ih264_buf_mgr_size:
   93|  4.69k|{
   94|  4.69k|    WORD32 size;
   95|       |
   96|  4.69k|    size = sizeof(buf_mgr_t);
   97|  4.69k|    size += ithread_get_mutex_lock_size();
   98|       |
   99|  4.69k|    return size;
  100|  4.69k|}
ih264_buf_mgr_lock:
  120|  34.7k|{
  121|  34.7k|    WORD32 retval;
  122|       |
  123|  34.7k|    retval = ithread_mutex_lock(ps_buf_mgr->pv_mutex);
  124|  34.7k|    if(retval)
  ------------------
  |  Branch (124:8): [True: 0, False: 34.7k]
  ------------------
  125|      0|        return IH264_FAIL;
  126|  34.7k|    return IH264_SUCCESS;
  127|  34.7k|}
ih264_buf_mgr_unlock:
  147|  34.7k|{
  148|  34.7k|    WORD32 retval;
  149|       |
  150|  34.7k|    retval = ithread_mutex_unlock(ps_buf_mgr->pv_mutex);
  151|  34.7k|    if(retval)
  ------------------
  |  Branch (151:8): [True: 0, False: 34.7k]
  ------------------
  152|      0|        return IH264_FAIL;
  153|  34.7k|    return IH264_SUCCESS;
  154|  34.7k|}
ih264_buf_mgr_free:
  211|    310|{
  212|    310|    WORD32 ret;
  213|       |
  214|    310|    ret = ithread_mutex_destroy(ps_buf_mgr->pv_mutex);
  215|    310|    if(0 == ret)
  ------------------
  |  Branch (215:8): [True: 310, False: 0]
  ------------------
  216|    310|        return IH264_SUCCESS;
  217|      0|    return IH264_FAIL;
  218|    310|}
ih264_buf_mgr_init:
  238|    320|{
  239|    320|    WORD32 id;
  240|    320|    UWORD8 *pu1_buf = (UWORD8 *)pv_buf;
  241|    320|    buf_mgr_t *ps_buf_mgr = (buf_mgr_t *)pu1_buf;
  242|       |
  243|    320|    pu1_buf += sizeof(buf_mgr_t);
  244|    320|    ps_buf_mgr->pv_mutex = pu1_buf;
  245|       |
  246|    320|    pu1_buf += ithread_get_mutex_lock_size();
  247|    320|    ithread_mutex_init(ps_buf_mgr->pv_mutex);
  248|       |
  249|    320|    ps_buf_mgr->i4_max_buf_cnt = BUF_MGR_MAX_CNT;
  ------------------
  |  |   44|    320|#define BUF_MGR_MAX_CNT 64
  ------------------
  250|    320|    ps_buf_mgr->i4_active_buf_cnt = 0;
  251|  20.8k|    for(id = 0; id < BUF_MGR_MAX_CNT; id++)
  ------------------
  |  |   44|  20.8k|#define BUF_MGR_MAX_CNT 64
  ------------------
  |  Branch (251:17): [True: 20.4k, False: 320]
  ------------------
  252|  20.4k|    {
  253|  20.4k|        ps_buf_mgr->au4_status[id] = 0;
  254|  20.4k|        ps_buf_mgr->apv_ptr[id] = NULL;
  255|  20.4k|    }
  256|       |
  257|    320|    return ps_buf_mgr;
  258|    320|}
ih264_buf_mgr_reset:
  278|  6.77k|{
  279|  6.77k|    WORD32 id;
  280|  6.77k|    buf_mgr_t *ps_buf_mgr;
  281|       |
  282|  6.77k|    ps_buf_mgr = (buf_mgr_t *) pv_buf_mgr;
  283|       |
  284|   440k|    for(id = 0; id < BUF_MGR_MAX_CNT; id++)
  ------------------
  |  |   44|   440k|#define BUF_MGR_MAX_CNT 64
  ------------------
  |  Branch (284:17): [True: 433k, False: 6.77k]
  ------------------
  285|   433k|    {
  286|   433k|        ps_buf_mgr->au4_status[id] = 0;
  287|   433k|    }
  288|       |
  289|  6.77k|    return;
  290|  6.77k|}
ih264_buf_mgr_add:
  320|  3.31k|{
  321|  3.31k|    IH264_ERROR_T ret = IH264_SUCCESS;
  322|       |
  323|  3.31k|    ret = ih264_buf_mgr_lock(ps_buf_mgr);
  324|  3.31k|    RETURN_IF((ret != IH264_SUCCESS), ret);
  ------------------
  |  |   44|  3.31k|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 3.31k]
  |  |  ------------------
  ------------------
  325|       |
  326|       |    /* Check if buffer ID is within allowed range */
  327|  3.31k|    if(buf_id >= ps_buf_mgr->i4_max_buf_cnt)
  ------------------
  |  Branch (327:8): [True: 0, False: 3.31k]
  ------------------
  328|      0|    {
  329|      0|        ret = ih264_buf_mgr_unlock(ps_buf_mgr);
  330|      0|        RETURN_IF((ret != IH264_SUCCESS), ret);
  ------------------
  |  |   44|      0|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  331|      0|        return IH264_FAIL;
  332|      0|    }
  333|       |
  334|       |    /* Check if the current ID is being used to hold some other buffer */
  335|  3.31k|    if((ps_buf_mgr->apv_ptr[buf_id] != NULL) &&
  ------------------
  |  Branch (335:8): [True: 0, False: 3.31k]
  ------------------
  336|      0|       (ps_buf_mgr->apv_ptr[buf_id] != pv_ptr))
  ------------------
  |  Branch (336:8): [True: 0, False: 0]
  ------------------
  337|      0|    {
  338|      0|        ret = ih264_buf_mgr_unlock(ps_buf_mgr);
  339|      0|        RETURN_IF((ret != IH264_SUCCESS), ret);
  ------------------
  |  |   44|      0|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  340|      0|        return IH264_FAIL;
  341|      0|    }
  342|  3.31k|    ps_buf_mgr->apv_ptr[buf_id] = pv_ptr;
  343|  3.31k|    ps_buf_mgr->i4_active_buf_cnt++;
  344|       |
  345|  3.31k|    ret = ih264_buf_mgr_unlock(ps_buf_mgr);
  346|  3.31k|    RETURN_IF((ret != IH264_SUCCESS), ret);
  ------------------
  |  |   44|  3.31k|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 3.31k]
  |  |  ------------------
  ------------------
  347|       |
  348|  3.31k|    return ret;
  349|  3.31k|}
ih264_buf_mgr_get_next_free:
  374|  8.23k|{
  375|  8.23k|    WORD32 id;
  376|  8.23k|    void *pv_ret_ptr = NULL;
  377|  8.23k|    IH264_ERROR_T ret = IH264_SUCCESS;
  378|       |
  379|  8.23k|    ret = ih264_buf_mgr_lock(ps_buf_mgr);
  380|  8.23k|    RETURN_IF((ret != IH264_SUCCESS), NULL);
  ------------------
  |  |   44|  8.23k|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 8.23k]
  |  |  ------------------
  ------------------
  381|       |
  382|  18.5k|    for(id = 0; id < ps_buf_mgr->i4_active_buf_cnt; id++)
  ------------------
  |  Branch (382:17): [True: 18.4k, False: 43]
  ------------------
  383|  18.4k|    {
  384|       |        /* Check if the buffer is non-null and status is zero */
  385|  18.4k|        if((ps_buf_mgr->au4_status[id] == 0) && (ps_buf_mgr->apv_ptr[id]))
  ------------------
  |  Branch (385:12): [True: 8.19k, False: 10.2k]
  |  Branch (385:49): [True: 8.19k, False: 0]
  ------------------
  386|  8.19k|        {
  387|  8.19k|            *pi4_buf_id = id;
  388|       |            /* mark buffer as busy before returning */
  389|  8.19k|            ps_buf_mgr->au4_status[id] = 1;
  390|  8.19k|            pv_ret_ptr = ps_buf_mgr->apv_ptr[id];
  391|  8.19k|            break;
  392|  8.19k|        }
  393|  18.4k|    }
  394|  8.23k|    ret = ih264_buf_mgr_unlock(ps_buf_mgr);
  395|  8.23k|    RETURN_IF((ret != IH264_SUCCESS), NULL);
  ------------------
  |  |   44|  8.23k|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 8.23k]
  |  |  ------------------
  ------------------
  396|       |
  397|  8.23k|    return pv_ret_ptr;
  398|  8.23k|}
ih264_buf_mgr_release:
  470|  14.0k|{
  471|  14.0k|    IH264_ERROR_T ret = IH264_SUCCESS;
  472|       |
  473|  14.0k|    ret = ih264_buf_mgr_lock(ps_buf_mgr);
  474|  14.0k|    RETURN_IF((ret != IH264_SUCCESS), ret);
  ------------------
  |  |   44|  14.0k|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 14.0k]
  |  |  ------------------
  ------------------
  475|       |
  476|       |    /* If the given id is pointing to an id which is not yet added */
  477|  14.0k|    if(buf_id >= ps_buf_mgr->i4_active_buf_cnt)
  ------------------
  |  Branch (477:8): [True: 3.40k, False: 10.6k]
  ------------------
  478|  3.40k|    {
  479|  3.40k|        ret = ih264_buf_mgr_unlock(ps_buf_mgr);
  480|  3.40k|        RETURN_IF((ret != IH264_SUCCESS), ret);
  ------------------
  |  |   44|  3.40k|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 3.40k]
  |  |  ------------------
  ------------------
  481|  3.40k|        return IH264_FAIL;
  482|  3.40k|    }
  483|       |
  484|  10.6k|    ps_buf_mgr->au4_status[buf_id] &= ~mask;
  485|       |
  486|       |    /* If both the REF and DISP are zero, DEC is set to zero */
  487|  10.6k|    if(ps_buf_mgr->au4_status[buf_id] == 1)
  ------------------
  |  Branch (487:8): [True: 5.16k, False: 5.44k]
  ------------------
  488|  5.16k|    {
  489|  5.16k|        ps_buf_mgr->au4_status[buf_id] = 0;
  490|  5.16k|    }
  491|       |
  492|  10.6k|    ret = ih264_buf_mgr_unlock(ps_buf_mgr);
  493|  10.6k|    RETURN_IF((ret != IH264_SUCCESS), ret);
  ------------------
  |  |   44|  10.6k|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 10.6k]
  |  |  ------------------
  ------------------
  494|       |
  495|  10.6k|    return ret;
  496|  10.6k|}
ih264_buf_mgr_set_status:
  525|  9.20k|{
  526|  9.20k|    IH264_ERROR_T ret = IH264_SUCCESS;
  527|       |
  528|  9.20k|    ret = ih264_buf_mgr_lock(ps_buf_mgr);
  529|  9.20k|    RETURN_IF((ret != IH264_SUCCESS), ret);
  ------------------
  |  |   44|  9.20k|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 9.20k]
  |  |  ------------------
  ------------------
  530|       |
  531|  9.20k|    if(buf_id >= ps_buf_mgr->i4_active_buf_cnt)
  ------------------
  |  Branch (531:8): [True: 0, False: 9.20k]
  ------------------
  532|      0|    {
  533|      0|        ret = ih264_buf_mgr_unlock(ps_buf_mgr);
  534|      0|        RETURN_IF((ret != IH264_SUCCESS), ret);
  ------------------
  |  |   44|      0|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  535|      0|        return IH264_FAIL;
  536|      0|    }
  537|       |
  538|  9.20k|    if((ps_buf_mgr->au4_status[buf_id] & mask) != 0)
  ------------------
  |  Branch (538:8): [True: 0, False: 9.20k]
  ------------------
  539|      0|    {
  540|      0|        ret = ih264_buf_mgr_unlock(ps_buf_mgr);
  541|      0|        RETURN_IF((ret != IH264_SUCCESS), ret);
  ------------------
  |  |   44|      0|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  542|      0|        return IH264_FAIL;
  543|      0|    }
  544|       |
  545|  9.20k|    ps_buf_mgr->au4_status[buf_id] |= mask;
  546|  9.20k|    ret = ih264_buf_mgr_unlock(ps_buf_mgr);
  547|  9.20k|    RETURN_IF((ret != IH264_SUCCESS), ret);
  ------------------
  |  |   44|  9.20k|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 9.20k]
  |  |  ------------------
  ------------------
  548|       |
  549|  9.20k|    return ret;
  550|  9.20k|}

ih264_intra_pred_chroma_8x8_mode_dc:
  118|  2.19k|{
  119|       |    /* availability of left predictors (only for DC) */
  120|  2.19k|    WORD32 left_avail, left_avail1, left_avail2;
  121|       |
  122|       |    /* availability of top predictors (only for DC) */
  123|  2.19k|    WORD32 top_avail;
  124|       |
  125|       |    /* Pointer to start of left predictors */
  126|  2.19k|    UWORD8 *pu1_left = NULL;
  127|       |
  128|       |    /* Pointer to start of top predictors */
  129|  2.19k|    UWORD8 *pu1_top = NULL;
  130|       |
  131|       |    /* temporary variables to store accumulated first left half, second left half,
  132|       |     * first top half, second top half of U and V values*/
  133|  2.19k|    WORD32 val_u_l1 = 0, val_u_l2 = 0, val_u_t1 = 0, val_u_t2 = 0;
  134|  2.19k|    WORD32 val_v_l1 = 0, val_v_l2 = 0, val_v_t1 = 0, val_v_t2 = 0;
  135|  2.19k|    WORD32 val_u1 = 0, val_u2 = 0, val_v1 = 0, val_v2 = 0;
  136|       |
  137|       |    /* temp */
  138|  2.19k|    WORD32 col, row;
  139|       |
  140|  2.19k|    UNUSED(src_strd);
  ------------------
  |  |   45|  2.19k|#define UNUSED(x) ((void)(x))
  ------------------
  141|  2.19k|    left_avail = ngbr_avail & 0x11;
  142|  2.19k|    left_avail1 = ngbr_avail & 1;
  143|  2.19k|    left_avail2 = (ngbr_avail >> 4) & 1;
  144|  2.19k|    top_avail = (ngbr_avail >> 2) & 1;
  145|       |
  146|  2.19k|    pu1_top = pu1_src + 2 * BLK8x8SIZE + 2;
  ------------------
  |  |  510|  2.19k|#define BLK8x8SIZE          8
  ------------------
  147|  2.19k|    pu1_left = pu1_src + 2 * BLK8x8SIZE - 2;
  ------------------
  |  |  510|  2.19k|#define BLK8x8SIZE          8
  ------------------
  148|       |
  149|  2.19k|    if(left_avail1)
  ------------------
  |  Branch (149:8): [True: 1.13k, False: 1.06k]
  ------------------
  150|  1.13k|    {
  151|       |        /* First 4x4 block */
  152|  1.13k|        val_u_l1 += *pu1_left;
  153|  1.13k|        val_v_l1 += *(pu1_left + 1);
  154|  1.13k|        pu1_left -= 2;
  155|  1.13k|        val_u_l1 += *pu1_left;
  156|  1.13k|        val_v_l1 += *(pu1_left + 1);
  157|  1.13k|        pu1_left -= 2;
  158|  1.13k|        val_u_l1 += *pu1_left;
  159|  1.13k|        val_v_l1 += *(pu1_left + 1);
  160|  1.13k|        pu1_left -= 2;
  161|  1.13k|        val_u_l1 += *pu1_left + 2;
  162|  1.13k|        val_v_l1 += *(pu1_left + 1) + 2;
  163|  1.13k|        pu1_left -= 2;
  164|  1.13k|    }
  165|  1.06k|    else
  166|  1.06k|    {
  167|  1.06k|        pu1_left -= 2 * 4;
  168|  1.06k|    }
  169|       |
  170|  2.19k|    if(left_avail2)
  ------------------
  |  Branch (170:8): [True: 1.13k, False: 1.06k]
  ------------------
  171|  1.13k|    {
  172|       |        /* Second 4x4 block */
  173|  1.13k|        val_u_l2 += *pu1_left;
  174|  1.13k|        val_v_l2 += *(pu1_left + 1);
  175|  1.13k|        pu1_left -= 2;
  176|  1.13k|        val_u_l2 += *pu1_left;
  177|  1.13k|        val_v_l2 += *(pu1_left + 1);
  178|  1.13k|        pu1_left -= 2;
  179|  1.13k|        val_u_l2 += *pu1_left;
  180|  1.13k|        val_v_l2 += *(pu1_left + 1);
  181|  1.13k|        pu1_left -= 2;
  182|  1.13k|        val_u_l2 += *pu1_left + 2;
  183|  1.13k|        val_v_l2 += *(pu1_left + 1) + 2;
  184|  1.13k|        pu1_left -= 2;
  185|  1.13k|    }
  186|  1.06k|    else
  187|  1.06k|    {
  188|  1.06k|        pu1_left -= 2 * 4;
  189|  1.06k|    }
  190|       |
  191|  2.19k|    if(top_avail)
  ------------------
  |  Branch (191:8): [True: 1.91k, False: 285]
  ------------------
  192|  1.91k|    {
  193|  1.91k|        val_u_t1 += *pu1_top + *(pu1_top + 2) + *(pu1_top + 4)
  194|  1.91k|                        + *(pu1_top + 6) + 2;
  195|  1.91k|        val_u_t2 += *(pu1_top + 8) + *(pu1_top + 10) + *(pu1_top + 12)
  196|  1.91k|                        + *(pu1_top + 14) + 2;
  197|  1.91k|        val_v_t1 += *(pu1_top + 1) + *(pu1_top + 3) + *(pu1_top + 5)
  198|  1.91k|                        + *(pu1_top + 7) + 2;
  199|  1.91k|        val_v_t2 += *(pu1_top + 9) + *(pu1_top + 11) + *(pu1_top + 13)
  200|  1.91k|                        + *(pu1_top + 15) + 2;
  201|  1.91k|    }
  202|       |
  203|  2.19k|    if(left_avail + top_avail)
  ------------------
  |  Branch (203:8): [True: 2.06k, False: 138]
  ------------------
  204|  2.06k|    {
  205|  2.06k|        val_u1 = (left_avail1 + top_avail) ?
  ------------------
  |  Branch (205:18): [True: 2.06k, False: 0]
  ------------------
  206|  2.06k|                        ((val_u_l1 + val_u_t1)
  207|  2.06k|                                        >> (1 + left_avail1 + top_avail)) :128;
  208|  2.06k|        val_v1 = (left_avail1 + top_avail) ?
  ------------------
  |  Branch (208:18): [True: 2.06k, False: 0]
  ------------------
  209|  2.06k|                        ((val_v_l1 + val_v_t1)
  210|  2.06k|                                        >> (1 + left_avail1 + top_avail)) :128;
  211|  2.06k|        if(top_avail)
  ------------------
  |  Branch (211:12): [True: 1.91k, False: 147]
  ------------------
  212|  1.91k|        {
  213|  1.91k|            val_u2 = val_u_t2 >> 2;
  214|  1.91k|            val_v2 = val_v_t2 >> 2;
  215|  1.91k|        }
  216|    147|        else if(left_avail1)
  ------------------
  |  Branch (216:17): [True: 147, False: 0]
  ------------------
  217|    147|        {
  218|    147|            val_u2 = val_u_l1 >> 2;
  219|    147|            val_v2 = val_v_l1 >> 2;
  220|    147|        }
  221|      0|        else
  222|      0|        {
  223|      0|            val_u2 = val_v2 = 128;
  224|      0|        }
  225|       |
  226|  10.3k|        for(row = 0; row < 4; row++)
  ------------------
  |  Branch (226:22): [True: 8.24k, False: 2.06k]
  ------------------
  227|  8.24k|        {
  228|       |            /* top left 4x4 block */
  229|  41.2k|            for(col = 0; col < 8; col += 2)
  ------------------
  |  Branch (229:26): [True: 32.9k, False: 8.24k]
  ------------------
  230|  32.9k|            {
  231|  32.9k|                *(pu1_dst + row * dst_strd + col) = val_u1;
  232|  32.9k|                *(pu1_dst + row * dst_strd + col + 1) = val_v1;
  233|  32.9k|            }
  234|       |            /* top right 4x4 block */
  235|  41.2k|            for(col = 8; col < 16; col += 2)
  ------------------
  |  Branch (235:26): [True: 32.9k, False: 8.24k]
  ------------------
  236|  32.9k|            {
  237|  32.9k|                *(pu1_dst + row * dst_strd + col) = val_u2;
  238|  32.9k|                *(pu1_dst + row * dst_strd + col + 1) = val_v2;
  239|  32.9k|            }
  240|  8.24k|        }
  241|       |
  242|  2.06k|        if(left_avail2)
  ------------------
  |  Branch (242:12): [True: 1.13k, False: 922]
  ------------------
  243|  1.13k|        {
  244|  1.13k|            val_u1 = val_u_l2 >> 2;
  245|  1.13k|            val_v1 = val_v_l2 >> 2;
  246|  1.13k|        }
  247|    922|        else if(top_avail)
  ------------------
  |  Branch (247:17): [True: 922, False: 0]
  ------------------
  248|    922|        {
  249|    922|            val_u1 = val_u_t1 >> 2;
  250|    922|            val_v1 = val_v_t1 >> 2;
  251|    922|        }
  252|      0|        else
  253|      0|        {
  254|      0|            val_u1 = val_v1 = 128;
  255|      0|        }
  256|  2.06k|        val_u2 = (left_avail2 + top_avail) ?
  ------------------
  |  Branch (256:18): [True: 2.06k, False: 0]
  ------------------
  257|  2.06k|                        ((val_u_l2 + val_u_t2)
  258|  2.06k|                                        >> (1 + left_avail2 + top_avail)) : 128;
  259|  2.06k|        val_v2 = (left_avail2 + top_avail) ?
  ------------------
  |  Branch (259:18): [True: 2.06k, False: 0]
  ------------------
  260|  2.06k|                        ((val_v_l2 + val_v_t2)
  261|  2.06k|                                        >> (1 + left_avail2 + top_avail)) :  128;
  262|       |
  263|  10.3k|        for(row = 4; row < 8; row++)
  ------------------
  |  Branch (263:22): [True: 8.24k, False: 2.06k]
  ------------------
  264|  8.24k|        {
  265|       |            /* bottom left 4x4 block */
  266|  41.2k|            for(col = 0; col < 8; col += 2)
  ------------------
  |  Branch (266:26): [True: 32.9k, False: 8.24k]
  ------------------
  267|  32.9k|            {
  268|  32.9k|                *(pu1_dst + row * dst_strd + col) = val_u1;
  269|  32.9k|                *(pu1_dst + row * dst_strd + col + 1) = val_v1;
  270|  32.9k|            }
  271|       |            /* bottom right 4x4 block */
  272|  41.2k|            for(col = 8; col < 16; col += 2)
  ------------------
  |  Branch (272:26): [True: 32.9k, False: 8.24k]
  ------------------
  273|  32.9k|            {
  274|  32.9k|                *(pu1_dst + row * dst_strd + col) = val_u2;
  275|  32.9k|                *(pu1_dst + row * dst_strd + col + 1) = val_v2;
  276|  32.9k|            }
  277|  8.24k|        }
  278|  2.06k|    }
  279|    138|    else
  280|    138|    {
  281|       |        /* Both left and top are unavailable, set the block to 128 */
  282|  1.24k|        for(row = 0; row < 8; row++)
  ------------------
  |  Branch (282:22): [True: 1.10k, False: 138]
  ------------------
  283|  1.10k|        {
  284|  1.10k|            memset(pu1_dst + row * dst_strd, 128, 8 * sizeof(UWORD16));
  285|  1.10k|        }
  286|    138|    }
  287|  2.19k|}
ih264_intra_pred_chroma_8x8_mode_horz:
  323|  3.20k|{
  324|       |    /* Pointer to start of left predictors */
  325|  3.20k|    UWORD8 *pu1_left = NULL;
  326|       |
  327|       |    /* temp */
  328|  3.20k|    WORD32 rows, cols;
  329|       |
  330|  3.20k|    UNUSED(src_strd);
  ------------------
  |  |   45|  3.20k|#define UNUSED(x) ((void)(x))
  ------------------
  331|  3.20k|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|  3.20k|#define UNUSED(x) ((void)(x))
  ------------------
  332|  3.20k|    pu1_left = pu1_src + 2 * BLK8x8SIZE - 2;
  ------------------
  |  |  510|  3.20k|#define BLK8x8SIZE          8
  ------------------
  333|  28.8k|    for(rows = 0; rows < 8; rows++)
  ------------------
  |  Branch (333:19): [True: 25.6k, False: 3.20k]
  ------------------
  334|  25.6k|    {
  335|   230k|        for(cols = 0; cols < 16; cols += 2)
  ------------------
  |  Branch (335:23): [True: 204k, False: 25.6k]
  ------------------
  336|   204k|        {
  337|   204k|            *(pu1_dst + rows * dst_strd + cols) = *pu1_left;
  338|   204k|            *(pu1_dst + rows * dst_strd + cols + 1) = *(pu1_left + 1);
  339|   204k|        }
  340|  25.6k|        pu1_left -= 2;
  341|  25.6k|    }
  342|  3.20k|}
ih264_intra_pred_chroma_8x8_mode_vert:
  379|  2.95k|{
  380|       |    /* Pointer to start of top predictors */
  381|  2.95k|    UWORD8 *pu1_top = NULL;
  382|       |
  383|       |    /* temp */
  384|  2.95k|    WORD32 row;
  385|       |
  386|  2.95k|    UNUSED(src_strd);
  ------------------
  |  |   45|  2.95k|#define UNUSED(x) ((void)(x))
  ------------------
  387|  2.95k|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|  2.95k|#define UNUSED(x) ((void)(x))
  ------------------
  388|  2.95k|    pu1_top = pu1_src + 2 * BLK8x8SIZE + 2;
  ------------------
  |  |  510|  2.95k|#define BLK8x8SIZE          8
  ------------------
  389|       |
  390|       |    /* 8 bytes are copied from src to dst */
  391|  8.86k|    for(row = 0; row < 2; row++)
  ------------------
  |  Branch (391:18): [True: 5.90k, False: 2.95k]
  ------------------
  392|  5.90k|    {
  393|  5.90k|        memcpy(pu1_dst, pu1_top, 16);
  394|       |
  395|  5.90k|        pu1_dst += dst_strd;
  396|  5.90k|        memcpy(pu1_dst, pu1_top, 16);
  397|       |
  398|  5.90k|        pu1_dst += dst_strd;
  399|  5.90k|        memcpy(pu1_dst, pu1_top, 16);
  400|       |
  401|  5.90k|        pu1_dst += dst_strd;
  402|  5.90k|        memcpy(pu1_dst, pu1_top, 16);
  403|       |
  404|  5.90k|        pu1_dst += dst_strd;
  405|  5.90k|    }
  406|  2.95k|}
ih264_intra_pred_chroma_8x8_mode_plane:
  443|    367|{
  444|       |    /* Pointer to start of left predictors */
  445|    367|    UWORD8 *pu1_left = NULL;
  446|       |
  447|       |    /* Pointer to start of top predictors */
  448|    367|    UWORD8 *pu1_top = NULL;
  449|       |
  450|       |    /* temp */
  451|    367|    WORD32 val = 0;
  452|    367|    WORD32 rows, cols;
  453|       |
  454|       |    /* Implementing section 8.3.4.4. The variables represent the corresponding
  455|       |     * variables in the section */
  456|    367|    WORD32 a_u, b_u, c_u, h_u, v_u;
  457|    367|    WORD32 a_v, b_v, c_v, h_v, v_v;
  458|       |
  459|    367|    UNUSED(src_strd);
  ------------------
  |  |   45|    367|#define UNUSED(x) ((void)(x))
  ------------------
  460|    367|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    367|#define UNUSED(x) ((void)(x))
  ------------------
  461|    367|    a_u = b_u = c_u = h_u = v_u = 0;
  462|    367|    a_v = b_v = c_v = h_v = v_v = 0;
  463|       |
  464|    367|    pu1_top = pu1_src + 2 * BLK8x8SIZE + 2;
  ------------------
  |  |  510|    367|#define BLK8x8SIZE          8
  ------------------
  465|    367|    pu1_left = pu1_src + 2 * BLK8x8SIZE - 2;
  ------------------
  |  |  510|    367|#define BLK8x8SIZE          8
  ------------------
  466|       |
  467|  1.83k|    for(cols = 0; cols < 4; cols++)
  ------------------
  |  Branch (467:19): [True: 1.46k, False: 367]
  ------------------
  468|  1.46k|    {
  469|  1.46k|        h_u += (cols + 1) * (pu1_top[8 + 2 * cols] - pu1_top[4 - 2 * cols]);
  470|  1.46k|        h_v += (cols + 1) * (pu1_top[8 + 2 * cols + 1] - pu1_top[4 - 2 * cols+ 1]);
  471|       |
  472|  1.46k|        v_u += (cols + 1) * (pu1_left[(4 + cols) * (-2)] - pu1_left[(2 - cols) * (-2)]);
  473|  1.46k|        v_v += (cols + 1)  * (pu1_left[(4 + cols) * (-2) + 1]  - pu1_left[(2 - cols) * (-2) + 1]);
  474|  1.46k|    }
  475|    367|    a_u = 16 * (pu1_left[7 * (-2)] + pu1_top[14]);
  476|    367|    a_v = 16 * (pu1_left[7 * (-2) + 1] + pu1_top[15]);
  477|    367|    b_u = (34 * h_u + 32) >> 6;
  478|    367|    b_v = (34 * h_v + 32) >> 6;
  479|    367|    c_u = (34 * v_u + 32) >> 6;
  480|    367|    c_v = (34 * v_v + 32) >> 6;
  481|       |
  482|  3.30k|    for(rows = 0; rows < 8; rows++)
  ------------------
  |  Branch (482:19): [True: 2.93k, False: 367]
  ------------------
  483|  2.93k|    {
  484|  26.4k|        for(cols = 0; cols < 8; cols++)
  ------------------
  |  Branch (484:23): [True: 23.4k, False: 2.93k]
  ------------------
  485|  23.4k|        {
  486|  23.4k|            val = (a_u + b_u * (cols - 3) + c_u * (rows - 3) );
  487|  23.4k|            val = (val + 16) >> 5;
  488|  23.4k|            *(pu1_dst + rows * dst_strd + 2 * cols) = CLIP_U8(val);
  ------------------
  |  |   58|  23.4k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  23.4k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 894, False: 22.5k]
  |  |  |  |  |  Branch (77:54): [True: 361, False: 22.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  489|  23.4k|            val = (a_v + b_v * (cols - 3) + c_v * (rows - 3) );
  490|  23.4k|            val = (val + 16) >> 5;
  491|  23.4k|            *(pu1_dst + rows * dst_strd + 2 * cols + 1) = CLIP_U8(val);
  ------------------
  |  |   58|  23.4k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  23.4k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 604, False: 22.8k]
  |  |  |  |  |  Branch (77:54): [True: 220, False: 22.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  492|  23.4k|        }
  493|  2.93k|    }
  494|    367|}

ih264_deblk_luma_vert_bs4:
  108|  6.00k|{
  109|  6.00k|    UWORD8 p3, p2, p1, p0, q0, q1, q2, q3;
  110|  6.00k|    WORD32 pos_p3, pos_p2, pos_p1, pos_p0;
  111|  6.00k|    WORD32 pos_q0, pos_q1, pos_q2,pos_q3;
  112|  6.00k|    UWORD8 a_p, a_q; /* threshold variables */
  113|  6.00k|    WORD32 blk_strd = src_strd << 2; /* block_increment = src_strd * 4 */
  114|  6.00k|    UWORD8 *pu1_src_temp;
  115|  6.00k|    WORD8 i = 0, edge;
  116|       |
  117|  6.00k|    pos_q0 = 0;
  118|  6.00k|    pos_q1 = 1;
  119|  6.00k|    pos_q2 = 2;
  120|  6.00k|    pos_q3 = 3;
  121|  6.00k|    pos_p0 = -1;
  122|  6.00k|    pos_p1 = -2;
  123|  6.00k|    pos_p2 = -3;
  124|  6.00k|    pos_p3 = -4;
  125|       |
  126|  30.0k|    for(edge = 0; edge < 4; edge++, pu1_src += blk_strd)
  ------------------
  |  Branch (126:19): [True: 24.0k, False: 6.00k]
  ------------------
  127|  24.0k|    {
  128|  24.0k|        pu1_src_temp = pu1_src;
  129|   120k|        for(i = 0; i < 4; ++i, pu1_src_temp += src_strd)
  ------------------
  |  Branch (129:20): [True: 96.0k, False: 24.0k]
  ------------------
  130|  96.0k|        {
  131|  96.0k|            q0 = pu1_src_temp[pos_q0];
  132|  96.0k|            q1 = pu1_src_temp[pos_q1];
  133|  96.0k|            p0 = pu1_src_temp[pos_p0];
  134|  96.0k|            p1 = pu1_src_temp[pos_p1];
  135|       |
  136|       |            /* Filter Decision */
  137|  96.0k|            if((ABS(p0 - q0) >= alpha) ||
  ------------------
  |  |  100|  96.0k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 35.6k, False: 60.3k]
  |  |  ------------------
  ------------------
  |  Branch (137:16): [True: 32.2k, False: 63.7k]
  ------------------
  138|  63.7k|               (ABS(q1 - q0) >= beta)  ||
  ------------------
  |  |  100|  63.7k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 14.8k, False: 48.8k]
  |  |  ------------------
  ------------------
  |  Branch (138:16): [True: 13.6k, False: 50.1k]
  ------------------
  139|  50.1k|               (ABS(p1 - p0) >= beta))
  ------------------
  |  |  100|  50.1k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 9.10k, False: 40.9k]
  |  |  ------------------
  ------------------
  |  Branch (139:16): [True: 4.41k, False: 45.6k]
  ------------------
  140|  50.3k|                continue;
  141|       |
  142|  45.6k|            p2 = pu1_src_temp[pos_p2];
  143|  45.6k|            p3 = pu1_src_temp[pos_p3];
  144|  45.6k|            q2 = pu1_src_temp[pos_q2];
  145|  45.6k|            q3 = pu1_src_temp[pos_q3];
  146|       |
  147|  45.6k|            if(ABS(p0 - q0) < ((alpha >> 2) + 2))
  ------------------
  |  |  100|  45.6k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 14.6k, False: 31.0k]
  |  |  ------------------
  ------------------
  |  Branch (147:16): [True: 38.7k, False: 6.93k]
  ------------------
  148|  38.7k|            {
  149|       |                /* Threshold Variables */
  150|  38.7k|                a_p = (UWORD8)ABS(p2 - p0);
  ------------------
  |  |  100|  38.7k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 11.5k, False: 27.1k]
  |  |  ------------------
  ------------------
  151|  38.7k|                a_q = (UWORD8)ABS(q2 - q0);
  ------------------
  |  |  100|  38.7k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 6.61k, False: 32.1k]
  |  |  ------------------
  ------------------
  152|       |
  153|  38.7k|                if(a_p < beta)
  ------------------
  |  Branch (153:20): [True: 36.6k, False: 2.10k]
  ------------------
  154|  36.6k|                {
  155|       |                    /* p0', p1', p2' */
  156|  36.6k|                    pu1_src_temp[pos_p0] = ((p2 + X2(p1) + X2(p0) + X2(q0) + q1
  ------------------
  |  |   91|  36.6k|#define X2(a)   ((a) << 1)
  ------------------
                                  pu1_src_temp[pos_p0] = ((p2 + X2(p1) + X2(p0) + X2(q0) + q1
  ------------------
  |  |   91|  36.6k|#define X2(a)   ((a) << 1)
  ------------------
                                  pu1_src_temp[pos_p0] = ((p2 + X2(p1) + X2(p0) + X2(q0) + q1
  ------------------
  |  |   91|  36.6k|#define X2(a)   ((a) << 1)
  ------------------
  157|  36.6k|                                    + 4) >> 3);
  158|  36.6k|                    pu1_src_temp[pos_p1] = ((p2 + p1 + p0 + q0 + 2) >> 2);
  159|  36.6k|                    pu1_src_temp[pos_p2] =
  160|  36.6k|                                    ((X2(p3) + X3(p2) + p1 + p0 + q0
  ------------------
  |  |   91|  36.6k|#define X2(a)   ((a) << 1)
  ------------------
                                                  ((X2(p3) + X3(p2) + p1 + p0 + q0
  ------------------
  |  |   92|  36.6k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  161|  36.6k|                                                    + 4) >> 3);
  162|  36.6k|                }
  163|  2.10k|                else
  164|  2.10k|                {
  165|       |                    /* p0'*/
  166|  2.10k|                    pu1_src_temp[pos_p0] = ((X2(p1) + p0 + q1 + 2) >> 2);
  ------------------
  |  |   91|  2.10k|#define X2(a)   ((a) << 1)
  ------------------
  167|  2.10k|                }
  168|       |
  169|  38.7k|                if(a_q < beta)
  ------------------
  |  Branch (169:20): [True: 37.4k, False: 1.27k]
  ------------------
  170|  37.4k|                {
  171|       |                    /* q0', q1', q2' */
  172|  37.4k|                    pu1_src_temp[pos_q0] = (p1 + X2(p0) + X2(q0) + X2(q1) + q2
  ------------------
  |  |   91|  37.4k|#define X2(a)   ((a) << 1)
  ------------------
                                  pu1_src_temp[pos_q0] = (p1 + X2(p0) + X2(q0) + X2(q1) + q2
  ------------------
  |  |   91|  37.4k|#define X2(a)   ((a) << 1)
  ------------------
                                  pu1_src_temp[pos_q0] = (p1 + X2(p0) + X2(q0) + X2(q1) + q2
  ------------------
  |  |   91|  37.4k|#define X2(a)   ((a) << 1)
  ------------------
  173|  37.4k|                                    + 4) >> 3;
  174|  37.4k|                    pu1_src_temp[pos_q1] = (p0 + q0 + q1 + q2 + 2) >> 2;
  175|  37.4k|                    pu1_src_temp[pos_q2] = (X2(q3) + X3(q2) + q1 + q0 + p0 + 4)
  ------------------
  |  |   91|  37.4k|#define X2(a)   ((a) << 1)
  ------------------
                                  pu1_src_temp[pos_q2] = (X2(q3) + X3(q2) + q1 + q0 + p0 + 4)
  ------------------
  |  |   92|  37.4k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  176|  37.4k|                                    >> 3;
  177|  37.4k|                }
  178|  1.27k|                else
  179|  1.27k|                {
  180|       |                    /* q0'*/
  181|  1.27k|                    pu1_src_temp[pos_q0] = (X2(q1) + q0 + p1 + 2) >> 2;
  ------------------
  |  |   91|  1.27k|#define X2(a)   ((a) << 1)
  ------------------
  182|  1.27k|                }
  183|  38.7k|            }
  184|  6.93k|            else
  185|  6.93k|            {
  186|       |                /* p0', q0'*/
  187|  6.93k|                pu1_src_temp[pos_p0] = ((X2(p1) + p0 + q1 + 2) >> 2);
  ------------------
  |  |   91|  6.93k|#define X2(a)   ((a) << 1)
  ------------------
  188|  6.93k|                pu1_src_temp[pos_q0] = (X2(q1) + q0 + p1 + 2) >> 2;
  ------------------
  |  |   91|  6.93k|#define X2(a)   ((a) << 1)
  ------------------
  189|  6.93k|            }
  190|  45.6k|        }
  191|  24.0k|    }
  192|  6.00k|}
ih264_deblk_luma_horz_bs4:
  226|  9.53k|{
  227|  9.53k|    UWORD8 p3, p2, p1, p0, q0, q1, q2, q3;
  228|  9.53k|    WORD32 pos_p3, pos_p2, pos_p1, pos_p0, pos_q0, pos_q1,
  229|  9.53k|                    pos_q2, pos_q3;
  230|  9.53k|    UWORD8 a_p, a_q; /* threshold variables */
  231|  9.53k|    UWORD8 *pu1_p3; /* pointer to the src sample p3 */
  232|  9.53k|    UWORD8 *pu1_p3_temp;
  233|  9.53k|    UWORD8 *pu1_src_temp;
  234|  9.53k|    WORD8 i = 0, edge;
  235|       |
  236|  9.53k|    pu1_p3 = pu1_src - (src_strd << 2);
  237|  9.53k|    pos_q0 = 0;
  238|  9.53k|    pos_q1 = src_strd;
  239|  9.53k|    pos_q2 = X2(src_strd);
  ------------------
  |  |   91|  9.53k|#define X2(a)   ((a) << 1)
  ------------------
  240|  9.53k|    pos_q3 = X3(src_strd);
  ------------------
  |  |   92|  9.53k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  241|  9.53k|    pos_p0 = X3(src_strd);
  ------------------
  |  |   92|  9.53k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  242|  9.53k|    pos_p1 = X2(src_strd);
  ------------------
  |  |   91|  9.53k|#define X2(a)   ((a) << 1)
  ------------------
  243|  9.53k|    pos_p2 = src_strd;
  244|  9.53k|    pos_p3 = 0;
  245|       |
  246|  47.6k|    for(edge = 0; edge < 4; edge++, pu1_src += 4, pu1_p3 += 4)
  ------------------
  |  Branch (246:19): [True: 38.1k, False: 9.53k]
  ------------------
  247|  38.1k|    {
  248|  38.1k|        pu1_src_temp = pu1_src;
  249|  38.1k|        pu1_p3_temp = pu1_p3;
  250|   190k|        for(i = 0; i < 4; ++i, pu1_src_temp++, pu1_p3_temp++)
  ------------------
  |  Branch (250:20): [True: 152k, False: 38.1k]
  ------------------
  251|   152k|        {
  252|   152k|            q0 = pu1_src_temp[pos_q0];
  253|   152k|            q1 = pu1_src_temp[pos_q1];
  254|   152k|            p0 = pu1_p3_temp[pos_p0];
  255|   152k|            p1 = pu1_p3_temp[pos_p1];
  256|       |
  257|       |            /* Filter Decision */
  258|   152k|            if((ABS(p0 - q0) >= alpha) ||
  ------------------
  |  |  100|   152k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 52.7k, False: 99.8k]
  |  |  ------------------
  ------------------
  |  Branch (258:16): [True: 45.0k, False: 107k]
  ------------------
  259|   107k|               (ABS(q1 - q0) >= beta) ||
  ------------------
  |  |  100|   107k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 26.0k, False: 81.4k]
  |  |  ------------------
  ------------------
  |  Branch (259:16): [True: 14.7k, False: 92.8k]
  ------------------
  260|  92.8k|               (ABS(p1 - p0) >= beta))
  ------------------
  |  |  100|  92.8k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 19.2k, False: 73.5k]
  |  |  ------------------
  ------------------
  |  Branch (260:16): [True: 14.4k, False: 78.3k]
  ------------------
  261|  74.2k|                continue;
  262|       |
  263|  78.3k|            p2 = pu1_p3_temp[pos_p2];
  264|  78.3k|            p3 = pu1_p3_temp[pos_p3];
  265|  78.3k|            q2 = pu1_src_temp[pos_q2];
  266|  78.3k|            q3 = pu1_src_temp[pos_q3];
  267|       |
  268|  78.3k|            if(ABS(p0 - q0) < ((alpha >> 2) + 2))
  ------------------
  |  |  100|  78.3k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 23.3k, False: 54.9k]
  |  |  ------------------
  ------------------
  |  Branch (268:16): [True: 68.4k, False: 9.89k]
  ------------------
  269|  68.4k|            {
  270|       |                /* Threshold Variables */
  271|  68.4k|                a_p = ABS(p2 - p0);
  ------------------
  |  |  100|  68.4k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 13.4k, False: 54.9k]
  |  |  ------------------
  ------------------
  272|  68.4k|                a_q = ABS(q2 - q0);
  ------------------
  |  |  100|  68.4k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 11.9k, False: 56.4k]
  |  |  ------------------
  ------------------
  273|       |
  274|  68.4k|                if((a_p < beta))
  ------------------
  |  Branch (274:20): [True: 64.2k, False: 4.18k]
  ------------------
  275|  64.2k|                {
  276|       |                    /* p0', p1', p2' */
  277|  64.2k|                    pu1_p3_temp[pos_p0] = (p2 + X2(p1) + X2(p0) + X2(q0) + q1
  ------------------
  |  |   91|  64.2k|#define X2(a)   ((a) << 1)
  ------------------
                                  pu1_p3_temp[pos_p0] = (p2 + X2(p1) + X2(p0) + X2(q0) + q1
  ------------------
  |  |   91|  64.2k|#define X2(a)   ((a) << 1)
  ------------------
                                  pu1_p3_temp[pos_p0] = (p2 + X2(p1) + X2(p0) + X2(q0) + q1
  ------------------
  |  |   91|  64.2k|#define X2(a)   ((a) << 1)
  ------------------
  278|  64.2k|                                    + 4) >> 3;
  279|  64.2k|                    pu1_p3_temp[pos_p1] = (p2 + p1 + p0 + q0 + 2) >> 2;
  280|  64.2k|                    pu1_p3_temp[pos_p2] =
  281|  64.2k|                                    (X2(p3) + X3(p2) + p1 + p0 + q0
  ------------------
  |  |   91|  64.2k|#define X2(a)   ((a) << 1)
  ------------------
                                                  (X2(p3) + X3(p2) + p1 + p0 + q0
  ------------------
  |  |   92|  64.2k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  282|  64.2k|                                                    + 4) >> 3;
  283|  64.2k|                }
  284|  4.18k|                else
  285|  4.18k|                {
  286|       |                    /* p0'*/
  287|  4.18k|                    pu1_p3_temp[pos_p0] = (X2(p1) + p0 + q1 + 2) >> 2;
  ------------------
  |  |   91|  4.18k|#define X2(a)   ((a) << 1)
  ------------------
  288|  4.18k|                }
  289|       |
  290|  68.4k|                if(a_q < beta)
  ------------------
  |  Branch (290:20): [True: 64.6k, False: 3.75k]
  ------------------
  291|  64.6k|                {
  292|       |                    /* q0', q1', q2' */
  293|  64.6k|                    pu1_src_temp[pos_q0] = (p1 + X2(p0) + X2(q0) + X2(q1)
  ------------------
  |  |   91|  64.6k|#define X2(a)   ((a) << 1)
  ------------------
                                  pu1_src_temp[pos_q0] = (p1 + X2(p0) + X2(q0) + X2(q1)
  ------------------
  |  |   91|  64.6k|#define X2(a)   ((a) << 1)
  ------------------
                                  pu1_src_temp[pos_q0] = (p1 + X2(p0) + X2(q0) + X2(q1)
  ------------------
  |  |   91|  64.6k|#define X2(a)   ((a) << 1)
  ------------------
  294|  64.6k|                                    + q2 + 4) >> 3;
  295|  64.6k|                    pu1_src_temp[pos_q1] = (p0 + q0 + q1 + q2 + 2) >> 2;
  296|  64.6k|                    pu1_src_temp[pos_q2] = (X2(q3) + X3(q2) + q1 + q0 + p0
  ------------------
  |  |   91|  64.6k|#define X2(a)   ((a) << 1)
  ------------------
                                  pu1_src_temp[pos_q2] = (X2(q3) + X3(q2) + q1 + q0 + p0
  ------------------
  |  |   92|  64.6k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  297|  64.6k|                                    + 4) >> 3;
  298|  64.6k|                }
  299|  3.75k|                else
  300|  3.75k|                {
  301|       |                    /* q0'*/
  302|  3.75k|                    pu1_src_temp[pos_q0] = (X2(q1) + q0 + p1 + 2) >> 2;
  ------------------
  |  |   91|  3.75k|#define X2(a)   ((a) << 1)
  ------------------
  303|  3.75k|                }
  304|  68.4k|            }
  305|  9.89k|            else
  306|  9.89k|            {
  307|       |                /* p0', q0'*/
  308|  9.89k|                pu1_p3_temp[pos_p0] = (X2(p1) + p0 + q1 + 2) >> 2;
  ------------------
  |  |   91|  9.89k|#define X2(a)   ((a) << 1)
  ------------------
  309|  9.89k|                pu1_src_temp[pos_q0] = (X2(q1) + q0 + p1 + 2) >> 2;
  ------------------
  |  |   91|  9.89k|#define X2(a)   ((a) << 1)
  ------------------
  310|  9.89k|            }
  311|  78.3k|        }
  312|  38.1k|    }
  313|  9.53k|}
ih264_deblk_luma_vert_bslt4:
  538|  58.8k|{
  539|  58.8k|    WORD8 i = 0, edge;
  540|  58.8k|    UWORD8 p2, p1, p0, q0, q1, q2;
  541|  58.8k|    WORD32 pos_p2, pos_p1, pos_p0, pos_q0, pos_q1, pos_q2;
  542|  58.8k|    UWORD8 a_p, a_q; /* threshold variables */
  543|  58.8k|    WORD32 blk_strd = src_strd << 2; /* block_increment = src_strd * 4 */
  544|  58.8k|    UWORD8 *pu1_src_temp;
  545|  58.8k|    WORD8 delta;
  546|  58.8k|    WORD8 tc;
  547|  58.8k|    WORD16 val;
  548|  58.8k|    UWORD8 tc0, u1_bs;
  549|       |
  550|  58.8k|    pos_q0 = 0;
  551|  58.8k|    pos_q1 = 1;
  552|  58.8k|    pos_q2 = 2;
  553|  58.8k|    pos_p0 = -1;
  554|  58.8k|    pos_p1 = -2;
  555|  58.8k|    pos_p2 = -3;
  556|       |
  557|   294k|    for(edge = 0; edge < 4; edge++, pu1_src += blk_strd)
  ------------------
  |  Branch (557:19): [True: 235k, False: 58.8k]
  ------------------
  558|   235k|    {
  559|   235k|        pu1_src_temp = pu1_src;
  560|       |        /* Filter Decision */
  561|   235k|        u1_bs = (UWORD8)((u4_bs >> ((3 - edge) << 3)) & 0x0ff);
  562|   235k|        if(!u1_bs)
  ------------------
  |  Branch (562:12): [True: 15.7k, False: 219k]
  ------------------
  563|  15.7k|            continue;
  564|       |        /* tc0 */
  565|   219k|        tc0 = pu1_cliptab[u1_bs];
  566|  1.09M|        for(i = 0; i < 4; ++i, pu1_src_temp += src_strd)
  ------------------
  |  Branch (566:20): [True: 878k, False: 219k]
  ------------------
  567|   878k|        {
  568|   878k|            q0 = pu1_src_temp[pos_q0];
  569|   878k|            q1 = pu1_src_temp[pos_q1];
  570|   878k|            p0 = pu1_src_temp[pos_p0];
  571|   878k|            p1 = pu1_src_temp[pos_p1];
  572|       |
  573|       |            /* Filter Decision */
  574|   878k|            if((ABS(p0 - q0) >= alpha) ||
  ------------------
  |  |  100|   878k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 276k, False: 601k]
  |  |  ------------------
  ------------------
  |  Branch (574:16): [True: 236k, False: 641k]
  ------------------
  575|   641k|               (ABS(q1 - q0) >= beta) ||
  ------------------
  |  |  100|   641k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 140k, False: 501k]
  |  |  ------------------
  ------------------
  |  Branch (575:16): [True: 167k, False: 473k]
  ------------------
  576|   473k|               (ABS(p1 - p0) >= beta))
  ------------------
  |  |  100|   473k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 83.6k, False: 390k]
  |  |  ------------------
  ------------------
  |  Branch (576:16): [True: 67.5k, False: 406k]
  ------------------
  577|   471k|                continue;
  578|       |
  579|   406k|            q2 = pu1_src_temp[pos_q2];
  580|   406k|            p2 = pu1_src_temp[pos_p2];
  581|       |
  582|   406k|            a_p = ABS(p2 - p0);
  ------------------
  |  |  100|   406k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 68.3k, False: 337k]
  |  |  ------------------
  ------------------
  583|   406k|            a_q = ABS(q2 - q0);
  ------------------
  |  |  100|   406k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 58.4k, False: 347k]
  |  |  ------------------
  ------------------
  584|       |
  585|       |            /* tc */
  586|   406k|            tc = tc0 + (a_p < beta) + (a_q < beta);
  587|       |
  588|   406k|            val = ((((q0 - p0) << 2) + (p1 - q1) + 4) >> 3);
  589|   406k|            delta = CLIP3(-tc, tc, val);
  ------------------
  |  |   77|   406k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 11.6k, False: 394k]
  |  |  |  Branch (77:54): [True: 11.5k, False: 382k]
  |  |  ------------------
  ------------------
  590|       |
  591|       |            /* p0' */
  592|   406k|            val = p0 + delta;
  593|   406k|            pu1_src_temp[pos_p0] = CLIP_U8(val);
  ------------------
  |  |   58|   406k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   406k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 248, False: 405k]
  |  |  |  |  |  Branch (77:54): [True: 6.44k, False: 399k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  594|       |            /* q0' */
  595|   406k|            val = q0 - delta;
  596|   406k|            pu1_src_temp[pos_q0] = CLIP_U8(val);
  ------------------
  |  |   58|   406k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   406k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 524, False: 405k]
  |  |  |  |  |  Branch (77:54): [True: 54, False: 405k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  597|       |
  598|       |            /* Luma only */
  599|   406k|            if(a_p < beta)
  ------------------
  |  Branch (599:16): [True: 374k, False: 31.1k]
  ------------------
  600|   374k|            {
  601|       |                /* p1' */
  602|   374k|                val = ((p2 + ((p0 + q0 + 1) >> 1) - (p1 << 1)) >> 1);
  603|   374k|                pu1_src_temp[pos_p1] += CLIP3(-tc0, tc0, val);
  ------------------
  |  |   77|   374k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 26.2k, False: 348k]
  |  |  |  Branch (77:54): [True: 18.6k, False: 330k]
  |  |  ------------------
  ------------------
  604|   374k|            }
  605|       |
  606|   406k|            if(a_q < beta)
  ------------------
  |  Branch (606:16): [True: 377k, False: 28.7k]
  ------------------
  607|   377k|            {
  608|       |                /* q1' */
  609|   377k|                val = ((q2 + ((p0 + q0 + 1) >> 1) - (q1 << 1)) >> 1);
  610|   377k|                pu1_src_temp[pos_q1] += CLIP3(-tc0, tc0, val);
  ------------------
  |  |   77|   377k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 21.4k, False: 355k]
  |  |  |  Branch (77:54): [True: 25.5k, False: 330k]
  |  |  ------------------
  ------------------
  611|   377k|            }
  612|   406k|        }
  613|   219k|    }
  614|  58.8k|}
ih264_deblk_luma_horz_bslt4:
  772|  62.8k|{
  773|  62.8k|    UWORD8 p2, p1, p0, q0, q1, q2;
  774|  62.8k|    WORD32 pos_p2, pos_p1, pos_p0, pos_q0, pos_q1, pos_q2;
  775|  62.8k|    UWORD8 a_p, a_q; /* Threshold variables */
  776|  62.8k|    UWORD8 *pu1_p2; /* Pointer to the src sample p2 */
  777|  62.8k|    UWORD8 *pu1_p2_temp;
  778|  62.8k|    UWORD8 *pu1_src_temp;
  779|  62.8k|    WORD8 i = 0, edge;
  780|  62.8k|    WORD8 delta;
  781|  62.8k|    WORD8 tc;
  782|  62.8k|    WORD16 val;
  783|  62.8k|    UWORD8 tc0, u1_bs;
  784|       |
  785|  62.8k|    pu1_p2 = pu1_src - (src_strd << 2);
  786|  62.8k|    pos_q0 = 0;
  787|  62.8k|    pos_q1 = src_strd;
  788|  62.8k|    pos_q2 = X2(src_strd);
  ------------------
  |  |   91|  62.8k|#define X2(a)   ((a) << 1)
  ------------------
  789|  62.8k|    pos_p0 = X3(src_strd);
  ------------------
  |  |   92|  62.8k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  790|  62.8k|    pos_p1 = X2(src_strd);
  ------------------
  |  |   91|  62.8k|#define X2(a)   ((a) << 1)
  ------------------
  791|  62.8k|    pos_p2 = src_strd;
  792|       |
  793|   314k|    for(edge = 0; edge < 4; edge++, pu1_src += 4, pu1_p2 += 4)
  ------------------
  |  Branch (793:19): [True: 251k, False: 62.8k]
  ------------------
  794|   251k|    {
  795|   251k|        pu1_src_temp = pu1_src;
  796|   251k|        pu1_p2_temp = pu1_p2;
  797|       |
  798|       |        /* Filter Decision */
  799|   251k|        u1_bs = (UWORD8)((u4_bs >> ((3 - edge) << 3)) & 0x0ff);
  800|   251k|        if(!u1_bs)
  ------------------
  |  Branch (800:12): [True: 14.2k, False: 237k]
  ------------------
  801|  14.2k|            continue;
  802|       |        /* tc0 */
  803|   237k|        tc0 = pu1_cliptab[u1_bs];
  804|       |
  805|  1.18M|        for(i = 0; i < 4; ++i, pu1_src_temp++, pu1_p2_temp++)
  ------------------
  |  Branch (805:20): [True: 948k, False: 237k]
  ------------------
  806|   948k|        {
  807|   948k|            q0 = pu1_src_temp[pos_q0];
  808|   948k|            q1 = pu1_src_temp[pos_q1];
  809|   948k|            p0 = pu1_p2_temp[pos_p0];
  810|   948k|            p1 = pu1_p2_temp[pos_p1];
  811|       |
  812|       |            /* Filter Decision */
  813|   948k|            if((ABS(p0 - q0) >= alpha) ||
  ------------------
  |  |  100|   948k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 299k, False: 649k]
  |  |  ------------------
  ------------------
  |  Branch (813:16): [True: 263k, False: 685k]
  ------------------
  814|   685k|               (ABS(q1 - q0) >= beta) ||
  ------------------
  |  |  100|   685k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 159k, False: 525k]
  |  |  ------------------
  ------------------
  |  Branch (814:16): [True: 196k, False: 488k]
  ------------------
  815|   488k|               (ABS(p1 - p0) >= beta))
  ------------------
  |  |  100|   488k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 95.3k, False: 392k]
  |  |  ------------------
  ------------------
  |  Branch (815:16): [True: 100k, False: 387k]
  ------------------
  816|   560k|                continue;
  817|       |
  818|   387k|            q2 = pu1_src_temp[pos_q2];
  819|   387k|            p2 = pu1_p2_temp[pos_p2];
  820|       |
  821|   387k|            a_p = ABS(p2 - p0);
  ------------------
  |  |  100|   387k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 61.4k, False: 326k]
  |  |  ------------------
  ------------------
  822|   387k|            a_q = ABS(q2 - q0);
  ------------------
  |  |  100|   387k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 48.4k, False: 339k]
  |  |  ------------------
  ------------------
  823|       |
  824|       |            /* tc */
  825|   387k|            tc = tc0 + (a_p < beta) + (a_q < beta);
  826|   387k|            val = ((((q0 - p0) << 2) + (p1 - q1) + 4) >> 3);
  827|   387k|            delta = CLIP3(-tc, tc, val);
  ------------------
  |  |   77|   387k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 6.76k, False: 381k]
  |  |  |  Branch (77:54): [True: 8.71k, False: 372k]
  |  |  ------------------
  ------------------
  828|       |            /* p0' */
  829|   387k|            val = p0 + delta;
  830|   387k|            pu1_p2_temp[pos_p0] = CLIP_U8(val);
  ------------------
  |  |   58|   387k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   387k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 363, False: 387k]
  |  |  |  |  |  Branch (77:54): [True: 46, False: 387k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  831|       |            /* q0' */
  832|   387k|            val = q0 - delta;
  833|   387k|            pu1_src_temp[pos_q0] = CLIP_U8(val);
  ------------------
  |  |   58|   387k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   387k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 545, False: 387k]
  |  |  |  |  |  Branch (77:54): [True: 23, False: 387k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  834|       |
  835|       |            /* Luma */
  836|   387k|            if(a_p < beta)
  ------------------
  |  Branch (836:16): [True: 352k, False: 35.3k]
  ------------------
  837|   352k|            {
  838|       |                /* p1' */
  839|   352k|                val = ((p2 + ((p0 + q0 + 1) >> 1) - (p1 << 1)) >> 1);
  840|   352k|                pu1_p2_temp[pos_p1] += CLIP3(-tc0, tc0, val);
  ------------------
  |  |   77|   352k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 14.9k, False: 337k]
  |  |  |  Branch (77:54): [True: 11.1k, False: 326k]
  |  |  ------------------
  ------------------
  841|   352k|            }
  842|       |
  843|   387k|            if(a_q < beta)
  ------------------
  |  Branch (843:16): [True: 351k, False: 36.0k]
  ------------------
  844|   351k|            {
  845|       |                /* q1' */
  846|   351k|                val = ((q2 + ((p0 + q0 + 1) >> 1) - (q1 << 1)) >> 1);
  847|   351k|                pu1_src_temp[pos_q1] += CLIP3(-tc0, tc0, val);
  ------------------
  |  |   77|   351k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 12.6k, False: 339k]
  |  |  |  Branch (77:54): [True: 11.7k, False: 327k]
  |  |  ------------------
  ------------------
  848|   351k|            }
  849|   387k|        }
  850|   237k|    }
  851|  62.8k|}
ih264_deblk_chroma_vert_bs4:
 1456|  6.00k|{
 1457|  6.00k|    UWORD8 *pu1_src_u = pu1_src; /* Pointer to the src sample q0 of U */
 1458|  6.00k|    UWORD8 *pu1_src_v = pu1_src + 1; /* Pointer to the src sample q0 of V */
 1459|  6.00k|    UWORD8 p1_u, p0_u, q0_u, q1_u, p1_v, p0_v, q0_v, q1_v;
 1460|  6.00k|    WORD32 blk_strd = src_strd << 1; /* block_increment = src_strd * 2*/
 1461|  6.00k|    WORD32 pos_p1, pos_p0, pos_q0, pos_q1;
 1462|  6.00k|    UWORD8 *pu1_src_temp_u, *pu1_src_temp_v;
 1463|  6.00k|    WORD8 i = 0, edge;
 1464|       |
 1465|  6.00k|    pos_q0 = 0;
 1466|  6.00k|    pos_q1 = 2;
 1467|  6.00k|    pos_p0 = -2;
 1468|  6.00k|    pos_p1 = -4;
 1469|       |
 1470|  30.0k|    for(edge = 0; edge < 4;
  ------------------
  |  Branch (1470:19): [True: 24.0k, False: 6.00k]
  ------------------
 1471|  24.0k|                    edge++, pu1_src_u += blk_strd, pu1_src_v += blk_strd)
 1472|  24.0k|    {
 1473|  24.0k|        pu1_src_temp_u = pu1_src_u;
 1474|  24.0k|        pu1_src_temp_v = pu1_src_v;
 1475|  72.0k|        for(i = 0; i < 2; ++i, pu1_src_temp_u += src_strd, pu1_src_temp_v +=
  ------------------
  |  Branch (1475:20): [True: 48.0k, False: 24.0k]
  ------------------
 1476|  48.0k|                        src_strd)
 1477|  48.0k|        {
 1478|  48.0k|            q0_u = pu1_src_temp_u[pos_q0];
 1479|  48.0k|            q1_u = pu1_src_temp_u[pos_q1];
 1480|  48.0k|            p0_u = pu1_src_temp_u[pos_p0];
 1481|  48.0k|            p1_u = pu1_src_temp_u[pos_p1];
 1482|  48.0k|            q0_v = pu1_src_temp_v[pos_q0];
 1483|  48.0k|            q1_v = pu1_src_temp_v[pos_q1];
 1484|  48.0k|            p0_v = pu1_src_temp_v[pos_p0];
 1485|  48.0k|            p1_v = pu1_src_temp_v[pos_p1];
 1486|       |
 1487|       |            /* Filter Decision */
 1488|  48.0k|            if((ABS(p0_u - q0_u) < alpha_cb) &&
  ------------------
  |  |  100|  48.0k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 19.8k, False: 28.1k]
  |  |  ------------------
  ------------------
  |  Branch (1488:16): [True: 31.7k, False: 16.2k]
  ------------------
 1489|  31.7k|               (ABS(q1_u - q0_u) < beta_cb) &&
  ------------------
  |  |  100|  31.7k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 6.54k, False: 25.2k]
  |  |  ------------------
  ------------------
  |  Branch (1489:16): [True: 26.9k, False: 4.77k]
  ------------------
 1490|  26.9k|               (ABS(p1_u - p0_u) < beta_cb))
  ------------------
  |  |  100|  26.9k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 5.65k, False: 21.3k]
  |  |  ------------------
  ------------------
  |  Branch (1490:16): [True: 22.7k, False: 4.26k]
  ------------------
 1491|  22.7k|            {
 1492|       |                /* p0' */
 1493|  22.7k|                pu1_src_temp_u[pos_p0] = ((X2(p1_u) + p0_u + q1_u + 2) >> 2);
  ------------------
  |  |   91|  22.7k|#define X2(a)   ((a) << 1)
  ------------------
 1494|       |                /* q0' */
 1495|  22.7k|                pu1_src_temp_u[pos_q0] = (X2(q1_u) + q0_u + p1_u + 2) >> 2;
  ------------------
  |  |   91|  22.7k|#define X2(a)   ((a) << 1)
  ------------------
 1496|  22.7k|            }
 1497|       |
 1498|       |            /* Filter Decision */
 1499|  48.0k|            if((ABS(p0_v - q0_v) < alpha_cr) &&
  ------------------
  |  |  100|  48.0k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 19.7k, False: 28.2k]
  |  |  ------------------
  ------------------
  |  Branch (1499:16): [True: 32.2k, False: 15.7k]
  ------------------
 1500|  32.2k|               (ABS(q1_v - q0_v) < beta_cr) &&
  ------------------
  |  |  100|  32.2k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 6.76k, False: 25.5k]
  |  |  ------------------
  ------------------
  |  Branch (1500:16): [True: 27.2k, False: 5.01k]
  ------------------
 1501|  27.2k|               (ABS(p1_v - p0_v) < beta_cr))
  ------------------
  |  |  100|  27.2k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 5.51k, False: 21.7k]
  |  |  ------------------
  ------------------
  |  Branch (1501:16): [True: 22.1k, False: 5.11k]
  ------------------
 1502|  22.1k|            {
 1503|       |                /* p0' */
 1504|  22.1k|                pu1_src_temp_v[pos_p0] = ((X2(p1_v) + p0_v + q1_v + 2) >> 2);
  ------------------
  |  |   91|  22.1k|#define X2(a)   ((a) << 1)
  ------------------
 1505|       |                /* q0' */
 1506|  22.1k|                pu1_src_temp_v[pos_q0] = (X2(q1_v) + q0_v + p1_v + 2) >> 2;
  ------------------
  |  |   91|  22.1k|#define X2(a)   ((a) << 1)
  ------------------
 1507|  22.1k|            }
 1508|  48.0k|        }
 1509|  24.0k|    }
 1510|  6.00k|}
ih264_deblk_chroma_horz_bs4:
 1552|  9.53k|{
 1553|  9.53k|    UWORD8 *pu1_src_u = pu1_src; /* Pointer to the src sample q0 of U */
 1554|  9.53k|    UWORD8 *pu1_src_v = pu1_src + 1; /* Pointer to the src sample q0 of V */
 1555|  9.53k|    UWORD8 p1_u, p0_u, q0_u, q1_u, p1_v, p0_v, q0_v, q1_v;
 1556|  9.53k|    WORD32 pos_p1, pos_p0, pos_q0, pos_q1;
 1557|  9.53k|    UWORD8 *pu1_src_temp_u, *pu1_src_temp_v;
 1558|  9.53k|    UWORD8 *pu1_p1_u; /* Pointer to the src sample p1 of U */
 1559|  9.53k|    UWORD8 *pu1_p1_v; /* Pointer to the src sample p1 of U */
 1560|  9.53k|    UWORD8 *pu1_p1_temp_u, *pu1_p1_temp_v;
 1561|  9.53k|    WORD8 i = 0, edge;
 1562|       |
 1563|  9.53k|    pu1_p1_u = pu1_src_u - (src_strd << 1);
 1564|  9.53k|    pu1_p1_v = pu1_src_v - (src_strd << 1);
 1565|  9.53k|    pos_q0 = 0;
 1566|  9.53k|    pos_q1 = src_strd;
 1567|  9.53k|    pos_p0 = src_strd;
 1568|  9.53k|    pos_p1 = 0;
 1569|       |
 1570|  47.6k|    for(edge = 0; edge < 4; edge++, pu1_src_u += 4, pu1_p1_u += 4, pu1_src_v +=
  ------------------
  |  Branch (1570:19): [True: 38.1k, False: 9.53k]
  ------------------
 1571|  38.1k|                    4, pu1_p1_v += 4)
 1572|  38.1k|    {
 1573|  38.1k|        pu1_src_temp_u = pu1_src_u;
 1574|  38.1k|        pu1_p1_temp_u = pu1_p1_u;
 1575|  38.1k|        pu1_src_temp_v = pu1_src_v;
 1576|  38.1k|        pu1_p1_temp_v = pu1_p1_v;
 1577|   114k|        for(i = 0; i < 2; ++i, pu1_src_temp_u += 2, pu1_p1_temp_u += 2,
  ------------------
  |  Branch (1577:20): [True: 76.2k, False: 38.1k]
  ------------------
 1578|  76.2k|                       pu1_src_temp_v += 2, pu1_p1_temp_v += 2)
 1579|  76.2k|        {
 1580|  76.2k|            q0_u = pu1_src_temp_u[pos_q0];
 1581|  76.2k|            q1_u = pu1_src_temp_u[pos_q1];
 1582|  76.2k|            p0_u = pu1_p1_temp_u[pos_p0];
 1583|  76.2k|            p1_u = pu1_p1_temp_u[pos_p1];
 1584|       |
 1585|  76.2k|            q0_v = pu1_src_temp_v[pos_q0];
 1586|  76.2k|            q1_v = pu1_src_temp_v[pos_q1];
 1587|  76.2k|            p0_v = pu1_p1_temp_v[pos_p0];
 1588|  76.2k|            p1_v = pu1_p1_temp_v[pos_p1];
 1589|       |
 1590|       |            /* Filter Decision */
 1591|  76.2k|            if(ABS(p0_u - q0_u) < alpha_cb && ABS(q1_u - q0_u) < beta_cb
  ------------------
  |  |  100|  76.2k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 26.8k, False: 49.4k]
  |  |  ------------------
  ------------------
                          if(ABS(p0_u - q0_u) < alpha_cb && ABS(q1_u - q0_u) < beta_cb
  ------------------
  |  |  100|  50.7k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 2.99k, False: 47.7k]
  |  |  ------------------
  ------------------
  |  Branch (1591:16): [True: 50.7k, False: 25.4k]
  |  Branch (1591:47): [True: 44.7k, False: 6.02k]
  ------------------
 1592|  44.7k|                            && ABS(p1_u - p0_u) < beta_cb)
  ------------------
  |  |  100|  44.7k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 3.56k, False: 41.2k]
  |  |  ------------------
  ------------------
  |  Branch (1592:32): [True: 42.4k, False: 2.28k]
  ------------------
 1593|  42.4k|            {
 1594|       |                /* p0' */
 1595|  42.4k|                pu1_p1_temp_u[pos_p0] = (X2(p1_u) + p0_u + q1_u + 2) >> 2;
  ------------------
  |  |   91|  42.4k|#define X2(a)   ((a) << 1)
  ------------------
 1596|       |                /* q0' */
 1597|  42.4k|                pu1_src_temp_u[pos_q0] = (X2(q1_u) + q0_u + p1_u + 2) >> 2;
  ------------------
  |  |   91|  42.4k|#define X2(a)   ((a) << 1)
  ------------------
 1598|  42.4k|            }
 1599|       |
 1600|       |            /* Filter Decision */
 1601|  76.2k|            if(ABS(p0_v - q0_v) < alpha_cr && ABS(q1_v - q0_v) < beta_cr
  ------------------
  |  |  100|  76.2k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 27.4k, False: 48.8k]
  |  |  ------------------
  ------------------
                          if(ABS(p0_v - q0_v) < alpha_cr && ABS(q1_v - q0_v) < beta_cr
  ------------------
  |  |  100|  51.5k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 2.79k, False: 48.7k]
  |  |  ------------------
  ------------------
  |  Branch (1601:16): [True: 51.5k, False: 24.7k]
  |  Branch (1601:47): [True: 45.4k, False: 6.10k]
  ------------------
 1602|  45.4k|                            && ABS(p1_v - p0_v) < beta_cr)
  ------------------
  |  |  100|  45.4k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 3.69k, False: 41.7k]
  |  |  ------------------
  ------------------
  |  Branch (1602:32): [True: 42.9k, False: 2.45k]
  ------------------
 1603|  42.9k|            {
 1604|       |                /* p0' */
 1605|  42.9k|                pu1_p1_temp_v[pos_p0] = (X2(p1_v) + p0_v + q1_v + 2) >> 2;
  ------------------
  |  |   91|  42.9k|#define X2(a)   ((a) << 1)
  ------------------
 1606|       |                /* q0' */
 1607|  42.9k|                pu1_src_temp_v[pos_q0] = (X2(q1_v) + q0_v + p1_v + 2) >> 2;
  ------------------
  |  |   91|  42.9k|#define X2(a)   ((a) << 1)
  ------------------
 1608|  42.9k|            }
 1609|  76.2k|        }
 1610|  38.1k|    }
 1611|  9.53k|}
ih264_deblk_chroma_vert_bslt4:
 1665|  34.6k|{
 1666|  34.6k|    UWORD8 *pu1_src_u = pu1_src; /* Pointer to the src sample q0 of plane U*/
 1667|  34.6k|    UWORD8 *pu1_src_v = pu1_src + 1; /* Pointer to the src sample q0 of plane V*/
 1668|  34.6k|    UWORD8 p1_u, p0_u, q0_u, q1_u, p1_v, p0_v, q0_v, q1_v;
 1669|  34.6k|    WORD32 blk_strd = src_strd << 1; /* block_increment = src_strd * 2 */
 1670|  34.6k|    WORD32 pos_p1, pos_p0, pos_q0, pos_q1;
 1671|  34.6k|    UWORD8 *pu1_src_temp_u, *pu1_src_temp_v;
 1672|  34.6k|    WORD8 i = 0, edge;
 1673|  34.6k|    WORD8 delta;
 1674|  34.6k|    WORD8 tcb, tcr;
 1675|  34.6k|    WORD16 val;
 1676|  34.6k|    UWORD8 tcb0, tcr0, u1_bs;
 1677|       |
 1678|  34.6k|    pos_q0 = 0;
 1679|  34.6k|    pos_q1 = 2;
 1680|  34.6k|    pos_p0 = -2;
 1681|  34.6k|    pos_p1 = -4;
 1682|       |
 1683|   173k|    for(edge = 0; edge < 4;
  ------------------
  |  Branch (1683:19): [True: 138k, False: 34.6k]
  ------------------
 1684|   138k|                    edge++, pu1_src_u += blk_strd, pu1_src_v += blk_strd)
 1685|   138k|    {
 1686|   138k|        pu1_src_temp_u = pu1_src_u;
 1687|   138k|        pu1_src_temp_v = pu1_src_v;
 1688|       |        /* Filter Decision */
 1689|   138k|        u1_bs = (UWORD8)((u4_bs >> ((3 - edge) << 3)) & 0x0ff);
 1690|   138k|        if(!u1_bs)
  ------------------
  |  Branch (1690:12): [True: 6.36k, False: 132k]
  ------------------
 1691|  6.36k|            continue;
 1692|       |        /* tc0 */
 1693|   132k|        tcb0 = pu1_cliptab_cb[u1_bs];
 1694|   132k|        tcr0 = pu1_cliptab_cr[u1_bs];
 1695|   132k|        tcb = tcb0 + 1;
 1696|   132k|        tcr = tcr0 + 1;
 1697|   396k|        for(i = 0; i < 2; ++i, pu1_src_temp_u += src_strd, pu1_src_temp_v +=
  ------------------
  |  Branch (1697:20): [True: 264k, False: 132k]
  ------------------
 1698|   264k|                        src_strd)
 1699|   264k|        {
 1700|   264k|            q0_u = pu1_src_temp_u[pos_q0];
 1701|   264k|            q1_u = pu1_src_temp_u[pos_q1];
 1702|   264k|            p0_u = pu1_src_temp_u[pos_p0];
 1703|   264k|            p1_u = pu1_src_temp_u[pos_p1];
 1704|       |
 1705|   264k|            q0_v = pu1_src_temp_v[pos_q0];
 1706|   264k|            q1_v = pu1_src_temp_v[pos_q1];
 1707|   264k|            p0_v = pu1_src_temp_v[pos_p0];
 1708|   264k|            p1_v = pu1_src_temp_v[pos_p1];
 1709|       |
 1710|       |            /* Filter Decision */
 1711|   264k|            if(ABS(p0_u - q0_u) < alpha_cb && ABS(q1_u - q0_u) < beta_cb
  ------------------
  |  |  100|   264k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 50.6k, False: 213k]
  |  |  ------------------
  ------------------
                          if(ABS(p0_u - q0_u) < alpha_cb && ABS(q1_u - q0_u) < beta_cb
  ------------------
  |  |  100|   208k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 18.8k, False: 189k]
  |  |  ------------------
  ------------------
  |  Branch (1711:16): [True: 208k, False: 55.8k]
  |  Branch (1711:47): [True: 195k, False: 12.6k]
  ------------------
 1712|   195k|                            && ABS(p1_u - p0_u) < beta_cb)
  ------------------
  |  |  100|   195k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 13.6k, False: 182k]
  |  |  ------------------
  ------------------
  |  Branch (1712:32): [True: 190k, False: 5.59k]
  ------------------
 1713|   190k|            {
 1714|   190k|                val = ((((q0_u - p0_u) << 2) + (p1_u - q1_u) + 4) >> 3);
 1715|   190k|                delta = CLIP3(-tcb, tcb, val);
  ------------------
  |  |   77|   190k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 3.37k, False: 186k]
  |  |  |  Branch (77:54): [True: 3.53k, False: 183k]
  |  |  ------------------
  ------------------
 1716|       |                /* p0' */
 1717|   190k|                val = p0_u + delta;
 1718|   190k|                pu1_src_temp_u[pos_p0] = CLIP_U8(val);
  ------------------
  |  |   58|   190k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   190k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 24, False: 190k]
  |  |  |  |  |  Branch (77:54): [True: 114, False: 190k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1719|       |                /* q0' */
 1720|   190k|                val = q0_u - delta;
 1721|   190k|                pu1_src_temp_u[pos_q0] = CLIP_U8(val);
  ------------------
  |  |   58|   190k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   190k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 19, False: 190k]
  |  |  |  |  |  Branch (77:54): [True: 3, False: 190k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1722|   190k|            }
 1723|       |
 1724|       |            /* Filter Decision */
 1725|   264k|            if(ABS(p0_v - q0_v) < alpha_cr && ABS(q1_v - q0_v) < beta_cr
  ------------------
  |  |  100|   264k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 54.4k, False: 209k]
  |  |  ------------------
  ------------------
                          if(ABS(p0_v - q0_v) < alpha_cr && ABS(q1_v - q0_v) < beta_cr
  ------------------
  |  |  100|   214k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 21.2k, False: 193k]
  |  |  ------------------
  ------------------
  |  Branch (1725:16): [True: 214k, False: 49.8k]
  |  Branch (1725:47): [True: 199k, False: 14.7k]
  ------------------
 1726|   199k|                            && ABS(p1_v - p0_v) < beta_cr)
  ------------------
  |  |  100|   199k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 14.2k, False: 185k]
  |  |  ------------------
  ------------------
  |  Branch (1726:32): [True: 193k, False: 5.72k]
  ------------------
 1727|   193k|            {
 1728|   193k|                val = ((((q0_v - p0_v) << 2) + (p1_v - q1_v) + 4) >> 3);
 1729|   193k|                delta = CLIP3(-tcr, tcr, val);
  ------------------
  |  |   77|   193k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 1.68k, False: 192k]
  |  |  |  Branch (77:54): [True: 3.31k, False: 188k]
  |  |  ------------------
  ------------------
 1730|       |                /* p0' */
 1731|   193k|                val = p0_v + delta;
 1732|   193k|                pu1_src_temp_v[pos_p0] = CLIP_U8(val);
  ------------------
  |  |   58|   193k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   193k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 13, False: 193k]
  |  |  |  |  |  Branch (77:54): [True: 114, False: 193k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1733|       |                /* q0' */
 1734|   193k|                val = q0_v - delta;
 1735|   193k|                pu1_src_temp_v[pos_q0] = CLIP_U8(val);
  ------------------
  |  |   58|   193k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   193k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 33, False: 193k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 193k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1736|   193k|            }
 1737|   264k|        }
 1738|   132k|    }
 1739|  34.6k|}
ih264_deblk_chroma_horz_bslt4:
 1793|  39.0k|{
 1794|  39.0k|    UWORD8 *pu1_src_u = pu1_src; /* Pointer to the src sample q0 of plane U*/
 1795|  39.0k|    UWORD8 *pu1_src_v = pu1_src + 1; /* Pointer to the src sample q0 of plane V*/
 1796|  39.0k|    UWORD8 p1_u, p0_u, q0_u, q1_u, p1_v, p0_v, q0_v, q1_v;
 1797|  39.0k|    WORD32 pos_p1, pos_p0, pos_q0, pos_q1;
 1798|  39.0k|    UWORD8 *pu1_src_temp_u, *pu1_src_temp_v;
 1799|  39.0k|    UWORD8 *pu1_p1_u; /* Pointer to the src sample p1 of plane U*/
 1800|  39.0k|    UWORD8 *pu1_p1_v; /* Pointer to the src sample p1 of plane V*/
 1801|  39.0k|    UWORD8 *pu1_p1_temp_u, *pu1_p1_temp_v;
 1802|  39.0k|    WORD8 i = 0, edge;
 1803|  39.0k|    WORD8 delta;
 1804|  39.0k|    WORD8 tcb, tcr;
 1805|  39.0k|    WORD16 val;
 1806|  39.0k|    UWORD8 u1_bs;
 1807|  39.0k|    UWORD8 tcb0, tcr0;
 1808|       |
 1809|  39.0k|    pu1_p1_u = pu1_src_u - (src_strd << 1);
 1810|  39.0k|    pu1_p1_v = pu1_src_v - (src_strd << 1);
 1811|  39.0k|    pos_q0 = 0;
 1812|  39.0k|    pos_q1 = src_strd;
 1813|  39.0k|    pos_p0 = src_strd;
 1814|  39.0k|    pos_p1 = 0;
 1815|       |
 1816|   195k|    for(edge = 0; edge < 4; edge++, pu1_src_u += 4, pu1_p1_u += 4,
  ------------------
  |  Branch (1816:19): [True: 156k, False: 39.0k]
  ------------------
 1817|   156k|                    pu1_src_v += 4, pu1_p1_v += 4)
 1818|   156k|    {
 1819|   156k|        pu1_src_temp_u = pu1_src_u;
 1820|   156k|        pu1_p1_temp_u = pu1_p1_u;
 1821|   156k|        pu1_src_temp_v = pu1_src_v;
 1822|   156k|        pu1_p1_temp_v = pu1_p1_v;
 1823|       |
 1824|       |        /* Filter Decision */
 1825|   156k|        u1_bs = (UWORD8)((u4_bs >> ((3 - edge) << 3)) & 0x0ff);
 1826|   156k|        if(!u1_bs)
  ------------------
  |  Branch (1826:12): [True: 7.10k, False: 148k]
  ------------------
 1827|  7.10k|            continue;
 1828|       |        /* tc0 */
 1829|   148k|        tcb0 = pu1_cliptab_cb[u1_bs];
 1830|   148k|        tcr0 = pu1_cliptab_cr[u1_bs];
 1831|       |
 1832|   446k|        for(i = 0; i < 2; ++i, pu1_src_temp_u += 2, pu1_p1_temp_u += 2,
  ------------------
  |  Branch (1832:20): [True: 297k, False: 148k]
  ------------------
 1833|   297k|                       pu1_src_temp_v += 2, pu1_p1_temp_v += 2)
 1834|   297k|        {
 1835|   297k|            q0_u = pu1_src_temp_u[pos_q0];
 1836|   297k|            q1_u = pu1_src_temp_u[pos_q1];
 1837|   297k|            p0_u = pu1_p1_temp_u[pos_p0];
 1838|   297k|            p1_u = pu1_p1_temp_u[pos_p1];
 1839|       |
 1840|   297k|            q0_v = pu1_src_temp_v[pos_q0];
 1841|   297k|            q1_v = pu1_src_temp_v[pos_q1];
 1842|   297k|            p0_v = pu1_p1_temp_v[pos_p0];
 1843|   297k|            p1_v = pu1_p1_temp_v[pos_p1];
 1844|       |
 1845|       |            /* tc */
 1846|   297k|            tcb = tcb0 + 1;
 1847|   297k|            tcr = tcr0 + 1;
 1848|       |            /* Filter Decision */
 1849|   297k|            if(ABS(p0_u - q0_u) < alpha_cb && ABS(q1_u - q0_u) < beta_cb
  ------------------
  |  |  100|   297k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 52.5k, False: 245k]
  |  |  ------------------
  ------------------
                          if(ABS(p0_u - q0_u) < alpha_cb && ABS(q1_u - q0_u) < beta_cb
  ------------------
  |  |  100|   232k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 28.1k, False: 204k]
  |  |  ------------------
  ------------------
  |  Branch (1849:16): [True: 232k, False: 65.6k]
  |  Branch (1849:47): [True: 215k, False: 16.7k]
  ------------------
 1850|   215k|                            && ABS(p1_u - p0_u) < beta_cb)
  ------------------
  |  |  100|   215k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 18.0k, False: 197k]
  |  |  ------------------
  ------------------
  |  Branch (1850:32): [True: 207k, False: 8.31k]
  ------------------
 1851|   207k|            {
 1852|   207k|                val = ((((q0_u - p0_u) << 2) + (p1_u - q1_u) + 4) >> 3);
 1853|   207k|                delta = CLIP3(-tcb, tcb, val);
  ------------------
  |  |   77|   207k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 1.87k, False: 205k]
  |  |  |  Branch (77:54): [True: 1.74k, False: 203k]
  |  |  ------------------
  ------------------
 1854|       |                /* p0' */
 1855|   207k|                val = p0_u + delta;
 1856|   207k|                pu1_p1_temp_u[pos_p0] = CLIP_U8(val);
  ------------------
  |  |   58|   207k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   207k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 20, False: 207k]
  |  |  |  |  |  Branch (77:54): [True: 2, False: 207k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1857|       |                /* q0' */
 1858|   207k|                val = q0_u - delta;
 1859|   207k|                pu1_src_temp_u[pos_q0] = CLIP_U8(val);
  ------------------
  |  |   58|   207k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   207k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 54, False: 207k]
  |  |  |  |  |  Branch (77:54): [True: 17, False: 207k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1860|   207k|            }
 1861|       |            /* Filter Decision */
 1862|   297k|            if(ABS(p0_v - q0_v) < alpha_cr && ABS(q1_v - q0_v) < beta_cr
  ------------------
  |  |  100|   297k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 59.0k, False: 238k]
  |  |  ------------------
  ------------------
                          if(ABS(p0_v - q0_v) < alpha_cr && ABS(q1_v - q0_v) < beta_cr
  ------------------
  |  |  100|   237k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 29.9k, False: 207k]
  |  |  ------------------
  ------------------
  |  Branch (1862:16): [True: 237k, False: 60.5k]
  |  Branch (1862:47): [True: 218k, False: 18.5k]
  ------------------
 1863|   218k|                            && ABS(p1_v - p0_v) < beta_cr)
  ------------------
  |  |  100|   218k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 21.1k, False: 197k]
  |  |  ------------------
  ------------------
  |  Branch (1863:32): [True: 210k, False: 8.61k]
  ------------------
 1864|   210k|            {
 1865|   210k|                val = ((((q0_v - p0_v) << 2) + (p1_v - q1_v) + 4) >> 3);
 1866|   210k|                delta = CLIP3(-tcr, tcr, val);
  ------------------
  |  |   77|   210k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 1.73k, False: 208k]
  |  |  |  Branch (77:54): [True: 2.02k, False: 206k]
  |  |  ------------------
  ------------------
 1867|       |                /* p0' */
 1868|   210k|                val = p0_v + delta;
 1869|   210k|                pu1_p1_temp_v[pos_p0] = CLIP_U8(val);
  ------------------
  |  |   58|   210k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   210k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 20, False: 210k]
  |  |  |  |  |  Branch (77:54): [True: 7, False: 210k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1870|       |                /* q0' */
 1871|   210k|                val = q0_v - delta;
 1872|   210k|                pu1_src_temp_v[pos_q0] = CLIP_U8(val);
  ------------------
  |  |   58|   210k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   210k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 30, False: 210k]
  |  |  |  |  |  Branch (77:54): [True: 10, False: 210k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1873|   210k|            }
 1874|   297k|        }
 1875|   148k|    }
 1876|  39.0k|}

ih264_disp_mgr_init:
   77|    160|{
   78|    160|    WORD32 id;
   79|       |
   80|    160|    ps_disp_mgr->u4_last_abs_poc = DEFAULT_POC;
  ------------------
  |  |   45|    160|#define DEFAULT_POC 0x7FFFFFFF
  ------------------
   81|       |
   82|  10.4k|    for(id = 0; id < DISP_MGR_MAX_CNT; id++)
  ------------------
  |  |   44|  10.4k|#define DISP_MGR_MAX_CNT 64
  ------------------
  |  Branch (82:17): [True: 10.2k, False: 160]
  ------------------
   83|  10.2k|    {
   84|  10.2k|        ps_disp_mgr->ai4_abs_poc[id] = DEFAULT_POC;
  ------------------
  |  |   45|  10.2k|#define DEFAULT_POC 0x7FFFFFFF
  ------------------
   85|       |        ps_disp_mgr->apv_ptr[id] = NULL;
   86|  10.2k|    }
   87|    160|}
ih264_disp_mgr_add:
  120|  3.16k|{
  121|  3.16k|    if(buf_id >= DISP_MGR_MAX_CNT)
  ------------------
  |  |   44|  3.16k|#define DISP_MGR_MAX_CNT 64
  ------------------
  |  Branch (121:8): [True: 0, False: 3.16k]
  ------------------
  122|      0|    {
  123|      0|        return (-1);
  124|      0|    }
  125|       |
  126|  3.16k|    if(ps_disp_mgr->apv_ptr[buf_id] != NULL)
  ------------------
  |  Branch (126:8): [True: 27, False: 3.14k]
  ------------------
  127|     27|    {
  128|     27|        return (-1);
  129|     27|    }
  130|       |
  131|  3.14k|    ps_disp_mgr->apv_ptr[buf_id] = pv_ptr;
  132|  3.14k|    ps_disp_mgr->ai4_abs_poc[buf_id] = abs_poc;
  133|       |
  134|  3.14k|    return 0;
  135|  3.16k|}
ih264_disp_mgr_get:
  159|  5.17k|{
  160|  5.17k|    WORD32 id;
  161|  5.17k|    void *pv_ret_ptr = NULL;
  162|  5.17k|    WORD32 i4_min_poc = 0x7FFFFFFF;
  163|  5.17k|    WORD32 min_poc_id = -1;
  164|       |
  165|       |    /* Find minimum POC */
  166|   336k|    for(id = 0; id < DISP_MGR_MAX_CNT; id++)
  ------------------
  |  |   44|   336k|#define DISP_MGR_MAX_CNT 64
  ------------------
  |  Branch (166:17): [True: 331k, False: 5.17k]
  ------------------
  167|   331k|    {
  168|   331k|        if((DEFAULT_POC != ps_disp_mgr->ai4_abs_poc[id]) &&
  ------------------
  |  |   45|   331k|#define DEFAULT_POC 0x7FFFFFFF
  ------------------
  |  Branch (168:12): [True: 3.97k, False: 327k]
  ------------------
  169|  3.97k|           (ps_disp_mgr->ai4_abs_poc[id] <= i4_min_poc))
  ------------------
  |  Branch (169:12): [True: 3.27k, False: 704]
  ------------------
  170|  3.27k|        {
  171|  3.27k|            i4_min_poc = ps_disp_mgr->ai4_abs_poc[id];
  172|  3.27k|            min_poc_id = id;
  173|  3.27k|        }
  174|   331k|    }
  175|  5.17k|    *pi4_buf_id = min_poc_id;
  176|       |    /* If all pocs are still default_poc then return NULL */
  177|  5.17k|    if(-1 == min_poc_id)
  ------------------
  |  Branch (177:8): [True: 2.14k, False: 3.03k]
  ------------------
  178|  2.14k|    {
  179|  2.14k|        return NULL;
  180|  2.14k|    }
  181|       |
  182|  3.03k|    pv_ret_ptr = ps_disp_mgr->apv_ptr[min_poc_id];
  183|       |
  184|       |    /* Set abs poc to default and apv_ptr to null so that the buffer is not returned again */
  185|  3.03k|    ps_disp_mgr->apv_ptr[min_poc_id] = NULL;
  186|  3.03k|    ps_disp_mgr->ai4_abs_poc[min_poc_id] = DEFAULT_POC;
  ------------------
  |  |   45|  3.03k|#define DEFAULT_POC 0x7FFFFFFF
  ------------------
  187|       |
  188|  3.03k|    return pv_ret_ptr;
  189|  5.17k|}

ih264_ihadamard_scaling_4x4:
  102|  1.05k|{
  103|  1.05k|    WORD32 i;
  104|  1.05k|    WORD32 x0, x1, x2, x3, x4, x5, x6, x7;
  105|  1.05k|    WORD16 *pi2_src_ptr, *pi2_out_ptr;
  106|  1.05k|    WORD32 *pi4_tmp_ptr;
  107|  1.05k|    WORD32 rnd_fact = (u4_qp_div_6 < 6) ? (1 << (5 - u4_qp_div_6)) : 0;
  ------------------
  |  Branch (107:23): [True: 910, False: 143]
  ------------------
  108|       |
  109|  1.05k|    pi4_tmp_ptr = pi4_tmp;
  110|  1.05k|    pi2_src_ptr = pi2_src;
  111|  1.05k|    pi2_out_ptr = pi2_out;
  112|       |
  113|       |    /* horizontal transform */
  114|  5.26k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|  5.26k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (114:16): [True: 4.21k, False: 1.05k]
  ------------------
  115|  4.21k|    {
  116|  4.21k|        x4 = pi2_src_ptr[0];
  117|  4.21k|        x5 = pi2_src_ptr[1];
  118|  4.21k|        x6 = pi2_src_ptr[2];
  119|  4.21k|        x7 = pi2_src_ptr[3];
  120|       |
  121|  4.21k|        x0 = x4 + x7;
  122|  4.21k|        x1 = x5 + x6;
  123|  4.21k|        x2 = x5 - x6;
  124|  4.21k|        x3 = x4 - x7;
  125|       |
  126|  4.21k|        pi4_tmp_ptr[0] = x0 + x1;
  127|  4.21k|        pi4_tmp_ptr[1] = x2 + x3;
  128|  4.21k|        pi4_tmp_ptr[2] = x0 - x1;
  129|  4.21k|        pi4_tmp_ptr[3] = x3 - x2;
  130|       |
  131|  4.21k|        pi4_tmp_ptr += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  4.21k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  132|  4.21k|        pi2_src_ptr += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  4.21k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  133|  4.21k|    }
  134|       |
  135|       |    /* vertical transform */
  136|  1.05k|    pi4_tmp_ptr = pi4_tmp;
  137|  5.26k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|  5.26k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (137:16): [True: 4.21k, False: 1.05k]
  ------------------
  138|  4.21k|    {
  139|  4.21k|        x4 = pi4_tmp_ptr[0];
  140|  4.21k|        x5 = pi4_tmp_ptr[4];
  141|  4.21k|        x6 = pi4_tmp_ptr[8];
  142|  4.21k|        x7 = pi4_tmp_ptr[12];
  143|       |
  144|  4.21k|        x0 = x4 + x7;
  145|  4.21k|        x1 = x5 + x6;
  146|  4.21k|        x2 = x5 - x6;
  147|  4.21k|        x3 = x4 - x7;
  148|       |
  149|  4.21k|        pi4_tmp_ptr[0] = x0 + x1;
  150|  4.21k|        pi4_tmp_ptr[4] = x2 + x3;
  151|  4.21k|        pi4_tmp_ptr[8] = x0 - x1;
  152|  4.21k|        pi4_tmp_ptr[12] = x3 - x2;
  153|       |
  154|  4.21k|        pi4_tmp_ptr++;
  155|  4.21k|    }
  156|  1.05k|    pi4_tmp_ptr = pi4_tmp;
  157|       |
  158|       |    /* scaling */
  159|  17.9k|    for(i = 0; i < (SUB_BLK_WIDTH_4x4 * SUB_BLK_WIDTH_4x4); i++)
  ------------------
  |  |   48|  17.9k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
                  for(i = 0; i < (SUB_BLK_WIDTH_4x4 * SUB_BLK_WIDTH_4x4); i++)
  ------------------
  |  |   48|  17.9k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (159:16): [True: 16.8k, False: 1.05k]
  ------------------
  160|  16.8k|    {
  161|  16.8k|        INV_QUANT(pi4_tmp_ptr[i], pu2_iscal_mat[0], pu2_weigh_mat[0],
  ------------------
  |  |  103|  16.8k|                {\
  |  |  104|  16.8k|                    i4_value *= quant_scale;\
  |  |  105|  16.8k|                    i4_value *= weight_scale;\
  |  |  106|  16.8k|                    i4_value += rndfactor;\
  |  |  107|  16.8k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  16.8k|                    i4_value >>= qbits;\
  |  |  109|  16.8k|                }
  ------------------
  162|  16.8k|                  u4_qp_div_6, rnd_fact, 6);
  163|  16.8k|        pi2_out_ptr[i] = pi4_tmp_ptr[i];
  164|  16.8k|    }
  165|  1.05k|}

ih264_inter_pred_luma_copy:
  129|   103k|{
  130|   103k|    WORD32 row, col;
  131|       |
  132|   103k|    UNUSED(pu1_tmp);
  ------------------
  |  |   45|   103k|#define UNUSED(x) ((void)(x))
  ------------------
  133|   103k|    UNUSED(dydx);
  ------------------
  |  |   45|   103k|#define UNUSED(x) ((void)(x))
  ------------------
  134|  1.72M|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (134:18): [True: 1.61M, False: 103k]
  ------------------
  135|  1.61M|    {
  136|  27.3M|        for(col = 0; col < wd; col++)
  ------------------
  |  Branch (136:22): [True: 25.7M, False: 1.61M]
  ------------------
  137|  25.7M|        {
  138|  25.7M|            pu1_dst[col] = pu1_src[col];
  139|  25.7M|        }
  140|       |
  141|  1.61M|        pu1_src += src_strd;
  142|  1.61M|        pu1_dst += dst_strd;
  143|  1.61M|    }
  144|   103k|}
ih264_inter_pred_luma_horz:
  251|  2.29k|{
  252|  2.29k|    WORD32 row, col;
  253|  2.29k|    WORD16 i2_tmp;
  254|       |
  255|  2.29k|    UNUSED(pu1_tmp);
  ------------------
  |  |   45|  2.29k|#define UNUSED(x) ((void)(x))
  ------------------
  256|  2.29k|    UNUSED(dydx);
  ------------------
  |  |   45|  2.29k|#define UNUSED(x) ((void)(x))
  ------------------
  257|  21.5k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (257:18): [True: 19.2k, False: 2.29k]
  ------------------
  258|  19.2k|    {
  259|   198k|        for(col = 0; col < wd; col++)
  ------------------
  |  Branch (259:22): [True: 179k, False: 19.2k]
  ------------------
  260|   179k|        {
  261|   179k|            i2_tmp = ih264_g_six_tap[0] * (pu1_src[col - 2] + pu1_src[col + 3])
  262|   179k|                     + ih264_g_six_tap[1] * (pu1_src[col - 1] + pu1_src[col + 2])
  263|   179k|                     + ih264_g_six_tap[2] * (pu1_src[col] + pu1_src[col + 1]);
  264|   179k|            i2_tmp = (i2_tmp + 16) >> 5;
  265|   179k|            pu1_dst[col] = CLIP_U8(i2_tmp);
  ------------------
  |  |   58|   179k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   179k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 4.75k, False: 174k]
  |  |  |  |  |  Branch (77:54): [True: 210, False: 174k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  266|   179k|        }
  267|  19.2k|        pu1_src += src_strd;
  268|  19.2k|        pu1_dst += dst_strd;
  269|  19.2k|    }
  270|  2.29k|}
ih264_inter_pred_luma_vert:
  321|  1.34k|{
  322|  1.34k|    WORD32 row, col;
  323|  1.34k|    WORD16 i2_tmp;
  324|       |
  325|  1.34k|    UNUSED(pu1_tmp);
  ------------------
  |  |   45|  1.34k|#define UNUSED(x) ((void)(x))
  ------------------
  326|  1.34k|    UNUSED(dydx);
  ------------------
  |  |   45|  1.34k|#define UNUSED(x) ((void)(x))
  ------------------
  327|  11.8k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (327:18): [True: 10.5k, False: 1.34k]
  ------------------
  328|  10.5k|    {
  329|   105k|        for(col = 0; col < wd; col++)
  ------------------
  |  Branch (329:22): [True: 94.5k, False: 10.5k]
  ------------------
  330|  94.5k|        {
  331|  94.5k|            i2_tmp = ih264_g_six_tap[0] * (pu1_src[col - 2 * src_strd] + pu1_src[col + 3 * src_strd])
  332|  94.5k|                     + ih264_g_six_tap[1] * (pu1_src[col - 1 * src_strd] + pu1_src[col + 2 * src_strd])
  333|  94.5k|                     + ih264_g_six_tap[2] * (pu1_src[col] + pu1_src[col + 1 * src_strd]);
  334|  94.5k|            i2_tmp = (i2_tmp + 16) >> 5;
  335|  94.5k|            pu1_dst[col] = CLIP_U8(i2_tmp);
  ------------------
  |  |   58|  94.5k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  94.5k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 4.57k, False: 89.9k]
  |  |  |  |  |  Branch (77:54): [True: 186, False: 89.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  336|  94.5k|        }
  337|  10.5k|        pu1_src += src_strd;
  338|  10.5k|        pu1_dst += dst_strd;
  339|  10.5k|    }
  340|  1.34k|}
ih264_inter_pred_luma_horz_hpel_vert_hpel:
  400|  1.19k|{
  401|  1.19k|    WORD32 row, col;
  402|  1.19k|    WORD32 tmp;
  403|  1.19k|    WORD16 *pi2_pred1_temp;
  404|  1.19k|    WORD16 *pi2_pred1;
  405|       |
  406|  1.19k|    UNUSED(dydx);
  ------------------
  |  |   45|  1.19k|#define UNUSED(x) ((void)(x))
  ------------------
  407|  1.19k|    pi2_pred1_temp = (WORD16*)pu1_tmp;
  408|  1.19k|    pi2_pred1_temp += 2;
  409|  1.19k|    pi2_pred1 = pi2_pred1_temp;
  410|       |
  411|  11.4k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (411:18): [True: 10.2k, False: 1.19k]
  ------------------
  412|  10.2k|    {
  413|   165k|        for(col = -2; col < wd + 3; col++)
  ------------------
  |  Branch (413:23): [True: 154k, False: 10.2k]
  ------------------
  414|   154k|        {
  415|   154k|            tmp = ih264_g_six_tap[0] * (pu1_src[col - 2 * src_strd] + pu1_src[col + 3 * src_strd])
  416|   154k|                  + ih264_g_six_tap[1] * (pu1_src[col - 1 * src_strd] + pu1_src[col + 2 * src_strd])
  417|   154k|                  + ih264_g_six_tap[2] * (pu1_src[col] + pu1_src[col + 1 * src_strd]);
  418|   154k|            pi2_pred1_temp[col] = tmp;
  419|   154k|        }
  420|  10.2k|        pu1_src += src_strd;
  421|  10.2k|        pi2_pred1_temp = pi2_pred1_temp + wd + 5;
  422|  10.2k|    }
  423|       |
  424|  11.4k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (424:18): [True: 10.2k, False: 1.19k]
  ------------------
  425|  10.2k|    {
  426|   113k|        for(col = 0; col < wd; col++)
  ------------------
  |  Branch (426:22): [True: 103k, False: 10.2k]
  ------------------
  427|   103k|        {
  428|   103k|            tmp = ih264_g_six_tap[0] * (pi2_pred1[col - 2] + pi2_pred1[col + 3])
  429|   103k|                  + ih264_g_six_tap[1] * (pi2_pred1[col - 1] + pi2_pred1[col + 2])
  430|   103k|                  + ih264_g_six_tap[2] * (pi2_pred1[col] + pi2_pred1[col + 1]);
  431|   103k|            tmp = (tmp + 512) >> 10;
  432|   103k|            pu1_dst[col] = CLIP_U8(tmp);
  ------------------
  |  |   58|   103k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   103k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 5.60k, False: 97.7k]
  |  |  |  |  |  Branch (77:54): [True: 144, False: 97.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  433|   103k|        }
  434|  10.2k|        pi2_pred1 += (wd + 5);
  435|  10.2k|        pu1_dst += dst_strd;
  436|  10.2k|    }
  437|  1.19k|}
ih264_inter_pred_luma_horz_qpel:
  496|  6.61k|{
  497|  6.61k|    WORD32 row, col;
  498|  6.61k|    UWORD8 *pu1_pred1;
  499|  6.61k|    WORD32 x_offset = dydx & 0x3;
  500|  6.61k|    UNUSED(pu1_tmp);
  ------------------
  |  |   45|  6.61k|#define UNUSED(x) ((void)(x))
  ------------------
  501|  6.61k|    pu1_pred1 = pu1_src + (x_offset >> 1);
  502|       |
  503|  55.9k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (503:18): [True: 49.3k, False: 6.61k]
  ------------------
  504|  49.3k|    {
  505|   476k|        for(col = 0; col < wd; col++, pu1_src++, pu1_dst++)
  ------------------
  |  Branch (505:22): [True: 427k, False: 49.3k]
  ------------------
  506|   427k|        {
  507|   427k|            WORD16 i2_temp;
  508|       |            /* The logic below implements the following equation
  509|       |             i2_temp = puc_pred[-2] - 5 * (puc_pred[-1] + puc_pred[2]) +
  510|       |             20 * (puc_pred[0] + puc_pred[1]) + puc_pred[3]; */
  511|   427k|            i2_temp = pu1_src[-2] + pu1_src[3]
  512|   427k|                      - (pu1_src[-1] + pu1_src[2])
  513|   427k|                      + ((pu1_src[0] + pu1_src[1] - pu1_src[-1] - pu1_src[2]) << 2)
  514|   427k|                      + ((pu1_src[0] + pu1_src[1]) << 4);
  515|   427k|            i2_temp = (i2_temp + 16) >> 5;
  516|   427k|            i2_temp = CLIP_U8(i2_temp);
  ------------------
  |  |   58|   427k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   427k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 15.8k, False: 411k]
  |  |  |  |  |  Branch (77:54): [True: 361, False: 411k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  517|   427k|            *pu1_dst = (i2_temp + *pu1_pred1 + 1) >> 1;
  518|       |
  519|   427k|            pu1_pred1++;
  520|   427k|        }
  521|  49.3k|        pu1_dst += dst_strd - wd;
  522|  49.3k|        pu1_src += src_strd - wd;
  523|  49.3k|        pu1_pred1 += src_strd - wd;
  524|  49.3k|    }
  525|  6.61k|}
ih264_inter_pred_luma_vert_qpel:
  584|  3.61k|{
  585|  3.61k|    WORD32 row, col;
  586|  3.61k|    WORD32 y_offset = dydx >> 2;
  587|  3.61k|    WORD32 off1, off2, off3;
  588|  3.61k|    UWORD8 *pu1_pred1;
  589|  3.61k|    UNUSED(pu1_tmp);
  ------------------
  |  |   45|  3.61k|#define UNUSED(x) ((void)(x))
  ------------------
  590|  3.61k|    y_offset = y_offset & 0x3;
  591|       |
  592|  3.61k|    off1 = src_strd;
  593|  3.61k|    off2 = src_strd << 1;
  594|  3.61k|    off3 = off1 + off2;
  595|       |
  596|  3.61k|    pu1_pred1 = pu1_src + (y_offset >> 1) * src_strd;
  597|       |
  598|  35.3k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (598:18): [True: 31.7k, False: 3.61k]
  ------------------
  599|  31.7k|    {
  600|   356k|        for(col = 0; col < wd; col++, pu1_dst++, pu1_src++, pu1_pred1++)
  ------------------
  |  Branch (600:22): [True: 324k, False: 31.7k]
  ------------------
  601|   324k|        {
  602|   324k|            WORD16 i2_temp;
  603|       |            /* The logic below implements the following equation
  604|       |             i16_temp = puc_pred[-2*src_strd] + puc_pred[3*src_strd] -
  605|       |             5 * (puc_pred[-1*src_strd] + puc_pred[2*src_strd])  +
  606|       |             20 * (puc_pred[0] + puc_pred[src_strd]); */
  607|   324k|            i2_temp = pu1_src[-off2] + pu1_src[off3]
  608|   324k|                       - (pu1_src[-off1] + pu1_src[off2])
  609|   324k|                       + ((pu1_src[0] + pu1_src[off1] - pu1_src[-off1] - pu1_src[off2]) << 2)
  610|   324k|                       + ((pu1_src[0] + pu1_src[off1]) << 4);
  611|   324k|            i2_temp = (i2_temp + 16) >> 5;
  612|   324k|            i2_temp = CLIP_U8(i2_temp);
  ------------------
  |  |   58|   324k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   324k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 12.9k, False: 311k]
  |  |  |  |  |  Branch (77:54): [True: 477, False: 310k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  613|       |
  614|   324k|            *pu1_dst = (i2_temp + *pu1_pred1 + 1) >> 1;
  615|   324k|        }
  616|  31.7k|        pu1_src += src_strd - wd;
  617|  31.7k|        pu1_pred1 += src_strd - wd;
  618|  31.7k|        pu1_dst += dst_strd - wd;
  619|  31.7k|    }
  620|  3.61k|}
ih264_inter_pred_luma_horz_qpel_vert_qpel:
  679|  7.01k|{
  680|  7.01k|    WORD32 row, col;
  681|  7.01k|    WORD32 x_offset = dydx & 0x3;
  682|  7.01k|    WORD32 y_offset = dydx >> 2;
  683|       |
  684|  7.01k|    WORD32 off1, off2, off3;
  685|  7.01k|    UWORD8* pu1_pred_vert, *pu1_pred_horz;
  686|  7.01k|    UNUSED(pu1_tmp);
  ------------------
  |  |   45|  7.01k|#define UNUSED(x) ((void)(x))
  ------------------
  687|  7.01k|    y_offset = y_offset & 0x3;
  688|       |
  689|  7.01k|    off1 = src_strd;
  690|  7.01k|    off2 = src_strd << 1;
  691|  7.01k|    off3 = off1 + off2;
  692|       |
  693|  7.01k|    pu1_pred_horz = pu1_src + (y_offset >> 1) * src_strd;
  694|  7.01k|    pu1_pred_vert = pu1_src + (x_offset >> 1);
  695|       |
  696|  66.6k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (696:18): [True: 59.6k, False: 7.01k]
  ------------------
  697|  59.6k|    {
  698|   651k|        for(col = 0; col < wd;
  ------------------
  |  Branch (698:22): [True: 591k, False: 59.6k]
  ------------------
  699|   591k|                        col++, pu1_dst++, pu1_pred_vert++, pu1_pred_horz++)
  700|   591k|        {
  701|   591k|            WORD16 i2_temp_vert, i2_temp_horz;
  702|       |            /* The logic below implements the following equation
  703|       |             i2_temp = puc_pred[-2*src_strd] + puc_pred[3*src_strd] -
  704|       |             5 * (puc_pred[-1*src_strd] + puc_pred[2*src_strd])  +
  705|       |             20 * (puc_pred[0] + puc_pred[src_strd]); */
  706|   591k|            i2_temp_vert = pu1_pred_vert[-off2] + pu1_pred_vert[off3]
  707|   591k|                            - (pu1_pred_vert[-off1] + pu1_pred_vert[off2])
  708|   591k|                            + ((pu1_pred_vert[0] + pu1_pred_vert[off1]
  709|   591k|                                            - pu1_pred_vert[-off1]
  710|   591k|                                            - pu1_pred_vert[off2]) << 2)
  711|   591k|                            + ((pu1_pred_vert[0] + pu1_pred_vert[off1]) << 4);
  712|   591k|            i2_temp_vert = (i2_temp_vert + 16) >> 5;
  713|   591k|            i2_temp_vert = CLIP_U8(i2_temp_vert);
  ------------------
  |  |   58|   591k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   591k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 24.4k, False: 567k]
  |  |  |  |  |  Branch (77:54): [True: 1.13k, False: 566k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  714|       |
  715|       |            /* The logic below implements the following equation
  716|       |             i16_temp = puc_pred[-2] - 5 * (puc_pred[-1] + puc_pred[2]) +
  717|       |             20 * (puc_pred[0] + puc_pred[1]) + puc_pred[3]; */
  718|   591k|            i2_temp_horz = pu1_pred_horz[-2] + pu1_pred_horz[3]
  719|   591k|                            - (pu1_pred_horz[-1] + pu1_pred_horz[2])
  720|   591k|                            + ((pu1_pred_horz[0] + pu1_pred_horz[1]
  721|   591k|                                            - pu1_pred_horz[-1]
  722|   591k|                                            - pu1_pred_horz[2]) << 2)
  723|   591k|                            + ((pu1_pred_horz[0] + pu1_pred_horz[1]) << 4);
  724|   591k|            i2_temp_horz = (i2_temp_horz + 16) >> 5;
  725|   591k|            i2_temp_horz = CLIP_U8(i2_temp_horz);
  ------------------
  |  |   58|   591k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   591k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 15.5k, False: 576k]
  |  |  |  |  |  Branch (77:54): [True: 682, False: 575k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  726|   591k|            *pu1_dst = (i2_temp_vert + i2_temp_horz + 1) >> 1;
  727|   591k|        }
  728|  59.6k|        pu1_pred_vert += (src_strd - wd);
  729|  59.6k|        pu1_pred_horz += (src_strd - wd);
  730|  59.6k|        pu1_dst += (dst_strd - wd);
  731|  59.6k|    }
  732|  7.01k|}
ih264_inter_pred_luma_horz_qpel_vert_hpel:
  792|  2.86k|{
  793|  2.86k|    WORD32 row, col;
  794|  2.86k|    WORD32 tmp;
  795|  2.86k|    WORD16* pi2_pred1_temp, *pi2_pred1;
  796|  2.86k|    UWORD8* pu1_dst_tmp;
  797|  2.86k|    WORD32 x_offset = dydx & 0x3;
  798|  2.86k|    WORD16 i2_macro;
  799|       |
  800|  2.86k|    pi2_pred1_temp = (WORD16*)pu1_tmp;
  801|  2.86k|    pi2_pred1_temp += 2;
  802|  2.86k|    pi2_pred1 = pi2_pred1_temp;
  803|  2.86k|    pu1_dst_tmp = pu1_dst;
  804|       |
  805|  28.5k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (805:18): [True: 25.6k, False: 2.86k]
  ------------------
  806|  25.6k|    {
  807|   424k|        for(col = -2; col < wd + 3; col++)
  ------------------
  |  Branch (807:23): [True: 398k, False: 25.6k]
  ------------------
  808|   398k|        {
  809|   398k|            tmp = 0;/*ih264_g_six_tap[] is the array containing the filter coeffs*/
  810|   398k|            tmp = ih264_g_six_tap[0] *
  811|   398k|                            (pu1_src[col - 2 * src_strd] + pu1_src[col + 3 * src_strd])
  812|   398k|                  + ih264_g_six_tap[1] *
  813|   398k|                            (pu1_src[col - 1 * src_strd] + pu1_src[col + 2 * src_strd])
  814|   398k|                  + ih264_g_six_tap[2] *
  815|   398k|                            (pu1_src[col] + pu1_src[col + 1 * src_strd]);
  816|   398k|            pi2_pred1_temp[col] = tmp;
  817|   398k|        }
  818|       |
  819|  25.6k|        pu1_src += src_strd;
  820|  25.6k|        pi2_pred1_temp = pi2_pred1_temp + wd + 5;
  821|  25.6k|    }
  822|       |
  823|  2.86k|    pi2_pred1_temp = pi2_pred1;
  824|  28.5k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (824:18): [True: 25.6k, False: 2.86k]
  ------------------
  825|  25.6k|    {
  826|   296k|        for(col = 0; col < wd; col++)
  ------------------
  |  Branch (826:22): [True: 270k, False: 25.6k]
  ------------------
  827|   270k|        {
  828|   270k|            tmp = 0;/*ih264_g_six_tap[] is the array containing the filter coeffs*/
  829|   270k|            tmp = ih264_g_six_tap[0] *
  830|   270k|                            (pi2_pred1[col - 2] + pi2_pred1[col + 3])
  831|   270k|                  + ih264_g_six_tap[1] *
  832|   270k|                            (pi2_pred1[col - 1] + pi2_pred1[col + 2])
  833|   270k|                  + ih264_g_six_tap[2] *
  834|   270k|                            (pi2_pred1[col] + pi2_pred1[col + 1]);
  835|   270k|            tmp = (tmp + 512) >> 10;
  836|   270k|            pu1_dst[col] = CLIP_U8(tmp);
  ------------------
  |  |   58|   270k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   270k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 11.2k, False: 259k]
  |  |  |  |  |  Branch (77:54): [True: 166, False: 258k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  837|   270k|        }
  838|  25.6k|        pi2_pred1 += (wd + 5);
  839|  25.6k|        pu1_dst += dst_strd;
  840|  25.6k|    }
  841|       |
  842|  2.86k|    pu1_dst = pu1_dst_tmp;
  843|  2.86k|    pi2_pred1_temp += (x_offset >> 1);
  844|  28.5k|    for(row = ht; row != 0; row--)
  ------------------
  |  Branch (844:19): [True: 25.6k, False: 2.86k]
  ------------------
  845|  25.6k|    {
  846|   296k|        for(col = wd; col != 0; col--, pu1_dst++, pi2_pred1_temp++)
  ------------------
  |  Branch (846:23): [True: 270k, False: 25.6k]
  ------------------
  847|   270k|        {
  848|   270k|            UWORD8 uc_temp;
  849|       |            /* Clipping the output of the six tap filter obtained from the
  850|       |             first stage of the 2d filter stage */
  851|   270k|            *pi2_pred1_temp = (*pi2_pred1_temp + 16) >> 5;
  852|   270k|            i2_macro = (*pi2_pred1_temp);
  853|   270k|            uc_temp = CLIP_U8(i2_macro);
  ------------------
  |  |   58|   270k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   270k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 9.17k, False: 261k]
  |  |  |  |  |  Branch (77:54): [True: 172, False: 261k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  854|   270k|            *pu1_dst = (*pu1_dst + uc_temp + 1) >> 1;
  855|   270k|        }
  856|  25.6k|        pi2_pred1_temp += 5;
  857|  25.6k|        pu1_dst += dst_strd - wd;
  858|  25.6k|    }
  859|  2.86k|}
ih264_inter_pred_luma_horz_hpel_vert_qpel:
  957|  3.02k|{
  958|       |
  959|  3.02k|    WORD32 row, col;
  960|  3.02k|    WORD32 tmp;
  961|  3.02k|    WORD32 y_offset = dydx >> 2;
  962|  3.02k|    WORD16* pi2_pred1_temp, *pi2_pred1;
  963|  3.02k|    UWORD8* pu1_dst_tmp;
  964|       |    //WORD32 x_offset = dydx & 0x3;
  965|  3.02k|    WORD16 i2_macro;
  966|       |
  967|  3.02k|    y_offset = y_offset & 0x3;
  968|       |
  969|  3.02k|    pi2_pred1_temp = (WORD16*)pu1_tmp;
  970|  3.02k|    pi2_pred1_temp += 2 * wd;
  971|  3.02k|    pi2_pred1 = pi2_pred1_temp;
  972|  3.02k|    pu1_dst_tmp = pu1_dst;
  973|  3.02k|    pu1_src -= 2 * src_strd;
  974|  45.0k|    for(row = -2; row < ht + 3; row++)
  ------------------
  |  Branch (974:19): [True: 42.0k, False: 3.02k]
  ------------------
  975|  42.0k|    {
  976|   449k|        for(col = 0; col < wd; col++)
  ------------------
  |  Branch (976:22): [True: 407k, False: 42.0k]
  ------------------
  977|   407k|        {
  978|   407k|            tmp = 0;/*ih264_g_six_tap[] is the array containing the filter coeffs*/
  979|   407k|            tmp = ih264_g_six_tap[0] * (pu1_src[col - 2] + pu1_src[col + 3])
  980|   407k|                  + ih264_g_six_tap[1] * (pu1_src[col - 1] + pu1_src[col + 2])
  981|   407k|                  + ih264_g_six_tap[2] * (pu1_src[col] + pu1_src[col + 1]);
  982|   407k|            pi2_pred1_temp[col - 2 * wd] = tmp;
  983|   407k|        }
  984|       |
  985|  42.0k|        pu1_src += src_strd;
  986|  42.0k|        pi2_pred1_temp += wd;
  987|  42.0k|    }
  988|  3.02k|    pi2_pred1_temp = pi2_pred1;
  989|  29.9k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (989:18): [True: 26.9k, False: 3.02k]
  ------------------
  990|  26.9k|    {
  991|   305k|        for(col = 0; col < wd; col++)
  ------------------
  |  Branch (991:22): [True: 278k, False: 26.9k]
  ------------------
  992|   278k|        {
  993|   278k|            tmp = 0;/*ih264_g_six_tap[] is the array containing the filter coeffs*/
  994|   278k|            tmp = ih264_g_six_tap[0] * (pi2_pred1[col - 2 * wd] + pi2_pred1[col + 3 * wd])
  995|   278k|                  + ih264_g_six_tap[1] * (pi2_pred1[col - 1 * wd] + pi2_pred1[col + 2 * wd])
  996|   278k|                  + ih264_g_six_tap[2] * (pi2_pred1[col] + pi2_pred1[col + 1 * wd]);
  997|   278k|            tmp = (tmp + 512) >> 10;
  998|   278k|            pu1_dst[col] = CLIP_U8(tmp);
  ------------------
  |  |   58|   278k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   278k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 13.3k, False: 265k]
  |  |  |  |  |  Branch (77:54): [True: 568, False: 265k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  999|   278k|        }
 1000|  26.9k|        pi2_pred1 += wd;
 1001|  26.9k|        pu1_dst += dst_strd;
 1002|  26.9k|    }
 1003|  3.02k|    pu1_dst = pu1_dst_tmp;
 1004|  3.02k|    pi2_pred1_temp += (y_offset >> 1) * wd;
 1005|  29.9k|    for(row = ht; row != 0; row--)
  ------------------
  |  Branch (1005:19): [True: 26.9k, False: 3.02k]
  ------------------
 1006|       |
 1007|  26.9k|    {
 1008|   305k|        for(col = wd; col != 0; col--, pu1_dst++, pi2_pred1_temp++)
  ------------------
  |  Branch (1008:23): [True: 278k, False: 26.9k]
  ------------------
 1009|   278k|        {
 1010|   278k|            UWORD8 u1_temp;
 1011|       |            /* Clipping the output of the six tap filter obtained from the
 1012|       |             first stage of the 2d filter stage */
 1013|   278k|            *pi2_pred1_temp = (*pi2_pred1_temp + 16) >> 5;
 1014|   278k|            i2_macro = (*pi2_pred1_temp);
 1015|   278k|            u1_temp = CLIP_U8(i2_macro);
  ------------------
  |  |   58|   278k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   278k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 7.10k, False: 271k]
  |  |  |  |  |  Branch (77:54): [True: 491, False: 271k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1016|   278k|            *pu1_dst = (*pu1_dst + u1_temp + 1) >> 1;
 1017|   278k|        }
 1018|       |        //pi16_pred1_temp += wd;
 1019|  26.9k|        pu1_dst += dst_strd - wd;
 1020|  26.9k|    }
 1021|  3.02k|}
ih264_inter_pred_chroma:
 1141|   131k|{
 1142|   131k|    WORD32 row, col;
 1143|   131k|    WORD16 i2_tmp;
 1144|       |
 1145|  1.05M|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (1145:18): [True: 926k, False: 131k]
  ------------------
 1146|   926k|    {
 1147|  14.9M|        for(col = 0; col < 2 * wd; col++)
  ------------------
  |  Branch (1147:22): [True: 13.9M, False: 926k]
  ------------------
 1148|  13.9M|        {
 1149|  13.9M|            i2_tmp = 0; /* applies equation (8-266) in section 8.4.2.2.2 */
 1150|  13.9M|            i2_tmp = (8 - dx) * (8 - dy) * pu1_src[col]
 1151|  13.9M|                     + (dx) * (8 - dy) * pu1_src[col + 2]
 1152|  13.9M|                     + (8 - dx) * (dy) * (pu1_src + src_strd)[col]
 1153|  13.9M|                     + (dx) * (dy) * (pu1_src + src_strd)[col + 2];
 1154|  13.9M|            i2_tmp = (i2_tmp + 32) >> 6;
 1155|  13.9M|            pu1_dst[col] = CLIP_U8(i2_tmp);
  ------------------
  |  |   58|  13.9M|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  13.9M|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 13.9M]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 13.9M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1156|  13.9M|        }
 1157|   926k|        pu1_src += src_strd;
 1158|   926k|        pu1_dst += dst_strd;
 1159|   926k|    }
 1160|   131k|}

ih264_iquant_itrans_recon_4x4:
  126|  50.9k|{
  127|  50.9k|    WORD16 *pi2_src_ptr = pi2_src;
  128|  50.9k|    WORD16 *pi2_tmp_ptr = pi2_tmp;
  129|  50.9k|    UWORD8 *pu1_pred_ptr = pu1_pred;
  130|  50.9k|    UWORD8 *pu1_out_ptr = pu1_out;
  131|  50.9k|    WORD16 x0, x1, x2, x3, i;
  132|  50.9k|    WORD32 q0, q1, q2, q3;
  133|  50.9k|    WORD16 i_macro;
  134|  50.9k|    WORD16 rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
  ------------------
  |  Branch (134:23): [True: 3.07k, False: 47.8k]
  ------------------
  135|       |
  136|       |    /* inverse quant */
  137|       |    /* horizontal inverse transform */
  138|   254k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|   254k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (138:16): [True: 203k, False: 50.9k]
  ------------------
  139|   203k|    {
  140|   203k|        q0 = pi2_src_ptr[0];
  141|   203k|        INV_QUANT(q0, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|   203k|                {\
  |  |  104|   203k|                    i4_value *= quant_scale;\
  |  |  105|   203k|                    i4_value *= weight_scale;\
  |  |  106|   203k|                    i4_value += rndfactor;\
  |  |  107|   203k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|   203k|                    i4_value >>= qbits;\
  |  |  109|   203k|                }
  ------------------
  142|       |        /* Restoring dc value for intra case */
  143|   203k|        if (i==0 && iq_start_idx == 1)
  ------------------
  |  Branch (143:13): [True: 50.9k, False: 152k]
  |  Branch (143:21): [True: 5.47k, False: 45.4k]
  ------------------
  144|  5.47k|        {
  145|  5.47k|            q0 = pi2_dc_ld_addr[0];
  146|  5.47k|        }
  147|       |
  148|   203k|        q2 = pi2_src_ptr[2];
  149|   203k|        INV_QUANT(q2, pu2_iscal_mat[2], pu2_weigh_mat[2], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|   203k|                {\
  |  |  104|   203k|                    i4_value *= quant_scale;\
  |  |  105|   203k|                    i4_value *= weight_scale;\
  |  |  106|   203k|                    i4_value += rndfactor;\
  |  |  107|   203k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|   203k|                    i4_value >>= qbits;\
  |  |  109|   203k|                }
  ------------------
  150|       |
  151|   203k|        x0 = q0 + q2;
  152|   203k|        x1 = q0 - q2;
  153|       |
  154|   203k|        q1 = pi2_src_ptr[1];
  155|   203k|        INV_QUANT(q1, pu2_iscal_mat[1], pu2_weigh_mat[1], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|   203k|                {\
  |  |  104|   203k|                    i4_value *= quant_scale;\
  |  |  105|   203k|                    i4_value *= weight_scale;\
  |  |  106|   203k|                    i4_value += rndfactor;\
  |  |  107|   203k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|   203k|                    i4_value >>= qbits;\
  |  |  109|   203k|                }
  ------------------
  156|       |
  157|   203k|        q3 = pi2_src_ptr[3];
  158|   203k|        INV_QUANT(q3, pu2_iscal_mat[3], pu2_weigh_mat[3], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|   203k|                {\
  |  |  104|   203k|                    i4_value *= quant_scale;\
  |  |  105|   203k|                    i4_value *= weight_scale;\
  |  |  106|   203k|                    i4_value += rndfactor;\
  |  |  107|   203k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|   203k|                    i4_value >>= qbits;\
  |  |  109|   203k|                }
  ------------------
  159|       |
  160|   203k|        x2 = (q1 >> 1) - q3;
  161|   203k|        x3 = q1 + (q3 >> 1);
  162|       |
  163|   203k|        pi2_tmp_ptr[0] = x0 + x3;
  164|   203k|        pi2_tmp_ptr[1] = x1 + x2;
  165|   203k|        pi2_tmp_ptr[2] = x1 - x2;
  166|   203k|        pi2_tmp_ptr[3] = x0 - x3;
  167|       |
  168|   203k|        pi2_src_ptr += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|   203k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  169|   203k|        pi2_tmp_ptr += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|   203k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  170|   203k|        pu2_iscal_mat += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|   203k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  171|   203k|        pu2_weigh_mat += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|   203k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  172|   203k|    }
  173|       |
  174|       |    /* vertical inverse transform */
  175|  50.9k|    pi2_tmp_ptr = pi2_tmp;
  176|   254k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|   254k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (176:16): [True: 203k, False: 50.9k]
  ------------------
  177|   203k|    {
  178|   203k|        pu1_pred_ptr = pu1_pred;
  179|   203k|        pu1_out = pu1_out_ptr;
  180|       |
  181|   203k|        x0 = (pi2_tmp_ptr[0] + pi2_tmp_ptr[8]);
  182|   203k|        x1 = (pi2_tmp_ptr[0] - pi2_tmp_ptr[8]);
  183|   203k|        x2 = (pi2_tmp_ptr[4] >> 1) - pi2_tmp_ptr[12];
  184|   203k|        x3 = pi2_tmp_ptr[4] + (pi2_tmp_ptr[12] >> 1);
  185|       |
  186|       |        /* inverse prediction */
  187|   203k|        i_macro = x0 + x3;
  188|   203k|        i_macro = ((i_macro + 32) >> 6);
  189|   203k|        i_macro += *pu1_pred_ptr;
  190|   203k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   203k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   203k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 33.5k, False: 170k]
  |  |  |  |  |  Branch (77:54): [True: 54.2k, False: 115k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  191|   203k|        pu1_pred_ptr += pred_strd;
  192|   203k|        pu1_out += out_strd;
  193|       |
  194|   203k|        i_macro = x1 + x2;
  195|   203k|        i_macro = ((i_macro + 32) >> 6);
  196|   203k|        i_macro += *pu1_pred_ptr;
  197|   203k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   203k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   203k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 36.3k, False: 167k]
  |  |  |  |  |  Branch (77:54): [True: 59.9k, False: 107k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  198|   203k|        pu1_pred_ptr += pred_strd;
  199|   203k|        pu1_out += out_strd;
  200|       |
  201|   203k|        i_macro = x1 - x2;
  202|   203k|        i_macro = ((i_macro + 32) >> 6);
  203|   203k|        i_macro += *pu1_pred_ptr;
  204|   203k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   203k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   203k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 35.0k, False: 168k]
  |  |  |  |  |  Branch (77:54): [True: 43.1k, False: 125k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  205|   203k|        pu1_pred_ptr += pred_strd;
  206|   203k|        pu1_out += out_strd;
  207|       |
  208|   203k|        i_macro = x0 - x3;
  209|   203k|        i_macro = ((i_macro + 32) >> 6);
  210|   203k|        i_macro += *pu1_pred_ptr;
  211|   203k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   203k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   203k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 35.1k, False: 168k]
  |  |  |  |  |  Branch (77:54): [True: 55.2k, False: 113k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  212|       |
  213|   203k|        pi2_tmp_ptr++;
  214|   203k|        pu1_out_ptr++;
  215|   203k|        pu1_pred++;
  216|   203k|    }
  217|  50.9k|}
ih264_iquant_itrans_recon_4x4_dc:
  280|  11.8k|{
  281|  11.8k|    UWORD8 *pu1_pred_ptr = pu1_pred;
  282|  11.8k|    UWORD8 *pu1_out_ptr = pu1_out;
  283|  11.8k|    WORD32 q0;
  284|  11.8k|    WORD16 x, i_macro, i;
  285|  11.8k|    WORD16 rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
  ------------------
  |  Branch (285:23): [True: 1.33k, False: 10.5k]
  ------------------
  286|       |
  287|  11.8k|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|  11.8k|#define UNUSED(x) ((void)(x))
  ------------------
  288|  11.8k|    if(iq_start_idx == 0)
  ------------------
  |  Branch (288:8): [True: 2.19k, False: 9.64k]
  ------------------
  289|  2.19k|    {
  290|  2.19k|        q0 = pi2_src[0];
  291|  2.19k|        INV_QUANT(q0, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  2.19k|                {\
  |  |  104|  2.19k|                    i4_value *= quant_scale;\
  |  |  105|  2.19k|                    i4_value *= weight_scale;\
  |  |  106|  2.19k|                    i4_value += rndfactor;\
  |  |  107|  2.19k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  2.19k|                    i4_value >>= qbits;\
  |  |  109|  2.19k|                }
  ------------------
  292|  2.19k|    }
  293|  9.64k|    else
  294|  9.64k|    {
  295|  9.64k|        q0 = pi2_dc_ld_addr[0]; // Restoring dc value for intra case3
  296|  9.64k|    }
  297|  11.8k|    i_macro = ((q0 + 32) >> 6);
  298|  59.2k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|  59.2k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (298:16): [True: 47.3k, False: 11.8k]
  ------------------
  299|  47.3k|    {
  300|  47.3k|        pu1_pred_ptr = pu1_pred;
  301|  47.3k|        pu1_out = pu1_out_ptr;
  302|       |
  303|       |        /* inverse prediction */
  304|  47.3k|        x = i_macro + *pu1_pred_ptr;
  305|  47.3k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  47.3k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  47.3k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 11.8k, False: 35.5k]
  |  |  |  |  |  Branch (77:54): [True: 1.01k, False: 34.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  306|  47.3k|        pu1_pred_ptr += pred_strd;
  307|  47.3k|        pu1_out += out_strd;
  308|       |
  309|  47.3k|        x = i_macro + *pu1_pred_ptr;
  310|  47.3k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  47.3k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  47.3k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 11.8k, False: 35.5k]
  |  |  |  |  |  Branch (77:54): [True: 998, False: 34.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  311|  47.3k|        pu1_pred_ptr += pred_strd;
  312|  47.3k|        pu1_out += out_strd;
  313|       |
  314|  47.3k|        x = i_macro + *pu1_pred_ptr;
  315|  47.3k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  47.3k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  47.3k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 11.8k, False: 35.5k]
  |  |  |  |  |  Branch (77:54): [True: 985, False: 34.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  316|  47.3k|        pu1_pred_ptr += pred_strd;
  317|  47.3k|        pu1_out += out_strd;
  318|       |
  319|  47.3k|        x = i_macro + *pu1_pred_ptr;
  320|  47.3k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  47.3k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  47.3k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 11.8k, False: 35.4k]
  |  |  |  |  |  Branch (77:54): [True: 973, False: 34.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  321|       |
  322|  47.3k|        pu1_out_ptr++;
  323|  47.3k|        pu1_pred++;
  324|  47.3k|    }
  325|  11.8k|}
ih264_iquant_itrans_recon_8x8:
  389|  14.4k|{
  390|  14.4k|    WORD32 i;
  391|  14.4k|    WORD16 *pi2_tmp_ptr = pi2_tmp;
  392|  14.4k|    UWORD8 *pu1_pred_ptr = pu1_pred;
  393|  14.4k|    UWORD8 *pu1_out_ptr = pu1_out;
  394|  14.4k|    WORD16 i_z0, i_z1, i_z2, i_z3, i_z4, i_z5, i_z6, i_z7;
  395|  14.4k|    WORD16 i_y0, i_y1, i_y2, i_y3, i_y4, i_y5, i_y6, i_y7;
  396|  14.4k|    WORD16 i_macro;
  397|  14.4k|    WORD32 q;
  398|  14.4k|    WORD32 rnd_fact = (qp_div < 6) ? (1 << (5 - qp_div)) : 0;
  ------------------
  |  Branch (398:23): [True: 10.8k, False: 3.62k]
  ------------------
  399|       |
  400|  14.4k|    UNUSED(iq_start_idx);
  ------------------
  |  |   45|  14.4k|#define UNUSED(x) ((void)(x))
  ------------------
  401|  14.4k|    UNUSED(pi2_dc_ld_addr);
  ------------------
  |  |   45|  14.4k|#define UNUSED(x) ((void)(x))
  ------------------
  402|       |    /*************************************************************/
  403|       |    /* De quantization of coefficients. Will be replaced by SIMD */
  404|       |    /* operations on platform. Note : DC coeff is not scaled     */
  405|       |    /*************************************************************/
  406|   940k|    for(i = 0; i < (SUB_BLK_WIDTH_8x8 * SUB_BLK_WIDTH_8x8); i++)
  ------------------
  |  |   53|   940k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
                  for(i = 0; i < (SUB_BLK_WIDTH_8x8 * SUB_BLK_WIDTH_8x8); i++)
  ------------------
  |  |   53|   940k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  |  Branch (406:16): [True: 926k, False: 14.4k]
  ------------------
  407|   926k|    {
  408|   926k|        q = pi2_src[i];
  409|   926k|        INV_QUANT(q, pu2_iscale_mat[i], pu2_weigh_mat[i], qp_div, rnd_fact, 6);
  ------------------
  |  |  103|   926k|                {\
  |  |  104|   926k|                    i4_value *= quant_scale;\
  |  |  105|   926k|                    i4_value *= weight_scale;\
  |  |  106|   926k|                    i4_value += rndfactor;\
  |  |  107|   926k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|   926k|                    i4_value >>= qbits;\
  |  |  109|   926k|                }
  ------------------
  410|   926k|        pi2_tmp_ptr[i] = q;
  411|   926k|    }
  412|       |    /* Perform Inverse transform */
  413|       |    /*--------------------------------------------------------------------*/
  414|       |    /* IDCT [ Horizontal transformation ]                                 */
  415|       |    /*--------------------------------------------------------------------*/
  416|   130k|    for(i = 0; i < SUB_BLK_WIDTH_8x8; i++)
  ------------------
  |  |   53|   130k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  |  Branch (416:16): [True: 115k, False: 14.4k]
  ------------------
  417|   115k|    {
  418|       |        /*------------------------------------------------------------------*/
  419|       |        /* y0 = w0 + w4                                                     */
  420|       |        /* y1 = -w3 + w5 - w7 - (w7 >> 1)                                   */
  421|       |        /* y2 = w0 - w4                                                     */
  422|       |        /* y3 = w1 + w7 - w3 - (w3 >> 1)                                    */
  423|       |        /* y4 = (w2 >> 1) - w6                                              */
  424|       |        /* y5 = -w1 + w7 + w5 + (w5 >> 1)                                   */
  425|       |        /* y6 = w2 + (w6 >> 1)                                              */
  426|       |        /* y7 = w3 + w5 + w1 + (w1 >> 1)                                    */
  427|       |        /*------------------------------------------------------------------*/
  428|   115k|        i_y0 = (pi2_tmp_ptr[0] + pi2_tmp_ptr[4] );
  429|       |
  430|   115k|        i_y1 = ((WORD32)(-pi2_tmp_ptr[3]) + pi2_tmp_ptr[5] - pi2_tmp_ptr[7]
  431|   115k|                        - (pi2_tmp_ptr[7] >> 1));
  432|       |
  433|   115k|        i_y2 = (pi2_tmp_ptr[0] - pi2_tmp_ptr[4] );
  434|       |
  435|   115k|        i_y3 = ((WORD32)pi2_tmp_ptr[1] + pi2_tmp_ptr[7] - pi2_tmp_ptr[3]
  436|   115k|                        - (pi2_tmp_ptr[3] >> 1));
  437|       |
  438|   115k|        i_y4 = ((pi2_tmp_ptr[2] >> 1) - pi2_tmp_ptr[6] );
  439|       |
  440|   115k|        i_y5 = ((WORD32)(-pi2_tmp_ptr[1]) + pi2_tmp_ptr[7] + pi2_tmp_ptr[5]
  441|   115k|                        + (pi2_tmp_ptr[5] >> 1));
  442|       |
  443|   115k|        i_y6 = (pi2_tmp_ptr[2] + (pi2_tmp_ptr[6] >> 1));
  444|       |
  445|   115k|        i_y7 = ((WORD32)pi2_tmp_ptr[3] + pi2_tmp_ptr[5] + pi2_tmp_ptr[1]
  446|   115k|                        + (pi2_tmp_ptr[1] >> 1));
  447|       |
  448|       |        /*------------------------------------------------------------------*/
  449|       |        /* z0 = y0 + y6                                                     */
  450|       |        /* z1 = y1 + (y7 >> 2)                                              */
  451|       |        /* z2 = y2 + y4                                                     */
  452|       |        /* z3 = y3 + (y5 >> 2)                                              */
  453|       |        /* z4 = y2 - y4                                                     */
  454|       |        /* z5 = (y3 >> 2) - y5                                              */
  455|       |        /* z6 = y0 - y6                                                     */
  456|       |        /* z7 = y7 - (y1 >> 2)                                              */
  457|       |        /*------------------------------------------------------------------*/
  458|   115k|        i_z0 = i_y0 + i_y6;
  459|   115k|        i_z1 = i_y1 + (i_y7 >> 2);
  460|   115k|        i_z2 = i_y2 + i_y4;
  461|   115k|        i_z3 = i_y3 + (i_y5 >> 2);
  462|   115k|        i_z4 = i_y2 - i_y4;
  463|   115k|        i_z5 = (i_y3 >> 2) - i_y5;
  464|   115k|        i_z6 = i_y0 - i_y6;
  465|   115k|        i_z7 = i_y7 - (i_y1 >> 2);
  466|       |
  467|       |        /*------------------------------------------------------------------*/
  468|       |        /* x0 = z0 + z7                                                     */
  469|       |        /* x1 = z2 + z5                                                     */
  470|       |        /* x2 = z4 + z3                                                     */
  471|       |        /* x3 = z6 + z1                                                     */
  472|       |        /* x4 = z6 - z1                                                     */
  473|       |        /* x5 = z4 - z3                                                     */
  474|       |        /* x6 = z2 - z5                                                     */
  475|       |        /* x7 = z0 - z7                                                     */
  476|       |        /*------------------------------------------------------------------*/
  477|   115k|        pi2_tmp_ptr[0] = i_z0 + i_z7;
  478|   115k|        pi2_tmp_ptr[1] = i_z2 + i_z5;
  479|   115k|        pi2_tmp_ptr[2] = i_z4 + i_z3;
  480|   115k|        pi2_tmp_ptr[3] = i_z6 + i_z1;
  481|   115k|        pi2_tmp_ptr[4] = i_z6 - i_z1;
  482|   115k|        pi2_tmp_ptr[5] = i_z4 - i_z3;
  483|   115k|        pi2_tmp_ptr[6] = i_z2 - i_z5;
  484|   115k|        pi2_tmp_ptr[7] = i_z0 - i_z7;
  485|       |
  486|       |        /* move to the next row */
  487|       |        //pi2_src_ptr += SUB_BLK_WIDTH_8x8;
  488|   115k|        pi2_tmp_ptr += SUB_BLK_WIDTH_8x8;
  ------------------
  |  |   53|   115k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  489|   115k|    }
  490|       |
  491|       |    /*--------------------------------------------------------------------*/
  492|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6            */
  493|       |    /*                                                                    */
  494|       |    /* Add the prediction and store it back to reconstructed frame buffer */
  495|       |    /* [Prediction buffer itself in this case]                            */
  496|       |    /*--------------------------------------------------------------------*/
  497|  14.4k|    pi2_tmp_ptr = pi2_tmp;
  498|   130k|    for(i = 0; i < SUB_BLK_WIDTH_8x8; i++)
  ------------------
  |  |   53|   130k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  |  Branch (498:16): [True: 115k, False: 14.4k]
  ------------------
  499|   115k|    {
  500|   115k|        pu1_pred_ptr = pu1_pred;
  501|   115k|        pu1_out = pu1_out_ptr;
  502|       |        /*------------------------------------------------------------------*/
  503|       |        /* y0j = w0j + w4j                                                  */
  504|       |        /* y1j = -w3j + w5j -w7j -(w7j >> 1)                                */
  505|       |        /* y2j = w0j -w4j                                                   */
  506|       |        /* y3j = w1j + w7j -w3j -(w3j >> 1)                                 */
  507|       |        /* y4j = ( w2j >> 1 ) -w6j                                          */
  508|       |        /* y5j = -w1j + w7j + w5j + (w5j >> 1)                              */
  509|       |        /* y6j = w2j + ( w6j >> 1 )                                         */
  510|       |        /* y7j = w3j + w5j + w1j + (w1j >> 1)                               */
  511|       |        /*------------------------------------------------------------------*/
  512|   115k|        i_y0 = pi2_tmp_ptr[0] + pi2_tmp_ptr[32];
  513|       |
  514|   115k|        i_y1 = (WORD32)(-pi2_tmp_ptr[24]) + pi2_tmp_ptr[40] - pi2_tmp_ptr[56]
  515|   115k|                        - (pi2_tmp_ptr[56] >> 1);
  516|       |
  517|   115k|        i_y2 = pi2_tmp_ptr[0] - pi2_tmp_ptr[32];
  518|       |
  519|   115k|        i_y3 = (WORD32)pi2_tmp_ptr[8] + pi2_tmp_ptr[56] - pi2_tmp_ptr[24]
  520|   115k|                        - (pi2_tmp_ptr[24] >> 1);
  521|       |
  522|   115k|        i_y4 = (pi2_tmp_ptr[16] >> 1) - pi2_tmp_ptr[48];
  523|       |
  524|   115k|        i_y5 = (WORD32)(-pi2_tmp_ptr[8]) + pi2_tmp_ptr[56] + pi2_tmp_ptr[40]
  525|   115k|                        + (pi2_tmp_ptr[40] >> 1);
  526|       |
  527|   115k|        i_y6 = pi2_tmp_ptr[16] + (pi2_tmp_ptr[48] >> 1);
  528|       |
  529|   115k|        i_y7 = (WORD32)pi2_tmp_ptr[24] + pi2_tmp_ptr[40] + pi2_tmp_ptr[8]
  530|   115k|                        + (pi2_tmp_ptr[8] >> 1);
  531|       |
  532|       |        /*------------------------------------------------------------------*/
  533|       |        /* z0j = y0j + y6j                                                  */
  534|       |        /* z1j = y1j + (y7j >> 2)                                           */
  535|       |        /* z2j = y2j + y4j                                                  */
  536|       |        /* z3j = y3j + (y5j >> 2)                                           */
  537|       |        /* z4j = y2j -y4j                                                   */
  538|       |        /* z5j = (y3j >> 2) -y5j                                            */
  539|       |        /* z6j = y0j -y6j                                                   */
  540|       |        /* z7j = y7j -(y1j >> 2)                                            */
  541|       |        /*------------------------------------------------------------------*/
  542|   115k|        i_z0 = i_y0 + i_y6;
  543|   115k|        i_z1 = i_y1 + (i_y7 >> 2);
  544|   115k|        i_z2 = i_y2 + i_y4;
  545|   115k|        i_z3 = i_y3 + (i_y5 >> 2);
  546|   115k|        i_z4 = i_y2 - i_y4;
  547|   115k|        i_z5 = (i_y3 >> 2) - i_y5;
  548|   115k|        i_z6 = i_y0 - i_y6;
  549|   115k|        i_z7 = i_y7 - (i_y1 >> 2);
  550|       |
  551|       |        /*------------------------------------------------------------------*/
  552|       |        /* x0j = z0j + z7j                                                  */
  553|       |        /* x1j = z2j + z5j                                                  */
  554|       |        /* x2j = z4j + z3j                                                  */
  555|       |        /* x3j = z6j + z1j                                                  */
  556|       |        /* x4j = z6j -z1j                                                   */
  557|       |        /* x5j = z4j -z3j                                                   */
  558|       |        /* x6j = z2j -z5j                                                   */
  559|       |        /* x7j = z0j -z7j                                                   */
  560|       |        /*------------------------------------------------------------------*/
  561|   115k|        i_macro = ((i_z0 + i_z7 + 32) >> 6) + *pu1_pred_ptr;
  562|   115k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   115k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   115k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 22.6k, False: 93.1k]
  |  |  |  |  |  Branch (77:54): [True: 4.73k, False: 88.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  563|       |        /* Change uc_recBuffer to Point to next element in the same column*/
  564|   115k|        pu1_pred_ptr += pred_strd;
  565|   115k|        pu1_out += out_strd;
  566|       |
  567|   115k|        i_macro = ((i_z2 + i_z5 + 32) >> 6) + *pu1_pred_ptr;
  568|   115k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   115k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   115k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 21.6k, False: 94.0k]
  |  |  |  |  |  Branch (77:54): [True: 3.59k, False: 90.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  569|   115k|        pu1_pred_ptr += pred_strd;
  570|   115k|        pu1_out += out_strd;
  571|       |
  572|   115k|        i_macro = ((i_z4 + i_z3 + 32) >> 6) + *pu1_pred_ptr;
  573|   115k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   115k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   115k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 21.2k, False: 94.5k]
  |  |  |  |  |  Branch (77:54): [True: 3.52k, False: 90.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  574|   115k|        pu1_pred_ptr += pred_strd;
  575|   115k|        pu1_out += out_strd;
  576|       |
  577|   115k|        i_macro = ((i_z6 + i_z1 + 32) >> 6) + *pu1_pred_ptr;
  578|   115k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   115k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   115k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 21.3k, False: 94.3k]
  |  |  |  |  |  Branch (77:54): [True: 3.73k, False: 90.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  579|   115k|        pu1_pred_ptr += pred_strd;
  580|   115k|        pu1_out += out_strd;
  581|       |
  582|   115k|        i_macro = ((i_z6 - i_z1 + 32) >> 6) + *pu1_pred_ptr;
  583|   115k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   115k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   115k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 21.4k, False: 94.3k]
  |  |  |  |  |  Branch (77:54): [True: 3.82k, False: 90.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  584|   115k|        pu1_pred_ptr += pred_strd;
  585|   115k|        pu1_out += out_strd;
  586|       |
  587|   115k|        i_macro = ((i_z4 - i_z3 + 32) >> 6) + *pu1_pred_ptr;
  588|   115k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   115k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   115k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 21.5k, False: 94.2k]
  |  |  |  |  |  Branch (77:54): [True: 3.46k, False: 90.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  589|   115k|        pu1_pred_ptr += pred_strd;
  590|   115k|        pu1_out += out_strd;
  591|       |
  592|   115k|        i_macro = ((i_z2 - i_z5 + 32) >> 6) + *pu1_pred_ptr;
  593|   115k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   115k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   115k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 22.0k, False: 93.6k]
  |  |  |  |  |  Branch (77:54): [True: 3.70k, False: 89.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  594|   115k|        pu1_pred_ptr += pred_strd;
  595|   115k|        pu1_out += out_strd;
  596|       |
  597|   115k|        i_macro = ((i_z0 - i_z7 + 32) >> 6) + *pu1_pred_ptr;
  598|   115k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   115k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   115k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 22.4k, False: 93.3k]
  |  |  |  |  |  Branch (77:54): [True: 4.51k, False: 88.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  599|       |
  600|   115k|        pi2_tmp_ptr++;
  601|   115k|        pu1_out_ptr++;
  602|   115k|        pu1_pred++;
  603|   115k|    }
  604|  14.4k|}
ih264_iquant_itrans_recon_8x8_dc:
  668|  2.35k|{
  669|  2.35k|    UWORD8 *pu1_pred_ptr = pu1_pred;
  670|  2.35k|    UWORD8 *pu1_out_ptr = pu1_out;
  671|  2.35k|    WORD16 x, i, i_macro;
  672|  2.35k|    WORD32 q;
  673|  2.35k|    WORD32 rnd_fact = (qp_div < 6) ? (1 << (5 - qp_div)) : 0;
  ------------------
  |  Branch (673:23): [True: 1.43k, False: 913]
  ------------------
  674|       |
  675|  2.35k|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|  2.35k|#define UNUSED(x) ((void)(x))
  ------------------
  676|  2.35k|    UNUSED(iq_start_idx);
  ------------------
  |  |   45|  2.35k|#define UNUSED(x) ((void)(x))
  ------------------
  677|  2.35k|    UNUSED(pi2_dc_ld_addr);
  ------------------
  |  |   45|  2.35k|#define UNUSED(x) ((void)(x))
  ------------------
  678|       |    /*************************************************************/
  679|       |    /* Dequantization of coefficients. Will be replaced by SIMD  */
  680|       |    /* operations on platform. Note : DC coeff is not scaled     */
  681|       |    /*************************************************************/
  682|  2.35k|    q = pi2_src[0];
  683|  2.35k|    INV_QUANT(q, pu2_iscale_mat[0], pu2_weigh_mat[0], qp_div, rnd_fact, 6);
  ------------------
  |  |  103|  2.35k|                {\
  |  |  104|  2.35k|                    i4_value *= quant_scale;\
  |  |  105|  2.35k|                    i4_value *= weight_scale;\
  |  |  106|  2.35k|                    i4_value += rndfactor;\
  |  |  107|  2.35k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  2.35k|                    i4_value >>= qbits;\
  |  |  109|  2.35k|                }
  ------------------
  684|  2.35k|    i_macro = (q + 32) >> 6;
  685|       |    /* Perform Inverse transform */
  686|       |    /*--------------------------------------------------------------------*/
  687|       |    /* IDCT [ Horizontal transformation ]                                 */
  688|       |    /*--------------------------------------------------------------------*/
  689|       |    /*--------------------------------------------------------------------*/
  690|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6            */
  691|       |    /*                                                                    */
  692|       |    /* Add the prediction and store it back to reconstructed frame buffer */
  693|       |    /* [Prediction buffer itself in this case]                            */
  694|       |    /*--------------------------------------------------------------------*/
  695|  21.1k|    for(i = 0; i < SUB_BLK_WIDTH_8x8; i++)
  ------------------
  |  |   53|  21.1k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  |  Branch (695:16): [True: 18.8k, False: 2.35k]
  ------------------
  696|  18.8k|    {
  697|  18.8k|        pu1_pred_ptr = pu1_pred;
  698|  18.8k|        pu1_out = pu1_out_ptr;
  699|       |
  700|  18.8k|        x = i_macro + *pu1_pred_ptr;
  701|  18.8k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  18.8k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  18.8k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 1.12k, False: 17.6k]
  |  |  |  |  |  Branch (77:54): [True: 413, False: 17.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  702|       |        /* Change uc_recBuffer to Point to next element in the same column*/
  703|  18.8k|        pu1_pred_ptr += pred_strd;
  704|  18.8k|        pu1_out += out_strd;
  705|       |
  706|  18.8k|        x = i_macro + *pu1_pred_ptr;
  707|  18.8k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  18.8k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  18.8k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 1.12k, False: 17.6k]
  |  |  |  |  |  Branch (77:54): [True: 401, False: 17.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  708|  18.8k|        pu1_pred_ptr += pred_strd;
  709|  18.8k|        pu1_out += out_strd;
  710|       |
  711|  18.8k|        x = i_macro + *pu1_pred_ptr;
  712|  18.8k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  18.8k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  18.8k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 1.14k, False: 17.6k]
  |  |  |  |  |  Branch (77:54): [True: 403, False: 17.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  713|  18.8k|        pu1_pred_ptr += pred_strd;
  714|  18.8k|        pu1_out += out_strd;
  715|       |
  716|  18.8k|        x = i_macro + *pu1_pred_ptr;
  717|  18.8k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  18.8k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  18.8k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 1.15k, False: 17.6k]
  |  |  |  |  |  Branch (77:54): [True: 395, False: 17.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  718|  18.8k|        pu1_pred_ptr += pred_strd;
  719|  18.8k|        pu1_out += out_strd;
  720|       |
  721|  18.8k|        x = i_macro + *pu1_pred_ptr;
  722|  18.8k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  18.8k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  18.8k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 1.15k, False: 17.6k]
  |  |  |  |  |  Branch (77:54): [True: 401, False: 17.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  723|  18.8k|        pu1_pred_ptr += pred_strd;
  724|  18.8k|        pu1_out += out_strd;
  725|       |
  726|  18.8k|        x = i_macro + *pu1_pred_ptr;
  727|  18.8k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  18.8k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  18.8k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 1.14k, False: 17.6k]
  |  |  |  |  |  Branch (77:54): [True: 398, False: 17.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  728|  18.8k|        pu1_pred_ptr += pred_strd;
  729|  18.8k|        pu1_out += out_strd;
  730|       |
  731|  18.8k|        x = i_macro + *pu1_pred_ptr;
  732|  18.8k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  18.8k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  18.8k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 1.13k, False: 17.6k]
  |  |  |  |  |  Branch (77:54): [True: 408, False: 17.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  733|  18.8k|        pu1_pred_ptr += pred_strd;
  734|  18.8k|        pu1_out += out_strd;
  735|       |
  736|  18.8k|        x = i_macro + *pu1_pred_ptr;
  737|  18.8k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  18.8k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  18.8k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 1.13k, False: 17.6k]
  |  |  |  |  |  Branch (77:54): [True: 404, False: 17.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  738|       |
  739|  18.8k|        pu1_out_ptr++;
  740|  18.8k|        pu1_pred++;
  741|  18.8k|    }
  742|  2.35k|}
ih264_iquant_itrans_recon_chroma_4x4:
  801|  19.6k|{
  802|  19.6k|    WORD16 *pi2_src_ptr = pi2_src;
  803|  19.6k|    WORD16 *pi2_tmp_ptr = pi2_tmp;
  804|  19.6k|    UWORD8 *pu1_pred_ptr = pu1_pred;
  805|  19.6k|    UWORD8 *pu1_out_ptr = pu1_out;
  806|  19.6k|    WORD16 x0, x1, x2, x3, i;
  807|  19.6k|    WORD32 q0, q1, q2, q3;
  808|  19.6k|    WORD16 i_macro;
  809|  19.6k|    WORD16 rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
  ------------------
  |  Branch (809:23): [True: 778, False: 18.8k]
  ------------------
  810|       |
  811|       |    /* inverse quant */
  812|       |    /* horizontal inverse transform */
  813|  98.3k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|  98.3k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (813:16): [True: 78.6k, False: 19.6k]
  ------------------
  814|  78.6k|    {
  815|  78.6k|        if(i == 0)
  ------------------
  |  Branch (815:12): [True: 19.6k, False: 59.0k]
  ------------------
  816|  19.6k|        {
  817|  19.6k|            q0 = pi2_dc_src[0];
  818|  19.6k|        }
  819|  59.0k|        else
  820|  59.0k|        {
  821|  59.0k|            q0 = pi2_src_ptr[0];
  822|  59.0k|            INV_QUANT(q0, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  59.0k|                {\
  |  |  104|  59.0k|                    i4_value *= quant_scale;\
  |  |  105|  59.0k|                    i4_value *= weight_scale;\
  |  |  106|  59.0k|                    i4_value += rndfactor;\
  |  |  107|  59.0k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  59.0k|                    i4_value >>= qbits;\
  |  |  109|  59.0k|                }
  ------------------
  823|  59.0k|        }
  824|       |
  825|  78.6k|        q2 = pi2_src_ptr[2];
  826|  78.6k|        INV_QUANT(q2, pu2_iscal_mat[2], pu2_weigh_mat[2], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  78.6k|                {\
  |  |  104|  78.6k|                    i4_value *= quant_scale;\
  |  |  105|  78.6k|                    i4_value *= weight_scale;\
  |  |  106|  78.6k|                    i4_value += rndfactor;\
  |  |  107|  78.6k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  78.6k|                    i4_value >>= qbits;\
  |  |  109|  78.6k|                }
  ------------------
  827|       |
  828|  78.6k|        x0 = q0 + q2;
  829|  78.6k|        x1 = q0 - q2;
  830|       |
  831|  78.6k|        q1 = pi2_src_ptr[1];
  832|  78.6k|        INV_QUANT(q1, pu2_iscal_mat[1], pu2_weigh_mat[1], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  78.6k|                {\
  |  |  104|  78.6k|                    i4_value *= quant_scale;\
  |  |  105|  78.6k|                    i4_value *= weight_scale;\
  |  |  106|  78.6k|                    i4_value += rndfactor;\
  |  |  107|  78.6k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  78.6k|                    i4_value >>= qbits;\
  |  |  109|  78.6k|                }
  ------------------
  833|       |
  834|  78.6k|        q3 = pi2_src_ptr[3];
  835|  78.6k|        INV_QUANT(q3, pu2_iscal_mat[3], pu2_weigh_mat[3], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  78.6k|                {\
  |  |  104|  78.6k|                    i4_value *= quant_scale;\
  |  |  105|  78.6k|                    i4_value *= weight_scale;\
  |  |  106|  78.6k|                    i4_value += rndfactor;\
  |  |  107|  78.6k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  78.6k|                    i4_value >>= qbits;\
  |  |  109|  78.6k|                }
  ------------------
  836|       |
  837|  78.6k|        x2 = (q1 >> 1) - q3;
  838|  78.6k|        x3 = q1 + (q3 >> 1);
  839|       |
  840|  78.6k|        pi2_tmp_ptr[0] = x0 + x3;
  841|  78.6k|        pi2_tmp_ptr[1] = x1 + x2;
  842|  78.6k|        pi2_tmp_ptr[2] = x1 - x2;
  843|  78.6k|        pi2_tmp_ptr[3] = x0 - x3;
  844|       |
  845|  78.6k|        pi2_src_ptr += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  78.6k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  846|  78.6k|        pi2_tmp_ptr += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  78.6k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  847|  78.6k|        pu2_iscal_mat += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  78.6k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  848|  78.6k|        pu2_weigh_mat += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  78.6k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  849|  78.6k|    }
  850|       |
  851|       |    /* vertical inverse transform */
  852|  19.6k|    pi2_tmp_ptr = pi2_tmp;
  853|  98.3k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|  98.3k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (853:16): [True: 78.6k, False: 19.6k]
  ------------------
  854|  78.6k|    {
  855|  78.6k|        pu1_pred_ptr = pu1_pred;
  856|  78.6k|        pu1_out = pu1_out_ptr;
  857|       |
  858|  78.6k|        x0 = (pi2_tmp_ptr[0] + pi2_tmp_ptr[8]);
  859|  78.6k|        x1 = (pi2_tmp_ptr[0] - pi2_tmp_ptr[8]);
  860|  78.6k|        x2 = (pi2_tmp_ptr[4] >> 1) - pi2_tmp_ptr[12];
  861|  78.6k|        x3 = pi2_tmp_ptr[4] + (pi2_tmp_ptr[12] >> 1);
  862|       |
  863|       |        /* inverse prediction */
  864|  78.6k|        i_macro = x0 + x3;
  865|  78.6k|        i_macro = ((i_macro + 32) >> 6);
  866|  78.6k|        i_macro += *pu1_pred_ptr;
  867|  78.6k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|  78.6k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  78.6k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 20.2k, False: 58.4k]
  |  |  |  |  |  Branch (77:54): [True: 2.50k, False: 55.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  868|  78.6k|        pu1_pred_ptr += pred_strd;
  869|  78.6k|        pu1_out += out_strd;
  870|       |
  871|  78.6k|        i_macro = x1 + x2;
  872|  78.6k|        i_macro = ((i_macro + 32) >> 6);
  873|  78.6k|        i_macro += *pu1_pred_ptr;
  874|  78.6k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|  78.6k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  78.6k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 5.78k, False: 72.9k]
  |  |  |  |  |  Branch (77:54): [True: 4.25k, False: 68.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  875|  78.6k|        pu1_pred_ptr += pred_strd;
  876|  78.6k|        pu1_out += out_strd;
  877|       |
  878|  78.6k|        i_macro = x1 - x2;
  879|  78.6k|        i_macro = ((i_macro + 32) >> 6);
  880|  78.6k|        i_macro += *pu1_pred_ptr;
  881|  78.6k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|  78.6k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  78.6k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 6.17k, False: 72.5k]
  |  |  |  |  |  Branch (77:54): [True: 4.88k, False: 67.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  882|  78.6k|        pu1_pred_ptr += pred_strd;
  883|  78.6k|        pu1_out += out_strd;
  884|       |
  885|  78.6k|        i_macro = x0 - x3;
  886|  78.6k|        i_macro = ((i_macro + 32) >> 6);
  887|  78.6k|        i_macro += *pu1_pred_ptr;
  888|  78.6k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|  78.6k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  78.6k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 18.8k, False: 59.8k]
  |  |  |  |  |  Branch (77:54): [True: 2.33k, False: 57.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  889|       |
  890|  78.6k|        pi2_tmp_ptr++;
  891|  78.6k|        pu1_out_ptr += 2; // Interleaved store for output
  892|  78.6k|        pu1_pred += 2; // Interleaved load for pred buffer
  893|  78.6k|    }
  894|  19.6k|}
ih264_iquant_itrans_recon_chroma_4x4_dc:
  950|  21.2k|{
  951|  21.2k|    UWORD8 *pu1_pred_ptr = pu1_pred;
  952|  21.2k|    UWORD8 *pu1_out_ptr = pu1_out;
  953|  21.2k|    WORD32 q0;
  954|  21.2k|    WORD16 x, i_macro, i;
  955|       |
  956|  21.2k|    UNUSED(pi2_src);
  ------------------
  |  |   45|  21.2k|#define UNUSED(x) ((void)(x))
  ------------------
  957|  21.2k|    UNUSED(pu2_iscal_mat);
  ------------------
  |  |   45|  21.2k|#define UNUSED(x) ((void)(x))
  ------------------
  958|  21.2k|    UNUSED(pu2_weigh_mat);
  ------------------
  |  |   45|  21.2k|#define UNUSED(x) ((void)(x))
  ------------------
  959|  21.2k|    UNUSED(u4_qp_div_6);
  ------------------
  |  |   45|  21.2k|#define UNUSED(x) ((void)(x))
  ------------------
  960|  21.2k|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|  21.2k|#define UNUSED(x) ((void)(x))
  ------------------
  961|       |
  962|  21.2k|    q0 = pi2_dc_src[0];    // Restoring dc value for intra case3
  963|  21.2k|    i_macro = ((q0 + 32) >> 6);
  964|       |
  965|   106k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|   106k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (965:16): [True: 84.9k, False: 21.2k]
  ------------------
  966|  84.9k|    {
  967|  84.9k|        pu1_pred_ptr = pu1_pred;
  968|  84.9k|        pu1_out = pu1_out_ptr;
  969|       |
  970|       |        /* inverse prediction */
  971|  84.9k|        x = i_macro + *pu1_pred_ptr;
  972|  84.9k|        *pu1_out =  CLIP_U8(x);
  ------------------
  |  |   58|  84.9k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  84.9k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 14.9k, False: 70.0k]
  |  |  |  |  |  Branch (77:54): [True: 2.99k, False: 67.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  973|  84.9k|        pu1_pred_ptr += pred_strd;
  974|  84.9k|        pu1_out += out_strd;
  975|       |
  976|  84.9k|        x = i_macro + *pu1_pred_ptr;
  977|  84.9k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  84.9k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  84.9k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 14.9k, False: 70.0k]
  |  |  |  |  |  Branch (77:54): [True: 3.02k, False: 67.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  978|  84.9k|        pu1_pred_ptr += pred_strd;
  979|  84.9k|        pu1_out += out_strd;
  980|       |
  981|  84.9k|        x = i_macro + *pu1_pred_ptr;
  982|  84.9k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  84.9k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  84.9k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 14.9k, False: 70.0k]
  |  |  |  |  |  Branch (77:54): [True: 3.02k, False: 67.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  983|  84.9k|        pu1_pred_ptr += pred_strd;
  984|  84.9k|        pu1_out += out_strd;
  985|       |
  986|  84.9k|        x = i_macro + *pu1_pred_ptr;
  987|  84.9k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  84.9k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  84.9k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 14.8k, False: 70.1k]
  |  |  |  |  |  Branch (77:54): [True: 2.94k, False: 67.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  988|       |
  989|  84.9k|        pu1_out_ptr+=2;
  990|  84.9k|        pu1_pred+=2;
  991|  84.9k|    }
  992|  21.2k|}

ih264_intra_pred_luma_4x4_mode_vert:
  139|  8.64k|{
  140|  8.64k|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
  141|       |
  142|  8.64k|    UNUSED(src_strd);
  ------------------
  |  |   45|  8.64k|#define UNUSED(x) ((void)(x))
  ------------------
  143|  8.64k|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|  8.64k|#define UNUSED(x) ((void)(x))
  ------------------
  144|  8.64k|    pu1_top = pu1_src + BLK_SIZE + 1;
  ------------------
  |  |  511|  8.64k|#define BLK_SIZE            4
  ------------------
  145|  8.64k|    memcpy(pu1_dst, pu1_top, 4);
  146|  8.64k|    memcpy(pu1_dst + dst_strd, pu1_top, 4);
  147|  8.64k|    memcpy(pu1_dst + 2 * dst_strd, pu1_top, 4);
  148|  8.64k|    memcpy(pu1_dst + 3 * dst_strd, pu1_top, 4);
  149|  8.64k|}
ih264_intra_pred_luma_4x4_mode_horz:
  188|  1.39k|{
  189|  1.39k|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
  190|       |
  191|  1.39k|    UNUSED(src_strd);
  ------------------
  |  |   45|  1.39k|#define UNUSED(x) ((void)(x))
  ------------------
  192|  1.39k|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|  1.39k|#define UNUSED(x) ((void)(x))
  ------------------
  193|  1.39k|    pu1_left = pu1_src + BLK_SIZE - 1;
  ------------------
  |  |  511|  1.39k|#define BLK_SIZE            4
  ------------------
  194|  1.39k|    memset(pu1_dst, *pu1_left, 4);
  195|  1.39k|    memset(pu1_dst + dst_strd, *(pu1_left - 1), 4);
  196|  1.39k|    memset(pu1_dst + 2 * dst_strd, *(pu1_left - 2), 4);
  197|  1.39k|    memset(pu1_dst + 3 * dst_strd, *(pu1_left - 3), 4);
  198|  1.39k|}
ih264_intra_pred_luma_4x4_mode_dc:
  236|  5.68k|{
  237|  5.68k|    UWORD8 u1_useleft; /* availability of left predictors (only for DC) */
  238|  5.68k|    UWORD8 u1_usetop; /* availability of top predictors (only for DC) */
  239|  5.68k|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
  240|  5.68k|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
  241|  5.68k|    WORD32 val = 0;
  242|       |
  243|  5.68k|    UNUSED(src_strd);
  ------------------
  |  |   45|  5.68k|#define UNUSED(x) ((void)(x))
  ------------------
  244|  5.68k|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|  5.68k|#define UNUSED(x) ((void)(x))
  ------------------
  245|  5.68k|    u1_useleft = BOOLEAN(ngbr_avail & LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|  5.68k|#define BOOLEAN(x) (!!(x))
  ------------------
  246|  5.68k|    u1_usetop = BOOLEAN(ngbr_avail & TOP_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|  5.68k|#define BOOLEAN(x) (!!(x))
  ------------------
  247|  5.68k|    pu1_top = pu1_src + BLK_SIZE + 1;
  ------------------
  |  |  511|  5.68k|#define BLK_SIZE            4
  ------------------
  248|  5.68k|    pu1_left = pu1_src + BLK_SIZE - 1;
  ------------------
  |  |  511|  5.68k|#define BLK_SIZE            4
  ------------------
  249|       |
  250|  5.68k|    if(u1_useleft)
  ------------------
  |  Branch (250:8): [True: 3.83k, False: 1.85k]
  ------------------
  251|  3.83k|    {
  252|  3.83k|        val += *pu1_left--;
  253|  3.83k|        val += *pu1_left--;
  254|  3.83k|        val += *pu1_left--;
  255|  3.83k|        val += *pu1_left + 2;
  256|  3.83k|    }
  257|  5.68k|    if(u1_usetop)
  ------------------
  |  Branch (257:8): [True: 5.19k, False: 490]
  ------------------
  258|  5.19k|    {
  259|  5.19k|        val += *pu1_top + *(pu1_top + 1) + *(pu1_top + 2) + *(pu1_top + 3)
  260|  5.19k|                        + 2;
  261|  5.19k|    }
  262|       |    /* Since 2 is added if either left/top pred is there,
  263|       |     val still being zero implies both preds are not there */
  264|  5.68k|    val = (val) ? (val >> (1 + u1_useleft + u1_usetop)) : 128;
  ------------------
  |  Branch (264:11): [True: 5.57k, False: 114]
  ------------------
  265|       |    /* 4 bytes are copied from src to dst */
  266|  5.68k|    memset(pu1_dst, val, 4);
  267|  5.68k|    memset(pu1_dst + dst_strd, val, 4);
  268|  5.68k|    memset(pu1_dst + 2 * dst_strd, val, 4);
  269|  5.68k|    memset(pu1_dst + 3 * dst_strd, val, 4);
  270|  5.68k|}
ih264_intra_pred_luma_4x4_mode_diag_dl:
  309|    798|{
  310|    798|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
  311|    798|    UWORD32 ui4_a, ui4_b, ui4_c, ui4_d, ui4_e, ui4_f, ui4_g, ui4_h;
  312|    798|    UWORD8 predicted_pixels[7];
  313|       |
  314|    798|    UNUSED(src_strd);
  ------------------
  |  |   45|    798|#define UNUSED(x) ((void)(x))
  ------------------
  315|    798|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    798|#define UNUSED(x) ((void)(x))
  ------------------
  316|    798|    pu1_top = pu1_src +BLK_SIZE + 1;
  ------------------
  |  |  511|    798|#define BLK_SIZE            4
  ------------------
  317|       |
  318|    798|    ui4_a = *pu1_top++;
  319|    798|    ui4_b = *pu1_top++;
  320|    798|    ui4_c = *pu1_top++;
  321|    798|    ui4_d = *pu1_top++;
  322|    798|    ui4_e = *pu1_top++;
  323|    798|    ui4_f = *pu1_top++;
  324|    798|    ui4_g = *pu1_top++;
  325|    798|    ui4_h = *pu1_top;
  326|       |
  327|    798|    predicted_pixels[0] = FILT121(ui4_a, ui4_b, ui4_c);
  ------------------
  |  |   46|    798|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  328|    798|    predicted_pixels[1] = FILT121(ui4_b, ui4_c, ui4_d);
  ------------------
  |  |   46|    798|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  329|    798|    predicted_pixels[2] = FILT121(ui4_c, ui4_d, ui4_e);
  ------------------
  |  |   46|    798|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  330|    798|    predicted_pixels[3] = FILT121(ui4_d, ui4_e, ui4_f);
  ------------------
  |  |   46|    798|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  331|    798|    predicted_pixels[4] = FILT121(ui4_e, ui4_f, ui4_g);
  ------------------
  |  |   46|    798|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  332|    798|    predicted_pixels[5] = FILT121(ui4_f, ui4_g, ui4_h);
  ------------------
  |  |   46|    798|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  333|    798|    predicted_pixels[6] = FILT121(ui4_g, ui4_h, ui4_h);
  ------------------
  |  |   46|    798|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  334|       |
  335|    798|    memcpy(pu1_dst, predicted_pixels, 4);
  336|    798|    memcpy(pu1_dst + dst_strd, predicted_pixels + 1, 4);
  337|    798|    memcpy(pu1_dst + 2 * dst_strd, predicted_pixels + 2, 4);
  338|    798|    memcpy(pu1_dst + 3 * dst_strd, predicted_pixels + 3, 4);
  339|    798|}
ih264_intra_pred_luma_4x4_mode_diag_dr:
  378|    356|{
  379|    356|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
  380|    356|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
  381|    356|    UWORD8 *pu1_topleft = NULL;/* Pointer to top left predictor */
  382|    356|    UWORD32 ui4_a, ui4_b, ui4_c, ui4_d, ui4_i, ui4_j, ui4_k, ui4_l, ui4_m;
  383|    356|    UWORD8 predicted_pixels[7];
  384|       |
  385|    356|    UNUSED(src_strd);
  ------------------
  |  |   45|    356|#define UNUSED(x) ((void)(x))
  ------------------
  386|    356|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    356|#define UNUSED(x) ((void)(x))
  ------------------
  387|    356|    pu1_top = pu1_src + BLK_SIZE + 1;
  ------------------
  |  |  511|    356|#define BLK_SIZE            4
  ------------------
  388|    356|    pu1_left = pu1_src + BLK_SIZE - 1;
  ------------------
  |  |  511|    356|#define BLK_SIZE            4
  ------------------
  389|    356|    pu1_topleft = pu1_src +BLK_SIZE;
  ------------------
  |  |  511|    356|#define BLK_SIZE            4
  ------------------
  390|       |
  391|    356|    ui4_a = *pu1_top++;
  392|    356|    ui4_b = *pu1_top++;
  393|    356|    ui4_c = *pu1_top++;
  394|    356|    ui4_d = *pu1_top++;
  395|    356|    ui4_i = *pu1_left--;
  396|    356|    ui4_j = *pu1_left--;
  397|    356|    ui4_k = *pu1_left--;
  398|    356|    ui4_l = *pu1_left;
  399|    356|    ui4_m = *pu1_topleft;
  400|       |
  401|    356|    predicted_pixels[2] = FILT121(ui4_j, ui4_i, ui4_m);
  ------------------
  |  |   46|    356|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  402|    356|    predicted_pixels[1] = FILT121(ui4_k, ui4_j, ui4_i);
  ------------------
  |  |   46|    356|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  403|    356|    predicted_pixels[0] = FILT121(ui4_l, ui4_k, ui4_j);
  ------------------
  |  |   46|    356|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  404|    356|    predicted_pixels[3] = FILT121(ui4_i, ui4_m, ui4_a);
  ------------------
  |  |   46|    356|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  405|    356|    predicted_pixels[4] = FILT121(ui4_m, ui4_a, ui4_b);
  ------------------
  |  |   46|    356|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  406|    356|    predicted_pixels[5] = FILT121(ui4_a, ui4_b, ui4_c);
  ------------------
  |  |   46|    356|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  407|    356|    predicted_pixels[6] = FILT121(ui4_b, ui4_c, ui4_d);
  ------------------
  |  |   46|    356|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  408|       |
  409|    356|    memcpy(pu1_dst, predicted_pixels + 3, 4);
  410|    356|    memcpy(pu1_dst + dst_strd, predicted_pixels + 2, 4);
  411|    356|    memcpy(pu1_dst + 2 * dst_strd, predicted_pixels + 1, 4);
  412|    356|    memcpy(pu1_dst + 3 * dst_strd, predicted_pixels, 4);
  413|    356|}
ih264_intra_pred_luma_4x4_mode_vert_r:
  452|    557|{
  453|       |
  454|    557|    UWORD32 ui4_a, ui4_b, ui4_c, ui4_d, ui4_i, ui4_j, ui4_k, ui4_m;
  455|    557|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
  456|    557|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
  457|    557|    UWORD8 *pu1_topleft = NULL;/* Pointer to top left predictor */
  458|    557|    UWORD8 predicted_pixels[10];
  459|       |
  460|    557|    UNUSED(src_strd);
  ------------------
  |  |   45|    557|#define UNUSED(x) ((void)(x))
  ------------------
  461|    557|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    557|#define UNUSED(x) ((void)(x))
  ------------------
  462|    557|    pu1_top = pu1_src +BLK_SIZE + 1;
  ------------------
  |  |  511|    557|#define BLK_SIZE            4
  ------------------
  463|    557|    pu1_left = pu1_src + BLK_SIZE - 1;
  ------------------
  |  |  511|    557|#define BLK_SIZE            4
  ------------------
  464|    557|    pu1_topleft = pu1_src + BLK_SIZE;
  ------------------
  |  |  511|    557|#define BLK_SIZE            4
  ------------------
  465|       |
  466|    557|    ui4_a = *pu1_top++;
  467|    557|    ui4_b = *pu1_top++;
  468|    557|    ui4_c = *pu1_top++;
  469|    557|    ui4_d = *pu1_top++;
  470|    557|    ui4_i = *pu1_left--;
  471|    557|    ui4_j = *pu1_left--;
  472|    557|    ui4_k = *pu1_left;
  473|    557|    ui4_m = *pu1_topleft;
  474|       |
  475|    557|    predicted_pixels[6] = FILT11(ui4_m, ui4_a);
  ------------------
  |  |   49|    557|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  476|    557|    predicted_pixels[7] = FILT11(ui4_a, ui4_b);
  ------------------
  |  |   49|    557|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  477|    557|    predicted_pixels[8] = FILT11(ui4_b, ui4_c);
  ------------------
  |  |   49|    557|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  478|    557|    predicted_pixels[9] = FILT11(ui4_c, ui4_d);
  ------------------
  |  |   49|    557|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  479|    557|    predicted_pixels[1] = FILT121(ui4_i, ui4_m, ui4_a);
  ------------------
  |  |   46|    557|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  480|    557|    predicted_pixels[2] = FILT121(ui4_m, ui4_a, ui4_b);
  ------------------
  |  |   46|    557|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  481|    557|    predicted_pixels[3] = FILT121(ui4_a, ui4_b, ui4_c);
  ------------------
  |  |   46|    557|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  482|    557|    predicted_pixels[4] = FILT121(ui4_b, ui4_c, ui4_d);
  ------------------
  |  |   46|    557|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  483|    557|    predicted_pixels[5] = FILT121(ui4_j, ui4_i, ui4_m);
  ------------------
  |  |   46|    557|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  484|    557|    predicted_pixels[0] = FILT121(ui4_k, ui4_j, ui4_i);
  ------------------
  |  |   46|    557|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  485|       |
  486|    557|    memcpy(pu1_dst, predicted_pixels + 6, 4);
  487|    557|    memcpy(pu1_dst + dst_strd, predicted_pixels + 1, 4);
  488|    557|    memcpy(pu1_dst + 2 * dst_strd, predicted_pixels + 5, 4);
  489|    557|    memcpy(pu1_dst + 3 * dst_strd, predicted_pixels, 4);
  490|    557|}
ih264_intra_pred_luma_4x4_mode_horz_d:
  529|    564|{
  530|    564|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
  531|    564|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
  532|    564|    UWORD8 *pu1_topleft = NULL;/* Pointer to top left predictor */
  533|    564|    UWORD32 ui4_a, ui4_b, ui4_c, ui4_i, ui4_j, ui4_k, ui4_l, ui4_m;
  534|    564|    UWORD8 predicted_pixels[10];
  535|       |
  536|    564|    UNUSED(src_strd);
  ------------------
  |  |   45|    564|#define UNUSED(x) ((void)(x))
  ------------------
  537|    564|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    564|#define UNUSED(x) ((void)(x))
  ------------------
  538|    564|    pu1_top = pu1_src + BLK_SIZE + 1;
  ------------------
  |  |  511|    564|#define BLK_SIZE            4
  ------------------
  539|    564|    pu1_left = pu1_src + BLK_SIZE - 1;
  ------------------
  |  |  511|    564|#define BLK_SIZE            4
  ------------------
  540|    564|    pu1_topleft = pu1_src + BLK_SIZE;
  ------------------
  |  |  511|    564|#define BLK_SIZE            4
  ------------------
  541|       |
  542|    564|    ui4_a = *pu1_top++;
  543|    564|    ui4_b = *pu1_top++;
  544|    564|    ui4_c = *pu1_top++;
  545|    564|    ui4_i = *pu1_left--;
  546|    564|    ui4_j = *pu1_left--;
  547|    564|    ui4_k = *pu1_left--;
  548|    564|    ui4_l = *pu1_left--;
  549|    564|    ui4_m = *pu1_topleft;
  550|       |
  551|    564|    predicted_pixels[6] = FILT11(ui4_i, ui4_m);
  ------------------
  |  |   49|    564|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  552|    564|    predicted_pixels[7] = FILT121(ui4_i, ui4_m, ui4_a);
  ------------------
  |  |   46|    564|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  553|    564|    predicted_pixels[8] = FILT121(ui4_m, ui4_a, ui4_b);
  ------------------
  |  |   46|    564|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  554|    564|    predicted_pixels[9] = FILT121(ui4_a, ui4_b, ui4_c);
  ------------------
  |  |   46|    564|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  555|    564|    predicted_pixels[1] = FILT121(ui4_l, ui4_k, ui4_j);
  ------------------
  |  |   46|    564|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  556|    564|    predicted_pixels[2] = FILT11(ui4_k, ui4_j);
  ------------------
  |  |   49|    564|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  557|    564|    predicted_pixels[3] = FILT121(ui4_k, ui4_j, ui4_i);
  ------------------
  |  |   46|    564|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  558|    564|    predicted_pixels[4] = FILT11(ui4_j, ui4_i);
  ------------------
  |  |   49|    564|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  559|    564|    predicted_pixels[5] = FILT121(ui4_j, ui4_i, ui4_m);
  ------------------
  |  |   46|    564|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  560|    564|    predicted_pixels[0] = FILT11(ui4_l, ui4_k);
  ------------------
  |  |   49|    564|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  561|       |
  562|    564|    memcpy(pu1_dst, predicted_pixels + 6, 4);
  563|    564|    memcpy(pu1_dst + dst_strd, predicted_pixels + 4, 4);
  564|    564|    memcpy(pu1_dst + 2 * dst_strd, predicted_pixels + 2, 4);
  565|    564|    memcpy(pu1_dst + 3 * dst_strd, predicted_pixels, 4);
  566|    564|}
ih264_intra_pred_luma_4x4_mode_vert_l:
  605|  12.8k|{
  606|  12.8k|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
  607|  12.8k|    UWORD32 ui4_a, ui4_b, ui4_c, ui4_d, ui4_e, ui4_f, ui4_g;
  608|  12.8k|    UWORD8 predicted_pixels[10];
  609|       |
  610|  12.8k|    UNUSED(src_strd);
  ------------------
  |  |   45|  12.8k|#define UNUSED(x) ((void)(x))
  ------------------
  611|  12.8k|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|  12.8k|#define UNUSED(x) ((void)(x))
  ------------------
  612|  12.8k|    pu1_top = pu1_src + BLK_SIZE + 1;
  ------------------
  |  |  511|  12.8k|#define BLK_SIZE            4
  ------------------
  613|       |
  614|  12.8k|    ui4_a = *pu1_top++;
  615|  12.8k|    ui4_b = *pu1_top++;
  616|  12.8k|    ui4_c = *pu1_top++;
  617|  12.8k|    ui4_d = *pu1_top++;
  618|  12.8k|    ui4_e = *pu1_top++;
  619|  12.8k|    ui4_f = *pu1_top++;
  620|  12.8k|    ui4_g = *pu1_top;
  621|       |
  622|  12.8k|    predicted_pixels[5] = FILT11(ui4_a, ui4_b);
  ------------------
  |  |   49|  12.8k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  623|  12.8k|    predicted_pixels[6] = FILT11(ui4_b, ui4_c);
  ------------------
  |  |   49|  12.8k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  624|  12.8k|    predicted_pixels[7] = FILT11(ui4_c, ui4_d);
  ------------------
  |  |   49|  12.8k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  625|  12.8k|    predicted_pixels[8] = FILT11(ui4_d, ui4_e);
  ------------------
  |  |   49|  12.8k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  626|  12.8k|    predicted_pixels[0] = FILT121(ui4_a, ui4_b, ui4_c);
  ------------------
  |  |   46|  12.8k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  627|  12.8k|    predicted_pixels[1] = FILT121(ui4_b, ui4_c, ui4_d);
  ------------------
  |  |   46|  12.8k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  628|  12.8k|    predicted_pixels[2] = FILT121(ui4_c, ui4_d, ui4_e);
  ------------------
  |  |   46|  12.8k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  629|  12.8k|    predicted_pixels[3] = FILT121(ui4_d, ui4_e, ui4_f);
  ------------------
  |  |   46|  12.8k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  630|  12.8k|    predicted_pixels[9] = FILT11(ui4_e, ui4_f);
  ------------------
  |  |   49|  12.8k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  631|  12.8k|    predicted_pixels[4] = FILT121(ui4_e, ui4_f, ui4_g);
  ------------------
  |  |   46|  12.8k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  632|       |
  633|  12.8k|    memcpy(pu1_dst, predicted_pixels + 5, 4);
  634|  12.8k|    memcpy(pu1_dst + dst_strd, predicted_pixels, 4);
  635|  12.8k|    memcpy(pu1_dst + 2 * dst_strd, predicted_pixels + 6, 4);
  636|  12.8k|    memcpy(pu1_dst + 3 * dst_strd, predicted_pixels + 1, 4);
  637|  12.8k|}
ih264_intra_pred_luma_4x4_mode_horz_u:
  676|  15.6k|{
  677|  15.6k|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
  678|  15.6k|    UWORD32 ui4_i, ui4_j, ui4_k, ui4_l;
  679|  15.6k|    UWORD8 predicted_pixels[10];
  680|       |
  681|  15.6k|    UNUSED(src_strd);
  ------------------
  |  |   45|  15.6k|#define UNUSED(x) ((void)(x))
  ------------------
  682|  15.6k|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|  15.6k|#define UNUSED(x) ((void)(x))
  ------------------
  683|  15.6k|    pu1_left = pu1_src + BLK_SIZE - 1;
  ------------------
  |  |  511|  15.6k|#define BLK_SIZE            4
  ------------------
  684|       |
  685|  15.6k|    ui4_i = *pu1_left--;
  686|  15.6k|    ui4_j = *pu1_left--;
  687|  15.6k|    ui4_k = *pu1_left--;
  688|  15.6k|    ui4_l = *pu1_left--;
  689|       |
  690|  15.6k|    predicted_pixels[0] = FILT11(ui4_j, ui4_i);
  ------------------
  |  |   49|  15.6k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  691|  15.6k|    predicted_pixels[1] = FILT121(ui4_k, ui4_j, ui4_i);
  ------------------
  |  |   46|  15.6k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  692|  15.6k|    predicted_pixels[2] = FILT11(ui4_k, ui4_j);
  ------------------
  |  |   49|  15.6k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  693|  15.6k|    predicted_pixels[3] = FILT121(ui4_l, ui4_k, ui4_j);
  ------------------
  |  |   46|  15.6k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  694|  15.6k|    predicted_pixels[4] = FILT11(ui4_l, ui4_k);
  ------------------
  |  |   49|  15.6k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
  695|  15.6k|    predicted_pixels[5] = FILT121(ui4_l, ui4_l, ui4_k);
  ------------------
  |  |   46|  15.6k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  696|  15.6k|    predicted_pixels[6] = ui4_l;
  697|  15.6k|    predicted_pixels[7] = ui4_l;
  698|  15.6k|    predicted_pixels[8] = ui4_l;
  699|  15.6k|    predicted_pixels[9] = ui4_l;
  700|       |
  701|  15.6k|    memcpy(pu1_dst, predicted_pixels, 4);
  702|  15.6k|    memcpy(pu1_dst + dst_strd, predicted_pixels + 2, 4);
  703|  15.6k|    memcpy(pu1_dst + 2 * dst_strd, predicted_pixels + 4, 4);
  704|  15.6k|    memcpy(pu1_dst + 3 * dst_strd, predicted_pixels + 6, 4);
  705|  15.6k|}
ih264_intra_pred_luma_8x8_mode_ref_filtering:
  747|  18.2k|{
  748|  18.2k|    WORD32 top_avail, left_avail, top_left_avail, top_right_avail;
  749|       |
  750|  18.2k|    left_avail = BOOLEAN(ngbr_avail & LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|  18.2k|#define BOOLEAN(x) (!!(x))
  ------------------
  751|  18.2k|    top_avail = BOOLEAN(ngbr_avail & TOP_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|  18.2k|#define BOOLEAN(x) (!!(x))
  ------------------
  752|  18.2k|    top_left_avail = BOOLEAN(ngbr_avail & TOP_LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|  18.2k|#define BOOLEAN(x) (!!(x))
  ------------------
  753|  18.2k|    top_right_avail = BOOLEAN(ngbr_avail & TOP_RIGHT_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|  18.2k|#define BOOLEAN(x) (!!(x))
  ------------------
  754|       |
  755|  18.2k|    if(top_avail)
  ------------------
  |  Branch (755:8): [True: 17.9k, False: 310]
  ------------------
  756|  17.9k|    {
  757|  17.9k|        WORD32 i;
  758|  17.9k|        UWORD32 u4_xm1;
  759|       |
  760|  17.9k|        if(!top_right_avail)
  ------------------
  |  Branch (760:12): [True: 6.74k, False: 11.1k]
  ------------------
  761|  6.74k|        {
  762|  6.74k|            memset(pu1_dst + 8 + 1 + 8, pu1_top[7], 8);
  763|  6.74k|            top_right_avail = 1;
  764|  6.74k|        }
  765|  11.1k|        else
  766|  11.1k|        {
  767|  11.1k|            memcpy(pu1_dst + 8 + 1 + 8, pu1_top + 8, 8);
  768|  11.1k|        }
  769|       |
  770|  17.9k|        if(top_left_avail)
  ------------------
  |  Branch (770:12): [True: 13.3k, False: 4.53k]
  ------------------
  771|  13.3k|        {
  772|  13.3k|            pu1_dst[8 + 1 + 0] = FILT121((*pu1_topleft), pu1_top[0],
  ------------------
  |  |   46|  13.3k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  773|  13.3k|                                         pu1_top[1]);
  774|  13.3k|        }
  775|  4.53k|        else
  776|  4.53k|        {
  777|  4.53k|            pu1_dst[8 + 1] = ((3 * pu1_top[0]) + pu1_top[1] + 2) >> 2;
  778|  4.53k|        }
  779|       |
  780|   125k|        for(i = 1; i <= 6; i++)
  ------------------
  |  Branch (780:20): [True: 107k, False: 17.9k]
  ------------------
  781|   107k|        {
  782|   107k|            pu1_dst[8 + 1 + i] = FILT121(pu1_top[i - 1], pu1_top[i],
  ------------------
  |  |   46|   107k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  783|   107k|                                         pu1_top[i + 1]);
  784|   107k|        }
  785|       |        /* First byte of Top Right input is in pu1_dst[8 + 1 + 8]*/
  786|  17.9k|        pu1_dst[8 + 1 + 7] = FILT121(pu1_top[6], pu1_top[7],
  ------------------
  |  |   46|  17.9k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  787|  17.9k|                                     pu1_dst[8 + 1 + 8]);
  788|       |
  789|       |        /* filtered output and source in same buf, to prevent output(x - 1)
  790|       |         being over written in process */
  791|  17.9k|        u4_xm1 = pu1_top[7];
  792|       |
  793|   143k|        for(i = 8; i <= 14; i++)
  ------------------
  |  Branch (793:20): [True: 125k, False: 17.9k]
  ------------------
  794|   125k|        {
  795|   125k|            UWORD32 u4_x;
  796|   125k|            u4_x = (u4_xm1 + (pu1_dst[8 + 1 + i] << 1) + pu1_dst[8 + 1 + i + 1]
  797|   125k|                            + 2) >> 2;
  798|       |            /* assigning u4_xm1 from the un-filtered values for the next iteration */
  799|   125k|            u4_xm1 = pu1_dst[8 + 1 + i];
  800|   125k|            pu1_dst[8 + 1 + i] = u4_x;
  801|   125k|        }
  802|       |
  803|  17.9k|        pu1_dst[8 + 1 + 15] = (u4_xm1 + (3 * pu1_dst[8 + 1 + 15]) + 2) >> 2;
  804|  17.9k|    }
  805|       |
  806|       |    /* pu1_topleft is overloaded. It is both: */
  807|       |    /* a. A pointer for the top left pixel */
  808|       |    /* b. An indicator of availability of top left. */
  809|       |    /*    If it is null then top left not available */
  810|  18.2k|    if(top_left_avail)
  ------------------
  |  Branch (810:8): [True: 13.3k, False: 4.84k]
  ------------------
  811|  13.3k|    {
  812|  13.3k|        if((!top_avail) || (!left_avail))
  ------------------
  |  Branch (812:12): [True: 2, False: 13.3k]
  |  Branch (812:28): [True: 0, False: 13.3k]
  ------------------
  813|      2|        {
  814|      2|            if(top_avail)
  ------------------
  |  Branch (814:16): [True: 0, False: 2]
  ------------------
  815|      0|                pu1_dst[8] = (3 * pu1_topleft[0] + pu1_top[0] + 2) >> 2;
  816|      2|            else if(left_avail)
  ------------------
  |  Branch (816:21): [True: 0, False: 2]
  ------------------
  817|      0|                pu1_dst[8] = (3 * pu1_topleft[0] + pu1_left[0] + 2) >> 2;
  818|      2|        }
  819|  13.3k|        else
  820|  13.3k|        {
  821|  13.3k|            pu1_dst[8] = FILT121(pu1_top[0], (*pu1_topleft), pu1_left[0]);
  ------------------
  |  |   46|  13.3k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  822|  13.3k|        }
  823|  13.3k|    }
  824|       |
  825|  18.2k|    if(left_avail)
  ------------------
  |  Branch (825:8): [True: 13.6k, False: 4.63k]
  ------------------
  826|  13.6k|    {
  827|  13.6k|        UWORD32 idx;
  828|  13.6k|        if(0 != pu1_topleft)
  ------------------
  |  Branch (828:12): [True: 13.3k, False: 210]
  ------------------
  829|  13.3k|        {
  830|  13.3k|            pu1_dst[7] = FILT121((*pu1_topleft), pu1_left[0],
  ------------------
  |  |   46|  13.3k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  831|  13.3k|                                 pu1_left[src_strd]);
  832|  13.3k|        }
  833|    210|        else
  834|    210|        {
  835|    210|            pu1_dst[7] = ((3 * pu1_left[0]) + pu1_left[src_strd] + 2) >> 2;
  836|    210|        }
  837|       |
  838|  95.2k|        for(idx = 1; idx <= 6; idx++)
  ------------------
  |  Branch (838:22): [True: 81.6k, False: 13.6k]
  ------------------
  839|  81.6k|        {
  840|  81.6k|            pu1_dst[7 - idx] = FILT121(pu1_left[(idx - 1) * src_strd],
  ------------------
  |  |   46|  81.6k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
  841|  81.6k|                                       pu1_left[idx * src_strd],
  842|  81.6k|                                       pu1_left[(idx + 1) * src_strd]);
  843|       |
  844|  81.6k|        }
  845|  13.6k|        pu1_dst[0] = (pu1_left[6 * src_strd] + 3 * pu1_left[7 * src_strd] + 2)
  846|  13.6k|                        >> 2;
  847|  13.6k|    }
  848|  18.2k|}
ih264_intra_pred_luma_8x8_mode_vert:
  887|  5.08k|{
  888|  5.08k|    UWORD8 *pu1_top = NULL;
  889|       |
  890|  5.08k|    UNUSED(src_strd);
  ------------------
  |  |   45|  5.08k|#define UNUSED(x) ((void)(x))
  ------------------
  891|  5.08k|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|  5.08k|#define UNUSED(x) ((void)(x))
  ------------------
  892|  5.08k|    pu1_top = pu1_src + BLK8x8SIZE + 1;
  ------------------
  |  |  510|  5.08k|#define BLK8x8SIZE          8
  ------------------
  893|       |
  894|  5.08k|    memcpy(pu1_dst, pu1_top, 8);
  895|  5.08k|    memcpy(pu1_dst + dst_strd, pu1_top, 8);
  896|  5.08k|    memcpy(pu1_dst + 2 * dst_strd, pu1_top, 8);
  897|  5.08k|    memcpy(pu1_dst + 3 * dst_strd, pu1_top, 8);
  898|  5.08k|    memcpy(pu1_dst + 4 * dst_strd, pu1_top, 8);
  899|  5.08k|    memcpy(pu1_dst + 5 * dst_strd, pu1_top, 8);
  900|  5.08k|    memcpy(pu1_dst + 6 * dst_strd, pu1_top, 8);
  901|  5.08k|    memcpy(pu1_dst + 7 * dst_strd, pu1_top, 8);
  902|  5.08k|}
ih264_intra_pred_luma_8x8_mode_horz:
  941|  1.24k|{
  942|  1.24k|    UWORD8 *pu1_left = pu1_src + BLK8x8SIZE - 1;
  ------------------
  |  |  510|  1.24k|#define BLK8x8SIZE          8
  ------------------
  943|       |
  944|  1.24k|    UNUSED(src_strd);
  ------------------
  |  |   45|  1.24k|#define UNUSED(x) ((void)(x))
  ------------------
  945|  1.24k|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|  1.24k|#define UNUSED(x) ((void)(x))
  ------------------
  946|  1.24k|    memset(pu1_dst, *pu1_left, 8);
  947|  1.24k|    memset(pu1_dst + dst_strd, *(pu1_left - 1), 8);
  948|  1.24k|    memset(pu1_dst + 2 * dst_strd, *(pu1_left - 2), 8);
  949|  1.24k|    memset(pu1_dst + 3 * dst_strd, *(pu1_left - 3), 8);
  950|  1.24k|    memset(pu1_dst + 4 * dst_strd, *(pu1_left - 4), 8);
  951|  1.24k|    memset(pu1_dst + 5 * dst_strd, *(pu1_left - 5), 8);
  952|  1.24k|    memset(pu1_dst + 6 * dst_strd, *(pu1_left - 6), 8);
  953|  1.24k|    memset(pu1_dst + 7 * dst_strd, *(pu1_left - 7), 8);
  954|  1.24k|}
ih264_intra_pred_luma_8x8_mode_dc:
  992|  4.96k|{
  993|  4.96k|    UWORD8 u1_useleft; /* availability of left predictors (only for DC) */
  994|  4.96k|    UWORD8 u1_usetop; /* availability of top predictors (only for DC) */
  995|  4.96k|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
  996|  4.96k|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
  997|  4.96k|    WORD32 row;
  998|  4.96k|    WORD32 val = 0;
  999|       |
 1000|  4.96k|    UNUSED(src_strd);
  ------------------
  |  |   45|  4.96k|#define UNUSED(x) ((void)(x))
  ------------------
 1001|  4.96k|    u1_useleft = BOOLEAN(ngbr_avail & LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|  4.96k|#define BOOLEAN(x) (!!(x))
  ------------------
 1002|  4.96k|    u1_usetop = BOOLEAN(ngbr_avail & TOP_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|  4.96k|#define BOOLEAN(x) (!!(x))
  ------------------
 1003|  4.96k|    pu1_top = pu1_src + BLK8x8SIZE + 1;
  ------------------
  |  |  510|  4.96k|#define BLK8x8SIZE          8
  ------------------
 1004|  4.96k|    pu1_left = pu1_src + BLK8x8SIZE - 1;
  ------------------
  |  |  510|  4.96k|#define BLK8x8SIZE          8
  ------------------
 1005|       |
 1006|  4.96k|    if(u1_useleft)
  ------------------
  |  Branch (1006:8): [True: 2.99k, False: 1.97k]
  ------------------
 1007|  2.99k|    {
 1008|  26.9k|        for(row = 0; row < BLK8x8SIZE; row++)
  ------------------
  |  |  510|  26.9k|#define BLK8x8SIZE          8
  ------------------
  |  Branch (1008:22): [True: 23.9k, False: 2.99k]
  ------------------
 1009|  23.9k|            val += *(pu1_left - row);
 1010|  2.99k|        val += 4;
 1011|  2.99k|    }
 1012|  4.96k|    if(u1_usetop)
  ------------------
  |  Branch (1012:8): [True: 4.80k, False: 162]
  ------------------
 1013|  4.80k|    {
 1014|  43.2k|        for(row = 0; row < BLK8x8SIZE; row++)
  ------------------
  |  |  510|  43.2k|#define BLK8x8SIZE          8
  ------------------
  |  Branch (1014:22): [True: 38.4k, False: 4.80k]
  ------------------
 1015|  38.4k|            val += *(pu1_top + row);
 1016|  4.80k|        val += 4;
 1017|  4.80k|    }
 1018|       |
 1019|       |    /* Since 4 is added if either left/top pred is there,
 1020|       |     val still being zero implies both preds are not there */
 1021|  4.96k|    val = (val) ? (val >> (2 + u1_useleft + u1_usetop)) : 128;
  ------------------
  |  Branch (1021:11): [True: 4.91k, False: 54]
  ------------------
 1022|       |
 1023|  4.96k|    memset(pu1_dst, val, 8);
 1024|  4.96k|    memset(pu1_dst + dst_strd, val, 8);
 1025|  4.96k|    memset(pu1_dst + 2 * dst_strd, val, 8);
 1026|  4.96k|    memset(pu1_dst + 3 * dst_strd, val, 8);
 1027|  4.96k|    memset(pu1_dst + 4 * dst_strd, val, 8);
 1028|  4.96k|    memset(pu1_dst + 5 * dst_strd, val, 8);
 1029|  4.96k|    memset(pu1_dst + 6 * dst_strd, val, 8);
 1030|  4.96k|    memset(pu1_dst + 7 * dst_strd, val, 8);
 1031|  4.96k|}
ih264_intra_pred_luma_8x8_mode_diag_dl:
 1070|    547|{
 1071|    547|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
 1072|    547|    UWORD32 ui4_a, ui4_b, ui4_c, ui4_d, ui4_e, ui4_f, ui4_g, ui4_h;
 1073|    547|    UWORD32 ui4_i, ui4_j, ui4_k, ui4_l, ui4_m, ui4_n, ui4_o, ui4_p;
 1074|    547|    UWORD8 predicted_pixels[15];
 1075|       |
 1076|    547|    UNUSED(src_strd);
  ------------------
  |  |   45|    547|#define UNUSED(x) ((void)(x))
  ------------------
 1077|    547|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    547|#define UNUSED(x) ((void)(x))
  ------------------
 1078|    547|    pu1_top = pu1_src + BLK8x8SIZE + 1;
  ------------------
  |  |  510|    547|#define BLK8x8SIZE          8
  ------------------
 1079|       |
 1080|    547|    ui4_a = *pu1_top++;
 1081|    547|    ui4_b = *pu1_top++;
 1082|    547|    ui4_c = *pu1_top++;
 1083|    547|    ui4_d = *pu1_top++;
 1084|    547|    ui4_e = *pu1_top++;
 1085|    547|    ui4_f = *pu1_top++;
 1086|    547|    ui4_g = *pu1_top++;
 1087|    547|    ui4_h = *pu1_top++;
 1088|    547|    ui4_i = *pu1_top++;
 1089|    547|    ui4_j = *pu1_top++;
 1090|    547|    ui4_k = *pu1_top++;
 1091|    547|    ui4_l = *pu1_top++;
 1092|    547|    ui4_m = *pu1_top++;
 1093|    547|    ui4_n = *pu1_top++;
 1094|    547|    ui4_o = *pu1_top++;
 1095|    547|    ui4_p = *pu1_top;
 1096|       |
 1097|    547|    predicted_pixels[0] = FILT121(ui4_a, ui4_b, ui4_c);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1098|    547|    predicted_pixels[1] = FILT121(ui4_b, ui4_c, ui4_d);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1099|    547|    predicted_pixels[2] = FILT121(ui4_c, ui4_d, ui4_e);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1100|    547|    predicted_pixels[3] = FILT121(ui4_d, ui4_e, ui4_f);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1101|    547|    predicted_pixels[4] = FILT121(ui4_e, ui4_f, ui4_g);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1102|    547|    predicted_pixels[5] = FILT121(ui4_f, ui4_g, ui4_h);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1103|    547|    predicted_pixels[6] = FILT121(ui4_g, ui4_h, ui4_i);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1104|    547|    predicted_pixels[7] = FILT121(ui4_h, ui4_i, ui4_j);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1105|    547|    predicted_pixels[8] = FILT121(ui4_i, ui4_j, ui4_k);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1106|    547|    predicted_pixels[9] = FILT121(ui4_j, ui4_k, ui4_l);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1107|    547|    predicted_pixels[10] = FILT121(ui4_k, ui4_l, ui4_m);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1108|    547|    predicted_pixels[11] = FILT121(ui4_l, ui4_m, ui4_n);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1109|    547|    predicted_pixels[12] = FILT121(ui4_m, ui4_n, ui4_o);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1110|    547|    predicted_pixels[13] = FILT121(ui4_n, ui4_o, ui4_p);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1111|    547|    predicted_pixels[14] = FILT121(ui4_o, ui4_p, ui4_p);
  ------------------
  |  |   46|    547|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1112|       |
 1113|    547|    memcpy(pu1_dst, predicted_pixels, 8);
 1114|    547|    memcpy(pu1_dst + dst_strd, predicted_pixels + 1, 8);
 1115|    547|    memcpy(pu1_dst + 2 * dst_strd, predicted_pixels + 2, 8);
 1116|    547|    memcpy(pu1_dst + 3 * dst_strd, predicted_pixels + 3, 8);
 1117|    547|    memcpy(pu1_dst + 4 * dst_strd, predicted_pixels + 4, 8);
 1118|    547|    memcpy(pu1_dst + 5 * dst_strd, predicted_pixels + 5, 8);
 1119|    547|    memcpy(pu1_dst + 6 * dst_strd, predicted_pixels + 6, 8);
 1120|    547|    memcpy(pu1_dst + 7 * dst_strd, predicted_pixels + 7, 8);
 1121|    547|}
ih264_intra_pred_luma_8x8_mode_diag_dr:
 1160|    413|{
 1161|    413|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
 1162|    413|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
 1163|    413|    UWORD8 *pu1_topleft = NULL; /* Pointer to start of top left predictors */
 1164|    413|    UWORD32 ui4_a;
 1165|    413|    UWORD32 ui4_b, ui4_c, ui4_d, ui4_e, ui4_f, ui4_g, ui4_h, ui4_i;
 1166|    413|    UWORD32 ui4_j, ui4_k, ui4_l, ui4_m, ui4_n, ui4_o, ui4_p, ui4_q;
 1167|    413|    UWORD8 predicted_pixels[15];
 1168|       |
 1169|    413|    UNUSED(src_strd);
  ------------------
  |  |   45|    413|#define UNUSED(x) ((void)(x))
  ------------------
 1170|    413|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    413|#define UNUSED(x) ((void)(x))
  ------------------
 1171|    413|    pu1_top = pu1_src + BLK8x8SIZE + 1;
  ------------------
  |  |  510|    413|#define BLK8x8SIZE          8
  ------------------
 1172|    413|    pu1_left = pu1_src + BLK8x8SIZE - 1;
  ------------------
  |  |  510|    413|#define BLK8x8SIZE          8
  ------------------
 1173|    413|    pu1_topleft = pu1_src + BLK8x8SIZE;
  ------------------
  |  |  510|    413|#define BLK8x8SIZE          8
  ------------------
 1174|       |
 1175|    413|    ui4_a = *pu1_topleft;
 1176|    413|    ui4_b = *pu1_top++;
 1177|    413|    ui4_c = *pu1_top++;
 1178|    413|    ui4_d = *pu1_top++;
 1179|    413|    ui4_e = *pu1_top++;
 1180|    413|    ui4_f = *pu1_top++;
 1181|    413|    ui4_g = *pu1_top++;
 1182|    413|    ui4_h = *pu1_top++;
 1183|    413|    ui4_i = *pu1_top;
 1184|    413|    ui4_j = *pu1_left--;
 1185|    413|    ui4_k = *pu1_left--;
 1186|    413|    ui4_l = *pu1_left--;
 1187|    413|    ui4_m = *pu1_left--;
 1188|    413|    ui4_n = *pu1_left--;
 1189|    413|    ui4_o = *pu1_left--;
 1190|    413|    ui4_p = *pu1_left--;
 1191|    413|    ui4_q = *pu1_left;
 1192|       |
 1193|    413|    predicted_pixels[6] = FILT121(ui4_a, ui4_j, ui4_k);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1194|    413|    predicted_pixels[5] = FILT121(ui4_j, ui4_k, ui4_l);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1195|    413|    predicted_pixels[4] = FILT121(ui4_k, ui4_l, ui4_m);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1196|    413|    predicted_pixels[3] = FILT121(ui4_l, ui4_m, ui4_n);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1197|    413|    predicted_pixels[2] = FILT121(ui4_m, ui4_n, ui4_o);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1198|    413|    predicted_pixels[1] = FILT121(ui4_n, ui4_o, ui4_p);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1199|    413|    predicted_pixels[0] = FILT121(ui4_o, ui4_p, ui4_q);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1200|    413|    predicted_pixels[7] = FILT121(ui4_b, ui4_a, ui4_j);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1201|    413|    predicted_pixels[8] = FILT121(ui4_a, ui4_b, ui4_c);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1202|    413|    predicted_pixels[9] = FILT121(ui4_b, ui4_c, ui4_d);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1203|    413|    predicted_pixels[10] = FILT121(ui4_c, ui4_d, ui4_e);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1204|    413|    predicted_pixels[11] = FILT121(ui4_d, ui4_e, ui4_f);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1205|    413|    predicted_pixels[12] = FILT121(ui4_e, ui4_f, ui4_g);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1206|    413|    predicted_pixels[13] = FILT121(ui4_f, ui4_g, ui4_h);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1207|    413|    predicted_pixels[14] = FILT121(ui4_g, ui4_h, ui4_i);
  ------------------
  |  |   46|    413|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1208|       |
 1209|    413|    memcpy(pu1_dst, predicted_pixels + 7, 8);
 1210|    413|    memcpy(pu1_dst + dst_strd, predicted_pixels + 6, 8);
 1211|    413|    memcpy(pu1_dst + 2 * dst_strd, predicted_pixels + 5, 8);
 1212|    413|    memcpy(pu1_dst + 3 * dst_strd, predicted_pixels + 4, 8);
 1213|    413|    memcpy(pu1_dst + 4 * dst_strd, predicted_pixels + 3, 8);
 1214|    413|    memcpy(pu1_dst + 5 * dst_strd, predicted_pixels + 2, 8);
 1215|    413|    memcpy(pu1_dst + 6 * dst_strd, predicted_pixels + 1, 8);
 1216|    413|    memcpy(pu1_dst + 7 * dst_strd, predicted_pixels, 8);
 1217|    413|}
ih264_intra_pred_luma_8x8_mode_vert_r:
 1256|    462|{
 1257|    462|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
 1258|    462|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
 1259|    462|    UWORD8 *pu1_topleft = NULL; /* Pointer to start of top left predictors */
 1260|    462|    UWORD32 ui4_a;
 1261|    462|    UWORD32 ui4_b, ui4_c, ui4_d, ui4_e, ui4_f, ui4_g, ui4_h, ui4_i;
 1262|    462|    UWORD32 ui4_j, ui4_k, ui4_l, ui4_m, ui4_n, ui4_o, ui4_p;
 1263|    462|    UWORD8 predicted_pixels[22];
 1264|       |
 1265|    462|    UNUSED(src_strd);
  ------------------
  |  |   45|    462|#define UNUSED(x) ((void)(x))
  ------------------
 1266|    462|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    462|#define UNUSED(x) ((void)(x))
  ------------------
 1267|    462|    pu1_top = pu1_src + BLK8x8SIZE + 1;
  ------------------
  |  |  510|    462|#define BLK8x8SIZE          8
  ------------------
 1268|    462|    pu1_left = pu1_src + BLK8x8SIZE - 1;
  ------------------
  |  |  510|    462|#define BLK8x8SIZE          8
  ------------------
 1269|    462|    pu1_topleft = pu1_src + BLK8x8SIZE;
  ------------------
  |  |  510|    462|#define BLK8x8SIZE          8
  ------------------
 1270|       |
 1271|    462|    ui4_a = *pu1_topleft;
 1272|       |
 1273|    462|    ui4_b = *pu1_top++;
 1274|    462|    ui4_c = *pu1_top++;
 1275|    462|    ui4_d = *pu1_top++;
 1276|    462|    ui4_e = *pu1_top++;
 1277|    462|    ui4_f = *pu1_top++;
 1278|    462|    ui4_g = *pu1_top++;
 1279|    462|    ui4_h = *pu1_top++;
 1280|    462|    ui4_i = *pu1_top;
 1281|    462|    ui4_j = *pu1_left--;
 1282|    462|    ui4_k = *pu1_left--;
 1283|    462|    ui4_l = *pu1_left--;
 1284|    462|    ui4_m = *pu1_left--;
 1285|    462|    ui4_n = *pu1_left--;
 1286|    462|    ui4_o = *pu1_left--;
 1287|    462|    ui4_p = *pu1_left--;
 1288|       |
 1289|    462|    predicted_pixels[0] = FILT121(ui4_o, ui4_n, ui4_m);
  ------------------
  |  |   46|    462|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1290|    462|    predicted_pixels[1] = FILT121(ui4_m, ui4_l, ui4_k);
  ------------------
  |  |   46|    462|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1291|    462|    predicted_pixels[2] = FILT121(ui4_k, ui4_j, ui4_a);
  ------------------
  |  |   46|    462|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1292|    462|    predicted_pixels[3] = FILT11(ui4_a, ui4_b);
  ------------------
  |  |   49|    462|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1293|    462|    predicted_pixels[4] = FILT11(ui4_b, ui4_c);
  ------------------
  |  |   49|    462|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1294|    462|    predicted_pixels[5] = FILT11(ui4_c, ui4_d);
  ------------------
  |  |   49|    462|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1295|    462|    predicted_pixels[6] = FILT11(ui4_d, ui4_e);
  ------------------
  |  |   49|    462|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1296|    462|    predicted_pixels[7] = FILT11(ui4_e, ui4_f);
  ------------------
  |  |   49|    462|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1297|    462|    predicted_pixels[8] = FILT11(ui4_f, ui4_g);
  ------------------
  |  |   49|    462|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1298|    462|    predicted_pixels[9] = FILT11(ui4_g, ui4_h);
  ------------------
  |  |   49|    462|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1299|    462|    predicted_pixels[10] = FILT11(ui4_h, ui4_i);
  ------------------
  |  |   49|    462|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1300|    462|    predicted_pixels[11] = FILT121(ui4_p, ui4_o, ui4_n);
  ------------------
  |  |   46|    462|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1301|    462|    predicted_pixels[12] = FILT121(ui4_n, ui4_m, ui4_l);
  ------------------
  |  |   46|    462|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1302|    462|    predicted_pixels[13] = FILT121(ui4_l, ui4_k, ui4_j);
  ------------------
  |  |   46|    462|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1303|    462|    predicted_pixels[14] = FILT121(ui4_b, ui4_a, ui4_j);
  ------------------
  |  |   46|    462|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1304|    462|    predicted_pixels[15] = FILT121(ui4_a, ui4_b, ui4_c);
  ------------------
  |  |   46|    462|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1305|    462|    predicted_pixels[16] = FILT121(ui4_b, ui4_c, ui4_d);
  ------------------
  |  |   46|    462|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1306|    462|    predicted_pixels[17] = FILT121(ui4_c, ui4_d, ui4_e);
  ------------------
  |  |   46|    462|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1307|    462|    predicted_pixels[18] = FILT121(ui4_d, ui4_e, ui4_f);
  ------------------
  |  |   46|    462|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1308|    462|    predicted_pixels[19] = FILT121(ui4_e, ui4_f, ui4_g);
  ------------------
  |  |   46|    462|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1309|    462|    predicted_pixels[20] = FILT121(ui4_f, ui4_g, ui4_h);
  ------------------
  |  |   46|    462|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1310|    462|    predicted_pixels[21] = FILT121(ui4_g, ui4_h, ui4_i);
  ------------------
  |  |   46|    462|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1311|       |
 1312|    462|    memcpy(pu1_dst, predicted_pixels + 3, 8);
 1313|    462|    memcpy(pu1_dst + 1 * dst_strd, predicted_pixels + 14, 8);
 1314|    462|    memcpy(pu1_dst + 2 * dst_strd, predicted_pixels + 2, 8);
 1315|    462|    memcpy(pu1_dst + 3 * dst_strd, predicted_pixels + 13, 8);
 1316|    462|    memcpy(pu1_dst + 4 * dst_strd, predicted_pixels + 1, 8);
 1317|    462|    memcpy(pu1_dst + 5 * dst_strd, predicted_pixels + 12, 8);
 1318|    462|    memcpy(pu1_dst + 6 * dst_strd, predicted_pixels, 8);
 1319|    462|    memcpy(pu1_dst + 7 * dst_strd, predicted_pixels + 11, 8);
 1320|    462|}
ih264_intra_pred_luma_8x8_mode_horz_d:
 1359|    427|{
 1360|    427|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
 1361|    427|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
 1362|    427|    UWORD8 *pu1_topleft = NULL; /* Pointer to start of top left predictors */
 1363|    427|    UWORD32 ui4_a;
 1364|    427|    UWORD32 ui4_b, ui4_c, ui4_d, ui4_e, ui4_f, ui4_g, ui4_h, ui4_i;
 1365|    427|    UWORD32 ui4_j, ui4_k, ui4_l, ui4_m, ui4_n, ui4_o, ui4_p;
 1366|    427|    UWORD8 predicted_pixels[22];
 1367|       |
 1368|    427|    UNUSED(src_strd);
  ------------------
  |  |   45|    427|#define UNUSED(x) ((void)(x))
  ------------------
 1369|    427|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    427|#define UNUSED(x) ((void)(x))
  ------------------
 1370|    427|    pu1_top = pu1_src + BLK8x8SIZE + 1;
  ------------------
  |  |  510|    427|#define BLK8x8SIZE          8
  ------------------
 1371|    427|    pu1_left = pu1_src + BLK8x8SIZE - 1;
  ------------------
  |  |  510|    427|#define BLK8x8SIZE          8
  ------------------
 1372|    427|    pu1_topleft = pu1_src + BLK8x8SIZE;
  ------------------
  |  |  510|    427|#define BLK8x8SIZE          8
  ------------------
 1373|       |
 1374|    427|    ui4_a = *pu1_topleft;
 1375|    427|    ui4_j = *pu1_top++;
 1376|    427|    ui4_k = *pu1_top++;
 1377|    427|    ui4_l = *pu1_top++;
 1378|    427|    ui4_m = *pu1_top++;
 1379|    427|    ui4_n = *pu1_top++;
 1380|    427|    ui4_o = *pu1_top++;
 1381|    427|    ui4_p = *pu1_top++;
 1382|    427|    ui4_b = *pu1_left--;
 1383|    427|    ui4_c = *pu1_left--;
 1384|    427|    ui4_d = *pu1_left--;
 1385|    427|    ui4_e = *pu1_left--;
 1386|    427|    ui4_f = *pu1_left--;
 1387|    427|    ui4_g = *pu1_left--;
 1388|    427|    ui4_h = *pu1_left--;
 1389|    427|    ui4_i = *pu1_left;
 1390|       |
 1391|    427|    predicted_pixels[0] = FILT11(ui4_h, ui4_i);
  ------------------
  |  |   49|    427|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1392|    427|    predicted_pixels[1] = FILT121(ui4_g, ui4_h, ui4_i);
  ------------------
  |  |   46|    427|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1393|    427|    predicted_pixels[2] = FILT11(ui4_g, ui4_h);
  ------------------
  |  |   49|    427|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1394|    427|    predicted_pixels[3] = FILT121(ui4_f, ui4_g, ui4_h);
  ------------------
  |  |   46|    427|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1395|    427|    predicted_pixels[4] = FILT11(ui4_f, ui4_g);
  ------------------
  |  |   49|    427|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1396|    427|    predicted_pixels[5] = FILT121(ui4_e, ui4_f, ui4_g);
  ------------------
  |  |   46|    427|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1397|    427|    predicted_pixels[6] = FILT11(ui4_e, ui4_f);
  ------------------
  |  |   49|    427|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1398|    427|    predicted_pixels[7] = FILT121(ui4_d, ui4_e, ui4_f);
  ------------------
  |  |   46|    427|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1399|    427|    predicted_pixels[8] = FILT11(ui4_d, ui4_e);
  ------------------
  |  |   49|    427|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1400|    427|    predicted_pixels[9] = FILT121(ui4_c, ui4_d, ui4_e);
  ------------------
  |  |   46|    427|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1401|    427|    predicted_pixels[10] = FILT11(ui4_c, ui4_d);
  ------------------
  |  |   49|    427|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1402|    427|    predicted_pixels[11] = FILT121(ui4_b, ui4_c, ui4_d);
  ------------------
  |  |   46|    427|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1403|    427|    predicted_pixels[12] = FILT11(ui4_b, ui4_c);
  ------------------
  |  |   49|    427|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1404|    427|    predicted_pixels[13] = FILT121(ui4_a, ui4_b, ui4_c);
  ------------------
  |  |   46|    427|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1405|    427|    predicted_pixels[14] = FILT11(ui4_a, ui4_b);
  ------------------
  |  |   49|    427|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1406|    427|    predicted_pixels[15] = FILT121(ui4_j, ui4_a, ui4_b);
  ------------------
  |  |   46|    427|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1407|    427|    predicted_pixels[16] = FILT121(ui4_k, ui4_j, ui4_a);
  ------------------
  |  |   46|    427|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1408|    427|    predicted_pixels[17] = FILT121(ui4_l, ui4_k, ui4_j);
  ------------------
  |  |   46|    427|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1409|    427|    predicted_pixels[18] = FILT121(ui4_m, ui4_l, ui4_k);
  ------------------
  |  |   46|    427|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1410|    427|    predicted_pixels[19] = FILT121(ui4_n, ui4_m, ui4_l);
  ------------------
  |  |   46|    427|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1411|    427|    predicted_pixels[20] = FILT121(ui4_o, ui4_n, ui4_m);
  ------------------
  |  |   46|    427|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1412|    427|    predicted_pixels[21] = FILT121(ui4_p, ui4_o, ui4_n);
  ------------------
  |  |   46|    427|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1413|       |
 1414|    427|    memcpy(pu1_dst, predicted_pixels + 14, 8);
 1415|    427|    memcpy(pu1_dst + dst_strd, predicted_pixels + 12, 8);
 1416|    427|    memcpy(pu1_dst + 2 * dst_strd, predicted_pixels + 10, 8);
 1417|    427|    memcpy(pu1_dst + 3 * dst_strd, predicted_pixels + 8, 8);
 1418|    427|    memcpy(pu1_dst + 4 * dst_strd, predicted_pixels + 6, 8);
 1419|    427|    memcpy(pu1_dst + 5 * dst_strd, predicted_pixels + 4, 8);
 1420|    427|    memcpy(pu1_dst + 6 * dst_strd, predicted_pixels + 2, 8);
 1421|    427|    memcpy(pu1_dst + 7 * dst_strd, predicted_pixels, 8);
 1422|    427|}
ih264_intra_pred_luma_8x8_mode_vert_l:
 1462|  1.01k|{
 1463|  1.01k|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
 1464|  1.01k|    UWORD32 ui4_a, ui4_b, ui4_c, ui4_d, ui4_e, ui4_f, ui4_g, ui4_h;
 1465|  1.01k|    UWORD32 ui4_i, ui4_j, ui4_k, ui4_l, ui4_m;
 1466|  1.01k|    UWORD8 predicted_pixels[22];
 1467|       |
 1468|  1.01k|    UNUSED(src_strd);
  ------------------
  |  |   45|  1.01k|#define UNUSED(x) ((void)(x))
  ------------------
 1469|  1.01k|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|  1.01k|#define UNUSED(x) ((void)(x))
  ------------------
 1470|  1.01k|    pu1_top = pu1_src + BLK8x8SIZE + 1;
  ------------------
  |  |  510|  1.01k|#define BLK8x8SIZE          8
  ------------------
 1471|       |
 1472|  1.01k|    ui4_a = *pu1_top++;
 1473|  1.01k|    ui4_b = *pu1_top++;
 1474|  1.01k|    ui4_c = *pu1_top++;
 1475|  1.01k|    ui4_d = *pu1_top++;
 1476|  1.01k|    ui4_e = *pu1_top++;
 1477|  1.01k|    ui4_f = *pu1_top++;
 1478|  1.01k|    ui4_g = *pu1_top++;
 1479|  1.01k|    ui4_h = *pu1_top++;
 1480|  1.01k|    ui4_i = *pu1_top++;
 1481|  1.01k|    ui4_j = *pu1_top++;
 1482|  1.01k|    ui4_k = *pu1_top++;
 1483|  1.01k|    ui4_l = *pu1_top++;
 1484|  1.01k|    ui4_m = *pu1_top++;
 1485|       |
 1486|  1.01k|    predicted_pixels[0] = FILT11(ui4_a, ui4_b);
  ------------------
  |  |   49|  1.01k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1487|  1.01k|    predicted_pixels[1] = FILT11(ui4_b, ui4_c);
  ------------------
  |  |   49|  1.01k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1488|  1.01k|    predicted_pixels[2] = FILT11(ui4_c, ui4_d);
  ------------------
  |  |   49|  1.01k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1489|  1.01k|    predicted_pixels[3] = FILT11(ui4_d, ui4_e);
  ------------------
  |  |   49|  1.01k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1490|  1.01k|    predicted_pixels[4] = FILT11(ui4_e, ui4_f);
  ------------------
  |  |   49|  1.01k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1491|  1.01k|    predicted_pixels[5] = FILT11(ui4_f, ui4_g);
  ------------------
  |  |   49|  1.01k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1492|  1.01k|    predicted_pixels[6] = FILT11(ui4_g, ui4_h);
  ------------------
  |  |   49|  1.01k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1493|  1.01k|    predicted_pixels[7] = FILT11(ui4_h, ui4_i);
  ------------------
  |  |   49|  1.01k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1494|  1.01k|    predicted_pixels[8] = FILT11(ui4_i, ui4_j);
  ------------------
  |  |   49|  1.01k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1495|  1.01k|    predicted_pixels[9] = FILT11(ui4_j, ui4_k);
  ------------------
  |  |   49|  1.01k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1496|  1.01k|    predicted_pixels[10] = FILT11(ui4_k, ui4_l);
  ------------------
  |  |   49|  1.01k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1497|  1.01k|    predicted_pixels[11] = FILT121(ui4_a, ui4_b, ui4_c);
  ------------------
  |  |   46|  1.01k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1498|  1.01k|    predicted_pixels[12] = FILT121(ui4_b, ui4_c, ui4_d);
  ------------------
  |  |   46|  1.01k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1499|  1.01k|    predicted_pixels[13] = FILT121(ui4_c, ui4_d, ui4_e);
  ------------------
  |  |   46|  1.01k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1500|  1.01k|    predicted_pixels[14] = FILT121(ui4_d, ui4_e, ui4_f);
  ------------------
  |  |   46|  1.01k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1501|  1.01k|    predicted_pixels[15] = FILT121(ui4_e, ui4_f, ui4_g);
  ------------------
  |  |   46|  1.01k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1502|  1.01k|    predicted_pixels[16] = FILT121(ui4_f, ui4_g, ui4_h);
  ------------------
  |  |   46|  1.01k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1503|  1.01k|    predicted_pixels[17] = FILT121(ui4_g, ui4_h, ui4_i);
  ------------------
  |  |   46|  1.01k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1504|  1.01k|    predicted_pixels[18] = FILT121(ui4_h, ui4_i, ui4_j);
  ------------------
  |  |   46|  1.01k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1505|  1.01k|    predicted_pixels[19] = FILT121(ui4_i, ui4_j, ui4_k);
  ------------------
  |  |   46|  1.01k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1506|  1.01k|    predicted_pixels[20] = FILT121(ui4_j, ui4_k, ui4_l);
  ------------------
  |  |   46|  1.01k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1507|  1.01k|    predicted_pixels[21] = FILT121(ui4_k, ui4_l, ui4_m);
  ------------------
  |  |   46|  1.01k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1508|       |
 1509|  1.01k|    memcpy(pu1_dst, predicted_pixels, 8);
 1510|  1.01k|    memcpy(pu1_dst + 2 * dst_strd, predicted_pixels + 1, 8);
 1511|  1.01k|    memcpy(pu1_dst + 4 * dst_strd, predicted_pixels + 2, 8);
 1512|  1.01k|    memcpy(pu1_dst + 6 * dst_strd, predicted_pixels + 3, 8);
 1513|  1.01k|    memcpy(pu1_dst + 1 * dst_strd, predicted_pixels + 11, 8);
 1514|  1.01k|    memcpy(pu1_dst + 3 * dst_strd, predicted_pixels + 12, 8);
 1515|  1.01k|    memcpy(pu1_dst + 5 * dst_strd, predicted_pixels + 13, 8);
 1516|  1.01k|    memcpy(pu1_dst + 7 * dst_strd, predicted_pixels + 14, 8);
 1517|  1.01k|}
ih264_intra_pred_luma_8x8_mode_horz_u:
 1556|  2.03k|{
 1557|  2.03k|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
 1558|  2.03k|    UWORD32 ui4_j, ui4_k, ui4_l, ui4_m, ui4_n, ui4_o, ui4_p, ui4_q;
 1559|  2.03k|    UWORD8 predicted_pixels[22];
 1560|       |
 1561|  2.03k|    UNUSED(src_strd);
  ------------------
  |  |   45|  2.03k|#define UNUSED(x) ((void)(x))
  ------------------
 1562|  2.03k|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|  2.03k|#define UNUSED(x) ((void)(x))
  ------------------
 1563|  2.03k|    pu1_left = pu1_src + BLK8x8SIZE - 1;
  ------------------
  |  |  510|  2.03k|#define BLK8x8SIZE          8
  ------------------
 1564|       |
 1565|  2.03k|    ui4_j = *pu1_left--;
 1566|  2.03k|    ui4_k = *pu1_left--;
 1567|  2.03k|    ui4_l = *pu1_left--;
 1568|  2.03k|    ui4_m = *pu1_left--;
 1569|  2.03k|    ui4_n = *pu1_left--;
 1570|  2.03k|    ui4_o = *pu1_left--;
 1571|  2.03k|    ui4_p = *pu1_left--;
 1572|  2.03k|    ui4_q = *pu1_left;
 1573|       |
 1574|  2.03k|    pu1_left = pu1_src + BLK8x8SIZE - 1;
  ------------------
  |  |  510|  2.03k|#define BLK8x8SIZE          8
  ------------------
 1575|       |
 1576|  2.03k|    predicted_pixels[0] = FILT11(ui4_j, ui4_k);
  ------------------
  |  |   49|  2.03k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1577|  2.03k|    predicted_pixels[1] = FILT121(ui4_j, ui4_k, ui4_l);
  ------------------
  |  |   46|  2.03k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1578|  2.03k|    predicted_pixels[2] = FILT11(ui4_k, ui4_l);
  ------------------
  |  |   49|  2.03k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1579|  2.03k|    predicted_pixels[3] = FILT121(ui4_k, ui4_l, ui4_m);
  ------------------
  |  |   46|  2.03k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1580|  2.03k|    predicted_pixels[4] = FILT11(ui4_l, ui4_m);
  ------------------
  |  |   49|  2.03k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1581|  2.03k|    predicted_pixels[5] = FILT121(ui4_l, ui4_m, ui4_n);
  ------------------
  |  |   46|  2.03k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1582|  2.03k|    predicted_pixels[6] = FILT11(ui4_m, ui4_n);
  ------------------
  |  |   49|  2.03k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1583|  2.03k|    predicted_pixels[7] = FILT121(ui4_m, ui4_n, ui4_o);
  ------------------
  |  |   46|  2.03k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1584|  2.03k|    predicted_pixels[8] = FILT11(ui4_n, ui4_o);
  ------------------
  |  |   49|  2.03k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1585|  2.03k|    predicted_pixels[9] = FILT121(ui4_n, ui4_o, ui4_p);
  ------------------
  |  |   46|  2.03k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1586|  2.03k|    predicted_pixels[10] = FILT11(ui4_o, ui4_p);
  ------------------
  |  |   49|  2.03k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1587|  2.03k|    predicted_pixels[11] = FILT121(ui4_o, ui4_p, ui4_q);
  ------------------
  |  |   46|  2.03k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1588|  2.03k|    predicted_pixels[12] = FILT11(ui4_p, ui4_q);
  ------------------
  |  |   49|  2.03k|#define FILT11(a,b) ((a + b + 1) >> 1)
  ------------------
 1589|  2.03k|    predicted_pixels[13] = FILT121(ui4_p, ui4_q, ui4_q);
  ------------------
  |  |   46|  2.03k|#define FILT121(a,b,c) ((a + (b << 1) + c + 2) >> 2)
  ------------------
 1590|  2.03k|    memset(predicted_pixels+14,ui4_q,8);
 1591|       |
 1592|  2.03k|    memcpy(pu1_dst, predicted_pixels, 8);
 1593|  2.03k|    memcpy(pu1_dst + 1 * dst_strd, predicted_pixels + 2, 8);
 1594|  2.03k|    memcpy(pu1_dst + 2 * dst_strd, predicted_pixels + 4, 8);
 1595|  2.03k|    memcpy(pu1_dst + 3 * dst_strd, predicted_pixels + 6, 8);
 1596|  2.03k|    memcpy(pu1_dst + 4 * dst_strd, predicted_pixels + 8, 8);
 1597|  2.03k|    memcpy(pu1_dst + 5 * dst_strd, predicted_pixels + 10, 8);
 1598|  2.03k|    memcpy(pu1_dst + 6 * dst_strd, predicted_pixels + 12, 8);
 1599|  2.03k|    memcpy(pu1_dst + 7 * dst_strd, predicted_pixels + 14, 8);
 1600|  2.03k|}
ih264_intra_pred_luma_16x16_mode_vert:
 1639|    699|{
 1640|    699|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
 1641|    699|    WORD32 rows; /* loop variables*/
 1642|       |
 1643|    699|    UNUSED(src_strd);
  ------------------
  |  |   45|    699|#define UNUSED(x) ((void)(x))
  ------------------
 1644|    699|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    699|#define UNUSED(x) ((void)(x))
  ------------------
 1645|    699|    pu1_top = pu1_src + MB_SIZE + 1;
  ------------------
  |  |  509|    699|#define MB_SIZE             16
  ------------------
 1646|  3.49k|    for(rows = 0; rows < 16; rows += 4, pu1_dst += dst_strd)
  ------------------
  |  Branch (1646:19): [True: 2.79k, False: 699]
  ------------------
 1647|  2.79k|    {
 1648|  2.79k|        memcpy(pu1_dst, pu1_top, 16);
 1649|  2.79k|        pu1_dst += dst_strd;
 1650|  2.79k|        memcpy(pu1_dst, pu1_top, 16);
 1651|  2.79k|        pu1_dst += dst_strd;
 1652|  2.79k|        memcpy(pu1_dst, pu1_top, 16);
 1653|  2.79k|        pu1_dst += dst_strd;
 1654|  2.79k|        memcpy(pu1_dst, pu1_top, 16);
 1655|  2.79k|    }
 1656|    699|}
ih264_intra_pred_luma_16x16_mode_horz:
 1695|    138|{
 1696|    138|    UWORD8 *pu1_left = NULL; /* Pointer to start of top predictors */
 1697|    138|    WORD32 rows;
 1698|       |
 1699|    138|    UNUSED(src_strd);
  ------------------
  |  |   45|    138|#define UNUSED(x) ((void)(x))
  ------------------
 1700|    138|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    138|#define UNUSED(x) ((void)(x))
  ------------------
 1701|    138|    pu1_left = pu1_src + MB_SIZE - 1;
  ------------------
  |  |  509|    138|#define MB_SIZE             16
  ------------------
 1702|    690|    for(rows = 0; rows < 16; rows += 4, pu1_dst += dst_strd, pu1_left --)
  ------------------
  |  Branch (1702:19): [True: 552, False: 138]
  ------------------
 1703|    552|    {
 1704|    552|        memset(pu1_dst, *pu1_left, 16); /* copy the left value to the entire row*/
 1705|    552|        pu1_left --;
 1706|    552|        pu1_dst += dst_strd;
 1707|    552|        memset(pu1_dst, *pu1_left, 16);
 1708|    552|        pu1_left --;
 1709|    552|        pu1_dst += dst_strd;
 1710|    552|        memset(pu1_dst, *pu1_left, 16);
 1711|    552|        pu1_left --;
 1712|    552|        pu1_dst += dst_strd;
 1713|    552|        memset(pu1_dst, *pu1_left, 16);
 1714|    552|    }
 1715|    138|}
ih264_intra_pred_luma_16x16_mode_dc:
 1753|    436|{
 1754|    436|    WORD8 u1_useleft; /* availability of left predictors (only for DC) */
 1755|    436|    UWORD8 u1_usetop; /* availability of top predictors (only for DC) */
 1756|    436|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
 1757|    436|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
 1758|    436|    WORD32 rows; /* loop variables*/
 1759|    436|    WORD32 val = 0;
 1760|       |
 1761|    436|    UNUSED(src_strd);
  ------------------
  |  |   45|    436|#define UNUSED(x) ((void)(x))
  ------------------
 1762|    436|    u1_useleft = BOOLEAN(ngbr_avail & LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|    436|#define BOOLEAN(x) (!!(x))
  ------------------
 1763|    436|    u1_usetop = BOOLEAN(ngbr_avail & TOP_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|    436|#define BOOLEAN(x) (!!(x))
  ------------------
 1764|    436|    pu1_top = pu1_src + MB_SIZE + 1;
  ------------------
  |  |  509|    436|#define MB_SIZE             16
  ------------------
 1765|    436|    pu1_left = pu1_src + MB_SIZE - 1;
  ------------------
  |  |  509|    436|#define MB_SIZE             16
  ------------------
 1766|    436|    if(u1_useleft)
  ------------------
  |  Branch (1766:8): [True: 231, False: 205]
  ------------------
 1767|    231|    {
 1768|  3.92k|        for(rows = 0; rows < 16; rows++)
  ------------------
  |  Branch (1768:23): [True: 3.69k, False: 231]
  ------------------
 1769|  3.69k|            val += *(pu1_left - rows);
 1770|    231|        val += 8;
 1771|    231|    }
 1772|    436|    if(u1_usetop)
  ------------------
  |  Branch (1772:8): [True: 360, False: 76]
  ------------------
 1773|    360|    {
 1774|  6.12k|        for(rows = 0; rows < 16; rows++)
  ------------------
  |  Branch (1774:23): [True: 5.76k, False: 360]
  ------------------
 1775|  5.76k|            val += *(pu1_top + rows);
 1776|    360|        val += 8;
 1777|    360|    }
 1778|       |    /* Since 8 is added if either left/top pred is there,
 1779|       |     val still being zero implies both preds are not there */
 1780|    436|    val = (val) ? (val >> (3 + u1_useleft + u1_usetop)) : 128;
  ------------------
  |  Branch (1780:11): [True: 397, False: 39]
  ------------------
 1781|       |
 1782|  2.18k|    for(rows = 0; rows < 16; rows += 4, pu1_dst += dst_strd)
  ------------------
  |  Branch (1782:19): [True: 1.74k, False: 436]
  ------------------
 1783|  1.74k|    {
 1784|  1.74k|        memset(pu1_dst, val, 16);
 1785|  1.74k|        pu1_dst += dst_strd;
 1786|  1.74k|        memset(pu1_dst, val, 16);
 1787|  1.74k|        pu1_dst += dst_strd;
 1788|  1.74k|        memset(pu1_dst, val, 16);
 1789|  1.74k|        pu1_dst += dst_strd;
 1790|  1.74k|        memset(pu1_dst, val, 16);
 1791|  1.74k|    }
 1792|    436|}
ih264_intra_pred_luma_16x16_mode_plane:
 1830|     88|{
 1831|       |    /*! Written with no multiplications */
 1832|     88|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
 1833|     88|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
 1834|     88|    UWORD8 *pu1_topleft = NULL;
 1835|     88|    WORD32 a, b, c, tmp;
 1836|     88|    UWORD8 *pu1_tmp1, *pu1_tmp2;
 1837|     88|    WORD32 shift;
 1838|       |
 1839|     88|    UNUSED(src_strd);
  ------------------
  |  |   45|     88|#define UNUSED(x) ((void)(x))
  ------------------
 1840|     88|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|     88|#define UNUSED(x) ((void)(x))
  ------------------
 1841|     88|    pu1_top = pu1_src + MB_SIZE + 1;
  ------------------
  |  |  509|     88|#define MB_SIZE             16
  ------------------
 1842|     88|    pu1_left = pu1_src + MB_SIZE - 1;
  ------------------
  |  |  509|     88|#define MB_SIZE             16
  ------------------
 1843|     88|    pu1_topleft = pu1_src + MB_SIZE;
  ------------------
  |  |  509|     88|#define MB_SIZE             16
  ------------------
 1844|       |
 1845|     88|    {
 1846|     88|        a = (*(pu1_top + 15) + *(pu1_left - 15)) << 4;
 1847|       |
 1848|       |        /*! Implement Sum(x*(P((x+7),-1) - P((x-7),-1))) x=1...8 */
 1849|     88|        pu1_tmp1 = pu1_top + 8;
 1850|     88|        pu1_tmp2 = pu1_tmp1 - 2;
 1851|       |
 1852|       |        /* Pixel diffs are only 9 bits;
 1853|       |         so sign extension allows shifts to be used even for signed */
 1854|     88|        b = ((*pu1_tmp1++) - (*pu1_tmp2--)); /* x=1 */
 1855|     88|        b += ((*pu1_tmp1++) - (*pu1_tmp2--)) << 1; /* x=2 */
 1856|     88|        tmp = ((*pu1_tmp1++) - (*pu1_tmp2--));
 1857|     88|        b += (tmp << 1) + tmp; /* x=3 */
 1858|     88|        b += ((*pu1_tmp1++) - (*pu1_tmp2--)) << 2; /* x=4 */
 1859|       |
 1860|     88|        tmp = ((*pu1_tmp1++) - (*pu1_tmp2--));
 1861|     88|        b += (tmp << 2) + tmp; /* x=5 */
 1862|     88|        tmp = ((*pu1_tmp1++) - (*pu1_tmp2--));
 1863|     88|        b += (tmp << 2) + (tmp << 1); /* x=6 */
 1864|     88|        tmp = ((*pu1_tmp1++) - (*pu1_tmp2--));
 1865|     88|        b += (tmp << 3) - tmp; /* x=7 */
 1866|     88|        b += ((*pu1_tmp1) - (*pu1_topleft)) << 3; /* x=8 */
 1867|       |
 1868|     88|        b = ((b << 2) + b + 32) >> 6; /*! (5*H + 32)>>6 */
 1869|       |
 1870|       |        /*! Implement Sum(y*(P(-1,(y+7)) - P(-1,(y-7)))) y=1...8 */
 1871|     88|        pu1_tmp1 = pu1_left - 8;
 1872|     88|        pu1_tmp2 = pu1_tmp1 + 2;
 1873|       |
 1874|     88|        c = ((*pu1_tmp1) - (*pu1_tmp2)); /* y=1 */
 1875|     88|        pu1_tmp1--;
 1876|     88|        pu1_tmp2++;
 1877|     88|        c += ((*pu1_tmp1) - (*pu1_tmp2)) << 1; /* y=2 */
 1878|     88|        pu1_tmp1--;
 1879|     88|        pu1_tmp2++;
 1880|     88|        tmp = ((*pu1_tmp1) - (*pu1_tmp2));
 1881|     88|        c += (tmp << 1) + tmp; /* y=3 */
 1882|     88|        pu1_tmp1--;
 1883|     88|        pu1_tmp2++;
 1884|     88|        c += ((*pu1_tmp1) - (*pu1_tmp2)) << 2; /* y=4 */
 1885|     88|        pu1_tmp1--;
 1886|     88|        pu1_tmp2++;
 1887|       |
 1888|     88|        tmp = ((*pu1_tmp1) - (*pu1_tmp2));
 1889|     88|        c += (tmp << 2) + tmp; /* y=5 */
 1890|     88|        pu1_tmp1--;
 1891|     88|        pu1_tmp2++;
 1892|     88|        tmp = ((*pu1_tmp1) - (*pu1_tmp2));
 1893|     88|        c += (tmp << 2) + (tmp << 1); /* y=6 */
 1894|     88|        pu1_tmp1--;
 1895|     88|        pu1_tmp2++;
 1896|     88|        tmp = ((*pu1_tmp1) - (*pu1_tmp2));
 1897|     88|        c += (tmp << 3) - tmp; /* y=7 */
 1898|     88|        pu1_tmp1--; //pu1_tmp2 ++;
 1899|       |        /* Modified to get (-1,-1) location as *(pu1_top - 1) instead of (pu1_left - ui4_stride) */
 1900|       |        //c += ((*pu1_tmp1) - (*(pu1_top - 1)))<<3;      /* y=8 */
 1901|     88|        c += ((*pu1_tmp1) - (*pu1_topleft)) << 3; /* y=8 */
 1902|       |
 1903|     88|        c = ((c << 2) + c + 32) >> 6; /*! (5*V + 32)>>32 */
 1904|     88|        shift = 3;
 1905|     88|    }
 1906|       |
 1907|       |    /*! Now from the plane parameters a, b, and c,
 1908|       |     compute the fitted plane values over the block */
 1909|     88|    {
 1910|     88|        WORD32 tmp1, tmpx, tmpx_init, j, i;
 1911|       |
 1912|     88|        tmpx_init = -(b << shift); /* -8b */
 1913|     88|        tmp = a - (c << shift) + 16; /* a-((4or8)*c)+16 */
 1914|  1.49k|        for(i = 0; i < 16; i++)
  ------------------
  |  Branch (1914:20): [True: 1.40k, False: 88]
  ------------------
 1915|  1.40k|        {
 1916|  1.40k|            tmp += c; /*increment every time by c to get c*(y-7or3)*/
 1917|  1.40k|            tmpx = tmpx_init; /* Init to -8b */
 1918|  23.9k|            for(j = 0; j < 16; j++)
  ------------------
  |  Branch (1918:24): [True: 22.5k, False: 1.40k]
  ------------------
 1919|  22.5k|            {
 1920|  22.5k|                tmpx += b; /* increment every time by b to get b*(x-7or3) */
 1921|  22.5k|                tmp1 = (tmp + tmpx) >> 5;
 1922|  22.5k|                *pu1_dst++ = CLIP_U8(tmp1);
  ------------------
  |  |   58|  22.5k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  22.5k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 4.66k, False: 17.8k]
  |  |  |  |  |  Branch (77:54): [True: 32, False: 17.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1923|  22.5k|            }
 1924|  1.40k|            pu1_dst += (dst_strd - 16);
 1925|  1.40k|        }
 1926|     88|    }
 1927|     88|}

ih264_pad_top:
   94|  5.78k|{
   95|  5.78k|    WORD32 row;
   96|       |
   97|  86.7k|    for(row = 1; row <= pad_size; row++)
  ------------------
  |  Branch (97:18): [True: 80.9k, False: 5.78k]
  ------------------
   98|  80.9k|    {
   99|  80.9k|        memcpy(pu1_src - row * src_strd, pu1_src, wd);
  100|  80.9k|    }
  101|  5.78k|}
ih264_pad_bottom:
  133|  5.78k|{
  134|  5.78k|    WORD32 row;
  135|       |
  136|  86.7k|    for(row = 1; row <= pad_size; row++)
  ------------------
  |  Branch (136:18): [True: 80.9k, False: 5.78k]
  ------------------
  137|  80.9k|    {
  138|  80.9k|        memcpy(pu1_src + (row - 1) * src_strd, pu1_src - 1 * src_strd, wd);
  139|  80.9k|    }
  140|  5.78k|}
ih264_pad_left_luma:
  172|  1.61k|{
  173|  1.61k|    WORD32 row;
  174|       |
  175|  1.33M|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (175:18): [True: 1.33M, False: 1.61k]
  ------------------
  176|  1.33M|    {
  177|  1.33M|        memset(pu1_src - pad_size, *pu1_src, pad_size);
  178|  1.33M|        pu1_src += src_strd;
  179|  1.33M|    }
  180|  1.61k|}
ih264_pad_left_chroma:
  212|  1.61k|{
  213|  1.61k|    WORD32 row, col;
  214|  1.61k|    UWORD16 u2_uv_val;
  215|  1.61k|    UWORD16 *pu2_src = (UWORD16 *)pu1_src;
  216|       |
  217|  1.61k|    src_strd >>= 1;
  218|  1.61k|    pad_size >>= 1;
  219|       |
  220|   670k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (220:18): [True: 668k, False: 1.61k]
  ------------------
  221|   668k|    {
  222|   668k|        u2_uv_val = pu2_src[0];
  223|  11.3M|        for(col = -pad_size; col < 0; col++)
  ------------------
  |  Branch (223:30): [True: 10.7M, False: 668k]
  ------------------
  224|  10.7M|        {
  225|  10.7M|            pu2_src[col] = u2_uv_val;
  226|  10.7M|        }
  227|   668k|        pu2_src += src_strd;
  228|   668k|    }
  229|  1.61k|}
ih264_pad_right_luma:
  261|  1.61k|{
  262|  1.61k|    WORD32 row;
  263|       |
  264|  1.33M|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (264:18): [True: 1.33M, False: 1.61k]
  ------------------
  265|  1.33M|    {
  266|  1.33M|        memset(pu1_src, *(pu1_src -1), pad_size);
  267|  1.33M|        pu1_src += src_strd;
  268|  1.33M|    }
  269|  1.61k|}
ih264_pad_right_chroma:
  301|  1.61k|{
  302|  1.61k|    WORD32 row, col;
  303|  1.61k|    UWORD16 u2_uv_val;
  304|  1.61k|    UWORD16 *pu2_src = (UWORD16 *)pu1_src;
  305|       |
  306|  1.61k|    src_strd >>= 1;
  307|  1.61k|    pad_size >>= 1;
  308|       |
  309|   670k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (309:18): [True: 668k, False: 1.61k]
  ------------------
  310|   668k|    {
  311|   668k|        u2_uv_val = pu2_src[-1];
  312|  11.3M|        for(col = 0; col < pad_size; col++)
  ------------------
  |  Branch (312:22): [True: 10.7M, False: 668k]
  ------------------
  313|  10.7M|        {
  314|  10.7M|            pu2_src[col] = u2_uv_val;
  315|  10.7M|        }
  316|   668k|        pu2_src += src_strd;
  317|   668k|    }
  318|  1.61k|}

ih264_default_weighted_pred_luma:
  110|  4.39k|{
  111|  4.39k|    WORD32 i, j;
  112|       |
  113|  4.39k|    src_strd1 -= wd;
  114|  4.39k|    src_strd2 -= wd;
  115|  4.39k|    dst_strd -= wd;
  116|       |
  117|  58.0k|    for(i = 0; i < ht; i++)
  ------------------
  |  Branch (117:16): [True: 53.6k, False: 4.39k]
  ------------------
  118|  53.6k|    {
  119|   728k|        for(j = 0; j < wd; j++, pu1_src1++, pu1_src2++, pu1_dst++)
  ------------------
  |  Branch (119:20): [True: 675k, False: 53.6k]
  ------------------
  120|   675k|            *pu1_dst = (*pu1_src1 + *pu1_src2 + 1) >> 1;
  121|       |
  122|  53.6k|        pu1_src1 += src_strd1;
  123|  53.6k|        pu1_src2 += src_strd2;
  124|  53.6k|        pu1_dst += dst_strd;
  125|  53.6k|    }
  126|  4.39k|}
ih264_default_weighted_pred_chroma:
  178|  4.39k|{
  179|  4.39k|    WORD32 i, j;
  180|       |
  181|  4.39k|    wd = wd << 1;
  182|       |
  183|  4.39k|    src_strd1 -= wd;
  184|  4.39k|    src_strd2 -= wd;
  185|  4.39k|    dst_strd -= wd;
  186|       |
  187|  31.2k|    for(i = 0; i < ht; i++)
  ------------------
  |  Branch (187:16): [True: 26.8k, False: 4.39k]
  ------------------
  188|  26.8k|    {
  189|   364k|        for(j = 0; j < wd; j++, pu1_src1++, pu1_src2++, pu1_dst++)
  ------------------
  |  Branch (189:20): [True: 337k, False: 26.8k]
  ------------------
  190|   337k|            *pu1_dst = (*pu1_src1 + *pu1_src2 + 1) >> 1;
  191|       |
  192|  26.8k|        pu1_src1 += src_strd1;
  193|  26.8k|        pu1_src2 += src_strd2;
  194|  26.8k|        pu1_dst += dst_strd;
  195|  26.8k|    }
  196|  4.39k|}
ih264_weighted_pred_luma:
  252|  50.0k|{
  253|  50.0k|    WORD32 i, j;
  254|       |
  255|  50.0k|    wt = (WORD16)(wt & 0xffff);
  256|  50.0k|    ofst = (WORD8)(ofst & 0xff);
  257|       |
  258|  50.0k|    src_strd -= wd;
  259|  50.0k|    dst_strd -= wd;
  260|       |
  261|  50.0k|    if(log_wd >= 1)
  ------------------
  |  Branch (261:8): [True: 24.7k, False: 25.2k]
  ------------------
  262|  24.7k|    {
  263|  24.7k|        WORD32 i_ofst = (1 << (log_wd - 1)) + (ofst << log_wd);
  264|   251k|        for(i = 0; i < ht; i++)
  ------------------
  |  Branch (264:20): [True: 226k, False: 24.7k]
  ------------------
  265|   226k|        {
  266|  2.80M|            for(j = 0; j < wd; j++, pu1_src++, pu1_dst++)
  ------------------
  |  Branch (266:24): [True: 2.57M, False: 226k]
  ------------------
  267|  2.57M|                *pu1_dst = CLIP_U8((wt * (*pu1_src) + i_ofst) >> log_wd);
  ------------------
  |  |   58|  2.57M|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  2.57M|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 857k, False: 1.72M]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.72M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  268|       |
  269|   226k|            pu1_src += src_strd;
  270|   226k|            pu1_dst += dst_strd;
  271|   226k|        }
  272|  24.7k|    }
  273|  25.2k|    else
  274|  25.2k|    {
  275|   354k|        for(i = 0; i < ht; i++)
  ------------------
  |  Branch (275:20): [True: 329k, False: 25.2k]
  ------------------
  276|   329k|        {
  277|  5.00M|            for(j = 0; j < wd; j++, pu1_src++, pu1_dst++)
  ------------------
  |  Branch (277:24): [True: 4.67M, False: 329k]
  ------------------
  278|  4.67M|                *pu1_dst = CLIP_U8(wt * (*pu1_src) + ofst);
  ------------------
  |  |   58|  4.67M|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  4.67M|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 4.06M, False: 614k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 614k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  279|       |
  280|   329k|            pu1_src += src_strd;
  281|   329k|            pu1_dst += dst_strd;
  282|   329k|        }
  283|  25.2k|    }
  284|  50.0k|}
ih264_weighted_pred_chroma:
  340|  50.0k|{
  341|  50.0k|    WORD32 i, j;
  342|  50.0k|    WORD32 wt_u, wt_v;
  343|  50.0k|    WORD32 ofst_u, ofst_v;
  344|       |
  345|  50.0k|    wt_u = (WORD16)(wt & 0xffff);
  346|  50.0k|    wt_v = (WORD16)(wt >> 16);
  347|       |
  348|  50.0k|    ofst_u = (WORD8)(ofst & 0xff);
  349|  50.0k|    ofst_v = (WORD8)(ofst >> 8);
  350|       |
  351|  50.0k|    src_strd -= wd << 1;
  352|  50.0k|    dst_strd -= wd << 1;
  353|       |
  354|  50.0k|    if(log_wd >= 1)
  ------------------
  |  Branch (354:8): [True: 966, False: 49.0k]
  ------------------
  355|    966|    {
  356|    966|        ofst_u = (1 << (log_wd - 1)) + (ofst_u << log_wd);
  357|    966|        ofst_v = (1 << (log_wd - 1)) + (ofst_v << log_wd);
  358|       |
  359|  8.11k|        for(i = 0; i < ht; i++)
  ------------------
  |  Branch (359:20): [True: 7.15k, False: 966]
  ------------------
  360|  7.15k|        {
  361|  62.7k|            for(j = 0; j < wd; j++, pu1_src++, pu1_dst++)
  ------------------
  |  Branch (361:24): [True: 55.5k, False: 7.15k]
  ------------------
  362|  55.5k|            {
  363|  55.5k|                *pu1_dst = CLIP_U8((wt_u * (*pu1_src) + ofst_u) >> log_wd);
  ------------------
  |  |   58|  55.5k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  55.5k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 55.5k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 55.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  364|  55.5k|                pu1_src++;
  365|  55.5k|                pu1_dst++;
  366|  55.5k|                *pu1_dst = CLIP_U8((wt_v * (*pu1_src) + ofst_v) >> log_wd);
  ------------------
  |  |   58|  55.5k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  55.5k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 55.5k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 55.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  367|  55.5k|            }
  368|  7.15k|            pu1_src += src_strd;
  369|  7.15k|            pu1_dst += dst_strd;
  370|  7.15k|        }
  371|    966|    }
  372|  49.0k|    else
  373|  49.0k|    {
  374|   319k|        for(i = 0; i < ht; i++)
  ------------------
  |  Branch (374:20): [True: 270k, False: 49.0k]
  ------------------
  375|   270k|        {
  376|  2.02M|            for(j = 0; j < wd; j++, pu1_src++, pu1_dst++)
  ------------------
  |  Branch (376:24): [True: 1.75M, False: 270k]
  ------------------
  377|  1.75M|            {
  378|  1.75M|                *pu1_dst = CLIP_U8(wt_u * (*pu1_src) + ofst_u);
  ------------------
  |  |   58|  1.75M|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.75M|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 1.75M]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.75M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  379|  1.75M|                pu1_src++;
  380|  1.75M|                pu1_dst++;
  381|  1.75M|                *pu1_dst = CLIP_U8(wt_v * (*pu1_src) + ofst_v);
  ------------------
  |  |   58|  1.75M|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.75M|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 1.75M]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.75M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  382|  1.75M|            }
  383|   270k|            pu1_src += src_strd;
  384|   270k|            pu1_dst += dst_strd;
  385|   270k|        }
  386|  49.0k|    }
  387|  50.0k|}
ih264_weighted_bi_pred_luma:
  460|    188|{
  461|    188|    WORD32 i, j;
  462|    188|    WORD32 shft, ofst;
  463|       |
  464|    188|    ofst1 = (WORD8)(ofst1 & 0xff);
  465|    188|    ofst2 = (WORD8)(ofst2 & 0xff);
  466|    188|    wt1 = (WORD16)(wt1 & 0xffff);
  467|    188|    wt2 = (WORD16)(wt2 & 0xffff);
  468|    188|    ofst = (ofst1 + ofst2 + 1) >> 1;
  469|       |
  470|    188|    shft = log_wd + 1;
  471|    188|    ofst = (1 << log_wd) + (ofst << shft);
  472|       |
  473|    188|    src_strd1 -= wd;
  474|    188|    src_strd2 -= wd;
  475|    188|    dst_strd -= wd;
  476|       |
  477|  3.14k|    for(i = 0; i < ht; i++)
  ------------------
  |  Branch (477:16): [True: 2.95k, False: 188]
  ------------------
  478|  2.95k|    {
  479|  49.9k|        for(j = 0; j < wd; j++, pu1_src1++, pu1_src2++, pu1_dst++)
  ------------------
  |  Branch (479:20): [True: 46.9k, False: 2.95k]
  ------------------
  480|  46.9k|            *pu1_dst = CLIP_U8((wt1 * (*pu1_src1) + wt2 * (*pu1_src2) + ofst) >> shft);
  ------------------
  |  |   58|  46.9k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  46.9k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 46.9k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 46.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  481|       |
  482|  2.95k|        pu1_src1 += src_strd1;
  483|  2.95k|        pu1_src2 += src_strd2;
  484|  2.95k|        pu1_dst += dst_strd;
  485|  2.95k|    }
  486|    188|}
ih264_weighted_bi_pred_chroma:
  559|    188|{
  560|    188|    WORD32 i, j;
  561|    188|    WORD32 wt1_u, wt1_v, wt2_u, wt2_v;
  562|    188|    WORD32 ofst1_u, ofst1_v, ofst2_u, ofst2_v;
  563|    188|    WORD32 ofst_u, ofst_v;
  564|    188|    WORD32 shft;
  565|       |
  566|    188|    ofst1_u = (WORD8)(ofst1 & 0xff);
  567|    188|    ofst1_v = (WORD8)(ofst1 >> 8);
  568|    188|    ofst2_u = (WORD8)(ofst2 & 0xff);
  569|    188|    ofst2_v = (WORD8)(ofst2 >> 8);
  570|    188|    wt1_u = (WORD16)(wt1 & 0xffff);
  571|    188|    wt1_v = (WORD16)(wt1 >> 16);
  572|    188|    wt2_u = (WORD16)(wt2 & 0xffff);
  573|    188|    wt2_v = (WORD16)(wt2 >> 16);
  574|    188|    ofst_u = (ofst1_u + ofst2_u + 1) >> 1;
  575|    188|    ofst_v = (ofst1_v + ofst2_v + 1) >> 1;
  576|       |
  577|    188|    src_strd1 -= wd << 1;
  578|    188|    src_strd2 -= wd << 1;
  579|    188|    dst_strd -= wd << 1;
  580|       |
  581|    188|    shft = log_wd + 1;
  582|    188|    ofst_u = (1 << log_wd) + (ofst_u << shft);
  583|    188|    ofst_v = (1 << log_wd) + (ofst_v << shft);
  584|       |
  585|  1.66k|    for(i = 0; i < ht; i++)
  ------------------
  |  Branch (585:16): [True: 1.47k, False: 188]
  ------------------
  586|  1.47k|    {
  587|  13.2k|        for(j = 0; j < wd; j++, pu1_src1++, pu1_src2++, pu1_dst++)
  ------------------
  |  Branch (587:20): [True: 11.7k, False: 1.47k]
  ------------------
  588|  11.7k|        {
  589|  11.7k|            *pu1_dst = CLIP_U8((wt1_u * (*pu1_src1) + wt2_u * (*pu1_src2) + ofst_u) >> shft);
  ------------------
  |  |   58|  11.7k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  11.7k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 11.7k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 11.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  590|  11.7k|            pu1_src1++;
  591|  11.7k|            pu1_src2++;
  592|  11.7k|            pu1_dst++;
  593|  11.7k|            *pu1_dst = CLIP_U8((wt1_v * (*pu1_src1) + wt2_v * (*pu1_src2) + ofst_v) >> shft);
  ------------------
  |  |   58|  11.7k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  11.7k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 11.7k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 11.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  594|  11.7k|        }
  595|  1.47k|        pu1_src1 += src_strd1;
  596|  1.47k|        pu1_src2 += src_strd2;
  597|  1.47k|        pu1_dst += dst_strd;
  598|  1.47k|    }
  599|    188|}

ithread_get_handle_size:
   67|    924|{
   68|    924|    return sizeof(pthread_t);
   69|    924|}
ithread_get_mutex_lock_size:
   72|  5.01k|{
   73|  5.01k|    return sizeof(pthread_mutex_t);
   74|  5.01k|}
ithread_create:
   78|    846|{
   79|    846|    UNUSED(attribute);
  ------------------
  |  |   47|    846|#define UNUSED(x) ((void)(x))
  ------------------
   80|       |    return pthread_create((pthread_t *)thread_handle, NULL,(void *(*)(void *)) strt, argument);
   81|    846|}
ithread_join:
   84|    846|{
   85|    846|    pthread_t *pthread_handle   = (pthread_t *)thread_handle;
   86|    846|    UNUSED(val_ptr);
  ------------------
  |  |   47|    846|#define UNUSED(x) ((void)(x))
  ------------------
   87|       |    return pthread_join(*pthread_handle, NULL);
   88|    846|}
ithread_mutex_init:
   95|    320|{
   96|       |    return pthread_mutex_init((pthread_mutex_t *) mutex, NULL);
   97|    320|}
ithread_mutex_destroy:
  100|    310|{
  101|    310|    return pthread_mutex_destroy((pthread_mutex_t *) mutex);
  102|    310|}
ithread_mutex_lock:
  105|  34.7k|{
  106|  34.7k|    return pthread_mutex_lock((pthread_mutex_t *)mutex);
  107|  34.7k|}
ithread_mutex_unlock:
  110|  34.7k|{
  111|  34.7k|    return pthread_mutex_unlock((pthread_mutex_t *)mutex);
  112|  34.7k|}
ithread_yield:
  115|  4.17k|{
  116|  4.17k|    sched_yield();
  117|  4.17k|}
ithread_set_name:
  163|  21.3k|{
  164|       |
  165|  21.3k|#ifndef WIN32
  166|  21.3k|#ifndef QNX
  167|  21.3k|#ifndef IOS
  168|  21.3k|    UNUSED(pc_thread_name);
  ------------------
  |  |   47|  21.3k|#define UNUSED(x) ((void)(x))
  ------------------
  169|       |//prctl(PR_SET_NAME, (unsigned long)pu1_thread_name, 0, 0, 0);
  170|  21.3k|#endif
  171|  21.3k|#endif
  172|  21.3k|#endif
  173|       |
  174|  21.3k|}

ih264_intra_pred_chroma_8x8_mode_horz_ssse3:
  101|    335|{
  102|       |
  103|    335|    UWORD8 *pu1_left; /* Pointer to start of top predictors */
  104|    335|    WORD32 dst_strd2;
  105|       |
  106|    335|    __m128i row1_16x8b, row2_16x8b;
  107|       |
  108|    335|    UNUSED(src_strd);
  ------------------
  |  |   45|    335|#define UNUSED(x) ((void)(x))
  ------------------
  109|    335|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    335|#define UNUSED(x) ((void)(x))
  ------------------
  110|       |
  111|    335|    pu1_left = pu1_src + 2 * BLK8x8SIZE - 2;
  ------------------
  |  |  510|    335|#define BLK8x8SIZE          8
  ------------------
  112|       |
  113|       |
  114|    335|    dst_strd2 = dst_strd << 1;
  115|    335|    row1_16x8b = _mm_set1_epi16(*((WORD16 *)(pu1_left)));
  116|    335|    row2_16x8b = _mm_set1_epi16(*((WORD16 *)(pu1_left - 2)));
  117|    335|    _mm_storeu_si128((__m128i *)pu1_dst, row1_16x8b);
  118|    335|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), row2_16x8b);
  119|       |
  120|    335|    pu1_dst += dst_strd2;
  121|    335|    row1_16x8b = _mm_set1_epi16(*((WORD16 *)(pu1_left - 4)));
  122|    335|    row2_16x8b = _mm_set1_epi16(*((WORD16 *)(pu1_left - 6)));
  123|    335|    _mm_storeu_si128((__m128i *)pu1_dst, row1_16x8b);
  124|    335|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), row2_16x8b);
  125|       |
  126|    335|    pu1_dst += dst_strd2;
  127|    335|    row1_16x8b = _mm_set1_epi16(*((WORD16 *)(pu1_left - 8)));
  128|    335|    row2_16x8b = _mm_set1_epi16(*((WORD16 *)(pu1_left - 10)));
  129|    335|    _mm_storeu_si128((__m128i *)pu1_dst, row1_16x8b);
  130|    335|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), row2_16x8b);
  131|       |
  132|    335|    pu1_dst += dst_strd2;
  133|    335|    row1_16x8b = _mm_set1_epi16(*((WORD16 *)(pu1_left - 12)));
  134|    335|    row2_16x8b = _mm_set1_epi16(*((WORD16 *)(pu1_left - 14)));
  135|    335|    _mm_storeu_si128((__m128i *)pu1_dst, row1_16x8b);
  136|    335|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), row2_16x8b);
  137|    335|}
ih264_intra_pred_chroma_8x8_mode_vert_ssse3:
  177|    910|{
  178|    910|    UWORD8 *pu1_top; /* Pointer to start of top predictors */
  179|    910|    WORD32 dst_strd2;
  180|       |
  181|    910|    __m128i top_16x8b;
  182|       |
  183|    910|    UNUSED(src_strd);
  ------------------
  |  |   45|    910|#define UNUSED(x) ((void)(x))
  ------------------
  184|    910|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    910|#define UNUSED(x) ((void)(x))
  ------------------
  185|       |
  186|    910|    pu1_top = pu1_src + 2 * BLK8x8SIZE + 2;
  ------------------
  |  |  510|    910|#define BLK8x8SIZE          8
  ------------------
  187|       |
  188|    910|    top_16x8b = _mm_loadu_si128((__m128i *)pu1_top);
  189|       |
  190|    910|    dst_strd2 = dst_strd << 1;
  191|    910|    _mm_storeu_si128((__m128i *)pu1_dst, top_16x8b);
  192|    910|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), top_16x8b);
  193|       |
  194|    910|    pu1_dst += dst_strd2;
  195|    910|    _mm_storeu_si128((__m128i *)pu1_dst, top_16x8b);
  196|    910|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), top_16x8b);
  197|       |
  198|    910|    pu1_dst += dst_strd2;
  199|    910|    _mm_storeu_si128((__m128i *)pu1_dst, top_16x8b);
  200|    910|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), top_16x8b);
  201|       |
  202|    910|    pu1_dst += dst_strd2;
  203|    910|    _mm_storeu_si128((__m128i *)pu1_dst, top_16x8b);
  204|    910|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), top_16x8b);
  205|    910|}
ih264_intra_pred_chroma_8x8_mode_plane_ssse3:
  245|    111|{
  246|    111|    UWORD8 *pu1_left, *pu1_top;
  247|    111|    WORD32 a_u, a_v, b_u, b_v, c_u, c_v;
  248|       |
  249|    111|    __m128i mul_8x16b, shuffle_8x16b;
  250|       |
  251|    111|    UNUSED(src_strd);
  ------------------
  |  |   45|    111|#define UNUSED(x) ((void)(x))
  ------------------
  252|    111|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    111|#define UNUSED(x) ((void)(x))
  ------------------
  253|       |
  254|    111|    pu1_top = pu1_src + MB_SIZE + 2;
  ------------------
  |  |  509|    111|#define MB_SIZE             16
  ------------------
  255|    111|    pu1_left = pu1_src + MB_SIZE - 2;
  ------------------
  |  |  509|    111|#define MB_SIZE             16
  ------------------
  256|       |
  257|    111|    mul_8x16b = _mm_setr_epi16(1, 2, 3, 4, 1, 2, 3, 4);
  258|    111|    shuffle_8x16b = _mm_setr_epi16(0xff00, 0xff02, 0xff04, 0xff06,
  259|    111|                                   0xff01, 0xff03, 0xff05, 0xff07);
  260|       |
  261|       |    //calculating a, b and c
  262|    111|    {
  263|    111|        WORD32 h_u, h_v, v_u, v_v;
  264|       |
  265|    111|        __m128i h_val1_16x8b, h_val2_16x8b;
  266|    111|        __m128i h_val1_8x16b, h_val2_8x16b, h_val_4x32b;
  267|    111|        __m128i v_val1_16x8b, v_val2_16x8b;
  268|    111|        __m128i v_val1_8x16b, v_val2_8x16b, v_val_4x32b;
  269|    111|        __m128i hv_val_4x32b;
  270|       |
  271|    111|        h_val1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_top + 8));
  272|    111|        h_val2_16x8b = _mm_loadl_epi64((__m128i *)(pu1_top - 2));
  273|    111|        v_val1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_left - 14));
  274|    111|        v_val2_16x8b = _mm_loadl_epi64((__m128i *)(pu1_left - 4));
  275|       |
  276|       |        // reversing the order
  277|    111|        h_val2_16x8b = _mm_shufflelo_epi16(h_val2_16x8b, 0x1b);
  278|    111|        v_val1_16x8b = _mm_shufflelo_epi16(v_val1_16x8b, 0x1b);
  279|       |
  280|       |        // separating u and v and 8-bit to 16-bit conversion
  281|    111|        h_val1_8x16b = _mm_shuffle_epi8(h_val1_16x8b, shuffle_8x16b);
  282|    111|        h_val2_8x16b = _mm_shuffle_epi8(h_val2_16x8b, shuffle_8x16b);
  283|    111|        v_val1_8x16b = _mm_shuffle_epi8(v_val1_16x8b, shuffle_8x16b);
  284|    111|        v_val2_8x16b = _mm_shuffle_epi8(v_val2_16x8b, shuffle_8x16b);
  285|       |
  286|    111|        h_val1_8x16b = _mm_sub_epi16(h_val1_8x16b, h_val2_8x16b);
  287|    111|        v_val1_8x16b = _mm_sub_epi16(v_val1_8x16b, v_val2_8x16b);
  288|       |
  289|    111|        h_val_4x32b = _mm_madd_epi16(mul_8x16b, h_val1_8x16b);
  290|    111|        v_val_4x32b = _mm_madd_epi16(mul_8x16b, v_val1_8x16b);
  291|       |
  292|    111|        hv_val_4x32b = _mm_hadd_epi32(h_val_4x32b, v_val_4x32b);
  293|       |
  294|    111|        a_u = (pu1_left[7 * (-2)] + pu1_top[14]) << 4;
  295|    111|        a_v = (pu1_left[7 * (-2) + 1] + pu1_top[15]) << 4;
  296|       |
  297|    111|        h_u = _mm_extract_epi16(hv_val_4x32b, 0);
  298|    111|        h_v = _mm_extract_epi16(hv_val_4x32b, 2);
  299|    111|        v_u = _mm_extract_epi16(hv_val_4x32b, 4);
  300|    111|        v_v = _mm_extract_epi16(hv_val_4x32b, 6);
  301|       |
  302|    111|        h_u = (h_u << 16) >> 15; // sign-extension and multiplication by 2
  303|    111|        h_v = (h_v << 16) >> 15;
  304|    111|        v_u = (v_u << 16) >> 15;
  305|    111|        v_v = (v_v << 16) >> 15;
  306|       |
  307|    111|        b_u = ((h_u << 4) + h_u + 32) >> 6;
  308|    111|        b_v = ((h_v << 4) + h_v + 32) >> 6;
  309|    111|        c_u = ((v_u << 4) + v_u + 32) >> 6;
  310|    111|        c_v = ((v_v << 4) + v_v + 32) >> 6;
  311|    111|    }
  312|       |    //using a, b and c to compute the fitted plane values
  313|    111|    {
  314|    111|        __m128i const_8x16b, c2_8x16b;
  315|    111|        __m128i res1_l_8x16b, res1_h_8x16b;
  316|    111|        __m128i res2_l_8x16b, res2_h_8x16b;
  317|    111|        __m128i res1_sh_l_8x16b, res1_sh_h_8x16b, res1_16x8b;
  318|    111|        __m128i res2_sh_l_8x16b, res2_sh_h_8x16b, res2_16x8b;
  319|       |
  320|    111|        WORD32 b_u2, b_v2, b_u3, b_v3;
  321|    111|        WORD32 const_u, const_v;
  322|    111|        WORD32 dst_strd2;
  323|       |
  324|    111|        const_u = a_u - (c_u << 1) - c_u + 16;
  325|    111|        const_v = a_v - (c_v << 1) - c_v + 16;
  326|       |
  327|    111|        b_u2 = b_u << 1;
  328|    111|        b_v2 = b_v << 1;
  329|    111|        b_u3 = b_u + b_u2;
  330|    111|        b_v3 = b_v + b_v2;
  331|       |
  332|    111|        const_8x16b = _mm_setr_epi16(const_u, const_v, const_u, const_v, const_u, const_v, const_u, const_v);
  333|    111|        res1_l_8x16b = _mm_setr_epi16(-b_u3, -b_v3, -b_u2, -b_v2, -b_u, -b_v, 0, 0);
  334|       |        //contains {-b*3, -b*2, -b*1, b*0}
  335|    111|        res1_h_8x16b = _mm_setr_epi16(b_u, b_v, b_u2, b_v2, b_u3, b_v3, b_u << 2, b_v << 2);
  336|       |        //contains {b*1, b*2, b*3, b*4}
  337|    111|        c2_8x16b = _mm_setr_epi16(c_u, c_v, c_u, c_v, c_u, c_v, c_u, c_v);
  338|       |
  339|       |        // rows 1, 2
  340|    111|        res1_l_8x16b = _mm_add_epi16(res1_l_8x16b, const_8x16b);
  341|    111|        res1_h_8x16b = _mm_add_epi16(res1_h_8x16b, const_8x16b);
  342|    111|        res2_l_8x16b = _mm_add_epi16(res1_l_8x16b, c2_8x16b);
  343|    111|        res2_h_8x16b = _mm_add_epi16(res1_h_8x16b, c2_8x16b);
  344|       |
  345|    111|        res1_sh_l_8x16b = _mm_srai_epi16(res1_l_8x16b, 5);
  346|    111|        res1_sh_h_8x16b = _mm_srai_epi16(res1_h_8x16b, 5);
  347|    111|        res2_sh_l_8x16b = _mm_srai_epi16(res2_l_8x16b, 5);
  348|    111|        res2_sh_h_8x16b = _mm_srai_epi16(res2_h_8x16b, 5);
  349|       |
  350|    111|        dst_strd2 = dst_strd << 1;
  351|    111|        c2_8x16b = _mm_slli_epi16(c2_8x16b, 1);
  352|       |
  353|    111|        res1_16x8b = _mm_packus_epi16(res1_sh_l_8x16b, res1_sh_h_8x16b);
  354|    111|        res2_16x8b = _mm_packus_epi16(res2_sh_l_8x16b, res2_sh_h_8x16b);
  355|       |
  356|    111|        _mm_storeu_si128((__m128i *)pu1_dst, res1_16x8b);
  357|    111|        _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), res2_16x8b);
  358|       |
  359|       |        // rows 3, 4
  360|    111|        res1_l_8x16b = _mm_add_epi16(res1_l_8x16b, c2_8x16b);
  361|    111|        res1_h_8x16b = _mm_add_epi16(res1_h_8x16b, c2_8x16b);
  362|    111|        res2_l_8x16b = _mm_add_epi16(res2_l_8x16b, c2_8x16b);
  363|    111|        res2_h_8x16b = _mm_add_epi16(res2_h_8x16b, c2_8x16b);
  364|       |
  365|    111|        res1_sh_l_8x16b = _mm_srai_epi16(res1_l_8x16b, 5);
  366|    111|        res1_sh_h_8x16b = _mm_srai_epi16(res1_h_8x16b, 5);
  367|    111|        res2_sh_l_8x16b = _mm_srai_epi16(res2_l_8x16b, 5);
  368|    111|        res2_sh_h_8x16b = _mm_srai_epi16(res2_h_8x16b, 5);
  369|       |
  370|    111|        pu1_dst += dst_strd2;
  371|       |
  372|    111|        res1_16x8b = _mm_packus_epi16(res1_sh_l_8x16b, res1_sh_h_8x16b);
  373|    111|        res2_16x8b = _mm_packus_epi16(res2_sh_l_8x16b, res2_sh_h_8x16b);
  374|       |
  375|    111|        _mm_storeu_si128((__m128i *)pu1_dst, res1_16x8b);
  376|    111|        _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), res2_16x8b);
  377|       |
  378|       |        // rows 5, 6
  379|    111|        res1_l_8x16b = _mm_add_epi16(res1_l_8x16b, c2_8x16b);
  380|    111|        res1_h_8x16b = _mm_add_epi16(res1_h_8x16b, c2_8x16b);
  381|    111|        res2_l_8x16b = _mm_add_epi16(res2_l_8x16b, c2_8x16b);
  382|    111|        res2_h_8x16b = _mm_add_epi16(res2_h_8x16b, c2_8x16b);
  383|       |
  384|    111|        res1_sh_l_8x16b = _mm_srai_epi16(res1_l_8x16b, 5);
  385|    111|        res1_sh_h_8x16b = _mm_srai_epi16(res1_h_8x16b, 5);
  386|    111|        res2_sh_l_8x16b = _mm_srai_epi16(res2_l_8x16b, 5);
  387|    111|        res2_sh_h_8x16b = _mm_srai_epi16(res2_h_8x16b, 5);
  388|       |
  389|    111|        pu1_dst += dst_strd2;
  390|       |
  391|    111|        res1_16x8b = _mm_packus_epi16(res1_sh_l_8x16b, res1_sh_h_8x16b);
  392|    111|        res2_16x8b = _mm_packus_epi16(res2_sh_l_8x16b, res2_sh_h_8x16b);
  393|       |
  394|    111|        _mm_storeu_si128((__m128i *)pu1_dst, res1_16x8b);
  395|    111|        _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), res2_16x8b);
  396|       |
  397|       |        // rows 7, 8
  398|    111|        res1_l_8x16b = _mm_add_epi16(res1_l_8x16b, c2_8x16b);
  399|    111|        res1_h_8x16b = _mm_add_epi16(res1_h_8x16b, c2_8x16b);
  400|    111|        res2_l_8x16b = _mm_add_epi16(res2_l_8x16b, c2_8x16b);
  401|    111|        res2_h_8x16b = _mm_add_epi16(res2_h_8x16b, c2_8x16b);
  402|       |
  403|    111|        res1_sh_l_8x16b = _mm_srai_epi16(res1_l_8x16b, 5);
  404|    111|        res1_sh_h_8x16b = _mm_srai_epi16(res1_h_8x16b, 5);
  405|    111|        res2_sh_l_8x16b = _mm_srai_epi16(res2_l_8x16b, 5);
  406|    111|        res2_sh_h_8x16b = _mm_srai_epi16(res2_h_8x16b, 5);
  407|       |
  408|    111|        pu1_dst += dst_strd2;
  409|       |
  410|    111|        res1_16x8b = _mm_packus_epi16(res1_sh_l_8x16b, res1_sh_h_8x16b);
  411|    111|        res2_16x8b = _mm_packus_epi16(res2_sh_l_8x16b, res2_sh_h_8x16b);
  412|       |
  413|    111|        _mm_storeu_si128((__m128i *)pu1_dst, res1_16x8b);
  414|    111|        _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), res2_16x8b);
  415|       |
  416|    111|    }
  417|    111|}

ih264_deblk_chroma_vert_bs4_ssse3:
  100|  3.88k|{
  101|  3.88k|    UWORD8 *pu1_src_uv = pu1_src; /* Pointer to the src sample q0 of plane U*/
  102|  3.88k|    WORD32 alpha_cbcr = (alpha_cr << 16) + alpha_cb;
  103|  3.88k|    WORD32 beta_cbcr = (beta_cr << 16) + beta_cb;
  104|  3.88k|    __m128i linea, lineb, linec, lined, linee, linef, lineg, lineh;
  105|  3.88k|    __m128i temp1, temp2, temp3, temp4;
  106|       |
  107|  3.88k|    __m128i q0_uv_16x8, p0_uv_16x8, q1_uv_16x8, p1_uv_16x8;
  108|  3.88k|    __m128i q0_uv_8x16, p0_uv_8x16, q1_uv_8x16, p1_uv_8x16;
  109|  3.88k|    __m128i flag1, flag2;
  110|  3.88k|    __m128i diff, alpha_cbcr_16x8, beta_cbcr_16x8;
  111|  3.88k|    __m128i zero = _mm_setzero_si128();
  112|  3.88k|    __m128i p0_uv_8x16_1, p0_uv_8x16_2, q0_uv_8x16_1, q0_uv_8x16_2;
  113|       |
  114|       |    /* Load and transpose the pixel values */
  115|  3.88k|    linea = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4));
  116|  3.88k|    lineb = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4 + src_strd));
  117|  3.88k|    linec = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4 + 2 * src_strd));
  118|  3.88k|    lined = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4 + 3 * src_strd));
  119|  3.88k|    linee = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4 + 4 * src_strd));
  120|  3.88k|    linef = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4 + 5 * src_strd));
  121|  3.88k|    lineg = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4 + 6 * src_strd));
  122|  3.88k|    lineh = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4 + 7 * src_strd));
  123|       |
  124|  3.88k|    temp1 = _mm_unpacklo_epi16(linea, lineb);
  125|  3.88k|    temp2 = _mm_unpacklo_epi16(linec, lined);
  126|  3.88k|    temp3 = _mm_unpacklo_epi16(linee, linef);
  127|  3.88k|    temp4 = _mm_unpacklo_epi16(lineg, lineh);
  128|       |
  129|  3.88k|    p1_uv_8x16 = _mm_unpacklo_epi32(temp1, temp2);
  130|  3.88k|    p0_uv_8x16 = _mm_unpacklo_epi32(temp3, temp4);
  131|  3.88k|    q0_uv_8x16 = _mm_unpackhi_epi32(temp1, temp2);
  132|  3.88k|    q1_uv_8x16 = _mm_unpackhi_epi32(temp3, temp4);
  133|       |
  134|  3.88k|    p1_uv_16x8 = _mm_unpacklo_epi64(p1_uv_8x16, p0_uv_8x16);
  135|  3.88k|    p0_uv_16x8 = _mm_unpackhi_epi64(p1_uv_8x16, p0_uv_8x16);
  136|  3.88k|    q0_uv_16x8 = _mm_unpacklo_epi64(q0_uv_8x16, q1_uv_8x16);
  137|  3.88k|    q1_uv_16x8 = _mm_unpackhi_epi64(q0_uv_8x16, q1_uv_8x16);
  138|       |    /* End of transpose */
  139|       |
  140|  3.88k|    q0_uv_8x16 = _mm_unpacklo_epi8(q0_uv_16x8, zero);
  141|  3.88k|    q1_uv_8x16 = _mm_unpacklo_epi8(q1_uv_16x8, zero);
  142|  3.88k|    p1_uv_8x16 = _mm_unpacklo_epi8(p1_uv_16x8, zero);
  143|  3.88k|    p0_uv_8x16 = _mm_unpacklo_epi8(p0_uv_16x8, zero);
  144|       |
  145|  3.88k|    diff = _mm_subs_epi16(p0_uv_8x16, q0_uv_8x16); //Condn 1
  146|  3.88k|    diff = _mm_abs_epi16(diff);
  147|  3.88k|    alpha_cbcr_16x8 = _mm_set1_epi32(alpha_cbcr);
  148|  3.88k|    flag1 = _mm_cmpgt_epi16(alpha_cbcr_16x8, diff);
  149|       |
  150|  3.88k|    diff = _mm_subs_epi16(q1_uv_8x16, q0_uv_8x16); //Condtn 2
  151|  3.88k|    diff = _mm_abs_epi16(diff);
  152|  3.88k|    beta_cbcr_16x8 = _mm_set1_epi32(beta_cbcr);
  153|  3.88k|    flag1 = _mm_and_si128(flag1, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  154|       |
  155|  3.88k|    diff = _mm_subs_epi16(p1_uv_8x16, p0_uv_8x16); //Condtn 3
  156|  3.88k|    diff = _mm_abs_epi16(diff);
  157|  3.88k|    flag1 = _mm_and_si128(flag1, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  158|       |
  159|  3.88k|    temp1 = _mm_slli_epi16(p1_uv_8x16, 1);
  160|  3.88k|    temp2 = _mm_add_epi16(p0_uv_8x16, q1_uv_8x16);
  161|  3.88k|    temp1 = _mm_add_epi16(temp1, _mm_set1_epi16(2));
  162|  3.88k|    temp1 = _mm_add_epi16(temp1, temp2);
  163|  3.88k|    p0_uv_8x16_1 = _mm_srai_epi16(temp1, 2);
  164|       |
  165|  3.88k|    temp1 = _mm_slli_epi16(q1_uv_8x16, 1);
  166|  3.88k|    temp2 = _mm_add_epi16(p1_uv_8x16, q0_uv_8x16);
  167|  3.88k|    temp1 = _mm_add_epi16(temp1, _mm_set1_epi16(2));
  168|  3.88k|    temp1 = _mm_add_epi16(temp1, temp2);
  169|  3.88k|    q0_uv_8x16_1 = _mm_srai_epi16(temp1, 2);
  170|       |
  171|  3.88k|    q0_uv_8x16 = _mm_unpackhi_epi8(q0_uv_16x8, zero);
  172|  3.88k|    q1_uv_8x16 = _mm_unpackhi_epi8(q1_uv_16x8, zero);
  173|  3.88k|    p1_uv_8x16 = _mm_unpackhi_epi8(p1_uv_16x8, zero);
  174|  3.88k|    p0_uv_8x16 = _mm_unpackhi_epi8(p0_uv_16x8, zero);
  175|       |
  176|  3.88k|    diff = _mm_subs_epi16(p0_uv_8x16, q0_uv_8x16); //Condn 1
  177|  3.88k|    diff = _mm_abs_epi16(diff);
  178|  3.88k|    alpha_cbcr_16x8 = _mm_set1_epi32(alpha_cbcr);
  179|  3.88k|    flag2 = _mm_cmpgt_epi16(alpha_cbcr_16x8, diff);
  180|       |
  181|  3.88k|    diff = _mm_subs_epi16(q1_uv_8x16, q0_uv_8x16); //Condtn 2
  182|  3.88k|    diff = _mm_abs_epi16(diff);
  183|  3.88k|    beta_cbcr_16x8 = _mm_set1_epi32(beta_cbcr);
  184|  3.88k|    flag2 = _mm_and_si128(flag2, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  185|       |
  186|  3.88k|    diff = _mm_subs_epi16(p1_uv_8x16, p0_uv_8x16); //Condtn 3
  187|  3.88k|    diff = _mm_abs_epi16(diff);
  188|  3.88k|    flag2 = _mm_and_si128(flag2, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  189|       |
  190|  3.88k|    temp1 = _mm_slli_epi16(p1_uv_8x16, 1);
  191|  3.88k|    temp2 = _mm_add_epi16(p0_uv_8x16, q1_uv_8x16);
  192|  3.88k|    temp1 = _mm_add_epi16(temp1, _mm_set1_epi16(2));
  193|  3.88k|    temp1 = _mm_add_epi16(temp1, temp2);
  194|  3.88k|    p0_uv_8x16_2 = _mm_srai_epi16(temp1, 2);
  195|       |
  196|  3.88k|    temp1 = _mm_slli_epi16(q1_uv_8x16, 1);
  197|  3.88k|    temp2 = _mm_add_epi16(p1_uv_8x16, q0_uv_8x16);
  198|  3.88k|    temp1 = _mm_add_epi16(temp1, _mm_set1_epi16(2));
  199|  3.88k|    temp1 = _mm_add_epi16(temp1, temp2);
  200|  3.88k|    q0_uv_8x16_2 = _mm_srai_epi16(temp1, 2);
  201|       |
  202|  3.88k|    p0_uv_8x16_2 = _mm_packus_epi16(p0_uv_8x16_1, p0_uv_8x16_2);
  203|  3.88k|    q0_uv_8x16_2 = _mm_packus_epi16(q0_uv_8x16_1, q0_uv_8x16_2);
  204|       |
  205|  3.88k|    flag1 = _mm_packs_epi16(flag1, flag2);
  206|       |
  207|  3.88k|    p0_uv_8x16_1 = _mm_and_si128(p0_uv_16x8,
  208|  3.88k|                                 _mm_xor_si128(flag1, _mm_set1_epi8(0xFF)));
  209|  3.88k|    p0_uv_8x16_2 = _mm_and_si128(p0_uv_8x16_2, flag1);
  210|  3.88k|    p0_uv_16x8 = _mm_add_epi8(p0_uv_8x16_1, p0_uv_8x16_2);
  211|       |
  212|  3.88k|    q0_uv_8x16_1 = _mm_and_si128(q0_uv_16x8,
  213|  3.88k|                                 _mm_xor_si128(flag1, _mm_set1_epi8(0xFF)));
  214|  3.88k|    q0_uv_8x16_2 = _mm_and_si128(q0_uv_8x16_2, flag1);
  215|  3.88k|    q0_uv_16x8 = _mm_add_epi8(q0_uv_8x16_1, q0_uv_8x16_2);
  216|       |
  217|       |    /* Inverse-transpose and store back */
  218|  3.88k|    temp1 = _mm_unpacklo_epi16(p1_uv_16x8, p0_uv_16x8);
  219|  3.88k|    temp2 = _mm_unpackhi_epi16(p1_uv_16x8, p0_uv_16x8);
  220|  3.88k|    temp3 = _mm_unpacklo_epi16(q0_uv_16x8, q1_uv_16x8);
  221|  3.88k|    temp4 = _mm_unpackhi_epi16(q0_uv_16x8, q1_uv_16x8);
  222|       |
  223|  3.88k|    linea = _mm_unpacklo_epi32(temp1, temp3);
  224|  3.88k|    lineb = _mm_srli_si128(linea, 8);
  225|  3.88k|    linec = _mm_unpackhi_epi32(temp1, temp3);
  226|  3.88k|    lined = _mm_srli_si128(linec, 8);
  227|  3.88k|    linee = _mm_unpacklo_epi32(temp2, temp4);
  228|  3.88k|    linef = _mm_srli_si128(linee, 8);
  229|  3.88k|    lineg = _mm_unpackhi_epi32(temp2, temp4);
  230|  3.88k|    lineh = _mm_srli_si128(lineg, 8);
  231|       |
  232|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4), linea);
  233|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4 + src_strd), lineb);
  234|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4 + 2 * src_strd), linec);
  235|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4 + 3 * src_strd), lined);
  236|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4 + 4 * src_strd), linee);
  237|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4 + 5 * src_strd), linef);
  238|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4 + 6 * src_strd), lineg);
  239|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4 + 7 * src_strd), lineh);
  240|       |
  241|  3.88k|}
ih264_deblk_chroma_horz_bs4_ssse3:
  283|  1.64k|{
  284|  1.64k|    UWORD8 *pu1_src_uv = pu1_src; /* Pointer to the src sample q0 of plane U*/
  285|  1.64k|    WORD16 i16_posP1, i16_posP0, i16_posQ1;
  286|       |
  287|  1.64k|    UWORD8 *pu1_HorzPixelUV; /*! < Pointer to the first pixel of the boundary */
  288|  1.64k|    WORD32 alpha_cbcr = (alpha_cr << 16) + alpha_cb;
  289|  1.64k|    WORD32 beta_cbcr = (beta_cr << 16) + beta_cb;
  290|  1.64k|    __m128i q0_uv_16x8, p0_uv_16x8, q1_uv_16x8, p1_uv_16x8;
  291|  1.64k|    __m128i q0_uv_8x16, p0_uv_8x16, q1_uv_8x16, p1_uv_8x16;
  292|  1.64k|    __m128i flag1, flag2;
  293|  1.64k|    __m128i diff, alpha_cbcr_16x8, beta_cbcr_16x8;
  294|  1.64k|    __m128i zero = _mm_setzero_si128();
  295|  1.64k|    __m128i p0_uv_8x16_1, p0_uv_8x16_2, q0_uv_8x16_1, q0_uv_8x16_2;
  296|  1.64k|    __m128i temp1, temp2;
  297|       |
  298|  1.64k|    pu1_HorzPixelUV = pu1_src_uv - (src_strd << 1);
  299|       |
  300|  1.64k|    i16_posQ1 = src_strd;
  301|  1.64k|    i16_posP0 = src_strd;
  302|  1.64k|    i16_posP1 = 0;
  303|       |
  304|  1.64k|    q0_uv_16x8 = _mm_loadu_si128((__m128i *)(pu1_src_uv));
  305|  1.64k|    q1_uv_16x8 = _mm_loadu_si128((__m128i *)(pu1_src_uv + i16_posQ1));
  306|  1.64k|    p1_uv_16x8 = _mm_loadu_si128((__m128i *)(pu1_HorzPixelUV + i16_posP1));
  307|  1.64k|    p0_uv_16x8 = _mm_loadu_si128((__m128i *)(pu1_HorzPixelUV + i16_posP0));
  308|       |
  309|  1.64k|    q0_uv_8x16 = _mm_unpacklo_epi8(q0_uv_16x8, zero);
  310|  1.64k|    q1_uv_8x16 = _mm_unpacklo_epi8(q1_uv_16x8, zero);
  311|  1.64k|    p1_uv_8x16 = _mm_unpacklo_epi8(p1_uv_16x8, zero);
  312|  1.64k|    p0_uv_8x16 = _mm_unpacklo_epi8(p0_uv_16x8, zero);
  313|       |
  314|  1.64k|    diff = _mm_subs_epi16(p0_uv_8x16, q0_uv_8x16); //Condn 1
  315|  1.64k|    diff = _mm_abs_epi16(diff);
  316|  1.64k|    alpha_cbcr_16x8 = _mm_set1_epi32(alpha_cbcr);
  317|  1.64k|    flag1 = _mm_cmpgt_epi16(alpha_cbcr_16x8, diff);
  318|       |
  319|  1.64k|    diff = _mm_subs_epi16(q1_uv_8x16, q0_uv_8x16); //Condtn 2
  320|  1.64k|    diff = _mm_abs_epi16(diff);
  321|  1.64k|    beta_cbcr_16x8 = _mm_set1_epi32(beta_cbcr);
  322|  1.64k|    flag1 = _mm_and_si128(flag1, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  323|       |
  324|  1.64k|    diff = _mm_subs_epi16(p1_uv_8x16, p0_uv_8x16); //Condtn 3
  325|  1.64k|    diff = _mm_abs_epi16(diff);
  326|  1.64k|    flag1 = _mm_and_si128(flag1, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  327|       |
  328|  1.64k|    temp1 = _mm_slli_epi16(p1_uv_8x16, 1);
  329|  1.64k|    temp2 = _mm_add_epi16(p0_uv_8x16, q1_uv_8x16);
  330|  1.64k|    temp1 = _mm_add_epi16(temp1, _mm_set1_epi16(2));
  331|  1.64k|    temp1 = _mm_add_epi16(temp1, temp2);
  332|  1.64k|    p0_uv_8x16_1 = _mm_srai_epi16(temp1, 2);
  333|       |
  334|  1.64k|    temp1 = _mm_slli_epi16(q1_uv_8x16, 1);
  335|  1.64k|    temp2 = _mm_add_epi16(p1_uv_8x16, q0_uv_8x16);
  336|  1.64k|    temp1 = _mm_add_epi16(temp1, _mm_set1_epi16(2));
  337|  1.64k|    temp1 = _mm_add_epi16(temp1, temp2);
  338|  1.64k|    q0_uv_8x16_1 = _mm_srai_epi16(temp1, 2);
  339|       |
  340|  1.64k|    q0_uv_8x16 = _mm_unpackhi_epi8(q0_uv_16x8, zero);
  341|  1.64k|    q1_uv_8x16 = _mm_unpackhi_epi8(q1_uv_16x8, zero);
  342|  1.64k|    p1_uv_8x16 = _mm_unpackhi_epi8(p1_uv_16x8, zero);
  343|  1.64k|    p0_uv_8x16 = _mm_unpackhi_epi8(p0_uv_16x8, zero);
  344|       |
  345|  1.64k|    diff = _mm_subs_epi16(p0_uv_8x16, q0_uv_8x16); //Condn 1
  346|  1.64k|    diff = _mm_abs_epi16(diff);
  347|  1.64k|    alpha_cbcr_16x8 = _mm_set1_epi32(alpha_cbcr);
  348|  1.64k|    flag2 = _mm_cmpgt_epi16(alpha_cbcr_16x8, diff);
  349|       |
  350|  1.64k|    diff = _mm_subs_epi16(q1_uv_8x16, q0_uv_8x16); //Condtn 2
  351|  1.64k|    diff = _mm_abs_epi16(diff);
  352|  1.64k|    beta_cbcr_16x8 = _mm_set1_epi32(beta_cbcr);
  353|  1.64k|    flag2 = _mm_and_si128(flag2, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  354|       |
  355|  1.64k|    diff = _mm_subs_epi16(p1_uv_8x16, p0_uv_8x16); //Condtn 3
  356|  1.64k|    diff = _mm_abs_epi16(diff);
  357|  1.64k|    flag2 = _mm_and_si128(flag2, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  358|       |
  359|  1.64k|    temp1 = _mm_slli_epi16(p1_uv_8x16, 1);
  360|  1.64k|    temp2 = _mm_add_epi16(p0_uv_8x16, q1_uv_8x16);
  361|  1.64k|    temp1 = _mm_add_epi16(temp1, _mm_set1_epi16(2));
  362|  1.64k|    temp1 = _mm_add_epi16(temp1, temp2);
  363|  1.64k|    p0_uv_8x16_2 = _mm_srai_epi16(temp1, 2);
  364|       |
  365|  1.64k|    temp1 = _mm_slli_epi16(q1_uv_8x16, 1);
  366|  1.64k|    temp2 = _mm_add_epi16(p1_uv_8x16, q0_uv_8x16);
  367|  1.64k|    temp1 = _mm_add_epi16(temp1, _mm_set1_epi16(2));
  368|  1.64k|    temp1 = _mm_add_epi16(temp1, temp2);
  369|  1.64k|    q0_uv_8x16_2 = _mm_srai_epi16(temp1, 2);
  370|       |
  371|  1.64k|    p0_uv_8x16_2 = _mm_packus_epi16(p0_uv_8x16_1, p0_uv_8x16_2);
  372|  1.64k|    q0_uv_8x16_2 = _mm_packus_epi16(q0_uv_8x16_1, q0_uv_8x16_2);
  373|       |
  374|  1.64k|    flag1 = _mm_packs_epi16(flag1, flag2);
  375|       |
  376|  1.64k|    p0_uv_8x16_1 = _mm_and_si128(p0_uv_16x8,
  377|  1.64k|                                 _mm_xor_si128(flag1, _mm_set1_epi8(0xFF)));
  378|  1.64k|    p0_uv_8x16_2 = _mm_and_si128(p0_uv_8x16_2, flag1);
  379|  1.64k|    p0_uv_8x16_1 = _mm_add_epi8(p0_uv_8x16_1, p0_uv_8x16_2);
  380|  1.64k|    _mm_storeu_si128((__m128i *)(pu1_HorzPixelUV + i16_posP0), p0_uv_8x16_1);
  381|       |
  382|  1.64k|    q0_uv_8x16_1 = _mm_and_si128(q0_uv_16x8,
  383|  1.64k|                                 _mm_xor_si128(flag1, _mm_set1_epi8(0xFF)));
  384|  1.64k|    q0_uv_8x16_2 = _mm_and_si128(q0_uv_8x16_2, flag1);
  385|  1.64k|    q0_uv_8x16_1 = _mm_add_epi8(q0_uv_8x16_1, q0_uv_8x16_2);
  386|  1.64k|    _mm_storeu_si128((__m128i *)(pu1_src_uv), q0_uv_8x16_1);
  387|       |
  388|  1.64k|}
ih264_deblk_chroma_vert_bslt4_ssse3:
  436|  48.1k|{
  437|  48.1k|    UWORD8 *pu1_src_uv = pu1_src; /* Pointer to the src sample q0 of plane U*/
  438|  48.1k|    UWORD8 u1_Bs0, u1_Bs1, u1_Bs2, u1_Bs3;
  439|  48.1k|    WORD32 alpha_cbcr = (alpha_cr << 16) + alpha_cb;
  440|  48.1k|    WORD32 beta_cbcr = (beta_cr << 16) + beta_cb;
  441|  48.1k|    __m128i linea, lineb, linec, lined, linee, linef, lineg, lineh;
  442|  48.1k|    __m128i temp1, temp2, temp3, temp4;
  443|       |
  444|  48.1k|    __m128i q0_uv_16x8, p0_uv_16x8, q1_uv_16x8, p1_uv_16x8;
  445|  48.1k|    __m128i q0_uv_8x16, p0_uv_8x16, q1_uv_8x16, p1_uv_8x16;
  446|  48.1k|    __m128i flag_bs, flag1, flag2;
  447|  48.1k|    __m128i diff, diff1, alpha_cbcr_16x8, beta_cbcr_16x8, in_macro;
  448|  48.1k|    __m128i zero = _mm_setzero_si128();
  449|  48.1k|    __m128i C0_uv_8x16;
  450|  48.1k|    __m128i p0_uv_8x16_1, p0_uv_8x16_2, q0_uv_8x16_1, q0_uv_8x16_2;
  451|       |
  452|  48.1k|    u1_Bs0 = (u4_bs >> 24) & 0xff;
  453|  48.1k|    u1_Bs1 = (u4_bs >> 16) & 0xff;
  454|  48.1k|    u1_Bs2 = (u4_bs >> 8) & 0xff;
  455|  48.1k|    u1_Bs3 = (u4_bs >> 0) & 0xff;
  456|       |
  457|  48.1k|    flag_bs = _mm_set_epi8(u1_Bs3, u1_Bs3, u1_Bs3, u1_Bs3, u1_Bs2, u1_Bs2,
  458|  48.1k|                           u1_Bs2, u1_Bs2, u1_Bs1, u1_Bs1, u1_Bs1, u1_Bs1,
  459|  48.1k|                           u1_Bs0, u1_Bs0, u1_Bs0, u1_Bs0);
  460|  48.1k|    flag_bs = _mm_cmpeq_epi8(flag_bs, zero); //Set flag to 1s and 0s
  461|  48.1k|    flag_bs = _mm_xor_si128(flag_bs, _mm_set1_epi8(0xFF)); //Invert for required mask
  462|       |
  463|       |    /* Load and transpose the pixel values */
  464|  48.1k|    linea = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4));
  465|  48.1k|    lineb = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4 + src_strd));
  466|  48.1k|    linec = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4 + 2 * src_strd));
  467|  48.1k|    lined = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4 + 3 * src_strd));
  468|  48.1k|    linee = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4 + 4 * src_strd));
  469|  48.1k|    linef = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4 + 5 * src_strd));
  470|  48.1k|    lineg = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4 + 6 * src_strd));
  471|  48.1k|    lineh = _mm_loadl_epi64((__m128i *)(pu1_src_uv - 4 + 7 * src_strd));
  472|       |
  473|  48.1k|    temp1 = _mm_unpacklo_epi16(linea, lineb);
  474|  48.1k|    temp2 = _mm_unpacklo_epi16(linec, lined);
  475|  48.1k|    temp3 = _mm_unpacklo_epi16(linee, linef);
  476|  48.1k|    temp4 = _mm_unpacklo_epi16(lineg, lineh);
  477|       |
  478|  48.1k|    p1_uv_8x16 = _mm_unpacklo_epi32(temp1, temp2);
  479|  48.1k|    p0_uv_8x16 = _mm_unpacklo_epi32(temp3, temp4);
  480|  48.1k|    q0_uv_8x16 = _mm_unpackhi_epi32(temp1, temp2);
  481|  48.1k|    q1_uv_8x16 = _mm_unpackhi_epi32(temp3, temp4);
  482|       |
  483|  48.1k|    p1_uv_16x8 = _mm_unpacklo_epi64(p1_uv_8x16, p0_uv_8x16);
  484|  48.1k|    p0_uv_16x8 = _mm_unpackhi_epi64(p1_uv_8x16, p0_uv_8x16);
  485|  48.1k|    q0_uv_16x8 = _mm_unpacklo_epi64(q0_uv_8x16, q1_uv_8x16);
  486|  48.1k|    q1_uv_16x8 = _mm_unpackhi_epi64(q0_uv_8x16, q1_uv_8x16);
  487|       |    /* End of transpose */
  488|       |
  489|  48.1k|    q0_uv_8x16 = _mm_unpacklo_epi8(q0_uv_16x8, zero);
  490|  48.1k|    q1_uv_8x16 = _mm_unpacklo_epi8(q1_uv_16x8, zero);
  491|  48.1k|    p1_uv_8x16 = _mm_unpacklo_epi8(p1_uv_16x8, zero);
  492|  48.1k|    p0_uv_8x16 = _mm_unpacklo_epi8(p0_uv_16x8, zero);
  493|       |
  494|  48.1k|    diff = _mm_subs_epi16(p0_uv_8x16, q0_uv_8x16); //Condn 1
  495|  48.1k|    diff = _mm_abs_epi16(diff);
  496|  48.1k|    alpha_cbcr_16x8 = _mm_set1_epi32(alpha_cbcr);
  497|  48.1k|    flag1 = _mm_cmpgt_epi16(alpha_cbcr_16x8, diff);
  498|       |
  499|  48.1k|    diff = _mm_subs_epi16(q1_uv_8x16, q0_uv_8x16); //Condtn 2
  500|  48.1k|    diff = _mm_abs_epi16(diff);
  501|  48.1k|    beta_cbcr_16x8 = _mm_set1_epi32(beta_cbcr);
  502|  48.1k|    flag1 = _mm_and_si128(flag1, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  503|       |
  504|  48.1k|    diff = _mm_subs_epi16(p1_uv_8x16, p0_uv_8x16); //Condtn 3
  505|  48.1k|    diff = _mm_abs_epi16(diff);
  506|  48.1k|    flag1 = _mm_and_si128(flag1, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  507|       |
  508|  48.1k|    diff = _mm_subs_epi16(q0_uv_8x16, p0_uv_8x16);
  509|  48.1k|    diff = _mm_slli_epi16(diff, 2);
  510|  48.1k|    diff1 = _mm_subs_epi16(p1_uv_8x16, q1_uv_8x16);
  511|  48.1k|    diff = _mm_add_epi16(diff, diff1);
  512|  48.1k|    diff = _mm_add_epi16(diff, _mm_set1_epi16(4));
  513|  48.1k|    in_macro = _mm_srai_epi16(diff, 3);
  514|       |
  515|  48.1k|    C0_uv_8x16 = _mm_set_epi16(pu1_cliptab_cr[u1_Bs1], pu1_cliptab_cb[u1_Bs1],
  516|  48.1k|                               pu1_cliptab_cr[u1_Bs1], pu1_cliptab_cb[u1_Bs1],
  517|  48.1k|                               pu1_cliptab_cr[u1_Bs0], pu1_cliptab_cb[u1_Bs0],
  518|  48.1k|                               pu1_cliptab_cr[u1_Bs0], pu1_cliptab_cb[u1_Bs0]);
  519|       |
  520|  48.1k|    C0_uv_8x16 = _mm_add_epi16(C0_uv_8x16, _mm_set1_epi16(1));
  521|       |
  522|  48.1k|    in_macro = _mm_min_epi16(C0_uv_8x16, in_macro); //CLIP3
  523|  48.1k|    C0_uv_8x16 = _mm_subs_epi16(zero, C0_uv_8x16);
  524|  48.1k|    in_macro = _mm_max_epi16(C0_uv_8x16, in_macro);
  525|       |
  526|  48.1k|    p0_uv_8x16_1 = _mm_add_epi16(p0_uv_8x16, in_macro);
  527|  48.1k|    q0_uv_8x16_1 = _mm_sub_epi16(q0_uv_8x16, in_macro);
  528|       |
  529|  48.1k|    q0_uv_8x16 = _mm_unpackhi_epi8(q0_uv_16x8, zero);
  530|  48.1k|    q1_uv_8x16 = _mm_unpackhi_epi8(q1_uv_16x8, zero);
  531|  48.1k|    p1_uv_8x16 = _mm_unpackhi_epi8(p1_uv_16x8, zero);
  532|  48.1k|    p0_uv_8x16 = _mm_unpackhi_epi8(p0_uv_16x8, zero);
  533|       |
  534|  48.1k|    diff = _mm_subs_epi16(p0_uv_8x16, q0_uv_8x16); //Condn 1
  535|  48.1k|    diff = _mm_abs_epi16(diff);
  536|  48.1k|    alpha_cbcr_16x8 = _mm_set1_epi32(alpha_cbcr);
  537|  48.1k|    flag2 = _mm_cmpgt_epi16(alpha_cbcr_16x8, diff);
  538|       |
  539|  48.1k|    diff = _mm_subs_epi16(q1_uv_8x16, q0_uv_8x16); //Condtn 2
  540|  48.1k|    diff = _mm_abs_epi16(diff);
  541|  48.1k|    beta_cbcr_16x8 = _mm_set1_epi32(beta_cbcr);
  542|  48.1k|    flag2 = _mm_and_si128(flag2, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  543|       |
  544|  48.1k|    diff = _mm_subs_epi16(p1_uv_8x16, p0_uv_8x16); //Condtn 3
  545|  48.1k|    diff = _mm_abs_epi16(diff);
  546|  48.1k|    flag2 = _mm_and_si128(flag2, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  547|       |
  548|  48.1k|    diff = _mm_subs_epi16(q0_uv_8x16, p0_uv_8x16);
  549|  48.1k|    diff = _mm_slli_epi16(diff, 2);
  550|  48.1k|    diff1 = _mm_subs_epi16(p1_uv_8x16, q1_uv_8x16);
  551|  48.1k|    diff = _mm_add_epi16(diff, diff1);
  552|  48.1k|    diff = _mm_add_epi16(diff, _mm_set1_epi16(4));
  553|  48.1k|    in_macro = _mm_srai_epi16(diff, 3);
  554|       |
  555|  48.1k|    C0_uv_8x16 = _mm_set_epi16(pu1_cliptab_cr[u1_Bs3], pu1_cliptab_cb[u1_Bs3],
  556|  48.1k|                               pu1_cliptab_cr[u1_Bs3], pu1_cliptab_cb[u1_Bs3],
  557|  48.1k|                               pu1_cliptab_cr[u1_Bs2], pu1_cliptab_cb[u1_Bs2],
  558|  48.1k|                               pu1_cliptab_cr[u1_Bs2], pu1_cliptab_cb[u1_Bs2]);
  559|       |
  560|  48.1k|    C0_uv_8x16 = _mm_add_epi16(C0_uv_8x16, _mm_set1_epi16(1));
  561|       |
  562|  48.1k|    in_macro = _mm_min_epi16(C0_uv_8x16, in_macro); //CLIP3
  563|  48.1k|    C0_uv_8x16 = _mm_subs_epi16(zero, C0_uv_8x16);
  564|  48.1k|    in_macro = _mm_max_epi16(C0_uv_8x16, in_macro);
  565|       |
  566|  48.1k|    p0_uv_8x16_2 = _mm_add_epi16(p0_uv_8x16, in_macro);
  567|  48.1k|    q0_uv_8x16_2 = _mm_sub_epi16(q0_uv_8x16, in_macro);
  568|       |
  569|  48.1k|    p0_uv_8x16_2 = _mm_packus_epi16(p0_uv_8x16_1, p0_uv_8x16_2);
  570|  48.1k|    q0_uv_8x16_2 = _mm_packus_epi16(q0_uv_8x16_1, q0_uv_8x16_2);
  571|       |
  572|  48.1k|    flag1 = _mm_packs_epi16(flag1, flag2);
  573|  48.1k|    flag1 = _mm_and_si128(flag1, flag_bs); //Final flag (BS condition + other 3 conditions)
  574|       |
  575|  48.1k|    p0_uv_8x16_1 = _mm_and_si128(p0_uv_16x8,
  576|  48.1k|                                 _mm_xor_si128(flag1, _mm_set1_epi8(0xFF)));
  577|  48.1k|    p0_uv_8x16_2 = _mm_and_si128(p0_uv_8x16_2, flag1);
  578|  48.1k|    p0_uv_16x8 = _mm_add_epi8(p0_uv_8x16_1, p0_uv_8x16_2);
  579|       |
  580|  48.1k|    q0_uv_8x16_1 = _mm_and_si128(q0_uv_16x8,
  581|  48.1k|                                 _mm_xor_si128(flag1, _mm_set1_epi8(0xFF)));
  582|  48.1k|    q0_uv_8x16_2 = _mm_and_si128(q0_uv_8x16_2, flag1);
  583|  48.1k|    q0_uv_16x8 = _mm_add_epi8(q0_uv_8x16_1, q0_uv_8x16_2);
  584|       |
  585|       |    /* Inverse-transpose and store back */
  586|  48.1k|    temp1 = _mm_unpacklo_epi16(p1_uv_16x8, p0_uv_16x8);
  587|  48.1k|    temp2 = _mm_unpackhi_epi16(p1_uv_16x8, p0_uv_16x8);
  588|  48.1k|    temp3 = _mm_unpacklo_epi16(q0_uv_16x8, q1_uv_16x8);
  589|  48.1k|    temp4 = _mm_unpackhi_epi16(q0_uv_16x8, q1_uv_16x8);
  590|       |
  591|  48.1k|    linea = _mm_unpacklo_epi32(temp1, temp3);
  592|  48.1k|    lineb = _mm_srli_si128(linea, 8);
  593|  48.1k|    linec = _mm_unpackhi_epi32(temp1, temp3);
  594|  48.1k|    lined = _mm_srli_si128(linec, 8);
  595|  48.1k|    linee = _mm_unpacklo_epi32(temp2, temp4);
  596|  48.1k|    linef = _mm_srli_si128(linee, 8);
  597|  48.1k|    lineg = _mm_unpackhi_epi32(temp2, temp4);
  598|  48.1k|    lineh = _mm_srli_si128(lineg, 8);
  599|       |
  600|  48.1k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4), linea);
  601|  48.1k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4 + src_strd), lineb);
  602|  48.1k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4 + 2 * src_strd), linec);
  603|  48.1k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4 + 3 * src_strd), lined);
  604|  48.1k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4 + 4 * src_strd), linee);
  605|  48.1k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4 + 5 * src_strd), linef);
  606|  48.1k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4 + 6 * src_strd), lineg);
  607|  48.1k|    _mm_storel_epi64((__m128i *)(pu1_src_uv - 4 + 7 * src_strd), lineh);
  608|       |
  609|  48.1k|}
ih264_deblk_chroma_horz_bslt4_ssse3:
  657|  51.7k|{
  658|  51.7k|    UWORD8 *pu1_src_uv = pu1_src; /* Pointer to the src sample q0 of plane U*/
  659|  51.7k|    WORD16 i16_posP1, i16_posP0, i16_posQ1;
  660|  51.7k|    UWORD8 u1_Bs0, u1_Bs1, u1_Bs2, u1_Bs3;
  661|       |
  662|  51.7k|    UWORD8 *pu1_HorzPixelUV; /*! < Pointer to the first pixel of the boundary */
  663|  51.7k|    WORD32 alpha_cbcr = (alpha_cr << 16) + alpha_cb;
  664|  51.7k|    WORD32 beta_cbcr = (beta_cr << 16) + beta_cb;
  665|  51.7k|    __m128i q0_uv_16x8, p0_uv_16x8, q1_uv_16x8, p1_uv_16x8;
  666|  51.7k|    __m128i q0_uv_8x16, p0_uv_8x16, q1_uv_8x16, p1_uv_8x16;
  667|  51.7k|    __m128i flag_bs, flag1, flag2;
  668|  51.7k|    __m128i diff, diff1, alpha_cbcr_16x8, beta_cbcr_16x8, in_macro;
  669|  51.7k|    __m128i zero = _mm_setzero_si128();
  670|  51.7k|    __m128i C0_uv_8x16;
  671|  51.7k|    __m128i p0_uv_8x16_1, p0_uv_8x16_2, q0_uv_8x16_1, q0_uv_8x16_2;
  672|       |
  673|  51.7k|    pu1_HorzPixelUV = pu1_src_uv - (src_strd << 1);
  674|       |
  675|  51.7k|    i16_posQ1 = src_strd;
  676|  51.7k|    i16_posP0 = src_strd;
  677|  51.7k|    i16_posP1 = 0;
  678|       |
  679|  51.7k|    u1_Bs0 = (u4_bs >> 24) & 0xff;
  680|  51.7k|    u1_Bs1 = (u4_bs >> 16) & 0xff;
  681|  51.7k|    u1_Bs2 = (u4_bs >> 8) & 0xff;
  682|  51.7k|    u1_Bs3 = (u4_bs >> 0) & 0xff;
  683|       |
  684|  51.7k|    flag_bs = _mm_set_epi8(u1_Bs3, u1_Bs3, u1_Bs3, u1_Bs3, u1_Bs2, u1_Bs2,
  685|  51.7k|                           u1_Bs2, u1_Bs2, u1_Bs1, u1_Bs1, u1_Bs1, u1_Bs1,
  686|  51.7k|                           u1_Bs0, u1_Bs0, u1_Bs0, u1_Bs0);
  687|  51.7k|    flag_bs = _mm_cmpeq_epi8(flag_bs, zero); //Set flag to 1s and 0s
  688|  51.7k|    flag_bs = _mm_xor_si128(flag_bs, _mm_set1_epi8(0xFF)); //Invert for required mask
  689|       |
  690|  51.7k|    q0_uv_16x8 = _mm_loadu_si128((__m128i *)(pu1_src_uv));
  691|  51.7k|    q1_uv_16x8 = _mm_loadu_si128((__m128i *)(pu1_src_uv + i16_posQ1));
  692|  51.7k|    p1_uv_16x8 = _mm_loadu_si128((__m128i *)(pu1_HorzPixelUV + i16_posP1));
  693|  51.7k|    p0_uv_16x8 = _mm_loadu_si128((__m128i *)(pu1_HorzPixelUV + i16_posP0));
  694|       |
  695|  51.7k|    q0_uv_8x16 = _mm_unpacklo_epi8(q0_uv_16x8, zero);
  696|  51.7k|    q1_uv_8x16 = _mm_unpacklo_epi8(q1_uv_16x8, zero);
  697|  51.7k|    p1_uv_8x16 = _mm_unpacklo_epi8(p1_uv_16x8, zero);
  698|  51.7k|    p0_uv_8x16 = _mm_unpacklo_epi8(p0_uv_16x8, zero);
  699|       |
  700|  51.7k|    diff = _mm_subs_epi16(p0_uv_8x16, q0_uv_8x16); //Condn 1
  701|  51.7k|    diff = _mm_abs_epi16(diff);
  702|  51.7k|    alpha_cbcr_16x8 = _mm_set1_epi32(alpha_cbcr);
  703|  51.7k|    flag1 = _mm_cmpgt_epi16(alpha_cbcr_16x8, diff);
  704|       |
  705|  51.7k|    diff = _mm_subs_epi16(q1_uv_8x16, q0_uv_8x16); //Condtn 2
  706|  51.7k|    diff = _mm_abs_epi16(diff);
  707|  51.7k|    beta_cbcr_16x8 = _mm_set1_epi32(beta_cbcr);
  708|  51.7k|    flag1 = _mm_and_si128(flag1, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  709|       |
  710|  51.7k|    diff = _mm_subs_epi16(p1_uv_8x16, p0_uv_8x16); //Condtn 3
  711|  51.7k|    diff = _mm_abs_epi16(diff);
  712|  51.7k|    flag1 = _mm_and_si128(flag1, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  713|       |
  714|  51.7k|    diff = _mm_subs_epi16(q0_uv_8x16, p0_uv_8x16);
  715|  51.7k|    diff = _mm_slli_epi16(diff, 2);
  716|  51.7k|    diff1 = _mm_subs_epi16(p1_uv_8x16, q1_uv_8x16);
  717|  51.7k|    diff = _mm_add_epi16(diff, diff1);
  718|  51.7k|    diff = _mm_add_epi16(diff, _mm_set1_epi16(4));
  719|  51.7k|    in_macro = _mm_srai_epi16(diff, 3);
  720|       |
  721|  51.7k|    C0_uv_8x16 = _mm_set_epi16(pu1_cliptab_cr[u1_Bs1], pu1_cliptab_cb[u1_Bs1],
  722|  51.7k|                               pu1_cliptab_cr[u1_Bs1], pu1_cliptab_cb[u1_Bs1],
  723|  51.7k|                               pu1_cliptab_cr[u1_Bs0], pu1_cliptab_cb[u1_Bs0],
  724|  51.7k|                               pu1_cliptab_cr[u1_Bs0], pu1_cliptab_cb[u1_Bs0]);
  725|       |
  726|  51.7k|    C0_uv_8x16 = _mm_add_epi16(C0_uv_8x16, _mm_set1_epi16(1));
  727|       |
  728|  51.7k|    in_macro = _mm_min_epi16(C0_uv_8x16, in_macro); //CLIP3
  729|  51.7k|    C0_uv_8x16 = _mm_subs_epi16(zero, C0_uv_8x16);
  730|  51.7k|    in_macro = _mm_max_epi16(C0_uv_8x16, in_macro);
  731|       |
  732|  51.7k|    p0_uv_8x16_1 = _mm_add_epi16(p0_uv_8x16, in_macro);
  733|  51.7k|    q0_uv_8x16_1 = _mm_sub_epi16(q0_uv_8x16, in_macro);
  734|       |
  735|  51.7k|    q0_uv_8x16 = _mm_unpackhi_epi8(q0_uv_16x8, zero);
  736|  51.7k|    q1_uv_8x16 = _mm_unpackhi_epi8(q1_uv_16x8, zero);
  737|  51.7k|    p1_uv_8x16 = _mm_unpackhi_epi8(p1_uv_16x8, zero);
  738|  51.7k|    p0_uv_8x16 = _mm_unpackhi_epi8(p0_uv_16x8, zero);
  739|       |
  740|  51.7k|    diff = _mm_subs_epi16(p0_uv_8x16, q0_uv_8x16); //Condn 1
  741|  51.7k|    diff = _mm_abs_epi16(diff);
  742|  51.7k|    alpha_cbcr_16x8 = _mm_set1_epi32(alpha_cbcr);
  743|  51.7k|    flag2 = _mm_cmpgt_epi16(alpha_cbcr_16x8, diff);
  744|       |
  745|  51.7k|    diff = _mm_subs_epi16(q1_uv_8x16, q0_uv_8x16); //Condtn 2
  746|  51.7k|    diff = _mm_abs_epi16(diff);
  747|  51.7k|    beta_cbcr_16x8 = _mm_set1_epi32(beta_cbcr);
  748|  51.7k|    flag2 = _mm_and_si128(flag2, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  749|       |
  750|  51.7k|    diff = _mm_subs_epi16(p1_uv_8x16, p0_uv_8x16); //Condtn 3
  751|  51.7k|    diff = _mm_abs_epi16(diff);
  752|  51.7k|    flag2 = _mm_and_si128(flag2, _mm_cmpgt_epi16(beta_cbcr_16x8, diff));
  753|       |
  754|  51.7k|    diff = _mm_subs_epi16(q0_uv_8x16, p0_uv_8x16);
  755|  51.7k|    diff = _mm_slli_epi16(diff, 2);
  756|  51.7k|    diff1 = _mm_subs_epi16(p1_uv_8x16, q1_uv_8x16);
  757|  51.7k|    diff = _mm_add_epi16(diff, diff1);
  758|  51.7k|    diff = _mm_add_epi16(diff, _mm_set1_epi16(4));
  759|  51.7k|    in_macro = _mm_srai_epi16(diff, 3);
  760|       |
  761|  51.7k|    C0_uv_8x16 = _mm_set_epi16(pu1_cliptab_cr[u1_Bs3], pu1_cliptab_cb[u1_Bs3],
  762|  51.7k|                               pu1_cliptab_cr[u1_Bs3], pu1_cliptab_cb[u1_Bs3],
  763|  51.7k|                               pu1_cliptab_cr[u1_Bs2], pu1_cliptab_cb[u1_Bs2],
  764|  51.7k|                               pu1_cliptab_cr[u1_Bs2], pu1_cliptab_cb[u1_Bs2]);
  765|       |
  766|  51.7k|    C0_uv_8x16 = _mm_add_epi16(C0_uv_8x16, _mm_set1_epi16(1));
  767|       |
  768|  51.7k|    in_macro = _mm_min_epi16(C0_uv_8x16, in_macro); //CLIP3
  769|  51.7k|    C0_uv_8x16 = _mm_subs_epi16(zero, C0_uv_8x16);
  770|  51.7k|    in_macro = _mm_max_epi16(C0_uv_8x16, in_macro);
  771|       |
  772|  51.7k|    p0_uv_8x16_2 = _mm_add_epi16(p0_uv_8x16, in_macro);
  773|  51.7k|    q0_uv_8x16_2 = _mm_sub_epi16(q0_uv_8x16, in_macro);
  774|       |
  775|  51.7k|    p0_uv_8x16_2 = _mm_packus_epi16(p0_uv_8x16_1, p0_uv_8x16_2);
  776|  51.7k|    q0_uv_8x16_2 = _mm_packus_epi16(q0_uv_8x16_1, q0_uv_8x16_2);
  777|       |
  778|  51.7k|    flag1 = _mm_packs_epi16(flag1, flag2);
  779|  51.7k|    flag1 = _mm_and_si128(flag1, flag_bs); //Final flag (BS condition + other 3 conditions)
  780|       |
  781|  51.7k|    p0_uv_8x16_1 = _mm_and_si128(p0_uv_16x8,
  782|  51.7k|                                 _mm_xor_si128(flag1, _mm_set1_epi8(0xFF)));
  783|  51.7k|    p0_uv_8x16_2 = _mm_and_si128(p0_uv_8x16_2, flag1);
  784|  51.7k|    p0_uv_8x16_1 = _mm_add_epi8(p0_uv_8x16_1, p0_uv_8x16_2);
  785|  51.7k|    _mm_storeu_si128((__m128i *)(pu1_HorzPixelUV + i16_posP0), p0_uv_8x16_1);
  786|       |
  787|  51.7k|    q0_uv_8x16_1 = _mm_and_si128(q0_uv_16x8,
  788|  51.7k|                                 _mm_xor_si128(flag1, _mm_set1_epi8(0xFF)));
  789|  51.7k|    q0_uv_8x16_2 = _mm_and_si128(q0_uv_8x16_2, flag1);
  790|  51.7k|    q0_uv_8x16_1 = _mm_add_epi8(q0_uv_8x16_1, q0_uv_8x16_2);
  791|  51.7k|    _mm_storeu_si128((__m128i *)(pu1_src_uv), q0_uv_8x16_1);
  792|       |
  793|  51.7k|}

ih264_deblk_luma_vert_bs4_ssse3:
   94|  3.88k|{
   95|  3.88k|    __m128i zero = _mm_setzero_si128();
   96|  3.88k|    __m128i q0_16x8, q1_16x8, q2_16x8, q3_16x8;
   97|  3.88k|    __m128i p0_16x8, p1_16x8, p2_16x8, p3_16x8;
   98|  3.88k|    __m128i q0_8x16, q1_8x16, q2_8x16, q3_8x16;
   99|  3.88k|    __m128i p0_8x16, p1_8x16, p2_8x16, p3_8x16;
  100|  3.88k|    __m128i q0_16x8_1;
  101|  3.88k|    __m128i p0_16x8_1;
  102|  3.88k|    __m128i q0_16x8_2, q1_16x8_2, q2_16x8_2;
  103|  3.88k|    __m128i p0_16x8_2, p1_16x8_2, p2_16x8_2;
  104|  3.88k|    __m128i temp1, temp2, temp3, temp4, temp5, temp6;
  105|  3.88k|    __m128i Alpha_8x16, Beta_8x16;
  106|  3.88k|    __m128i flag1_16x8, flag2_16x8, flag3_16x8, flag4_16x8;
  107|  3.88k|    __m128i const_val2_16x8 = _mm_set1_epi16(2);
  108|  3.88k|    __m128i line1, line2, line3, line4, line5, line6, line7, line8;
  109|       |
  110|  3.88k|    Alpha_8x16 = _mm_set1_epi16(alpha);
  111|  3.88k|    Beta_8x16 = _mm_set1_epi16(beta);
  112|       |
  113|  3.88k|    line1 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 0 * src_strd));
  114|  3.88k|    line2 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 1 * src_strd));
  115|  3.88k|    line3 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 2 * src_strd));
  116|  3.88k|    line4 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 3 * src_strd));
  117|  3.88k|    line5 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 4 * src_strd));
  118|  3.88k|    line6 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 5 * src_strd));
  119|  3.88k|    line7 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 6 * src_strd));
  120|  3.88k|    line8 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 7 * src_strd));
  121|       |
  122|  3.88k|    temp1 = _mm_unpacklo_epi8(line1, line2);
  123|  3.88k|    temp2 = _mm_unpacklo_epi8(line3, line4);
  124|  3.88k|    temp3 = _mm_unpacklo_epi8(line5, line6);
  125|  3.88k|    temp4 = _mm_unpacklo_epi8(line7, line8);
  126|       |
  127|  3.88k|    line1 = _mm_unpacklo_epi16(temp1, temp2);
  128|  3.88k|    line2 = _mm_unpackhi_epi16(temp1, temp2);
  129|  3.88k|    line3 = _mm_unpacklo_epi16(temp3, temp4);
  130|  3.88k|    line4 = _mm_unpackhi_epi16(temp3, temp4);
  131|       |
  132|  3.88k|    p1_8x16 = _mm_unpacklo_epi32(line1, line3);
  133|  3.88k|    p0_8x16 = _mm_unpackhi_epi32(line1, line3);
  134|  3.88k|    q0_8x16 = _mm_unpacklo_epi32(line2, line4);
  135|  3.88k|    q1_8x16 = _mm_unpackhi_epi32(line2, line4);
  136|       |
  137|  3.88k|    line1 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 8 * src_strd));
  138|  3.88k|    line2 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 9 * src_strd));
  139|  3.88k|    line3 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 10 * src_strd));
  140|  3.88k|    line4 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 11 * src_strd));
  141|  3.88k|    line5 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 12 * src_strd));
  142|  3.88k|    line6 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 13 * src_strd));
  143|  3.88k|    line7 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 14 * src_strd));
  144|  3.88k|    line8 = _mm_loadl_epi64((__m128i *)(pu1_src - 4 + 15 * src_strd));
  145|       |
  146|  3.88k|    temp1 = _mm_unpacklo_epi8(line1, line2);
  147|  3.88k|    temp2 = _mm_unpacklo_epi8(line3, line4);
  148|  3.88k|    temp3 = _mm_unpacklo_epi8(line5, line6);
  149|  3.88k|    temp4 = _mm_unpacklo_epi8(line7, line8);
  150|       |
  151|  3.88k|    line1 = _mm_unpacklo_epi16(temp1, temp2);
  152|  3.88k|    line2 = _mm_unpackhi_epi16(temp1, temp2);
  153|  3.88k|    line3 = _mm_unpacklo_epi16(temp3, temp4);
  154|  3.88k|    line4 = _mm_unpackhi_epi16(temp3, temp4);
  155|       |
  156|  3.88k|    temp1 = _mm_unpacklo_epi32(line1, line3);
  157|  3.88k|    temp2 = _mm_unpackhi_epi32(line1, line3);
  158|  3.88k|    temp3 = _mm_unpacklo_epi32(line2, line4);
  159|  3.88k|    temp4 = _mm_unpackhi_epi32(line2, line4);
  160|       |
  161|  3.88k|    p3_16x8 = _mm_unpacklo_epi64(p1_8x16, temp1);
  162|  3.88k|    p2_16x8 = _mm_unpackhi_epi64(p1_8x16, temp1);
  163|  3.88k|    q2_16x8 = _mm_unpacklo_epi64(q1_8x16, temp4);
  164|  3.88k|    q3_16x8 = _mm_unpackhi_epi64(q1_8x16, temp4);
  165|  3.88k|    p1_16x8 = _mm_unpacklo_epi64(p0_8x16, temp2);
  166|  3.88k|    p0_16x8 = _mm_unpackhi_epi64(p0_8x16, temp2);
  167|  3.88k|    q0_16x8 = _mm_unpacklo_epi64(q0_8x16, temp3);
  168|  3.88k|    q1_16x8 = _mm_unpackhi_epi64(q0_8x16, temp3);
  169|       |
  170|       |    //Cond1 (ABS(p0 - q0) < alpha)
  171|  3.88k|    temp1 = _mm_subs_epu8(q0_16x8, p0_16x8);
  172|  3.88k|    temp2 = _mm_subs_epu8(p0_16x8, q0_16x8);
  173|  3.88k|    temp1 = _mm_add_epi8(temp1, temp2);
  174|       |
  175|  3.88k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
  176|  3.88k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
  177|       |
  178|  3.88k|    temp2 = _mm_cmpgt_epi16(Alpha_8x16, temp2);
  179|  3.88k|    temp1 = _mm_cmpgt_epi16(Alpha_8x16, temp1);
  180|       |
  181|  3.88k|    flag1_16x8 = _mm_packs_epi16(temp2, temp1);
  182|       |
  183|       |    //Cond2 (ABS(q1 - q0) < beta)
  184|  3.88k|    temp1 = _mm_subs_epu8(q0_16x8, q1_16x8);
  185|  3.88k|    temp2 = _mm_subs_epu8(q1_16x8, q0_16x8);
  186|  3.88k|    temp1 = _mm_add_epi8(temp1, temp2);
  187|       |
  188|  3.88k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
  189|  3.88k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
  190|       |
  191|  3.88k|    temp2 = _mm_cmpgt_epi16(Beta_8x16, temp2);
  192|  3.88k|    temp1 = _mm_cmpgt_epi16(Beta_8x16, temp1);
  193|       |
  194|  3.88k|    flag2_16x8 = _mm_packs_epi16(temp2, temp1);
  195|       |
  196|  3.88k|    flag1_16x8 = _mm_and_si128(flag1_16x8, flag2_16x8);
  197|       |
  198|       |    //Cond3 (ABS(p1 - p0) < beta)
  199|  3.88k|    temp1 = _mm_subs_epu8(p0_16x8, p1_16x8);
  200|  3.88k|    temp2 = _mm_subs_epu8(p1_16x8, p0_16x8);
  201|  3.88k|    temp1 = _mm_add_epi8(temp1, temp2);
  202|       |
  203|  3.88k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
  204|  3.88k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
  205|       |
  206|  3.88k|    temp2 = _mm_cmpgt_epi16(Beta_8x16, temp2);
  207|  3.88k|    temp1 = _mm_cmpgt_epi16(Beta_8x16, temp1);
  208|       |
  209|  3.88k|    flag2_16x8 = _mm_packs_epi16(temp2, temp1);
  210|       |
  211|       |    // !((ABS(p0 - q0) < alpha) || (ABS(q1 - q0) < beta) || (ABS(p1 - p0) < beta))
  212|  3.88k|    flag1_16x8 = _mm_and_si128(flag1_16x8, flag2_16x8);
  213|       |
  214|       |    // (ABS(p0 - q0) < ((alpha >> 2) + 2))
  215|  3.88k|    temp1 = _mm_subs_epu8(p0_16x8, q0_16x8);
  216|  3.88k|    temp2 = _mm_subs_epu8(q0_16x8, p0_16x8);
  217|  3.88k|    temp1 = _mm_add_epi8(temp1, temp2);
  218|  3.88k|    Alpha_8x16 = _mm_srai_epi16(Alpha_8x16, 2);
  219|  3.88k|    Alpha_8x16 = _mm_add_epi16(Alpha_8x16, const_val2_16x8);
  220|       |
  221|  3.88k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
  222|  3.88k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
  223|  3.88k|    temp2 = _mm_cmpgt_epi16(Alpha_8x16, temp2);
  224|  3.88k|    temp1 = _mm_cmpgt_epi16(Alpha_8x16, temp1);
  225|       |
  226|  3.88k|    flag2_16x8 = _mm_packs_epi16(temp2, temp1);
  227|  3.88k|    flag2_16x8 = _mm_and_si128(flag1_16x8, flag2_16x8);
  228|       |
  229|       |    // (ABS(p2 - p0) < beta)
  230|  3.88k|    temp1 = _mm_subs_epu8(p0_16x8, p2_16x8);
  231|  3.88k|    temp2 = _mm_subs_epu8(p2_16x8, p0_16x8);
  232|  3.88k|    temp1 = _mm_add_epi8(temp1, temp2);
  233|       |
  234|  3.88k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
  235|  3.88k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
  236|  3.88k|    temp2 = _mm_cmpgt_epi16(Beta_8x16, temp2);
  237|  3.88k|    temp1 = _mm_cmpgt_epi16(Beta_8x16, temp1);
  238|       |
  239|  3.88k|    flag3_16x8 = _mm_packs_epi16(temp2, temp1);
  240|  3.88k|    flag3_16x8 = _mm_and_si128(flag3_16x8, flag2_16x8);
  241|       |
  242|       |    // (ABS(q2 - q0) < beta)
  243|  3.88k|    temp1 = _mm_subs_epu8(q0_16x8, q2_16x8);
  244|  3.88k|    temp2 = _mm_subs_epu8(q2_16x8, q0_16x8);
  245|  3.88k|    temp1 = _mm_add_epi8(temp1, temp2);
  246|       |
  247|  3.88k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
  248|  3.88k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
  249|  3.88k|    temp2 = _mm_cmpgt_epi16(Beta_8x16, temp2);
  250|  3.88k|    temp1 = _mm_cmpgt_epi16(Beta_8x16, temp1);
  251|       |
  252|  3.88k|    flag4_16x8 = _mm_packs_epi16(temp2, temp1);
  253|  3.88k|    flag4_16x8 = _mm_and_si128(flag4_16x8, flag2_16x8);
  254|       |
  255|       |    // First 8 pixels
  256|  3.88k|    p3_8x16 = _mm_unpacklo_epi8(p3_16x8, zero);
  257|  3.88k|    p2_8x16 = _mm_unpacklo_epi8(p2_16x8, zero);
  258|  3.88k|    p1_8x16 = _mm_unpacklo_epi8(p1_16x8, zero);
  259|  3.88k|    p0_8x16 = _mm_unpacklo_epi8(p0_16x8, zero);
  260|  3.88k|    q0_8x16 = _mm_unpacklo_epi8(q0_16x8, zero);
  261|  3.88k|    q1_8x16 = _mm_unpacklo_epi8(q1_16x8, zero);
  262|  3.88k|    q2_8x16 = _mm_unpacklo_epi8(q2_16x8, zero);
  263|  3.88k|    q3_8x16 = _mm_unpacklo_epi8(q3_16x8, zero);
  264|       |
  265|       |    // p0_1 and q0_1
  266|  3.88k|    temp1 = _mm_add_epi16(p0_8x16, q1_8x16);
  267|  3.88k|    temp2 = _mm_add_epi16(p1_8x16, q0_8x16);
  268|  3.88k|    temp5 = _mm_add_epi16(temp1, const_val2_16x8);
  269|  3.88k|    temp6 = _mm_add_epi16(temp2, const_val2_16x8);
  270|  3.88k|    temp3 = _mm_slli_epi16(p1_8x16, 1);
  271|  3.88k|    temp4 = _mm_slli_epi16(q1_8x16, 1);
  272|  3.88k|    temp1 = _mm_add_epi16(temp5, temp3);
  273|  3.88k|    temp2 = _mm_add_epi16(temp6, temp4);
  274|  3.88k|    p0_16x8_1 = _mm_srai_epi16(temp1, 2);
  275|  3.88k|    q0_16x8_1 = _mm_srai_epi16(temp2, 2);
  276|       |
  277|       |    // p1_2 and q1_2
  278|  3.88k|    temp6 = _mm_add_epi16(temp6, p0_8x16);
  279|  3.88k|    temp5 = _mm_add_epi16(temp5, q0_8x16);
  280|  3.88k|    temp1 = _mm_add_epi16(temp6, p2_8x16);
  281|  3.88k|    temp2 = _mm_add_epi16(temp5, q2_8x16);
  282|  3.88k|    p1_16x8_2 = _mm_srai_epi16(temp1, 2);
  283|  3.88k|    q1_16x8_2 = _mm_srai_epi16(temp2, 2);
  284|       |
  285|       |    // p0_2 and q0_2
  286|  3.88k|    temp1 = _mm_add_epi16(temp3, p2_8x16);
  287|  3.88k|    temp2 = _mm_add_epi16(temp4, q2_8x16);
  288|  3.88k|    temp1 = _mm_add_epi16(temp1, q1_8x16);
  289|  3.88k|    temp2 = _mm_add_epi16(temp2, p1_8x16);
  290|  3.88k|    temp3 = _mm_add_epi16(p0_8x16, q0_8x16);
  291|  3.88k|    temp3 = _mm_slli_epi16(temp3, 1);
  292|  3.88k|    temp1 = _mm_add_epi16(temp1, temp3);
  293|  3.88k|    temp2 = _mm_add_epi16(temp2, temp3);
  294|  3.88k|    temp1 = _mm_add_epi16(temp1, _mm_set1_epi16(4));
  295|  3.88k|    temp2 = _mm_add_epi16(temp2, _mm_set1_epi16(4));
  296|  3.88k|    p0_16x8_2 = _mm_srai_epi16(temp1, 3);
  297|  3.88k|    q0_16x8_2 = _mm_srai_epi16(temp2, 3);
  298|       |
  299|       |    // p2_2 and q2_2
  300|  3.88k|    temp1 = _mm_add_epi16(temp6, const_val2_16x8);
  301|  3.88k|    temp2 = _mm_add_epi16(temp5, const_val2_16x8);
  302|  3.88k|    temp3 = _mm_slli_epi16(p2_8x16, 1);
  303|  3.88k|    temp4 = _mm_slli_epi16(q2_8x16, 1);
  304|  3.88k|    temp3 = _mm_add_epi16(p2_8x16, temp3);
  305|  3.88k|    temp4 = _mm_add_epi16(q2_8x16, temp4);
  306|  3.88k|    temp5 = _mm_slli_epi16(p3_8x16, 1);
  307|  3.88k|    temp6 = _mm_slli_epi16(q3_8x16, 1);
  308|  3.88k|    temp1 = _mm_add_epi16(temp1, temp3);
  309|  3.88k|    temp2 = _mm_add_epi16(temp2, temp4);
  310|  3.88k|    temp1 = _mm_add_epi16(temp1, temp5);
  311|  3.88k|    temp2 = _mm_add_epi16(temp2, temp6);
  312|  3.88k|    p2_16x8_2 = _mm_srai_epi16(temp1, 3);
  313|  3.88k|    q2_16x8_2 = _mm_srai_epi16(temp2, 3);
  314|       |
  315|       |    // Second 8 pixels and packing with first 8 pixels
  316|  3.88k|    p3_8x16 = _mm_unpackhi_epi8(p3_16x8, zero);
  317|  3.88k|    p2_8x16 = _mm_unpackhi_epi8(p2_16x8, zero);
  318|  3.88k|    p1_8x16 = _mm_unpackhi_epi8(p1_16x8, zero);
  319|  3.88k|    p0_8x16 = _mm_unpackhi_epi8(p0_16x8, zero);
  320|  3.88k|    q0_8x16 = _mm_unpackhi_epi8(q0_16x8, zero);
  321|  3.88k|    q1_8x16 = _mm_unpackhi_epi8(q1_16x8, zero);
  322|  3.88k|    q2_8x16 = _mm_unpackhi_epi8(q2_16x8, zero);
  323|  3.88k|    q3_8x16 = _mm_unpackhi_epi8(q3_16x8, zero);
  324|       |
  325|       |    // p0_1 and q0_1
  326|  3.88k|    temp1 = _mm_add_epi16(p0_8x16, q1_8x16);
  327|  3.88k|    temp2 = _mm_add_epi16(p1_8x16, q0_8x16);
  328|  3.88k|    temp5 = _mm_add_epi16(temp1, const_val2_16x8);
  329|  3.88k|    temp6 = _mm_add_epi16(temp2, const_val2_16x8);
  330|  3.88k|    temp3 = _mm_slli_epi16(p1_8x16, 1);
  331|  3.88k|    temp4 = _mm_slli_epi16(q1_8x16, 1);
  332|  3.88k|    temp1 = _mm_add_epi16(temp5, temp3);
  333|  3.88k|    temp2 = _mm_add_epi16(temp6, temp4);
  334|  3.88k|    temp1 = _mm_srai_epi16(temp1, 2);
  335|  3.88k|    temp2 = _mm_srai_epi16(temp2, 2);
  336|  3.88k|    p0_16x8_1 = _mm_packus_epi16(p0_16x8_1, temp1);
  337|  3.88k|    q0_16x8_1 = _mm_packus_epi16(q0_16x8_1, temp2);
  338|       |
  339|       |    // p1_2 and q1_2
  340|  3.88k|    temp6 = _mm_add_epi16(temp6, p0_8x16);
  341|  3.88k|    temp5 = _mm_add_epi16(temp5, q0_8x16);
  342|  3.88k|    temp1 = _mm_add_epi16(temp6, p2_8x16);
  343|  3.88k|    temp2 = _mm_add_epi16(temp5, q2_8x16);
  344|  3.88k|    temp1 = _mm_srai_epi16(temp1, 2);
  345|  3.88k|    temp2 = _mm_srai_epi16(temp2, 2);
  346|  3.88k|    p1_16x8_2 = _mm_packus_epi16(p1_16x8_2, temp1);
  347|  3.88k|    q1_16x8_2 = _mm_packus_epi16(q1_16x8_2, temp2);
  348|       |
  349|       |    // p0_2 and q0_2
  350|  3.88k|    temp1 = _mm_add_epi16(temp3, p2_8x16);
  351|  3.88k|    temp2 = _mm_add_epi16(temp4, q2_8x16);
  352|  3.88k|    temp1 = _mm_add_epi16(temp1, q1_8x16);
  353|  3.88k|    temp2 = _mm_add_epi16(temp2, p1_8x16);
  354|  3.88k|    temp3 = _mm_add_epi16(p0_8x16, q0_8x16);
  355|  3.88k|    temp3 = _mm_slli_epi16(temp3, 1);
  356|  3.88k|    temp1 = _mm_add_epi16(temp1, temp3);
  357|  3.88k|    temp2 = _mm_add_epi16(temp2, temp3);
  358|  3.88k|    temp1 = _mm_add_epi16(temp1, _mm_set1_epi16(4));
  359|  3.88k|    temp2 = _mm_add_epi16(temp2, _mm_set1_epi16(4));
  360|  3.88k|    temp1 = _mm_srai_epi16(temp1, 3);
  361|  3.88k|    temp2 = _mm_srai_epi16(temp2, 3);
  362|  3.88k|    p0_16x8_2 = _mm_packus_epi16(p0_16x8_2, temp1);
  363|  3.88k|    q0_16x8_2 = _mm_packus_epi16(q0_16x8_2, temp2);
  364|       |
  365|       |    // p2_2 and q2_2
  366|  3.88k|    temp1 = _mm_add_epi16(temp6, const_val2_16x8);
  367|  3.88k|    temp2 = _mm_add_epi16(temp5, const_val2_16x8);
  368|  3.88k|    temp3 = _mm_slli_epi16(p2_8x16, 1);
  369|  3.88k|    temp4 = _mm_slli_epi16(q2_8x16, 1);
  370|  3.88k|    temp3 = _mm_add_epi16(p2_8x16, temp3);
  371|  3.88k|    temp4 = _mm_add_epi16(q2_8x16, temp4);
  372|  3.88k|    temp5 = _mm_slli_epi16(p3_8x16, 1);
  373|  3.88k|    temp6 = _mm_slli_epi16(q3_8x16, 1);
  374|  3.88k|    temp1 = _mm_add_epi16(temp1, temp3);
  375|  3.88k|    temp2 = _mm_add_epi16(temp2, temp4);
  376|  3.88k|    temp1 = _mm_add_epi16(temp1, temp5);
  377|  3.88k|    temp2 = _mm_add_epi16(temp2, temp6);
  378|  3.88k|    temp1 = _mm_srai_epi16(temp1, 3);
  379|  3.88k|    temp2 = _mm_srai_epi16(temp2, 3);
  380|  3.88k|    p2_16x8_2 = _mm_packus_epi16(p2_16x8_2, temp1);
  381|  3.88k|    q2_16x8_2 = _mm_packus_epi16(q2_16x8_2, temp2);
  382|       |
  383|       |    // p0 and q0
  384|  3.88k|    p0_16x8 = _mm_and_si128(p0_16x8,
  385|  3.88k|                            _mm_xor_si128(flag1_16x8, _mm_set1_epi8(0xFF)));
  386|  3.88k|    p0_16x8_1 = _mm_and_si128(p0_16x8_1, flag1_16x8);
  387|  3.88k|    p0_16x8 = _mm_add_epi8(p0_16x8, p0_16x8_1);
  388|  3.88k|    q0_16x8 = _mm_and_si128(q0_16x8,
  389|  3.88k|                            _mm_xor_si128(flag1_16x8, _mm_set1_epi8(0xFF)));
  390|  3.88k|    q0_16x8_1 = _mm_and_si128(q0_16x8_1, flag1_16x8);
  391|  3.88k|    q0_16x8 = _mm_add_epi8(q0_16x8, q0_16x8_1);
  392|       |
  393|       |    // p0 and q0
  394|  3.88k|    p0_16x8 = _mm_and_si128(p0_16x8,
  395|  3.88k|                            _mm_xor_si128(flag3_16x8, _mm_set1_epi8(0xFF)));
  396|  3.88k|    p0_16x8_2 = _mm_and_si128(p0_16x8_2, flag3_16x8);
  397|  3.88k|    p0_16x8 = _mm_add_epi8(p0_16x8, p0_16x8_2);
  398|  3.88k|    q0_16x8 = _mm_and_si128(q0_16x8,
  399|  3.88k|                            _mm_xor_si128(flag4_16x8, _mm_set1_epi8(0xFF)));
  400|  3.88k|    q0_16x8_2 = _mm_and_si128(q0_16x8_2, flag4_16x8);
  401|  3.88k|    q0_16x8 = _mm_add_epi8(q0_16x8, q0_16x8_2);
  402|       |
  403|       |    // p1 and q1
  404|  3.88k|    p1_16x8 = _mm_and_si128(p1_16x8,
  405|  3.88k|                            _mm_xor_si128(flag3_16x8, _mm_set1_epi8(0xFF)));
  406|  3.88k|    p1_16x8_2 = _mm_and_si128(p1_16x8_2, flag3_16x8);
  407|  3.88k|    p1_16x8 = _mm_add_epi8(p1_16x8, p1_16x8_2);
  408|  3.88k|    q1_16x8 = _mm_and_si128(q1_16x8,
  409|  3.88k|                            _mm_xor_si128(flag4_16x8, _mm_set1_epi8(0xFF)));
  410|  3.88k|    q1_16x8_2 = _mm_and_si128(q1_16x8_2, flag4_16x8);
  411|  3.88k|    q1_16x8 = _mm_add_epi8(q1_16x8, q1_16x8_2);
  412|       |
  413|       |    // p2 and q2
  414|  3.88k|    p2_16x8 = _mm_and_si128(p2_16x8,
  415|  3.88k|                            _mm_xor_si128(flag3_16x8, _mm_set1_epi8(0xFF)));
  416|  3.88k|    p2_16x8_2 = _mm_and_si128(p2_16x8_2, flag3_16x8);
  417|  3.88k|    p2_16x8 = _mm_add_epi8(p2_16x8, p2_16x8_2);
  418|  3.88k|    q2_16x8 = _mm_and_si128(q2_16x8,
  419|  3.88k|                            _mm_xor_si128(flag4_16x8, _mm_set1_epi8(0xFF)));
  420|  3.88k|    q2_16x8_2 = _mm_and_si128(q2_16x8_2, flag4_16x8);
  421|  3.88k|    q2_16x8 = _mm_add_epi8(q2_16x8, q2_16x8_2);
  422|       |
  423|  3.88k|    temp1 = _mm_unpacklo_epi8(p3_16x8, p2_16x8);
  424|  3.88k|    temp2 = _mm_unpacklo_epi8(p1_16x8, p0_16x8);
  425|  3.88k|    temp3 = _mm_unpacklo_epi8(q0_16x8, q1_16x8);
  426|  3.88k|    temp4 = _mm_unpacklo_epi8(q2_16x8, q3_16x8);
  427|       |
  428|  3.88k|    p3_8x16 = _mm_unpacklo_epi16(temp1, temp2);
  429|  3.88k|    p2_8x16 = _mm_unpackhi_epi16(temp1, temp2);
  430|  3.88k|    q2_8x16 = _mm_unpacklo_epi16(temp3, temp4);
  431|  3.88k|    q3_8x16 = _mm_unpackhi_epi16(temp3, temp4);
  432|       |
  433|  3.88k|    line1 = _mm_unpacklo_epi32(p3_8x16, q2_8x16);
  434|  3.88k|    line2 = _mm_srli_si128(line1, 8);
  435|  3.88k|    line3 = _mm_unpackhi_epi32(p3_8x16, q2_8x16);
  436|  3.88k|    line4 = _mm_srli_si128(line3, 8);
  437|  3.88k|    line5 = _mm_unpacklo_epi32(p2_8x16, q3_8x16);
  438|  3.88k|    line6 = _mm_srli_si128(line5, 8);
  439|  3.88k|    line7 = _mm_unpackhi_epi32(p2_8x16, q3_8x16);
  440|  3.88k|    line8 = _mm_srli_si128(line7, 8);
  441|       |
  442|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 0 * src_strd), line1);
  443|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 1 * src_strd), line2);
  444|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 2 * src_strd), line3);
  445|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 3 * src_strd), line4);
  446|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 4 * src_strd), line5);
  447|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 5 * src_strd), line6);
  448|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 6 * src_strd), line7);
  449|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 7 * src_strd), line8);
  450|       |
  451|  3.88k|    temp1 = _mm_unpackhi_epi8(p3_16x8, p2_16x8);
  452|  3.88k|    temp2 = _mm_unpackhi_epi8(p1_16x8, p0_16x8);
  453|  3.88k|    temp3 = _mm_unpackhi_epi8(q0_16x8, q1_16x8);
  454|  3.88k|    temp4 = _mm_unpackhi_epi8(q2_16x8, q3_16x8);
  455|       |
  456|  3.88k|    p3_8x16 = _mm_unpacklo_epi16(temp1, temp2);
  457|  3.88k|    p2_8x16 = _mm_unpackhi_epi16(temp1, temp2);
  458|  3.88k|    q2_8x16 = _mm_unpacklo_epi16(temp3, temp4);
  459|  3.88k|    q3_8x16 = _mm_unpackhi_epi16(temp3, temp4);
  460|       |
  461|  3.88k|    line1 = _mm_unpacklo_epi32(p3_8x16, q2_8x16);
  462|  3.88k|    line2 = _mm_srli_si128(line1, 8);
  463|  3.88k|    line3 = _mm_unpackhi_epi32(p3_8x16, q2_8x16);
  464|  3.88k|    line4 = _mm_srli_si128(line3, 8);
  465|  3.88k|    line5 = _mm_unpacklo_epi32(p2_8x16, q3_8x16);
  466|  3.88k|    line6 = _mm_srli_si128(line5, 8);
  467|  3.88k|    line7 = _mm_unpackhi_epi32(p2_8x16, q3_8x16);
  468|  3.88k|    line8 = _mm_srli_si128(line7, 8);
  469|       |
  470|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 8 * src_strd), line1);
  471|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 9 * src_strd), line2);
  472|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 10 * src_strd), line3);
  473|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 11 * src_strd), line4);
  474|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 12 * src_strd), line5);
  475|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 13 * src_strd), line6);
  476|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 14 * src_strd), line7);
  477|  3.88k|    _mm_storel_epi64((__m128i *)(pu1_src - 4 + 15 * src_strd), line8);
  478|       |
  479|  3.88k|}
ih264_deblk_luma_horz_bs4_ssse3:
  515|  1.64k|{
  516|  1.64k|    WORD16 i16_posP3, i16_posP2, i16_posP1, i16_posP0;
  517|  1.64k|    WORD16 i16_posQ1, i16_posQ2, i16_posQ3;
  518|  1.64k|    UWORD8 *pu1_HorzPixel;
  519|  1.64k|    __m128i zero = _mm_setzero_si128();
  520|  1.64k|    __m128i q0_16x8, q1_16x8, q2_16x8, q3_16x8;
  521|  1.64k|    __m128i p0_16x8, p1_16x8, p2_16x8, p3_16x8;
  522|  1.64k|    __m128i q0_8x16, q1_8x16, q2_8x16, q3_8x16;
  523|  1.64k|    __m128i p0_8x16, p1_8x16, p2_8x16, p3_8x16;
  524|  1.64k|    __m128i q0_16x8_1;
  525|  1.64k|    __m128i p0_16x8_1;
  526|  1.64k|    __m128i q0_16x8_2, q1_16x8_2, q2_16x8_2;
  527|  1.64k|    __m128i p0_16x8_2, p1_16x8_2, p2_16x8_2;
  528|  1.64k|    __m128i temp1, temp2, temp3, temp4, temp5, temp6;
  529|  1.64k|    __m128i Alpha_8x16, Beta_8x16;
  530|  1.64k|    __m128i flag1_16x8, flag2_16x8, flag3_16x8, flag4_16x8;
  531|  1.64k|    __m128i const_val2_16x8 = _mm_set1_epi16(2);
  532|       |
  533|  1.64k|    pu1_HorzPixel = pu1_src - (src_strd << 2);
  534|       |
  535|  1.64k|    i16_posQ1 = src_strd;
  536|  1.64k|    i16_posQ2 = X2(src_strd);
  ------------------
  |  |   91|  1.64k|#define X2(a)   ((a) << 1)
  ------------------
  537|  1.64k|    i16_posQ3 = X3(src_strd);
  ------------------
  |  |   92|  1.64k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  538|  1.64k|    i16_posP0 = X3(src_strd);
  ------------------
  |  |   92|  1.64k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  539|  1.64k|    i16_posP1 = X2(src_strd);
  ------------------
  |  |   91|  1.64k|#define X2(a)   ((a) << 1)
  ------------------
  540|  1.64k|    i16_posP2 = src_strd;
  541|  1.64k|    i16_posP3 = 0;
  542|       |
  543|  1.64k|    Alpha_8x16 = _mm_set1_epi16(alpha);
  544|  1.64k|    Beta_8x16 = _mm_set1_epi16(beta);
  545|       |
  546|  1.64k|    p3_16x8 = _mm_loadu_si128((__m128i *)(pu1_HorzPixel + i16_posP3));
  547|  1.64k|    p2_16x8 = _mm_loadu_si128((__m128i *)(pu1_HorzPixel + i16_posP2));
  548|  1.64k|    p1_16x8 = _mm_loadu_si128((__m128i *)(pu1_HorzPixel + i16_posP1));
  549|  1.64k|    p0_16x8 = _mm_loadu_si128((__m128i *)(pu1_HorzPixel + i16_posP0));
  550|  1.64k|    q0_16x8 = _mm_loadu_si128((__m128i *)(pu1_src));
  551|  1.64k|    q1_16x8 = _mm_loadu_si128((__m128i *)(pu1_src + i16_posQ1));
  552|  1.64k|    q2_16x8 = _mm_loadu_si128((__m128i *)(pu1_src + i16_posQ2));
  553|  1.64k|    q3_16x8 = _mm_loadu_si128((__m128i *)(pu1_src + i16_posQ3));
  554|       |
  555|       |    //Cond1 (ABS(p0 - q0) < alpha)
  556|  1.64k|    temp1 = _mm_subs_epu8(q0_16x8, p0_16x8);
  557|  1.64k|    temp2 = _mm_subs_epu8(p0_16x8, q0_16x8);
  558|  1.64k|    temp1 = _mm_add_epi8(temp1, temp2);
  559|       |
  560|  1.64k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
  561|  1.64k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
  562|       |
  563|  1.64k|    temp2 = _mm_cmpgt_epi16(Alpha_8x16, temp2);
  564|  1.64k|    temp1 = _mm_cmpgt_epi16(Alpha_8x16, temp1);
  565|       |
  566|  1.64k|    flag1_16x8 = _mm_packs_epi16(temp2, temp1);
  567|       |
  568|       |    //Cond2 (ABS(q1 - q0) < beta)
  569|  1.64k|    temp1 = _mm_subs_epu8(q0_16x8, q1_16x8);
  570|  1.64k|    temp2 = _mm_subs_epu8(q1_16x8, q0_16x8);
  571|  1.64k|    temp1 = _mm_add_epi8(temp1, temp2);
  572|       |
  573|  1.64k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
  574|  1.64k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
  575|       |
  576|  1.64k|    temp2 = _mm_cmpgt_epi16(Beta_8x16, temp2);
  577|  1.64k|    temp1 = _mm_cmpgt_epi16(Beta_8x16, temp1);
  578|       |
  579|  1.64k|    flag2_16x8 = _mm_packs_epi16(temp2, temp1);
  580|       |
  581|  1.64k|    flag1_16x8 = _mm_and_si128(flag1_16x8, flag2_16x8);
  582|       |
  583|       |    //Cond3 (ABS(p1 - p0) < beta)
  584|  1.64k|    temp1 = _mm_subs_epu8(p0_16x8, p1_16x8);
  585|  1.64k|    temp2 = _mm_subs_epu8(p1_16x8, p0_16x8);
  586|  1.64k|    temp1 = _mm_add_epi8(temp1, temp2);
  587|       |
  588|  1.64k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
  589|  1.64k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
  590|       |
  591|  1.64k|    temp2 = _mm_cmpgt_epi16(Beta_8x16, temp2);
  592|  1.64k|    temp1 = _mm_cmpgt_epi16(Beta_8x16, temp1);
  593|       |
  594|  1.64k|    flag2_16x8 = _mm_packs_epi16(temp2, temp1);
  595|       |
  596|       |    // !((ABS(p0 - q0) < alpha) || (ABS(q1 - q0) < beta) || (ABS(p1 - p0) < beta))
  597|  1.64k|    flag1_16x8 = _mm_and_si128(flag1_16x8, flag2_16x8);
  598|       |
  599|       |    // (ABS(p0 - q0) < ((alpha >> 2) + 2))
  600|  1.64k|    temp1 = _mm_subs_epu8(p0_16x8, q0_16x8);
  601|  1.64k|    temp2 = _mm_subs_epu8(q0_16x8, p0_16x8);
  602|  1.64k|    temp1 = _mm_add_epi8(temp1, temp2);
  603|  1.64k|    Alpha_8x16 = _mm_srai_epi16(Alpha_8x16, 2);
  604|  1.64k|    Alpha_8x16 = _mm_add_epi16(Alpha_8x16, const_val2_16x8);
  605|       |
  606|  1.64k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
  607|  1.64k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
  608|  1.64k|    temp2 = _mm_cmpgt_epi16(Alpha_8x16, temp2);
  609|  1.64k|    temp1 = _mm_cmpgt_epi16(Alpha_8x16, temp1);
  610|       |
  611|  1.64k|    flag2_16x8 = _mm_packs_epi16(temp2, temp1);
  612|  1.64k|    flag2_16x8 = _mm_and_si128(flag1_16x8, flag2_16x8);
  613|       |
  614|       |    // (ABS(p2 - p0) < beta)
  615|  1.64k|    temp1 = _mm_subs_epu8(p0_16x8, p2_16x8);
  616|  1.64k|    temp2 = _mm_subs_epu8(p2_16x8, p0_16x8);
  617|  1.64k|    temp1 = _mm_add_epi8(temp1, temp2);
  618|       |
  619|  1.64k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
  620|  1.64k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
  621|  1.64k|    temp2 = _mm_cmpgt_epi16(Beta_8x16, temp2);
  622|  1.64k|    temp1 = _mm_cmpgt_epi16(Beta_8x16, temp1);
  623|       |
  624|  1.64k|    flag3_16x8 = _mm_packs_epi16(temp2, temp1);
  625|  1.64k|    flag3_16x8 = _mm_and_si128(flag3_16x8, flag2_16x8);
  626|       |
  627|       |    // (ABS(q2 - q0) < beta)
  628|  1.64k|    temp1 = _mm_subs_epu8(q0_16x8, q2_16x8);
  629|  1.64k|    temp2 = _mm_subs_epu8(q2_16x8, q0_16x8);
  630|  1.64k|    temp1 = _mm_add_epi8(temp1, temp2);
  631|       |
  632|  1.64k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
  633|  1.64k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
  634|  1.64k|    temp2 = _mm_cmpgt_epi16(Beta_8x16, temp2);
  635|  1.64k|    temp1 = _mm_cmpgt_epi16(Beta_8x16, temp1);
  636|       |
  637|  1.64k|    flag4_16x8 = _mm_packs_epi16(temp2, temp1);
  638|  1.64k|    flag4_16x8 = _mm_and_si128(flag4_16x8, flag2_16x8);
  639|       |
  640|       |    // First 8 pixels
  641|  1.64k|    p3_8x16 = _mm_unpacklo_epi8(p3_16x8, zero);
  642|  1.64k|    p2_8x16 = _mm_unpacklo_epi8(p2_16x8, zero);
  643|  1.64k|    p1_8x16 = _mm_unpacklo_epi8(p1_16x8, zero);
  644|  1.64k|    p0_8x16 = _mm_unpacklo_epi8(p0_16x8, zero);
  645|  1.64k|    q0_8x16 = _mm_unpacklo_epi8(q0_16x8, zero);
  646|  1.64k|    q1_8x16 = _mm_unpacklo_epi8(q1_16x8, zero);
  647|  1.64k|    q2_8x16 = _mm_unpacklo_epi8(q2_16x8, zero);
  648|  1.64k|    q3_8x16 = _mm_unpacklo_epi8(q3_16x8, zero);
  649|       |
  650|       |    // p0_1 and q0_1
  651|  1.64k|    temp1 = _mm_add_epi16(p0_8x16, q1_8x16);
  652|  1.64k|    temp2 = _mm_add_epi16(p1_8x16, q0_8x16);
  653|  1.64k|    temp5 = _mm_add_epi16(temp1, const_val2_16x8);
  654|  1.64k|    temp6 = _mm_add_epi16(temp2, const_val2_16x8);
  655|  1.64k|    temp3 = _mm_slli_epi16(p1_8x16, 1);
  656|  1.64k|    temp4 = _mm_slli_epi16(q1_8x16, 1);
  657|  1.64k|    temp1 = _mm_add_epi16(temp5, temp3);
  658|  1.64k|    temp2 = _mm_add_epi16(temp6, temp4);
  659|  1.64k|    p0_16x8_1 = _mm_srai_epi16(temp1, 2);
  660|  1.64k|    q0_16x8_1 = _mm_srai_epi16(temp2, 2);
  661|       |
  662|       |    // p1_2 and q1_2
  663|  1.64k|    temp6 = _mm_add_epi16(temp6, p0_8x16);
  664|  1.64k|    temp5 = _mm_add_epi16(temp5, q0_8x16);
  665|  1.64k|    temp1 = _mm_add_epi16(temp6, p2_8x16);
  666|  1.64k|    temp2 = _mm_add_epi16(temp5, q2_8x16);
  667|  1.64k|    p1_16x8_2 = _mm_srai_epi16(temp1, 2);
  668|  1.64k|    q1_16x8_2 = _mm_srai_epi16(temp2, 2);
  669|       |
  670|       |    // p0_2 and q0_2
  671|  1.64k|    temp1 = _mm_add_epi16(temp3, p2_8x16);
  672|  1.64k|    temp2 = _mm_add_epi16(temp4, q2_8x16);
  673|  1.64k|    temp1 = _mm_add_epi16(temp1, q1_8x16);
  674|  1.64k|    temp2 = _mm_add_epi16(temp2, p1_8x16);
  675|  1.64k|    temp3 = _mm_add_epi16(p0_8x16, q0_8x16);
  676|  1.64k|    temp3 = _mm_slli_epi16(temp3, 1);
  677|  1.64k|    temp1 = _mm_add_epi16(temp1, temp3);
  678|  1.64k|    temp2 = _mm_add_epi16(temp2, temp3);
  679|  1.64k|    temp1 = _mm_add_epi16(temp1, _mm_set1_epi16(4));
  680|  1.64k|    temp2 = _mm_add_epi16(temp2, _mm_set1_epi16(4));
  681|  1.64k|    p0_16x8_2 = _mm_srai_epi16(temp1, 3);
  682|  1.64k|    q0_16x8_2 = _mm_srai_epi16(temp2, 3);
  683|       |
  684|       |    // p2_2 and q2_2
  685|  1.64k|    temp1 = _mm_add_epi16(temp6, const_val2_16x8);
  686|  1.64k|    temp2 = _mm_add_epi16(temp5, const_val2_16x8);
  687|  1.64k|    temp3 = _mm_slli_epi16(p2_8x16, 1);
  688|  1.64k|    temp4 = _mm_slli_epi16(q2_8x16, 1);
  689|  1.64k|    temp3 = _mm_add_epi16(p2_8x16, temp3);
  690|  1.64k|    temp4 = _mm_add_epi16(q2_8x16, temp4);
  691|  1.64k|    temp5 = _mm_slli_epi16(p3_8x16, 1);
  692|  1.64k|    temp6 = _mm_slli_epi16(q3_8x16, 1);
  693|  1.64k|    temp1 = _mm_add_epi16(temp1, temp3);
  694|  1.64k|    temp2 = _mm_add_epi16(temp2, temp4);
  695|  1.64k|    temp1 = _mm_add_epi16(temp1, temp5);
  696|  1.64k|    temp2 = _mm_add_epi16(temp2, temp6);
  697|  1.64k|    p2_16x8_2 = _mm_srai_epi16(temp1, 3);
  698|  1.64k|    q2_16x8_2 = _mm_srai_epi16(temp2, 3);
  699|       |
  700|       |    // Second 8 pixels and packing with first 8 pixels
  701|  1.64k|    p3_8x16 = _mm_unpackhi_epi8(p3_16x8, zero);
  702|  1.64k|    p2_8x16 = _mm_unpackhi_epi8(p2_16x8, zero);
  703|  1.64k|    p1_8x16 = _mm_unpackhi_epi8(p1_16x8, zero);
  704|  1.64k|    p0_8x16 = _mm_unpackhi_epi8(p0_16x8, zero);
  705|  1.64k|    q0_8x16 = _mm_unpackhi_epi8(q0_16x8, zero);
  706|  1.64k|    q1_8x16 = _mm_unpackhi_epi8(q1_16x8, zero);
  707|  1.64k|    q2_8x16 = _mm_unpackhi_epi8(q2_16x8, zero);
  708|  1.64k|    q3_8x16 = _mm_unpackhi_epi8(q3_16x8, zero);
  709|       |
  710|       |    // p0_1 and q0_1
  711|  1.64k|    temp1 = _mm_add_epi16(p0_8x16, q1_8x16);
  712|  1.64k|    temp2 = _mm_add_epi16(p1_8x16, q0_8x16);
  713|  1.64k|    temp5 = _mm_add_epi16(temp1, const_val2_16x8);
  714|  1.64k|    temp6 = _mm_add_epi16(temp2, const_val2_16x8);
  715|  1.64k|    temp3 = _mm_slli_epi16(p1_8x16, 1);
  716|  1.64k|    temp4 = _mm_slli_epi16(q1_8x16, 1);
  717|  1.64k|    temp1 = _mm_add_epi16(temp5, temp3);
  718|  1.64k|    temp2 = _mm_add_epi16(temp6, temp4);
  719|  1.64k|    temp1 = _mm_srai_epi16(temp1, 2);
  720|  1.64k|    temp2 = _mm_srai_epi16(temp2, 2);
  721|  1.64k|    p0_16x8_1 = _mm_packus_epi16(p0_16x8_1, temp1);
  722|  1.64k|    q0_16x8_1 = _mm_packus_epi16(q0_16x8_1, temp2);
  723|       |
  724|       |    // p1_2 and q1_2
  725|  1.64k|    temp6 = _mm_add_epi16(temp6, p0_8x16);
  726|  1.64k|    temp5 = _mm_add_epi16(temp5, q0_8x16);
  727|  1.64k|    temp1 = _mm_add_epi16(temp6, p2_8x16);
  728|  1.64k|    temp2 = _mm_add_epi16(temp5, q2_8x16);
  729|  1.64k|    temp1 = _mm_srai_epi16(temp1, 2);
  730|  1.64k|    temp2 = _mm_srai_epi16(temp2, 2);
  731|  1.64k|    p1_16x8_2 = _mm_packus_epi16(p1_16x8_2, temp1);
  732|  1.64k|    q1_16x8_2 = _mm_packus_epi16(q1_16x8_2, temp2);
  733|       |
  734|       |    // p0_2 and q0_2
  735|  1.64k|    temp1 = _mm_add_epi16(temp3, p2_8x16);
  736|  1.64k|    temp2 = _mm_add_epi16(temp4, q2_8x16);
  737|  1.64k|    temp1 = _mm_add_epi16(temp1, q1_8x16);
  738|  1.64k|    temp2 = _mm_add_epi16(temp2, p1_8x16);
  739|  1.64k|    temp3 = _mm_add_epi16(p0_8x16, q0_8x16);
  740|  1.64k|    temp3 = _mm_slli_epi16(temp3, 1);
  741|  1.64k|    temp1 = _mm_add_epi16(temp1, temp3);
  742|  1.64k|    temp2 = _mm_add_epi16(temp2, temp3);
  743|  1.64k|    temp1 = _mm_add_epi16(temp1, _mm_set1_epi16(4));
  744|  1.64k|    temp2 = _mm_add_epi16(temp2, _mm_set1_epi16(4));
  745|  1.64k|    temp1 = _mm_srai_epi16(temp1, 3);
  746|  1.64k|    temp2 = _mm_srai_epi16(temp2, 3);
  747|  1.64k|    p0_16x8_2 = _mm_packus_epi16(p0_16x8_2, temp1);
  748|  1.64k|    q0_16x8_2 = _mm_packus_epi16(q0_16x8_2, temp2);
  749|       |
  750|       |    // p2_2 and q2_2
  751|  1.64k|    temp1 = _mm_add_epi16(temp6, const_val2_16x8);
  752|  1.64k|    temp2 = _mm_add_epi16(temp5, const_val2_16x8);
  753|  1.64k|    temp3 = _mm_slli_epi16(p2_8x16, 1);
  754|  1.64k|    temp4 = _mm_slli_epi16(q2_8x16, 1);
  755|  1.64k|    temp3 = _mm_add_epi16(p2_8x16, temp3);
  756|  1.64k|    temp4 = _mm_add_epi16(q2_8x16, temp4);
  757|  1.64k|    temp5 = _mm_slli_epi16(p3_8x16, 1);
  758|  1.64k|    temp6 = _mm_slli_epi16(q3_8x16, 1);
  759|  1.64k|    temp1 = _mm_add_epi16(temp1, temp3);
  760|  1.64k|    temp2 = _mm_add_epi16(temp2, temp4);
  761|  1.64k|    temp1 = _mm_add_epi16(temp1, temp5);
  762|  1.64k|    temp2 = _mm_add_epi16(temp2, temp6);
  763|  1.64k|    temp1 = _mm_srai_epi16(temp1, 3);
  764|  1.64k|    temp2 = _mm_srai_epi16(temp2, 3);
  765|  1.64k|    p2_16x8_2 = _mm_packus_epi16(p2_16x8_2, temp1);
  766|  1.64k|    q2_16x8_2 = _mm_packus_epi16(q2_16x8_2, temp2);
  767|       |
  768|       |    // p0 and q0
  769|  1.64k|    p0_16x8 = _mm_and_si128(p0_16x8,
  770|  1.64k|                            _mm_xor_si128(flag1_16x8, _mm_set1_epi8(0xFF)));
  771|  1.64k|    p0_16x8_1 = _mm_and_si128(p0_16x8_1, flag1_16x8);
  772|  1.64k|    p0_16x8 = _mm_add_epi8(p0_16x8, p0_16x8_1);
  773|  1.64k|    q0_16x8 = _mm_and_si128(q0_16x8,
  774|  1.64k|                            _mm_xor_si128(flag1_16x8, _mm_set1_epi8(0xFF)));
  775|  1.64k|    q0_16x8_1 = _mm_and_si128(q0_16x8_1, flag1_16x8);
  776|  1.64k|    q0_16x8 = _mm_add_epi8(q0_16x8, q0_16x8_1);
  777|       |
  778|       |    // p0 and q0
  779|  1.64k|    p0_16x8 = _mm_and_si128(p0_16x8,
  780|  1.64k|                            _mm_xor_si128(flag3_16x8, _mm_set1_epi8(0xFF)));
  781|  1.64k|    p0_16x8_2 = _mm_and_si128(p0_16x8_2, flag3_16x8);
  782|  1.64k|    p0_16x8 = _mm_add_epi8(p0_16x8, p0_16x8_2);
  783|  1.64k|    q0_16x8 = _mm_and_si128(q0_16x8,
  784|  1.64k|                            _mm_xor_si128(flag4_16x8, _mm_set1_epi8(0xFF)));
  785|  1.64k|    q0_16x8_2 = _mm_and_si128(q0_16x8_2, flag4_16x8);
  786|  1.64k|    q0_16x8 = _mm_add_epi8(q0_16x8, q0_16x8_2);
  787|       |
  788|       |    // p1 and q1
  789|  1.64k|    p1_16x8 = _mm_and_si128(p1_16x8,
  790|  1.64k|                            _mm_xor_si128(flag3_16x8, _mm_set1_epi8(0xFF)));
  791|  1.64k|    p1_16x8_2 = _mm_and_si128(p1_16x8_2, flag3_16x8);
  792|  1.64k|    p1_16x8 = _mm_add_epi8(p1_16x8, p1_16x8_2);
  793|  1.64k|    q1_16x8 = _mm_and_si128(q1_16x8,
  794|  1.64k|                            _mm_xor_si128(flag4_16x8, _mm_set1_epi8(0xFF)));
  795|  1.64k|    q1_16x8_2 = _mm_and_si128(q1_16x8_2, flag4_16x8);
  796|  1.64k|    q1_16x8 = _mm_add_epi8(q1_16x8, q1_16x8_2);
  797|       |
  798|       |    // p2 and q2
  799|  1.64k|    p2_16x8 = _mm_and_si128(p2_16x8,
  800|  1.64k|                            _mm_xor_si128(flag3_16x8, _mm_set1_epi8(0xFF)));
  801|  1.64k|    p2_16x8_2 = _mm_and_si128(p2_16x8_2, flag3_16x8);
  802|  1.64k|    p2_16x8 = _mm_add_epi8(p2_16x8, p2_16x8_2);
  803|  1.64k|    q2_16x8 = _mm_and_si128(q2_16x8,
  804|  1.64k|                            _mm_xor_si128(flag4_16x8, _mm_set1_epi8(0xFF)));
  805|  1.64k|    q2_16x8_2 = _mm_and_si128(q2_16x8_2, flag4_16x8);
  806|  1.64k|    q2_16x8 = _mm_add_epi8(q2_16x8, q2_16x8_2);
  807|       |
  808|  1.64k|    _mm_storeu_si128((__m128i *)(pu1_HorzPixel + i16_posP2), p2_16x8);
  809|  1.64k|    _mm_storeu_si128((__m128i *)(pu1_HorzPixel + i16_posP1), p1_16x8);
  810|  1.64k|    _mm_storeu_si128((__m128i *)(pu1_HorzPixel + i16_posP0), p0_16x8);
  811|       |
  812|  1.64k|    _mm_storeu_si128((__m128i *)(pu1_src), q0_16x8);
  813|  1.64k|    _mm_storeu_si128((__m128i *)(pu1_src + i16_posQ1), q1_16x8);
  814|  1.64k|    _mm_storeu_si128((__m128i *)(pu1_src + i16_posQ2), q2_16x8);
  815|       |
  816|  1.64k|}
ih264_deblk_luma_vert_bslt4_ssse3:
  856|  61.9k|{
  857|  61.9k|    UWORD8 u1_Bs, u1_Bs1;
  858|       |
  859|  61.9k|    WORD32 j = 0;
  860|       |
  861|  61.9k|    __m128i linea, lineb, linec, lined, linee, linef, lineg, lineh;
  862|  61.9k|    __m128i int1, int2, int3, int4, high1, high2;
  863|  61.9k|    __m128i flag, flag1, i_C, i_C0;
  864|  61.9k|    __m128i i_Ap, i_Aq, diff, const1, const2, in_macro, in_macrotemp, temp,
  865|  61.9k|                    temp1;
  866|  61.9k|    __m128i zero = _mm_setzero_si128();
  867|       |
  868|   185k|    for(j = 0; j <= 8 * src_strd; j += 8 * src_strd)
  ------------------
  |  Branch (868:16): [True: 123k, False: 61.9k]
  ------------------
  869|   123k|    {
  870|       |        //Transpose
  871|   123k|        linea = _mm_loadl_epi64((__m128i *)(pu1_src - 3 + j));
  872|   123k|        lineb = _mm_loadl_epi64((__m128i *)(pu1_src - 3 + src_strd + j));
  873|   123k|        linec = _mm_loadl_epi64((__m128i *)(pu1_src - 3 + 2 * src_strd + j));
  874|   123k|        lined = _mm_loadl_epi64((__m128i *)(pu1_src - 3 + 3 * src_strd + j));
  875|       |
  876|   123k|        linea = _mm_unpacklo_epi8(linea, zero);
  877|   123k|        lineb = _mm_unpacklo_epi8(lineb, zero);
  878|   123k|        linec = _mm_unpacklo_epi8(linec, zero);
  879|   123k|        lined = _mm_unpacklo_epi8(lined, zero);
  880|       |
  881|   123k|        int1 = _mm_unpacklo_epi16(linea, lineb);
  882|   123k|        lineb = _mm_unpackhi_epi16(linea, lineb);
  883|       |
  884|   123k|        int2 = _mm_unpacklo_epi16(linec, lined);
  885|   123k|        lined = _mm_unpackhi_epi16(linec, lined);
  886|       |
  887|   123k|        linea = _mm_unpacklo_epi16(int1, int2);
  888|   123k|        int1 = _mm_unpackhi_epi16(int1, int2);
  889|       |
  890|   123k|        linec = _mm_unpacklo_epi16(lineb, lined);
  891|   123k|        high1 = _mm_unpackhi_epi16(lineb, lined);
  892|       |
  893|   123k|        linee = _mm_loadl_epi64((__m128i *)(pu1_src - 3 + 4 * src_strd + j));
  894|   123k|        linef = _mm_loadl_epi64((__m128i *)(pu1_src - 3 + 5 * src_strd + j));
  895|   123k|        lineg = _mm_loadl_epi64((__m128i *)(pu1_src - 3 + 6 * src_strd + j));
  896|   123k|        lineh = _mm_loadl_epi64((__m128i *)(pu1_src - 3 + 7 * src_strd + j));
  897|       |
  898|   123k|        linee = _mm_unpacklo_epi8(linee, zero);
  899|   123k|        linef = _mm_unpacklo_epi8(linef, zero);
  900|   123k|        lineg = _mm_unpacklo_epi8(lineg, zero);
  901|   123k|        lineh = _mm_unpacklo_epi8(lineh, zero);
  902|       |
  903|   123k|        int2 = _mm_unpacklo_epi16(linee, linef);
  904|   123k|        linef = _mm_unpackhi_epi16(linee, linef);
  905|       |
  906|   123k|        int3 = _mm_unpacklo_epi16(lineg, lineh);
  907|   123k|        lineh = _mm_unpackhi_epi16(lineg, lineh);
  908|       |
  909|   123k|        linee = _mm_unpacklo_epi16(int2, int3);
  910|   123k|        int2 = _mm_unpackhi_epi16(int2, int3);
  911|       |
  912|   123k|        lineg = _mm_unpacklo_epi16(linef, lineh);
  913|   123k|        high2 = _mm_unpackhi_epi16(linef, lineh);
  914|       |
  915|   123k|        int4 = _mm_unpacklo_epi16(linea, linee);
  916|   123k|        lineb = _mm_unpackhi_epi16(linea, linee);
  917|       |
  918|   123k|        int3 = _mm_unpacklo_epi16(int1, int2);
  919|   123k|        lined = _mm_unpackhi_epi16(int1, int2);
  920|       |
  921|   123k|        int2 = _mm_unpacklo_epi16(linec, lineg);
  922|   123k|        linef = _mm_unpackhi_epi16(linec, lineg);
  923|       |
  924|   123k|        linea = int4;
  925|   123k|        linec = int3;
  926|   123k|        linee = int2;
  927|       |
  928|   123k|        lineg = _mm_unpacklo_epi16(high1, high2);
  929|   123k|        lineh = _mm_unpackhi_epi16(high1, high2);
  930|       |
  931|       |        //end of transpose
  932|       |
  933|   123k|        u1_Bs = (u4_bs >> 24) & 0xff;
  934|   123k|        u1_Bs1 = (u4_bs >> 16) & 0xff;
  935|   123k|        u4_bs <<= 16;
  936|       |
  937|   123k|        flag1 = _mm_set_epi16(u1_Bs1, u1_Bs, u1_Bs1, u1_Bs, u1_Bs1, u1_Bs,
  938|   123k|                              u1_Bs1, u1_Bs);
  939|   123k|        flag1 = _mm_cmpeq_epi16(flag1, zero); //Set flag to 1s and 0s
  940|   123k|        flag1 = _mm_xor_si128(flag1, _mm_set1_epi16(0xFFFF)); //Invert for required mask
  941|       |
  942|   123k|        i_C0 = _mm_set_epi16(pu1_cliptab[u1_Bs1], pu1_cliptab[u1_Bs],
  943|   123k|                             pu1_cliptab[u1_Bs1], pu1_cliptab[u1_Bs],
  944|   123k|                             pu1_cliptab[u1_Bs1], pu1_cliptab[u1_Bs],
  945|   123k|                             pu1_cliptab[u1_Bs1], pu1_cliptab[u1_Bs]);
  946|       |
  947|   123k|        diff = _mm_subs_epi16(linec, lined); //Condn 1
  948|   123k|        diff = _mm_abs_epi16(diff);
  949|   123k|        const1 = _mm_set1_epi16(alpha);
  950|   123k|        flag = _mm_cmpgt_epi16(const1, diff);
  951|       |
  952|   123k|        diff = _mm_subs_epi16(linee, lined); //Condtn 2
  953|   123k|        diff = _mm_abs_epi16(diff);
  954|   123k|        const1 = _mm_set1_epi16(beta);
  955|   123k|        flag = _mm_and_si128(flag, _mm_cmpgt_epi16(const1, diff));
  956|       |
  957|   123k|        diff = _mm_subs_epi16(lineb, linec); //Condtn 3
  958|   123k|        diff = _mm_abs_epi16(diff);
  959|   123k|        flag = _mm_and_si128(flag, _mm_cmpgt_epi16(const1, diff)); //Const 1= Beta from now on
  960|       |
  961|   123k|        flag = _mm_and_si128(flag, flag1); //Final flag (ui_B condition + other 3 conditions)
  962|       |
  963|       |        //Adding Ap<Beta and Aq<Beta
  964|   123k|        i_Ap = _mm_subs_epi16(linea, linec);
  965|   123k|        i_Ap = _mm_abs_epi16(i_Ap);
  966|   123k|        const2 = _mm_cmpgt_epi16(const1, i_Ap);
  967|   123k|        const2 = _mm_subs_epi16(zero, const2); //Make FFFF=1 and 0000=0
  968|   123k|        i_C = _mm_add_epi16(i_C0, const2);
  969|       |
  970|   123k|        i_Aq = _mm_subs_epi16(linef, lined);
  971|   123k|        i_Aq = _mm_abs_epi16(i_Aq);
  972|   123k|        const2 = _mm_cmpgt_epi16(const1, i_Aq);
  973|   123k|        const2 = _mm_subs_epi16(zero, const2);
  974|   123k|        i_C = _mm_add_epi16(i_C, const2);
  975|       |
  976|       |        //Calculate in_macro
  977|   123k|        diff = _mm_subs_epi16(lined, linec);
  978|   123k|        diff = _mm_slli_epi16(diff, 2);
  979|   123k|        const2 = _mm_subs_epi16(lineb, linee);
  980|   123k|        diff = _mm_add_epi16(diff, const2);
  981|   123k|        const2 = _mm_set1_epi16(4);
  982|   123k|        diff = _mm_add_epi16(diff, const2);
  983|   123k|        in_macro = _mm_srai_epi16(diff, 3);
  984|       |
  985|   123k|        in_macro = _mm_min_epi16(i_C, in_macro); //CLIP3
  986|   123k|        i_C = _mm_subs_epi16(zero, i_C);
  987|   123k|        in_macro = _mm_max_epi16(i_C, in_macro);
  988|       |
  989|       |        //Compute and store
  990|   123k|        in_macrotemp = _mm_add_epi16(linec, in_macro);
  991|   123k|        in_macrotemp = _mm_and_si128(in_macrotemp, flag);
  992|   123k|        temp = _mm_and_si128(linec,
  993|   123k|                             _mm_xor_si128(flag, _mm_set1_epi16(0xFFFF)));
  994|   123k|        temp = _mm_add_epi16(temp, in_macrotemp);
  995|       |        //temp= _mm_packus_epi16 (temp, zero);
  996|       |        //_mm_storel_epi64(uc_HorzPixel+i16_posP0+i, in_macrotemp);
  997|       |
  998|   123k|        in_macrotemp = _mm_subs_epi16(lined, in_macro);
  999|   123k|        in_macrotemp = _mm_and_si128(in_macrotemp, flag);
 1000|   123k|        temp1 = _mm_and_si128(lined,
 1001|   123k|                              _mm_xor_si128(flag, _mm_set1_epi16(0xFFFF)));
 1002|   123k|        temp1 = _mm_add_epi16(temp1, in_macrotemp);
 1003|       |        //temp1= _mm_packus_epi16 (temp1, zero);
 1004|       |        //_mm_storel_epi64(pu1_src+i, in_macrotemp);
 1005|       |
 1006|       |        //If Ap<Beta
 1007|   123k|        flag1 = _mm_cmpgt_epi16(const1, i_Ap);
 1008|   123k|        flag1 = _mm_and_si128(flag, flag1);
 1009|   123k|        in_macrotemp = _mm_add_epi16(linec, lined);
 1010|   123k|        in_macrotemp = _mm_add_epi16(in_macrotemp, _mm_set1_epi16(1));
 1011|   123k|        in_macrotemp = _mm_srai_epi16(in_macrotemp, 1);
 1012|   123k|        in_macro = _mm_add_epi16(in_macrotemp, linea);
 1013|   123k|        in_macro = _mm_subs_epi16(in_macro, _mm_slli_epi16(lineb, 1));
 1014|   123k|        in_macro = _mm_srai_epi16(in_macro, 1);
 1015|       |
 1016|   123k|        in_macro = _mm_min_epi16(i_C0, in_macro); //CLIP3
 1017|   123k|        i_C0 = _mm_subs_epi16(zero, i_C0);
 1018|   123k|        in_macro = _mm_max_epi16(i_C0, in_macro);
 1019|       |
 1020|   123k|        in_macro = _mm_and_si128(in_macro, flag1);
 1021|   123k|        lineb = _mm_add_epi16(lineb, in_macro);
 1022|       |        //in_macro= _mm_packus_epi16 (i_p1, zero);
 1023|       |        //_mm_storel_epi64(uc_HorzPixel+i16_posP1+i, in_macro);
 1024|       |
 1025|   123k|        flag1 = _mm_cmpgt_epi16(const1, i_Aq);
 1026|   123k|        flag1 = _mm_and_si128(flag, flag1);
 1027|   123k|        in_macro = _mm_add_epi16(in_macrotemp, linef);
 1028|   123k|        in_macro = _mm_subs_epi16(in_macro, _mm_slli_epi16(linee, 1));
 1029|   123k|        in_macro = _mm_srai_epi16(in_macro, 1);
 1030|       |
 1031|   123k|        i_C0 = _mm_abs_epi16(i_C0);
 1032|   123k|        in_macro = _mm_min_epi16(i_C0, in_macro); //CLIP3
 1033|   123k|        i_C0 = _mm_subs_epi16(zero, i_C0);
 1034|   123k|        in_macro = _mm_max_epi16(i_C0, in_macro);
 1035|       |
 1036|   123k|        in_macro = _mm_and_si128(in_macro, flag1);
 1037|   123k|        linee = _mm_add_epi16(linee, in_macro);
 1038|       |        //in_macro= _mm_packus_epi16 (i_q1, zero);
 1039|       |        //_mm_storel_epi64(pu1_src+i16_posQ1+i, in_macro);
 1040|   123k|        linec = temp;
 1041|   123k|        lined = temp1;
 1042|       |        //End of filtering
 1043|       |
 1044|   123k|        int1 = _mm_unpacklo_epi16(linea, linee);
 1045|   123k|        linee = _mm_unpackhi_epi16(linea, linee);
 1046|       |
 1047|   123k|        int2 = _mm_unpacklo_epi16(linec, lineg);
 1048|   123k|        lineg = _mm_unpackhi_epi16(linec, lineg);
 1049|       |
 1050|   123k|        linea = _mm_unpacklo_epi16(int1, int2);
 1051|   123k|        int3 = _mm_unpackhi_epi16(int1, int2);
 1052|       |
 1053|   123k|        linec = _mm_unpacklo_epi16(linee, lineg);
 1054|   123k|        lineg = _mm_unpackhi_epi16(linee, lineg);
 1055|       |
 1056|   123k|        int1 = _mm_unpacklo_epi16(lineb, linef);
 1057|   123k|        linef = _mm_unpackhi_epi16(lineb, linef);
 1058|       |
 1059|   123k|        int2 = _mm_unpacklo_epi16(lined, lineh);
 1060|   123k|        lineh = _mm_unpackhi_epi16(lined, lineh);
 1061|       |
 1062|   123k|        lineb = _mm_unpacklo_epi16(int1, int2);
 1063|   123k|        int4 = _mm_unpackhi_epi16(int1, int2);
 1064|       |
 1065|   123k|        lined = _mm_unpacklo_epi16(linef, lineh);
 1066|   123k|        lineh = _mm_unpackhi_epi16(linef, lineh);
 1067|       |
 1068|   123k|        int1 = _mm_unpackhi_epi16(linea, lineb);
 1069|   123k|        linea = _mm_unpacklo_epi16(linea, lineb);
 1070|       |
 1071|   123k|        int2 = _mm_unpacklo_epi16(int3, int4);
 1072|   123k|        high1 = _mm_unpackhi_epi16(int3, int4);
 1073|       |
 1074|   123k|        lineb = _mm_unpacklo_epi16(linec, lined);
 1075|   123k|        linef = _mm_unpackhi_epi16(linec, lined);
 1076|       |
 1077|   123k|        lined = _mm_unpacklo_epi16(lineg, lineh);
 1078|   123k|        lineh = _mm_unpackhi_epi16(lineg, lineh);
 1079|       |
 1080|   123k|        linee = int1;
 1081|   123k|        lineg = high1;
 1082|   123k|        linec = int2;
 1083|       |        //End of inverse transpose
 1084|       |
 1085|       |        //Packs and stores
 1086|   123k|        linea = _mm_packus_epi16(linea, zero);
 1087|   123k|        _mm_storel_epi64((__m128i *)(pu1_src - 3 + j), linea);
 1088|       |
 1089|   123k|        lineb = _mm_packus_epi16(lineb, zero);
 1090|   123k|        _mm_storel_epi64((__m128i *)(pu1_src - 3 + src_strd + j), lineb);
 1091|       |
 1092|   123k|        linec = _mm_packus_epi16(linec, zero);
 1093|   123k|        _mm_storel_epi64((__m128i *)(pu1_src - 3 + 2 * src_strd + j), linec);
 1094|       |
 1095|   123k|        lined = _mm_packus_epi16(lined, zero);
 1096|   123k|        _mm_storel_epi64((__m128i *)(pu1_src - 3 + 3 * src_strd + j), lined);
 1097|       |
 1098|   123k|        linee = _mm_packus_epi16(linee, zero);
 1099|   123k|        _mm_storel_epi64((__m128i *)(pu1_src - 3 + 4 * src_strd + j), linee);
 1100|       |
 1101|   123k|        linef = _mm_packus_epi16(linef, zero);
 1102|   123k|        _mm_storel_epi64((__m128i *)(pu1_src - 3 + 5 * src_strd + j), linef);
 1103|       |
 1104|   123k|        lineg = _mm_packus_epi16(lineg, zero);
 1105|   123k|        _mm_storel_epi64((__m128i *)(pu1_src - 3 + 6 * src_strd + j), lineg);
 1106|       |
 1107|   123k|        lineh = _mm_packus_epi16(lineh, zero);
 1108|   123k|        _mm_storel_epi64((__m128i *)(pu1_src - 3 + 7 * src_strd + j), lineh);
 1109|       |
 1110|   123k|    }
 1111|  61.9k|}
ih264_deblk_luma_horz_bslt4_ssse3:
 1151|  65.2k|{
 1152|  65.2k|    WORD16 i16_posP2, i16_posP1, i16_posP0, i16_posQ1, i16_posQ2;
 1153|  65.2k|    UWORD8 *pu1_HorzPixel;
 1154|  65.2k|    __m128i zero = _mm_setzero_si128();
 1155|  65.2k|    __m128i bs_flag_16x8b, C0_16x8, C0_8x16, C0_hi_8x16, C_8x16, C_hi_8x16;
 1156|  65.2k|    __m128i q0_16x8, q1_16x8, q2_16x8, p0_16x8, p1_16x8, p2_16x8;
 1157|  65.2k|    __m128i temp1, temp2;
 1158|  65.2k|    __m128i Alpha_8x16, Beta_8x16, flag1_16x8, flag2_16x8, flag3_16x8;
 1159|  65.2k|    __m128i in_macro_16x8, in_macro_hi_16x8;
 1160|  65.2k|    __m128i const_val4_8x16;
 1161|  65.2k|    UWORD8 u1_Bs0, u1_Bs1, u1_Bs2, u1_Bs3;
 1162|  65.2k|    UWORD8 clip0, clip1, clip2, clip3;
 1163|       |
 1164|  65.2k|    pu1_HorzPixel = pu1_src - (src_strd << 2);
 1165|       |
 1166|  65.2k|    i16_posQ1 = src_strd;
 1167|  65.2k|    i16_posQ2 = X2(src_strd);
  ------------------
  |  |   91|  65.2k|#define X2(a)   ((a) << 1)
  ------------------
 1168|  65.2k|    i16_posP0 = X3(src_strd);
  ------------------
  |  |   92|  65.2k|#define X3(a)   (((a) << 1) + (a))
  ------------------
 1169|  65.2k|    i16_posP1 = X2(src_strd);
  ------------------
  |  |   91|  65.2k|#define X2(a)   ((a) << 1)
  ------------------
 1170|  65.2k|    i16_posP2 = src_strd;
 1171|       |
 1172|  65.2k|    q0_16x8 = _mm_loadu_si128((__m128i *)(pu1_src));
 1173|  65.2k|    q1_16x8 = _mm_loadu_si128((__m128i *)(pu1_src + i16_posQ1));
 1174|       |
 1175|  65.2k|    u1_Bs0 = (u4_bs >> 24) & 0xff;
 1176|  65.2k|    u1_Bs1 = (u4_bs >> 16) & 0xff;
 1177|  65.2k|    u1_Bs2 = (u4_bs >> 8) & 0xff;
 1178|  65.2k|    u1_Bs3 = (u4_bs >> 0) & 0xff;
 1179|  65.2k|    clip0 = pu1_cliptab[u1_Bs0];
 1180|  65.2k|    clip1 = pu1_cliptab[u1_Bs1];
 1181|  65.2k|    clip2 = pu1_cliptab[u1_Bs2];
 1182|  65.2k|    clip3 = pu1_cliptab[u1_Bs3];
 1183|       |
 1184|  65.2k|    Alpha_8x16 = _mm_set1_epi16(alpha);
 1185|  65.2k|    Beta_8x16 = _mm_set1_epi16(beta);
 1186|       |
 1187|  65.2k|    bs_flag_16x8b = _mm_set_epi8(u1_Bs3, u1_Bs3, u1_Bs3, u1_Bs3, u1_Bs2, u1_Bs2,
 1188|  65.2k|                                 u1_Bs2, u1_Bs2, u1_Bs1, u1_Bs1, u1_Bs1, u1_Bs1,
 1189|  65.2k|                                 u1_Bs0, u1_Bs0, u1_Bs0, u1_Bs0);
 1190|       |
 1191|  65.2k|    C0_16x8 = _mm_set_epi8(clip3, clip3, clip3, clip3, clip2, clip2, clip2,
 1192|  65.2k|                           clip2, clip1, clip1, clip1, clip1, clip0, clip0,
 1193|  65.2k|                           clip0, clip0);
 1194|       |
 1195|  65.2k|    bs_flag_16x8b = _mm_cmpeq_epi8(bs_flag_16x8b, zero);
 1196|  65.2k|    bs_flag_16x8b = _mm_xor_si128(bs_flag_16x8b, _mm_set1_epi8(0xFF)); //Invert for required mask
 1197|  65.2k|    C0_8x16 = _mm_unpacklo_epi8(C0_16x8, zero);
 1198|  65.2k|    C0_hi_8x16 = _mm_unpackhi_epi8(C0_16x8, zero);
 1199|       |
 1200|  65.2k|    p1_16x8 = _mm_loadu_si128((__m128i *)(pu1_HorzPixel + i16_posP1));
 1201|  65.2k|    p0_16x8 = _mm_loadu_si128((__m128i *)(pu1_HorzPixel + i16_posP0));
 1202|  65.2k|    p2_16x8 = _mm_loadu_si128((__m128i *)(pu1_HorzPixel + i16_posP2));
 1203|  65.2k|    q2_16x8 = _mm_loadu_si128((__m128i *)(pu1_src + i16_posQ2));
 1204|       |
 1205|       |    //Cond1 (ABS(p0 - q0) < alpha)
 1206|  65.2k|    temp1 = _mm_subs_epu8(q0_16x8, p0_16x8);
 1207|  65.2k|    temp2 = _mm_subs_epu8(p0_16x8, q0_16x8);
 1208|  65.2k|    temp1 = _mm_add_epi8(temp1, temp2);
 1209|       |
 1210|  65.2k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
 1211|  65.2k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
 1212|       |
 1213|  65.2k|    temp2 = _mm_cmpgt_epi16(Alpha_8x16, temp2);
 1214|  65.2k|    temp1 = _mm_cmpgt_epi16(Alpha_8x16, temp1);
 1215|       |
 1216|  65.2k|    flag1_16x8 = _mm_packs_epi16(temp2, temp1);
 1217|  65.2k|    flag1_16x8 = _mm_and_si128(flag1_16x8, bs_flag_16x8b);
 1218|       |
 1219|       |    //Cond2 (ABS(q1 - q0) < beta)
 1220|  65.2k|    temp1 = _mm_subs_epu8(q0_16x8, q1_16x8);
 1221|  65.2k|    temp2 = _mm_subs_epu8(q1_16x8, q0_16x8);
 1222|  65.2k|    temp1 = _mm_add_epi8(temp1, temp2);
 1223|       |
 1224|  65.2k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
 1225|  65.2k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
 1226|       |
 1227|  65.2k|    temp2 = _mm_cmpgt_epi16(Beta_8x16, temp2);
 1228|  65.2k|    temp1 = _mm_cmpgt_epi16(Beta_8x16, temp1);
 1229|       |
 1230|  65.2k|    flag2_16x8 = _mm_packs_epi16(temp2, temp1);
 1231|       |
 1232|  65.2k|    flag1_16x8 = _mm_and_si128(flag1_16x8, flag2_16x8);
 1233|       |
 1234|       |    //Cond3 (ABS(p1 - p0) < beta)
 1235|  65.2k|    temp1 = _mm_subs_epu8(p0_16x8, p1_16x8);
 1236|  65.2k|    temp2 = _mm_subs_epu8(p1_16x8, p0_16x8);
 1237|  65.2k|    temp1 = _mm_add_epi8(temp1, temp2);
 1238|       |
 1239|  65.2k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
 1240|  65.2k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
 1241|       |
 1242|  65.2k|    temp2 = _mm_cmpgt_epi16(Beta_8x16, temp2);
 1243|  65.2k|    temp1 = _mm_cmpgt_epi16(Beta_8x16, temp1);
 1244|       |
 1245|  65.2k|    flag2_16x8 = _mm_packs_epi16(temp2, temp1);
 1246|       |
 1247|       |    // !((ABS(p0 - q0) < alpha) || (ABS(q1 - q0) < beta) || (ABS(p1 - p0) < beta))
 1248|  65.2k|    flag1_16x8 = _mm_and_si128(flag1_16x8, flag2_16x8);
 1249|       |
 1250|       |    // (ABS(p2 - p0) < beta)
 1251|  65.2k|    temp1 = _mm_subs_epu8(p0_16x8, p2_16x8);
 1252|  65.2k|    temp2 = _mm_subs_epu8(p2_16x8, p0_16x8);
 1253|  65.2k|    temp1 = _mm_add_epi8(temp1, temp2);
 1254|       |
 1255|  65.2k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
 1256|  65.2k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
 1257|  65.2k|    temp2 = _mm_cmpgt_epi16(Beta_8x16, temp2);
 1258|  65.2k|    temp1 = _mm_cmpgt_epi16(Beta_8x16, temp1);
 1259|       |
 1260|  65.2k|    flag2_16x8 = _mm_packs_epi16(temp2, temp1);
 1261|  65.2k|    flag2_16x8 = _mm_and_si128(flag1_16x8, flag2_16x8);
 1262|       |
 1263|  65.2k|    temp2 = _mm_subs_epi16(zero, temp2);
 1264|  65.2k|    temp1 = _mm_subs_epi16(zero, temp1);
 1265|       |
 1266|  65.2k|    C_8x16 = _mm_add_epi16(C0_8x16, temp2);
 1267|  65.2k|    C_hi_8x16 = _mm_add_epi16(C0_hi_8x16, temp1);
 1268|       |
 1269|       |    // (ABS(q2 - q0) < beta)
 1270|  65.2k|    temp1 = _mm_subs_epu8(q0_16x8, q2_16x8);
 1271|  65.2k|    temp2 = _mm_subs_epu8(q2_16x8, q0_16x8);
 1272|  65.2k|    temp1 = _mm_add_epi8(temp1, temp2);
 1273|       |
 1274|  65.2k|    temp2 = _mm_unpacklo_epi8(temp1, zero);
 1275|  65.2k|    temp1 = _mm_unpackhi_epi8(temp1, zero);
 1276|  65.2k|    temp2 = _mm_cmpgt_epi16(Beta_8x16, temp2);
 1277|  65.2k|    temp1 = _mm_cmpgt_epi16(Beta_8x16, temp1);
 1278|       |
 1279|  65.2k|    flag3_16x8 = _mm_packs_epi16(temp2, temp1);
 1280|  65.2k|    flag3_16x8 = _mm_and_si128(flag1_16x8, flag3_16x8);
 1281|       |
 1282|  65.2k|    temp2 = _mm_subs_epi16(zero, temp2);
 1283|  65.2k|    temp1 = _mm_subs_epi16(zero, temp1);
 1284|       |
 1285|  65.2k|    C_8x16 = _mm_add_epi16(C_8x16, temp2);
 1286|  65.2k|    C_hi_8x16 = _mm_add_epi16(C_hi_8x16, temp1);
 1287|       |
 1288|  65.2k|    const_val4_8x16 = _mm_set1_epi16(4);
 1289|  65.2k|    temp1 = _mm_subs_epi16(_mm_unpacklo_epi8(q0_16x8, zero),
 1290|  65.2k|                           _mm_unpacklo_epi8(p0_16x8, zero));
 1291|  65.2k|    temp2 = _mm_subs_epi16(_mm_unpacklo_epi8(p1_16x8, zero),
 1292|  65.2k|                           _mm_unpacklo_epi8(q1_16x8, zero));
 1293|  65.2k|    temp1 = _mm_slli_epi16(temp1, 2);
 1294|  65.2k|    temp1 = _mm_add_epi16(temp1, temp2);
 1295|  65.2k|    temp1 = _mm_add_epi16(temp1, const_val4_8x16);
 1296|  65.2k|    in_macro_16x8 = _mm_srai_epi16(temp1, 3);
 1297|       |
 1298|  65.2k|    temp1 = _mm_subs_epi16(_mm_unpackhi_epi8(q0_16x8, zero),
 1299|  65.2k|                           _mm_unpackhi_epi8(p0_16x8, zero));
 1300|  65.2k|    temp2 = _mm_subs_epi16(_mm_unpackhi_epi8(p1_16x8, zero),
 1301|  65.2k|                           _mm_unpackhi_epi8(q1_16x8, zero));
 1302|  65.2k|    temp1 = _mm_slli_epi16(temp1, 2);
 1303|  65.2k|    temp1 = _mm_add_epi16(temp1, temp2);
 1304|  65.2k|    temp1 = _mm_add_epi16(temp1, const_val4_8x16);
 1305|  65.2k|    in_macro_hi_16x8 = _mm_srai_epi16(temp1, 3);
 1306|       |
 1307|  65.2k|    in_macro_16x8 = _mm_min_epi16(C_8x16, in_macro_16x8); //CLIP3
 1308|  65.2k|    in_macro_hi_16x8 = _mm_min_epi16(C_hi_8x16, in_macro_hi_16x8); //CLIP3
 1309|  65.2k|    C_8x16 = _mm_subs_epi16(zero, C_8x16);
 1310|  65.2k|    C_hi_8x16 = _mm_subs_epi16(zero, C_hi_8x16);
 1311|  65.2k|    in_macro_16x8 = _mm_max_epi16(C_8x16, in_macro_16x8); //CLIP3
 1312|  65.2k|    in_macro_hi_16x8 = _mm_max_epi16(C_hi_8x16, in_macro_hi_16x8); //CLIP3
 1313|       |
 1314|  65.2k|    temp1 = _mm_add_epi16(_mm_unpacklo_epi8(p0_16x8, zero), in_macro_16x8);
 1315|  65.2k|    temp2 = _mm_add_epi16(_mm_unpackhi_epi8(p0_16x8, zero), in_macro_hi_16x8);
 1316|       |
 1317|  65.2k|    temp1 = _mm_packus_epi16(temp1, temp2);
 1318|       |
 1319|  65.2k|    temp1 = _mm_and_si128(temp1, flag1_16x8);
 1320|  65.2k|    temp2 = _mm_and_si128(p0_16x8,
 1321|  65.2k|                          _mm_xor_si128(flag1_16x8, _mm_set1_epi16(0xFFFF)));
 1322|       |
 1323|  65.2k|    temp1 = _mm_add_epi8(temp1, temp2);
 1324|       |
 1325|  65.2k|    _mm_storeu_si128((__m128i *)(pu1_HorzPixel + i16_posP0), temp1);
 1326|       |
 1327|  65.2k|    temp1 = _mm_sub_epi16(_mm_unpacklo_epi8(q0_16x8, zero), in_macro_16x8);
 1328|  65.2k|    temp2 = _mm_sub_epi16(_mm_unpackhi_epi8(q0_16x8, zero), in_macro_hi_16x8);
 1329|       |
 1330|  65.2k|    temp1 = _mm_packus_epi16(temp1, temp2);
 1331|       |
 1332|  65.2k|    temp1 = _mm_and_si128(temp1, flag1_16x8);
 1333|  65.2k|    temp2 = _mm_and_si128(q0_16x8,
 1334|  65.2k|                          _mm_xor_si128(flag1_16x8, _mm_set1_epi16(0xFFFF)));
 1335|       |
 1336|  65.2k|    temp1 = _mm_add_epi8(temp1, temp2);
 1337|  65.2k|    _mm_storeu_si128((__m128i *)(pu1_src), temp1);
 1338|       |
 1339|       |    //if(Ap < Beta)
 1340|  65.2k|    temp1 = _mm_avg_epu16(_mm_unpacklo_epi8(q0_16x8, zero),
 1341|  65.2k|                          _mm_unpacklo_epi8(p0_16x8, zero));
 1342|  65.2k|    temp2 = _mm_slli_epi16(_mm_unpacklo_epi8(p1_16x8, zero), 1);
 1343|       |    //temp2 = _mm_subs_epi16(zero,temp2);
 1344|  65.2k|    temp2 = _mm_subs_epi16(_mm_unpacklo_epi8(p2_16x8, zero), temp2);
 1345|  65.2k|    temp2 = _mm_add_epi16(temp1, temp2);
 1346|  65.2k|    in_macro_16x8 = _mm_srai_epi16(temp2, 1);
 1347|       |
 1348|  65.2k|    temp1 = _mm_avg_epu16(_mm_unpackhi_epi8(q0_16x8, zero),
 1349|  65.2k|                          _mm_unpackhi_epi8(p0_16x8, zero));
 1350|  65.2k|    temp2 = _mm_slli_epi16(_mm_unpackhi_epi8(p1_16x8, zero), 1);
 1351|       |    //temp2 = _mm_subs_epi16(zero,temp2);
 1352|  65.2k|    temp2 = _mm_subs_epi16(_mm_unpackhi_epi8(p2_16x8, zero), temp2);
 1353|  65.2k|    temp2 = _mm_add_epi16(temp1, temp2);
 1354|  65.2k|    in_macro_hi_16x8 = _mm_srai_epi16(temp2, 1);
 1355|       |
 1356|  65.2k|    in_macro_16x8 = _mm_min_epi16(C0_8x16, in_macro_16x8); //CLIP3
 1357|  65.2k|    in_macro_hi_16x8 = _mm_min_epi16(C0_hi_8x16, in_macro_hi_16x8); //CLIP3
 1358|  65.2k|    C0_8x16 = _mm_subs_epi16(zero, C0_8x16);
 1359|  65.2k|    C0_hi_8x16 = _mm_subs_epi16(zero, C0_hi_8x16);
 1360|  65.2k|    in_macro_16x8 = _mm_max_epi16(C0_8x16, in_macro_16x8); //CLIP3
 1361|  65.2k|    in_macro_hi_16x8 = _mm_max_epi16(C0_hi_8x16, in_macro_hi_16x8); //CLIP3
 1362|       |
 1363|  65.2k|    temp1 = _mm_add_epi16(_mm_unpacklo_epi8(p1_16x8, zero), in_macro_16x8);
 1364|  65.2k|    temp2 = _mm_add_epi16(_mm_unpackhi_epi8(p1_16x8, zero), in_macro_hi_16x8);
 1365|       |
 1366|  65.2k|    temp1 = _mm_packus_epi16(temp1, temp2);
 1367|       |
 1368|  65.2k|    temp1 = _mm_and_si128(temp1, flag2_16x8);
 1369|  65.2k|    temp2 = _mm_and_si128(p1_16x8,
 1370|  65.2k|                          _mm_xor_si128(flag2_16x8, _mm_set1_epi16(0xFFFF)));
 1371|  65.2k|    temp1 = _mm_add_epi8(temp1, temp2);
 1372|  65.2k|    _mm_storeu_si128((__m128i *)(pu1_HorzPixel + i16_posP1), temp1);
 1373|       |
 1374|       |    //if(Aq < Beta)
 1375|  65.2k|    temp1 = _mm_avg_epu16(_mm_unpacklo_epi8(q0_16x8, zero),
 1376|  65.2k|                          _mm_unpacklo_epi8(p0_16x8, zero));
 1377|  65.2k|    temp2 = _mm_slli_epi16(_mm_unpacklo_epi8(q1_16x8, zero), 1);
 1378|       |    //temp2 = _mm_slli_epi16 (temp2, 1);
 1379|  65.2k|    temp2 = _mm_subs_epi16(_mm_unpacklo_epi8(q2_16x8, zero), temp2);
 1380|  65.2k|    temp2 = _mm_add_epi16(temp1, temp2);
 1381|  65.2k|    in_macro_16x8 = _mm_srai_epi16(temp2, 1);
 1382|       |
 1383|  65.2k|    temp1 = _mm_avg_epu16(_mm_unpackhi_epi8(q0_16x8, zero),
 1384|  65.2k|                          _mm_unpackhi_epi8(p0_16x8, zero));
 1385|  65.2k|    temp2 = _mm_slli_epi16(_mm_unpackhi_epi8(q1_16x8, zero), 1);
 1386|       |    //temp2 = _mm_slli_epi16 (temp2, 1);
 1387|  65.2k|    temp2 = _mm_subs_epi16(_mm_unpackhi_epi8(q2_16x8, zero), temp2);
 1388|  65.2k|    temp2 = _mm_add_epi16(temp1, temp2);
 1389|  65.2k|    in_macro_hi_16x8 = _mm_srai_epi16(temp2, 1);
 1390|       |
 1391|  65.2k|    in_macro_16x8 = _mm_max_epi16(C0_8x16, in_macro_16x8); //CLIP3
 1392|  65.2k|    in_macro_hi_16x8 = _mm_max_epi16(C0_hi_8x16, in_macro_hi_16x8); //CLIP3
 1393|  65.2k|    C0_8x16 = _mm_subs_epi16(zero, C0_8x16);
 1394|  65.2k|    C0_hi_8x16 = _mm_subs_epi16(zero, C0_hi_8x16);
 1395|  65.2k|    in_macro_16x8 = _mm_min_epi16(C0_8x16, in_macro_16x8); //CLIP3
 1396|  65.2k|    in_macro_hi_16x8 = _mm_min_epi16(C0_hi_8x16, in_macro_hi_16x8); //CLIP3
 1397|       |
 1398|  65.2k|    temp1 = _mm_add_epi16(_mm_unpacklo_epi8(q1_16x8, zero), in_macro_16x8);
 1399|  65.2k|    temp2 = _mm_add_epi16(_mm_unpackhi_epi8(q1_16x8, zero), in_macro_hi_16x8);
 1400|       |
 1401|  65.2k|    temp1 = _mm_packus_epi16(temp1, temp2);
 1402|       |
 1403|  65.2k|    temp1 = _mm_and_si128(temp1, flag3_16x8);
 1404|  65.2k|    temp2 = _mm_and_si128(q1_16x8,
 1405|  65.2k|                          _mm_xor_si128(flag3_16x8, _mm_set1_epi16(0xFFFF)));
 1406|  65.2k|    temp1 = _mm_add_epi8(temp1, temp2);
 1407|       |
 1408|  65.2k|    _mm_storeu_si128((__m128i *)(pu1_src + i16_posQ1), temp1);
 1409|       |
 1410|  65.2k|}

ih264_ihadamard_scaling_4x4_sse42:
   95|    693|{
   96|    693|    __m128i src_r0_r1, src_r2_r3;
   97|    693|    __m128i src_r0, src_r1, src_r2, src_r3;
   98|    693|    __m128i temp0, temp1, temp2, temp3;
   99|    693|    __m128i add_rshift = _mm_set1_epi32((u4_qp_div_6 < 6) ? (1 << (5 - u4_qp_div_6)) : 0);
  ------------------
  |  Branch (99:41): [True: 538, False: 155]
  ------------------
  100|    693|    __m128i mult_val = _mm_set1_epi32(pu2_iscal_mat[0] * pu2_weigh_mat[0]);
  101|    693|    UNUSED (pi4_tmp);
  ------------------
  |  |   45|    693|#define UNUSED(x) ((void)(x))
  ------------------
  102|       |
  103|    693|    src_r0_r1 = _mm_loadu_si128((__m128i *) (pi2_src)); //a00 a01 a02 a03 a10 a11 a12 a13 -- the source matrix 0th,1st row
  104|    693|    src_r2_r3 = _mm_loadu_si128((__m128i *) (pi2_src + 8)); //a20 a21 a22 a23 a30 a31 a32 a33 -- the source matrix 2nd,3rd row
  105|       |    //sign_reg = _mm_cmpgt_epi16(zero_8x16b, src_r0_r1);
  106|    693|    src_r0 = _mm_cvtepi16_epi32(src_r0_r1);
  107|    693|    src_r0_r1 = _mm_srli_si128(src_r0_r1, 8);
  108|    693|    src_r1 = _mm_cvtepi16_epi32(src_r0_r1);
  109|       |
  110|    693|    src_r2 = _mm_cvtepi16_epi32(src_r2_r3);
  111|    693|    src_r2_r3 = _mm_srli_si128(src_r2_r3, 8);
  112|    693|    src_r3 = _mm_cvtepi16_epi32(src_r2_r3);
  113|       |
  114|       |    /* Perform Inverse transform */
  115|       |    /*-------------------------------------------------------------*/
  116|       |    /* IDCT [ Horizontal transformation ]                          */
  117|       |    /*-------------------------------------------------------------*/
  118|       |    // Matrix transpose
  119|       |    /*
  120|       |     *  a0 a1 a2 a3
  121|       |     *  b0 b1 b2 b3
  122|       |     *  c0 c1 c2 c3
  123|       |     *  d0 d1 d2 d3
  124|       |     */
  125|    693|    temp0 = _mm_unpacklo_epi32(src_r0, src_r1);                  //a0 b0 a1 b1
  126|    693|    temp2 = _mm_unpacklo_epi32(src_r2, src_r3);                  //c0 d0 c1 d1
  127|    693|    temp1 = _mm_unpackhi_epi32(src_r0, src_r1);                  //a2 b2 a3 b3
  128|    693|    temp3 = _mm_unpackhi_epi32(src_r2, src_r3);                  //c2 d2 c3 d3
  129|    693|    src_r0 = _mm_unpacklo_epi64(temp0, temp2);                    //a0 b0 c0 d0
  130|    693|    src_r1 = _mm_unpackhi_epi64(temp0, temp2);                    //a1 b1 c1 d1
  131|    693|    src_r2 = _mm_unpacklo_epi64(temp1, temp3);                    //a2 b2 c2 d2
  132|    693|    src_r3 = _mm_unpackhi_epi64(temp1, temp3);                    //a3 b3 c3 d3
  133|       |
  134|    693|    temp0 = _mm_add_epi32(src_r0, src_r3);
  135|    693|    temp1 = _mm_add_epi32(src_r1, src_r2);
  136|    693|    temp2 = _mm_sub_epi32(src_r1, src_r2);
  137|    693|    temp3 = _mm_sub_epi32(src_r0, src_r3);
  138|       |
  139|    693|    src_r0 = _mm_add_epi32(temp0, temp1);
  140|    693|    src_r1 = _mm_add_epi32(temp2, temp3);
  141|    693|    src_r2 = _mm_sub_epi32(temp0, temp1);
  142|    693|    src_r3 = _mm_sub_epi32(temp3, temp2);
  143|       |
  144|       |    /*-------------------------------------------------------------*/
  145|       |    /* IDCT [ Vertical transformation ]                          */
  146|       |    /*-------------------------------------------------------------*/
  147|       |    // Matrix transpose
  148|       |    /*
  149|       |     *  a0 b0 c0 d0
  150|       |     *  a1 b1 c1 d1
  151|       |     *  a2 b2 c2 d2
  152|       |     *  a3 b3 c3 d3
  153|       |     */
  154|    693|    temp0 = _mm_unpacklo_epi32(src_r0, src_r1);                  //a0 a1 b0 b1
  155|    693|    temp2 = _mm_unpacklo_epi32(src_r2, src_r3);                  //a2 a3 b2 b3
  156|    693|    temp1 = _mm_unpackhi_epi32(src_r0, src_r1);                  //c0 c1 d0 d1
  157|    693|    temp3 = _mm_unpackhi_epi32(src_r2, src_r3);                  //c2 c3 d2 d3
  158|    693|    src_r0 = _mm_unpacklo_epi64(temp0, temp2);                   //a0 a1 a2 a3
  159|    693|    src_r1 = _mm_unpackhi_epi64(temp0, temp2);                   //b0 b1 b2 b3
  160|    693|    src_r2 = _mm_unpacklo_epi64(temp1, temp3);                   //c0 c1 c2 c3
  161|    693|    src_r3 = _mm_unpackhi_epi64(temp1, temp3);                   //d0 d1 d2 d3
  162|       |
  163|    693|    temp0 = _mm_add_epi32(src_r0, src_r3);
  164|    693|    temp1 = _mm_add_epi32(src_r1, src_r2);
  165|    693|    temp2 = _mm_sub_epi32(src_r1, src_r2);
  166|    693|    temp3 = _mm_sub_epi32(src_r0, src_r3);
  167|       |
  168|    693|    src_r0 = _mm_add_epi32(temp0, temp1);
  169|    693|    src_r1 = _mm_add_epi32(temp2, temp3);
  170|    693|    src_r2 = _mm_sub_epi32(temp0, temp1);
  171|    693|    src_r3 = _mm_sub_epi32(temp3, temp2);
  172|       |
  173|    693|    src_r0 = _mm_mullo_epi32(src_r0, mult_val);
  174|    693|    src_r1 = _mm_mullo_epi32(src_r1, mult_val);
  175|    693|    src_r2 = _mm_mullo_epi32(src_r2, mult_val);
  176|    693|    src_r3 = _mm_mullo_epi32(src_r3, mult_val);
  177|       |
  178|       |    //Scaling
  179|    693|    if(u4_qp_div_6 >= 6)
  ------------------
  |  Branch (179:8): [True: 155, False: 538]
  ------------------
  180|    155|    {
  181|    155|        src_r0 = _mm_slli_epi32(src_r0, u4_qp_div_6 - 6);
  182|    155|        src_r1 = _mm_slli_epi32(src_r1, u4_qp_div_6 - 6);
  183|    155|        src_r2 = _mm_slli_epi32(src_r2, u4_qp_div_6 - 6);
  184|    155|        src_r3 = _mm_slli_epi32(src_r3, u4_qp_div_6 - 6);
  185|    155|    }
  186|    538|    else
  187|    538|    {
  188|    538|        temp0 = _mm_add_epi32(src_r0, add_rshift);
  189|    538|        temp1 = _mm_add_epi32(src_r1, add_rshift);
  190|    538|        temp2 = _mm_add_epi32(src_r2, add_rshift);
  191|    538|        temp3 = _mm_add_epi32(src_r3, add_rshift);
  192|    538|        src_r0 = _mm_srai_epi32(temp0, 6 - u4_qp_div_6);
  193|    538|        src_r1 = _mm_srai_epi32(temp1, 6 - u4_qp_div_6);
  194|    538|        src_r2 = _mm_srai_epi32(temp2, 6 - u4_qp_div_6);
  195|    538|        src_r3 = _mm_srai_epi32(temp3, 6 - u4_qp_div_6);
  196|    538|    }
  197|    693|    src_r0_r1 = _mm_packs_epi32(src_r0, src_r1);
  198|    693|    src_r2_r3 = _mm_packs_epi32(src_r2, src_r3);
  199|       |
  200|    693|    _mm_storeu_si128((__m128i *) (&pi2_out[0]), src_r0_r1);
  201|    693|    _mm_storeu_si128((__m128i *) (&pi2_out[8]), src_r2_r3);
  202|    693|}

ih264_inter_pred_luma_copy_ssse3:
   98|   318k|{
   99|   318k|    __m128i y_0_16x8b, y_1_16x8b, y_2_16x8b, y_3_16x8b;
  100|       |
  101|   318k|    WORD32 src_strd2, src_strd3, src_strd4, dst_strd2, dst_strd3, dst_strd4;
  102|   318k|    UNUSED(pu1_tmp);
  ------------------
  |  |   45|   318k|#define UNUSED(x) ((void)(x))
  ------------------
  103|   318k|    UNUSED(dydx);
  ------------------
  |  |   45|   318k|#define UNUSED(x) ((void)(x))
  ------------------
  104|       |
  105|   318k|    src_strd2 = src_strd << 1;
  106|   318k|    dst_strd2 = dst_strd << 1;
  107|   318k|    src_strd4 = src_strd << 2;
  108|   318k|    dst_strd4 = dst_strd << 2;
  109|   318k|    src_strd3 = src_strd2 + src_strd;
  110|   318k|    dst_strd3 = dst_strd2 + dst_strd;
  111|       |
  112|   318k|    if(wd == 4)
  ------------------
  |  Branch (112:8): [True: 1.49k, False: 317k]
  ------------------
  113|  1.49k|    {
  114|  1.49k|        do
  115|  2.11k|        {
  116|  2.11k|            *((WORD32 *)(pu1_dst)) =  *((WORD32 *)(pu1_src));
  117|  2.11k|            *((WORD32 *)(pu1_dst + dst_strd)) = *((WORD32 *)(pu1_src + src_strd));
  118|  2.11k|            *((WORD32 *)(pu1_dst + dst_strd2)) = *((WORD32 *)(pu1_src + src_strd2));
  119|  2.11k|            *((WORD32 *)(pu1_dst + dst_strd3)) = *((WORD32 *)(pu1_src + src_strd3));
  120|       |
  121|  2.11k|            ht -= 4;
  122|  2.11k|            pu1_src += src_strd4;
  123|  2.11k|            pu1_dst += dst_strd4;
  124|  2.11k|        }
  125|  2.11k|        while(ht > 0);
  ------------------
  |  Branch (125:15): [True: 622, False: 1.49k]
  ------------------
  126|  1.49k|    }
  127|   317k|    else if(wd == 8)
  ------------------
  |  Branch (127:13): [True: 10.3k, False: 306k]
  ------------------
  128|  10.3k|    {
  129|  10.3k|        do
  130|  24.5k|        {
  131|  24.5k|            y_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  132|  24.5k|            y_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + src_strd));
  133|  24.5k|            y_2_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + src_strd2));
  134|  24.5k|            y_3_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + src_strd3));
  135|       |
  136|  24.5k|            _mm_storel_epi64((__m128i *)pu1_dst, y_0_16x8b);
  137|  24.5k|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), y_1_16x8b);
  138|  24.5k|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd2), y_2_16x8b);
  139|  24.5k|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd3), y_3_16x8b);
  140|       |
  141|  24.5k|            ht -= 4;
  142|  24.5k|            pu1_src += src_strd4;
  143|  24.5k|            pu1_dst += dst_strd4;
  144|  24.5k|        }
  145|  24.5k|        while(ht > 0);
  ------------------
  |  Branch (145:15): [True: 14.2k, False: 10.3k]
  ------------------
  146|  10.3k|    }
  147|   306k|    else // wd == 16
  148|   306k|    {
  149|   306k|        WORD32 src_strd5, src_strd6, src_strd7, src_strd8;
  150|   306k|        WORD32 dst_strd5, dst_strd6, dst_strd7, dst_strd8;
  151|       |
  152|   306k|        __m128i y_4_16x8b, y_5_16x8b, y_6_16x8b, y_7_16x8b;
  153|       |
  154|   306k|        src_strd5 = src_strd2 + src_strd3;
  155|   306k|        dst_strd5 = dst_strd2 + dst_strd3;
  156|   306k|        src_strd6 = src_strd3 << 1;
  157|   306k|        dst_strd6 = dst_strd3 << 1;
  158|   306k|        src_strd7 = src_strd3 + src_strd4;
  159|   306k|        dst_strd7 = dst_strd3 + dst_strd4;
  160|   306k|        src_strd8 = src_strd << 3;
  161|   306k|        dst_strd8 = dst_strd << 3;
  162|       |
  163|   306k|        do
  164|   612k|        {
  165|   612k|            y_0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
  166|   612k|            y_1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));
  167|   612k|            y_2_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd2));
  168|   612k|            y_3_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd3));
  169|   612k|            y_4_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd4));
  170|   612k|            y_5_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd5));
  171|   612k|            y_6_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd6));
  172|   612k|            y_7_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd7));
  173|       |
  174|   612k|            _mm_storeu_si128((__m128i *)pu1_dst, y_0_16x8b);
  175|   612k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), y_1_16x8b);
  176|   612k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd2), y_2_16x8b);
  177|   612k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd3), y_3_16x8b);
  178|   612k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd4), y_4_16x8b);
  179|   612k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd5), y_5_16x8b);
  180|   612k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd6), y_6_16x8b);
  181|   612k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd7), y_7_16x8b);
  182|       |
  183|   612k|            ht -= 8;
  184|   612k|            pu1_src += src_strd8;
  185|   612k|            pu1_dst += dst_strd8;
  186|   612k|        }
  187|   612k|        while(ht > 0);
  ------------------
  |  Branch (187:15): [True: 305k, False: 306k]
  ------------------
  188|   306k|    }
  189|   318k|}
ih264_inter_pred_luma_horz_ssse3:
  224|  3.74k|{
  225|  3.74k|    __m128i coeff0_1_16x8b, coeff2_3_16x8b, coeff4_5_16x8b;
  226|  3.74k|    __m128i const_val16_8x16b;
  227|       |
  228|  3.74k|    UNUSED(pu1_tmp);
  ------------------
  |  |   45|  3.74k|#define UNUSED(x) ((void)(x))
  ------------------
  229|  3.74k|    UNUSED(dydx);
  ------------------
  |  |   45|  3.74k|#define UNUSED(x) ((void)(x))
  ------------------
  230|       |
  231|  3.74k|    pu1_src -= 2; // the filter input starts from x[-2] (till x[3])
  232|       |
  233|  3.74k|    coeff0_1_16x8b = _mm_set1_epi32(0xFB01FB01); //c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1
  234|  3.74k|    coeff2_3_16x8b = _mm_set1_epi32(0x14141414); //c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3
  235|  3.74k|    coeff4_5_16x8b = _mm_set1_epi32(0x01FB01FB); //c4 c5 c4 c5 c4 c5 c4 c5 c4 c5 c4 c5 c4 c5 c4 c5
  236|       |                                                 //c0 = c5 = 1, c1 = c4 = -5, c2 = c3 = 20
  237|  3.74k|    const_val16_8x16b = _mm_set1_epi16(16);
  238|       |
  239|  3.74k|    if(wd == 4)
  ------------------
  |  Branch (239:8): [True: 1.48k, False: 2.26k]
  ------------------
  240|  1.48k|    {
  241|  1.48k|        __m128i src_r0_16x8b, src_r1_16x8b, src_r0r1_16x8b;
  242|  1.48k|        __m128i src_r0_sht_16x8b, src_r1_sht_16x8b;
  243|       |
  244|  1.48k|        __m128i res_r0r1_t1_8x16b, res_r0r1_t2_8x16b, res_r0r1_t3_8x16b;
  245|  1.48k|        __m128i res_r0r1_16x8b;
  246|       |
  247|       |        //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
  248|       |        //Row1 : b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
  249|       |
  250|  1.48k|        do
  251|  3.91k|        {
  252|  3.91k|            src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);                     //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
  253|  3.91k|            src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));        //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9....b15
  254|       |
  255|  3.91k|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                     //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
  256|  3.91k|            src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                     //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
  257|       |
  258|  3.91k|            src_r0_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);       //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
  259|  3.91k|            src_r1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);       //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
  260|       |
  261|  3.91k|            src_r0r1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);        //a0 a1 a1 a2 a2 a3 a3 a4 b0 b1 b1 b2 b2 b3 b3 b4
  262|  3.91k|            res_r0r1_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);  //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
  263|       |                                                                                    //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
  264|       |
  265|  3.91k|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 4);                         //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8  0  0  0  0
  266|  3.91k|            src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 4);                         //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8  0  0  0  0
  267|       |
  268|  3.91k|            src_r0r1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);        //a2 a3 a3 a4 a4 a5 a5 a6 b2 b3 b3 b4 b4 b5 b5 b6
  269|  3.91k|            res_r0r1_t2_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff2_3_16x8b);  //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
  270|       |                                                                                    //b2*c2+b3*c3 b3*c2+b4*c3 b4*c2+b5*c3 b5*c2+b6*c3
  271|       |
  272|  3.91k|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 4);                         //a4 a5 a5 a6 a6 a7 a7 a8  0  0  0  0  0  0  0  0
  273|  3.91k|            src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 4);                         //b4 b5 b5 b6 b6 b7 b7 b8  0  0  0  0  0  0  0  0
  274|       |
  275|  3.91k|            src_r0r1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);        //a4 a5 a5 a6 a6 a7 a7 a8 b4 b5 b5 b6 b6 b7 b7 b8
  276|  3.91k|            res_r0r1_t3_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff4_5_16x8b);  //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
  277|       |                                                                                    //b4*c4+b5*c5 b5*c4+b6*c5 b4*c6+b7*c5 b7*c4+b8*c5
  278|       |
  279|  3.91k|            res_r0r1_t1_8x16b = _mm_add_epi16(res_r0r1_t1_8x16b, res_r0r1_t2_8x16b);
  280|  3.91k|            res_r0r1_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_r0r1_t3_8x16b);
  281|  3.91k|            res_r0r1_t1_8x16b = _mm_add_epi16(res_r0r1_t1_8x16b, res_r0r1_t3_8x16b); //a0*c0+a1*c1+a2*c2+a3*c3+a4*a4+a5*c5 + 16;
  282|       |                                                                                     //a1*c0+a2*c1+a2*c2+a3*c3+a5*a4+a6*c5 + 16;
  283|       |                                                                                     //a2*c0+a3*c1+a4*c2+a5*c3+a6*a4+a7*c5 + 16;
  284|       |                                                                                     //a3*c0+a4*c1+a5*c2+a6*c3+a6*a4+a8*c5 + 16;
  285|       |                                                                                     //b0*c0+b1*c1+b2*c2+b3*c3+b4*b4+b5*c5 + 16;
  286|       |                                                                                     //b1*c0+b2*c1+b2*c2+b3*c3+b5*b4+b6*c5 + 16;
  287|       |                                                                                     //b2*c0+b3*c1+b4*c2+b5*c3+b6*b4+b7*c5 + 16;
  288|       |                                                                                     //b3*c0+b4*c1+b5*c2+b6*c3+b6*b4+b8*c5 + 16;
  289|       |
  290|  3.91k|            res_r0r1_t1_8x16b = _mm_srai_epi16(res_r0r1_t1_8x16b, 5);                //shifting right by 5 bits.
  291|       |
  292|  3.91k|            res_r0r1_16x8b = _mm_packus_epi16(res_r0r1_t1_8x16b, res_r0r1_t1_8x16b);
  293|       |
  294|  3.91k|            *((WORD32 *)(pu1_dst)) = _mm_cvtsi128_si32(res_r0r1_16x8b);
  295|  3.91k|            res_r0r1_16x8b = _mm_srli_si128(res_r0r1_16x8b, 4);
  296|  3.91k|            *((WORD32 *)(pu1_dst + dst_strd)) = _mm_cvtsi128_si32(res_r0r1_16x8b);
  297|       |
  298|  3.91k|            ht -= 2;
  299|  3.91k|            pu1_src += src_strd << 1;
  300|  3.91k|            pu1_dst += dst_strd << 1;
  301|  3.91k|        }
  302|  3.91k|        while(ht > 0);
  ------------------
  |  Branch (302:15): [True: 2.43k, False: 1.48k]
  ------------------
  303|  1.48k|    }
  304|  2.26k|    else if(wd == 8)
  ------------------
  |  Branch (304:13): [True: 1.01k, False: 1.24k]
  ------------------
  305|  1.01k|    {
  306|  1.01k|        __m128i src_r0_16x8b, src_r1_16x8b, src_r0_sht_16x8b, src_r1_sht_16x8b;
  307|  1.01k|        __m128i src_r0_t1_16x8b, src_r1_t1_16x8b;
  308|       |
  309|  1.01k|        __m128i res_r0_t1_8x16b, res_r0_t2_8x16b, res_r0_t3_8x16b;
  310|  1.01k|        __m128i res_r1_t1_8x16b, res_r1_t2_8x16b, res_r1_t3_8x16b;
  311|       |
  312|       |        //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
  313|       |        //Row1 : b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
  314|       |
  315|  1.01k|        do
  316|  6.52k|        {
  317|  6.52k|            src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);                   //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
  318|  6.52k|            src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));      //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9....b15
  319|       |
  320|  6.52k|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                   //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
  321|  6.52k|            src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                   //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
  322|       |
  323|  6.52k|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);  //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
  324|  6.52k|            src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);  //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
  325|       |
  326|  6.52k|            res_r0_t1_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff0_1_16x8b); //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
  327|       |                                                                                  //a4*c0+a5*c1 a5*c0+a6*c1 a6*c0+a7*c1 a7*c0+a8*c1
  328|  6.52k|            res_r1_t1_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff0_1_16x8b); //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
  329|       |                                                                                  //b4*c0+b5*c1 b5*c0+b6*c1 b6*c0+b7*c1 b7*c0+b8*c1
  330|       |
  331|  6.52k|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                       //a2 a3 a4 a5 a6 a7 a8 a9....a15 0 0
  332|  6.52k|            src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                       //b2 b3 b4 b5 b6 b7 b8 b9....b15 0 0
  333|       |
  334|  6.52k|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);               //a3 a4 a5 a6 a7 a8 a9....a15 0  0  0
  335|  6.52k|            src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);               //b3 b4 b5 b6 b7 b8 b9....b15 0  0  0
  336|       |
  337|  6.52k|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);  //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10
  338|  6.52k|            src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);  //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8 a8 a9 a9 a10
  339|       |
  340|  6.52k|            res_r0_t2_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff2_3_16x8b); //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
  341|       |                                                                                  //a6*c2+a7*c3 a7*c2+a8*c3 a8*c2+a9*c3 a9*c2+a10*c3
  342|  6.52k|            res_r1_t2_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff2_3_16x8b); //b2*c2+b3*c3 b3*c2+b4*c3 b2*c4+b5*c3 b5*c2+b6*c3
  343|       |                                                                                  //b6*c2+b7*c3 b7*c2+b8*c3 b8*c2+b9*c3 b9*c2+b10*c3
  344|       |
  345|  6.52k|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                       //a4 a5 a6 a7 a8 a9....a15 0  0  0  0
  346|  6.52k|            src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                       //b4 b5 b6 b7 b8 b9....b15 0  0  0  0
  347|       |
  348|  6.52k|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);               //a5 a6 a7 a8 a9....a15 0  0  0  0  0
  349|  6.52k|            src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);               //b5 b6 b7 b8 b9....b15 0  0  0  0  0
  350|       |
  351|  6.52k|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);  //a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10 a10 a11 a11 a12
  352|  6.52k|            src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);  //b4 b5 b5 b6 b6 b7 b7 b8 b8 b9 b9 b10 b10 b11 b11 b12
  353|       |
  354|  6.52k|            res_r0_t3_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff4_5_16x8b); //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
  355|       |                                                                                  //a8*c4+a9*c5 a9*c4+a10*c5 a10*c4+a11*c5 a11*c4+a12*c5
  356|  6.52k|            res_r1_t3_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff4_5_16x8b); //b4*c4+b5*c5 b5*c4+b6*c5 b6*c4+b7*c5 b7*c4+b8*c5
  357|       |                                                                                  //b8*c4+b9*c5 b9*c4+b10*c5 b10*c4+b11*c5 b11*c4+b12*c5
  358|  6.52k|            res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t2_8x16b);
  359|  6.52k|            res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t2_8x16b);
  360|  6.52k|            res_r0_t3_8x16b = _mm_add_epi16(res_r0_t3_8x16b, const_val16_8x16b);
  361|  6.52k|            res_r1_t3_8x16b = _mm_add_epi16(res_r1_t3_8x16b, const_val16_8x16b);
  362|  6.52k|            res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t3_8x16b);
  363|  6.52k|            res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t3_8x16b);
  364|       |
  365|  6.52k|            res_r0_t1_8x16b = _mm_srai_epi16(res_r0_t1_8x16b, 5);                 //shifting right by 5 bits.
  366|  6.52k|            res_r1_t1_8x16b = _mm_srai_epi16(res_r1_t1_8x16b, 5);
  367|       |
  368|  6.52k|            src_r0_16x8b = _mm_packus_epi16(res_r0_t1_8x16b, res_r0_t1_8x16b);
  369|  6.52k|            src_r1_16x8b = _mm_packus_epi16(res_r1_t1_8x16b, res_r1_t1_8x16b);
  370|       |
  371|  6.52k|            _mm_storel_epi64((__m128i *)pu1_dst, src_r0_16x8b);
  372|  6.52k|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), src_r1_16x8b);
  373|       |
  374|  6.52k|            ht -= 2;
  375|  6.52k|            pu1_src += src_strd << 1;
  376|  6.52k|            pu1_dst += dst_strd << 1;
  377|  6.52k|        }
  378|  6.52k|        while(ht > 0);
  ------------------
  |  Branch (378:15): [True: 5.50k, False: 1.01k]
  ------------------
  379|  1.01k|    }
  380|  1.24k|    else // wd == 16
  381|  1.24k|    {
  382|  1.24k|        __m128i src_r0_16x8b, src_r1_16x8b, src_r0_sht_16x8b, src_r1_sht_16x8b;
  383|  1.24k|        __m128i src_r0_t1_16x8b, src_r1_t1_16x8b;
  384|       |
  385|  1.24k|        __m128i res_r0_t1_8x16b, res_r0_t2_8x16b, res_r0_t3_8x16b;
  386|  1.24k|        __m128i res_r1_t1_8x16b, res_r1_t2_8x16b, res_r1_t3_8x16b;
  387|       |
  388|       |        //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
  389|       |        //Row0 :                         b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
  390|       |        //b0 is same a8. Similarly other bn pixels are same as a(n+8) pixels.
  391|       |
  392|  1.24k|        do
  393|  17.6k|        {
  394|  17.6k|            src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);                  //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
  395|  17.6k|            src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + 8));            //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9....b15
  396|       |
  397|  17.6k|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                   //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
  398|  17.6k|            src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                   //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
  399|       |
  400|  17.6k|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);  //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
  401|  17.6k|            src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);  //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
  402|       |
  403|  17.6k|            res_r0_t1_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff0_1_16x8b); //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
  404|       |                                                                                  //a4*c0+a5*c1 a5*c0+a6*c1 a6*c0+a7*c1 a7*c0+a8*c1
  405|  17.6k|            res_r1_t1_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff0_1_16x8b); //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
  406|       |                                                                                  //b4*c0+b5*c1 b5*c0+b6*c1 b6*c0+b7*c1 b7*c0+b8*c1
  407|       |
  408|  17.6k|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                       //a2 a3 a4 a5 a6 a7 a8 a9....a15 0 0
  409|  17.6k|            src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                       //b2 b3 b4 b5 b6 b7 b8 b9....b15 0 0
  410|       |
  411|  17.6k|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);               //a3 a4 a5 a6 a7 a8 a9....a15 0  0  0
  412|  17.6k|            src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);               //b3 b4 b5 b6 b7 b8 b9....b15 0  0  0
  413|       |
  414|  17.6k|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);  //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10
  415|  17.6k|            src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);  //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8 a8 a9 a9 a10
  416|       |
  417|  17.6k|            res_r0_t2_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff2_3_16x8b); //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
  418|       |                                                                                  //a6*c2+a7*c3 a7*c2+a8*c3 a8*c2+a9*c3 a9*c2+a10*c3
  419|  17.6k|            res_r1_t2_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff2_3_16x8b); //b2*c2+b3*c3 b3*c2+b4*c3 b2*c4+b5*c3 b5*c2+b6*c3
  420|       |                                                                                  //b6*c2+b7*c3 b7*c2+b8*c3 b8*c2+b9*c3 b9*c2+b10*c3
  421|       |
  422|  17.6k|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                       //a4 a5 a6 a7 a8 a9....a15 0  0  0  0
  423|  17.6k|            src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                       //b4 b5 b6 b7 b8 b9....b15 0  0  0  0
  424|       |
  425|  17.6k|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);               //a5 a6 a7 a8 a9....a15 0  0  0  0  0
  426|  17.6k|            src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);               //b5 b6 b7 b8 b9....b15 0  0  0  0  0
  427|       |
  428|  17.6k|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);  //a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10 a10 a11 a11 a12
  429|  17.6k|            src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);  //b4 b5 b5 b6 b6 b7 b7 b8 b8 b9 b9 b10 b10 b11 b11 b12
  430|       |
  431|  17.6k|            res_r0_t3_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff4_5_16x8b); //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
  432|       |                                                                                  //a8*c4+a9*c5 a9*c4+a10*c5 a10*c4+a11*c5 a11*c4+a12*c5
  433|  17.6k|            res_r1_t3_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff4_5_16x8b); //b4*c4+b5*c5 b5*c4+b6*c5 b6*c4+b7*c5 b7*c4+b8*c5
  434|       |                                                                                  //b8*c4+b9*c5 b9*c4+b10*c5 b10*c4+b11*c5 b11*c4+b12*c5
  435|  17.6k|            res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t2_8x16b);
  436|  17.6k|            res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t2_8x16b);
  437|  17.6k|            res_r0_t3_8x16b = _mm_add_epi16(res_r0_t3_8x16b, const_val16_8x16b);
  438|  17.6k|            res_r1_t3_8x16b = _mm_add_epi16(res_r1_t3_8x16b, const_val16_8x16b);
  439|  17.6k|            res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t3_8x16b);
  440|  17.6k|            res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t3_8x16b);
  441|       |
  442|  17.6k|            res_r0_t1_8x16b = _mm_srai_epi16(res_r0_t1_8x16b, 5);                 //shifting right by 5 bits.
  443|  17.6k|            res_r1_t1_8x16b = _mm_srai_epi16(res_r1_t1_8x16b, 5);
  444|       |
  445|  17.6k|            src_r0_16x8b = _mm_packus_epi16(res_r0_t1_8x16b, res_r1_t1_8x16b);
  446|  17.6k|            _mm_storeu_si128((__m128i *)pu1_dst, src_r0_16x8b);
  447|       |
  448|  17.6k|            ht--;
  449|  17.6k|            pu1_src += src_strd;
  450|  17.6k|            pu1_dst += dst_strd;
  451|  17.6k|        }
  452|  17.6k|        while(ht > 0);
  ------------------
  |  Branch (452:15): [True: 16.4k, False: 1.24k]
  ------------------
  453|  1.24k|    }
  454|  3.74k|}
ih264_inter_pred_luma_vert_ssse3:
  489|  1.85k|{
  490|  1.85k|    __m128i src_r0_16x8b, src_r1_16x8b, src_r2_16x8b, src_r3_16x8b, src_r4_16x8b;
  491|  1.85k|    __m128i src_r5_16x8b, src_r6_16x8b;
  492|  1.85k|    __m128i src_r0r1_16x8b, src_r2r3_16x8b, src_r4r5_16x8b;
  493|       |
  494|  1.85k|    __m128i res_16x8b, res_t1_8x16b, res_t2_8x16b, res_t3_8x16b;
  495|       |
  496|  1.85k|    __m128i coeff0_1_16x8b, coeff2_3_16x8b, coeff4_5_16x8b;
  497|  1.85k|    __m128i const_val16_8x16b;
  498|       |
  499|  1.85k|    UNUSED(pu1_tmp);
  ------------------
  |  |   45|  1.85k|#define UNUSED(x) ((void)(x))
  ------------------
  500|  1.85k|    UNUSED(dydx);
  ------------------
  |  |   45|  1.85k|#define UNUSED(x) ((void)(x))
  ------------------
  501|       |
  502|  1.85k|    coeff0_1_16x8b = _mm_set1_epi32(0xFB01FB01); //c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1
  503|  1.85k|    coeff2_3_16x8b = _mm_set1_epi32(0x14141414); //c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3
  504|  1.85k|    coeff4_5_16x8b = _mm_set1_epi32(0x01FB01FB); //c4 c5 c4 c5 c4 c5 c4 c5 c4 c5 c4 c5 c4 c5 c4 c5
  505|       |                                                 //c0 = c5 = 1, c1 = c4 = -5, c2 = c3 = 20
  506|  1.85k|    const_val16_8x16b = _mm_set1_epi16(16);
  507|       |
  508|  1.85k|    pu1_src -= src_strd << 1; // the filter input starts from x[-2] (till x[3])
  509|       |
  510|  1.85k|    if(wd == 4)
  ------------------
  |  Branch (510:8): [True: 468, False: 1.38k]
  ------------------
  511|    468|    {
  512|       |        //Epilogue: Load all the pred rows except sixth and seventh row
  513|       |        //          for the first and second row processing.
  514|    468|        src_r0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  515|    468|        pu1_src += src_strd;
  516|    468|        src_r1_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  517|    468|        pu1_src += src_strd;
  518|    468|        src_r2_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  519|    468|        pu1_src += src_strd;
  520|    468|        src_r3_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  521|    468|        pu1_src += src_strd;
  522|    468|        src_r4_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  523|    468|        pu1_src += src_strd;
  524|       |
  525|    468|        src_r0_16x8b = _mm_unpacklo_epi32(src_r0_16x8b, src_r1_16x8b);
  526|    468|        src_r1_16x8b = _mm_unpacklo_epi32(src_r1_16x8b, src_r2_16x8b);
  527|    468|        src_r2_16x8b = _mm_unpacklo_epi32(src_r2_16x8b, src_r3_16x8b);
  528|    468|        src_r3_16x8b = _mm_unpacklo_epi32(src_r3_16x8b, src_r4_16x8b);
  529|       |
  530|    468|        do
  531|  1.56k|        {
  532|  1.56k|            src_r5_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  533|  1.56k|            src_r6_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + src_strd));
  534|       |
  535|  1.56k|            src_r4_16x8b = _mm_unpacklo_epi32(src_r4_16x8b, src_r5_16x8b);
  536|  1.56k|            src_r5_16x8b = _mm_unpacklo_epi32(src_r5_16x8b, src_r6_16x8b);
  537|       |
  538|  1.56k|            src_r0r1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r1_16x8b);
  539|  1.56k|            src_r2r3_16x8b = _mm_unpacklo_epi8(src_r2_16x8b, src_r3_16x8b);
  540|  1.56k|            src_r4r5_16x8b = _mm_unpacklo_epi8(src_r4_16x8b, src_r5_16x8b);
  541|       |
  542|  1.56k|            res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
  543|  1.56k|            res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
  544|  1.56k|            res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
  545|       |
  546|  1.56k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
  547|  1.56k|            res_t3_8x16b = _mm_add_epi16(res_t3_8x16b, const_val16_8x16b);
  548|  1.56k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
  549|       |
  550|  1.56k|            res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
  551|  1.56k|            res_16x8b = _mm_packus_epi16(res_t1_8x16b, res_t1_8x16b);
  552|       |
  553|  1.56k|            *((WORD32 *)(pu1_dst)) = _mm_cvtsi128_si32(res_16x8b);
  554|  1.56k|            res_16x8b = _mm_srli_si128(res_16x8b, 4);
  555|  1.56k|            *((WORD32 *)(pu1_dst + dst_strd)) = _mm_cvtsi128_si32(res_16x8b);
  556|       |
  557|  1.56k|            src_r0_16x8b = src_r2_16x8b;
  558|  1.56k|            src_r1_16x8b = src_r3_16x8b;
  559|  1.56k|            src_r2_16x8b = src_r4_16x8b;
  560|  1.56k|            src_r3_16x8b = src_r5_16x8b;
  561|  1.56k|            src_r4_16x8b = src_r6_16x8b;
  562|       |
  563|  1.56k|            ht -= 2;
  564|  1.56k|            pu1_src += src_strd << 1;
  565|  1.56k|            pu1_dst += dst_strd << 1;
  566|  1.56k|        }
  567|  1.56k|        while(ht > 0);
  ------------------
  |  Branch (567:15): [True: 1.09k, False: 468]
  ------------------
  568|    468|    }
  569|       |
  570|  1.38k|    else if(wd == 8)
  ------------------
  |  Branch (570:13): [True: 824, False: 561]
  ------------------
  571|    824|    {
  572|       |        //Epilogue: Load all the pred rows except sixth and seventh row
  573|       |        //          for the first and second row processing.
  574|    824|        src_r0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  575|    824|        pu1_src += src_strd;
  576|    824|        src_r1_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  577|    824|        pu1_src += src_strd;
  578|    824|        src_r2_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  579|    824|        pu1_src += src_strd;
  580|    824|        src_r3_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  581|    824|        pu1_src += src_strd;
  582|    824|        src_r4_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  583|    824|        pu1_src += src_strd;
  584|       |
  585|    824|        src_r0_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);
  586|    824|        src_r1_16x8b = _mm_unpacklo_epi64(src_r1_16x8b, src_r2_16x8b);
  587|    824|        src_r2_16x8b = _mm_unpacklo_epi64(src_r2_16x8b, src_r3_16x8b);
  588|    824|        src_r3_16x8b = _mm_unpacklo_epi64(src_r3_16x8b, src_r4_16x8b);
  589|       |
  590|    824|        do
  591|  4.38k|        {
  592|  4.38k|            src_r5_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  593|  4.38k|            src_r6_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + src_strd));
  594|       |
  595|  4.38k|            src_r4_16x8b = _mm_unpacklo_epi64(src_r4_16x8b, src_r5_16x8b);
  596|  4.38k|            src_r5_16x8b = _mm_unpacklo_epi64(src_r5_16x8b, src_r6_16x8b);
  597|       |
  598|  4.38k|            src_r0r1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r1_16x8b);
  599|  4.38k|            src_r2r3_16x8b = _mm_unpacklo_epi8(src_r2_16x8b, src_r3_16x8b);
  600|  4.38k|            src_r4r5_16x8b = _mm_unpacklo_epi8(src_r4_16x8b, src_r5_16x8b);
  601|       |
  602|  4.38k|            res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
  603|  4.38k|            res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
  604|  4.38k|            res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
  605|       |
  606|  4.38k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
  607|  4.38k|            res_t3_8x16b = _mm_add_epi16(res_t3_8x16b, const_val16_8x16b);
  608|  4.38k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
  609|       |
  610|  4.38k|            res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
  611|  4.38k|            res_16x8b = _mm_packus_epi16(res_t1_8x16b, res_t1_8x16b);
  612|       |
  613|  4.38k|            _mm_storel_epi64((__m128i *)pu1_dst, res_16x8b);
  614|       |
  615|  4.38k|            src_r0r1_16x8b = _mm_unpackhi_epi8(src_r0_16x8b, src_r1_16x8b);
  616|  4.38k|            src_r2r3_16x8b = _mm_unpackhi_epi8(src_r2_16x8b, src_r3_16x8b);
  617|  4.38k|            src_r4r5_16x8b = _mm_unpackhi_epi8(src_r4_16x8b, src_r5_16x8b);
  618|       |
  619|  4.38k|            res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
  620|  4.38k|            res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
  621|  4.38k|            res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
  622|       |
  623|  4.38k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
  624|  4.38k|            res_t3_8x16b = _mm_add_epi16(res_t3_8x16b, const_val16_8x16b);
  625|  4.38k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
  626|       |
  627|  4.38k|            res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
  628|  4.38k|            res_16x8b = _mm_packus_epi16(res_t1_8x16b, res_t1_8x16b);
  629|       |
  630|  4.38k|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), res_16x8b);
  631|       |
  632|  4.38k|            src_r0_16x8b = src_r2_16x8b;
  633|  4.38k|            src_r1_16x8b = src_r3_16x8b;
  634|  4.38k|            src_r2_16x8b = src_r4_16x8b;
  635|  4.38k|            src_r3_16x8b = src_r5_16x8b;
  636|  4.38k|            src_r4_16x8b = src_r6_16x8b;
  637|       |
  638|  4.38k|            ht -= 2;
  639|  4.38k|            pu1_src += src_strd << 1;
  640|  4.38k|            pu1_dst += dst_strd << 1;
  641|  4.38k|        }
  642|  4.38k|        while(ht > 0);
  ------------------
  |  Branch (642:15): [True: 3.56k, False: 824]
  ------------------
  643|    824|    }
  644|    561|    else // wd == 16
  645|    561|    {
  646|    561|        __m128i res_t0_8x16b;
  647|       |
  648|       |        //Epilogue: Load all the pred rows except sixth and seventh row
  649|       |        //          for the first and second row processing.
  650|    561|        src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
  651|    561|        pu1_src += src_strd;
  652|    561|        src_r1_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
  653|    561|        pu1_src += src_strd;
  654|    561|        src_r2_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
  655|    561|        pu1_src += src_strd;
  656|    561|        src_r3_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
  657|    561|        pu1_src += src_strd;
  658|    561|        src_r4_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
  659|    561|        pu1_src += src_strd;
  660|       |
  661|    561|        do
  662|  4.02k|        {
  663|  4.02k|            src_r5_16x8b  = _mm_loadu_si128((__m128i *)pu1_src);
  664|  4.02k|            src_r6_16x8b  = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));
  665|       |
  666|  4.02k|            src_r0r1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r1_16x8b);
  667|  4.02k|            src_r2r3_16x8b = _mm_unpacklo_epi8(src_r2_16x8b, src_r3_16x8b);
  668|  4.02k|            src_r4r5_16x8b = _mm_unpacklo_epi8(src_r4_16x8b, src_r5_16x8b);
  669|       |
  670|  4.02k|            res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
  671|  4.02k|            res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
  672|  4.02k|            res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
  673|       |
  674|  4.02k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
  675|  4.02k|            res_t3_8x16b = _mm_add_epi16(res_t3_8x16b, const_val16_8x16b);
  676|  4.02k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
  677|  4.02k|            res_t0_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
  678|       |
  679|  4.02k|            src_r0r1_16x8b = _mm_unpackhi_epi8(src_r0_16x8b, src_r1_16x8b);
  680|  4.02k|            src_r2r3_16x8b = _mm_unpackhi_epi8(src_r2_16x8b, src_r3_16x8b);
  681|  4.02k|            src_r4r5_16x8b = _mm_unpackhi_epi8(src_r4_16x8b, src_r5_16x8b);
  682|       |
  683|  4.02k|            res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
  684|  4.02k|            res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
  685|  4.02k|            res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
  686|       |
  687|  4.02k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
  688|  4.02k|            res_t3_8x16b = _mm_add_epi16(res_t3_8x16b, const_val16_8x16b);
  689|  4.02k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
  690|  4.02k|            res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
  691|       |
  692|  4.02k|            res_16x8b = _mm_packus_epi16(res_t0_8x16b, res_t1_8x16b);
  693|       |
  694|  4.02k|            _mm_storeu_si128((__m128i *)pu1_dst, res_16x8b);
  695|       |
  696|  4.02k|            src_r0r1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r2_16x8b);
  697|  4.02k|            src_r2r3_16x8b = _mm_unpacklo_epi8(src_r3_16x8b, src_r4_16x8b);
  698|  4.02k|            src_r4r5_16x8b = _mm_unpacklo_epi8(src_r5_16x8b, src_r6_16x8b);
  699|       |
  700|  4.02k|            res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
  701|  4.02k|            res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
  702|  4.02k|            res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
  703|       |
  704|  4.02k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
  705|  4.02k|            res_t3_8x16b = _mm_add_epi16(res_t3_8x16b, const_val16_8x16b);
  706|  4.02k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
  707|  4.02k|            res_t0_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
  708|       |
  709|  4.02k|            src_r0r1_16x8b = _mm_unpackhi_epi8(src_r1_16x8b, src_r2_16x8b);
  710|  4.02k|            src_r2r3_16x8b = _mm_unpackhi_epi8(src_r3_16x8b, src_r4_16x8b);
  711|  4.02k|            src_r4r5_16x8b = _mm_unpackhi_epi8(src_r5_16x8b, src_r6_16x8b);
  712|       |
  713|  4.02k|            res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
  714|  4.02k|            res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
  715|  4.02k|            res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
  716|       |
  717|  4.02k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
  718|  4.02k|            res_t3_8x16b = _mm_add_epi16(res_t3_8x16b, const_val16_8x16b);
  719|  4.02k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
  720|  4.02k|            res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
  721|       |
  722|  4.02k|            res_16x8b = _mm_packus_epi16(res_t0_8x16b, res_t1_8x16b);
  723|       |
  724|  4.02k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), res_16x8b);
  725|       |
  726|  4.02k|            src_r0_16x8b = src_r2_16x8b;
  727|  4.02k|            src_r1_16x8b = src_r3_16x8b;
  728|  4.02k|            src_r2_16x8b = src_r4_16x8b;
  729|  4.02k|            src_r3_16x8b = src_r5_16x8b;
  730|  4.02k|            src_r4_16x8b = src_r6_16x8b;
  731|       |
  732|  4.02k|            ht -= 2;
  733|  4.02k|            pu1_src += src_strd << 1;
  734|  4.02k|            pu1_dst += dst_strd << 1;
  735|  4.02k|        }
  736|  4.02k|        while(ht > 0);
  ------------------
  |  Branch (736:15): [True: 3.46k, False: 561]
  ------------------
  737|    561|    }
  738|  1.85k|}
ih264_inter_pred_luma_horz_hpel_vert_hpel_ssse3:
  775|  2.11k|{
  776|  2.11k|    UNUSED(dydx);
  ------------------
  |  |   45|  2.11k|#define UNUSED(x) ((void)(x))
  ------------------
  777|       |
  778|  2.11k|    if(wd == 4)
  ------------------
  |  Branch (778:8): [True: 64, False: 2.04k]
  ------------------
  779|     64|    {
  780|     64|        WORD16 *pi2_temp;
  781|       |
  782|     64|        pu1_tmp += 4;
  783|     64|        pu1_src -= src_strd << 1;
  784|     64|        pi2_temp = (WORD16 *)pu1_tmp;
  785|     64|        pu1_src -= 2; // the filter input starts from x[-2] (till x[3])
  786|       |
  787|       |        // Horizontal 6-tap filtering
  788|     64|        {
  789|     64|            WORD32 ht_tmp = ht + 4;
  790|       |
  791|     64|            __m128i src_r0_16x8b, src_r1_16x8b;
  792|     64|            __m128i src_r0_sht_16x8b, src_r1_sht_16x8b;
  793|     64|            __m128i src_r0r1_t1_16x8b;
  794|     64|            __m128i res_r0r1_t1_8x16b, res_r0r1_t2_8x16b, res_r0r1_t3_8x16b;
  795|     64|            __m128i coeff0_1_16x8b, coeff2_3_16x8b, coeff4_5_16x8b;
  796|       |
  797|     64|            coeff0_1_16x8b = _mm_set1_epi32(0xFB01FB01);  //c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1
  798|     64|            coeff2_3_16x8b = _mm_set1_epi32(0x14141414);  //c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3
  799|     64|            coeff4_5_16x8b = _mm_set1_epi32(0x01FB01FB);  //c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5
  800|       |                                                          //c0 = c5 = 1, c1 = c4 = -5, c2 = c3 = 20
  801|       |            //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
  802|       |            //Row1 : b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
  803|       |
  804|     64|            do
  805|    346|            {
  806|    346|                src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);                       //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
  807|    346|                src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));          //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9....b15
  808|       |
  809|    346|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                       //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
  810|    346|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                       //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
  811|       |
  812|    346|                src_r0_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);         //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
  813|    346|                src_r1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);         //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
  814|       |
  815|    346|                src_r0r1_t1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);       //a0 a1 a1 a2 a2 a3 a3 a4 b0 b1 b1 b2 b2 b3 b3 b4
  816|    346|                res_r0r1_t1_8x16b = _mm_maddubs_epi16(src_r0r1_t1_16x8b, coeff0_1_16x8b); //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
  817|       |                                                                                          //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
  818|       |
  819|    346|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 4);                           //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8  0  0  0  0
  820|    346|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 4);                           //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8  0  0  0  0
  821|       |
  822|    346|                src_r0r1_t1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);       //a2 a3 a3 a4 a4 a5 a5 a6 b2 b3 b3 b4 b4 b5 b5 b6
  823|    346|                res_r0r1_t2_8x16b = _mm_maddubs_epi16(src_r0r1_t1_16x8b, coeff2_3_16x8b); //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
  824|       |                                                                                          //b2*c2+b3*c3 b3*c2+b4*c3 b4*c2+b5*c3 b5*c2+b6*c3
  825|       |
  826|    346|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 4);                           //a4 a5 a5 a6 a6 a7 a7 a8  0  0  0  0  0  0  0  0
  827|    346|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 4);                           //b4 b5 b5 b6 b6 b7 b7 b8  0  0  0  0  0  0  0  0
  828|       |
  829|    346|                src_r0r1_t1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);       //a4 a5 a5 a6 a6 a7 a7 a8 b4 b5 b5 b6 b6 b7 b7 b8
  830|    346|                res_r0r1_t3_8x16b = _mm_maddubs_epi16(src_r0r1_t1_16x8b, coeff4_5_16x8b); //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
  831|       |                                                                                          //b4*c4+b5*c5 b5*c4+b6*c5 b4*c6+b7*c5 b7*c4+b8*c5
  832|    346|                res_r0r1_t1_8x16b = _mm_add_epi16(res_r0r1_t1_8x16b, res_r0r1_t2_8x16b);
  833|    346|                res_r0r1_t1_8x16b = _mm_add_epi16(res_r0r1_t3_8x16b, res_r0r1_t1_8x16b);
  834|       |
  835|    346|                _mm_storeu_si128((__m128i *)pi2_temp, res_r0r1_t1_8x16b);
  836|       |
  837|    346|                ht_tmp -= 2;
  838|    346|                pu1_src += src_strd << 1;
  839|    346|                pi2_temp += 8;
  840|    346|            }
  841|    346|            while(ht_tmp > 0);
  ------------------
  |  Branch (841:19): [True: 282, False: 64]
  ------------------
  842|       |
  843|     64|            src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);                           //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
  844|     64|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                           //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
  845|       |
  846|     64|            src_r0_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);             //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
  847|     64|            res_r0r1_t1_8x16b = _mm_maddubs_epi16(src_r0_16x8b, coeff0_1_16x8b);          //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
  848|       |
  849|     64|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b,4);                                //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8  0  0  0  0
  850|     64|            res_r0r1_t2_8x16b = _mm_maddubs_epi16(src_r0_16x8b, coeff2_3_16x8b);          //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
  851|       |
  852|     64|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b,4);                                //a4 a5 a5 a6 a6 a7 a7 a8  0  0  0  0  0  0  0  0
  853|     64|            res_r0r1_t3_8x16b = _mm_maddubs_epi16(src_r0_16x8b, coeff4_5_16x8b);          //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
  854|       |
  855|     64|            res_r0r1_t1_8x16b = _mm_add_epi16(res_r0r1_t1_8x16b, res_r0r1_t2_8x16b);
  856|     64|            res_r0r1_t1_8x16b = _mm_add_epi16(res_r0r1_t3_8x16b, res_r0r1_t1_8x16b);
  857|       |
  858|     64|            _mm_storel_epi64((__m128i *)pi2_temp, res_r0r1_t1_8x16b);
  859|     64|        }
  860|       |
  861|     64|        pi2_temp = (WORD16 *)pu1_tmp;
  862|       |
  863|       |        // Vertical 6-tap filtering
  864|     64|        {
  865|     64|            __m128i src_r0_8x16b, src_r1_8x16b, src_r2_8x16b, src_r3_8x16b,
  866|     64|                            src_r4_8x16b;
  867|     64|            __m128i src_r5_8x16b, src_r6_8x16b;
  868|     64|            __m128i src_t1_8x16b, src_t2_8x16b;
  869|       |
  870|     64|            __m128i res_t0_4x32b, res_t1_4x32b, res_t2_4x32b, res_t3_4x32b;
  871|     64|            __m128i res_8x16b, res_16x8b;
  872|       |
  873|     64|            __m128i coeff0_1_8x16b, coeff2_3_8x16b, coeff4_5_8x16b;
  874|     64|            __m128i const_val512_4x32b;
  875|       |
  876|     64|            coeff0_1_8x16b = _mm_set1_epi32(0xFFFB0001);
  877|     64|            coeff2_3_8x16b = _mm_set1_epi32(0x00140014);
  878|     64|            coeff4_5_8x16b = _mm_set1_epi32(0x0001FFFB);
  879|       |
  880|     64|            const_val512_4x32b = _mm_set1_epi32(512);
  881|       |
  882|     64|            src_r0_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp));
  883|     64|            src_r1_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp + 4));
  884|     64|            src_r2_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp + 8));
  885|     64|            src_r3_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp + 12));
  886|     64|            src_r4_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp + 16));
  887|     64|            pi2_temp += 20;
  888|       |
  889|     64|            do
  890|    218|            {
  891|    218|                src_r5_8x16b = _mm_loadl_epi64((__m128i *)pi2_temp);
  892|    218|                src_r6_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp + 4));
  893|       |
  894|    218|                src_r0_8x16b = _mm_unpacklo_epi16(src_r0_8x16b, src_r1_8x16b);
  895|    218|                src_t1_8x16b = _mm_unpacklo_epi16(src_r2_8x16b, src_r3_8x16b);
  896|    218|                src_t2_8x16b = _mm_unpacklo_epi16(src_r4_8x16b, src_r5_8x16b);
  897|       |
  898|    218|                res_t1_4x32b = _mm_madd_epi16(src_r0_8x16b, coeff0_1_8x16b);
  899|    218|                res_t2_4x32b = _mm_madd_epi16(src_t1_8x16b, coeff2_3_8x16b);
  900|    218|                res_t3_4x32b = _mm_madd_epi16(src_t2_8x16b, coeff4_5_8x16b);
  901|       |
  902|    218|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
  903|    218|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
  904|    218|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
  905|       |
  906|    218|                res_t0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
  907|       |
  908|    218|                src_r1_8x16b = _mm_unpacklo_epi16(src_r1_8x16b, src_r2_8x16b);
  909|    218|                src_t1_8x16b = _mm_unpacklo_epi16(src_r3_8x16b, src_r4_8x16b);
  910|    218|                src_t2_8x16b = _mm_unpacklo_epi16(src_r5_8x16b, src_r6_8x16b);
  911|       |
  912|    218|                res_t1_4x32b = _mm_madd_epi16(src_r1_8x16b, coeff0_1_8x16b);
  913|    218|                res_t2_4x32b = _mm_madd_epi16(src_t1_8x16b, coeff2_3_8x16b);
  914|    218|                res_t3_4x32b = _mm_madd_epi16(src_t2_8x16b, coeff4_5_8x16b);
  915|       |
  916|    218|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
  917|    218|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
  918|    218|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
  919|       |
  920|    218|                res_t1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
  921|       |
  922|    218|                res_8x16b = _mm_packs_epi32(res_t0_4x32b, res_t1_4x32b);
  923|    218|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
  924|       |
  925|    218|                *((WORD32 *)(pu1_dst)) = _mm_cvtsi128_si32(res_16x8b);
  926|    218|                res_16x8b = _mm_srli_si128(res_16x8b, 4);
  927|    218|                *((WORD32 *)(pu1_dst + dst_strd)) = _mm_cvtsi128_si32(res_16x8b);
  928|       |
  929|    218|                src_r0_8x16b = src_r2_8x16b;
  930|    218|                src_r1_8x16b = src_r3_8x16b;
  931|    218|                src_r2_8x16b = src_r4_8x16b;
  932|    218|                src_r3_8x16b = src_r5_8x16b;
  933|    218|                src_r4_8x16b = src_r6_8x16b;
  934|       |
  935|    218|                ht -= 2;
  936|    218|                pi2_temp += 8;
  937|    218|                pu1_dst += dst_strd << 1;
  938|    218|            }
  939|    218|            while(ht > 0);
  ------------------
  |  Branch (939:19): [True: 154, False: 64]
  ------------------
  940|     64|        }
  941|     64|    }
  942|  2.04k|    else if(wd == 8)
  ------------------
  |  Branch (942:13): [True: 717, False: 1.33k]
  ------------------
  943|    717|    {
  944|    717|        WORD16 *pi2_temp;
  945|       |
  946|    717|        pu1_tmp += 4;
  947|    717|        pu1_src -= src_strd << 1;
  948|    717|        pi2_temp = (WORD16 *)pu1_tmp;
  949|    717|        pu1_src -= 2; // the filter input starts from x[-2] (till x[3])
  950|       |
  951|       |        // Horizontal 6-tap filtering
  952|    717|        {
  953|    717|            WORD32 ht_tmp = ht + 4;
  954|       |
  955|    717|            __m128i src_r0_16x8b, src_r1_16x8b;
  956|    717|            __m128i src_r0_sht_16x8b, src_r1_sht_16x8b;
  957|    717|            __m128i src_r0_t1_16x8b, src_r1_t1_16x8b;
  958|    717|            __m128i res_r0_t1_8x16b, res_r0_t2_8x16b, res_r0_t3_8x16b;
  959|    717|            __m128i res_r1_t1_8x16b, res_r1_t2_8x16b, res_r1_t3_8x16b;
  960|    717|            __m128i coeff0_1_16x8b, coeff2_3_16x8b, coeff4_5_16x8b;
  961|       |
  962|    717|            coeff0_1_16x8b = _mm_set1_epi32(0xFB01FB01);  //c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1
  963|    717|            coeff2_3_16x8b = _mm_set1_epi32(0x14141414);  //c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3
  964|    717|            coeff4_5_16x8b = _mm_set1_epi32(0x01FB01FB);  //c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5
  965|       |                                                          //c0 = c5 = 1, c1 = c4 = -5, c2 = c3 = 20
  966|       |            //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
  967|       |            //Row1 : b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
  968|       |
  969|    717|            do
  970|  5.79k|            {
  971|  5.79k|                src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);                      //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15
  972|  5.79k|                src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));         //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12 b13 b14 b15
  973|       |
  974|  5.79k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                      //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
  975|  5.79k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                      //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
  976|       |
  977|  5.79k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
  978|  5.79k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
  979|       |
  980|  5.79k|                res_r0_t1_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff0_1_16x8b);    //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
  981|       |                                                                                         //a4*c0+a5*c1 a5*c0+a6*c1 a6*c0+a7*c1 a7*c0+a8*c1
  982|  5.79k|                res_r1_t1_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff0_1_16x8b);    //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
  983|       |                                                                                         //b4*c0+b5*c1 b5*c0+b6*c1 b6*c0+b7*c1 b7*c0+b8*c1
  984|       |
  985|  5.79k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                          //a2 a3 a4 a5 a6 a7 a8 a9....a15 0 0
  986|  5.79k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                          //b2 b3 b4 b5 b6 b7 b8 b9....b15 0 0
  987|       |
  988|  5.79k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                  //a3 a4 a5 a6 a7 a8 a9....a15 0  0  0
  989|  5.79k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                  //b3 b4 b5 b6 b7 b8 b9....b15 0  0  0
  990|       |
  991|  5.79k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10
  992|  5.79k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8 a8 a9 a9 a10
  993|       |
  994|  5.79k|                res_r0_t2_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff2_3_16x8b);    //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
  995|       |                                                                                         //a6*c2+a7*c3 a7*c2+a8*c3 a8*c2+a9*c3 a9*c2+a10*c3
  996|  5.79k|                res_r1_t2_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff2_3_16x8b);    //b2*c2+b3*c3 b3*c2+b4*c3 b2*c4+b5*c3 b5*c2+b6*c3
  997|       |                                                                                         //b6*c2+b7*c3 b7*c2+b8*c3 b8*c2+b9*c3 b9*c2+b10*c3
  998|       |
  999|  5.79k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                          //a4 a5 a6 a7 a8 a9....a15 0  0  0  0
 1000|  5.79k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                          //b4 b5 b6 b7 b8 b9....b15 0  0  0  0
 1001|       |
 1002|  5.79k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                  //a5 a6 a7 a8 a9....a15 0  0  0  0  0
 1003|  5.79k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                  //b5 b6 b7 b8 b9....b15 0  0  0  0  0
 1004|       |
 1005|  5.79k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10 a10 a11 a11 a12
 1006|  5.79k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b4 b5 b5 b6 b6 b7 b7 b8 b8 b9 b9 b10 b10 b11 b11 b12
 1007|       |
 1008|  5.79k|                res_r0_t3_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff4_5_16x8b);    //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
 1009|       |                                                                                         //a8*c4+a9*c5 a9*c4+a10*c5 a10*c4+a11*c5 a11*c4+a12*c5
 1010|  5.79k|                res_r1_t3_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff4_5_16x8b);    //b4*c4+b5*c5 b5*c4+b6*c5 b6*c4+b7*c5 b7*c4+b8*c5
 1011|       |                                                                                         //b8*c4+b9*c5 b9*c4+b10*c5 b10*c4+b11*c5 b11*c4+b12*c5
 1012|  5.79k|                res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t2_8x16b);
 1013|  5.79k|                res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t3_8x16b);
 1014|       |
 1015|  5.79k|                res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t2_8x16b);
 1016|  5.79k|                res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t3_8x16b);
 1017|       |
 1018|  5.79k|                _mm_storeu_si128((__m128i *)pi2_temp, res_r0_t1_8x16b);
 1019|  5.79k|                _mm_storeu_si128((__m128i *)(pi2_temp + 8), res_r1_t1_8x16b);
 1020|       |
 1021|  5.79k|                ht_tmp -= 2;
 1022|  5.79k|                pu1_src += src_strd << 1;
 1023|  5.79k|                pi2_temp += 16;
 1024|  5.79k|            }
 1025|  5.79k|            while(ht_tmp > 0);
  ------------------
  |  Branch (1025:19): [True: 5.08k, False: 717]
  ------------------
 1026|       |
 1027|    717|            src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);                          //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15
 1028|    717|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                          //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
 1029|       |
 1030|    717|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b,src_r0_sht_16x8b);          //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
 1031|    717|            res_r0_t1_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b,coeff0_1_16x8b);         //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
 1032|       |                                                                                         //a4*c0+a5*c1 a5*c0+a6*c1 a6*c0+a7*c1 a7*c0+a8*c1
 1033|       |
 1034|    717|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                              //a2 a3 a4 a5 a6 a7 a8 a9....a15 0 0
 1035|    717|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                      //a3 a4 a5 a6 a7 a8 a9....a15 0  0  0
 1036|       |
 1037|    717|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);         //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10
 1038|    717|            res_r0_t2_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff2_3_16x8b);        //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
 1039|       |                                                                                         //a6*c2+a7*c3 a7*c2+a8*c3 a8*c2+a9*c3 a9*c2+a10*c3
 1040|       |
 1041|    717|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                              //a4 a5 a6 a7 a8 a9....a15 0  0  0  0
 1042|    717|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                      //a5 a6 a7 a8 a9....a15 0  0  0  0  0
 1043|       |
 1044|    717|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);         //a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10 a10 a11 a11 a12
 1045|    717|            res_r0_t3_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff4_5_16x8b);        //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
 1046|       |                                                                                         //a8*c4+a9*c5 a9*c4+a10*c5 a10*c4+a11*c5 a11*c4+a12*c5
 1047|    717|            res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t2_8x16b);
 1048|    717|            res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t3_8x16b);
 1049|       |
 1050|    717|            _mm_storeu_si128((__m128i *)pi2_temp, res_r0_t1_8x16b);
 1051|    717|        }
 1052|       |
 1053|    717|        pi2_temp = (WORD16 *)pu1_tmp;
 1054|       |
 1055|       |        // Vertical 6-tap filtering
 1056|    717|        {
 1057|    717|            __m128i src_r0_8x16b, src_r1_8x16b, src_r2_8x16b, src_r3_8x16b,
 1058|    717|                            src_r4_8x16b;
 1059|    717|            __m128i src_r5_8x16b, src_r6_8x16b;
 1060|    717|            __m128i src_r0r1_8x16b, src_r2r3_8x16b, src_r4r5_8x16b;
 1061|       |
 1062|    717|            __m128i res_t1_4x32b, res_t2_4x32b, res_t3_4x32b;
 1063|    717|            __m128i res_c0_4x32b, res_c1_4x32b;
 1064|    717|            __m128i res_8x16b, res_16x8b;
 1065|       |
 1066|    717|            __m128i coeff0_1_8x16b, coeff2_3_8x16b, coeff4_5_8x16b;
 1067|    717|            __m128i const_val512_4x32b;
 1068|       |
 1069|    717|            coeff0_1_8x16b = _mm_set1_epi32(0xFFFB0001);
 1070|    717|            coeff2_3_8x16b = _mm_set1_epi32(0x00140014);
 1071|    717|            coeff4_5_8x16b = _mm_set1_epi32(0x0001FFFB);
 1072|       |
 1073|    717|            const_val512_4x32b = _mm_set1_epi32(512);
 1074|       |
 1075|    717|            src_r0_8x16b = _mm_loadu_si128((__m128i *)pi2_temp);
 1076|    717|            src_r1_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp + 8));
 1077|    717|            src_r2_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp + 16));
 1078|    717|            src_r3_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp + 24));
 1079|    717|            src_r4_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp + 32));
 1080|    717|            pi2_temp += 40;
 1081|       |
 1082|    717|            do
 1083|  4.36k|            {
 1084|  4.36k|                src_r5_8x16b = _mm_loadu_si128((__m128i *)pi2_temp);
 1085|  4.36k|                src_r6_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp + 8));
 1086|       |
 1087|  4.36k|                src_r0r1_8x16b = _mm_unpacklo_epi16(src_r0_8x16b, src_r1_8x16b);
 1088|  4.36k|                src_r2r3_8x16b = _mm_unpacklo_epi16(src_r2_8x16b, src_r3_8x16b);
 1089|  4.36k|                src_r4r5_8x16b = _mm_unpacklo_epi16(src_r4_8x16b, src_r5_8x16b);
 1090|       |
 1091|  4.36k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 1092|  4.36k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 1093|  4.36k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 1094|       |
 1095|  4.36k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 1096|  4.36k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 1097|  4.36k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 1098|  4.36k|                res_c0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 1099|       |
 1100|  4.36k|                src_r0r1_8x16b = _mm_unpackhi_epi16(src_r0_8x16b, src_r1_8x16b);
 1101|  4.36k|                src_r2r3_8x16b = _mm_unpackhi_epi16(src_r2_8x16b, src_r3_8x16b);
 1102|  4.36k|                src_r4r5_8x16b = _mm_unpackhi_epi16(src_r4_8x16b, src_r5_8x16b);
 1103|       |
 1104|  4.36k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 1105|  4.36k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 1106|  4.36k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 1107|       |
 1108|  4.36k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 1109|  4.36k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 1110|  4.36k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 1111|  4.36k|                res_c1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 1112|       |
 1113|  4.36k|                res_8x16b = _mm_packs_epi32(res_c0_4x32b, res_c1_4x32b);
 1114|  4.36k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 1115|       |
 1116|  4.36k|                _mm_storel_epi64((__m128i *)pu1_dst, res_16x8b);
 1117|       |
 1118|  4.36k|                src_r0r1_8x16b = _mm_unpacklo_epi16(src_r1_8x16b, src_r2_8x16b);
 1119|  4.36k|                src_r2r3_8x16b = _mm_unpacklo_epi16(src_r3_8x16b, src_r4_8x16b);
 1120|  4.36k|                src_r4r5_8x16b = _mm_unpacklo_epi16(src_r5_8x16b, src_r6_8x16b);
 1121|       |
 1122|  4.36k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 1123|  4.36k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 1124|  4.36k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 1125|       |
 1126|  4.36k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 1127|  4.36k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 1128|  4.36k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 1129|  4.36k|                res_c0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 1130|       |
 1131|  4.36k|                src_r0r1_8x16b = _mm_unpackhi_epi16(src_r1_8x16b, src_r2_8x16b);
 1132|  4.36k|                src_r2r3_8x16b = _mm_unpackhi_epi16(src_r3_8x16b, src_r4_8x16b);
 1133|  4.36k|                src_r4r5_8x16b = _mm_unpackhi_epi16(src_r5_8x16b, src_r6_8x16b);
 1134|       |
 1135|  4.36k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 1136|  4.36k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 1137|  4.36k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 1138|       |
 1139|  4.36k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 1140|  4.36k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 1141|  4.36k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 1142|  4.36k|                res_c1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 1143|       |
 1144|  4.36k|                res_8x16b = _mm_packs_epi32(res_c0_4x32b, res_c1_4x32b);
 1145|  4.36k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 1146|       |
 1147|  4.36k|                _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), res_16x8b);
 1148|       |
 1149|  4.36k|                src_r0_8x16b = src_r2_8x16b;
 1150|  4.36k|                src_r1_8x16b = src_r3_8x16b;
 1151|  4.36k|                src_r2_8x16b = src_r4_8x16b;
 1152|  4.36k|                src_r3_8x16b = src_r5_8x16b;
 1153|  4.36k|                src_r4_8x16b = src_r6_8x16b;
 1154|       |
 1155|  4.36k|                ht -= 2;
 1156|  4.36k|                pi2_temp += 16;
 1157|  4.36k|                pu1_dst += dst_strd << 1;
 1158|  4.36k|            }
 1159|  4.36k|            while(ht > 0);
  ------------------
  |  Branch (1159:19): [True: 3.64k, False: 717]
  ------------------
 1160|    717|        }
 1161|    717|    }
 1162|  1.33k|    else // wd == 16
 1163|  1.33k|    {
 1164|  1.33k|        WORD16 *pi2_temp;
 1165|  1.33k|        WORD32 ht_tmp;
 1166|       |
 1167|  1.33k|        pu1_tmp += 4;
 1168|  1.33k|        pu1_src -= src_strd << 1;
 1169|  1.33k|        pi2_temp = (WORD16 *)pu1_tmp;
 1170|  1.33k|        pu1_src -= 2; // the filter input starts from x[-2] (till x[3])
 1171|       |
 1172|       |        // Horizontal 6-tap filtering
 1173|  1.33k|        {
 1174|  1.33k|            __m128i src_r0_16x8b, src_r1_16x8b, src_r0_sht_16x8b, src_r1_sht_16x8b;
 1175|  1.33k|            __m128i src_r0_t1_16x8b, src_r1_t1_16x8b;
 1176|       |
 1177|  1.33k|            __m128i res_r0_t1_8x16b, res_r0_t2_8x16b, res_r0_t3_8x16b;
 1178|  1.33k|            __m128i res_r1_t1_8x16b, res_r1_t2_8x16b, res_r1_t3_8x16b;
 1179|       |
 1180|  1.33k|            __m128i coeff0_1_16x8b, coeff2_3_16x8b, coeff4_5_16x8b;
 1181|       |
 1182|  1.33k|            ht_tmp = ht + 5;
 1183|       |
 1184|  1.33k|            coeff0_1_16x8b = _mm_set1_epi32(0xFB01FB01);  //c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1
 1185|  1.33k|            coeff2_3_16x8b = _mm_set1_epi32(0x14141414);  //c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3
 1186|  1.33k|            coeff4_5_16x8b = _mm_set1_epi32(0x01FB01FB);  //c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5
 1187|       |                                                          //c0 = c5 = 1, c1 = c4 = -5, c2 = c3 = 20
 1188|       |            //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
 1189|       |            //Row0 :                         b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
 1190|       |            //b0 is same a8. Similarly other bn pixels are same as a(n+8) pixels.
 1191|       |
 1192|  1.33k|            do
 1193|  23.3k|            {
 1194|  23.3k|                src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);                      //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
 1195|  23.3k|                src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + 8));                //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9....b15
 1196|       |
 1197|  23.3k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                      //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
 1198|  23.3k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                      //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
 1199|       |
 1200|  23.3k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
 1201|  23.3k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
 1202|       |
 1203|  23.3k|                res_r0_t1_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff0_1_16x8b);    //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
 1204|       |                                                                                         //a4*c0+a5*c1 a5*c0+a6*c1 a6*c0+a7*c1 a7*c0+a8*c1
 1205|  23.3k|                res_r1_t1_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff0_1_16x8b);    //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
 1206|       |                                                                                         //b4*c0+b5*c1 b5*c0+b6*c1 b6*c0+b7*c1 b7*c0+b8*c1
 1207|       |
 1208|  23.3k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                          //a2 a3 a4 a5 a6 a7 a8 a9....a15 0 0
 1209|  23.3k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                          //b2 b3 b4 b5 b6 b7 b8 b9....b15 0 0
 1210|       |
 1211|  23.3k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                  //a3 a4 a5 a6 a7 a8 a9....a15 0  0  0
 1212|  23.3k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                  //b3 b4 b5 b6 b7 b8 b9....b15 0  0  0
 1213|       |
 1214|  23.3k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10
 1215|  23.3k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8 a8 a9 a9 a10
 1216|       |
 1217|  23.3k|                res_r0_t2_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff2_3_16x8b);    //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
 1218|       |                                                                                         //a6*c2+a7*c3 a7*c2+a8*c3 a8*c2+a9*c3 a9*c2+a10*c3
 1219|  23.3k|                res_r1_t2_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff2_3_16x8b);    //b2*c2+b3*c3 b3*c2+b4*c3 b2*c4+b5*c3 b5*c2+b6*c3
 1220|       |                                                                                         //b6*c2+b7*c3 b7*c2+b8*c3 b8*c2+b9*c3 b9*c2+b10*c3
 1221|       |
 1222|  23.3k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                          //a4 a5 a6 a7 a8 a9....a15 0  0  0  0
 1223|  23.3k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                          //b4 b5 b6 b7 b8 b9....b15 0  0  0  0
 1224|       |
 1225|  23.3k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                  //a5 a6 a7 a8 a9....a15 0  0  0  0  0
 1226|  23.3k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                  //b5 b6 b7 b8 b9....b15 0  0  0  0  0
 1227|       |
 1228|  23.3k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10 a10 a11 a11 a12
 1229|  23.3k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b4 b5 b5 b6 b6 b7 b7 b8 b8 b9 b9 b10 b10 b11 b11 b12
 1230|       |
 1231|  23.3k|                res_r0_t3_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff4_5_16x8b);    //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
 1232|       |                                                                                         //a8*c4+a9*c5 a9*c4+a10*c5 a10*c4+a11*c5 a11*c4+a12*c5
 1233|  23.3k|                res_r1_t3_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff4_5_16x8b);    //b4*c4+b5*c5 b5*c4+b6*c5 b6*c4+b7*c5 b7*c4+b8*c5
 1234|       |                                                                                         //b8*c4+b9*c5 b9*c4+b10*c5 b10*c4+b11*c5 b11*c4+b12*c5
 1235|  23.3k|                res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t2_8x16b);
 1236|  23.3k|                res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t3_8x16b);
 1237|       |
 1238|  23.3k|                res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t2_8x16b);
 1239|  23.3k|                res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t3_8x16b);
 1240|       |
 1241|  23.3k|                _mm_storeu_si128((__m128i *)pi2_temp, res_r0_t1_8x16b);
 1242|  23.3k|                _mm_storeu_si128((__m128i *)(pi2_temp + 8), res_r1_t1_8x16b);
 1243|       |
 1244|  23.3k|                ht_tmp--;
 1245|  23.3k|                pu1_src += src_strd;
 1246|  23.3k|                pi2_temp += 16;
 1247|  23.3k|            }
 1248|  23.3k|            while(ht_tmp > 0);
  ------------------
  |  Branch (1248:19): [True: 22.0k, False: 1.33k]
  ------------------
 1249|  1.33k|        }
 1250|       |
 1251|  1.33k|        pi2_temp = (WORD16 *)pu1_tmp;
 1252|       |
 1253|       |        // Vertical 6-tap filtering
 1254|  1.33k|        {
 1255|  1.33k|            WORD16 *pi2_temp2;
 1256|  1.33k|            UWORD8 *pu1_dst2;
 1257|  1.33k|            WORD32 ht_tmp;
 1258|       |
 1259|  1.33k|            __m128i src_r0_8x16b, src_r1_8x16b, src_r2_8x16b, src_r3_8x16b, src_r4_8x16b;
 1260|  1.33k|            __m128i src_r5_8x16b, src_r6_8x16b;
 1261|  1.33k|            __m128i src_r0r1_8x16b, src_r2r3_8x16b, src_r4r5_8x16b;
 1262|       |
 1263|  1.33k|            __m128i res_t1_4x32b, res_t2_4x32b, res_t3_4x32b;
 1264|  1.33k|            __m128i res_c0_4x32b, res_c1_4x32b;
 1265|  1.33k|            __m128i res_8x16b, res_16x8b;
 1266|       |
 1267|  1.33k|            __m128i coeff0_1_8x16b, coeff2_3_8x16b, coeff4_5_8x16b;
 1268|  1.33k|            __m128i const_val512_4x32b;
 1269|       |
 1270|  1.33k|            coeff0_1_8x16b = _mm_set1_epi32(0xFFFB0001);
 1271|  1.33k|            coeff2_3_8x16b = _mm_set1_epi32(0x00140014);
 1272|  1.33k|            coeff4_5_8x16b = _mm_set1_epi32(0x0001FFFB);
 1273|       |
 1274|  1.33k|            const_val512_4x32b = _mm_set1_epi32(512);
 1275|       |
 1276|  1.33k|            pi2_temp2 = pi2_temp + 8;
 1277|  1.33k|            pu1_dst2 = pu1_dst + 8;
 1278|  1.33k|            ht_tmp = ht;
 1279|       |
 1280|       |            /**********************************************************/
 1281|       |            /*     Do first height x 8 block                          */
 1282|       |            /**********************************************************/
 1283|  1.33k|            src_r0_8x16b = _mm_loadu_si128((__m128i *)pi2_temp);
 1284|  1.33k|            src_r1_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp + 16));
 1285|  1.33k|            src_r2_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp + 32));
 1286|  1.33k|            src_r3_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp + 48));
 1287|  1.33k|            src_r4_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp + 64));
 1288|  1.33k|            pi2_temp += 80;
 1289|       |
 1290|  1.33k|            do
 1291|  8.34k|            {
 1292|  8.34k|                src_r5_8x16b = _mm_loadu_si128((__m128i *)pi2_temp);
 1293|  8.34k|                src_r6_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp + 16));
 1294|       |
 1295|  8.34k|                src_r0r1_8x16b = _mm_unpacklo_epi16(src_r0_8x16b, src_r1_8x16b);
 1296|  8.34k|                src_r2r3_8x16b = _mm_unpacklo_epi16(src_r2_8x16b, src_r3_8x16b);
 1297|  8.34k|                src_r4r5_8x16b = _mm_unpacklo_epi16(src_r4_8x16b, src_r5_8x16b);
 1298|       |
 1299|  8.34k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 1300|  8.34k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 1301|  8.34k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 1302|       |
 1303|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 1304|  8.34k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 1305|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 1306|  8.34k|                res_c0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 1307|       |
 1308|  8.34k|                src_r0r1_8x16b = _mm_unpackhi_epi16(src_r0_8x16b, src_r1_8x16b);
 1309|  8.34k|                src_r2r3_8x16b = _mm_unpackhi_epi16(src_r2_8x16b, src_r3_8x16b);
 1310|  8.34k|                src_r4r5_8x16b = _mm_unpackhi_epi16(src_r4_8x16b, src_r5_8x16b);
 1311|       |
 1312|  8.34k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 1313|  8.34k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 1314|  8.34k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 1315|       |
 1316|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 1317|  8.34k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 1318|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 1319|  8.34k|                res_c1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 1320|       |
 1321|  8.34k|                res_8x16b = _mm_packs_epi32(res_c0_4x32b, res_c1_4x32b);
 1322|  8.34k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 1323|       |
 1324|  8.34k|                _mm_storel_epi64((__m128i *)pu1_dst, res_16x8b);
 1325|       |
 1326|  8.34k|                src_r0r1_8x16b = _mm_unpacklo_epi16(src_r1_8x16b, src_r2_8x16b);
 1327|  8.34k|                src_r2r3_8x16b = _mm_unpacklo_epi16(src_r3_8x16b, src_r4_8x16b);
 1328|  8.34k|                src_r4r5_8x16b = _mm_unpacklo_epi16(src_r5_8x16b, src_r6_8x16b);
 1329|       |
 1330|  8.34k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 1331|  8.34k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 1332|  8.34k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 1333|       |
 1334|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 1335|  8.34k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 1336|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 1337|  8.34k|                res_c0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 1338|       |
 1339|  8.34k|                src_r0r1_8x16b = _mm_unpackhi_epi16(src_r1_8x16b, src_r2_8x16b);
 1340|  8.34k|                src_r2r3_8x16b = _mm_unpackhi_epi16(src_r3_8x16b, src_r4_8x16b);
 1341|  8.34k|                src_r4r5_8x16b = _mm_unpackhi_epi16(src_r5_8x16b, src_r6_8x16b);
 1342|       |
 1343|  8.34k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 1344|  8.34k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 1345|  8.34k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 1346|       |
 1347|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 1348|  8.34k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 1349|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 1350|  8.34k|                res_c1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 1351|       |
 1352|  8.34k|                res_8x16b = _mm_packs_epi32(res_c0_4x32b, res_c1_4x32b);
 1353|  8.34k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 1354|       |
 1355|  8.34k|                _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), res_16x8b);
 1356|       |
 1357|  8.34k|                src_r0_8x16b = src_r2_8x16b;
 1358|  8.34k|                src_r1_8x16b = src_r3_8x16b;
 1359|  8.34k|                src_r2_8x16b = src_r4_8x16b;
 1360|  8.34k|                src_r3_8x16b = src_r5_8x16b;
 1361|  8.34k|                src_r4_8x16b = src_r6_8x16b;
 1362|       |
 1363|  8.34k|                ht_tmp -= 2;
 1364|  8.34k|                pi2_temp += 32;
 1365|  8.34k|                pu1_dst += dst_strd << 1;
 1366|  8.34k|            }
 1367|  8.34k|            while(ht_tmp > 0);
  ------------------
  |  Branch (1367:19): [True: 7.01k, False: 1.33k]
  ------------------
 1368|       |
 1369|       |            /**********************************************************/
 1370|       |            /*     Do second ht x 8 block                          */
 1371|       |            /**********************************************************/
 1372|  1.33k|            src_r0_8x16b = _mm_loadu_si128((__m128i *)pi2_temp2);
 1373|  1.33k|            src_r1_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 16));
 1374|  1.33k|            src_r2_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 32));
 1375|  1.33k|            src_r3_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 48));
 1376|  1.33k|            src_r4_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 64));
 1377|  1.33k|            pi2_temp2 += 80;
 1378|       |
 1379|  1.33k|            do
 1380|  8.34k|            {
 1381|  8.34k|                src_r5_8x16b = _mm_loadu_si128((__m128i *)pi2_temp2);
 1382|  8.34k|                src_r6_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 16));
 1383|       |
 1384|  8.34k|                src_r0r1_8x16b = _mm_unpacklo_epi16(src_r0_8x16b, src_r1_8x16b);
 1385|  8.34k|                src_r2r3_8x16b = _mm_unpacklo_epi16(src_r2_8x16b, src_r3_8x16b);
 1386|  8.34k|                src_r4r5_8x16b = _mm_unpacklo_epi16(src_r4_8x16b, src_r5_8x16b);
 1387|       |
 1388|  8.34k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 1389|  8.34k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 1390|  8.34k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 1391|       |
 1392|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 1393|  8.34k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 1394|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 1395|  8.34k|                res_c0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 1396|       |
 1397|  8.34k|                src_r0r1_8x16b = _mm_unpackhi_epi16(src_r0_8x16b, src_r1_8x16b);
 1398|  8.34k|                src_r2r3_8x16b = _mm_unpackhi_epi16(src_r2_8x16b, src_r3_8x16b);
 1399|  8.34k|                src_r4r5_8x16b = _mm_unpackhi_epi16(src_r4_8x16b, src_r5_8x16b);
 1400|       |
 1401|  8.34k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 1402|  8.34k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 1403|  8.34k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 1404|       |
 1405|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 1406|  8.34k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 1407|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 1408|  8.34k|                res_c1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 1409|       |
 1410|  8.34k|                res_8x16b = _mm_packs_epi32(res_c0_4x32b, res_c1_4x32b);
 1411|  8.34k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 1412|       |
 1413|  8.34k|                _mm_storel_epi64((__m128i *)pu1_dst2, res_16x8b);
 1414|       |
 1415|  8.34k|                src_r0r1_8x16b = _mm_unpacklo_epi16(src_r1_8x16b, src_r2_8x16b);
 1416|  8.34k|                src_r2r3_8x16b = _mm_unpacklo_epi16(src_r3_8x16b, src_r4_8x16b);
 1417|  8.34k|                src_r4r5_8x16b = _mm_unpacklo_epi16(src_r5_8x16b, src_r6_8x16b);
 1418|       |
 1419|  8.34k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 1420|  8.34k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 1421|  8.34k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 1422|       |
 1423|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 1424|  8.34k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 1425|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 1426|  8.34k|                res_c0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 1427|       |
 1428|  8.34k|                src_r0r1_8x16b = _mm_unpackhi_epi16(src_r1_8x16b, src_r2_8x16b);
 1429|  8.34k|                src_r2r3_8x16b = _mm_unpackhi_epi16(src_r3_8x16b, src_r4_8x16b);
 1430|  8.34k|                src_r4r5_8x16b = _mm_unpackhi_epi16(src_r5_8x16b, src_r6_8x16b);
 1431|       |
 1432|  8.34k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 1433|  8.34k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 1434|  8.34k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 1435|       |
 1436|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 1437|  8.34k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 1438|  8.34k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 1439|  8.34k|                res_c1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 1440|       |
 1441|  8.34k|                res_8x16b = _mm_packs_epi32(res_c0_4x32b, res_c1_4x32b);
 1442|  8.34k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 1443|       |
 1444|  8.34k|                _mm_storel_epi64((__m128i *)(pu1_dst2 + dst_strd), res_16x8b);
 1445|       |
 1446|  8.34k|                src_r0_8x16b = src_r2_8x16b;
 1447|  8.34k|                src_r1_8x16b = src_r3_8x16b;
 1448|  8.34k|                src_r2_8x16b = src_r4_8x16b;
 1449|  8.34k|                src_r3_8x16b = src_r5_8x16b;
 1450|  8.34k|                src_r4_8x16b = src_r6_8x16b;
 1451|       |
 1452|  8.34k|                ht -= 2;
 1453|  8.34k|                pi2_temp2 += 32;
 1454|  8.34k|                pu1_dst2 += dst_strd << 1;
 1455|  8.34k|            }
 1456|  8.34k|            while(ht > 0);
  ------------------
  |  Branch (1456:19): [True: 7.01k, False: 1.33k]
  ------------------
 1457|  1.33k|        }
 1458|  1.33k|    }
 1459|  2.11k|}
ih264_inter_pred_luma_horz_qpel_ssse3:
 1499|  9.15k|{
 1500|  9.15k|    WORD32 x_offset;
 1501|  9.15k|    UWORD8 *pu1_pred1;
 1502|       |
 1503|  9.15k|    __m128i src_r0_16x8b, src_r1_16x8b;
 1504|  9.15k|    __m128i src_r0_sht_16x8b, src_r1_sht_16x8b;
 1505|  9.15k|    __m128i coeff0_1_16x8b, coeff2_3_16x8b, coeff4_5_16x8b;
 1506|  9.15k|    __m128i const_val16_8x16b;
 1507|       |
 1508|  9.15k|    UNUSED(pu1_tmp);
  ------------------
  |  |   45|  9.15k|#define UNUSED(x) ((void)(x))
  ------------------
 1509|       |
 1510|  9.15k|    x_offset = dydx & 3;
 1511|       |
 1512|  9.15k|    coeff0_1_16x8b = _mm_set1_epi32(0xFB01FB01); //c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1
 1513|  9.15k|    coeff2_3_16x8b = _mm_set1_epi32(0x14141414); //c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3
 1514|  9.15k|    coeff4_5_16x8b = _mm_set1_epi32(0x01FB01FB); //c4 c5 c4 c5 c4 c5 c4 c5 c4 c5 c4 c5 c4 c5 c4 c5
 1515|       |                                                 //c0 = c5 = 1, c1 = c4 = -5, c2 = c3 = 20
 1516|  9.15k|    pu1_pred1 = pu1_src + (x_offset >> 1);
 1517|       |
 1518|  9.15k|    const_val16_8x16b = _mm_set1_epi16(16);
 1519|       |
 1520|  9.15k|    pu1_src -= 2; // the filter input starts from x[-2] (till x[3])
 1521|       |
 1522|  9.15k|    if(wd == 4)
  ------------------
  |  Branch (1522:8): [True: 1.51k, False: 7.64k]
  ------------------
 1523|  1.51k|    {
 1524|  1.51k|        __m128i src_r0r1_16x8b;
 1525|       |
 1526|  1.51k|        __m128i res_r0r1_t1_8x16b, res_r0r1_t2_8x16b, res_r0r1_t3_8x16b;
 1527|  1.51k|        __m128i res_r0r1_16x8b;
 1528|       |
 1529|       |        //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
 1530|       |        //Row1 : b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
 1531|       |
 1532|  1.51k|        do
 1533|  3.88k|        {
 1534|  3.88k|            src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);                         //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
 1535|  3.88k|            src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));            //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9....b15
 1536|       |
 1537|  3.88k|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                         //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
 1538|  3.88k|            src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                         //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
 1539|       |
 1540|  3.88k|            src_r0_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);           //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
 1541|  3.88k|            src_r1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);           //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
 1542|       |
 1543|  3.88k|            src_r0r1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);            //a0 a1 a1 a2 a2 a3 a3 a4 b0 b1 b1 b2 b2 b3 b3 b4
 1544|  3.88k|            res_r0r1_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);      //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
 1545|       |                                                                                        //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
 1546|       |
 1547|  3.88k|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 4);                             //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8  0  0  0  0
 1548|  3.88k|            src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 4);                             //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8  0  0  0  0
 1549|       |
 1550|  3.88k|            src_r0r1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);            //a2 a3 a3 a4 a4 a5 a5 a6 b2 b3 b3 b4 b4 b5 b5 b6
 1551|  3.88k|            res_r0r1_t2_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff2_3_16x8b);      //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
 1552|       |                                                                                        //b2*c2+b3*c3 b3*c2+b4*c3 b4*c2+b5*c3 b5*c2+b6*c3
 1553|       |
 1554|  3.88k|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 4);                             //a4 a5 a5 a6 a6 a7 a7 a8  0  0  0  0  0  0  0  0
 1555|  3.88k|            src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 4);                             //b4 b5 b5 b6 b6 b7 b7 b8  0  0  0  0  0  0  0  0
 1556|       |
 1557|  3.88k|            src_r0r1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);            //a4 a5 a5 a6 a6 a7 a7 a8 b4 b5 b5 b6 b6 b7 b7 b8
 1558|  3.88k|            res_r0r1_t3_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff4_5_16x8b);      //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
 1559|       |                                                                                        //b4*c4+b5*c5 b5*c4+b6*c5 b4*c6+b7*c5 b7*c4+b8*c5
 1560|  3.88k|            src_r0_16x8b = _mm_loadl_epi64((__m128i *)pu1_pred1);
 1561|  3.88k|            src_r1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred1 + src_strd));
 1562|       |
 1563|  3.88k|            res_r0r1_t1_8x16b = _mm_add_epi16(res_r0r1_t1_8x16b, res_r0r1_t2_8x16b);
 1564|  3.88k|            res_r0r1_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_r0r1_t3_8x16b);
 1565|  3.88k|            res_r0r1_t1_8x16b = _mm_add_epi16(res_r0r1_t1_8x16b, res_r0r1_t3_8x16b);    //a0*c0+a1*c1+a2*c2+a3*c3+a4*a4+a5*c5 + 16;
 1566|       |                                                                                        //a1*c0+a2*c1+a2*c2+a3*c3+a5*a4+a6*c5 + 16;
 1567|       |                                                                                        //a2*c0+a3*c1+a4*c2+a5*c3+a6*a4+a7*c5 + 16;
 1568|       |                                                                                        //a3*c0+a4*c1+a5*c2+a6*c3+a6*a4+a8*c5 + 16;
 1569|       |                                                                                        //b0*c0+b1*c1+b2*c2+b3*c3+b4*b4+b5*c5 + 16;
 1570|       |                                                                                        //b1*c0+b2*c1+b2*c2+b3*c3+b5*b4+b6*c5 + 16;
 1571|       |                                                                                        //b2*c0+b3*c1+b4*c2+b5*c3+b6*b4+b7*c5 + 16;
 1572|       |                                                                                        //b3*c0+b4*c1+b5*c2+b6*c3+b6*b4+b8*c5 + 16;
 1573|  3.88k|            src_r0r1_16x8b = _mm_unpacklo_epi32(src_r0_16x8b,src_r1_16x8b);
 1574|       |
 1575|  3.88k|            res_r0r1_t1_8x16b = _mm_srai_epi16(res_r0r1_t1_8x16b, 5);                   //shifting right by 5 bits.
 1576|       |
 1577|  3.88k|            res_r0r1_16x8b = _mm_packus_epi16(res_r0r1_t1_8x16b, res_r0r1_t1_8x16b);
 1578|  3.88k|            res_r0r1_16x8b = _mm_avg_epu8(src_r0r1_16x8b, res_r0r1_16x8b);              //computing q-pel
 1579|       |
 1580|  3.88k|            *((WORD32 *)(pu1_dst)) = _mm_cvtsi128_si32(res_r0r1_16x8b);
 1581|  3.88k|            res_r0r1_16x8b = _mm_srli_si128(res_r0r1_16x8b, 4);
 1582|  3.88k|            *((WORD32 *)(pu1_dst + dst_strd)) = _mm_cvtsi128_si32(res_r0r1_16x8b);
 1583|       |
 1584|  3.88k|            ht -= 2;
 1585|  3.88k|            pu1_src += src_strd << 1;
 1586|  3.88k|            pu1_pred1 += src_strd << 1;
 1587|  3.88k|            pu1_dst += dst_strd << 1;
 1588|  3.88k|        }
 1589|  3.88k|        while(ht > 0);
  ------------------
  |  Branch (1589:15): [True: 2.37k, False: 1.51k]
  ------------------
 1590|  1.51k|    }
 1591|  7.64k|    else if(wd == 8)
  ------------------
  |  Branch (1591:13): [True: 2.78k, False: 4.86k]
  ------------------
 1592|  2.78k|    {
 1593|  2.78k|        __m128i src_r0_t1_16x8b, src_r1_t1_16x8b;
 1594|       |
 1595|  2.78k|        __m128i res_r0_t1_8x16b, res_r0_t2_8x16b, res_r0_t3_8x16b;
 1596|  2.78k|        __m128i res_r1_t1_8x16b, res_r1_t2_8x16b, res_r1_t3_8x16b;
 1597|  2.78k|        __m128i res_r0_16x8b, res_r1_16x8b;
 1598|       |
 1599|       |        //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
 1600|       |        //Row1 : b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
 1601|       |
 1602|  2.78k|        do
 1603|  15.2k|        {
 1604|  15.2k|            src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);                      //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
 1605|  15.2k|            src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));         //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9....b15
 1606|       |
 1607|  15.2k|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                      //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
 1608|  15.2k|            src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                      //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
 1609|       |
 1610|  15.2k|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
 1611|  15.2k|            src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
 1612|       |
 1613|  15.2k|            res_r0_t1_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff0_1_16x8b);    //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
 1614|       |                                                                                     //a4*c0+a5*c1 a5*c0+a6*c1 a6*c0+a7*c1 a7*c0+a8*c1
 1615|  15.2k|            res_r1_t1_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff0_1_16x8b);    //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
 1616|       |                                                                                     //b4*c0+b5*c1 b5*c0+b6*c1 b6*c0+b7*c1 b7*c0+b8*c1
 1617|       |
 1618|  15.2k|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                          //a2 a3 a4 a5 a6 a7 a8 a9....a15 0 0
 1619|  15.2k|            src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                          //b2 b3 b4 b5 b6 b7 b8 b9....b15 0 0
 1620|       |
 1621|  15.2k|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                  //a3 a4 a5 a6 a7 a8 a9....a15 0  0  0
 1622|  15.2k|            src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                  //b3 b4 b5 b6 b7 b8 b9....b15 0  0  0
 1623|       |
 1624|  15.2k|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10
 1625|  15.2k|            src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8 a8 a9 a9 a10
 1626|       |
 1627|  15.2k|            res_r0_t2_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff2_3_16x8b);    //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
 1628|       |                                                                                     //a6*c2+a7*c3 a7*c2+a8*c3 a8*c2+a9*c3 a9*c2+a10*c3
 1629|  15.2k|            res_r1_t2_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff2_3_16x8b);    //b2*c2+b3*c3 b3*c2+b4*c3 b2*c4+b5*c3 b5*c2+b6*c3
 1630|       |                                                                                     //b6*c2+b7*c3 b7*c2+b8*c3 b8*c2+b9*c3 b9*c2+b10*c3
 1631|       |
 1632|  15.2k|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                          //a4 a5 a6 a7 a8 a9....a15 0  0  0  0
 1633|  15.2k|            src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                          //b4 b5 b6 b7 b8 b9....b15 0  0  0  0
 1634|       |
 1635|  15.2k|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                  //a5 a6 a7 a8 a9....a15 0  0  0  0  0
 1636|  15.2k|            src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                  //b5 b6 b7 b8 b9....b15 0  0  0  0  0
 1637|       |
 1638|  15.2k|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10 a10 a11 a11 a12
 1639|  15.2k|            src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b4 b5 b5 b6 b6 b7 b7 b8 b8 b9 b9 b10 b10 b11 b11 b12
 1640|       |
 1641|  15.2k|            res_r0_t3_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff4_5_16x8b);    //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
 1642|       |                                                                                     //a8*c4+a9*c5 a9*c4+a10*c5 a10*c4+a11*c5 a11*c4+a12*c5
 1643|  15.2k|            res_r1_t3_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff4_5_16x8b);    //b4*c4+b5*c5 b5*c4+b6*c5 b6*c4+b7*c5 b7*c4+b8*c5
 1644|       |                                                                                     //b8*c4+b9*c5 b9*c4+b10*c5 b10*c4+b11*c5 b11*c4+b12*c5
 1645|  15.2k|            src_r0_16x8b = _mm_loadl_epi64((__m128i *)pu1_pred1);
 1646|  15.2k|            src_r1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred1 + src_strd));
 1647|       |
 1648|  15.2k|            res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t2_8x16b);
 1649|  15.2k|            res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t2_8x16b);
 1650|  15.2k|            res_r0_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_r0_t3_8x16b);
 1651|  15.2k|            res_r1_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_r1_t3_8x16b);
 1652|  15.2k|            res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t3_8x16b);
 1653|  15.2k|            res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t3_8x16b);
 1654|       |
 1655|  15.2k|            res_r0_t1_8x16b = _mm_srai_epi16(res_r0_t1_8x16b, 5);
 1656|  15.2k|            res_r1_t1_8x16b = _mm_srai_epi16(res_r1_t1_8x16b, 5);                    //shifting right by 5 bits.
 1657|       |
 1658|  15.2k|            res_r0_16x8b = _mm_packus_epi16(res_r0_t1_8x16b, res_r0_t1_8x16b);
 1659|  15.2k|            res_r1_16x8b = _mm_packus_epi16(res_r1_t1_8x16b, res_r1_t1_8x16b);
 1660|       |
 1661|  15.2k|            res_r0_16x8b = _mm_avg_epu8(src_r0_16x8b, res_r0_16x8b);
 1662|  15.2k|            res_r1_16x8b = _mm_avg_epu8(src_r1_16x8b, res_r1_16x8b);                 //computing q-pel
 1663|       |
 1664|  15.2k|            _mm_storel_epi64((__m128i *)pu1_dst, res_r0_16x8b);
 1665|  15.2k|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), res_r1_16x8b);
 1666|       |
 1667|  15.2k|            ht -= 2;
 1668|  15.2k|            pu1_src += src_strd << 1;
 1669|  15.2k|            pu1_pred1 += src_strd << 1;
 1670|  15.2k|            pu1_dst += dst_strd << 1;
 1671|  15.2k|        }
 1672|  15.2k|        while(ht > 0);
  ------------------
  |  Branch (1672:15): [True: 12.4k, False: 2.78k]
  ------------------
 1673|  2.78k|    }
 1674|  4.86k|    else // wd == 16
 1675|  4.86k|    {
 1676|  4.86k|        __m128i src_r0_t1_16x8b, src_r1_t1_16x8b;
 1677|       |
 1678|  4.86k|        __m128i res_r0_t1_8x16b, res_r0_t2_8x16b, res_r0_t3_8x16b;
 1679|  4.86k|        __m128i res_r1_t1_8x16b, res_r1_t2_8x16b, res_r1_t3_8x16b;
 1680|  4.86k|        __m128i res_16x8b;
 1681|       |
 1682|       |        //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
 1683|       |        //Row0 :                         b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
 1684|       |        //b0 is same a8. Similarly other bn pixels are same as a(n+8) pixels.
 1685|       |
 1686|  4.86k|        do
 1687|  59.8k|        {
 1688|  59.8k|            src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);                      //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
 1689|  59.8k|            src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + 8));                //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9....b15
 1690|       |
 1691|  59.8k|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                      //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
 1692|  59.8k|            src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                      //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
 1693|       |
 1694|  59.8k|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
 1695|  59.8k|            src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
 1696|       |
 1697|  59.8k|            res_r0_t1_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff0_1_16x8b);    //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
 1698|       |                                                                                     //a4*c0+a5*c1 a5*c0+a6*c1 a6*c0+a7*c1 a7*c0+a8*c1
 1699|  59.8k|            res_r1_t1_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff0_1_16x8b);    //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
 1700|       |                                                                                     //b4*c0+b5*c1 b5*c0+b6*c1 b6*c0+b7*c1 b7*c0+b8*c1
 1701|       |
 1702|  59.8k|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                          //a2 a3 a4 a5 a6 a7 a8 a9....a15 0 0
 1703|  59.8k|            src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                          //b2 b3 b4 b5 b6 b7 b8 b9....b15 0 0
 1704|       |
 1705|  59.8k|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                  //a3 a4 a5 a6 a7 a8 a9....a15 0  0  0
 1706|  59.8k|            src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                  //b3 b4 b5 b6 b7 b8 b9....b15 0  0  0
 1707|       |
 1708|  59.8k|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10
 1709|  59.8k|            src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8 a8 a9 a9 a10
 1710|       |
 1711|  59.8k|            res_r0_t2_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff2_3_16x8b);    //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
 1712|       |                                                                                     //a6*c2+a7*c3 a7*c2+a8*c3 a8*c2+a9*c3 a9*c2+a10*c3
 1713|  59.8k|            res_r1_t2_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff2_3_16x8b);    //b2*c2+b3*c3 b3*c2+b4*c3 b2*c4+b5*c3 b5*c2+b6*c3
 1714|       |                                                                                     //b6*c2+b7*c3 b7*c2+b8*c3 b8*c2+b9*c3 b9*c2+b10*c3
 1715|       |
 1716|  59.8k|            src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                          //a4 a5 a6 a7 a8 a9....a15 0  0  0  0
 1717|  59.8k|            src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                          //b4 b5 b6 b7 b8 b9....b15 0  0  0  0
 1718|       |
 1719|  59.8k|            src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                  //a5 a6 a7 a8 a9....a15 0  0  0  0  0
 1720|  59.8k|            src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                  //b5 b6 b7 b8 b9....b15 0  0  0  0  0
 1721|       |
 1722|  59.8k|            src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10 a10 a11 a11 a12
 1723|  59.8k|            src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b4 b5 b5 b6 b6 b7 b7 b8 b8 b9 b9 b10 b10 b11 b11 b12
 1724|       |
 1725|  59.8k|            res_r0_t3_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff4_5_16x8b);    //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
 1726|       |                                                                                     //a8*c4+a9*c5 a9*c4+a10*c5 a10*c4+a11*c5 a11*c4+a12*c5
 1727|  59.8k|            res_r1_t3_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff4_5_16x8b);    //b4*c4+b5*c5 b5*c4+b6*c5 b6*c4+b7*c5 b7*c4+b8*c5
 1728|       |                                                                                     //b8*c4+b9*c5 b9*c4+b10*c5 b10*c4+b11*c5 b11*c4+b12*c5
 1729|  59.8k|            src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_pred1);
 1730|       |
 1731|  59.8k|            res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t2_8x16b);
 1732|  59.8k|            res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t2_8x16b);
 1733|  59.8k|            res_r0_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_r0_t3_8x16b);
 1734|  59.8k|            res_r1_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_r1_t3_8x16b);
 1735|  59.8k|            res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t3_8x16b);
 1736|  59.8k|            res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t3_8x16b);
 1737|       |
 1738|  59.8k|            res_r0_t1_8x16b = _mm_srai_epi16(res_r0_t1_8x16b, 5);
 1739|  59.8k|            res_r1_t1_8x16b = _mm_srai_epi16(res_r1_t1_8x16b, 5);                    //shifting right by 5 bits
 1740|       |
 1741|  59.8k|            res_16x8b = _mm_packus_epi16(res_r0_t1_8x16b, res_r1_t1_8x16b);
 1742|  59.8k|            res_16x8b = _mm_avg_epu8(src_r0_16x8b, res_16x8b);                       //computing q-pel
 1743|       |
 1744|  59.8k|            _mm_storeu_si128((__m128i *)pu1_dst, res_16x8b);
 1745|       |
 1746|  59.8k|            ht--;
 1747|  59.8k|            pu1_src += src_strd;
 1748|  59.8k|            pu1_pred1 += src_strd;
 1749|  59.8k|            pu1_dst += dst_strd;
 1750|  59.8k|        }
 1751|  59.8k|        while(ht > 0);
  ------------------
  |  Branch (1751:15): [True: 54.9k, False: 4.86k]
  ------------------
 1752|  4.86k|    }
 1753|  9.15k|}
ih264_inter_pred_luma_vert_qpel_ssse3:
 1793|  6.67k|{
 1794|  6.67k|    WORD32 y_offset;
 1795|  6.67k|    UWORD8 *pu1_pred1;
 1796|       |
 1797|       |
 1798|  6.67k|    __m128i src_r0_16x8b, src_r1_16x8b, src_r2_16x8b, src_r3_16x8b, src_r4_16x8b;
 1799|  6.67k|    __m128i src_r5_16x8b, src_r6_16x8b;
 1800|  6.67k|    __m128i src_r0r1_16x8b, src_r2r3_16x8b, src_r4r5_16x8b;
 1801|  6.67k|    __m128i res_16x8b, res_t1_8x16b, res_t2_8x16b, res_t3_8x16b;
 1802|       |
 1803|  6.67k|    __m128i coeff0_1_16x8b, coeff2_3_16x8b, coeff4_5_16x8b;
 1804|  6.67k|    __m128i const_val16_8x16b;
 1805|       |
 1806|  6.67k|    UNUSED(pu1_tmp);
  ------------------
  |  |   45|  6.67k|#define UNUSED(x) ((void)(x))
  ------------------
 1807|  6.67k|    y_offset = dydx & 0xf;
 1808|       |
 1809|  6.67k|    coeff0_1_16x8b = _mm_set1_epi32(0xFB01FB01); //c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1
 1810|  6.67k|    coeff2_3_16x8b = _mm_set1_epi32(0x14141414); //c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3
 1811|  6.67k|    coeff4_5_16x8b = _mm_set1_epi32(0x01FB01FB); //c4 c5 c4 c5 c4 c5 c4 c5 c4 c5 c4 c5 c4 c5 c4 c5
 1812|       |                                                 //c0 = c5 = 1, c1 = c4 = -5, c2 = c3 = 20
 1813|       |
 1814|  6.67k|    pu1_pred1 = pu1_src + (y_offset >> 3) * src_strd;
 1815|       |
 1816|  6.67k|    const_val16_8x16b = _mm_set1_epi16(16);
 1817|       |
 1818|  6.67k|    pu1_src -= src_strd << 1; // the filter input starts from x[-2] (till x[3])
 1819|       |
 1820|  6.67k|    if(wd == 4)
  ------------------
  |  Branch (1820:8): [True: 685, False: 5.98k]
  ------------------
 1821|    685|    {
 1822|       |        //Epilogue: Load all the pred rows except sixth and seventh row
 1823|       |        //          for the first and second row processing.
 1824|    685|        src_r0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
 1825|    685|        pu1_src += src_strd;
 1826|    685|        src_r1_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
 1827|    685|        pu1_src += src_strd;
 1828|    685|        src_r2_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
 1829|    685|        pu1_src += src_strd;
 1830|    685|        src_r3_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
 1831|    685|        pu1_src += src_strd;
 1832|    685|        src_r4_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
 1833|    685|        pu1_src += src_strd;
 1834|       |
 1835|    685|        src_r0_16x8b = _mm_unpacklo_epi32(src_r0_16x8b, src_r1_16x8b);
 1836|    685|        src_r1_16x8b = _mm_unpacklo_epi32(src_r1_16x8b, src_r2_16x8b);
 1837|    685|        src_r2_16x8b = _mm_unpacklo_epi32(src_r2_16x8b, src_r3_16x8b);
 1838|    685|        src_r3_16x8b = _mm_unpacklo_epi32(src_r3_16x8b, src_r4_16x8b);
 1839|       |
 1840|    685|        do
 1841|  2.48k|        {
 1842|  2.48k|            src_r5_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
 1843|  2.48k|            src_r6_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + src_strd));
 1844|       |
 1845|  2.48k|            src_r4_16x8b = _mm_unpacklo_epi32(src_r4_16x8b, src_r5_16x8b);
 1846|  2.48k|            src_r5_16x8b = _mm_unpacklo_epi32(src_r5_16x8b, src_r6_16x8b);
 1847|       |
 1848|  2.48k|            src_r0r1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r1_16x8b);
 1849|  2.48k|            src_r2r3_16x8b = _mm_unpacklo_epi8(src_r2_16x8b, src_r3_16x8b);
 1850|  2.48k|            src_r4r5_16x8b = _mm_unpacklo_epi8(src_r4_16x8b, src_r5_16x8b);
 1851|       |
 1852|  2.48k|            res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 1853|  2.48k|            res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 1854|  2.48k|            res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 1855|       |
 1856|  2.48k|            src_r0_16x8b = _mm_loadl_epi64((__m128i *)pu1_pred1);
 1857|  2.48k|            src_r1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred1 + src_strd));
 1858|       |
 1859|  2.48k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 1860|  2.48k|            res_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_t3_8x16b);
 1861|  2.48k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
 1862|       |
 1863|  2.48k|            src_r0r1_16x8b = _mm_unpacklo_epi32(src_r0_16x8b,src_r1_16x8b);
 1864|       |
 1865|  2.48k|            res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
 1866|       |
 1867|  2.48k|            res_16x8b = _mm_packus_epi16(res_t1_8x16b, res_t1_8x16b);
 1868|       |
 1869|  2.48k|            res_16x8b = _mm_avg_epu8(src_r0r1_16x8b, res_16x8b); //computing q-pel
 1870|       |
 1871|  2.48k|            *((WORD32 *)(pu1_dst)) = _mm_cvtsi128_si32(res_16x8b);
 1872|  2.48k|            res_16x8b = _mm_srli_si128(res_16x8b, 4);
 1873|  2.48k|            *((WORD32 *)(pu1_dst + dst_strd)) = _mm_cvtsi128_si32(res_16x8b);
 1874|       |
 1875|  2.48k|            src_r0_16x8b = src_r2_16x8b;
 1876|  2.48k|            src_r1_16x8b = src_r3_16x8b;
 1877|  2.48k|            src_r2_16x8b = src_r4_16x8b;
 1878|  2.48k|            src_r3_16x8b = src_r5_16x8b;
 1879|  2.48k|            src_r4_16x8b = src_r6_16x8b;
 1880|       |
 1881|  2.48k|            ht -= 2;
 1882|  2.48k|            pu1_src += src_strd << 1;
 1883|  2.48k|            pu1_pred1 += src_strd << 1;
 1884|  2.48k|            pu1_dst += dst_strd << 1;
 1885|  2.48k|        }
 1886|  2.48k|        while(ht > 0);
  ------------------
  |  Branch (1886:15): [True: 1.79k, False: 685]
  ------------------
 1887|    685|    }
 1888|       |
 1889|  5.98k|    else if(wd == 8)
  ------------------
  |  Branch (1889:13): [True: 2.83k, False: 3.15k]
  ------------------
 1890|  2.83k|    {
 1891|       |        //Epilogue: Load all the pred rows except sixth and seventh row
 1892|       |        //          for the first and second row processing.
 1893|  2.83k|        src_r0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
 1894|  2.83k|        pu1_src += src_strd;
 1895|  2.83k|        src_r1_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
 1896|  2.83k|        pu1_src += src_strd;
 1897|  2.83k|        src_r2_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
 1898|  2.83k|        pu1_src += src_strd;
 1899|  2.83k|        src_r3_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
 1900|  2.83k|        pu1_src += src_strd;
 1901|  2.83k|        src_r4_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
 1902|  2.83k|        pu1_src += src_strd;
 1903|       |
 1904|  2.83k|        src_r0_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);
 1905|  2.83k|        src_r1_16x8b = _mm_unpacklo_epi64(src_r1_16x8b, src_r2_16x8b);
 1906|  2.83k|        src_r2_16x8b = _mm_unpacklo_epi64(src_r2_16x8b, src_r3_16x8b);
 1907|  2.83k|        src_r3_16x8b = _mm_unpacklo_epi64(src_r3_16x8b, src_r4_16x8b);
 1908|       |
 1909|  2.83k|        do
 1910|  16.3k|        {
 1911|  16.3k|            src_r5_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
 1912|  16.3k|            src_r6_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + src_strd));
 1913|       |
 1914|  16.3k|            src_r4_16x8b = _mm_unpacklo_epi64(src_r4_16x8b, src_r5_16x8b);
 1915|  16.3k|            src_r5_16x8b = _mm_unpacklo_epi64(src_r5_16x8b, src_r6_16x8b);
 1916|       |
 1917|  16.3k|            src_r0r1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r1_16x8b);
 1918|  16.3k|            src_r2r3_16x8b = _mm_unpacklo_epi8(src_r2_16x8b, src_r3_16x8b);
 1919|  16.3k|            src_r4r5_16x8b = _mm_unpacklo_epi8(src_r4_16x8b, src_r5_16x8b);
 1920|       |
 1921|  16.3k|            res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 1922|  16.3k|            res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 1923|  16.3k|            res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 1924|       |
 1925|  16.3k|            src_r0r1_16x8b = _mm_loadl_epi64((__m128i *)pu1_pred1);
 1926|       |
 1927|  16.3k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 1928|  16.3k|            res_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_t3_8x16b);
 1929|  16.3k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
 1930|       |
 1931|  16.3k|            res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
 1932|       |
 1933|  16.3k|            res_16x8b = _mm_packus_epi16(res_t1_8x16b, res_t1_8x16b);
 1934|  16.3k|            res_16x8b = _mm_avg_epu8(src_r0r1_16x8b, res_16x8b); //computing q-pel
 1935|       |
 1936|  16.3k|            _mm_storel_epi64((__m128i *)pu1_dst, res_16x8b);
 1937|       |
 1938|  16.3k|            src_r0r1_16x8b = _mm_unpackhi_epi8(src_r0_16x8b, src_r1_16x8b);
 1939|  16.3k|            src_r2r3_16x8b = _mm_unpackhi_epi8(src_r2_16x8b, src_r3_16x8b);
 1940|  16.3k|            src_r4r5_16x8b = _mm_unpackhi_epi8(src_r4_16x8b, src_r5_16x8b);
 1941|       |
 1942|  16.3k|            res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 1943|  16.3k|            res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 1944|  16.3k|            res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 1945|       |
 1946|  16.3k|            src_r0r1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred1 + src_strd));
 1947|       |
 1948|  16.3k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 1949|  16.3k|            res_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_t3_8x16b);
 1950|  16.3k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
 1951|       |
 1952|  16.3k|            res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
 1953|       |
 1954|  16.3k|            res_16x8b = _mm_packus_epi16(res_t1_8x16b, res_t1_8x16b);
 1955|  16.3k|            res_16x8b = _mm_avg_epu8(src_r0r1_16x8b, res_16x8b); //computing q-pel
 1956|       |
 1957|  16.3k|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), res_16x8b);
 1958|       |
 1959|  16.3k|            src_r0_16x8b = src_r2_16x8b;
 1960|  16.3k|            src_r1_16x8b = src_r3_16x8b;
 1961|  16.3k|            src_r2_16x8b = src_r4_16x8b;
 1962|  16.3k|            src_r3_16x8b = src_r5_16x8b;
 1963|  16.3k|            src_r4_16x8b = src_r6_16x8b;
 1964|       |
 1965|  16.3k|            ht -= 2;
 1966|  16.3k|            pu1_src += src_strd << 1;
 1967|  16.3k|            pu1_pred1 += src_strd << 1;
 1968|  16.3k|            pu1_dst += dst_strd << 1;
 1969|  16.3k|        }
 1970|  16.3k|        while(ht > 0);
  ------------------
  |  Branch (1970:15): [True: 13.4k, False: 2.83k]
  ------------------
 1971|  2.83k|    }
 1972|  3.15k|    else // wd == 16
 1973|  3.15k|    {
 1974|  3.15k|        __m128i res_t0_8x16b;
 1975|       |
 1976|       |        //Epilogue: Load all the pred rows except sixth and seventh row
 1977|       |        //          for the first and second row processing.
 1978|  3.15k|        src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
 1979|  3.15k|        pu1_src += src_strd;
 1980|  3.15k|        src_r1_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
 1981|  3.15k|        pu1_src += src_strd;
 1982|  3.15k|        src_r2_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
 1983|  3.15k|        pu1_src += src_strd;
 1984|  3.15k|        src_r3_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
 1985|  3.15k|        pu1_src += src_strd;
 1986|  3.15k|        src_r4_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
 1987|  3.15k|        pu1_src += src_strd;
 1988|       |
 1989|  3.15k|        do
 1990|  21.4k|        {
 1991|  21.4k|            src_r5_16x8b  = _mm_loadu_si128((__m128i *)pu1_src);
 1992|  21.4k|            src_r6_16x8b  = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));
 1993|       |
 1994|  21.4k|            src_r0r1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r1_16x8b);
 1995|  21.4k|            src_r2r3_16x8b = _mm_unpacklo_epi8(src_r2_16x8b, src_r3_16x8b);
 1996|  21.4k|            src_r4r5_16x8b = _mm_unpacklo_epi8(src_r4_16x8b, src_r5_16x8b);
 1997|       |
 1998|  21.4k|            res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 1999|  21.4k|            res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2000|  21.4k|            res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2001|       |
 2002|  21.4k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2003|  21.4k|            res_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_t3_8x16b);
 2004|  21.4k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
 2005|       |
 2006|  21.4k|            res_t0_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
 2007|       |
 2008|  21.4k|            src_r0r1_16x8b = _mm_unpackhi_epi8(src_r0_16x8b, src_r1_16x8b);
 2009|  21.4k|            src_r2r3_16x8b = _mm_unpackhi_epi8(src_r2_16x8b, src_r3_16x8b);
 2010|  21.4k|            src_r4r5_16x8b = _mm_unpackhi_epi8(src_r4_16x8b, src_r5_16x8b);
 2011|       |
 2012|  21.4k|            res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2013|  21.4k|            res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2014|  21.4k|            res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2015|       |
 2016|  21.4k|            src_r0r1_16x8b = _mm_loadu_si128((__m128i *)pu1_pred1);
 2017|       |
 2018|  21.4k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2019|  21.4k|            res_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_t3_8x16b);
 2020|  21.4k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
 2021|       |
 2022|  21.4k|            res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
 2023|       |
 2024|  21.4k|            res_16x8b = _mm_packus_epi16(res_t0_8x16b, res_t1_8x16b);
 2025|  21.4k|            res_16x8b = _mm_avg_epu8(src_r0r1_16x8b, res_16x8b); //computing q-pel
 2026|       |
 2027|  21.4k|            _mm_storeu_si128((__m128i *)pu1_dst, res_16x8b);
 2028|       |
 2029|  21.4k|            src_r0r1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r2_16x8b);
 2030|  21.4k|            src_r2r3_16x8b = _mm_unpacklo_epi8(src_r3_16x8b, src_r4_16x8b);
 2031|  21.4k|            src_r4r5_16x8b = _mm_unpacklo_epi8(src_r5_16x8b, src_r6_16x8b);
 2032|       |
 2033|  21.4k|            res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2034|  21.4k|            res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2035|  21.4k|            res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2036|       |
 2037|  21.4k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2038|  21.4k|            res_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_t3_8x16b);
 2039|  21.4k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
 2040|       |
 2041|  21.4k|            res_t0_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
 2042|       |
 2043|  21.4k|            src_r0r1_16x8b = _mm_unpackhi_epi8(src_r1_16x8b, src_r2_16x8b);
 2044|  21.4k|            src_r2r3_16x8b = _mm_unpackhi_epi8(src_r3_16x8b, src_r4_16x8b);
 2045|  21.4k|            src_r4r5_16x8b = _mm_unpackhi_epi8(src_r5_16x8b, src_r6_16x8b);
 2046|       |
 2047|  21.4k|            res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2048|  21.4k|            res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2049|  21.4k|            res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2050|       |
 2051|  21.4k|            src_r0r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_pred1 + src_strd));
 2052|       |
 2053|  21.4k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2054|  21.4k|            res_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_t3_8x16b);
 2055|  21.4k|            res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
 2056|       |
 2057|  21.4k|            res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
 2058|       |
 2059|  21.4k|            res_16x8b = _mm_packus_epi16(res_t0_8x16b, res_t1_8x16b);
 2060|  21.4k|            res_16x8b = _mm_avg_epu8(src_r0r1_16x8b, res_16x8b); //computing q-pel
 2061|       |
 2062|  21.4k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), res_16x8b);
 2063|       |
 2064|  21.4k|            src_r0_16x8b = src_r2_16x8b;
 2065|  21.4k|            src_r1_16x8b = src_r3_16x8b;
 2066|  21.4k|            src_r2_16x8b = src_r4_16x8b;
 2067|  21.4k|            src_r3_16x8b = src_r5_16x8b;
 2068|  21.4k|            src_r4_16x8b = src_r6_16x8b;
 2069|       |
 2070|  21.4k|            ht -= 2;
 2071|  21.4k|            pu1_src += src_strd << 1;
 2072|  21.4k|            pu1_pred1 += src_strd << 1;
 2073|  21.4k|            pu1_dst += dst_strd << 1;
 2074|  21.4k|        }
 2075|  21.4k|        while(ht > 0);
  ------------------
  |  Branch (2075:15): [True: 18.2k, False: 3.15k]
  ------------------
 2076|  3.15k|    }
 2077|  6.67k|}
ih264_inter_pred_luma_horz_qpel_vert_qpel_ssse3:
 2118|  11.6k|{
 2119|  11.6k|    WORD32 ht_temp;
 2120|  11.6k|    UWORD8 *pu1_pred_vert,*pu1_pred_horiz;
 2121|  11.6k|    UWORD8 *pu1_tmp1, *pu1_tmp2;
 2122|  11.6k|    WORD32 x_offset, y_offset;
 2123|       |
 2124|  11.6k|    __m128i coeff0_1_16x8b, coeff2_3_16x8b, coeff4_5_16x8b;
 2125|  11.6k|    __m128i const_val16_8x16b;
 2126|       |
 2127|  11.6k|    pu1_tmp1 = pu1_tmp;
 2128|       |
 2129|  11.6k|    dydx &= 0xf;
 2130|  11.6k|    ht_temp = ht;
 2131|  11.6k|    x_offset = dydx & 0x3;
 2132|  11.6k|    y_offset = dydx >> 2;
 2133|  11.6k|    pu1_tmp2 = pu1_tmp1;
 2134|       |
 2135|  11.6k|    pu1_pred_vert  = pu1_src + (x_offset >> 1) - 2*src_strd;
 2136|  11.6k|    pu1_pred_horiz = pu1_src + (y_offset >> 1) * src_strd - 2;
 2137|       |    //the filter input starts from x[-2] (till x[3])
 2138|       |
 2139|  11.6k|    coeff0_1_16x8b = _mm_set1_epi32(0xFB01FB01);  //c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1
 2140|  11.6k|    coeff2_3_16x8b = _mm_set1_epi32(0x14141414);  //c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3
 2141|  11.6k|    coeff4_5_16x8b = _mm_set1_epi32(0x01FB01FB);  //c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5
 2142|       |                                                  //c0 = c5 = 1, c1 = c4 = -5, c2 = c3 = 20
 2143|  11.6k|    const_val16_8x16b = _mm_set1_epi16(16);
 2144|       |
 2145|  11.6k|    if(wd == 4)
  ------------------
  |  Branch (2145:8): [True: 610, False: 11.0k]
  ------------------
 2146|    610|    {
 2147|       |        //vertical q-pel filter
 2148|    610|        {
 2149|    610|            __m128i src_r0_16x8b, src_r1_16x8b, src_r2_16x8b, src_r3_16x8b, src_r4_16x8b;
 2150|    610|            __m128i src_r5_16x8b, src_r6_16x8b;
 2151|    610|            __m128i src_r0r1_16x8b, src_r2r3_16x8b, src_r4r5_16x8b;
 2152|       |
 2153|    610|            __m128i res_r0r1_16x8b, res_t1_8x16b, res_t2_8x16b, res_t3_8x16b;
 2154|       |
 2155|       |            //epilogue: Load all the pred rows except sixth  and seventh row for the
 2156|       |            //first and second row processing.
 2157|    610|            src_r0_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred_vert));
 2158|    610|            pu1_pred_vert = pu1_pred_vert + src_strd;
 2159|       |
 2160|    610|            src_r1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred_vert));
 2161|    610|            pu1_pred_vert = pu1_pred_vert + src_strd;
 2162|    610|            src_r0_16x8b = _mm_unpacklo_epi32(src_r0_16x8b, src_r1_16x8b);
 2163|       |
 2164|    610|            src_r2_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred_vert));
 2165|    610|            pu1_pred_vert = pu1_pred_vert + src_strd;
 2166|    610|            src_r1_16x8b = _mm_unpacklo_epi32(src_r1_16x8b, src_r2_16x8b);
 2167|       |
 2168|    610|            src_r3_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred_vert));
 2169|    610|            pu1_pred_vert = pu1_pred_vert + src_strd;
 2170|    610|            src_r2_16x8b = _mm_unpacklo_epi32(src_r2_16x8b, src_r3_16x8b);
 2171|       |
 2172|    610|            src_r4_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred_vert));
 2173|    610|            pu1_pred_vert = pu1_pred_vert + src_strd;
 2174|    610|            src_r3_16x8b = _mm_unpacklo_epi32(src_r3_16x8b, src_r4_16x8b);
 2175|       |
 2176|       |            //Core Loop: Process all the rows.
 2177|    610|            do
 2178|  1.82k|            {
 2179|  1.82k|                src_r5_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred_vert));
 2180|  1.82k|                src_r4_16x8b = _mm_unpacklo_epi32(src_r4_16x8b, src_r5_16x8b);
 2181|       |
 2182|  1.82k|                src_r6_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred_vert + src_strd));
 2183|  1.82k|                src_r5_16x8b = _mm_unpacklo_epi32(src_r5_16x8b, src_r6_16x8b);
 2184|       |
 2185|  1.82k|                src_r0r1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r1_16x8b);
 2186|  1.82k|                src_r2r3_16x8b = _mm_unpacklo_epi8(src_r2_16x8b, src_r3_16x8b);
 2187|  1.82k|                src_r4r5_16x8b = _mm_unpacklo_epi8(src_r4_16x8b, src_r5_16x8b);
 2188|       |
 2189|  1.82k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2190|  1.82k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2191|  1.82k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2192|       |
 2193|  1.82k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2194|  1.82k|                res_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_t3_8x16b);
 2195|  1.82k|                res_t1_8x16b = _mm_add_epi16(res_t3_8x16b, res_t1_8x16b);
 2196|       |
 2197|  1.82k|                res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
 2198|  1.82k|                res_r0r1_16x8b = _mm_packus_epi16(res_t1_8x16b, res_t1_8x16b);
 2199|       |
 2200|  1.82k|                _mm_storel_epi64((__m128i *)pu1_tmp1, res_r0r1_16x8b);
 2201|       |
 2202|  1.82k|                src_r0_16x8b = src_r2_16x8b;
 2203|  1.82k|                src_r1_16x8b = src_r3_16x8b;
 2204|  1.82k|                src_r2_16x8b = src_r4_16x8b;
 2205|  1.82k|                src_r3_16x8b = src_r5_16x8b;
 2206|  1.82k|                src_r4_16x8b = src_r6_16x8b;
 2207|       |
 2208|  1.82k|                ht_temp -= 2;
 2209|  1.82k|                pu1_pred_vert += src_strd << 1;
 2210|  1.82k|                pu1_tmp1 += 8;
 2211|  1.82k|            }
 2212|  1.82k|            while(ht_temp > 0);
  ------------------
  |  Branch (2212:19): [True: 1.21k, False: 610]
  ------------------
 2213|    610|        }
 2214|       |
 2215|       |        //horizontal q-pel filter
 2216|    610|        {
 2217|    610|            __m128i src_r0_16x8b, src_r1_16x8b;
 2218|    610|            __m128i src_r0_sht_16x8b, src_r1_sht_16x8b;
 2219|    610|            __m128i src_r0r1_vpel_16x8b, src_r0r1_t1_16x8b;
 2220|       |
 2221|    610|            __m128i res_r0r1_t1_8x16b, res_r0r1_t2_8x16b, res_r0r1_t3_8x16b;
 2222|    610|            __m128i res_r0r1_16x8b;
 2223|       |
 2224|       |            //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
 2225|       |            //Row1 : b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
 2226|       |
 2227|    610|            do
 2228|  1.82k|            {
 2229|  1.82k|                src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_pred_horiz);                  //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
 2230|  1.82k|                src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_pred_horiz + src_strd));     //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9....b15
 2231|       |
 2232|  1.82k|                src_r0r1_vpel_16x8b = _mm_loadl_epi64((__m128i *)pu1_tmp2);
 2233|       |
 2234|  1.82k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                          //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
 2235|  1.82k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                          //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
 2236|       |
 2237|  1.82k|                src_r0_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);            //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
 2238|  1.82k|                src_r1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);            //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
 2239|       |
 2240|  1.82k|                src_r0r1_t1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);          //a0 a1 a1 a2 a2 a3 a3 a4 b0 b1 b1 b2 b2 b3 b3 b4
 2241|  1.82k|                res_r0r1_t1_8x16b = _mm_maddubs_epi16(src_r0r1_t1_16x8b, coeff0_1_16x8b);    //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
 2242|       |                                                                                             //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
 2243|       |
 2244|  1.82k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 4);                              //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8  0  0  0  0
 2245|  1.82k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 4);                              //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8  0  0  0  0
 2246|       |
 2247|  1.82k|                src_r0r1_t1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);          //a2 a3 a3 a4 a4 a5 a5 a6 b2 b3 b3 b4 b4 b5 b5 b6
 2248|  1.82k|                res_r0r1_t2_8x16b = _mm_maddubs_epi16(src_r0r1_t1_16x8b, coeff2_3_16x8b);    //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
 2249|       |                                                                                             //b2*c2+b3*c3 b3*c2+b4*c3 b4*c2+b5*c3 b5*c2+b6*c3
 2250|       |
 2251|  1.82k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 4);                              //a4 a5 a5 a6 a6 a7 a7 a8  0  0  0  0  0  0  0  0
 2252|  1.82k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 4);                              //b4 b5 b5 b6 b6 b7 b7 b8  0  0  0  0  0  0  0  0
 2253|       |
 2254|  1.82k|                src_r0r1_t1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);          //a4 a5 a5 a6 a6 a7 a7 a8 b4 b5 b5 b6 b6 b7 b7 b8
 2255|  1.82k|                res_r0r1_t3_8x16b = _mm_maddubs_epi16(src_r0r1_t1_16x8b, coeff4_5_16x8b);    //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
 2256|       |                                                                                             //b4*c4+b5*c5 b5*c4+b6*c5 b4*c6+b7*c5 b7*c4+b8*c5
 2257|       |
 2258|  1.82k|                res_r0r1_t1_8x16b = _mm_add_epi16(res_r0r1_t1_8x16b, res_r0r1_t2_8x16b);
 2259|  1.82k|                res_r0r1_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_r0r1_t3_8x16b);
 2260|  1.82k|                res_r0r1_t1_8x16b = _mm_add_epi16(res_r0r1_t1_8x16b, res_r0r1_t3_8x16b);     //a0*c0+a1*c1+a2*c2+a3*c3+a4*a4+a5*c5 + 15;
 2261|       |                                                                                             //a1*c0+a2*c1+a2*c2+a3*c3+a5*a4+a6*c5 + 15;
 2262|       |                                                                                             //a2*c0+a3*c1+a4*c2+a5*c3+a6*a4+a7*c5 + 15;
 2263|       |                                                                                             //a3*c0+a4*c1+a5*c2+a6*c3+a6*a4+a8*c5 + 15;
 2264|       |                                                                                             //b0*c0+b1*c1+b2*c2+b3*c3+b4*b4+b5*c5 + 15;
 2265|       |                                                                                             //b1*c0+b2*c1+b2*c2+b3*c3+b5*b4+b6*c5 + 15;
 2266|       |                                                                                             //b2*c0+b3*c1+b4*c2+b5*c3+b6*b4+b7*c5 + 15;
 2267|       |                                                                                             //b3*c0+b4*c1+b5*c2+b6*c3+b6*b4+b8*c5 + 15;
 2268|       |
 2269|  1.82k|                res_r0r1_t1_8x16b = _mm_srai_epi16(res_r0r1_t1_8x16b, 5);                    //shifting right by 5 bits.
 2270|       |
 2271|  1.82k|                res_r0r1_16x8b = _mm_packus_epi16(res_r0r1_t1_8x16b,res_r0r1_t1_8x16b);
 2272|       |
 2273|  1.82k|                res_r0r1_16x8b = _mm_avg_epu8(res_r0r1_16x8b,src_r0r1_vpel_16x8b);
 2274|       |
 2275|  1.82k|                *((WORD32 *)(pu1_dst)) = _mm_cvtsi128_si32(res_r0r1_16x8b);
 2276|  1.82k|                res_r0r1_16x8b = _mm_srli_si128(res_r0r1_16x8b, 4);
 2277|  1.82k|                *((WORD32 *)(pu1_dst + dst_strd)) = _mm_cvtsi128_si32(res_r0r1_16x8b);
 2278|       |
 2279|  1.82k|                ht -= 2;
 2280|  1.82k|                pu1_pred_horiz += src_strd << 1;
 2281|  1.82k|                pu1_tmp2 += 8;
 2282|  1.82k|                pu1_dst += dst_strd << 1;
 2283|  1.82k|            }
 2284|  1.82k|            while(ht > 0);
  ------------------
  |  Branch (2284:19): [True: 1.21k, False: 610]
  ------------------
 2285|    610|        }
 2286|    610|    }
 2287|  11.0k|    else if(wd == 8)
  ------------------
  |  Branch (2287:13): [True: 4.10k, False: 6.90k]
  ------------------
 2288|  4.10k|    {
 2289|       |        //vertical q-pel filter
 2290|  4.10k|        {
 2291|  4.10k|            __m128i src_r0_16x8b, src_r1_16x8b, src_r2_16x8b, src_r3_16x8b;
 2292|  4.10k|            __m128i src_r4_16x8b, src_r5_16x8b, src_r6_16x8b;
 2293|  4.10k|            __m128i src_r0r1_16x8b, src_r2r3_16x8b, src_r4r5_16x8b;
 2294|       |
 2295|  4.10k|            __m128i res_16x8b, res_t1_8x16b, res_t2_8x16b, res_t3_8x16b;
 2296|       |
 2297|       |            //epilogue: Load all the pred rows except sixth  and seventh row for the
 2298|       |            //first and second row processing.
 2299|  4.10k|            src_r0_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred_vert));
 2300|  4.10k|            pu1_pred_vert = pu1_pred_vert + src_strd;
 2301|       |
 2302|  4.10k|            src_r1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred_vert));
 2303|  4.10k|            pu1_pred_vert = pu1_pred_vert + src_strd;
 2304|  4.10k|            src_r0_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);
 2305|       |
 2306|  4.10k|            src_r2_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred_vert));
 2307|  4.10k|            pu1_pred_vert = pu1_pred_vert + src_strd;
 2308|  4.10k|            src_r1_16x8b = _mm_unpacklo_epi64(src_r1_16x8b, src_r2_16x8b);
 2309|       |
 2310|  4.10k|            src_r3_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred_vert));
 2311|  4.10k|            pu1_pred_vert = pu1_pred_vert + src_strd;
 2312|  4.10k|            src_r2_16x8b = _mm_unpacklo_epi64(src_r2_16x8b, src_r3_16x8b);
 2313|       |
 2314|  4.10k|            src_r4_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred_vert));
 2315|  4.10k|            pu1_pred_vert = pu1_pred_vert + src_strd;
 2316|  4.10k|            src_r3_16x8b = _mm_unpacklo_epi64(src_r3_16x8b, src_r4_16x8b);
 2317|       |
 2318|       |            //Core Loop: Process all the rows.
 2319|  4.10k|            do
 2320|  26.1k|            {
 2321|  26.1k|                src_r5_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred_vert));
 2322|  26.1k|                src_r4_16x8b = _mm_unpacklo_epi64(src_r4_16x8b, src_r5_16x8b);
 2323|       |
 2324|  26.1k|                src_r6_16x8b = _mm_loadl_epi64((__m128i *)(pu1_pred_vert + src_strd));
 2325|  26.1k|                src_r5_16x8b = _mm_unpacklo_epi64(src_r5_16x8b, src_r6_16x8b);
 2326|       |
 2327|  26.1k|                src_r0r1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r1_16x8b);
 2328|  26.1k|                src_r2r3_16x8b = _mm_unpacklo_epi8(src_r2_16x8b, src_r3_16x8b);
 2329|  26.1k|                src_r4r5_16x8b = _mm_unpacklo_epi8(src_r4_16x8b, src_r5_16x8b);
 2330|       |
 2331|  26.1k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2332|  26.1k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2333|  26.1k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2334|       |
 2335|  26.1k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2336|  26.1k|                res_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_t3_8x16b);
 2337|  26.1k|                res_t1_8x16b = _mm_add_epi16(res_t3_8x16b, res_t1_8x16b);
 2338|       |
 2339|  26.1k|                res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
 2340|  26.1k|                res_16x8b = _mm_packus_epi16(res_t1_8x16b, res_t1_8x16b);
 2341|       |
 2342|  26.1k|                _mm_storel_epi64((__m128i *)(pu1_tmp1), res_16x8b);
 2343|       |
 2344|  26.1k|                src_r0r1_16x8b = _mm_unpackhi_epi8(src_r0_16x8b, src_r1_16x8b);
 2345|  26.1k|                src_r2r3_16x8b = _mm_unpackhi_epi8(src_r2_16x8b, src_r3_16x8b);
 2346|  26.1k|                src_r4r5_16x8b = _mm_unpackhi_epi8(src_r4_16x8b, src_r5_16x8b);
 2347|       |
 2348|  26.1k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2349|  26.1k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2350|  26.1k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2351|       |
 2352|  26.1k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2353|  26.1k|                res_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_t3_8x16b);
 2354|  26.1k|                res_t1_8x16b = _mm_add_epi16(res_t3_8x16b, res_t1_8x16b);
 2355|       |
 2356|  26.1k|                res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
 2357|  26.1k|                res_16x8b = _mm_packus_epi16(res_t1_8x16b, res_t1_8x16b);
 2358|       |
 2359|  26.1k|                _mm_storel_epi64((__m128i *)(pu1_tmp1 + 8), res_16x8b);
 2360|       |
 2361|  26.1k|                src_r0_16x8b = src_r2_16x8b;
 2362|  26.1k|                src_r1_16x8b = src_r3_16x8b;
 2363|  26.1k|                src_r2_16x8b = src_r4_16x8b;
 2364|  26.1k|                src_r3_16x8b = src_r5_16x8b;
 2365|  26.1k|                src_r4_16x8b = src_r6_16x8b;
 2366|       |
 2367|  26.1k|                ht_temp -= 2;
 2368|  26.1k|                pu1_pred_vert += src_strd << 1;
 2369|  26.1k|                pu1_tmp1 += 16;
 2370|  26.1k|            }
 2371|  26.1k|            while(ht_temp > 0);
  ------------------
  |  Branch (2371:19): [True: 22.0k, False: 4.10k]
  ------------------
 2372|  4.10k|        }
 2373|       |
 2374|       |        //horizontal q-pel filter
 2375|  4.10k|        {
 2376|  4.10k|            __m128i src_r0_16x8b, src_r1_16x8b, src_r0_sht_16x8b, src_r1_sht_16x8b;
 2377|  4.10k|            __m128i src_r0_t1_16x8b, src_r1_t1_16x8b;
 2378|  4.10k|            __m128i src_r0_vpel_16x8b, src_r1_vpel_16x8b;
 2379|       |
 2380|  4.10k|            __m128i res_r0_t1_8x16b, res_r0_t2_8x16b, res_r0_t3_8x16b;
 2381|  4.10k|            __m128i res_r1_t1_8x16b, res_r1_t2_8x16b, res_r1_t3_8x16b, res_16x8b;
 2382|       |
 2383|       |            //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
 2384|       |            //Row1 : b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
 2385|       |
 2386|  4.10k|            do
 2387|  26.1k|            {
 2388|  26.1k|                src_r0_16x8b = _mm_loadu_si128((__m128i *)(pu1_pred_horiz));               //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
 2389|  26.1k|                src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_pred_horiz + src_strd));    //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9....b15
 2390|       |
 2391|  26.1k|                src_r0_vpel_16x8b = _mm_loadl_epi64((__m128i *)(pu1_tmp2));                //a2 a3 a4 a5 a6 a7 a8....a15 0 or
 2392|       |                                                                                           //a3 a4 a5 a6 a7 a8 a9....a15 0
 2393|  26.1k|                src_r1_vpel_16x8b = _mm_loadl_epi64((__m128i *)(pu1_tmp2 + 8));
 2394|       |                                                                                           //b2 b3 b4 b5 b6 b7 b8....b15 0 or
 2395|       |                                                                                           //b3 b4 b5 b6 b7 b8 b9....b15 0
 2396|       |
 2397|  26.1k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                        //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
 2398|  26.1k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                        //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
 2399|       |
 2400|  26.1k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);       //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
 2401|  26.1k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);       //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
 2402|       |
 2403|  26.1k|                res_r0_t1_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff0_1_16x8b);      //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
 2404|       |                                                                                           //a4*c0+a5*c1 a5*c0+a6*c1 a6*c0+a7*c1 a7*c0+a8*c1
 2405|  26.1k|                res_r1_t1_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff0_1_16x8b);      //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
 2406|       |                                                                                           //b4*c0+b5*c1 b5*c0+b6*c1 b6*c0+b7*c1 b7*c0+b8*c1
 2407|       |
 2408|  26.1k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                            //a2 a3 a4 a5 a6 a7 a8 a9....a15 0 0
 2409|  26.1k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                            //b2 b3 b4 b5 b6 b7 b8 b9....b15 0 0
 2410|       |
 2411|  26.1k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                    //a3 a4 a5 a6 a7 a8 a9....a15 0  0  0
 2412|  26.1k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                    //b3 b4 b5 b6 b7 b8 b9....b15 0  0  0
 2413|       |
 2414|  26.1k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);       //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10
 2415|  26.1k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);       //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8 a8 a9 a9 a10
 2416|       |
 2417|  26.1k|                res_r0_t2_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff2_3_16x8b);      //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
 2418|       |                                                                                           //a6*c2+a7*c3 a7*c2+a8*c3 a8*c2+a9*c3 a9*c2+a10*c3
 2419|  26.1k|                res_r1_t2_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff2_3_16x8b);      //b2*c2+b3*c3 b3*c2+b4*c3 b2*c4+b5*c3 b5*c2+b6*c3
 2420|       |                                                                                           //b6*c2+b7*c3 b7*c2+b8*c3 b8*c2+b9*c3 b9*c2+b10*c3
 2421|       |
 2422|  26.1k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                            //a4 a5 a6 a7 a8 a9....a15 0  0  0  0
 2423|  26.1k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                            //b4 b5 b6 b7 b8 b9....b15 0  0  0  0
 2424|       |
 2425|  26.1k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                    //a5 a6 a7 a8 a9....a15 0  0  0  0  0
 2426|  26.1k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                    //b5 b6 b7 b8 b9....b15 0  0  0  0  0
 2427|       |
 2428|  26.1k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);       //a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10 a10 a11 a11 a12
 2429|  26.1k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);       //b4 b5 b5 b6 b6 b7 b7 b8 b8 b9 b9 b10 b10 b11 b11 b12
 2430|       |
 2431|  26.1k|                res_r0_t3_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff4_5_16x8b);      //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
 2432|       |                                                                                           //a8*c4+a9*c5 a9*c4+a10*c5 a10*c4+a11*c5 a11*c4+a12*c5
 2433|  26.1k|                res_r1_t3_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff4_5_16x8b);      //b4*c4+b5*c5 b5*c4+b6*c5 b6*c4+b7*c5 b7*c4+b8*c5
 2434|       |                                                                                           //b8*c4+b9*c5 b9*c4+b10*c5 b10*c4+b11*c5 b11*c4+b12*c5
 2435|  26.1k|                res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t2_8x16b);
 2436|  26.1k|                res_r0_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_r0_t3_8x16b);
 2437|  26.1k|                res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t3_8x16b);
 2438|  26.1k|                res_r0_t1_8x16b = _mm_srai_epi16(res_r0_t1_8x16b, 5);                      //shifting right by 5 bits.
 2439|       |
 2440|  26.1k|                res_16x8b = _mm_packus_epi16(res_r0_t1_8x16b, res_r0_t1_8x16b);
 2441|  26.1k|                res_16x8b = _mm_avg_epu8(res_16x8b, src_r0_vpel_16x8b);
 2442|       |
 2443|  26.1k|                _mm_storel_epi64((__m128i *)(pu1_dst), res_16x8b);
 2444|       |
 2445|  26.1k|                res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t2_8x16b);
 2446|  26.1k|                res_r1_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_r1_t3_8x16b);
 2447|  26.1k|                res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t3_8x16b);
 2448|  26.1k|                res_r1_t1_8x16b = _mm_srai_epi16(res_r1_t1_8x16b, 5);                      //shifting right by 5 bits.
 2449|       |
 2450|  26.1k|                res_16x8b = _mm_packus_epi16(res_r1_t1_8x16b, res_r1_t1_8x16b);
 2451|  26.1k|                res_16x8b = _mm_avg_epu8(res_16x8b,src_r1_vpel_16x8b);
 2452|       |
 2453|  26.1k|                _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), res_16x8b);
 2454|       |
 2455|  26.1k|                ht -= 2;
 2456|  26.1k|                pu1_pred_horiz += src_strd << 1;
 2457|  26.1k|                pu1_dst += dst_strd << 1;
 2458|  26.1k|                pu1_tmp2 += 16;
 2459|  26.1k|            }
 2460|  26.1k|            while(ht > 0);
  ------------------
  |  Branch (2460:19): [True: 22.0k, False: 4.10k]
  ------------------
 2461|  4.10k|        }
 2462|  4.10k|    }
 2463|  6.90k|    else // wd == 16
 2464|  6.90k|    {
 2465|       |        //vertical q-pel filter
 2466|  6.90k|        {
 2467|  6.90k|            __m128i src_r0_16x8b, src_r1_16x8b, src_r2_16x8b, src_r3_16x8b;
 2468|  6.90k|            __m128i src_r4_16x8b, src_r5_16x8b, src_r6_16x8b;
 2469|  6.90k|            __m128i src_r0r1_16x8b, src_r2r3_16x8b, src_r4r5_16x8b;
 2470|       |
 2471|  6.90k|            __m128i res_t0_8x16b, res_t1_8x16b, res_t2_8x16b, res_t3_8x16b;
 2472|  6.90k|            __m128i res_16x8b;
 2473|       |
 2474|       |            //epilogue: Load all the pred rows except sixth  and seventh row for the
 2475|       |            //first and second row processing.
 2476|  6.90k|            src_r0_16x8b = _mm_loadu_si128((__m128i *)(pu1_pred_vert));
 2477|  6.90k|            pu1_pred_vert =  pu1_pred_vert + src_strd;
 2478|  6.90k|            src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_pred_vert));
 2479|  6.90k|            pu1_pred_vert =  pu1_pred_vert + src_strd;
 2480|  6.90k|            src_r2_16x8b = _mm_loadu_si128((__m128i *)(pu1_pred_vert));
 2481|  6.90k|            pu1_pred_vert =  pu1_pred_vert + src_strd;
 2482|  6.90k|            src_r3_16x8b = _mm_loadu_si128((__m128i *)(pu1_pred_vert));
 2483|  6.90k|            pu1_pred_vert =  pu1_pred_vert + src_strd;
 2484|  6.90k|            src_r4_16x8b = _mm_loadu_si128((__m128i *)(pu1_pred_vert));
 2485|  6.90k|            pu1_pred_vert =  pu1_pred_vert + src_strd;
 2486|       |
 2487|       |            //Core Loop: Process all the rows.
 2488|  6.90k|            do
 2489|  48.2k|            {
 2490|  48.2k|                src_r5_16x8b = _mm_loadu_si128((__m128i *)(pu1_pred_vert));
 2491|  48.2k|                src_r6_16x8b = _mm_loadu_si128((__m128i *)(pu1_pred_vert + src_strd));
 2492|       |
 2493|  48.2k|                src_r0r1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r1_16x8b);
 2494|  48.2k|                src_r2r3_16x8b = _mm_unpacklo_epi8(src_r2_16x8b, src_r3_16x8b);
 2495|  48.2k|                src_r4r5_16x8b = _mm_unpacklo_epi8(src_r4_16x8b, src_r5_16x8b);
 2496|       |
 2497|  48.2k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2498|  48.2k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2499|  48.2k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2500|       |
 2501|  48.2k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2502|  48.2k|                res_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_t3_8x16b);
 2503|  48.2k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
 2504|  48.2k|                res_t0_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
 2505|       |
 2506|  48.2k|                src_r0r1_16x8b = _mm_unpackhi_epi8(src_r0_16x8b, src_r1_16x8b);
 2507|  48.2k|                src_r2r3_16x8b = _mm_unpackhi_epi8(src_r2_16x8b, src_r3_16x8b);
 2508|  48.2k|                src_r4r5_16x8b = _mm_unpackhi_epi8(src_r4_16x8b, src_r5_16x8b);
 2509|       |
 2510|  48.2k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2511|  48.2k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2512|  48.2k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2513|       |
 2514|  48.2k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2515|  48.2k|                res_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_t3_8x16b);
 2516|  48.2k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
 2517|  48.2k|                res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
 2518|       |
 2519|  48.2k|                res_16x8b = _mm_packus_epi16(res_t0_8x16b, res_t1_8x16b);
 2520|       |
 2521|  48.2k|                _mm_storeu_si128((__m128i *)(pu1_tmp1), res_16x8b);
 2522|       |
 2523|  48.2k|                src_r0r1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r2_16x8b);
 2524|  48.2k|                src_r2r3_16x8b = _mm_unpacklo_epi8(src_r3_16x8b, src_r4_16x8b);
 2525|  48.2k|                src_r4r5_16x8b = _mm_unpacklo_epi8(src_r5_16x8b, src_r6_16x8b);
 2526|       |
 2527|  48.2k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2528|  48.2k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2529|  48.2k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2530|       |
 2531|  48.2k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2532|  48.2k|                res_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_t3_8x16b);
 2533|  48.2k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
 2534|  48.2k|                res_t0_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
 2535|       |
 2536|  48.2k|                src_r0r1_16x8b = _mm_unpackhi_epi8(src_r1_16x8b, src_r2_16x8b);
 2537|  48.2k|                src_r2r3_16x8b = _mm_unpackhi_epi8(src_r3_16x8b, src_r4_16x8b);
 2538|  48.2k|                src_r4r5_16x8b = _mm_unpackhi_epi8(src_r5_16x8b, src_r6_16x8b);
 2539|       |
 2540|  48.2k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2541|  48.2k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2542|  48.2k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2543|       |
 2544|  48.2k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2545|  48.2k|                res_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_t3_8x16b);
 2546|  48.2k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t3_8x16b);
 2547|  48.2k|                res_t1_8x16b = _mm_srai_epi16(res_t1_8x16b, 5); //shifting right by 5 bits.
 2548|       |
 2549|  48.2k|                res_16x8b = _mm_packus_epi16(res_t0_8x16b, res_t1_8x16b);
 2550|       |
 2551|  48.2k|                _mm_storeu_si128((__m128i *)(pu1_tmp1 + 16), res_16x8b);
 2552|       |
 2553|  48.2k|                src_r0_16x8b = src_r2_16x8b;
 2554|  48.2k|                src_r1_16x8b = src_r3_16x8b;
 2555|  48.2k|                src_r2_16x8b = src_r4_16x8b;
 2556|  48.2k|                src_r3_16x8b = src_r5_16x8b;
 2557|  48.2k|                src_r4_16x8b = src_r6_16x8b;
 2558|       |
 2559|  48.2k|                ht_temp -= 2;
 2560|  48.2k|                pu1_pred_vert += src_strd << 1;
 2561|  48.2k|                pu1_tmp1 += 32;
 2562|  48.2k|            }
 2563|  48.2k|            while(ht_temp > 0);
  ------------------
  |  Branch (2563:19): [True: 41.3k, False: 6.90k]
  ------------------
 2564|  6.90k|        }
 2565|       |        //horizontal q-pel filter
 2566|  6.90k|        {
 2567|  6.90k|            __m128i src_r0_16x8b, src_r1_16x8b, src_r0_sht_16x8b, src_r1_sht_16x8b;
 2568|  6.90k|            __m128i src_r0_t1_16x8b, src_r1_t1_16x8b;
 2569|  6.90k|            __m128i src_vpel_16x8b;
 2570|       |
 2571|  6.90k|            __m128i res_r0_t1_8x16b, res_r0_t2_8x16b, res_r0_t3_8x16b;
 2572|  6.90k|            __m128i res_r1_t1_8x16b, res_r1_t2_8x16b, res_r1_t3_8x16b;
 2573|  6.90k|            __m128i res_16x8b;
 2574|       |
 2575|       |            //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
 2576|       |            //Row0 :                         b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
 2577|       |            //b0 is same a8. Similarly other bn pixels are same as a(n+8) pixels.
 2578|       |
 2579|  6.90k|            do
 2580|  96.5k|            {
 2581|  96.5k|                src_r0_16x8b = _mm_loadu_si128((__m128i *)(pu1_pred_horiz));             //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
 2582|  96.5k|                src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_pred_horiz + 8));         //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9....b15
 2583|  96.5k|                src_vpel_16x8b = _mm_loadu_si128((__m128i *)(pu1_tmp2));
 2584|       |
 2585|  96.5k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                      //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
 2586|  96.5k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                      //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
 2587|       |
 2588|  96.5k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
 2589|  96.5k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
 2590|       |
 2591|  96.5k|                res_r0_t1_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff0_1_16x8b);    //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
 2592|       |                                                                                         //a4*c0+a5*c1 a5*c0+a6*c1 a6*c0+a7*c1 a7*c0+a8*c1
 2593|  96.5k|                res_r1_t1_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff0_1_16x8b);    //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
 2594|       |                                                                                         //b4*c0+b5*c1 b5*c0+b6*c1 b6*c0+b7*c1 b7*c0+b8*c1
 2595|       |
 2596|  96.5k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                          //a2 a3 a4 a5 a6 a7 a8 a9....a15 0 0
 2597|  96.5k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                          //b2 b3 b4 b5 b6 b7 b8 b9....b15 0 0
 2598|       |
 2599|  96.5k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                  //a3 a4 a5 a6 a7 a8 a9....a15 0  0  0
 2600|  96.5k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                  //b3 b4 b5 b6 b7 b8 b9....b15 0  0  0
 2601|       |
 2602|  96.5k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10
 2603|  96.5k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8 a8 a9 a9 a10
 2604|       |
 2605|  96.5k|                res_r0_t2_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff2_3_16x8b);    //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
 2606|       |                                                                                         //a6*c2+a7*c3 a7*c2+a8*c3 a8*c2+a9*c3 a9*c2+a10*c3
 2607|  96.5k|                res_r1_t2_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff2_3_16x8b);    //b2*c2+b3*c3 b3*c2+b4*c3 b2*c4+b5*c3 b5*c2+b6*c3
 2608|       |                                                                                         //b6*c2+b7*c3 b7*c2+b8*c3 b8*c2+b9*c3 b9*c2+b10*c3
 2609|       |
 2610|  96.5k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                          //a4 a5 a6 a7 a8 a9....a15 0  0  0  0
 2611|  96.5k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                          //b4 b5 b6 b7 b8 b9....b15 0  0  0  0
 2612|       |
 2613|  96.5k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                  //a5 a6 a7 a8 a9....a15 0  0  0  0  0
 2614|  96.5k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                  //b5 b6 b7 b8 b9....b15 0  0  0  0  0
 2615|       |
 2616|  96.5k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);     //a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10 a10 a11 a11 a12
 2617|  96.5k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);     //b4 b5 b5 b6 b6 b7 b7 b8 b8 b9 b9 b10 b10 b11 b11 b12
 2618|       |
 2619|  96.5k|                res_r0_t3_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff4_5_16x8b);    //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
 2620|       |                                                                                         //a8*c4+a9*c5 a9*c4+a10*c5 a10*c4+a11*c5 a11*c4+a12*c5
 2621|  96.5k|                res_r1_t3_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff4_5_16x8b);    //b4*c4+b5*c5 b5*c4+b6*c5 b6*c4+b7*c5 b7*c4+b8*c5
 2622|       |                                                                                         //b8*c4+b9*c5 b9*c4+b10*c5 b10*c4+b11*c5 b11*c4+b12*c5
 2623|  96.5k|                res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t2_8x16b);
 2624|  96.5k|                res_r0_t3_8x16b = _mm_add_epi16(const_val16_8x16b, res_r0_t3_8x16b);
 2625|  96.5k|                res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t3_8x16b);
 2626|  96.5k|                res_r0_t1_8x16b = _mm_srai_epi16(res_r0_t1_8x16b, 5);                    //shifting right by 5 bits.
 2627|       |
 2628|  96.5k|                res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t2_8x16b);
 2629|  96.5k|                res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t3_8x16b);
 2630|  96.5k|                res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, const_val16_8x16b);
 2631|  96.5k|                res_r1_t1_8x16b = _mm_srai_epi16(res_r1_t1_8x16b, 5);                    //shifting right by 5 bits.
 2632|       |
 2633|  96.5k|                res_16x8b = _mm_packus_epi16(res_r0_t1_8x16b, res_r1_t1_8x16b);
 2634|       |
 2635|  96.5k|                res_16x8b = _mm_avg_epu8(res_16x8b, src_vpel_16x8b);
 2636|  96.5k|                _mm_storeu_si128((__m128i *)(pu1_dst), res_16x8b);
 2637|       |
 2638|  96.5k|                ht --;
 2639|  96.5k|                pu1_pred_horiz  += src_strd;
 2640|  96.5k|                pu1_dst += dst_strd;
 2641|  96.5k|                pu1_tmp2 += 16;
 2642|  96.5k|            }
 2643|  96.5k|            while(ht > 0);
  ------------------
  |  Branch (2643:19): [True: 89.6k, False: 6.90k]
  ------------------
 2644|  6.90k|        }
 2645|  6.90k|    }
 2646|  11.6k|}
ih264_inter_pred_luma_horz_qpel_vert_hpel_ssse3:
 2686|  3.18k|{
 2687|  3.18k|    WORD32 ht_temp;
 2688|  3.18k|    WORD32 x_offset;
 2689|  3.18k|    WORD32 off0,off1, off2, off3, off4, off5;
 2690|  3.18k|    WORD16 *pi2_temp1,*pi2_temp2,*pi2_temp3;
 2691|       |
 2692|  3.18k|    ht_temp = ht;
 2693|  3.18k|    x_offset = dydx & 0x3;
 2694|  3.18k|    pi2_temp1 = (WORD16 *)pu1_tmp;
 2695|  3.18k|    pi2_temp2 = pi2_temp1;
 2696|  3.18k|    pi2_temp3 = pi2_temp1 + (x_offset >> 1);
 2697|       |
 2698|  3.18k|    pu1_src -= 2 * src_strd;
 2699|  3.18k|    pu1_src -= 2;
 2700|  3.18k|    pi2_temp3 += 2;
 2701|       |    //the filter input starts from x[-2] (till x[3])
 2702|       |
 2703|  3.18k|    if(wd == 4)
  ------------------
  |  Branch (2703:8): [True: 410, False: 2.77k]
  ------------------
 2704|    410|    {
 2705|       |        //vertical half-pel
 2706|    410|        {
 2707|    410|            __m128i src_r0_16x8b, src_r1_16x8b, src_r2_16x8b, src_r3_16x8b, src_r4_16x8b;
 2708|    410|            __m128i src_r5_16x8b, src_r6_16x8b;
 2709|    410|            __m128i src_r0r1_16x8b, src_r2r3_16x8b, src_r4r5_16x8b;
 2710|       |
 2711|    410|            __m128i res_t1_8x16b, res_t2_8x16b, res_t3_8x16b;
 2712|       |
 2713|    410|            __m128i coeff0_1_16x8b, coeff2_3_16x8b, coeff4_5_16x8b;
 2714|       |
 2715|    410|            coeff0_1_16x8b = _mm_set1_epi32(0xFB01FB01);  //c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1
 2716|    410|            coeff2_3_16x8b = _mm_set1_epi32(0x14141414);  //c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3
 2717|    410|            coeff4_5_16x8b = _mm_set1_epi32(0x01FB01FB);  //c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5
 2718|       |                                                          //c0 = c5 = 1, c1 = c4 = -5, c2 = c3 = 20
 2719|    410|            off0 = -((src_strd << 2) + src_strd) + 8;
 2720|    410|            off1 = -(src_strd << 2) + 8;
 2721|    410|            off2 = -((src_strd << 1) + src_strd) + 8;
 2722|    410|            off3 = -(src_strd << 1) + 8;
 2723|    410|            off4 = -src_strd + 8;
 2724|    410|            off5 = 8;
 2725|       |
 2726|       |            //epilogue: Load all the pred rows except sixth  and seventh row for the
 2727|       |            //first and second row processing.
 2728|    410|            src_r0_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src));
 2729|    410|            pu1_src =  pu1_src + src_strd;
 2730|       |
 2731|    410|            src_r1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src));
 2732|    410|            pu1_src =  pu1_src + src_strd;
 2733|       |
 2734|    410|            src_r2_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src));
 2735|    410|            pu1_src =  pu1_src + src_strd;
 2736|       |
 2737|    410|            src_r3_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src));
 2738|    410|            pu1_src =  pu1_src + src_strd;
 2739|       |
 2740|    410|            src_r4_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src));
 2741|    410|            pu1_src =  pu1_src + src_strd;
 2742|       |
 2743|       |            //Core Loop: Process all the rows.
 2744|    410|            do
 2745|  1.08k|            {
 2746|  1.08k|                src_r5_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src));
 2747|       |
 2748|  1.08k|                src_r0r1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r1_16x8b);
 2749|  1.08k|                src_r2r3_16x8b = _mm_unpacklo_epi8(src_r2_16x8b, src_r3_16x8b);
 2750|  1.08k|                src_r4r5_16x8b = _mm_unpacklo_epi8(src_r4_16x8b, src_r5_16x8b);
 2751|       |
 2752|  1.08k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2753|  1.08k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2754|  1.08k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2755|       |
 2756|  1.08k|                res_t1_8x16b = _mm_add_epi16(res_t2_8x16b, res_t1_8x16b);
 2757|  1.08k|                res_t1_8x16b = _mm_add_epi16(res_t3_8x16b, res_t1_8x16b);
 2758|       |
 2759|  1.08k|                _mm_storeu_si128((__m128i *)(pi2_temp1), res_t1_8x16b);
 2760|       |
 2761|  1.08k|                pi2_temp1[8] = pu1_src[off0] + pu1_src[off5]
 2762|  1.08k|                                   - (pu1_src[off1] + pu1_src[off4])
 2763|  1.08k|                                   + ((pu1_src[off2] + pu1_src[off3] - pu1_src[off1] - pu1_src[off4]) << 2)
 2764|  1.08k|                                   + ((pu1_src[off2] + pu1_src[off3]) << 4);
 2765|       |
 2766|  1.08k|                pu1_src = pu1_src + src_strd;
 2767|  1.08k|                pi2_temp1 = pi2_temp1 + 9;
 2768|       |
 2769|  1.08k|                src_r6_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src));
 2770|       |
 2771|  1.08k|                src_r0r1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r2_16x8b);
 2772|  1.08k|                src_r2r3_16x8b = _mm_unpacklo_epi8(src_r3_16x8b, src_r4_16x8b);
 2773|  1.08k|                src_r4r5_16x8b = _mm_unpacklo_epi8(src_r5_16x8b, src_r6_16x8b);
 2774|       |
 2775|  1.08k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2776|  1.08k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2777|  1.08k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2778|       |
 2779|  1.08k|                res_t1_8x16b = _mm_add_epi16(res_t2_8x16b, res_t1_8x16b);
 2780|  1.08k|                res_t1_8x16b = _mm_add_epi16(res_t3_8x16b, res_t1_8x16b);
 2781|       |
 2782|  1.08k|                _mm_storeu_si128((__m128i *)(pi2_temp1), res_t1_8x16b);
 2783|       |
 2784|  1.08k|                pi2_temp1[8] = pu1_src[off0] + pu1_src[off5]
 2785|  1.08k|                                   - (pu1_src[off1] + pu1_src[off4])
 2786|  1.08k|                                   + ((pu1_src[off2] + pu1_src[off3] - pu1_src[off1] - pu1_src[off4]) << 2)
 2787|  1.08k|                                   + ((pu1_src[off2] + pu1_src[off3]) << 4);
 2788|       |
 2789|  1.08k|                ht_temp -= 2;
 2790|  1.08k|                pu1_src = pu1_src + src_strd;
 2791|  1.08k|                pi2_temp1 = pi2_temp1 + 9;
 2792|       |
 2793|  1.08k|                src_r0_16x8b = src_r2_16x8b;
 2794|  1.08k|                src_r1_16x8b = src_r3_16x8b;
 2795|  1.08k|                src_r2_16x8b = src_r4_16x8b;
 2796|  1.08k|                src_r3_16x8b = src_r5_16x8b;
 2797|  1.08k|                src_r4_16x8b = src_r6_16x8b;
 2798|  1.08k|            }
 2799|  1.08k|            while(ht_temp > 0);
  ------------------
  |  Branch (2799:19): [True: 678, False: 410]
  ------------------
 2800|    410|        }
 2801|       |
 2802|       |        //horizontal q-pel
 2803|    410|        {
 2804|    410|            __m128i src_r0_8x16b, src_r1_8x16b, src_r2_8x16b;
 2805|    410|            __m128i src_r3_8x16b, src_r4_8x16b, src_r5_8x16b;
 2806|    410|            __m128i src_r0r1_c0_8x16b, src_r2r3_c0_8x16b, src_r4r5_c0_8x16b;
 2807|    410|            __m128i src_hpel_16x8b, src_hpel_8x16b;
 2808|       |
 2809|    410|            __m128i res_t1_4x32b, res_t2_4x32b, res_t3_4x32b;
 2810|    410|            __m128i res_8x16b, res_16x8b;
 2811|       |
 2812|    410|            __m128i coeff0_1_8x16b, coeff2_3_8x16b, coeff4_5_8x16b;
 2813|    410|            __m128i const_val512_4x32b, const_val16_8x16b;
 2814|       |
 2815|    410|            coeff0_1_8x16b = _mm_set1_epi32(0xFFFB0001);
 2816|    410|            coeff2_3_8x16b = _mm_set1_epi32(0x00140014);
 2817|    410|            coeff4_5_8x16b = _mm_set1_epi32(0x0001FFFB);
 2818|       |
 2819|    410|            const_val512_4x32b = _mm_set1_epi32(512);
 2820|    410|            const_val16_8x16b = _mm_set1_epi16(16);
 2821|       |
 2822|    410|            do
 2823|  2.17k|            {
 2824|  2.17k|                src_r0_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp2));
 2825|  2.17k|                src_r1_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 1));
 2826|  2.17k|                src_r2_8x16b = _mm_srli_si128(src_r1_8x16b, 2);
 2827|  2.17k|                src_r3_8x16b = _mm_srli_si128(src_r1_8x16b, 4);
 2828|  2.17k|                src_r4_8x16b = _mm_srli_si128(src_r1_8x16b, 6);
 2829|  2.17k|                src_r5_8x16b = _mm_srli_si128(src_r1_8x16b, 8);
 2830|       |
 2831|  2.17k|                src_r0r1_c0_8x16b = _mm_unpacklo_epi16(src_r0_8x16b, src_r1_8x16b);
 2832|  2.17k|                src_r2r3_c0_8x16b = _mm_unpacklo_epi16(src_r2_8x16b, src_r3_8x16b);
 2833|  2.17k|                src_r4r5_c0_8x16b = _mm_unpacklo_epi16(src_r4_8x16b, src_r5_8x16b);
 2834|       |
 2835|  2.17k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_c0_8x16b, coeff0_1_8x16b);
 2836|  2.17k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_c0_8x16b, coeff2_3_8x16b);
 2837|  2.17k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_c0_8x16b, coeff4_5_8x16b);
 2838|       |
 2839|  2.17k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 2840|  2.17k|                res_t3_4x32b = _mm_add_epi32(const_val512_4x32b, res_t3_4x32b);
 2841|  2.17k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 2842|  2.17k|                res_t1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 2843|       |
 2844|  2.17k|                res_8x16b = _mm_packs_epi32(res_t1_4x32b, res_t1_4x32b);
 2845|  2.17k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 2846|       |
 2847|  2.17k|                src_hpel_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp3));
 2848|  2.17k|                src_hpel_8x16b = _mm_add_epi16(src_hpel_8x16b, const_val16_8x16b);
 2849|  2.17k|                src_hpel_8x16b = _mm_srai_epi16(src_hpel_8x16b, 5); //shifting right by 5 bits.
 2850|  2.17k|                src_hpel_16x8b = _mm_packus_epi16(src_hpel_8x16b, src_hpel_8x16b);
 2851|       |
 2852|  2.17k|                res_16x8b = _mm_avg_epu8(res_16x8b, src_hpel_16x8b);
 2853|       |
 2854|  2.17k|                *((WORD32 *)(pu1_dst)) = _mm_cvtsi128_si32(res_16x8b);
 2855|       |
 2856|  2.17k|                ht--;
 2857|  2.17k|                pi2_temp2 = pi2_temp2 + 4 + 5;
 2858|  2.17k|                pi2_temp3 = pi2_temp3 + 4 + 5;
 2859|  2.17k|                pu1_dst = pu1_dst + dst_strd;
 2860|  2.17k|            }
 2861|  2.17k|            while(ht > 0);
  ------------------
  |  Branch (2861:19): [True: 1.76k, False: 410]
  ------------------
 2862|    410|        }
 2863|    410|    }
 2864|  2.77k|    else if(wd == 8)
  ------------------
  |  Branch (2864:13): [True: 908, False: 1.87k]
  ------------------
 2865|    908|    {
 2866|       |        // vertical half-pel
 2867|    908|        {
 2868|    908|            __m128i src_r0_16x8b, src_r1_16x8b, src_r2_16x8b, src_r3_16x8b, src_r4_16x8b;
 2869|    908|            __m128i src_r5_16x8b, src_r6_16x8b;
 2870|    908|            __m128i src_r0r1_16x8b, src_r2r3_16x8b, src_r4r5_16x8b;
 2871|       |
 2872|    908|            __m128i res_t1_8x16b, res_t2_8x16b, res_t3_8x16b;
 2873|       |
 2874|    908|            __m128i coeff0_1_16x8b, coeff2_3_16x8b, coeff4_5_16x8b;
 2875|       |
 2876|    908|            coeff0_1_16x8b = _mm_set1_epi32(0xFB01FB01);  //c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1
 2877|    908|            coeff2_3_16x8b = _mm_set1_epi32(0x14141414);  //c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3
 2878|    908|            coeff4_5_16x8b = _mm_set1_epi32(0x01FB01FB);  //c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5
 2879|       |
 2880|       |            //epilogue: Load all the pred rows except sixth  and seventh row for the
 2881|       |            //first and second row processing.
 2882|    908|            src_r0_16x8b = _mm_loadu_si128((__m128i *)(pu1_src));
 2883|    908|            pu1_src =  pu1_src + src_strd;
 2884|       |
 2885|    908|            src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src));
 2886|    908|            pu1_src =  pu1_src + src_strd;
 2887|       |
 2888|    908|            src_r2_16x8b = _mm_loadu_si128((__m128i *)(pu1_src));
 2889|    908|            pu1_src =  pu1_src + src_strd;
 2890|       |
 2891|    908|            src_r3_16x8b = _mm_loadu_si128((__m128i *)(pu1_src));
 2892|    908|            pu1_src =  pu1_src + src_strd;
 2893|       |
 2894|    908|            src_r4_16x8b = _mm_loadu_si128((__m128i *)(pu1_src));
 2895|    908|            pu1_src =  pu1_src + src_strd;
 2896|       |
 2897|       |            //Core Loop: Process all the rows.
 2898|    908|            do
 2899|  4.91k|            {
 2900|  4.91k|                src_r5_16x8b = _mm_loadu_si128((__m128i *)(pu1_src));
 2901|  4.91k|                src_r6_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));
 2902|       |
 2903|  4.91k|                src_r0r1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r1_16x8b);
 2904|  4.91k|                src_r2r3_16x8b = _mm_unpacklo_epi8(src_r2_16x8b, src_r3_16x8b);
 2905|  4.91k|                src_r4r5_16x8b = _mm_unpacklo_epi8(src_r4_16x8b, src_r5_16x8b);
 2906|       |
 2907|  4.91k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2908|  4.91k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2909|  4.91k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2910|       |
 2911|  4.91k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2912|  4.91k|                res_t1_8x16b = _mm_add_epi16(res_t3_8x16b, res_t1_8x16b);
 2913|       |
 2914|  4.91k|                _mm_storeu_si128((__m128i *)(pi2_temp1), res_t1_8x16b);
 2915|       |
 2916|  4.91k|                src_r0r1_16x8b = _mm_unpackhi_epi8(src_r0_16x8b, src_r1_16x8b);
 2917|  4.91k|                src_r2r3_16x8b = _mm_unpackhi_epi8(src_r2_16x8b, src_r3_16x8b);
 2918|  4.91k|                src_r4r5_16x8b = _mm_unpackhi_epi8(src_r4_16x8b, src_r5_16x8b);
 2919|       |
 2920|  4.91k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2921|  4.91k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2922|  4.91k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2923|       |
 2924|  4.91k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2925|  4.91k|                res_t1_8x16b = _mm_add_epi16(res_t3_8x16b, res_t1_8x16b);
 2926|       |
 2927|  4.91k|                _mm_storeu_si128((__m128i *)(pi2_temp1 + 8), res_t1_8x16b);
 2928|       |
 2929|  4.91k|                src_r0r1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r2_16x8b);
 2930|  4.91k|                src_r2r3_16x8b = _mm_unpacklo_epi8(src_r3_16x8b, src_r4_16x8b);
 2931|  4.91k|                src_r4r5_16x8b = _mm_unpacklo_epi8(src_r5_16x8b, src_r6_16x8b);
 2932|       |
 2933|  4.91k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2934|  4.91k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2935|  4.91k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2936|       |
 2937|  4.91k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2938|  4.91k|                res_t1_8x16b = _mm_add_epi16(res_t3_8x16b, res_t1_8x16b);
 2939|       |
 2940|  4.91k|                _mm_storeu_si128((__m128i *)(pi2_temp1 + 8 + 5), res_t1_8x16b);
 2941|       |
 2942|  4.91k|                src_r0r1_16x8b = _mm_unpackhi_epi8(src_r1_16x8b, src_r2_16x8b);
 2943|  4.91k|                src_r2r3_16x8b = _mm_unpackhi_epi8(src_r3_16x8b, src_r4_16x8b);
 2944|  4.91k|                src_r4r5_16x8b = _mm_unpackhi_epi8(src_r5_16x8b, src_r6_16x8b);
 2945|       |
 2946|  4.91k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 2947|  4.91k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 2948|  4.91k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 2949|       |
 2950|  4.91k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 2951|  4.91k|                res_t1_8x16b = _mm_add_epi16(res_t3_8x16b, res_t1_8x16b);
 2952|       |
 2953|  4.91k|                _mm_storeu_si128((__m128i *)(pi2_temp1 + 8 + 5 + 8), res_t1_8x16b);
 2954|       |
 2955|  4.91k|                src_r0_16x8b = src_r2_16x8b;
 2956|  4.91k|                src_r1_16x8b = src_r3_16x8b;
 2957|  4.91k|                src_r2_16x8b = src_r4_16x8b;
 2958|  4.91k|                src_r3_16x8b = src_r5_16x8b;
 2959|  4.91k|                src_r4_16x8b = src_r6_16x8b;
 2960|       |
 2961|  4.91k|                ht_temp -= 2;
 2962|  4.91k|                pu1_src =  pu1_src + (src_strd << 1);
 2963|  4.91k|                pi2_temp1 = pi2_temp1 + (13 << 1);
 2964|  4.91k|            }
 2965|  4.91k|            while(ht_temp > 0);
  ------------------
  |  Branch (2965:19): [True: 4.00k, False: 908]
  ------------------
 2966|    908|        }
 2967|       |        // horizontal q-pel
 2968|    908|        {
 2969|    908|            __m128i src_r0_8x16b, src_r1_8x16b, src_r2_8x16b, src_r3_8x16b;
 2970|    908|            __m128i src_r4_8x16b, src_r5_8x16b;
 2971|    908|            __m128i src_r0r1_c0_8x16b, src_r2r3_c0_8x16b, src_r4r5_c0_8x16b;
 2972|    908|            __m128i src_r0r1_c1_8x16b, src_r2r3_c1_8x16b, src_r4r5_c1_8x16b;
 2973|    908|            __m128i src_hpel_8x16b, src_hpel_16x8b;
 2974|       |
 2975|    908|            __m128i res_t0_4x32b, res_t1_4x32b, res_t2_4x32b, res_t3_4x32b;
 2976|    908|            __m128i res_8x16b, res_16x8b;
 2977|       |
 2978|    908|            __m128i coeff0_1_8x16b, coeff2_3_8x16b, coeff4_5_8x16b;
 2979|    908|            __m128i const_val512_4x32b, const_val16_8x16b;
 2980|       |
 2981|    908|            coeff0_1_8x16b = _mm_set1_epi32(0xFFFB0001);
 2982|    908|            coeff2_3_8x16b = _mm_set1_epi32(0x00140014);
 2983|    908|            coeff4_5_8x16b = _mm_set1_epi32(0x0001FFFB);
 2984|       |
 2985|    908|            const_val512_4x32b = _mm_set1_epi32(512);
 2986|    908|            const_val16_8x16b = _mm_set1_epi16(16);
 2987|       |
 2988|    908|            do
 2989|  9.82k|            {
 2990|  9.82k|                src_r0_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2));
 2991|  9.82k|                src_r1_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 1));
 2992|  9.82k|                src_r2_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 2));
 2993|  9.82k|                src_r3_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 3));
 2994|  9.82k|                src_r4_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 4));
 2995|  9.82k|                src_r5_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 5));
 2996|       |
 2997|  9.82k|                src_r0r1_c0_8x16b = _mm_unpacklo_epi16(src_r0_8x16b, src_r1_8x16b);
 2998|  9.82k|                src_r2r3_c0_8x16b = _mm_unpacklo_epi16(src_r2_8x16b, src_r3_8x16b);
 2999|  9.82k|                src_r4r5_c0_8x16b = _mm_unpacklo_epi16(src_r4_8x16b, src_r5_8x16b);
 3000|       |
 3001|  9.82k|                src_r0r1_c1_8x16b = _mm_unpackhi_epi16(src_r0_8x16b, src_r1_8x16b);
 3002|  9.82k|                src_r2r3_c1_8x16b = _mm_unpackhi_epi16(src_r2_8x16b, src_r3_8x16b);
 3003|  9.82k|                src_r4r5_c1_8x16b = _mm_unpackhi_epi16(src_r4_8x16b, src_r5_8x16b);
 3004|       |
 3005|  9.82k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_c0_8x16b, coeff0_1_8x16b);
 3006|  9.82k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_c0_8x16b, coeff2_3_8x16b);
 3007|  9.82k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_c0_8x16b, coeff4_5_8x16b);
 3008|       |
 3009|  9.82k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3010|  9.82k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3011|  9.82k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3012|       |
 3013|  9.82k|                res_t0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3014|       |
 3015|  9.82k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_c1_8x16b, coeff0_1_8x16b);
 3016|  9.82k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_c1_8x16b, coeff2_3_8x16b);
 3017|  9.82k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_c1_8x16b, coeff4_5_8x16b);
 3018|       |
 3019|  9.82k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3020|  9.82k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3021|  9.82k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3022|       |
 3023|  9.82k|                res_t1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3024|       |
 3025|  9.82k|                res_8x16b = _mm_packs_epi32(res_t0_4x32b, res_t1_4x32b);
 3026|  9.82k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 3027|       |
 3028|  9.82k|                src_hpel_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp3));
 3029|  9.82k|                src_hpel_8x16b = _mm_add_epi16(src_hpel_8x16b, const_val16_8x16b);
 3030|  9.82k|                src_hpel_8x16b = _mm_srai_epi16(src_hpel_8x16b, 5); //shifting right by 5 bits.
 3031|  9.82k|                src_hpel_16x8b = _mm_packus_epi16(src_hpel_8x16b, src_hpel_8x16b);
 3032|       |
 3033|  9.82k|                res_16x8b = _mm_avg_epu8(res_16x8b, src_hpel_16x8b);
 3034|       |
 3035|  9.82k|                _mm_storel_epi64((__m128i *)(pu1_dst), res_16x8b);
 3036|       |
 3037|  9.82k|                ht--;
 3038|  9.82k|                pi2_temp2 = pi2_temp2 + 8 + 5;
 3039|  9.82k|                pi2_temp3 = pi2_temp3 + 8 + 5;
 3040|  9.82k|                pu1_dst = pu1_dst + dst_strd;
 3041|  9.82k|            }
 3042|  9.82k|            while(ht > 0);
  ------------------
  |  Branch (3042:19): [True: 8.92k, False: 908]
  ------------------
 3043|    908|        }
 3044|    908|    }
 3045|  1.87k|    else // wd == 16
 3046|  1.87k|    {
 3047|       |        // vertical half-pel
 3048|  1.87k|        {
 3049|  1.87k|            __m128i src_r0_16x8b, src_r1_16x8b, src_r2_16x8b, src_r3_16x8b;
 3050|  1.87k|            __m128i src_r4_16x8b, src_r5_16x8b;
 3051|  1.87k|            __m128i src_r0_c2_16x8b, src_r1_c2_16x8b, src_r2_c2_16x8b, src_r3_c2_16x8b;
 3052|  1.87k|            __m128i src_r4_c2_16x8b, src_r5_c2_16x8b;
 3053|  1.87k|            __m128i src_r0r1_16x8b, src_r2r3_16x8b, src_r4r5_16x8b;
 3054|       |
 3055|  1.87k|            __m128i res_t1_8x16b, res_t2_8x16b, res_t3_8x16b;
 3056|       |
 3057|  1.87k|            __m128i coeff0_1_16x8b,coeff2_3_16x8b,coeff4_5_16x8b;
 3058|       |
 3059|  1.87k|            coeff0_1_16x8b = _mm_set1_epi32(0xFB01FB01);  //c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1
 3060|  1.87k|            coeff2_3_16x8b = _mm_set1_epi32(0x14141414);  //c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3
 3061|  1.87k|            coeff4_5_16x8b = _mm_set1_epi32(0x01FB01FB);  //c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5
 3062|       |
 3063|  1.87k|            src_r0_16x8b = _mm_loadu_si128((__m128i *)(pu1_src));
 3064|  1.87k|            src_r0_c2_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + 16));
 3065|  1.87k|            pu1_src =  pu1_src + src_strd;
 3066|  1.87k|            src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src));
 3067|  1.87k|            src_r1_c2_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + 16));
 3068|  1.87k|            pu1_src =  pu1_src + src_strd;
 3069|  1.87k|            src_r2_16x8b = _mm_loadu_si128((__m128i *)(pu1_src));
 3070|  1.87k|            src_r2_c2_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + 16));
 3071|  1.87k|            pu1_src =  pu1_src + src_strd;
 3072|  1.87k|            src_r3_16x8b = _mm_loadu_si128((__m128i *)(pu1_src));
 3073|  1.87k|            src_r3_c2_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + 16));
 3074|  1.87k|            pu1_src =  pu1_src + src_strd;
 3075|  1.87k|            src_r4_16x8b = _mm_loadu_si128((__m128i *)(pu1_src));
 3076|  1.87k|            src_r4_c2_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + 16));
 3077|  1.87k|            pu1_src =  pu1_src + src_strd;
 3078|       |
 3079|       |            //Core Loop: Process all the rows.
 3080|  1.87k|            do
 3081|  27.5k|            {
 3082|  27.5k|                src_r5_16x8b  = _mm_loadu_si128((__m128i *)(pu1_src));
 3083|  27.5k|                src_r5_c2_16x8b  = _mm_loadu_si128((__m128i *)(pu1_src + 16));
 3084|       |
 3085|  27.5k|                src_r0r1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r1_16x8b);
 3086|  27.5k|                src_r2r3_16x8b = _mm_unpacklo_epi8(src_r2_16x8b, src_r3_16x8b);
 3087|  27.5k|                src_r4r5_16x8b = _mm_unpacklo_epi8(src_r4_16x8b, src_r5_16x8b);
 3088|       |
 3089|  27.5k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 3090|  27.5k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 3091|  27.5k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 3092|       |
 3093|  27.5k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 3094|  27.5k|                res_t1_8x16b = _mm_add_epi16(res_t3_8x16b, res_t1_8x16b);
 3095|       |
 3096|  27.5k|                _mm_storeu_si128((__m128i *)(pi2_temp1), res_t1_8x16b);
 3097|       |
 3098|  27.5k|                src_r0r1_16x8b = _mm_unpackhi_epi8(src_r0_16x8b, src_r1_16x8b);
 3099|  27.5k|                src_r2r3_16x8b = _mm_unpackhi_epi8(src_r2_16x8b, src_r3_16x8b);
 3100|  27.5k|                src_r4r5_16x8b = _mm_unpackhi_epi8(src_r4_16x8b, src_r5_16x8b);
 3101|       |
 3102|  27.5k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 3103|  27.5k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 3104|  27.5k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 3105|       |
 3106|  27.5k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 3107|  27.5k|                res_t1_8x16b = _mm_add_epi16(res_t3_8x16b, res_t1_8x16b);
 3108|       |
 3109|  27.5k|                _mm_storeu_si128((__m128i *)(pi2_temp1 + 8), res_t1_8x16b);
 3110|       |
 3111|  27.5k|                src_r0r1_16x8b = _mm_unpacklo_epi8(src_r0_c2_16x8b, src_r1_c2_16x8b);
 3112|  27.5k|                src_r2r3_16x8b = _mm_unpacklo_epi8(src_r2_c2_16x8b, src_r3_c2_16x8b);
 3113|  27.5k|                src_r4r5_16x8b = _mm_unpacklo_epi8(src_r4_c2_16x8b, src_r5_c2_16x8b);
 3114|       |
 3115|  27.5k|                res_t1_8x16b = _mm_maddubs_epi16(src_r0r1_16x8b, coeff0_1_16x8b);
 3116|  27.5k|                res_t2_8x16b = _mm_maddubs_epi16(src_r2r3_16x8b, coeff2_3_16x8b);
 3117|  27.5k|                res_t3_8x16b = _mm_maddubs_epi16(src_r4r5_16x8b, coeff4_5_16x8b);
 3118|       |
 3119|  27.5k|                res_t1_8x16b = _mm_add_epi16(res_t1_8x16b, res_t2_8x16b);
 3120|  27.5k|                res_t1_8x16b = _mm_add_epi16(res_t3_8x16b, res_t1_8x16b);
 3121|       |
 3122|  27.5k|                _mm_storeu_si128((__m128i *)(pi2_temp1 + 16), res_t1_8x16b);
 3123|       |
 3124|  27.5k|                src_r0_16x8b = src_r1_16x8b;
 3125|  27.5k|                src_r1_16x8b = src_r2_16x8b;
 3126|  27.5k|                src_r2_16x8b = src_r3_16x8b;
 3127|  27.5k|                src_r3_16x8b = src_r4_16x8b;
 3128|  27.5k|                src_r4_16x8b = src_r5_16x8b;
 3129|       |
 3130|  27.5k|                src_r0_c2_16x8b = src_r1_c2_16x8b;
 3131|  27.5k|                src_r1_c2_16x8b = src_r2_c2_16x8b;
 3132|  27.5k|                src_r2_c2_16x8b = src_r3_c2_16x8b;
 3133|  27.5k|                src_r3_c2_16x8b = src_r4_c2_16x8b;
 3134|  27.5k|                src_r4_c2_16x8b = src_r5_c2_16x8b;
 3135|       |
 3136|  27.5k|                ht_temp--;
 3137|  27.5k|                pu1_src =  pu1_src + src_strd;
 3138|  27.5k|                pi2_temp1 =  pi2_temp1 + 16 + 5;
 3139|  27.5k|            }
 3140|  27.5k|            while(ht_temp > 0);
  ------------------
  |  Branch (3140:19): [True: 25.6k, False: 1.87k]
  ------------------
 3141|  1.87k|        }
 3142|       |        // horizontal q-pel
 3143|  1.87k|        {
 3144|  1.87k|            __m128i src_r0_8x16b, src_r1_8x16b, src_r2_8x16b, src_r3_8x16b;
 3145|  1.87k|            __m128i src_r4_8x16b, src_r5_8x16b;
 3146|  1.87k|            __m128i src_r0r1_8x16b, src_r2r3_8x16b, src_r4r5_8x16b;
 3147|  1.87k|            __m128i src_hpel1_8x16b, src_hpel2_8x16b, src_hpel_16x8b;
 3148|       |
 3149|  1.87k|            __m128i res_t0_4x32b, res_t1_4x32b, res_t2_4x32b, res_t3_4x32b;
 3150|  1.87k|            __m128i res_c0_8x16b, res_c1_8x16b, res_16x8b;
 3151|       |
 3152|  1.87k|            __m128i coeff0_1_8x16b, coeff2_3_8x16b, coeff4_5_8x16b;
 3153|  1.87k|            __m128i const_val512_4x32b, const_val16_8x16b;
 3154|       |
 3155|  1.87k|            coeff0_1_8x16b = _mm_set1_epi32(0xFFFB0001);
 3156|  1.87k|            coeff2_3_8x16b = _mm_set1_epi32(0x00140014);
 3157|  1.87k|            coeff4_5_8x16b = _mm_set1_epi32(0x0001FFFB);
 3158|       |
 3159|  1.87k|            const_val512_4x32b = _mm_set1_epi32(512);
 3160|  1.87k|            const_val16_8x16b = _mm_set1_epi16(16);
 3161|       |
 3162|  1.87k|            do
 3163|  27.5k|            {
 3164|  27.5k|                src_r0_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2));
 3165|  27.5k|                src_r1_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 1));
 3166|  27.5k|                src_r2_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 2));
 3167|  27.5k|                src_r3_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 3));
 3168|  27.5k|                src_r4_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 4));
 3169|  27.5k|                src_r5_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 5));
 3170|       |
 3171|  27.5k|                src_r0r1_8x16b = _mm_unpacklo_epi16(src_r0_8x16b, src_r1_8x16b);
 3172|  27.5k|                src_r2r3_8x16b = _mm_unpacklo_epi16(src_r2_8x16b, src_r3_8x16b);
 3173|  27.5k|                src_r4r5_8x16b = _mm_unpacklo_epi16(src_r4_8x16b, src_r5_8x16b);
 3174|       |
 3175|  27.5k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3176|  27.5k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3177|  27.5k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3178|       |
 3179|  27.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3180|  27.5k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3181|  27.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3182|  27.5k|                res_t0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3183|       |
 3184|  27.5k|                src_r0r1_8x16b = _mm_unpackhi_epi16(src_r0_8x16b, src_r1_8x16b);
 3185|  27.5k|                src_r2r3_8x16b = _mm_unpackhi_epi16(src_r2_8x16b, src_r3_8x16b);
 3186|  27.5k|                src_r4r5_8x16b = _mm_unpackhi_epi16(src_r4_8x16b, src_r5_8x16b);
 3187|       |
 3188|  27.5k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3189|  27.5k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3190|  27.5k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3191|       |
 3192|  27.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3193|  27.5k|                res_t3_4x32b = _mm_add_epi32(const_val512_4x32b, res_t3_4x32b);
 3194|  27.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3195|  27.5k|                res_t1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3196|       |
 3197|  27.5k|                res_c0_8x16b = _mm_packs_epi32(res_t0_4x32b, res_t1_4x32b);
 3198|       |
 3199|  27.5k|                src_r0_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 8));
 3200|  27.5k|                src_r1_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 8 + 1));
 3201|  27.5k|                src_r2_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 8 + 2));
 3202|  27.5k|                src_r3_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 8 + 3));
 3203|  27.5k|                src_r4_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 8 + 4));
 3204|  27.5k|                src_r5_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 8 + 5));
 3205|       |
 3206|  27.5k|                src_r0r1_8x16b = _mm_unpacklo_epi16(src_r0_8x16b, src_r1_8x16b);
 3207|  27.5k|                src_r2r3_8x16b = _mm_unpacklo_epi16(src_r2_8x16b, src_r3_8x16b);
 3208|  27.5k|                src_r4r5_8x16b = _mm_unpacklo_epi16(src_r4_8x16b, src_r5_8x16b);
 3209|       |
 3210|  27.5k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3211|  27.5k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3212|  27.5k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3213|       |
 3214|  27.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3215|  27.5k|                res_t3_4x32b = _mm_add_epi32(const_val512_4x32b, res_t3_4x32b);
 3216|  27.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3217|  27.5k|                res_t0_4x32b = _mm_srai_epi32(res_t1_4x32b ,10);
 3218|       |
 3219|  27.5k|                src_r0r1_8x16b = _mm_unpackhi_epi16(src_r0_8x16b, src_r1_8x16b);
 3220|  27.5k|                src_r2r3_8x16b = _mm_unpackhi_epi16(src_r2_8x16b, src_r3_8x16b);
 3221|  27.5k|                src_r4r5_8x16b = _mm_unpackhi_epi16(src_r4_8x16b, src_r5_8x16b);
 3222|       |
 3223|  27.5k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3224|  27.5k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3225|  27.5k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3226|       |
 3227|  27.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3228|  27.5k|                res_t3_4x32b = _mm_add_epi32(const_val512_4x32b, res_t3_4x32b);
 3229|  27.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3230|  27.5k|                res_t1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3231|       |
 3232|  27.5k|                res_c1_8x16b = _mm_packs_epi32(res_t0_4x32b, res_t1_4x32b);
 3233|  27.5k|                res_16x8b = _mm_packus_epi16(res_c0_8x16b, res_c1_8x16b);
 3234|       |
 3235|  27.5k|                src_hpel1_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp3));
 3236|  27.5k|                src_hpel1_8x16b = _mm_add_epi16(src_hpel1_8x16b, const_val16_8x16b);
 3237|  27.5k|                src_hpel1_8x16b = _mm_srai_epi16(src_hpel1_8x16b, 5); //shifting right by 5 bits.
 3238|       |
 3239|  27.5k|                src_hpel2_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp3 + 8));
 3240|  27.5k|                src_hpel2_8x16b = _mm_add_epi16(src_hpel2_8x16b, const_val16_8x16b);
 3241|  27.5k|                src_hpel2_8x16b = _mm_srai_epi16(src_hpel2_8x16b, 5); //shifting right by 5 bits.
 3242|       |
 3243|  27.5k|                src_hpel_16x8b = _mm_packus_epi16(src_hpel1_8x16b, src_hpel2_8x16b);
 3244|  27.5k|                res_16x8b = _mm_avg_epu8(res_16x8b, src_hpel_16x8b);
 3245|       |
 3246|  27.5k|                _mm_storeu_si128((__m128i *)(pu1_dst), res_16x8b);
 3247|       |
 3248|  27.5k|                ht--;
 3249|  27.5k|                pi2_temp2 = pi2_temp2 + 16 + 5;
 3250|  27.5k|                pi2_temp3 = pi2_temp3 + 16 + 5;
 3251|  27.5k|                pu1_dst = pu1_dst + dst_strd;
 3252|  27.5k|            }
 3253|  27.5k|            while(ht > 0);
  ------------------
  |  Branch (3253:19): [True: 25.6k, False: 1.87k]
  ------------------
 3254|  1.87k|        }
 3255|  1.87k|    }
 3256|  3.18k|}
ih264_inter_pred_luma_horz_hpel_vert_qpel_ssse3:
 3296|  5.43k|{
 3297|  5.43k|    WORD32 ht_temp;
 3298|  5.43k|    WORD32 y_offset;
 3299|  5.43k|    WORD16 *pi2_temp1,*pi2_temp2,*pi2_temp3;
 3300|       |
 3301|  5.43k|    y_offset = (dydx & 0xf) >> 2;
 3302|  5.43k|    pi2_temp1 = (WORD16 *)pu1_tmp;
 3303|  5.43k|    pi2_temp2 = pi2_temp1;
 3304|  5.43k|    pi2_temp3 = pi2_temp1 + (y_offset >> 1) * wd;
 3305|       |
 3306|  5.43k|    ht_temp = ht + 5;
 3307|  5.43k|    pu1_src -= src_strd << 1;
 3308|  5.43k|    pu1_src -= 2;
 3309|  5.43k|    pi2_temp3 += wd << 1;
 3310|       |    //the filter input starts from x[-2] (till x[3])
 3311|       |
 3312|  5.43k|    if(wd == 4)
  ------------------
  |  Branch (3312:8): [True: 348, False: 5.09k]
  ------------------
 3313|    348|    {
 3314|       |        // horizontal half-pel
 3315|    348|        {
 3316|    348|            __m128i src_r0_16x8b, src_r1_16x8b, src_r0r1_t1_16x8b;
 3317|    348|            __m128i src_r0_sht_16x8b, src_r1_sht_16x8b;
 3318|    348|            __m128i res_r0r1_t1_8x16b, res_r0r1_t2_8x16b, res_r0r1_t3_8x16b;
 3319|    348|            __m128i coeff0_1_16x8b, coeff2_3_16x8b, coeff4_5_16x8b;
 3320|       |
 3321|    348|            coeff0_1_16x8b = _mm_set1_epi32(0xFB01FB01);  //c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1
 3322|    348|            coeff2_3_16x8b = _mm_set1_epi32(0x14141414);  //c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3
 3323|    348|            coeff4_5_16x8b = _mm_set1_epi32(0x01FB01FB);  //c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5
 3324|       |
 3325|       |            //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
 3326|       |            //Row1 : b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
 3327|       |
 3328|    348|            do
 3329|  2.29k|            {
 3330|  2.29k|                src_r0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);                         //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
 3331|  2.29k|                src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));            //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9....b15
 3332|       |
 3333|  2.29k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                         //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
 3334|  2.29k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                         //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
 3335|       |
 3336|  2.29k|                src_r0_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);           //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
 3337|  2.29k|                src_r1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);           //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
 3338|       |
 3339|  2.29k|                src_r0r1_t1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);         //a0 a1 a1 a2 a2 a3 a3 a4 b0 b1 b1 b2 b2 b3 b3 b4
 3340|  2.29k|                res_r0r1_t1_8x16b = _mm_maddubs_epi16(src_r0r1_t1_16x8b, coeff0_1_16x8b);   //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
 3341|       |                                                                                            //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
 3342|       |
 3343|  2.29k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 4);                             //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8  0  0  0  0
 3344|  2.29k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 4);                             //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8  0  0  0  0
 3345|       |
 3346|  2.29k|                src_r0r1_t1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);         //a2 a3 a3 a4 a4 a5 a5 a6 b2 b3 b3 b4 b4 b5 b5 b6
 3347|  2.29k|                res_r0r1_t2_8x16b = _mm_maddubs_epi16(src_r0r1_t1_16x8b, coeff2_3_16x8b);   //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
 3348|       |                                                                                            //b2*c2+b3*c3 b3*c2+b4*c3 b4*c2+b5*c3 b5*c2+b6*c3
 3349|       |
 3350|  2.29k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 4);                             //a4 a5 a5 a6 a6 a7 a7 a8  0  0  0  0  0  0  0  0
 3351|  2.29k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 4);                             //b4 b5 b5 b6 b6 b7 b7 b8  0  0  0  0  0  0  0  0
 3352|       |
 3353|  2.29k|                src_r0r1_t1_16x8b = _mm_unpacklo_epi64(src_r0_16x8b, src_r1_16x8b);         //a4 a5 a5 a6 a6 a7 a7 a8 b4 b5 b5 b6 b6 b7 b7 b8
 3354|  2.29k|                res_r0r1_t3_8x16b = _mm_maddubs_epi16(src_r0r1_t1_16x8b, coeff4_5_16x8b);   //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
 3355|       |                                                                                            //b4*c4+b5*c5 b5*c4+b6*c5 b4*c6+b7*c5 b7*c4+b8*c5
 3356|       |
 3357|  2.29k|                res_r0r1_t1_8x16b = _mm_add_epi16(res_r0r1_t1_8x16b, res_r0r1_t2_8x16b);
 3358|  2.29k|                res_r0r1_t1_8x16b = _mm_add_epi16(res_r0r1_t1_8x16b, res_r0r1_t3_8x16b);
 3359|       |
 3360|       |
 3361|  2.29k|                _mm_storeu_si128((__m128i *)(pi2_temp1), res_r0r1_t1_8x16b);
 3362|       |
 3363|  2.29k|                ht_temp -= 2;
 3364|  2.29k|                pu1_src =  pu1_src + (src_strd << 1);
 3365|  2.29k|                pi2_temp1 =  pi2_temp1 + (4 << 1);
 3366|  2.29k|            }
 3367|  2.29k|            while(ht_temp > 0);
  ------------------
  |  Branch (3367:19): [True: 1.94k, False: 348]
  ------------------
 3368|    348|        }
 3369|       |        // vertical q-pel
 3370|    348|        {
 3371|    348|            __m128i src_r0_8x16b, src_r1_8x16b, src_r2_8x16b, src_r3_8x16b;
 3372|    348|            __m128i src_r4_8x16b, src_r5_8x16b, src_r6_8x16b;
 3373|    348|            __m128i src_r0r1_c0_8x16b, src_r2r3_c0_8x16b, src_r4r5_c0_8x16b;
 3374|    348|            __m128i src_hpel_16x8b, src_hpel_8x16b;
 3375|       |
 3376|    348|            __m128i res_t0_4x32b, res_t1_4x32b, res_t2_4x32b, res_t3_4x32b;
 3377|    348|            __m128i res_8x16b, res_16x8b;
 3378|       |
 3379|    348|            __m128i coeff0_1_8x16b, coeff2_3_8x16b, coeff4_5_8x16b;
 3380|    348|            __m128i const_val512_4x32b, const_val16_8x16b;
 3381|       |
 3382|    348|            const_val512_4x32b = _mm_set1_epi32(512);
 3383|    348|            const_val16_8x16b = _mm_set1_epi16(16);
 3384|       |
 3385|    348|            coeff0_1_8x16b = _mm_set1_epi32(0xFFFB0001);
 3386|    348|            coeff2_3_8x16b = _mm_set1_epi32(0x00140014);
 3387|    348|            coeff4_5_8x16b = _mm_set1_epi32(0x0001FFFB);
 3388|       |
 3389|    348|            src_r0_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp2));
 3390|    348|            src_r1_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp2 + 4));
 3391|    348|            src_r2_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp2 + 8));
 3392|    348|            src_r3_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp2 + 12));
 3393|    348|            src_r4_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp2 + 16));
 3394|    348|            pi2_temp2 += 20;
 3395|       |
 3396|    348|            do
 3397|  1.24k|            {
 3398|  1.24k|                src_r5_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp2));
 3399|  1.24k|                src_r6_8x16b = _mm_loadl_epi64((__m128i *)(pi2_temp2 + 4));
 3400|       |
 3401|  1.24k|                src_r0r1_c0_8x16b = _mm_unpacklo_epi16(src_r0_8x16b, src_r1_8x16b);
 3402|  1.24k|                src_r2r3_c0_8x16b = _mm_unpacklo_epi16(src_r2_8x16b, src_r3_8x16b);
 3403|  1.24k|                src_r4r5_c0_8x16b = _mm_unpacklo_epi16(src_r4_8x16b, src_r5_8x16b);
 3404|       |
 3405|  1.24k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_c0_8x16b, coeff0_1_8x16b);
 3406|  1.24k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_c0_8x16b, coeff2_3_8x16b);
 3407|  1.24k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_c0_8x16b, coeff4_5_8x16b);
 3408|       |
 3409|  1.24k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3410|  1.24k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3411|  1.24k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3412|  1.24k|                res_t0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3413|       |
 3414|  1.24k|                src_r0r1_c0_8x16b = _mm_unpacklo_epi16(src_r1_8x16b, src_r2_8x16b);
 3415|  1.24k|                src_r2r3_c0_8x16b = _mm_unpacklo_epi16(src_r3_8x16b, src_r4_8x16b);
 3416|  1.24k|                src_r4r5_c0_8x16b = _mm_unpacklo_epi16(src_r5_8x16b, src_r6_8x16b);
 3417|       |
 3418|  1.24k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_c0_8x16b, coeff0_1_8x16b);
 3419|  1.24k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_c0_8x16b, coeff2_3_8x16b);
 3420|  1.24k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_c0_8x16b, coeff4_5_8x16b);
 3421|       |
 3422|  1.24k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3423|  1.24k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3424|  1.24k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3425|  1.24k|                res_t1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3426|       |
 3427|  1.24k|                res_8x16b = _mm_packs_epi32(res_t0_4x32b, res_t1_4x32b);
 3428|  1.24k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 3429|       |
 3430|  1.24k|                src_hpel_8x16b = _mm_loadu_si128((__m128i *)pi2_temp3);
 3431|  1.24k|                src_hpel_8x16b = _mm_add_epi16(src_hpel_8x16b, const_val16_8x16b);
 3432|  1.24k|                src_hpel_8x16b = _mm_srai_epi16(src_hpel_8x16b, 5); //shifting right by 5 bits.
 3433|  1.24k|                src_hpel_16x8b = _mm_packus_epi16(src_hpel_8x16b, src_hpel_8x16b);
 3434|       |
 3435|  1.24k|                res_16x8b = _mm_avg_epu8(res_16x8b, src_hpel_16x8b);
 3436|       |
 3437|  1.24k|                *((WORD32 *)(pu1_dst)) = _mm_cvtsi128_si32(res_16x8b);
 3438|  1.24k|                res_16x8b = _mm_srli_si128(res_16x8b, 4);
 3439|  1.24k|                *((WORD32 *)(pu1_dst + dst_strd)) = _mm_cvtsi128_si32(res_16x8b);
 3440|       |
 3441|  1.24k|                src_r0_8x16b = src_r2_8x16b;
 3442|  1.24k|                src_r1_8x16b = src_r3_8x16b;
 3443|  1.24k|                src_r2_8x16b = src_r4_8x16b;
 3444|  1.24k|                src_r3_8x16b = src_r5_8x16b;
 3445|  1.24k|                src_r4_8x16b = src_r6_8x16b;
 3446|       |
 3447|  1.24k|                ht -= 2;
 3448|  1.24k|                pi2_temp2 =  pi2_temp2 + (4 << 1);
 3449|  1.24k|                pi2_temp3 =  pi2_temp3 + (4 << 1);
 3450|  1.24k|                pu1_dst = pu1_dst + (dst_strd << 1);
 3451|  1.24k|            }
 3452|  1.24k|            while(ht > 0);
  ------------------
  |  Branch (3452:19): [True: 900, False: 348]
  ------------------
 3453|    348|        }
 3454|    348|    }
 3455|  5.09k|    else if(wd == 8)
  ------------------
  |  Branch (3455:13): [True: 2.22k, False: 2.86k]
  ------------------
 3456|  2.22k|    {
 3457|       |        // horizontal half-pel
 3458|  2.22k|        {
 3459|  2.22k|            __m128i src_r0_16x8b, src_r1_16x8b, src_r0_sht_16x8b, src_r1_sht_16x8b;
 3460|  2.22k|            __m128i src_r0_t1_16x8b, src_r1_t1_16x8b;
 3461|       |
 3462|  2.22k|            __m128i res_r0_t1_8x16b, res_r0_t2_8x16b, res_r0_t3_8x16b;
 3463|  2.22k|            __m128i res_r1_t1_8x16b, res_r1_t2_8x16b, res_r1_t3_8x16b;
 3464|       |
 3465|  2.22k|            __m128i coeff0_1_16x8b, coeff2_3_16x8b, coeff4_5_16x8b;
 3466|       |
 3467|  2.22k|            coeff0_1_16x8b = _mm_set1_epi32(0xFB01FB01);  //c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1
 3468|  2.22k|            coeff2_3_16x8b = _mm_set1_epi32(0x14141414);  //c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3
 3469|  2.22k|            coeff4_5_16x8b = _mm_set1_epi32(0x01FB01FB);  //c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5
 3470|       |
 3471|       |            //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
 3472|       |            //Row1 : b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
 3473|       |
 3474|  2.22k|            do
 3475|  20.2k|            {
 3476|  20.2k|                src_r0_16x8b = _mm_loadu_si128((__m128i *)(pu1_src));                   //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
 3477|  20.2k|                src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));        //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9....b15
 3478|       |
 3479|  20.2k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                     //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
 3480|  20.2k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                     //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
 3481|       |
 3482|  20.2k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);    //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
 3483|  20.2k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);    //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
 3484|       |
 3485|  20.2k|                res_r0_t1_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff0_1_16x8b);   //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
 3486|       |                                                                                        //a4*c0+a5*c1 a5*c0+a6*c1 a6*c0+a7*c1 a7*c0+a8*c1
 3487|  20.2k|                res_r1_t1_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff0_1_16x8b);   //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
 3488|       |                                                                                        //b4*c0+b5*c1 b5*c0+b6*c1 b6*c0+b7*c1 b7*c0+b8*c1
 3489|       |
 3490|  20.2k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                         //a2 a3 a4 a5 a6 a7 a8 a9....a15 0 0
 3491|  20.2k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                         //b2 b3 b4 b5 b6 b7 b8 b9....b15 0 0
 3492|       |
 3493|  20.2k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                 //a3 a4 a5 a6 a7 a8 a9....a15 0  0  0
 3494|  20.2k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                 //b3 b4 b5 b6 b7 b8 b9....b15 0  0  0
 3495|       |
 3496|  20.2k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);    //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10
 3497|  20.2k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);    //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8 a8 a9 a9 a10
 3498|       |
 3499|  20.2k|                res_r0_t2_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff2_3_16x8b);   //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
 3500|       |                                                                                        //a6*c2+a7*c3 a7*c2+a8*c3 a8*c2+a9*c3 a9*c2+a10*c3
 3501|  20.2k|                res_r1_t2_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff2_3_16x8b);   //b2*c2+b3*c3 b3*c2+b4*c3 b2*c4+b5*c3 b5*c2+b6*c3
 3502|       |                                                                                        //b6*c2+b7*c3 b7*c2+b8*c3 b8*c2+b9*c3 b9*c2+b10*c3
 3503|       |
 3504|  20.2k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                         //a4 a5 a6 a7 a8 a9....a15 0  0  0  0
 3505|  20.2k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                         //b4 b5 b6 b7 b8 b9....b15 0  0  0  0
 3506|       |
 3507|  20.2k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                 //a5 a6 a7 a8 a9....a15 0  0  0  0  0
 3508|  20.2k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                 //b5 b6 b7 b8 b9....b15 0  0  0  0  0
 3509|       |
 3510|  20.2k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);    //a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10 a10 a11 a11 a12
 3511|  20.2k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);    //b4 b5 b5 b6 b6 b7 b7 b8 b8 b9 b9 b10 b10 b11 b11 b12
 3512|       |
 3513|  20.2k|                res_r0_t3_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff4_5_16x8b);   //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
 3514|       |                                                                                        //a8*c4+a9*c5 a9*c4+a10*c5 a10*c4+a11*c5 a11*c4+a12*c5
 3515|  20.2k|                res_r1_t3_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff4_5_16x8b);   //b4*c4+b5*c5 b5*c4+b6*c5 b6*c4+b7*c5 b7*c4+b8*c5
 3516|       |                                                                                        //b8*c4+b9*c5 b9*c4+b10*c5 b10*c4+b11*c5 b11*c4+b12*c5
 3517|  20.2k|                res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t2_8x16b);
 3518|  20.2k|                res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t3_8x16b);
 3519|       |
 3520|  20.2k|                res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t2_8x16b);
 3521|  20.2k|                res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t3_8x16b);
 3522|       |
 3523|  20.2k|                _mm_storeu_si128((__m128i *)(pi2_temp1), res_r0_t1_8x16b);
 3524|  20.2k|                _mm_storeu_si128((__m128i *)(pi2_temp1 + 8), res_r1_t1_8x16b);
 3525|       |
 3526|  20.2k|                ht_temp -= 2;
 3527|  20.2k|                pu1_src =  pu1_src + (src_strd << 1);
 3528|  20.2k|                pi2_temp1 =  pi2_temp1 + (8 << 1);
 3529|  20.2k|            }
 3530|  20.2k|            while(ht_temp > 0);
  ------------------
  |  Branch (3530:19): [True: 18.0k, False: 2.22k]
  ------------------
 3531|  2.22k|        }
 3532|       |        // vertical q-pel
 3533|  2.22k|        {
 3534|  2.22k|            __m128i src_r0_8x16b, src_r1_8x16b, src_r2_8x16b, src_r3_8x16b;
 3535|  2.22k|            __m128i src_r4_8x16b, src_r5_8x16b, src_r6_8x16b;
 3536|  2.22k|            __m128i src_r0r1_8x16b, src_r2r3_8x16b, src_r4r5_8x16b;
 3537|  2.22k|            __m128i src_hpel_8x16b, src_hpel_16x8b;
 3538|       |
 3539|  2.22k|            __m128i res_t0_4x32b, res_t1_4x32b, res_t2_4x32b, res_t3_4x32b;
 3540|  2.22k|            __m128i res_8x16b, res_16x8b;
 3541|       |
 3542|  2.22k|            __m128i coeff0_1_8x16b, coeff2_3_8x16b, coeff4_5_8x16b;
 3543|  2.22k|            __m128i const_val512_4x32b, const_val16_8x16b;
 3544|       |
 3545|  2.22k|            coeff0_1_8x16b = _mm_set1_epi32(0xFFFB0001);
 3546|  2.22k|            coeff2_3_8x16b = _mm_set1_epi32(0x00140014);
 3547|  2.22k|            coeff4_5_8x16b = _mm_set1_epi32(0x0001FFFB);
 3548|       |
 3549|  2.22k|            const_val512_4x32b = _mm_set1_epi32(512);
 3550|  2.22k|            const_val16_8x16b = _mm_set1_epi16(16);
 3551|       |
 3552|  2.22k|            src_r0_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2));
 3553|  2.22k|            src_r1_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 8));
 3554|  2.22k|            src_r2_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 16));
 3555|  2.22k|            src_r3_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 24));
 3556|  2.22k|            src_r4_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 32));
 3557|  2.22k|            pi2_temp2 += 40;
 3558|       |
 3559|  2.22k|            do
 3560|  13.5k|            {
 3561|  13.5k|                src_r5_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2));
 3562|  13.5k|                src_r6_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 8));
 3563|       |
 3564|  13.5k|                src_r0r1_8x16b = _mm_unpacklo_epi16(src_r0_8x16b, src_r1_8x16b);
 3565|  13.5k|                src_r2r3_8x16b = _mm_unpacklo_epi16(src_r2_8x16b, src_r3_8x16b);
 3566|  13.5k|                src_r4r5_8x16b = _mm_unpacklo_epi16(src_r4_8x16b, src_r5_8x16b);
 3567|       |
 3568|  13.5k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3569|  13.5k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3570|  13.5k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3571|       |
 3572|  13.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3573|  13.5k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3574|  13.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3575|  13.5k|                res_t0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3576|       |
 3577|  13.5k|                src_r0r1_8x16b = _mm_unpackhi_epi16(src_r0_8x16b, src_r1_8x16b);
 3578|  13.5k|                src_r2r3_8x16b = _mm_unpackhi_epi16(src_r2_8x16b, src_r3_8x16b);
 3579|  13.5k|                src_r4r5_8x16b = _mm_unpackhi_epi16(src_r4_8x16b, src_r5_8x16b);
 3580|       |
 3581|  13.5k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3582|  13.5k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3583|  13.5k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3584|       |
 3585|  13.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3586|  13.5k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3587|  13.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3588|  13.5k|                res_t1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3589|       |
 3590|  13.5k|                res_8x16b = _mm_packs_epi32(res_t0_4x32b, res_t1_4x32b);
 3591|  13.5k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 3592|       |
 3593|  13.5k|                src_hpel_8x16b = _mm_loadu_si128((__m128i *)pi2_temp3);
 3594|  13.5k|                src_hpel_8x16b = _mm_add_epi16(const_val16_8x16b, src_hpel_8x16b);
 3595|  13.5k|                src_hpel_8x16b = _mm_srai_epi16(src_hpel_8x16b, 5); //shifting right by 5 bits.
 3596|  13.5k|                src_hpel_16x8b = _mm_packus_epi16(src_hpel_8x16b, src_hpel_8x16b);
 3597|       |
 3598|  13.5k|                res_16x8b = _mm_avg_epu8(res_16x8b, src_hpel_16x8b);
 3599|       |
 3600|  13.5k|                _mm_storel_epi64((__m128i *)(pu1_dst), res_16x8b);
 3601|       |
 3602|  13.5k|                src_r0r1_8x16b = _mm_unpacklo_epi16(src_r1_8x16b, src_r2_8x16b);
 3603|  13.5k|                src_r2r3_8x16b = _mm_unpacklo_epi16(src_r3_8x16b, src_r4_8x16b);
 3604|  13.5k|                src_r4r5_8x16b = _mm_unpacklo_epi16(src_r5_8x16b, src_r6_8x16b);
 3605|       |
 3606|  13.5k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3607|  13.5k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3608|  13.5k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3609|       |
 3610|  13.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3611|  13.5k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3612|  13.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3613|  13.5k|                res_t0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3614|       |
 3615|  13.5k|                src_r0r1_8x16b = _mm_unpackhi_epi16(src_r1_8x16b, src_r2_8x16b);
 3616|  13.5k|                src_r2r3_8x16b = _mm_unpackhi_epi16(src_r3_8x16b, src_r4_8x16b);
 3617|  13.5k|                src_r4r5_8x16b = _mm_unpackhi_epi16(src_r5_8x16b, src_r6_8x16b);
 3618|       |
 3619|  13.5k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3620|  13.5k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3621|  13.5k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3622|       |
 3623|  13.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3624|  13.5k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3625|  13.5k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3626|  13.5k|                res_t1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3627|       |
 3628|  13.5k|                res_8x16b = _mm_packs_epi32(res_t0_4x32b, res_t1_4x32b);
 3629|  13.5k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 3630|       |
 3631|  13.5k|                src_hpel_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp3 + 8));
 3632|  13.5k|                src_hpel_8x16b = _mm_add_epi16(const_val16_8x16b, src_hpel_8x16b);
 3633|  13.5k|                src_hpel_8x16b = _mm_srai_epi16(src_hpel_8x16b, 5); //shifting right by 5 bits.
 3634|  13.5k|                src_hpel_16x8b = _mm_packus_epi16(src_hpel_8x16b, src_hpel_8x16b);
 3635|       |
 3636|  13.5k|                res_16x8b = _mm_avg_epu8(res_16x8b, src_hpel_16x8b);
 3637|       |
 3638|  13.5k|                _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), res_16x8b);
 3639|       |
 3640|  13.5k|                src_r0_8x16b = src_r2_8x16b;
 3641|  13.5k|                src_r1_8x16b = src_r3_8x16b;
 3642|  13.5k|                src_r2_8x16b = src_r4_8x16b;
 3643|  13.5k|                src_r3_8x16b = src_r5_8x16b;
 3644|  13.5k|                src_r4_8x16b = src_r6_8x16b;
 3645|       |
 3646|  13.5k|                ht -= 2;
 3647|  13.5k|                pi2_temp2 = pi2_temp2 + (8 << 1);
 3648|  13.5k|                pi2_temp3 = pi2_temp3 + (8 << 1);
 3649|  13.5k|                pu1_dst = pu1_dst + (dst_strd << 1);
 3650|  13.5k|            }
 3651|  13.5k|            while(ht > 0);
  ------------------
  |  Branch (3651:19): [True: 11.3k, False: 2.22k]
  ------------------
 3652|  2.22k|        }
 3653|  2.22k|    }
 3654|  2.86k|    else // wd == 16
 3655|  2.86k|    {
 3656|  2.86k|        UWORD8 *pu1_dst1;
 3657|  2.86k|        WORD16 *pi2_temp4,*pi2_temp5;
 3658|       |
 3659|  2.86k|        pu1_dst1 = pu1_dst + 8;
 3660|  2.86k|        pi2_temp4 = pi2_temp2 + 8;
 3661|  2.86k|        pi2_temp5 = pi2_temp3 + 8;
 3662|       |
 3663|       |        // horizontal half-pel
 3664|  2.86k|        {
 3665|  2.86k|            __m128i src_r0_16x8b, src_r1_16x8b, src_r0_sht_16x8b, src_r1_sht_16x8b;
 3666|  2.86k|            __m128i src_r0_t1_16x8b, src_r1_t1_16x8b;
 3667|       |
 3668|  2.86k|            __m128i res_r0_t1_8x16b, res_r0_t2_8x16b, res_r0_t3_8x16b;
 3669|  2.86k|            __m128i res_r1_t1_8x16b, res_r1_t2_8x16b, res_r1_t3_8x16b;
 3670|       |
 3671|  2.86k|            __m128i coeff0_1_16x8b, coeff2_3_16x8b, coeff4_5_16x8b;
 3672|       |
 3673|  2.86k|            coeff0_1_16x8b = _mm_set1_epi32(0xFB01FB01);  //c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1 c0 c1
 3674|  2.86k|            coeff2_3_16x8b = _mm_set1_epi32(0x14141414);  //c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3 c2 c3
 3675|  2.86k|            coeff4_5_16x8b = _mm_set1_epi32(0x01FB01FB);  //c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c5 c5
 3676|       |
 3677|       |            //Row0 : a0 a1 a2 a3 a4 a5 a6 a7 a8 a9.....
 3678|       |            //Row0 :                         b0 b1 b2 b3 b4 b5 b6 b7 b8 b9.....
 3679|       |            //b0 is same a8. Similarly other bn pixels are same as a(n+8) pixels.
 3680|       |
 3681|  2.86k|            do
 3682|  54.4k|            {
 3683|  54.4k|                src_r0_16x8b = _mm_loadu_si128((__m128i *)(pu1_src));                  //a0 a1 a2 a3 a4 a5 a6 a7 a8 a9....a15
 3684|  54.4k|                src_r1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + 8));              //b0 b1 b2 b3 b4 b5 b6 b7 b8 b9....b15
 3685|       |
 3686|  54.4k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_16x8b, 1);                    //a1 a2 a3 a4 a5 a6 a7 a8 a9....a15 0
 3687|  54.4k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_16x8b, 1);                    //b1 b2 b3 b4 b5 b6 b7 b8 b9....b15 0
 3688|       |
 3689|  54.4k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);   //a0 a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8
 3690|  54.4k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);   //b0 b1 b1 b2 b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8
 3691|       |
 3692|  54.4k|                res_r0_t1_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff0_1_16x8b);   //a0*c0+a1*c1 a1*c0+a2*c1 a2*c0+a3*c1 a3*c0+a4*c1
 3693|       |                                                                                        //a4*c0+a5*c1 a5*c0+a6*c1 a6*c0+a7*c1 a7*c0+a8*c1
 3694|  54.4k|                res_r1_t1_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff0_1_16x8b);   //b0*c0+b1*c1 b1*c0+b2*c1 b2*c0+b3*c1 b3*c0+b4*c1
 3695|       |                                                                                        //b4*c0+b5*c1 b5*c0+b6*c1 b6*c0+b7*c1 b7*c0+b8*c1
 3696|       |
 3697|  54.4k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                         //a2 a3 a4 a5 a6 a7 a8 a9....a15 0 0
 3698|  54.4k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                         //b2 b3 b4 b5 b6 b7 b8 b9....b15 0 0
 3699|       |
 3700|  54.4k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                 //a3 a4 a5 a6 a7 a8 a9....a15 0  0  0
 3701|  54.4k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                 //b3 b4 b5 b6 b7 b8 b9....b15 0  0  0
 3702|       |
 3703|  54.4k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);    //a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10
 3704|  54.4k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);    //b2 b3 b3 b4 b4 b5 b5 b6 b6 b7 b7 b8 a8 a9 a9 a10
 3705|       |
 3706|  54.4k|                res_r0_t2_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff2_3_16x8b);   //a2*c2+a3*c3 a3*c2+a4*c3 a4*c2+a5*c3 a5*c2+a6*c3
 3707|       |                                                                                        //a6*c2+a7*c3 a7*c2+a8*c3 a8*c2+a9*c3 a9*c2+a10*c3
 3708|  54.4k|                res_r1_t2_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff2_3_16x8b);   //b2*c2+b3*c3 b3*c2+b4*c3 b2*c4+b5*c3 b5*c2+b6*c3
 3709|       |                                                                                        //b6*c2+b7*c3 b7*c2+b8*c3 b8*c2+b9*c3 b9*c2+b10*c3
 3710|       |
 3711|  54.4k|                src_r0_16x8b = _mm_srli_si128(src_r0_16x8b, 2);                         //a4 a5 a6 a7 a8 a9....a15 0  0  0  0
 3712|  54.4k|                src_r1_16x8b = _mm_srli_si128(src_r1_16x8b, 2);                         //b4 b5 b6 b7 b8 b9....b15 0  0  0  0
 3713|       |
 3714|  54.4k|                src_r0_sht_16x8b = _mm_srli_si128(src_r0_sht_16x8b, 2);                 //a5 a6 a7 a8 a9....a15 0  0  0  0  0
 3715|  54.4k|                src_r1_sht_16x8b = _mm_srli_si128(src_r1_sht_16x8b, 2);                 //b5 b6 b7 b8 b9....b15 0  0  0  0  0
 3716|       |
 3717|  54.4k|                src_r0_t1_16x8b = _mm_unpacklo_epi8(src_r0_16x8b, src_r0_sht_16x8b);    //a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10 a10 a11 a11 a12
 3718|  54.4k|                src_r1_t1_16x8b = _mm_unpacklo_epi8(src_r1_16x8b, src_r1_sht_16x8b);    //b4 b5 b5 b6 b6 b7 b7 b8 b8 b9 b9 b10 b10 b11 b11 b12
 3719|       |
 3720|  54.4k|                res_r0_t3_8x16b = _mm_maddubs_epi16(src_r0_t1_16x8b, coeff4_5_16x8b);   //a4*c4+a5*c5 a5*c4+a6*c5 a6*c4+a7*c5 a7*c4+a8*c5
 3721|       |                                                                                        //a8*c4+a9*c5 a9*c4+a10*c5 a10*c4+a11*c5 a11*c4+a12*c5
 3722|  54.4k|                res_r1_t3_8x16b = _mm_maddubs_epi16(src_r1_t1_16x8b, coeff4_5_16x8b);   //b4*c4+b5*c5 b5*c4+b6*c5 b6*c4+b7*c5 b7*c4+b8*c5
 3723|       |                                                                                        //b8*c4+b9*c5 b9*c4+b10*c5 b10*c4+b11*c5 b11*c4+b12*c5
 3724|  54.4k|                res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t2_8x16b);
 3725|  54.4k|                res_r0_t1_8x16b = _mm_add_epi16(res_r0_t1_8x16b, res_r0_t3_8x16b);
 3726|       |
 3727|  54.4k|                res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t2_8x16b);
 3728|  54.4k|                res_r1_t1_8x16b = _mm_add_epi16(res_r1_t1_8x16b, res_r1_t3_8x16b);
 3729|       |
 3730|  54.4k|                _mm_storeu_si128((__m128i *)(pi2_temp1), res_r0_t1_8x16b);
 3731|  54.4k|                _mm_storeu_si128((__m128i *)(pi2_temp1 + 8), res_r1_t1_8x16b);
 3732|       |
 3733|  54.4k|                ht_temp--;
 3734|  54.4k|                pu1_src =  pu1_src + src_strd;
 3735|  54.4k|                pi2_temp1 =  pi2_temp1 + 16;
 3736|  54.4k|            }
 3737|  54.4k|            while(ht_temp > 0);
  ------------------
  |  Branch (3737:19): [True: 51.5k, False: 2.86k]
  ------------------
 3738|  2.86k|        }
 3739|       |        // vertical q-pel
 3740|  2.86k|        {
 3741|  2.86k|            __m128i src_r0_8x16b, src_r1_8x16b, src_r2_8x16b, src_r3_8x16b, src_r4_8x16b;
 3742|  2.86k|            __m128i src_r5_8x16b, src_r6_8x16b;
 3743|  2.86k|            __m128i src_r0r1_8x16b, src_r2r3_8x16b, src_r4r5_8x16b;
 3744|  2.86k|            __m128i src_hpel_8x16b, src_hpel_16x8b;
 3745|       |
 3746|  2.86k|            __m128i res_t0_4x32b, res_t1_4x32b, res_t2_4x32b, res_t3_4x32b;
 3747|  2.86k|            __m128i res_8x16b, res_16x8b;
 3748|       |
 3749|  2.86k|            __m128i coeff0_1_8x16b, coeff2_3_8x16b, coeff4_5_8x16b;
 3750|  2.86k|            __m128i const_val512_4x32b, const_val16_8x16b;
 3751|       |
 3752|  2.86k|            coeff0_1_8x16b = _mm_set1_epi32(0xFFFB0001);
 3753|  2.86k|            coeff2_3_8x16b = _mm_set1_epi32(0x00140014);
 3754|  2.86k|            coeff4_5_8x16b = _mm_set1_epi32(0x0001FFFB);
 3755|       |
 3756|  2.86k|            const_val512_4x32b = _mm_set1_epi32(512);
 3757|  2.86k|            const_val16_8x16b = _mm_set1_epi16(16);
 3758|       |
 3759|       |            /**********************************************************/
 3760|       |            /*     Do first height x 8 block                          */
 3761|       |            /**********************************************************/
 3762|  2.86k|            src_r0_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2));
 3763|  2.86k|            src_r1_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 16));
 3764|  2.86k|            src_r2_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 32));
 3765|  2.86k|            src_r3_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 48));
 3766|  2.86k|            src_r4_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 64));
 3767|  2.86k|            pi2_temp2 += 80;
 3768|       |
 3769|  2.86k|            ht_temp = ht;
 3770|  2.86k|            do
 3771|  20.0k|            {
 3772|  20.0k|                src_r5_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2));
 3773|  20.0k|                src_r6_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp2 + 16));
 3774|       |
 3775|  20.0k|                src_r0r1_8x16b = _mm_unpacklo_epi16(src_r0_8x16b, src_r1_8x16b);
 3776|  20.0k|                src_r2r3_8x16b = _mm_unpacklo_epi16(src_r2_8x16b, src_r3_8x16b);
 3777|  20.0k|                src_r4r5_8x16b = _mm_unpacklo_epi16(src_r4_8x16b, src_r5_8x16b);
 3778|       |
 3779|  20.0k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3780|  20.0k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3781|  20.0k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3782|       |
 3783|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3784|  20.0k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3785|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3786|  20.0k|                res_t0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3787|       |
 3788|  20.0k|                src_r0r1_8x16b = _mm_unpackhi_epi16(src_r0_8x16b, src_r1_8x16b);
 3789|  20.0k|                src_r2r3_8x16b = _mm_unpackhi_epi16(src_r2_8x16b, src_r3_8x16b);
 3790|  20.0k|                src_r4r5_8x16b = _mm_unpackhi_epi16(src_r4_8x16b, src_r5_8x16b);
 3791|       |
 3792|  20.0k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3793|  20.0k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3794|  20.0k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3795|       |
 3796|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3797|  20.0k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3798|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3799|  20.0k|                res_t1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3800|       |
 3801|  20.0k|                res_8x16b = _mm_packs_epi32(res_t0_4x32b, res_t1_4x32b);
 3802|  20.0k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 3803|       |
 3804|  20.0k|                src_hpel_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp3));
 3805|  20.0k|                src_hpel_8x16b = _mm_add_epi16(src_hpel_8x16b, const_val16_8x16b);
 3806|  20.0k|                src_hpel_8x16b = _mm_srai_epi16(src_hpel_8x16b, 5); //shifting right by 5 bits.
 3807|  20.0k|                src_hpel_16x8b = _mm_packus_epi16(src_hpel_8x16b, src_hpel_8x16b);
 3808|       |
 3809|  20.0k|                res_16x8b = _mm_avg_epu8(res_16x8b, src_hpel_16x8b);
 3810|  20.0k|                _mm_storel_epi64((__m128i *)(pu1_dst), res_16x8b);
 3811|       |
 3812|  20.0k|                src_r0r1_8x16b = _mm_unpacklo_epi16(src_r1_8x16b, src_r2_8x16b);
 3813|  20.0k|                src_r2r3_8x16b = _mm_unpacklo_epi16(src_r3_8x16b, src_r4_8x16b);
 3814|  20.0k|                src_r4r5_8x16b = _mm_unpacklo_epi16(src_r5_8x16b, src_r6_8x16b);
 3815|       |
 3816|  20.0k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3817|  20.0k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3818|  20.0k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3819|       |
 3820|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3821|  20.0k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3822|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3823|  20.0k|                res_t0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3824|       |
 3825|  20.0k|                src_r0r1_8x16b = _mm_unpackhi_epi16(src_r1_8x16b, src_r2_8x16b);
 3826|  20.0k|                src_r2r3_8x16b = _mm_unpackhi_epi16(src_r3_8x16b, src_r4_8x16b);
 3827|  20.0k|                src_r4r5_8x16b = _mm_unpackhi_epi16(src_r5_8x16b, src_r6_8x16b);
 3828|       |
 3829|  20.0k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3830|  20.0k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3831|  20.0k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3832|       |
 3833|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3834|  20.0k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3835|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3836|  20.0k|                res_t1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3837|       |
 3838|  20.0k|                res_8x16b = _mm_packs_epi32(res_t0_4x32b, res_t1_4x32b);
 3839|  20.0k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 3840|       |
 3841|  20.0k|                src_hpel_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp3 + 16));
 3842|  20.0k|                src_hpel_8x16b = _mm_add_epi16(src_hpel_8x16b, const_val16_8x16b);
 3843|  20.0k|                src_hpel_8x16b = _mm_srai_epi16(src_hpel_8x16b, 5); //shifting right by 5 bits.
 3844|  20.0k|                src_hpel_16x8b = _mm_packus_epi16(src_hpel_8x16b, src_hpel_8x16b);
 3845|       |
 3846|  20.0k|                res_16x8b = _mm_avg_epu8(res_16x8b, src_hpel_16x8b);
 3847|  20.0k|                _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), res_16x8b);
 3848|       |
 3849|  20.0k|                src_r0_8x16b = src_r2_8x16b;
 3850|  20.0k|                src_r1_8x16b = src_r3_8x16b;
 3851|  20.0k|                src_r2_8x16b = src_r4_8x16b;
 3852|  20.0k|                src_r3_8x16b = src_r5_8x16b;
 3853|  20.0k|                src_r4_8x16b = src_r6_8x16b;
 3854|       |
 3855|  20.0k|                ht_temp -= 2;
 3856|  20.0k|                pi2_temp3 = pi2_temp3 + (16 << 1);
 3857|  20.0k|                pi2_temp2 = pi2_temp2 + (16 << 1);
 3858|  20.0k|                pu1_dst = pu1_dst + (dst_strd << 1);
 3859|  20.0k|            }
 3860|  20.0k|            while(ht_temp > 0);
  ------------------
  |  Branch (3860:19): [True: 17.1k, False: 2.86k]
  ------------------
 3861|       |
 3862|       |            /**********************************************************/
 3863|       |            /*     Do second height * 8 block                         */
 3864|       |            /**********************************************************/
 3865|  2.86k|            src_r0_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp4));
 3866|  2.86k|            src_r1_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp4 + 16));
 3867|  2.86k|            src_r2_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp4 + 32));
 3868|  2.86k|            src_r3_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp4 + 48));
 3869|  2.86k|            src_r4_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp4 + 64));
 3870|  2.86k|            pi2_temp4 += 80;
 3871|       |
 3872|  2.86k|            do
 3873|  20.0k|            {
 3874|  20.0k|                src_r5_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp4));
 3875|  20.0k|                src_r6_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp4 + 16));
 3876|       |
 3877|  20.0k|                src_r0r1_8x16b = _mm_unpacklo_epi16(src_r0_8x16b, src_r1_8x16b);
 3878|  20.0k|                src_r2r3_8x16b = _mm_unpacklo_epi16(src_r2_8x16b, src_r3_8x16b);
 3879|  20.0k|                src_r4r5_8x16b = _mm_unpacklo_epi16(src_r4_8x16b, src_r5_8x16b);
 3880|       |
 3881|  20.0k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3882|  20.0k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3883|  20.0k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3884|       |
 3885|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3886|  20.0k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3887|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3888|  20.0k|                res_t0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3889|       |
 3890|  20.0k|                src_r0r1_8x16b = _mm_unpackhi_epi16(src_r0_8x16b, src_r1_8x16b);
 3891|  20.0k|                src_r2r3_8x16b = _mm_unpackhi_epi16(src_r2_8x16b, src_r3_8x16b);
 3892|  20.0k|                src_r4r5_8x16b = _mm_unpackhi_epi16(src_r4_8x16b, src_r5_8x16b);
 3893|       |
 3894|  20.0k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3895|  20.0k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3896|  20.0k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3897|       |
 3898|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3899|  20.0k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3900|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3901|  20.0k|                res_t1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3902|       |
 3903|  20.0k|                res_8x16b = _mm_packs_epi32(res_t0_4x32b, res_t1_4x32b);
 3904|  20.0k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 3905|       |
 3906|  20.0k|                src_hpel_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp5));
 3907|  20.0k|                src_hpel_8x16b = _mm_add_epi16(src_hpel_8x16b, const_val16_8x16b);
 3908|  20.0k|                src_hpel_8x16b = _mm_srai_epi16(src_hpel_8x16b, 5); //shifting right by 5 bits.
 3909|  20.0k|                src_hpel_16x8b = _mm_packus_epi16(src_hpel_8x16b, src_hpel_8x16b);
 3910|       |
 3911|  20.0k|                res_16x8b = _mm_avg_epu8(res_16x8b, src_hpel_16x8b);
 3912|  20.0k|                _mm_storel_epi64((__m128i *)(pu1_dst1), res_16x8b);
 3913|       |
 3914|  20.0k|                src_r0r1_8x16b = _mm_unpacklo_epi16(src_r1_8x16b, src_r2_8x16b);
 3915|  20.0k|                src_r2r3_8x16b = _mm_unpacklo_epi16(src_r3_8x16b, src_r4_8x16b);
 3916|  20.0k|                src_r4r5_8x16b = _mm_unpacklo_epi16(src_r5_8x16b, src_r6_8x16b);
 3917|       |
 3918|  20.0k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3919|  20.0k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3920|  20.0k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3921|       |
 3922|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3923|  20.0k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3924|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3925|  20.0k|                res_t0_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3926|       |
 3927|  20.0k|                src_r0r1_8x16b = _mm_unpackhi_epi16(src_r1_8x16b, src_r2_8x16b);
 3928|  20.0k|                src_r2r3_8x16b = _mm_unpackhi_epi16(src_r3_8x16b, src_r4_8x16b);
 3929|  20.0k|                src_r4r5_8x16b = _mm_unpackhi_epi16(src_r5_8x16b, src_r6_8x16b);
 3930|       |
 3931|  20.0k|                res_t1_4x32b = _mm_madd_epi16(src_r0r1_8x16b, coeff0_1_8x16b);
 3932|  20.0k|                res_t2_4x32b = _mm_madd_epi16(src_r2r3_8x16b, coeff2_3_8x16b);
 3933|  20.0k|                res_t3_4x32b = _mm_madd_epi16(src_r4r5_8x16b, coeff4_5_8x16b);
 3934|       |
 3935|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t2_4x32b);
 3936|  20.0k|                res_t3_4x32b = _mm_add_epi32(res_t3_4x32b, const_val512_4x32b);
 3937|  20.0k|                res_t1_4x32b = _mm_add_epi32(res_t1_4x32b, res_t3_4x32b);
 3938|  20.0k|                res_t1_4x32b = _mm_srai_epi32(res_t1_4x32b, 10);
 3939|       |
 3940|  20.0k|                res_8x16b = _mm_packs_epi32(res_t0_4x32b, res_t1_4x32b);
 3941|  20.0k|                res_16x8b = _mm_packus_epi16(res_8x16b, res_8x16b);
 3942|       |
 3943|  20.0k|                src_hpel_8x16b = _mm_loadu_si128((__m128i *)(pi2_temp5 + 16));
 3944|  20.0k|                src_hpel_8x16b = _mm_add_epi16(src_hpel_8x16b, const_val16_8x16b);
 3945|  20.0k|                src_hpel_8x16b = _mm_srai_epi16(src_hpel_8x16b, 5); //shifting right by 5 bits.
 3946|  20.0k|                src_hpel_16x8b = _mm_packus_epi16(src_hpel_8x16b, src_hpel_8x16b);
 3947|       |
 3948|  20.0k|                res_16x8b = _mm_avg_epu8(res_16x8b, src_hpel_16x8b);
 3949|  20.0k|                _mm_storel_epi64((__m128i *)(pu1_dst1 + dst_strd), res_16x8b);
 3950|       |
 3951|  20.0k|                src_r0_8x16b = src_r2_8x16b;
 3952|  20.0k|                src_r1_8x16b = src_r3_8x16b;
 3953|  20.0k|                src_r2_8x16b = src_r4_8x16b;
 3954|  20.0k|                src_r3_8x16b = src_r5_8x16b;
 3955|  20.0k|                src_r4_8x16b = src_r6_8x16b;
 3956|       |
 3957|  20.0k|                ht -= 2;
 3958|  20.0k|                pi2_temp5 = pi2_temp5 + (16 << 1);
 3959|  20.0k|                pi2_temp4 = pi2_temp4 + (16 << 1);
 3960|  20.0k|                pu1_dst1 = pu1_dst1 + (dst_strd << 1);
 3961|  20.0k|            }
 3962|  20.0k|            while(ht > 0);
  ------------------
  |  Branch (3962:19): [True: 17.1k, False: 2.86k]
  ------------------
 3963|  2.86k|        }
 3964|  2.86k|    }
 3965|  5.43k|}
ih264_inter_pred_chroma_ssse3:
 4002|   362k|{
 4003|   362k|    WORD32 i, j, A, B, C, D;
 4004|       |
 4005|   362k|    i = 8 - dx;
 4006|   362k|    j = 8 - dy;
 4007|       |
 4008|   362k|    A = i * j;
 4009|   362k|    B = dx * j;
 4010|   362k|    C = i * dy;
 4011|   362k|    D = dx * dy;
 4012|       |
 4013|   362k|    if(wd == 2)
  ------------------
  |  Branch (4013:8): [True: 7.07k, False: 355k]
  ------------------
 4014|  7.07k|    {
 4015|  7.07k|        WORD32 tmp1, tmp2, tmp3, tmp4;
 4016|       |
 4017|  7.07k|        do
 4018|  10.2k|        {
 4019|       |            //U
 4020|  10.2k|            tmp1 = A * pu1_src[0] + B * pu1_src[2] + C * pu1_src[src_strd] + D * pu1_src[src_strd + 2];
 4021|  10.2k|            tmp2 = A * pu1_src[2] + B * pu1_src[4] + C * pu1_src[src_strd + 2] + D * pu1_src[src_strd + 4];
 4022|       |            //V
 4023|  10.2k|            tmp3 = A * pu1_src[1] + B * pu1_src[3] + C * pu1_src[src_strd + 1] + D * pu1_src[src_strd + 3];
 4024|  10.2k|            tmp4 = A * pu1_src[3] + B * pu1_src[5] + C * pu1_src[src_strd + 3] + D * pu1_src[src_strd + 5];
 4025|       |
 4026|  10.2k|            tmp1 = (tmp1 + 32) >> 6;
 4027|  10.2k|            tmp2 = (tmp2 + 32) >> 6;
 4028|  10.2k|            tmp3 = (tmp3 + 32) >> 6;
 4029|  10.2k|            tmp4 = (tmp4 + 32) >> 6;
 4030|       |
 4031|  10.2k|            pu1_dst[0] = CLIP_U8(tmp1);
  ------------------
  |  |   58|  10.2k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  10.2k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 10.2k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 10.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4032|  10.2k|            pu1_dst[2] = CLIP_U8(tmp2);
  ------------------
  |  |   58|  10.2k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  10.2k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 10.2k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 10.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4033|  10.2k|            pu1_dst[1] = CLIP_U8(tmp3);
  ------------------
  |  |   58|  10.2k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  10.2k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 10.2k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 10.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4034|  10.2k|            pu1_dst[3] = CLIP_U8(tmp4);
  ------------------
  |  |   58|  10.2k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  10.2k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 10.2k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 10.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4035|       |
 4036|  10.2k|            pu1_src += src_strd;
 4037|  10.2k|            pu1_dst += dst_strd;
 4038|       |
 4039|  10.2k|            tmp1 = A * pu1_src[0] + B * pu1_src[2] + C * pu1_src[src_strd] + D * pu1_src[src_strd + 2];
 4040|  10.2k|            tmp2 = A * pu1_src[2] + B * pu1_src[4] + C * pu1_src[src_strd + 2] + D * pu1_src[src_strd + 4];
 4041|  10.2k|            tmp3 = A * pu1_src[1] + B * pu1_src[3] + C * pu1_src[src_strd + 1] + D * pu1_src[src_strd + 3];
 4042|  10.2k|            tmp4 = A * pu1_src[3] + B * pu1_src[5] + C * pu1_src[src_strd + 3] + D * pu1_src[src_strd + 5];
 4043|       |
 4044|  10.2k|            tmp1 = (tmp1 + 32) >> 6;
 4045|  10.2k|            tmp2 = (tmp2 + 32) >> 6;
 4046|  10.2k|            tmp3 = (tmp3 + 32) >> 6;
 4047|  10.2k|            tmp4 = (tmp4 + 32) >> 6;
 4048|       |
 4049|  10.2k|            pu1_dst[0] = CLIP_U8(tmp1);
  ------------------
  |  |   58|  10.2k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  10.2k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 10.2k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 10.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4050|  10.2k|            pu1_dst[2] = CLIP_U8(tmp2);
  ------------------
  |  |   58|  10.2k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  10.2k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 10.2k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 10.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4051|  10.2k|            pu1_dst[1] = CLIP_U8(tmp3);
  ------------------
  |  |   58|  10.2k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  10.2k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 10.2k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 10.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4052|  10.2k|            pu1_dst[3] = CLIP_U8(tmp4);
  ------------------
  |  |   58|  10.2k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  10.2k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 10.2k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 10.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 4053|       |
 4054|  10.2k|            ht -= 2;
 4055|  10.2k|            pu1_src += src_strd;
 4056|  10.2k|            pu1_dst += dst_strd;
 4057|  10.2k|        }
 4058|  10.2k|        while(ht > 0);
  ------------------
  |  Branch (4058:15): [True: 3.15k, False: 7.07k]
  ------------------
 4059|       |
 4060|  7.07k|    }
 4061|   355k|    else if(wd == 4)
  ------------------
  |  Branch (4061:13): [True: 25.7k, False: 329k]
  ------------------
 4062|  25.7k|    {
 4063|  25.7k|        WORD32 AB, CD;
 4064|       |
 4065|  25.7k|        __m128i src_r1_16x8b, src_r2_16x8b, src_r3_16x8b;
 4066|  25.7k|        __m128i res1_AB_8x16b, res1_CD_8x16b, res1_8x16b, res1_16x8b;
 4067|  25.7k|        __m128i res2_AB_8x16b, res2_CD_8x16b, res2_8x16b, res2_16x8b;
 4068|       |
 4069|  25.7k|        __m128i coeffAB_16x8b, coeffCD_16x8b, round_add32_8x16b;
 4070|  25.7k|        __m128i const_shuff_16x8b;
 4071|       |
 4072|  25.7k|        AB = (B << 8) + A;
 4073|  25.7k|        CD = (D << 8) + C;
 4074|       |
 4075|  25.7k|        coeffAB_16x8b = _mm_set1_epi16(AB);
 4076|  25.7k|        coeffCD_16x8b = _mm_set1_epi16(CD);
 4077|       |
 4078|  25.7k|        round_add32_8x16b = _mm_set1_epi16(32);
 4079|       |
 4080|  25.7k|        const_shuff_16x8b = _mm_setr_epi32(0x03010200, 0x05030402, 0x07050604, 0x09070806);
 4081|       |
 4082|  25.7k|        src_r1_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
 4083|  25.7k|        src_r1_16x8b = _mm_shuffle_epi8(src_r1_16x8b, const_shuff_16x8b);
 4084|  25.7k|        pu1_src += src_strd;
 4085|       |
 4086|  25.7k|        do
 4087|  70.3k|        {
 4088|  70.3k|            src_r2_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
 4089|  70.3k|            src_r3_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));
 4090|       |
 4091|  70.3k|            src_r2_16x8b = _mm_shuffle_epi8(src_r2_16x8b, const_shuff_16x8b);
 4092|  70.3k|            src_r3_16x8b = _mm_shuffle_epi8(src_r3_16x8b, const_shuff_16x8b);
 4093|       |
 4094|  70.3k|            res1_AB_8x16b = _mm_maddubs_epi16(src_r1_16x8b, coeffAB_16x8b);
 4095|  70.3k|            res1_CD_8x16b = _mm_maddubs_epi16(src_r2_16x8b, coeffCD_16x8b);
 4096|  70.3k|            res2_AB_8x16b = _mm_maddubs_epi16(src_r2_16x8b, coeffAB_16x8b);
 4097|  70.3k|            res2_CD_8x16b = _mm_maddubs_epi16(src_r3_16x8b, coeffCD_16x8b);
 4098|       |
 4099|  70.3k|            res1_8x16b = _mm_add_epi16(res1_AB_8x16b, res1_CD_8x16b);
 4100|  70.3k|            res2_8x16b = _mm_add_epi16(res2_AB_8x16b, res2_CD_8x16b);
 4101|  70.3k|            res1_8x16b = _mm_add_epi16(res1_8x16b, round_add32_8x16b);
 4102|  70.3k|            res2_8x16b = _mm_add_epi16(res2_8x16b, round_add32_8x16b);
 4103|       |
 4104|  70.3k|            res1_8x16b = _mm_srai_epi16(res1_8x16b, 6);
 4105|  70.3k|            res2_8x16b = _mm_srai_epi16(res2_8x16b, 6);
 4106|       |
 4107|  70.3k|            res1_16x8b = _mm_packus_epi16(res1_8x16b, res1_8x16b);
 4108|  70.3k|            res2_16x8b = _mm_packus_epi16(res2_8x16b, res2_8x16b);
 4109|       |
 4110|  70.3k|            _mm_storel_epi64((__m128i *)pu1_dst, res1_16x8b);
 4111|  70.3k|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), res2_16x8b);
 4112|       |
 4113|  70.3k|            src_r1_16x8b = src_r3_16x8b;
 4114|       |
 4115|  70.3k|            ht -= 2;
 4116|  70.3k|            pu1_src += src_strd << 1;
 4117|  70.3k|            pu1_dst += dst_strd << 1;
 4118|  70.3k|        }
 4119|  70.3k|        while(ht > 0);
  ------------------
  |  Branch (4119:15): [True: 44.5k, False: 25.7k]
  ------------------
 4120|  25.7k|    }
 4121|   329k|    else // wd == 8
 4122|   329k|    {
 4123|   329k|        WORD32 AB, CD;
 4124|       |
 4125|   329k|        __m128i src_r1l_16x8b, src_r2l_16x8b;
 4126|   329k|        __m128i src_r1h_16x8b, src_r2h_16x8b;
 4127|       |
 4128|   329k|        __m128i res_l_AB_8x16b, res_l_CD_8x16b;
 4129|   329k|        __m128i res_h_AB_8x16b, res_h_CD_8x16b;
 4130|   329k|        __m128i res_l_8x16b, res_h_8x16b, res_16x8b;
 4131|       |
 4132|   329k|        __m128i coeffAB_16x8b, coeffCD_16x8b, round_add32_8x16b;
 4133|   329k|        __m128i const_shuff_16x8b;
 4134|       |
 4135|   329k|        AB = (B << 8) + A;
 4136|   329k|        CD = (D << 8) + C;
 4137|       |
 4138|   329k|        coeffAB_16x8b = _mm_set1_epi16(AB);
 4139|   329k|        coeffCD_16x8b = _mm_set1_epi16(CD);
 4140|       |
 4141|   329k|        round_add32_8x16b = _mm_set1_epi16(32);
 4142|       |
 4143|   329k|        const_shuff_16x8b = _mm_setr_epi32(0x03010200, 0x05030402, 0x07050604, 0x09070806);
 4144|       |
 4145|   329k|        src_r1l_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
 4146|   329k|        src_r1h_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + 8));
 4147|       |
 4148|   329k|        src_r1l_16x8b = _mm_shuffle_epi8(src_r1l_16x8b, const_shuff_16x8b);
 4149|   329k|        src_r1h_16x8b = _mm_shuffle_epi8(src_r1h_16x8b, const_shuff_16x8b);
 4150|       |
 4151|   329k|        pu1_src += src_strd;
 4152|       |
 4153|   329k|        do
 4154|   650k|        {
 4155|       |            //row 1
 4156|   650k|            src_r2l_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
 4157|   650k|            src_r2h_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + 8));
 4158|       |
 4159|   650k|            src_r2l_16x8b = _mm_shuffle_epi8(src_r2l_16x8b, const_shuff_16x8b);
 4160|   650k|            src_r2h_16x8b = _mm_shuffle_epi8(src_r2h_16x8b, const_shuff_16x8b);
 4161|       |
 4162|   650k|            res_l_AB_8x16b = _mm_maddubs_epi16(src_r1l_16x8b, coeffAB_16x8b);
 4163|   650k|            res_h_AB_8x16b = _mm_maddubs_epi16(src_r1h_16x8b, coeffAB_16x8b);
 4164|   650k|            res_l_CD_8x16b = _mm_maddubs_epi16(src_r2l_16x8b, coeffCD_16x8b);
 4165|   650k|            res_h_CD_8x16b = _mm_maddubs_epi16(src_r2h_16x8b, coeffCD_16x8b);
 4166|       |
 4167|   650k|            res_l_8x16b = _mm_add_epi16(res_l_AB_8x16b, round_add32_8x16b);
 4168|   650k|            res_h_8x16b = _mm_add_epi16(res_h_AB_8x16b, round_add32_8x16b);
 4169|   650k|            res_l_8x16b = _mm_add_epi16(res_l_8x16b, res_l_CD_8x16b);
 4170|   650k|            res_h_8x16b = _mm_add_epi16(res_h_8x16b, res_h_CD_8x16b);
 4171|       |
 4172|   650k|            res_l_8x16b = _mm_srai_epi16(res_l_8x16b, 6);
 4173|   650k|            res_h_8x16b = _mm_srai_epi16(res_h_8x16b, 6);
 4174|       |
 4175|   650k|            res_16x8b = _mm_packus_epi16(res_l_8x16b, res_h_8x16b);
 4176|       |
 4177|   650k|            _mm_storeu_si128((__m128i *)pu1_dst, res_16x8b);
 4178|       |
 4179|   650k|            pu1_src += src_strd;
 4180|   650k|            pu1_dst += dst_strd;
 4181|       |
 4182|       |            //row 2
 4183|   650k|            src_r1l_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
 4184|   650k|            src_r1h_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + 8));
 4185|       |
 4186|   650k|            src_r1l_16x8b = _mm_shuffle_epi8(src_r1l_16x8b, const_shuff_16x8b);
 4187|   650k|            src_r1h_16x8b = _mm_shuffle_epi8(src_r1h_16x8b, const_shuff_16x8b);
 4188|       |
 4189|   650k|            res_l_AB_8x16b = _mm_maddubs_epi16(src_r2l_16x8b, coeffAB_16x8b);
 4190|   650k|            res_h_AB_8x16b = _mm_maddubs_epi16(src_r2h_16x8b, coeffAB_16x8b);
 4191|   650k|            res_l_CD_8x16b = _mm_maddubs_epi16(src_r1l_16x8b, coeffCD_16x8b);
 4192|   650k|            res_h_CD_8x16b = _mm_maddubs_epi16(src_r1h_16x8b, coeffCD_16x8b);
 4193|       |
 4194|   650k|            res_l_8x16b = _mm_add_epi16(res_l_AB_8x16b, round_add32_8x16b);
 4195|   650k|            res_h_8x16b = _mm_add_epi16(res_h_AB_8x16b, round_add32_8x16b);
 4196|   650k|            res_l_8x16b = _mm_add_epi16(res_l_8x16b, res_l_CD_8x16b);
 4197|   650k|            res_h_8x16b = _mm_add_epi16(res_h_8x16b, res_h_CD_8x16b);
 4198|       |
 4199|   650k|            res_l_8x16b = _mm_srai_epi16(res_l_8x16b, 6);
 4200|   650k|            res_h_8x16b = _mm_srai_epi16(res_h_8x16b, 6);
 4201|       |
 4202|   650k|            res_16x8b = _mm_packus_epi16(res_l_8x16b, res_h_8x16b);
 4203|       |
 4204|   650k|            _mm_storeu_si128((__m128i *)pu1_dst, res_16x8b);
 4205|       |
 4206|   650k|            pu1_src += src_strd;
 4207|   650k|            pu1_dst += dst_strd;
 4208|       |
 4209|       |            //row 3
 4210|   650k|            src_r2l_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
 4211|   650k|            src_r2h_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + 8));
 4212|       |
 4213|   650k|            src_r2l_16x8b = _mm_shuffle_epi8(src_r2l_16x8b, const_shuff_16x8b);
 4214|   650k|            src_r2h_16x8b = _mm_shuffle_epi8(src_r2h_16x8b, const_shuff_16x8b);
 4215|       |
 4216|   650k|            res_l_AB_8x16b = _mm_maddubs_epi16(src_r1l_16x8b, coeffAB_16x8b);
 4217|   650k|            res_h_AB_8x16b = _mm_maddubs_epi16(src_r1h_16x8b, coeffAB_16x8b);
 4218|   650k|            res_l_CD_8x16b = _mm_maddubs_epi16(src_r2l_16x8b, coeffCD_16x8b);
 4219|   650k|            res_h_CD_8x16b = _mm_maddubs_epi16(src_r2h_16x8b, coeffCD_16x8b);
 4220|       |
 4221|   650k|            res_l_8x16b = _mm_add_epi16(res_l_AB_8x16b, round_add32_8x16b);
 4222|   650k|            res_h_8x16b = _mm_add_epi16(res_h_AB_8x16b, round_add32_8x16b);
 4223|   650k|            res_l_8x16b = _mm_add_epi16(res_l_8x16b, res_l_CD_8x16b);
 4224|   650k|            res_h_8x16b = _mm_add_epi16(res_h_8x16b, res_h_CD_8x16b);
 4225|       |
 4226|   650k|            res_l_8x16b = _mm_srai_epi16(res_l_8x16b, 6);
 4227|   650k|            res_h_8x16b = _mm_srai_epi16(res_h_8x16b, 6);
 4228|       |
 4229|   650k|            res_16x8b = _mm_packus_epi16(res_l_8x16b, res_h_8x16b);
 4230|       |
 4231|   650k|            _mm_storeu_si128((__m128i *)pu1_dst, res_16x8b);
 4232|       |
 4233|   650k|            pu1_src += src_strd;
 4234|   650k|            pu1_dst += dst_strd;
 4235|       |
 4236|       |            //row 1
 4237|   650k|            src_r1l_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
 4238|   650k|            src_r1h_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + 8));
 4239|       |
 4240|   650k|            src_r1l_16x8b = _mm_shuffle_epi8(src_r1l_16x8b, const_shuff_16x8b);
 4241|   650k|            src_r1h_16x8b = _mm_shuffle_epi8(src_r1h_16x8b, const_shuff_16x8b);
 4242|       |
 4243|   650k|            res_l_AB_8x16b = _mm_maddubs_epi16(src_r2l_16x8b, coeffAB_16x8b);
 4244|   650k|            res_h_AB_8x16b = _mm_maddubs_epi16(src_r2h_16x8b, coeffAB_16x8b);
 4245|   650k|            res_l_CD_8x16b = _mm_maddubs_epi16(src_r1l_16x8b, coeffCD_16x8b);
 4246|   650k|            res_h_CD_8x16b = _mm_maddubs_epi16(src_r1h_16x8b, coeffCD_16x8b);
 4247|       |
 4248|   650k|            res_l_8x16b = _mm_add_epi16(res_l_AB_8x16b, round_add32_8x16b);
 4249|   650k|            res_h_8x16b = _mm_add_epi16(res_h_AB_8x16b, round_add32_8x16b);
 4250|   650k|            res_l_8x16b = _mm_add_epi16(res_l_8x16b, res_l_CD_8x16b);
 4251|   650k|            res_h_8x16b = _mm_add_epi16(res_h_8x16b, res_h_CD_8x16b);
 4252|       |
 4253|   650k|            res_l_8x16b = _mm_srai_epi16(res_l_8x16b, 6);
 4254|   650k|            res_h_8x16b = _mm_srai_epi16(res_h_8x16b, 6);
 4255|       |
 4256|   650k|            res_16x8b = _mm_packus_epi16(res_l_8x16b, res_h_8x16b);
 4257|       |
 4258|   650k|            _mm_storeu_si128((__m128i *)pu1_dst, res_16x8b);
 4259|       |
 4260|   650k|            ht -= 4;
 4261|   650k|            pu1_src += src_strd;
 4262|   650k|            pu1_dst += dst_strd;
 4263|   650k|        }
 4264|   650k|        while(ht > 0);
  ------------------
  |  Branch (4264:15): [True: 321k, False: 329k]
  ------------------
 4265|   329k|    }
 4266|   362k|}

ih264_iquant_itrans_recon_4x4_dc_ssse3:
  112|  7.95k|{
  113|  7.95k|    UWORD32 *pu4_out = (UWORD32 *)pu1_out;
  114|  7.95k|    WORD32 q0 = pi2_src[0];
  115|  7.95k|    WORD16 i_macro, rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
  ------------------
  |  Branch (115:32): [True: 2.21k, False: 5.73k]
  ------------------
  116|       |
  117|  7.95k|    __m128i predload_r,pred_r0, pred_r1, pred_r2, pred_r3;
  118|  7.95k|    __m128i sign_reg;
  119|  7.95k|    __m128i zero_8x16b = _mm_setzero_si128();          // all bits reset to zero
  120|  7.95k|    __m128i temp4, temp5, temp6, temp7;
  121|  7.95k|    __m128i value_add;
  122|       |
  123|  7.95k|    UNUSED (pi2_tmp);
  ------------------
  |  |   45|  7.95k|#define UNUSED(x) ((void)(x))
  ------------------
  124|       |
  125|  7.95k|    INV_QUANT(q0, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  7.95k|                {\
  |  |  104|  7.95k|                    i4_value *= quant_scale;\
  |  |  105|  7.95k|                    i4_value *= weight_scale;\
  |  |  106|  7.95k|                    i4_value += rndfactor;\
  |  |  107|  7.95k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  7.95k|                    i4_value >>= qbits;\
  |  |  109|  7.95k|                }
  ------------------
  126|       |
  127|  7.95k|    if (iq_start_idx != 0 )
  ------------------
  |  Branch (127:9): [True: 5.12k, False: 2.83k]
  ------------------
  128|  5.12k|        q0 = pi2_dc_ld_addr[0];     // Restoring dc value for intra case
  129|       |
  130|  7.95k|    i_macro = ((q0 + 32) >> 6);
  131|       |
  132|  7.95k|    value_add = _mm_set1_epi16(i_macro);
  133|       |
  134|  7.95k|    zero_8x16b = _mm_setzero_si128();                  // all bits reset to zero
  135|       |    //Load pred buffer
  136|  7.95k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[0])); //p00 p01 p02 p03 0 0 0 0 0 0 0 0 -- all 8 bits
  137|  7.95k|    pred_r0 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p00 p01 p02 p03 0 0 0 0 -- all 16 bits
  138|  7.95k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[pred_strd])); //p10 p11 p12 p13 0 0 0 0 0 0 0 0 -- all 8 bits
  139|  7.95k|    pred_r1 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p10 p11 p12 p13 0 0 0 0 -- all 16 bits
  140|  7.95k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[2*pred_strd])); //p20 p21 p22 p23 0 0 0 0 0 0 0 0 -- all 8 bits
  141|  7.95k|    pred_r2 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p20 p21 p22 p23 0 0 0 0 -- all 16 bits
  142|  7.95k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[3*pred_strd])); //p30 p31 p32 p33 0 0 0 0 0 0 0 0 -- all 8 bits
  143|  7.95k|    pred_r3 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p30 p31 p32 p33 0 0 0 0 -- all 16 bits
  144|       |
  145|  7.95k|    pred_r0 = _mm_unpacklo_epi64(pred_r0, pred_r1); //p00 p01 p02 p03 p10 p11 p12 p13
  146|  7.95k|    pred_r2 = _mm_unpacklo_epi64(pred_r2, pred_r3); //p20 p21 p22p p23 p30 p31 p32 p33
  147|       |
  148|  7.95k|    temp4 = _mm_add_epi16(value_add, pred_r0);
  149|  7.95k|    temp5 = _mm_add_epi16(value_add, pred_r2);
  150|       |    /*------------------------------------------------------------------*/
  151|       |    //Clipping the results to 8 bits
  152|  7.95k|    sign_reg = _mm_cmpgt_epi16(temp4, zero_8x16b);                 // sign check
  153|  7.95k|    temp4 = _mm_and_si128(temp4, sign_reg);
  154|  7.95k|    sign_reg = _mm_cmpgt_epi16(temp5, zero_8x16b);                 // sign check
  155|  7.95k|    temp5 = _mm_and_si128(temp5, sign_reg);
  156|       |
  157|  7.95k|    temp4 = _mm_packus_epi16(temp4,temp5);
  158|  7.95k|    temp5 = _mm_srli_si128(temp4,4);
  159|  7.95k|    temp6 = _mm_srli_si128(temp5,4);
  160|  7.95k|    temp7 = _mm_srli_si128(temp6,4);
  161|       |
  162|  7.95k|    *pu4_out = _mm_cvtsi128_si32(temp4);
  163|  7.95k|    pu1_out += out_strd;
  164|  7.95k|    pu4_out = (UWORD32 *)(pu1_out);
  165|  7.95k|    *(pu4_out) = _mm_cvtsi128_si32(temp5);
  166|  7.95k|    pu1_out += out_strd;
  167|  7.95k|    pu4_out = (UWORD32 *)(pu1_out);
  168|  7.95k|    *(pu4_out) = _mm_cvtsi128_si32(temp6);
  169|  7.95k|    pu1_out += out_strd;
  170|  7.95k|    pu4_out = (UWORD32 *)(pu1_out);
  171|  7.95k|    *(pu4_out) = _mm_cvtsi128_si32(temp7);
  172|  7.95k|}
ih264_iquant_itrans_recon_8x8_dc_ssse3:
  238|     57|{
  239|     57|    WORD32 q0 = pi2_src[0];
  240|     57|    WORD16 i_macro, rnd_fact = (qp_div < 6) ? 1 << (5 - qp_div) : 0;
  ------------------
  |  Branch (240:32): [True: 57, False: 0]
  ------------------
  241|       |
  242|     57|    __m128i predload_r,pred_r0, pred_r1, pred_r2, pred_r3,pred_r4,pred_r5,pred_r6,pred_r7;
  243|     57|    __m128i sign_reg;
  244|     57|    __m128i zero_8x16b = _mm_setzero_si128();          // all bits reset to zero
  245|     57|    __m128i temp1,temp2,temp3,temp4, temp5, temp6, temp7,temp8;
  246|     57|    __m128i value_add;
  247|       |
  248|     57|    UNUSED (pi2_tmp);
  ------------------
  |  |   45|     57|#define UNUSED(x) ((void)(x))
  ------------------
  249|     57|    UNUSED (iq_start_idx);
  ------------------
  |  |   45|     57|#define UNUSED(x) ((void)(x))
  ------------------
  250|     57|    UNUSED (pi2_dc_ld_addr);
  ------------------
  |  |   45|     57|#define UNUSED(x) ((void)(x))
  ------------------
  251|       |
  252|     57|    INV_QUANT(q0, pu2_iscale_mat[0], pu2_weigh_mat[0], qp_div, rnd_fact, 6);
  ------------------
  |  |  103|     57|                {\
  |  |  104|     57|                    i4_value *= quant_scale;\
  |  |  105|     57|                    i4_value *= weight_scale;\
  |  |  106|     57|                    i4_value += rndfactor;\
  |  |  107|     57|                    i4_value <<= u4_qp_div_6;\
  |  |  108|     57|                    i4_value >>= qbits;\
  |  |  109|     57|                }
  ------------------
  253|     57|    i_macro = ((q0 + 32) >> 6);
  254|       |
  255|     57|    value_add = _mm_set1_epi16(i_macro);
  256|       |
  257|       |    //Load pred buffer row 0
  258|     57|    predload_r = _mm_loadl_epi64((__m128i *)(&pu1_pred[0])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  259|     57|    pred_r0 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  260|       |    //Load pred buffer row 1
  261|     57|    predload_r = _mm_loadl_epi64((__m128i *)(&pu1_pred[pred_strd])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  262|     57|    pred_r1 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  263|       |    //Load pred buffer row 2
  264|     57|    predload_r = _mm_loadl_epi64(
  265|     57|                    (__m128i *)(&pu1_pred[2 * pred_strd])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  266|     57|    pred_r2 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  267|       |    //Load pred buffer row 3
  268|     57|    predload_r = _mm_loadl_epi64(
  269|     57|                    (__m128i *)(&pu1_pred[3 * pred_strd])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  270|     57|    pred_r3 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  271|       |    //Load pred buffer row 4
  272|     57|    predload_r = _mm_loadl_epi64(
  273|     57|                    (__m128i *)(&pu1_pred[4 * pred_strd])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  274|     57|    pred_r4 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  275|       |    //Load pred buffer row 5
  276|     57|    predload_r = _mm_loadl_epi64(
  277|     57|                    (__m128i *)(&pu1_pred[5 * pred_strd])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bit
  278|     57|    pred_r5 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  279|       |    //Load pred buffer row 6
  280|     57|    predload_r = _mm_loadl_epi64(
  281|     57|                    (__m128i *)(&pu1_pred[6 * pred_strd])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  282|     57|    pred_r6 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  283|       |    //Load pred buffer row 7
  284|     57|    predload_r = _mm_loadl_epi64(
  285|     57|                    (__m128i *)(&pu1_pred[7 * pred_strd])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  286|     57|    pred_r7 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  287|       |
  288|     57|    temp1 = _mm_add_epi16(value_add, pred_r0);
  289|       |
  290|     57|    temp2 = _mm_add_epi16(value_add, pred_r1);
  291|       |
  292|     57|    temp3 = _mm_add_epi16(value_add, pred_r2);
  293|       |
  294|     57|    temp4 = _mm_add_epi16(value_add, pred_r3);
  295|       |
  296|     57|    temp5 = _mm_add_epi16(value_add, pred_r4);
  297|       |
  298|     57|    temp6 = _mm_add_epi16(value_add, pred_r5);
  299|       |
  300|     57|    temp7 = _mm_add_epi16(value_add, pred_r6);
  301|       |
  302|     57|    temp8 = _mm_add_epi16(value_add, pred_r7);
  303|       |    /*------------------------------------------------------------------*/
  304|       |    //Clipping the results to 8 bits
  305|     57|    sign_reg = _mm_cmpgt_epi16(temp1, zero_8x16b); // sign check
  306|     57|    temp1 = _mm_and_si128(temp1, sign_reg);
  307|     57|    sign_reg = _mm_cmpgt_epi16(temp2, zero_8x16b); // sign check
  308|     57|    temp2 = _mm_and_si128(temp2, sign_reg);
  309|     57|    sign_reg = _mm_cmpgt_epi16(temp3, zero_8x16b); // sign check
  310|     57|    temp3 = _mm_and_si128(temp3, sign_reg);
  311|     57|    sign_reg = _mm_cmpgt_epi16(temp4, zero_8x16b); // sign check
  312|     57|    temp4 = _mm_and_si128(temp4, sign_reg);
  313|     57|    sign_reg = _mm_cmpgt_epi16(temp5, zero_8x16b); // sign check
  314|     57|    temp5 = _mm_and_si128(temp5, sign_reg);
  315|     57|    sign_reg = _mm_cmpgt_epi16(temp6, zero_8x16b); // sign check
  316|     57|    temp6 = _mm_and_si128(temp6, sign_reg);
  317|     57|    sign_reg = _mm_cmpgt_epi16(temp7, zero_8x16b); // sign check
  318|     57|    temp7 = _mm_and_si128(temp7, sign_reg);
  319|     57|    sign_reg = _mm_cmpgt_epi16(temp8, zero_8x16b); // sign check
  320|     57|    temp8 = _mm_and_si128(temp8, sign_reg);
  321|       |
  322|     57|    temp1 = _mm_packus_epi16(temp1, zero_8x16b);
  323|     57|    temp2 = _mm_packus_epi16(temp2, zero_8x16b);
  324|     57|    temp3 = _mm_packus_epi16(temp3, zero_8x16b);
  325|     57|    temp4 = _mm_packus_epi16(temp4, zero_8x16b);
  326|     57|    temp5 = _mm_packus_epi16(temp5, zero_8x16b);
  327|     57|    temp6 = _mm_packus_epi16(temp6, zero_8x16b);
  328|     57|    temp7 = _mm_packus_epi16(temp7, zero_8x16b);
  329|     57|    temp8 = _mm_packus_epi16(temp8, zero_8x16b);
  330|       |
  331|     57|    _mm_storel_epi64((__m128i *)(&pu1_out[0]), temp1);
  332|     57|    _mm_storel_epi64((__m128i *)(&pu1_out[out_strd]), temp2);
  333|     57|    _mm_storel_epi64((__m128i *)(&pu1_out[2 * out_strd]), temp3);
  334|     57|    _mm_storel_epi64((__m128i *)(&pu1_out[3 * out_strd]), temp4);
  335|     57|    _mm_storel_epi64((__m128i *)(&pu1_out[4 * out_strd]), temp5);
  336|     57|    _mm_storel_epi64((__m128i *)(&pu1_out[5 * out_strd]), temp6);
  337|     57|    _mm_storel_epi64((__m128i *)(&pu1_out[6 * out_strd]), temp7);
  338|     57|    _mm_storel_epi64((__m128i *)(&pu1_out[7 * out_strd]), temp8);
  339|     57|}
ih264_iquant_itrans_recon_chroma_4x4_dc_ssse3:
  398|  11.6k| {
  399|  11.6k|    WORD16 q0 = pi2_dc_src[0];      // DC value won't be dequantized for chroma inverse transform
  400|  11.6k|    WORD16 i_macro = ((q0 + 32) >> 6);
  401|       |
  402|  11.6k|    __m128i pred_r0, pred_r1, pred_r2, pred_r3, sign_reg;
  403|  11.6k|    __m128i zero_8x16b = _mm_setzero_si128();          // all bits reset to zero
  404|  11.6k|    __m128i chroma_mask = _mm_set1_epi16 (0xFF);
  405|  11.6k|    __m128i value_add = _mm_set1_epi16(i_macro);
  406|  11.6k|    __m128i out_r0, out_r1, out_r2, out_r3;
  407|       |
  408|  11.6k|    UNUSED (pi2_src);
  ------------------
  |  |   45|  11.6k|#define UNUSED(x) ((void)(x))
  ------------------
  409|  11.6k|    UNUSED (pu2_iscal_mat);
  ------------------
  |  |   45|  11.6k|#define UNUSED(x) ((void)(x))
  ------------------
  410|  11.6k|    UNUSED (pu2_weigh_mat);
  ------------------
  |  |   45|  11.6k|#define UNUSED(x) ((void)(x))
  ------------------
  411|  11.6k|    UNUSED (u4_qp_div_6);
  ------------------
  |  |   45|  11.6k|#define UNUSED(x) ((void)(x))
  ------------------
  412|  11.6k|    UNUSED (pi2_tmp);
  ------------------
  |  |   45|  11.6k|#define UNUSED(x) ((void)(x))
  ------------------
  413|       |
  414|       |    //Load pred buffer
  415|  11.6k|    pred_r0 = _mm_loadl_epi64((__m128i *) (&pu1_pred[0])); //p00 p01 p02 p03 0 0 0 0 0 0 0 0 -- all 8 bits
  416|  11.6k|    pred_r1 = _mm_loadl_epi64((__m128i *) (&pu1_pred[pred_strd])); //p10 p11 p12 p13 0 0 0 0 0 0 0 0 -- all 8 bits
  417|  11.6k|    pred_r2 = _mm_loadl_epi64((__m128i *) (&pu1_pred[2 * pred_strd])); //p20 p21 p22 p23 0 0 0 0 0 0 0 0 -- all 8 bits
  418|  11.6k|    pred_r3 = _mm_loadl_epi64((__m128i *) (&pu1_pred[3 * pred_strd])); //p30 p31 p32 p33 0 0 0 0 0 0 0 0 -- all 8 bits
  419|       |
  420|  11.6k|    pred_r0 = _mm_and_si128(pred_r0, chroma_mask);
  421|  11.6k|    pred_r1 = _mm_and_si128(pred_r1, chroma_mask);
  422|  11.6k|    pred_r2 = _mm_and_si128(pred_r2, chroma_mask);
  423|  11.6k|    pred_r3 = _mm_and_si128(pred_r3, chroma_mask);
  424|       |
  425|  11.6k|    pred_r0 = _mm_unpacklo_epi64(pred_r0, pred_r1); //p00 p01 p02 p03 p10 p11 p12 p13
  426|  11.6k|    pred_r2 = _mm_unpacklo_epi64(pred_r2, pred_r3); //p20 p21 p22p p23 p30 p31 p32 p33
  427|       |
  428|  11.6k|    pred_r0 = _mm_add_epi16(value_add, pred_r0);
  429|  11.6k|    pred_r2 = _mm_add_epi16(value_add, pred_r2);
  430|       |
  431|       |    /*------------------------------------------------------------------*/
  432|       |    //Clipping the results to 8 bits
  433|  11.6k|    sign_reg = _mm_cmpgt_epi16(pred_r0, zero_8x16b);        // sign check
  434|  11.6k|    pred_r0 = _mm_and_si128(pred_r0, sign_reg);
  435|  11.6k|    sign_reg = _mm_cmpgt_epi16(pred_r2, zero_8x16b);
  436|  11.6k|    pred_r2 = _mm_and_si128(pred_r2, sign_reg);
  437|       |
  438|  11.6k|    pred_r0 = _mm_packus_epi16(pred_r0, pred_r2);
  439|  11.6k|    pred_r1 = _mm_srli_si128(pred_r0, 4);
  440|  11.6k|    pred_r2 = _mm_srli_si128(pred_r1, 4);
  441|  11.6k|    pred_r3 = _mm_srli_si128(pred_r2, 4);
  442|       |
  443|  11.6k|    pred_r0 = _mm_unpacklo_epi8(pred_r0, zero_8x16b); //p00 p01 p02 p03 -- all 16 bits
  444|  11.6k|    pred_r1 = _mm_unpacklo_epi8(pred_r1, zero_8x16b); //p10 p11 p12 p13 -- all 16 bits
  445|  11.6k|    pred_r2 = _mm_unpacklo_epi8(pred_r2, zero_8x16b); //p20 p21 p22 p23 -- all 16 bits
  446|  11.6k|    pred_r3 = _mm_unpacklo_epi8(pred_r3, zero_8x16b); //p30 p31 p32 p33 -- all 16 bits
  447|       |
  448|  11.6k|    chroma_mask = _mm_set1_epi16 (0xFF00);
  449|  11.6k|    out_r0 = _mm_loadl_epi64((__m128i *) (&pu1_out[0]));
  450|  11.6k|    out_r1 = _mm_loadl_epi64((__m128i *) (&pu1_out[out_strd]));
  451|  11.6k|    out_r2 = _mm_loadl_epi64((__m128i *) (&pu1_out[2 * out_strd]));
  452|  11.6k|    out_r3 = _mm_loadl_epi64((__m128i *) (&pu1_out[3 * out_strd]));
  453|       |
  454|  11.6k|    out_r0 = _mm_and_si128(out_r0, chroma_mask);
  455|  11.6k|    out_r1 = _mm_and_si128(out_r1, chroma_mask);
  456|  11.6k|    out_r2 = _mm_and_si128(out_r2, chroma_mask);
  457|  11.6k|    out_r3 = _mm_and_si128(out_r3, chroma_mask);
  458|       |
  459|  11.6k|    out_r0 = _mm_add_epi8(out_r0, pred_r0);
  460|  11.6k|    out_r1 = _mm_add_epi8(out_r1, pred_r1);
  461|  11.6k|    out_r2 = _mm_add_epi8(out_r2, pred_r2);
  462|  11.6k|    out_r3 = _mm_add_epi8(out_r3, pred_r3);
  463|       |
  464|  11.6k|    _mm_storel_epi64((__m128i *)(&pu1_out[0]), out_r0);
  465|  11.6k|    _mm_storel_epi64((__m128i *)(&pu1_out[out_strd]), out_r1);
  466|  11.6k|    _mm_storel_epi64((__m128i *)(&pu1_out[2 * out_strd]), out_r2);
  467|  11.6k|    _mm_storel_epi64((__m128i *)(&pu1_out[3 * out_strd]), out_r3);
  468|  11.6k|}

ih264_iquant_itrans_recon_4x4_sse42:
  111|  13.6k| {
  112|  13.6k|    UWORD32 *pu4_out = (UWORD32 *) pu1_out;
  113|  13.6k|    __m128i src_r0_r1, src_r2_r3;
  114|  13.6k|    __m128i src_r0, src_r1, src_r2, src_r3;
  115|  13.6k|    __m128i scalemat_r0_r1, scalemat_r2_r3;
  116|  13.6k|    __m128i pred_r0, pred_r1, pred_r2, pred_r3;
  117|  13.6k|    __m128i sign_reg, dequant_r0_r1, dequant_r2_r3;
  118|  13.6k|    __m128i zero_8x16b = _mm_setzero_si128();          // all bits reset to zero
  119|  13.6k|    __m128i temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
  120|  13.6k|    __m128i resq_r0, resq_r1, resq_r2, resq_r3;
  121|  13.6k|    __m128i add_rshift = _mm_set1_epi32((u4_qp_div_6 < 4) ? (1 << (3 - u4_qp_div_6)) : 0);
  ------------------
  |  Branch (121:41): [True: 1.80k, False: 11.8k]
  ------------------
  122|  13.6k|    __m128i value_32 = _mm_set1_epi32(32);
  123|  13.6k|    UNUSED (pi2_tmp);
  ------------------
  |  |   45|  13.6k|#define UNUSED(x) ((void)(x))
  ------------------
  124|       |
  125|       |    /*************************************************************/
  126|       |    /* Dequantization of coefficients. Will be replaced by SIMD  */
  127|       |    /* operations on platform                                    */
  128|       |    /*************************************************************/
  129|  13.6k|    src_r0_r1 = _mm_loadu_si128((__m128i *) (pi2_src)); //a00 a01 a02 a03 a10 a11 a12 a13 -- the source matrix 0th,1st row
  130|  13.6k|    src_r2_r3 = _mm_loadu_si128((__m128i *) (pi2_src + 8)); //a20 a21 a22 a23 a30 a31 a32 a33 -- the source matrix 2nd,3rd row
  131|  13.6k|    scalemat_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat)); //b00 b01 b02 b03 b10 b11 b12 b13 -- the scaling matrix 0th,1st row
  132|  13.6k|    scalemat_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat + 8)); //b20 b21 b22 b23 b30 b31 b32 b33 -- the scaling matrix 2nd,3rd row
  133|  13.6k|    dequant_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat)); //q00 q01 q02 q03 q10 q11 q12 q13 -- all 16 bits
  134|  13.6k|    dequant_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat + 8)); //q20 q21 q22 q23 q30 q31 q32 q33 -- all 16 bits
  135|       |
  136|  13.6k|    temp0 = _mm_mullo_epi16(scalemat_r0_r1, dequant_r0_r1); //b00*q00 b01*q01 b02*q02 b03*q03 b10*q10 b11*q11 b12*q12 b13*q13 -- 16 bit result
  137|  13.6k|    temp1 = _mm_mullo_epi16(scalemat_r2_r3, dequant_r2_r3); //b00*q00 b01*q01 b02*q02 b03*q03 b10*q10 b11*q11 b12*q12 b13*q13 -- 16 bit result
  138|       |
  139|  13.6k|    temp4 = _mm_unpacklo_epi16(temp0, zero_8x16b); // b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long
  140|  13.6k|    temp5 = _mm_unpackhi_epi16(temp0, zero_8x16b); // b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long
  141|  13.6k|    temp6 = _mm_unpacklo_epi16(temp1, zero_8x16b); // b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long
  142|  13.6k|    temp7 = _mm_unpackhi_epi16(temp1, zero_8x16b); // b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long
  143|       |
  144|  13.6k|    src_r0 = _mm_unpacklo_epi16(src_r0_r1, zero_8x16b); // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  145|  13.6k|    src_r1 = _mm_unpackhi_epi16(src_r0_r1, zero_8x16b); // a10 0 a11 0 a12 0 a13 0 -- 16 bit long
  146|  13.6k|    src_r2 = _mm_unpacklo_epi16(src_r2_r3, zero_8x16b); // a20 0 a21 0 a22 0 a23 0 -- 16 bit long
  147|  13.6k|    src_r3 = _mm_unpackhi_epi16(src_r2_r3, zero_8x16b); // a30 0 a31 0 a32 0 a33 0 -- 16 bit long
  148|       |
  149|  13.6k|    temp4 = _mm_madd_epi16(src_r0, temp4); //a00*b00*q00 a10*b10*q10 a20*b20*q20 a30*b30 q30 -- 32 bits long
  150|  13.6k|    temp5 = _mm_madd_epi16(src_r1, temp5);
  151|  13.6k|    temp6 = _mm_madd_epi16(src_r2, temp6);
  152|  13.6k|    temp7 = _mm_madd_epi16(src_r3, temp7);
  153|       |
  154|  13.6k|    if (u4_qp_div_6 >= 4) {
  ------------------
  |  Branch (154:9): [True: 11.8k, False: 1.80k]
  ------------------
  155|  11.8k|        resq_r0 = _mm_slli_epi32(temp4, u4_qp_div_6 - 4);
  156|  11.8k|        resq_r1 = _mm_slli_epi32(temp5, u4_qp_div_6 - 4);
  157|  11.8k|        resq_r2 = _mm_slli_epi32(temp6, u4_qp_div_6 - 4);
  158|  11.8k|        resq_r3 = _mm_slli_epi32(temp7, u4_qp_div_6 - 4);
  159|  11.8k|    } else {
  160|  1.80k|        temp4 = _mm_add_epi32(temp4, add_rshift);
  161|  1.80k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  162|  1.80k|        temp6 = _mm_add_epi32(temp6, add_rshift);
  163|  1.80k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  164|  1.80k|        resq_r0 = _mm_srai_epi32(temp4, 4 - u4_qp_div_6);
  165|  1.80k|        resq_r1 = _mm_srai_epi32(temp5, 4 - u4_qp_div_6);
  166|  1.80k|        resq_r2 = _mm_srai_epi32(temp6, 4 - u4_qp_div_6);
  167|  1.80k|        resq_r3 = _mm_srai_epi32(temp7, 4 - u4_qp_div_6);
  168|  1.80k|    }
  169|       |
  170|  13.6k|    if (iq_start_idx == 1)
  ------------------
  |  Branch (170:9): [True: 1.04k, False: 12.6k]
  ------------------
  171|  1.04k|        resq_r0 = _mm_insert_epi32(resq_r0,(WORD32)pi2_dc_ld_addr[0],0);
  172|       |    /* Perform Inverse transform */
  173|       |    /*-------------------------------------------------------------*/
  174|       |    /* IDCT [ Horizontal transformation ]                          */
  175|       |    /*-------------------------------------------------------------*/
  176|       |    // Matrix transpose
  177|       |    /*
  178|       |     *  a0 a1 a2 a3
  179|       |     *  b0 b1 b2 b3
  180|       |     *  c0 c1 c2 c3
  181|       |     *  d0 d1 d2 d3
  182|       |     */
  183|  13.6k|    temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);                  //a0 b0 a1 b1
  184|  13.6k|    temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);                  //c0 d0 c1 d1
  185|  13.6k|    temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);                  //a2 b2 a3 b3
  186|  13.6k|    temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);                  //c2 d2 c3 d3
  187|  13.6k|    resq_r0 = _mm_unpacklo_epi64(temp1, temp3);                    //a0 b0 c0 d0
  188|  13.6k|    resq_r1 = _mm_unpackhi_epi64(temp1, temp3);                    //a1 b1 c1 d1
  189|  13.6k|    resq_r2 = _mm_unpacklo_epi64(temp2, temp4);                    //a2 b2 c2 d2
  190|  13.6k|    resq_r3 = _mm_unpackhi_epi64(temp2, temp4);                    //a3 b3 c3 d3
  191|       |    //Transform starts -- horizontal transform
  192|       |    /*------------------------------------------------------------------*/
  193|       |    /* z0 = w0 + w2                                             */
  194|  13.6k|    temp0 = _mm_add_epi32(resq_r0, resq_r2);
  195|       |    /* z1 = w0 - w2                                             */
  196|  13.6k|    temp1 = _mm_sub_epi32(resq_r0, resq_r2);
  197|       |    /* z2 = (w1 >> 1) - w3                                      */
  198|  13.6k|    temp2 = _mm_srai_epi32(resq_r1, 1);                         //(w1>>1)
  199|  13.6k|    temp2 = _mm_sub_epi32(temp2, resq_r3);                      //(w1>>1) - w3
  200|       |    /* z3 = w1 + (w3 >> 1)                                      */
  201|  13.6k|    temp3 = _mm_srai_epi32(resq_r3, 1);                         //(w3>>1) + w1
  202|  13.6k|    temp3 = _mm_add_epi32(temp3, resq_r1);
  203|       |    /*----------------------------------------------------------*/
  204|       |    /* x0 = z0 + z3                                             */
  205|  13.6k|    resq_r0 = _mm_add_epi32(temp0, temp3);
  206|       |    /* x1 = z1 + z2                                             */
  207|  13.6k|    resq_r1 = _mm_add_epi32(temp1, temp2);
  208|       |    /* x2 = z1 - z2                                             */
  209|  13.6k|    resq_r2 = _mm_sub_epi32(temp1, temp2);
  210|       |    /* x3 = z0 - z3                                             */
  211|  13.6k|    resq_r3 = _mm_sub_epi32(temp0, temp3);
  212|       |    // Matrix transpose
  213|       |    /*
  214|       |     *  a0 b0 c0 d0
  215|       |     *  a1 b1 c1 d1
  216|       |     *  a2 b2 c2 d2
  217|       |     *  a3 b3 c3 d3
  218|       |     */
  219|  13.6k|    temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);                  //a0 a1 b0 b1
  220|  13.6k|    temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);                  //a2 a3 b2 b3
  221|  13.6k|    temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);                  //c0 c1 d0 d1
  222|  13.6k|    temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);                  //c2 c3 d2 d3
  223|  13.6k|    resq_r0 = _mm_unpacklo_epi64(temp1, temp3);                    //a0 a1 a2 a3
  224|  13.6k|    resq_r1 = _mm_unpackhi_epi64(temp1, temp3);                    //b0 b1 b2 b3
  225|  13.6k|    resq_r2 = _mm_unpacklo_epi64(temp2, temp4);                    //c0 c1 c2 c3
  226|  13.6k|    resq_r3 = _mm_unpackhi_epi64(temp2, temp4);                    //d0 d1 d2 d3
  227|       |    //Transform ends -- horizontal transform
  228|       |
  229|       |    //Load pred buffer
  230|  13.6k|    pred_r0 = loadu_32(&pu1_pred[0]); //p00 p01 p02 p03 -- all 8 bits
  231|  13.6k|    pred_r1 = loadu_32(&pu1_pred[pred_strd]); //p10 p11 p12 p13 -- all 8 bits
  232|  13.6k|    pred_r2 = loadu_32(&pu1_pred[2 * pred_strd]); //p20 p21 p22 p23 -- all 8 bits
  233|  13.6k|    pred_r3 = loadu_32(&pu1_pred[3 * pred_strd]); //p30 p31 p32 p33 -- all 8 bits
  234|       |
  235|  13.6k|    pred_r0 = _mm_cvtepu8_epi32(pred_r0); //p00 p01 p02 p03 -- all 32 bits
  236|  13.6k|    pred_r1 = _mm_cvtepu8_epi32(pred_r1); //p10 p11 p12 p13 -- all 32 bits
  237|  13.6k|    pred_r2 = _mm_cvtepu8_epi32(pred_r2); //p20 p21 p22 p23 -- all 32 bits
  238|  13.6k|    pred_r3 = _mm_cvtepu8_epi32(pred_r3); //p30 p31 p32 p33 -- all 32 bits
  239|       |
  240|       |    /*--------------------------------------------------------------*/
  241|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6      */
  242|       |    /*                                                              */
  243|       |    /* Add the prediction and store it back to same buffer          */
  244|       |    /*--------------------------------------------------------------*/
  245|       |    /* z0j = y0j + y2j                                                        */
  246|  13.6k|    temp0 = _mm_add_epi32(resq_r0, resq_r2);
  247|       |    /* z1j = y0j - y2j                                                        */
  248|  13.6k|    temp1 = _mm_sub_epi32(resq_r0, resq_r2);
  249|       |    /* z2j = (y1j>>1) - y3j                                                        */
  250|  13.6k|    temp2 = _mm_srai_epi32(resq_r1, 1);                             //(y1j>>1)
  251|  13.6k|    temp2 = _mm_sub_epi32(temp2, resq_r3);
  252|       |    /* z3j = y1j + (y3j>>1)                                                        */
  253|  13.6k|    temp3 = _mm_srai_epi32(resq_r3, 1);                             //(y3j>>1)
  254|  13.6k|    temp3 = _mm_add_epi32(temp3, resq_r1);
  255|       |
  256|       |    /* x0j = z0j + z3j                                                        */
  257|  13.6k|    temp4 = _mm_add_epi32(temp0, temp3);
  258|  13.6k|    temp4 = _mm_add_epi32(temp4, value_32);
  259|  13.6k|    temp4 = _mm_srai_epi32(temp4, 6);
  260|  13.6k|    temp4 = _mm_add_epi32(temp4, pred_r0);
  261|       |    /* x1j = z1j + z2j                                                        */
  262|  13.6k|    temp5 = _mm_add_epi32(temp1, temp2);
  263|  13.6k|    temp5 = _mm_add_epi32(temp5, value_32);
  264|  13.6k|    temp5 = _mm_srai_epi32(temp5, 6);
  265|  13.6k|    temp5 = _mm_add_epi32(temp5, pred_r1);
  266|       |    /* x2j = z1j - z2j                                                        */
  267|  13.6k|    temp6 = _mm_sub_epi32(temp1, temp2);
  268|  13.6k|    temp6 = _mm_add_epi32(temp6, value_32);
  269|  13.6k|    temp6 = _mm_srai_epi32(temp6, 6);
  270|  13.6k|    temp6 = _mm_add_epi32(temp6, pred_r2);
  271|       |    /* x3j = z0j - z3j                                                        */
  272|  13.6k|    temp7 = _mm_sub_epi32(temp0, temp3);
  273|  13.6k|    temp7 = _mm_add_epi32(temp7, value_32);
  274|  13.6k|    temp7 = _mm_srai_epi32(temp7, 6);
  275|  13.6k|    temp7 = _mm_add_epi32(temp7, pred_r3);
  276|       |
  277|       |    // 32-bit to 16-bit conversion
  278|  13.6k|    temp0 = _mm_packs_epi32(temp4, temp5);
  279|  13.6k|    temp1 = _mm_packs_epi32(temp6, temp7);
  280|       |    /*------------------------------------------------------------------*/
  281|       |    //Clipping the results to 8 bits
  282|  13.6k|    sign_reg = _mm_cmpgt_epi16(temp0, zero_8x16b);      // sign check
  283|  13.6k|    temp0 = _mm_and_si128(temp0, sign_reg);
  284|  13.6k|    sign_reg = _mm_cmpgt_epi16(temp1, zero_8x16b);
  285|  13.6k|    temp1 = _mm_and_si128(temp1, sign_reg);
  286|       |
  287|  13.6k|    resq_r0 = _mm_packus_epi16(temp0, temp1);
  288|  13.6k|    resq_r1 = _mm_srli_si128(resq_r0, 4);
  289|  13.6k|    resq_r2 = _mm_srli_si128(resq_r1, 4);
  290|  13.6k|    resq_r3 = _mm_srli_si128(resq_r2, 4);
  291|       |
  292|  13.6k|    *pu4_out = _mm_cvtsi128_si32(resq_r0);
  293|  13.6k|    pu1_out += out_strd;
  294|  13.6k|    pu4_out = (UWORD32 *) (pu1_out);
  295|  13.6k|    *(pu4_out) = _mm_cvtsi128_si32(resq_r1);
  296|  13.6k|    pu1_out += out_strd;
  297|  13.6k|    pu4_out = (UWORD32 *) (pu1_out);
  298|  13.6k|    *(pu4_out) = _mm_cvtsi128_si32(resq_r2);
  299|  13.6k|    pu1_out += out_strd;
  300|  13.6k|    pu4_out = (UWORD32 *) (pu1_out);
  301|  13.6k|    *(pu4_out) = _mm_cvtsi128_si32(resq_r3);
  302|  13.6k|}
ih264_iquant_itrans_recon_chroma_4x4_sse42:
  361|  2.99k| {
  362|  2.99k|    __m128i src_r0_r1, src_r2_r3;
  363|  2.99k|    __m128i src_r0, src_r1, src_r2, src_r3;
  364|  2.99k|    __m128i scalemat_r0_r1, scalemat_r2_r3;
  365|  2.99k|    __m128i pred_r0, pred_r1, pred_r2, pred_r3;
  366|  2.99k|    __m128i sign_reg, dequant_r0_r1, dequant_r2_r3;
  367|  2.99k|    __m128i zero_8x16b = _mm_setzero_si128();          // all bits reset to zero
  368|  2.99k|    __m128i temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
  369|  2.99k|    __m128i resq_r0, resq_r1, resq_r2, resq_r3;
  370|  2.99k|    __m128i add_rshift = _mm_set1_epi32((u4_qp_div_6 < 4) ? (1 << (3 - u4_qp_div_6)) : 0);
  ------------------
  |  Branch (370:41): [True: 368, False: 2.62k]
  ------------------
  371|  2.99k|    __m128i value_32 = _mm_set1_epi32(32);
  372|  2.99k|    __m128i chroma_mask = _mm_set1_epi16 (0xFF);
  373|  2.99k|    __m128i out_r0, out_r1, out_r2, out_r3;
  374|  2.99k|    UNUSED (pi2_tmp);
  ------------------
  |  |   45|  2.99k|#define UNUSED(x) ((void)(x))
  ------------------
  375|       |
  376|       |    /*************************************************************/
  377|       |    /* Dequantization of coefficients. Will be replaced by SIMD  */
  378|       |    /* operations on platform                                    */
  379|       |    /*************************************************************/
  380|  2.99k|    src_r0_r1 = _mm_loadu_si128((__m128i *) (pi2_src)); //a00 a01 a02 a03 a10 a11 a12 a13 -- the source matrix 0th,1st row
  381|  2.99k|    src_r2_r3 = _mm_loadu_si128((__m128i *) (pi2_src + 8)); //a20 a21 a22 a23 a30 a31 a32 a33 -- the source matrix 2nd,3rd row
  382|  2.99k|    scalemat_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat)); //b00 b01 b02 b03 b10 b11 b12 b13 -- the scaling matrix 0th,1st row
  383|  2.99k|    scalemat_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat + 8)); //b20 b21 b22 b23 b30 b31 b32 b33 -- the scaling matrix 2nd,3rd row
  384|  2.99k|    dequant_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat)); //q00 q01 q02 q03 q10 q11 q12 q13 -- all 16 bits
  385|  2.99k|    dequant_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat + 8)); //q20 q21 q22 q23 q30 q31 q32 q33 -- all 16 bits
  386|       |
  387|  2.99k|    temp0 = _mm_mullo_epi16(scalemat_r0_r1, dequant_r0_r1); //b00*q00 b01*q01 b02*q02 b03*q03 b10*q10 b11*q11 b12*q12 b13*q13 -- 16 bit result
  388|  2.99k|    temp1 = _mm_mullo_epi16(scalemat_r2_r3, dequant_r2_r3); //b00*q00 b01*q01 b02*q02 b03*q03 b10*q10 b11*q11 b12*q12 b13*q13 -- 16 bit result
  389|       |
  390|  2.99k|    temp4 = _mm_unpacklo_epi16(temp0, zero_8x16b); // b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long
  391|  2.99k|    temp5 = _mm_unpackhi_epi16(temp0, zero_8x16b); // b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long
  392|  2.99k|    temp6 = _mm_unpacklo_epi16(temp1, zero_8x16b); // b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long
  393|  2.99k|    temp7 = _mm_unpackhi_epi16(temp1, zero_8x16b); // b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long
  394|       |
  395|  2.99k|    src_r0 = _mm_unpacklo_epi16(src_r0_r1, zero_8x16b); // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  396|  2.99k|    src_r1 = _mm_unpackhi_epi16(src_r0_r1, zero_8x16b); // a10 0 a11 0 a12 0 a13 0 -- 16 bit long
  397|  2.99k|    src_r2 = _mm_unpacklo_epi16(src_r2_r3, zero_8x16b); // a20 0 a21 0 a22 0 a23 0 -- 16 bit long
  398|  2.99k|    src_r3 = _mm_unpackhi_epi16(src_r2_r3, zero_8x16b); // a30 0 a31 0 a32 0 a33 0 -- 16 bit long
  399|       |
  400|  2.99k|    temp4 = _mm_madd_epi16(src_r0, temp4); //a00*b00*q00 a10*b10*q10 a20*b20*q20 a30*b30 q30 -- 32 bits long
  401|  2.99k|    temp5 = _mm_madd_epi16(src_r1, temp5);
  402|  2.99k|    temp6 = _mm_madd_epi16(src_r2, temp6);
  403|  2.99k|    temp7 = _mm_madd_epi16(src_r3, temp7);
  404|       |
  405|  2.99k|    if (u4_qp_div_6 >= 4) {
  ------------------
  |  Branch (405:9): [True: 2.62k, False: 368]
  ------------------
  406|  2.62k|        resq_r0 = _mm_slli_epi32(temp4, u4_qp_div_6 - 4);
  407|  2.62k|        resq_r1 = _mm_slli_epi32(temp5, u4_qp_div_6 - 4);
  408|  2.62k|        resq_r2 = _mm_slli_epi32(temp6, u4_qp_div_6 - 4);
  409|  2.62k|        resq_r3 = _mm_slli_epi32(temp7, u4_qp_div_6 - 4);
  410|  2.62k|    } else {
  411|    368|        temp4 = _mm_add_epi32(temp4, add_rshift);
  412|    368|        temp5 = _mm_add_epi32(temp5, add_rshift);
  413|    368|        temp6 = _mm_add_epi32(temp6, add_rshift);
  414|    368|        temp7 = _mm_add_epi32(temp7, add_rshift);
  415|    368|        resq_r0 = _mm_srai_epi32(temp4, 4 - u4_qp_div_6);
  416|    368|        resq_r1 = _mm_srai_epi32(temp5, 4 - u4_qp_div_6);
  417|    368|        resq_r2 = _mm_srai_epi32(temp6, 4 - u4_qp_div_6);
  418|    368|        resq_r3 = _mm_srai_epi32(temp7, 4 - u4_qp_div_6);
  419|    368|    }
  420|       |
  421|  2.99k|    resq_r0 = _mm_insert_epi32(resq_r0,(WORD32)pi2_dc_ld_addr[0],0);
  422|       |    /* Perform Inverse transform */
  423|       |    /*-------------------------------------------------------------*/
  424|       |    /* IDCT [ Horizontal transformation ]                          */
  425|       |    /*-------------------------------------------------------------*/
  426|       |    // Matrix transpose
  427|       |    /*
  428|       |     *  a0 a1 a2 a3
  429|       |     *  b0 b1 b2 b3
  430|       |     *  c0 c1 c2 c3
  431|       |     *  d0 d1 d2 d3
  432|       |     */
  433|  2.99k|    temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);                  //a0 b0 a1 b1
  434|  2.99k|    temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);                  //c0 d0 c1 d1
  435|  2.99k|    temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);                  //a2 b2 a3 b3
  436|  2.99k|    temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);                  //c2 d2 c3 d3
  437|  2.99k|    resq_r0 = _mm_unpacklo_epi64(temp1, temp3);                    //a0 b0 c0 d0
  438|  2.99k|    resq_r1 = _mm_unpackhi_epi64(temp1, temp3);                    //a1 b1 c1 d1
  439|  2.99k|    resq_r2 = _mm_unpacklo_epi64(temp2, temp4);                    //a2 b2 c2 d2
  440|  2.99k|    resq_r3 = _mm_unpackhi_epi64(temp2, temp4);                    //a3 b3 c3 d3
  441|       |    //Transform starts -- horizontal transform
  442|       |    /*------------------------------------------------------------------*/
  443|       |    /* z0 = w0 + w2                                             */
  444|  2.99k|    temp0 = _mm_add_epi32(resq_r0, resq_r2);
  445|       |    /* z1 = w0 - w2                                             */
  446|  2.99k|    temp1 = _mm_sub_epi32(resq_r0, resq_r2);
  447|       |    /* z2 = (w1 >> 1) - w3                                      */
  448|  2.99k|    temp2 = _mm_srai_epi32(resq_r1, 1);                         //(w1>>1)
  449|  2.99k|    temp2 = _mm_sub_epi32(temp2, resq_r3);                      //(w1>>1) - w3
  450|       |    /* z3 = w1 + (w3 >> 1)                                      */
  451|  2.99k|    temp3 = _mm_srai_epi32(resq_r3, 1);                         //(w3>>1) + w1
  452|  2.99k|    temp3 = _mm_add_epi32(temp3, resq_r1);
  453|       |    /*----------------------------------------------------------*/
  454|       |    /* x0 = z0 + z3                                             */
  455|  2.99k|    resq_r0 = _mm_add_epi32(temp0, temp3);
  456|       |    /* x1 = z1 + z2                                             */
  457|  2.99k|    resq_r1 = _mm_add_epi32(temp1, temp2);
  458|       |    /* x2 = z1 - z2                                             */
  459|  2.99k|    resq_r2 = _mm_sub_epi32(temp1, temp2);
  460|       |    /* x3 = z0 - z3                                             */
  461|  2.99k|    resq_r3 = _mm_sub_epi32(temp0, temp3);
  462|       |    // Matrix transpose
  463|       |    /*
  464|       |     *  a0 b0 c0 d0
  465|       |     *  a1 b1 c1 d1
  466|       |     *  a2 b2 c2 d2
  467|       |     *  a3 b3 c3 d3
  468|       |     */
  469|  2.99k|    temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);                  //a0 a1 b0 b1
  470|  2.99k|    temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);                  //a2 a3 b2 b3
  471|  2.99k|    temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);                  //c0 c1 d0 d1
  472|  2.99k|    temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);                  //c2 c3 d2 d3
  473|  2.99k|    resq_r0 = _mm_unpacklo_epi64(temp1, temp3);                    //a0 a1 a2 a3
  474|  2.99k|    resq_r1 = _mm_unpackhi_epi64(temp1, temp3);                    //b0 b1 b2 b3
  475|  2.99k|    resq_r2 = _mm_unpacklo_epi64(temp2, temp4);                    //c0 c1 c2 c3
  476|  2.99k|    resq_r3 = _mm_unpackhi_epi64(temp2, temp4);                    //d0 d1 d2 d3
  477|       |    //Transform ends -- horizontal transform
  478|       |
  479|       |    //Load pred buffer
  480|  2.99k|    pred_r0 = _mm_loadl_epi64((__m128i *) (&pu1_pred[0])); //p00 p01 p02 p03 0 0 0 0 0 0 0 0 -- all 8 bits
  481|  2.99k|    pred_r1 = _mm_loadl_epi64((__m128i *) (&pu1_pred[pred_strd])); //p10 p11 p12 p13 0 0 0 0 0 0 0 0 -- all 8 bits
  482|  2.99k|    pred_r2 = _mm_loadl_epi64((__m128i *) (&pu1_pred[2 * pred_strd])); //p20 p21 p22 p23 0 0 0 0 0 0 0 0 -- all 8 bits
  483|  2.99k|    pred_r3 = _mm_loadl_epi64((__m128i *) (&pu1_pred[3 * pred_strd])); //p30 p31 p32 p33 0 0 0 0 0 0 0 0 -- all 8 bits
  484|       |
  485|  2.99k|    pred_r0 = _mm_and_si128(pred_r0, chroma_mask);
  486|  2.99k|    pred_r1 = _mm_and_si128(pred_r1, chroma_mask);
  487|  2.99k|    pred_r2 = _mm_and_si128(pred_r2, chroma_mask);
  488|  2.99k|    pred_r3 = _mm_and_si128(pred_r3, chroma_mask);
  489|       |
  490|  2.99k|    pred_r0 = _mm_cvtepu16_epi32(pred_r0); //p00 p01 p02 p03 -- all 32 bits
  491|  2.99k|    pred_r1 = _mm_cvtepu16_epi32(pred_r1); //p10 p11 p12 p13 -- all 32 bits
  492|  2.99k|    pred_r2 = _mm_cvtepu16_epi32(pred_r2); //p20 p21 p22 p23 -- all 32 bits
  493|  2.99k|    pred_r3 = _mm_cvtepu16_epi32(pred_r3); //p30 p31 p32 p33 -- all 32 bits
  494|       |
  495|       |    /*--------------------------------------------------------------*/
  496|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6      */
  497|       |    /*                                                              */
  498|       |    /* Add the prediction and store it back to same buffer          */
  499|       |    /*--------------------------------------------------------------*/
  500|       |    /* z0j = y0j + y2j                                                        */
  501|  2.99k|    temp0 = _mm_add_epi32(resq_r0, resq_r2);
  502|       |    /* z1j = y0j - y2j                                                        */
  503|  2.99k|    temp1 = _mm_sub_epi32(resq_r0, resq_r2);
  504|       |    /* z2j = (y1j>>1) - y3j                                                        */
  505|  2.99k|    temp2 = _mm_srai_epi32(resq_r1, 1);                             //(y1j>>1)
  506|  2.99k|    temp2 = _mm_sub_epi32(temp2, resq_r3);
  507|       |    /* z3j = y1j + (y3j>>1)                                                        */
  508|  2.99k|    temp3 = _mm_srai_epi32(resq_r3, 1);                             //(y3j>>1)
  509|  2.99k|    temp3 = _mm_add_epi32(temp3, resq_r1);
  510|       |
  511|       |    /* x0j = z0j + z3j                                                        */
  512|  2.99k|    temp4 = _mm_add_epi32(temp0, temp3);
  513|  2.99k|    temp4 = _mm_add_epi32(temp4, value_32);
  514|  2.99k|    temp4 = _mm_srai_epi32(temp4, 6);
  515|  2.99k|    temp4 = _mm_add_epi32(temp4, pred_r0);
  516|       |    /* x1j = z1j + z2j                                                        */
  517|  2.99k|    temp5 = _mm_add_epi32(temp1, temp2);
  518|  2.99k|    temp5 = _mm_add_epi32(temp5, value_32);
  519|  2.99k|    temp5 = _mm_srai_epi32(temp5, 6);
  520|  2.99k|    temp5 = _mm_add_epi32(temp5, pred_r1);
  521|       |    /* x2j = z1j - z2j                                                        */
  522|  2.99k|    temp6 = _mm_sub_epi32(temp1, temp2);
  523|  2.99k|    temp6 = _mm_add_epi32(temp6, value_32);
  524|  2.99k|    temp6 = _mm_srai_epi32(temp6, 6);
  525|  2.99k|    temp6 = _mm_add_epi32(temp6, pred_r2);
  526|       |    /* x3j = z0j - z3j                                                        */
  527|  2.99k|    temp7 = _mm_sub_epi32(temp0, temp3);
  528|  2.99k|    temp7 = _mm_add_epi32(temp7, value_32);
  529|  2.99k|    temp7 = _mm_srai_epi32(temp7, 6);
  530|  2.99k|    temp7 = _mm_add_epi32(temp7, pred_r3);
  531|       |
  532|       |    // 32-bit to 16-bit conversion
  533|  2.99k|    temp0 = _mm_packs_epi32(temp4, temp5);
  534|  2.99k|    temp1 = _mm_packs_epi32(temp6, temp7);
  535|       |    /*------------------------------------------------------------------*/
  536|       |    //Clipping the results to 8 bits
  537|  2.99k|    sign_reg = _mm_cmpgt_epi16(temp0, zero_8x16b);      // sign check
  538|  2.99k|    temp0 = _mm_and_si128(temp0, sign_reg);
  539|  2.99k|    sign_reg = _mm_cmpgt_epi16(temp1, zero_8x16b);
  540|  2.99k|    temp1 = _mm_and_si128(temp1, sign_reg);
  541|       |
  542|  2.99k|    resq_r0 = _mm_packus_epi16(temp0, temp1);
  543|  2.99k|    resq_r1 = _mm_srli_si128(resq_r0, 4);
  544|  2.99k|    resq_r2 = _mm_srli_si128(resq_r1, 4);
  545|  2.99k|    resq_r3 = _mm_srli_si128(resq_r2, 4);
  546|       |
  547|  2.99k|    resq_r0 = _mm_cvtepu8_epi16(resq_r0); //p00 p01 p02 p03 -- all 16 bits
  548|  2.99k|    resq_r1 = _mm_cvtepu8_epi16(resq_r1); //p10 p11 p12 p13 -- all 16 bits
  549|  2.99k|    resq_r2 = _mm_cvtepu8_epi16(resq_r2); //p20 p21 p22 p23 -- all 16 bits
  550|  2.99k|    resq_r3 = _mm_cvtepu8_epi16(resq_r3); //p30 p31 p32 p33 -- all 16 bits
  551|       |
  552|  2.99k|    chroma_mask = _mm_set1_epi16 (0xFF00);
  553|  2.99k|    out_r0 = _mm_loadl_epi64((__m128i *) (&pu1_out[0]));
  554|  2.99k|    out_r1 = _mm_loadl_epi64((__m128i *) (&pu1_out[out_strd]));
  555|  2.99k|    out_r2 = _mm_loadl_epi64((__m128i *) (&pu1_out[2 * out_strd]));
  556|  2.99k|    out_r3 = _mm_loadl_epi64((__m128i *) (&pu1_out[3 * out_strd]));
  557|       |
  558|  2.99k|    out_r0 = _mm_and_si128(out_r0, chroma_mask);
  559|  2.99k|    out_r1 = _mm_and_si128(out_r1, chroma_mask);
  560|  2.99k|    out_r2 = _mm_and_si128(out_r2, chroma_mask);
  561|  2.99k|    out_r3 = _mm_and_si128(out_r3, chroma_mask);
  562|       |
  563|  2.99k|    out_r0 = _mm_add_epi8(out_r0, resq_r0);
  564|  2.99k|    out_r1 = _mm_add_epi8(out_r1, resq_r1);
  565|  2.99k|    out_r2 = _mm_add_epi8(out_r2, resq_r2);
  566|  2.99k|    out_r3 = _mm_add_epi8(out_r3, resq_r3);
  567|       |
  568|  2.99k|    _mm_storel_epi64((__m128i *)(&pu1_out[0]), out_r0);
  569|  2.99k|    _mm_storel_epi64((__m128i *)(&pu1_out[out_strd]), out_r1);
  570|  2.99k|    _mm_storel_epi64((__m128i *)(&pu1_out[2 * out_strd]), out_r2);
  571|  2.99k|    _mm_storel_epi64((__m128i *)(&pu1_out[3 * out_strd]), out_r3);
  572|  2.99k|}

ih264_iquant_itrans_recon_4x4_ssse3:
  111|  1.92k|{
  112|  1.92k|    UWORD32 *pu4_out = (UWORD32 *) pu1_out;
  113|  1.92k|    __m128i src_r0_r1, src_r2_r3;
  114|  1.92k|    __m128i src_r0, src_r1, src_r2, src_r3;
  115|  1.92k|    __m128i scalemat_r0_r1, scalemat_r2_r3, predload_r;
  116|  1.92k|    __m128i pred_r0, pred_r1, pred_r2, pred_r3;
  117|  1.92k|    __m128i sign_reg, dequant_r0_r1, dequant_r2_r3;
  118|  1.92k|    __m128i zero_8x16b = _mm_setzero_si128();          // all bits reset to zero
  119|  1.92k|    __m128i temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
  120|  1.92k|    __m128i resq_r0, resq_r1, resq_r2, resq_r3;
  121|  1.92k|    __m128i add_rshift = _mm_set1_epi32((u4_qp_div_6 < 4) ? (1 << (3 - u4_qp_div_6)) : 0);
  ------------------
  |  Branch (121:41): [True: 0, False: 1.92k]
  ------------------
  122|  1.92k|    __m128i value_32 = _mm_set1_epi32(32);
  123|  1.92k|    UNUSED (pi2_tmp);
  ------------------
  |  |   45|  1.92k|#define UNUSED(x) ((void)(x))
  ------------------
  124|  1.92k|    UNUSED (pi2_dc_ld_addr);
  ------------------
  |  |   45|  1.92k|#define UNUSED(x) ((void)(x))
  ------------------
  125|       |
  126|       |    /*************************************************************/
  127|       |    /* Dequantization of coefficients. Will be replaced by SIMD  */
  128|       |    /* operations on platform                                    */
  129|       |    /*************************************************************/
  130|  1.92k|    src_r0_r1 = _mm_loadu_si128((__m128i *) (pi2_src)); //a00 a01 a02 a03 a10 a11 a12 a13 -- the source matrix 0th,1st row
  131|  1.92k|    src_r2_r3 = _mm_loadu_si128((__m128i *) (pi2_src + 8)); //a20 a21 a22 a23 a30 a31 a32 a33 -- the source matrix 2nd,3rd row
  132|  1.92k|    scalemat_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat)); //b00 b01 b02 b03 b10 b11 b12 b13 -- the scaling matrix 0th,1st row
  133|  1.92k|    scalemat_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat + 8)); //b20 b21 b22 b23 b30 b31 b32 b33 -- the scaling matrix 2nd,3rd row
  134|  1.92k|    dequant_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat)); //q00 q01 q02 q03 q10 q11 q12 q13 -- all 16 bits
  135|  1.92k|    dequant_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat + 8)); //q20 q21 q22 q23 q30 q31 q32 q33 -- all 16 bits
  136|       |
  137|  1.92k|    temp0 = _mm_mullo_epi16(scalemat_r0_r1, dequant_r0_r1); //b00*q00 b01*q01 b02*q02 b03*q03 b10*q10 b11*q11 b12*q12 b13*q13 -- 16 bit result
  138|  1.92k|    temp1 = _mm_mullo_epi16(scalemat_r2_r3, dequant_r2_r3); //b00*q00 b01*q01 b02*q02 b03*q03 b10*q10 b11*q11 b12*q12 b13*q13 -- 16 bit result
  139|       |
  140|  1.92k|    temp4 = _mm_unpacklo_epi16(temp0, zero_8x16b); // b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long
  141|  1.92k|    temp5 = _mm_unpackhi_epi16(temp0, zero_8x16b); // b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long
  142|  1.92k|    temp6 = _mm_unpacklo_epi16(temp1, zero_8x16b); // b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long
  143|  1.92k|    temp7 = _mm_unpackhi_epi16(temp1, zero_8x16b); // b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long
  144|       |
  145|  1.92k|    src_r0 = _mm_unpacklo_epi16(src_r0_r1, zero_8x16b); // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  146|  1.92k|    src_r1 = _mm_unpackhi_epi16(src_r0_r1, zero_8x16b); // a10 0 a11 0 a12 0 a13 0 -- 16 bit long
  147|  1.92k|    src_r2 = _mm_unpacklo_epi16(src_r2_r3, zero_8x16b); // a20 0 a21 0 a22 0 a23 0 -- 16 bit long
  148|  1.92k|    src_r3 = _mm_unpackhi_epi16(src_r2_r3, zero_8x16b); // a30 0 a31 0 a32 0 a33 0 -- 16 bit long
  149|       |
  150|  1.92k|    temp4 = _mm_madd_epi16(src_r0, temp4); //a00*b00*q00 a10*b10*q10 a20*b20*q20 a30*b30 q30 -- 32 bits long
  151|  1.92k|    temp5 = _mm_madd_epi16(src_r1, temp5);
  152|  1.92k|    temp6 = _mm_madd_epi16(src_r2, temp6);
  153|  1.92k|    temp7 = _mm_madd_epi16(src_r3, temp7);
  154|       |
  155|  1.92k|    if (u4_qp_div_6 >= 4) {
  ------------------
  |  Branch (155:9): [True: 1.92k, False: 0]
  ------------------
  156|  1.92k|        resq_r0 = _mm_slli_epi32(temp4, u4_qp_div_6 - 4);
  157|  1.92k|        resq_r1 = _mm_slli_epi32(temp5, u4_qp_div_6 - 4);
  158|  1.92k|        resq_r2 = _mm_slli_epi32(temp6, u4_qp_div_6 - 4);
  159|  1.92k|        resq_r3 = _mm_slli_epi32(temp7, u4_qp_div_6 - 4);
  160|  1.92k|    } else {
  161|      0|        temp4 = _mm_add_epi32(temp4, add_rshift);
  162|      0|        temp5 = _mm_add_epi32(temp5, add_rshift);
  163|      0|        temp6 = _mm_add_epi32(temp6, add_rshift);
  164|      0|        temp7 = _mm_add_epi32(temp7, add_rshift);
  165|      0|        resq_r0 = _mm_srai_epi32(temp4, 4 - u4_qp_div_6);
  166|      0|        resq_r1 = _mm_srai_epi32(temp5, 4 - u4_qp_div_6);
  167|      0|        resq_r2 = _mm_srai_epi32(temp6, 4 - u4_qp_div_6);
  168|      0|        resq_r3 = _mm_srai_epi32(temp7, 4 - u4_qp_div_6);
  169|      0|    }
  170|       |
  171|  1.92k|    if (iq_start_idx == 1)
  ------------------
  |  Branch (171:9): [True: 75, False: 1.85k]
  ------------------
  172|     75|    {
  173|     75|        resq_r0 = _mm_insert_epi16(resq_r0,(WORD32)pi2_src[0],0);
  174|     75|        if (pi2_src[0] >= 0)
  ------------------
  |  Branch (174:13): [True: 38, False: 37]
  ------------------
  175|     38|            resq_r0 = _mm_insert_epi16(resq_r0,0,1);
  176|     37|        else
  177|     37|            resq_r0 = _mm_insert_epi16(resq_r0,-1,1);
  178|     75|    }
  179|       |    /* Perform Inverse transform */
  180|       |    /*-------------------------------------------------------------*/
  181|       |    /* IDCT [ Horizontal transformation ]                          */
  182|       |    /*-------------------------------------------------------------*/
  183|       |    // Matrix transpose
  184|       |    /*
  185|       |     *  a0 a1 a2 a3
  186|       |     *  b0 b1 b2 b3
  187|       |     *  c0 c1 c2 c3
  188|       |     *  d0 d1 d2 d3
  189|       |     */
  190|  1.92k|    temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);                  //a0 b0 a1 b1
  191|  1.92k|    temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);                  //c0 d0 c1 d1
  192|  1.92k|    temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);                  //a2 b2 a3 b3
  193|  1.92k|    temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);                  //c2 d2 c3 d3
  194|  1.92k|    resq_r0 = _mm_unpacklo_epi64(temp1, temp3);                    //a0 b0 c0 d0
  195|  1.92k|    resq_r1 = _mm_unpackhi_epi64(temp1, temp3);                    //a1 b1 c1 d1
  196|  1.92k|    resq_r2 = _mm_unpacklo_epi64(temp2, temp4);                    //a2 b2 c2 d2
  197|  1.92k|    resq_r3 = _mm_unpackhi_epi64(temp2, temp4);                    //a3 b3 c3 d3
  198|       |    //Transform starts -- horizontal transform
  199|       |    /*------------------------------------------------------------------*/
  200|       |    /* z0 = w0 + w2                                             */
  201|  1.92k|    temp0 = _mm_add_epi32(resq_r0, resq_r2);
  202|       |    /* z1 = w0 - w2                                             */
  203|  1.92k|    temp1 = _mm_sub_epi32(resq_r0, resq_r2);
  204|       |    /* z2 = (w1 >> 1) - w3                                      */
  205|  1.92k|    temp2 = _mm_srai_epi32(resq_r1, 1);                         //(w1>>1)
  206|  1.92k|    temp2 = _mm_sub_epi32(temp2, resq_r3);                      //(w1>>1) - w3
  207|       |    /* z3 = w1 + (w3 >> 1)                                      */
  208|  1.92k|    temp3 = _mm_srai_epi32(resq_r3, 1);                         //(w3>>1) + w1
  209|  1.92k|    temp3 = _mm_add_epi32(temp3, resq_r1);
  210|       |    /*----------------------------------------------------------*/
  211|       |    /* x0 = z0 + z3                                             */
  212|  1.92k|    resq_r0 = _mm_add_epi32(temp0, temp3);
  213|       |    /* x1 = z1 + z2                                             */
  214|  1.92k|    resq_r1 = _mm_add_epi32(temp1, temp2);
  215|       |    /* x2 = z1 - z2                                             */
  216|  1.92k|    resq_r2 = _mm_sub_epi32(temp1, temp2);
  217|       |    /* x3 = z0 - z3                                             */
  218|  1.92k|    resq_r3 = _mm_sub_epi32(temp0, temp3);
  219|       |    // Matrix transpose
  220|       |    /*
  221|       |     *  a0 b0 c0 d0
  222|       |     *  a1 b1 c1 d1
  223|       |     *  a2 b2 c2 d2
  224|       |     *  a3 b3 c3 d3
  225|       |     */
  226|  1.92k|    temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);                  //a0 a1 b0 b1
  227|  1.92k|    temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);                  //a2 a3 b2 b3
  228|  1.92k|    temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);                  //c0 c1 d0 d1
  229|  1.92k|    temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);                  //c2 c3 d2 d3
  230|  1.92k|    resq_r0 = _mm_unpacklo_epi64(temp1, temp3);                    //a0 a1 a2 a3
  231|  1.92k|    resq_r1 = _mm_unpackhi_epi64(temp1, temp3);                    //b0 b1 b2 b3
  232|  1.92k|    resq_r2 = _mm_unpacklo_epi64(temp2, temp4);                    //c0 c1 c2 c3
  233|  1.92k|    resq_r3 = _mm_unpackhi_epi64(temp2, temp4);                    //d0 d1 d2 d3
  234|       |    //Transform ends -- horizontal transform
  235|       |
  236|  1.92k|    zero_8x16b = _mm_setzero_si128();                  // all bits reset to zero
  237|       |    //Load pred buffer
  238|  1.92k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[0])); //p00 p01 p02 p03 0 0 0 0 0 0 0 0 -- all 8 bits
  239|  1.92k|    pred_r0 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p00 p01 p02 p03 0 0 0 0 -- all 16 bits
  240|       |
  241|  1.92k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[pred_strd])); //p10 p11 p12 p13 0 0 0 0 0 0 0 0 -- all 8 bits
  242|  1.92k|    pred_r1 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p10 p11 p12 p13 0 0 0 0 -- all 16 bits
  243|       |
  244|  1.92k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[2 * pred_strd])); //p20 p21 p22 p23 0 0 0 0 0 0 0 0 -- all 8 bits
  245|  1.92k|    pred_r2 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p20 p21 p22 p23 0 0 0 0 -- all 16 bits
  246|       |
  247|  1.92k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[3 * pred_strd])); //p30 p31 p32 p33 0 0 0 0 0 0 0 0 -- all 8 bits
  248|  1.92k|    pred_r3 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p30 p31 p32 p33 0 0 0 0 -- all 16 bits
  249|  1.92k|    pred_r0 = _mm_unpacklo_epi16(pred_r0, zero_8x16b); //p00 p01 p02 p03 -- 32 bits sign extended
  250|  1.92k|    pred_r1 = _mm_unpacklo_epi16(pred_r1, zero_8x16b); //p10 p11 p12 p13 -- 32 bits sign extended
  251|  1.92k|    pred_r2 = _mm_unpacklo_epi16(pred_r2, zero_8x16b); //p20 p21 p22 p23 -- 32 bits sign extended
  252|  1.92k|    pred_r3 = _mm_unpacklo_epi16(pred_r3, zero_8x16b); //p30 p31 p32 p33 -- 32 bits sign extended
  253|       |
  254|       |    /*--------------------------------------------------------------*/
  255|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6      */
  256|       |    /*                                                              */
  257|       |    /* Add the prediction and store it back to same buffer          */
  258|       |    /*--------------------------------------------------------------*/
  259|       |    /* z0j = y0j + y2j                                                        */
  260|  1.92k|    temp0 = _mm_add_epi32(resq_r0, resq_r2);
  261|       |    /* z1j = y0j - y2j                                                        */
  262|  1.92k|    temp1 = _mm_sub_epi32(resq_r0, resq_r2);
  263|       |    /* z2j = (y1j>>1) - y3j                                                        */
  264|  1.92k|    temp2 = _mm_srai_epi32(resq_r1, 1);                             //(y1j>>1)
  265|  1.92k|    temp2 = _mm_sub_epi32(temp2, resq_r3);
  266|       |    /* z3j = y1j + (y3j>>1)                                                        */
  267|  1.92k|    temp3 = _mm_srai_epi32(resq_r3, 1);                             //(y3j>>1)
  268|  1.92k|    temp3 = _mm_add_epi32(temp3, resq_r1);
  269|       |
  270|       |    /* x0j = z0j + z3j                                                        */
  271|  1.92k|    temp4 = _mm_add_epi32(temp0, temp3);
  272|  1.92k|    temp4 = _mm_add_epi32(temp4, value_32);
  273|  1.92k|    temp4 = _mm_srai_epi32(temp4, 6);
  274|  1.92k|    temp4 = _mm_add_epi32(temp4, pred_r0);
  275|       |    /* x1j = z1j + z2j                                                        */
  276|  1.92k|    temp5 = _mm_add_epi32(temp1, temp2);
  277|  1.92k|    temp5 = _mm_add_epi32(temp5, value_32);
  278|  1.92k|    temp5 = _mm_srai_epi32(temp5, 6);
  279|  1.92k|    temp5 = _mm_add_epi32(temp5, pred_r1);
  280|       |    /* x2j = z1j - z2j                                                        */
  281|  1.92k|    temp6 = _mm_sub_epi32(temp1, temp2);
  282|  1.92k|    temp6 = _mm_add_epi32(temp6, value_32);
  283|  1.92k|    temp6 = _mm_srai_epi32(temp6, 6);
  284|  1.92k|    temp6 = _mm_add_epi32(temp6, pred_r2);
  285|       |    /* x3j = z0j - z3j                                                        */
  286|  1.92k|    temp7 = _mm_sub_epi32(temp0, temp3);
  287|  1.92k|    temp7 = _mm_add_epi32(temp7, value_32);
  288|  1.92k|    temp7 = _mm_srai_epi32(temp7, 6);
  289|  1.92k|    temp7 = _mm_add_epi32(temp7, pred_r3);
  290|       |
  291|       |    // 32-bit to 16-bit conversion
  292|  1.92k|    temp0 = _mm_packs_epi32(temp4, temp5);
  293|  1.92k|    temp1 = _mm_packs_epi32(temp6, temp7);
  294|       |    /*------------------------------------------------------------------*/
  295|       |    //Clipping the results to 8 bits
  296|  1.92k|    sign_reg = _mm_cmpgt_epi16(temp0, zero_8x16b);      // sign check
  297|  1.92k|    temp0 = _mm_and_si128(temp0, sign_reg);
  298|  1.92k|    sign_reg = _mm_cmpgt_epi16(temp1, zero_8x16b);
  299|  1.92k|    temp1 = _mm_and_si128(temp1, sign_reg);
  300|       |
  301|  1.92k|    resq_r0 = _mm_packus_epi16(temp0, temp1);
  302|  1.92k|    resq_r1 = _mm_srli_si128(resq_r0, 4);
  303|  1.92k|    resq_r2 = _mm_srli_si128(resq_r1, 4);
  304|  1.92k|    resq_r3 = _mm_srli_si128(resq_r2, 4);
  305|       |
  306|  1.92k|    *pu4_out = _mm_cvtsi128_si32(resq_r0);
  307|  1.92k|    pu1_out += out_strd;
  308|  1.92k|    pu4_out = (UWORD32 *) (pu1_out);
  309|  1.92k|    *(pu4_out) = _mm_cvtsi128_si32(resq_r1);
  310|  1.92k|    pu1_out += out_strd;
  311|  1.92k|    pu4_out = (UWORD32 *) (pu1_out);
  312|  1.92k|    *(pu4_out) = _mm_cvtsi128_si32(resq_r2);
  313|  1.92k|    pu1_out += out_strd;
  314|  1.92k|    pu4_out = (UWORD32 *) (pu1_out);
  315|  1.92k|    *(pu4_out) = _mm_cvtsi128_si32(resq_r3);
  316|  1.92k|}
ih264_iquant_itrans_recon_8x8_ssse3:
  380|  4.74k|{
  381|  4.74k|    __m128i src_r0;
  382|  4.74k|    __m128i scalemat_r0;
  383|  4.74k|    __m128i zero_8x16b = _mm_setzero_si128(); // all bits reset to zero
  384|       |    // __m128i one_8x16b = _mm_set1_epi8(255); // all bits set to 1
  385|       |    // __m128i one_zero_mask = _mm_unpacklo_epi16(one_8x16b, zero_8x16b); // 1 0 1 0 1 0 1 0 --- 16 bits size
  386|  4.74k|    __m128i value_32 = _mm_set1_epi32(32);
  387|  4.74k|    __m128i add_rshift = _mm_set1_epi32((qp_div < 6) ? (1 << (5 - qp_div)) : 0);
  ------------------
  |  Branch (387:41): [True: 4.49k, False: 245]
  ------------------
  388|  4.74k|    __m128i dequant_r0;
  389|  4.74k|    __m128i predload_r;
  390|  4.74k|    __m128i pred_r0_1, pred_r1_1, pred_r2_1, pred_r3_1, pred_r4_1, pred_r5_1,
  391|  4.74k|            pred_r6_1, pred_r7_1;
  392|  4.74k|    __m128i sign_reg;
  393|  4.74k|    __m128i src_r0_1, src_r0_2;
  394|  4.74k|    __m128i scalemat_r0_1, scalemat_r0_2;
  395|  4.74k|    __m128i temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8;
  396|  4.74k|    __m128i temp10, temp11, temp12, temp13, temp14, temp15, temp16, temp17,
  397|  4.74k|            temp18, temp19, temp20;
  398|       |    // To store dequantization results
  399|  4.74k|    __m128i resq_r0_1, resq_r0_2, resq_r1_1, resq_r1_2, resq_r2_1, resq_r2_2,
  400|  4.74k|            resq_r3_1, resq_r3_2, resq_r4_1, resq_r4_2, resq_r5_1, resq_r5_2,
  401|  4.74k|            resq_r6_1, resq_r6_2, resq_r7_1, resq_r7_2;
  402|  4.74k|    UNUSED (pi2_tmp);
  ------------------
  |  |   45|  4.74k|#define UNUSED(x) ((void)(x))
  ------------------
  403|  4.74k|    UNUSED (iq_start_idx);
  ------------------
  |  |   45|  4.74k|#define UNUSED(x) ((void)(x))
  ------------------
  404|  4.74k|    UNUSED (pi2_dc_ld_addr);
  ------------------
  |  |   45|  4.74k|#define UNUSED(x) ((void)(x))
  ------------------
  405|       |
  406|       |    /*************************************************************/
  407|       |    /* Dequantization of coefficients. Will be replaced by SIMD  */
  408|       |    /* operations on platform. Note : DC coeff is not scaled     */
  409|       |    /*************************************************************/
  410|       |
  411|       |    // Row 0 processing
  412|  4.74k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src)); //a00 a01 a02 a03 a04 a05 a06 a07 -- the source matrix 0th row
  413|  4.74k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat)); //b00 b01 b02 b03 b04 b05 b06 b07 -- the scaling matrix 0th row
  414|  4.74k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[0])); //q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  415|  4.74k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b); //a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  416|  4.74k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b); // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  417|  4.74k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0); //b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  418|  4.74k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b); // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  419|  4.74k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b); // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  420|       |
  421|  4.74k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1); // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  422|  4.74k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2); // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  423|       |
  424|  4.74k|    if (qp_div >= 6) {
  ------------------
  |  Branch (424:9): [True: 245, False: 4.49k]
  ------------------
  425|    245|        resq_r0_1 = _mm_slli_epi32(temp5, qp_div - 6);
  426|    245|        resq_r0_2 = _mm_slli_epi32(temp7, qp_div - 6);
  427|  4.49k|    } else {
  428|  4.49k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  429|  4.49k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  430|  4.49k|        resq_r0_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  431|  4.49k|        resq_r0_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  432|  4.49k|    }
  433|  4.74k|    resq_r0_1 = _mm_packs_epi32(resq_r0_1, resq_r0_2); //a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 16 bit long
  434|       |    // Row 1 processing
  435|  4.74k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 8)); //a00 a01 a02 a03 a04 a05 a06 a07 a08 -- the source matrix 1st row
  436|  4.74k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 8)); //b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 1st row
  437|  4.74k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[8])); //q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  438|  4.74k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b); //a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  439|  4.74k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b); // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  440|  4.74k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0); //b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  441|  4.74k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b); // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  442|  4.74k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b); // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  443|  4.74k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1); // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  444|  4.74k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2); // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  445|  4.74k|    if (qp_div >= 6) {
  ------------------
  |  Branch (445:9): [True: 245, False: 4.49k]
  ------------------
  446|    245|        resq_r1_1 = _mm_slli_epi32(temp5, qp_div - 6);
  447|    245|        resq_r1_2 = _mm_slli_epi32(temp7, qp_div - 6);
  448|  4.49k|    } else {
  449|  4.49k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  450|  4.49k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  451|  4.49k|        resq_r1_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  452|  4.49k|        resq_r1_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  453|  4.49k|    }
  454|  4.74k|    resq_r1_1 = _mm_packs_epi32(resq_r1_1, resq_r1_2); //a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 16 bit long
  455|       |    // Row 2 processing
  456|  4.74k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 16)); //a00 a01 a02 a03 a04 a05 a06 a07 a08 -- the source matrix 2nd row
  457|  4.74k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 16)); //b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 2nd row
  458|  4.74k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[16])); //q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  459|  4.74k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b); //a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  460|  4.74k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b); // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  461|  4.74k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0); //b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  462|  4.74k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b); // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  463|  4.74k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b); // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  464|  4.74k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1); // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  465|  4.74k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2); // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  466|  4.74k|    if (qp_div >= 6) {
  ------------------
  |  Branch (466:9): [True: 245, False: 4.49k]
  ------------------
  467|    245|        resq_r2_1 = _mm_slli_epi32(temp5, qp_div - 6);
  468|    245|        resq_r2_2 = _mm_slli_epi32(temp7, qp_div - 6);
  469|  4.49k|    } else {
  470|  4.49k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  471|  4.49k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  472|  4.49k|        resq_r2_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  473|  4.49k|        resq_r2_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  474|  4.49k|    }
  475|  4.74k|    resq_r2_1 = _mm_packs_epi32(resq_r2_1, resq_r2_2); //a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 16 bit long
  476|       |    // Row 3 processing
  477|  4.74k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 24)); //a00 a01 a02 a03 a04 a05 a06 a07 a08 -- the source matrix 3rd row
  478|  4.74k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 24)); //b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 3rd row
  479|  4.74k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[24])); //q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  480|  4.74k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b); //a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  481|  4.74k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b); // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  482|  4.74k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0); //b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  483|  4.74k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b); // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  484|  4.74k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b); // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  485|  4.74k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1); // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 - 32 bits long
  486|  4.74k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2); // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  487|  4.74k|    if (qp_div >= 6) {
  ------------------
  |  Branch (487:9): [True: 245, False: 4.49k]
  ------------------
  488|    245|        resq_r3_1 = _mm_slli_epi32(temp5, qp_div - 6);
  489|    245|        resq_r3_2 = _mm_slli_epi32(temp7, qp_div - 6);
  490|  4.49k|    } else {
  491|  4.49k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  492|  4.49k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  493|  4.49k|        resq_r3_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  494|  4.49k|        resq_r3_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  495|  4.49k|    }
  496|  4.74k|    resq_r3_1 = _mm_packs_epi32(resq_r3_1, resq_r3_2); //a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 16 bit long
  497|       |    // Row 4 processing
  498|  4.74k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 32)); //a00 a01 a02 a03 a04 a05 a06 a07 a08 -- the source matrix 4th row
  499|  4.74k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 32)); //b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 4th row
  500|  4.74k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[32])); //q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  501|  4.74k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b); //a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  502|  4.74k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b); // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  503|  4.74k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0); //b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  504|  4.74k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b); // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  505|  4.74k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b); // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  506|  4.74k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1); // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  507|  4.74k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2); // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  508|  4.74k|    if (qp_div >= 6) {
  ------------------
  |  Branch (508:9): [True: 245, False: 4.49k]
  ------------------
  509|    245|        resq_r4_1 = _mm_slli_epi32(temp5, qp_div - 6);
  510|    245|        resq_r4_2 = _mm_slli_epi32(temp7, qp_div - 6);
  511|       |
  512|  4.49k|    } else {
  513|  4.49k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  514|  4.49k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  515|  4.49k|        resq_r4_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  516|  4.49k|        resq_r4_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  517|  4.49k|    }
  518|  4.74k|    resq_r4_1 = _mm_packs_epi32(resq_r4_1, resq_r4_2); //a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 16 bit long
  519|       |    // Row 5 processing
  520|  4.74k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 40)); //a00 a01 a02 a03 a04 a05 a06 a07 a08 -- the source matrix 5th row
  521|  4.74k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 40)); //b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 5th row
  522|  4.74k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[40])); //q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  523|  4.74k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b); //a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  524|  4.74k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b); // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  525|  4.74k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0); //b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  526|  4.74k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b); // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  527|  4.74k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b); // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  528|  4.74k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1); // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  529|  4.74k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2); // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  530|  4.74k|    if (qp_div >= 6) {
  ------------------
  |  Branch (530:9): [True: 245, False: 4.49k]
  ------------------
  531|    245|        resq_r5_1 = _mm_slli_epi32(temp5, qp_div - 6);
  532|    245|        resq_r5_2 = _mm_slli_epi32(temp7, qp_div - 6);
  533|       |        //resq_r5_1 = _mm_and_si128(resq_r5_1,one_zero_mask);
  534|       |        //resq_r5_2 = _mm_and_si128(resq_r5_2,one_zero_mask);
  535|  4.49k|    } else {
  536|  4.49k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  537|  4.49k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  538|  4.49k|        resq_r5_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  539|  4.49k|        resq_r5_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  540|  4.49k|    }
  541|  4.74k|    resq_r5_1 = _mm_packs_epi32(resq_r5_1, resq_r5_2); //a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 16 bit long
  542|       |    // Row 6 processing
  543|  4.74k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 48)); //a00 a01 a02 a03 a04 a05 a06 a07 a08 -- the source matrix 6th row
  544|  4.74k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 48)); //b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 6th row
  545|  4.74k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[48])); //q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  546|  4.74k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b); //a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  547|  4.74k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b); // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  548|  4.74k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0); //b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  549|  4.74k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b); // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  550|  4.74k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b); // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  551|  4.74k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1); // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  552|  4.74k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2); // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  553|  4.74k|    if (qp_div >= 6) {
  ------------------
  |  Branch (553:9): [True: 245, False: 4.49k]
  ------------------
  554|    245|        resq_r6_1 = _mm_slli_epi32(temp5, qp_div - 6);
  555|    245|        resq_r6_2 = _mm_slli_epi32(temp7, qp_div - 6);
  556|       |        //resq_r6_1 = _mm_and_si128(resq_r6_1,one_zero_mask);
  557|       |        //resq_r6_2 = _mm_and_si128(resq_r6_2,one_zero_mask);
  558|  4.49k|    } else {
  559|  4.49k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  560|  4.49k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  561|  4.49k|        resq_r6_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  562|  4.49k|        resq_r6_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  563|       |        //resq_r6_1 = _mm_and_si128(resq_r6_1,one_zero_mask);
  564|       |        //resq_r6_2 = _mm_and_si128(resq_r6_2,one_zero_mask);
  565|  4.49k|    }
  566|  4.74k|    resq_r6_1 = _mm_packs_epi32(resq_r6_1, resq_r6_2); //a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 16 bit long
  567|       |    // Row 7 processing
  568|  4.74k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 56)); //a00 a01 a02 a03 a04 a05 a06 a07 a08 -- the source matrix 7th row
  569|  4.74k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 56)); //b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 7th row
  570|  4.74k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[56])); //q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  571|  4.74k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b); //a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  572|  4.74k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b); // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  573|  4.74k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0); //b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  574|  4.74k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b); // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  575|  4.74k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b); // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  576|  4.74k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1); // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  577|  4.74k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2); // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  578|  4.74k|    if (qp_div >= 6) {
  ------------------
  |  Branch (578:9): [True: 245, False: 4.49k]
  ------------------
  579|    245|        resq_r7_1 = _mm_slli_epi32(temp5, qp_div - 6);
  580|    245|        resq_r7_2 = _mm_slli_epi32(temp7, qp_div - 6);
  581|  4.49k|    } else {
  582|  4.49k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  583|  4.49k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  584|  4.49k|        resq_r7_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  585|  4.49k|        resq_r7_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  586|  4.49k|    }
  587|  4.74k|    resq_r7_1 = _mm_packs_epi32(resq_r7_1, resq_r7_2); //a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 16 bit long
  588|       |    /* Perform Inverse transform */
  589|       |    /*--------------------------------------------------------------------*/
  590|       |    /* IDCT [ Horizontal transformation ]                                 */
  591|       |    /*--------------------------------------------------------------------*/
  592|       |    // Matrix transpose
  593|       |    /*
  594|       |     *  a0 a1 a2 a3 a4 a5 a6 a7
  595|       |     *  b0 b1 b2 b3 b4 b5 b6 b7
  596|       |     *  c0 c1 c2 c3 c4 c5 c6 c7
  597|       |     *  d0 d1 d2 d3 d4 d5 d6 d7
  598|       |     */
  599|  4.74k|    temp1 = _mm_unpacklo_epi16(resq_r0_1, resq_r1_1); //a0 b0 a1 b1 a2 b2 a3 b3
  600|  4.74k|    temp3 = _mm_unpacklo_epi16(resq_r2_1, resq_r3_1); //c0 d0 c1 d1 c2 d2 c3 d3
  601|  4.74k|    temp2 = _mm_unpackhi_epi16(resq_r0_1, resq_r1_1); //a4 b4 a5 b5 a6 b6 a7 b7
  602|  4.74k|    temp4 = _mm_unpackhi_epi16(resq_r2_1, resq_r3_1); //c4 d4 c5 d5 c6 d6 c7 d7
  603|  4.74k|    resq_r0_1 = _mm_unpacklo_epi32(temp1, temp3); //a0 b0 c0 d0 a1 b1 c1 d1
  604|  4.74k|    resq_r1_1 = _mm_unpackhi_epi32(temp1, temp3); //a2 b2 c2 d2 a3 b3 c3 d3
  605|  4.74k|    resq_r2_1 = _mm_unpacklo_epi32(temp2, temp4); //a4 b4 c4 d4 a5 b5 c5 d5
  606|  4.74k|    resq_r3_1 = _mm_unpackhi_epi32(temp2, temp4); //a6 b6 c6 d6 a7 b7 c7 d7
  607|       |    /*
  608|       |     * e0 e1 e2 e3 e4 e5 e6 e7
  609|       |     * f0 f1 f2 f3 f4 f5 f6 f7
  610|       |     * g0 g1 g2 g3 g4 g5 g6 g7
  611|       |     * h0 h1 h2 h3 h4 h5 h6 h7
  612|       |     */
  613|  4.74k|    temp1 = _mm_unpacklo_epi16(resq_r4_1, resq_r5_1); //e0 f0 e1 f1 e2 f2 e2 f3
  614|  4.74k|    temp3 = _mm_unpacklo_epi16(resq_r6_1, resq_r7_1); //g0 h0 g1 h1 g2 h2 g3 h3
  615|  4.74k|    temp2 = _mm_unpackhi_epi16(resq_r4_1, resq_r5_1); //e4 f4 e5 f5 e6 f6 e7 f7
  616|  4.74k|    temp4 = _mm_unpackhi_epi16(resq_r6_1, resq_r7_1); //g4 h4 g5 h5 g6 h6 g7 h7
  617|  4.74k|    resq_r4_1 = _mm_unpacklo_epi32(temp1, temp3); //e0 f0 g0 h0 e1 f1 g1 h1
  618|  4.74k|    resq_r5_1 = _mm_unpackhi_epi32(temp1, temp3); //e2 f2 g2 h2 e3 f3 g3 h3
  619|  4.74k|    resq_r6_1 = _mm_unpacklo_epi32(temp2, temp4); //e4 f4 g4 h4 e5 f5 g5 h5
  620|  4.74k|    resq_r7_1 = _mm_unpackhi_epi32(temp2, temp4); //e6 f6 g6 h6 e7 f7 g7 h7
  621|       |    /*
  622|       |     * a0 b0 c0 d0 a1 b1 c1 d1
  623|       |     * a2 b2 c2 d2 a3 b3 c3 d3
  624|       |     * a4 b4 c4 d4 a5 b5 c5 d5
  625|       |     * a6 b6 c6 d6 a7 b7 c7 d7
  626|       |     * e0 f0 g0 h0 e1 f1 g1 h1
  627|       |     * e2 f2 g2 h2 e3 f3 g3 h3
  628|       |     * e4 f4 g4 h4 e5 f5 g5 h5
  629|       |     * e6 f6 g6 h6 e7 f7 g7 h7
  630|       |     */
  631|  4.74k|    resq_r0_2 = _mm_unpacklo_epi64(resq_r0_1, resq_r4_1); //a0 b0 c0 d0 e0 f0 g0 h0
  632|  4.74k|    resq_r1_2 = _mm_unpackhi_epi64(resq_r0_1, resq_r4_1); //a1 b1 c1 d1 e1 f1 g1 h1
  633|  4.74k|    resq_r2_2 = _mm_unpacklo_epi64(resq_r1_1, resq_r5_1); //a2 b2 c2 d2 e2 f2 g2 h2
  634|  4.74k|    resq_r3_2 = _mm_unpackhi_epi64(resq_r1_1, resq_r5_1); //a3 b3 c3 d3 e3 f3 g3 h3
  635|  4.74k|    resq_r4_2 = _mm_unpacklo_epi64(resq_r2_1, resq_r6_1); //a4 b4 c4 d4 e4 f4 g4 h4
  636|  4.74k|    resq_r5_2 = _mm_unpackhi_epi64(resq_r2_1, resq_r6_1); //a5 b5 c5 d5 e5 f5 g5 h5
  637|  4.74k|    resq_r6_2 = _mm_unpacklo_epi64(resq_r3_1, resq_r7_1); //a6 b6 c6 d6 e6 f6 g6 h6
  638|  4.74k|    resq_r7_2 = _mm_unpackhi_epi64(resq_r3_1, resq_r7_1); //a7 b7 c7 d7 e7 f7 g7 h7
  639|       |
  640|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r1_2);
  641|  4.74k|    resq_r1_1 = _mm_unpacklo_epi16(resq_r1_2, sign_reg); //a1 b1 c1 d1 -- 32 bit
  642|  4.74k|    resq_r1_2 = _mm_unpackhi_epi16(resq_r1_2, sign_reg); //e1 f1 g1 h1 -- 32 bit
  643|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r3_2);
  644|  4.74k|    resq_r3_1 = _mm_unpacklo_epi16(resq_r3_2, sign_reg); //a3 b3 c3 d3 -- 32 bit
  645|  4.74k|    resq_r3_2 = _mm_unpackhi_epi16(resq_r3_2, sign_reg); //e3 f3 g3 h3 -- 32 bit
  646|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r5_2);
  647|  4.74k|    resq_r5_1 = _mm_unpacklo_epi16(resq_r5_2, sign_reg); //a5 b5 c5 d5 -- 32 bit
  648|  4.74k|    resq_r5_2 = _mm_unpackhi_epi16(resq_r5_2, sign_reg); //e5 f5 g5 h5 -- 32 bit
  649|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r7_2);
  650|  4.74k|    resq_r7_1 = _mm_unpacklo_epi16(resq_r7_2, sign_reg); //a7 b7 c7 d7 -- 32 bit
  651|  4.74k|    resq_r7_2 = _mm_unpackhi_epi16(resq_r7_2, sign_reg); //e7 f7 g7 h7 -- 32 bit
  652|       |    //Transform starts -- horizontal transform
  653|       |    /*------------------------------------------------------------------*/
  654|       |    /* y0 = w0 + w4                                                     */
  655|  4.74k|    temp1 = _mm_add_epi16(resq_r0_2, resq_r4_2);
  656|       |    /* y2 = w0 - w4                                                      */
  657|  4.74k|    temp3 = _mm_sub_epi16(resq_r0_2, resq_r4_2);
  658|       |    /* y1 = -w3 + w5 - w7 - (w7 >> 1)                                   */
  659|  4.74k|    temp2 = _mm_sub_epi32(resq_r5_1, resq_r3_1); //-w3+w5
  660|  4.74k|    temp10 = _mm_sub_epi32(resq_r5_2, resq_r3_2);
  661|  4.74k|    temp4 = _mm_sub_epi32(temp2, resq_r7_1); //-w3+w5-w7
  662|  4.74k|    temp12 = _mm_sub_epi32(temp10, resq_r7_2);
  663|  4.74k|    temp5 = _mm_srai_epi32(resq_r7_1, 1); //w7>>1
  664|  4.74k|    temp13 = _mm_srai_epi32(resq_r7_2, 1);
  665|  4.74k|    temp2 = _mm_sub_epi32(temp4, temp5); //-w3+w5-w7 -(w7>>1)
  666|  4.74k|    temp10 = _mm_sub_epi32(temp12, temp13);
  667|  4.74k|    temp2 = _mm_packs_epi32(temp2, temp10);
  668|       |    /* y3 = w1 + w7 - w3 - (w3 >> 1)                                    */
  669|  4.74k|    temp4 = _mm_add_epi32(resq_r1_1, resq_r7_1); //w1+w7
  670|  4.74k|    temp12 = _mm_add_epi32(resq_r1_2, resq_r7_2);
  671|  4.74k|    temp4 = _mm_sub_epi32(temp4, resq_r3_1); //w1+w7-w3
  672|  4.74k|    temp12 = _mm_sub_epi32(temp12, resq_r3_2);
  673|  4.74k|    temp5 = _mm_srai_epi32(resq_r3_1, 1); //w3>>1
  674|  4.74k|    temp13 = _mm_srai_epi32(resq_r3_2, 1);
  675|  4.74k|    temp4 = _mm_sub_epi32(temp4, temp5); //w1+w7-w3-(w3>>1)
  676|  4.74k|    temp12 = _mm_sub_epi32(temp12, temp13);
  677|  4.74k|    temp4 = _mm_packs_epi32(temp4, temp12);
  678|       |    /* y4 = (w2 >> 1) - w6                                              */
  679|  4.74k|    temp5 = _mm_srai_epi16(resq_r2_2, 1); //w2>>1
  680|  4.74k|    temp5 = _mm_sub_epi16(temp5, resq_r6_2); //(w2>>1)-w6
  681|       |    /* y5 = -w1 + w7 + w5 + (w5 >> 1)                                   */
  682|  4.74k|    temp6 = _mm_sub_epi32(resq_r7_1, resq_r1_1); //w7-w1
  683|  4.74k|    temp14 = _mm_sub_epi32(resq_r7_2, resq_r1_2);
  684|  4.74k|    temp6 = _mm_add_epi32(temp6, resq_r5_1); //w7-w1+w5
  685|  4.74k|    temp14 = _mm_add_epi32(temp14, resq_r5_2);
  686|  4.74k|    temp7 = _mm_srai_epi32(resq_r5_1, 1); //w5>>1
  687|  4.74k|    temp15 = _mm_srai_epi32(resq_r5_2, 1);
  688|  4.74k|    temp6 = _mm_add_epi32(temp6, temp7); //w7-w1_w5+(w5>>1)
  689|  4.74k|    temp14 = _mm_add_epi32(temp14, temp15);
  690|  4.74k|    temp6 = _mm_packs_epi32(temp6, temp14);
  691|       |    /* y6 = w2 + (w6 >> 1)                                              */
  692|  4.74k|    temp7 = _mm_srai_epi16(resq_r6_2, 1); //w6>>1
  693|  4.74k|    temp7 = _mm_add_epi16(temp7, resq_r2_2); //(w6>>1)+w2
  694|       |    /* y7 = w3 + w5 + w1 + (w1 >> 1)                                    */
  695|  4.74k|    temp8 = _mm_add_epi32(resq_r3_1, resq_r5_1); //w3+w5
  696|  4.74k|    temp16 = _mm_add_epi32(resq_r3_2, resq_r5_2);
  697|  4.74k|    temp8 = _mm_add_epi32(temp8, resq_r1_1); //w3+w5+w1
  698|  4.74k|    temp16 = _mm_add_epi32(temp16, resq_r1_2);
  699|  4.74k|    temp17 = _mm_srai_epi32(resq_r1_1, 1); //w1>>1
  700|  4.74k|    temp18 = _mm_srai_epi32(resq_r1_2, 1);
  701|  4.74k|    temp8 = _mm_add_epi32(temp8, temp17); //w3+w5+w1+(w1>>1)
  702|  4.74k|    temp16 = _mm_add_epi32(temp16, temp18);
  703|  4.74k|    temp8 = _mm_packs_epi32(temp8, temp16);
  704|       |    /*------------------------------------------------------------------*/
  705|       |    /*------------------------------------------------------------------*/
  706|       |    /* z0 = y0 + y6                                                        */
  707|  4.74k|    resq_r0_1 = _mm_add_epi16(temp1, temp7);
  708|       |    /* z1 = y1 + (y7 >> 2)                                                */
  709|  4.74k|    resq_r1_1 = _mm_srai_epi16(temp8, 2);
  710|  4.74k|    resq_r1_1 = _mm_add_epi16(resq_r1_1, temp2);
  711|       |    /* z2 = y2 + y4                                                        */
  712|  4.74k|    resq_r2_1 = _mm_add_epi16(temp3, temp5);
  713|       |    /* z3 = y3 + (y5 >> 2)                                                */
  714|  4.74k|    resq_r3_1 = _mm_srai_epi16(temp6, 2);
  715|  4.74k|    resq_r3_1 = _mm_add_epi16(resq_r3_1, temp4);
  716|       |    /* z4 = y2 - y4                                                        */
  717|  4.74k|    resq_r4_1 = _mm_sub_epi16(temp3, temp5);
  718|       |    /* z5 = (y3 >> 2) - y5                                                 */
  719|  4.74k|    resq_r5_1 = _mm_srai_epi16(temp4, 2);
  720|  4.74k|    resq_r5_1 = _mm_sub_epi16(resq_r5_1, temp6);
  721|       |    /* z6 = y0 - y6                                                     */
  722|  4.74k|    resq_r6_1 = _mm_sub_epi16(temp1, temp7);
  723|       |    /* z7 = y7 - (y1 >> 2)                                                 */
  724|  4.74k|    resq_r7_1 = _mm_srai_epi16(temp2, 2);
  725|  4.74k|    resq_r7_1 = _mm_sub_epi16(temp8, resq_r7_1);
  726|       |    /*------------------------------------------------------------------*/
  727|       |    /*------------------------------------------------------------------*/
  728|       |    /* x0 = z0 + z7                                                        */
  729|  4.74k|    temp1 = _mm_add_epi16(resq_r0_1, resq_r7_1);
  730|       |    /* x1 = z2 + z5                                                        */
  731|  4.74k|    temp2 = _mm_add_epi16(resq_r2_1, resq_r5_1);
  732|       |    /* x2 = z4 + z3                                                        */
  733|  4.74k|    temp3 = _mm_add_epi16(resq_r4_1, resq_r3_1);
  734|       |    /* x3 = z6 + z1                                                        */
  735|  4.74k|    temp4 = _mm_add_epi16(resq_r6_1, resq_r1_1);
  736|       |    /* x4 = z6 - z1                                                        */
  737|  4.74k|    temp5 = _mm_sub_epi16(resq_r6_1, resq_r1_1);
  738|       |    /* x5 = z4 - z3                                                        */
  739|  4.74k|    temp6 = _mm_sub_epi16(resq_r4_1, resq_r3_1);
  740|       |    /* x6 = z2 - z5                                                        */
  741|  4.74k|    temp7 = _mm_sub_epi16(resq_r2_1, resq_r5_1);
  742|       |    /* x7 = z0 - z7                                                        */
  743|  4.74k|    temp8 = _mm_sub_epi16(resq_r0_1, resq_r7_1);
  744|       |    /*------------------------------------------------------------------*/
  745|       |    // Matrix transpose
  746|       |    /*
  747|       |     *  a0 b0 c0 d0 e0 f0 g0 h0
  748|       |     *  a1 b1 c1 d1 e1 f1 g1 h1
  749|       |     *  a2 b2 c2 d2 e2 f2 g2 h2
  750|       |     *  a3 b3 c3 d3 e3 f3 g3 h3
  751|       |     */
  752|  4.74k|    temp17 = _mm_unpacklo_epi16(temp1, temp2); //a0 a1 b0 b1 c0 c1 d0 d1
  753|  4.74k|    temp19 = _mm_unpacklo_epi16(temp3, temp4); //a2 a3 b2 b3 c2 c3 d2 d3
  754|  4.74k|    temp18 = _mm_unpackhi_epi16(temp1, temp2); //e0 e1 f0 f1 g0 g1 h0 h1
  755|  4.74k|    temp20 = _mm_unpackhi_epi16(temp3, temp4); //e2 e3 f2 f3 g2 g3 h2 h3
  756|       |
  757|  4.74k|    resq_r0_1 = _mm_unpacklo_epi32(temp17, temp19); //a0 a1 a2 a3 b0 b1 b2 b3
  758|  4.74k|    resq_r1_1 = _mm_unpackhi_epi32(temp17, temp19); //c0 c1 c2 c3 d0 d1 d2 d3
  759|  4.74k|    resq_r2_1 = _mm_unpacklo_epi32(temp18, temp20); //e0 e1 e2 e3 f0 f1 f2 f3
  760|  4.74k|    resq_r3_1 = _mm_unpackhi_epi32(temp18, temp20); //g0 g2 g2 g3 h0 h1 h2 h3
  761|       |    /*
  762|       |     *  a4 b4 c4 d4 e4 f4 g4 h4
  763|       |     *  a5 b5 c5 d5 e5 f5 g5 h5
  764|       |     *  a6 b6 c6 d6 e6 f6 g6 h6
  765|       |     *  a7 b7 c7 d7 e7 f7 g7 h7
  766|       |     */
  767|  4.74k|    temp17 = _mm_unpacklo_epi16(temp5, temp6); //a4 a5 b4 b5 c4 c5 d4 d5
  768|  4.74k|    temp19 = _mm_unpacklo_epi16(temp7, temp8); //a6 a7 b6 b7 c6 c7 d6 d7
  769|  4.74k|    temp18 = _mm_unpackhi_epi16(temp5, temp6); //e4 e5 f4 f5 g4 g5 h4 h5
  770|  4.74k|    temp20 = _mm_unpackhi_epi16(temp7, temp8); //e6 e7 f6 f7 g6 g7 h6 h7
  771|       |
  772|  4.74k|    resq_r4_1 = _mm_unpacklo_epi32(temp17, temp19); //a4 a5 a6 a7 b4 b5 b6 b7
  773|  4.74k|    resq_r5_1 = _mm_unpackhi_epi32(temp17, temp19); //c4 c5 c6 c7 d4 d5 d6 d7
  774|  4.74k|    resq_r6_1 = _mm_unpacklo_epi32(temp18, temp20); //e4 e5 e6 e7 f4 f5 f6 f7
  775|  4.74k|    resq_r7_1 = _mm_unpackhi_epi32(temp18, temp20); //g4 g5 g6 g7 h4 h5 h6 h7
  776|       |    /*  a0 a1 a2 a3 b0 b1 b2 b3
  777|       |     *  c0 c1 c2 c3 d0 d1 d2 d3
  778|       |     *  e0 e1 e2 e3 f0 f1 f2 f3
  779|       |     *  g0 g2 g2 g3 h0 h1 h2 h3
  780|       |     *  a4 a5 a6 a7 b4 b5 b6 b7
  781|       |     *  c4 c5 c6 c7 d4 d5 d6 d7
  782|       |     *  e4 e5 e6 e7 f4 f5 f6 f7
  783|       |     *  g4 g5 g6 g7 h4 h5 h6 h7
  784|       |     */
  785|  4.74k|    resq_r0_2 = _mm_unpacklo_epi64(resq_r0_1, resq_r4_1); //a0 a1 a2 a3 a4 a5 a6 a7
  786|  4.74k|    resq_r1_2 = _mm_unpackhi_epi64(resq_r0_1, resq_r4_1); //b0 b1 b2 b3 b4 b5 b6 b7
  787|  4.74k|    resq_r2_2 = _mm_unpacklo_epi64(resq_r1_1, resq_r5_1); //c0 c1 c2 c3 c4 c5 c6 c7
  788|  4.74k|    resq_r3_2 = _mm_unpackhi_epi64(resq_r1_1, resq_r5_1); //d0 d1 d2 d3 d4 d5 d6 d7
  789|  4.74k|    resq_r4_2 = _mm_unpacklo_epi64(resq_r2_1, resq_r6_1); //e0 e1 e2 e3 e4 e5 e6 e7
  790|  4.74k|    resq_r5_2 = _mm_unpackhi_epi64(resq_r2_1, resq_r6_1); //f0 f1 f2 f3 f4 f5 f6 f7
  791|  4.74k|    resq_r6_2 = _mm_unpacklo_epi64(resq_r3_1, resq_r7_1); //g0 g1 g2 g3 g4 g5 g6 g7
  792|  4.74k|    resq_r7_2 = _mm_unpackhi_epi64(resq_r3_1, resq_r7_1); //h0 h1 h2 h3 h4 h5 h6 h7
  793|       |
  794|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r1_2);
  795|  4.74k|    resq_r1_1 = _mm_unpacklo_epi16(resq_r1_2, sign_reg); //a1 b1 c1 d1 -- 32 bit
  796|  4.74k|    resq_r1_2 = _mm_unpackhi_epi16(resq_r1_2, sign_reg); //e1 f1 g1 h1 -- 32 bit
  797|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r3_2);
  798|  4.74k|    resq_r3_1 = _mm_unpacklo_epi16(resq_r3_2, sign_reg); //a3 b3 c3 d3 -- 32 bit
  799|  4.74k|    resq_r3_2 = _mm_unpackhi_epi16(resq_r3_2, sign_reg); //e3 f3 g3 h3 -- 32 bit
  800|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r5_2);
  801|  4.74k|    resq_r5_1 = _mm_unpacklo_epi16(resq_r5_2, sign_reg); //a5 b5 c5 d5 -- 32 bit
  802|  4.74k|    resq_r5_2 = _mm_unpackhi_epi16(resq_r5_2, sign_reg); //e5 f5 g5 h5 -- 32 bit
  803|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r7_2);
  804|  4.74k|    resq_r7_1 = _mm_unpacklo_epi16(resq_r7_2, sign_reg); //a7 b7 c7 d7 -- 32 bit
  805|  4.74k|    resq_r7_2 = _mm_unpackhi_epi16(resq_r7_2, sign_reg); //e7 f7 g7 h7 -- 32 bit
  806|       |
  807|  4.74k|    zero_8x16b = _mm_setzero_si128(); // all bits reset to zero
  808|       |    //Load pred buffer row 0
  809|  4.74k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[0])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  810|  4.74k|    pred_r0_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  811|       |    //Load pred buffer row 1
  812|  4.74k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[pred_strd])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  813|  4.74k|    pred_r1_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  814|       |    //Load pred buffer row 2
  815|  4.74k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[2 * pred_strd])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  816|  4.74k|    pred_r2_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  817|       |    //Load pred buffer row 3
  818|  4.74k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[3 * pred_strd])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  819|  4.74k|    pred_r3_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  820|       |    //Load pred buffer row 4
  821|  4.74k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[4 * pred_strd])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  822|  4.74k|    pred_r4_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  823|       |    //Load pred buffer row 5
  824|  4.74k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[5 * pred_strd])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bit
  825|  4.74k|    pred_r5_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  826|       |    //Load pred buffer row 6
  827|  4.74k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[6 * pred_strd])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  828|  4.74k|    pred_r6_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  829|       |    //Load pred buffer row 7
  830|  4.74k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[7 * pred_strd])); //p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  831|  4.74k|    pred_r7_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b); //p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  832|       |
  833|       |    /*--------------------------------------------------------------------*/
  834|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6            */
  835|       |    /*                                                                    */
  836|       |    /* Add the prediction and store it back to reconstructed frame buffer */
  837|       |    /* [Prediction buffer itself in this case]                            */
  838|       |    /*--------------------------------------------------------------------*/
  839|       |
  840|       |    /* y0j = w0j + w4j                                                     */
  841|  4.74k|    temp1 = _mm_add_epi16(resq_r0_2, resq_r4_2);
  842|       |    /* y2j = w0j - w4j                                                      */
  843|  4.74k|    temp3 = _mm_sub_epi16(resq_r0_2, resq_r4_2);
  844|       |    /* y1j = -w3j + w5j - w7j - (w7j >> 1)                                   */
  845|  4.74k|    temp2 = _mm_sub_epi32(resq_r5_1, resq_r3_1); //-w3+w5
  846|  4.74k|    temp10 = _mm_sub_epi32(resq_r5_2, resq_r3_2);
  847|  4.74k|    temp4 = _mm_sub_epi32(temp2, resq_r7_1); //-w3+w5-w7
  848|  4.74k|    temp12 = _mm_sub_epi32(temp10, resq_r7_2);
  849|  4.74k|    temp5 = _mm_srai_epi32(resq_r7_1, 1); //w7>>1
  850|  4.74k|    temp13 = _mm_srai_epi32(resq_r7_2, 1);
  851|  4.74k|    temp2 = _mm_sub_epi32(temp4, temp5); //-w3+w5-w7 -(w7>>1)
  852|  4.74k|    temp10 = _mm_sub_epi32(temp12, temp13);
  853|  4.74k|    temp2 = _mm_packs_epi32(temp2, temp10);
  854|       |    /* y3j = w1j + w7j - w3j - (w3j >> 1)                                    */
  855|  4.74k|    temp4 = _mm_add_epi32(resq_r1_1, resq_r7_1); //w1+w7
  856|  4.74k|    temp12 = _mm_add_epi32(resq_r1_2, resq_r7_2);
  857|  4.74k|    temp4 = _mm_sub_epi32(temp4, resq_r3_1); //w1+w7-w3
  858|  4.74k|    temp12 = _mm_sub_epi32(temp12, resq_r3_2);
  859|  4.74k|    temp5 = _mm_srai_epi32(resq_r3_1, 1); //w3>>1
  860|  4.74k|    temp13 = _mm_srai_epi32(resq_r3_2, 1);
  861|  4.74k|    temp4 = _mm_sub_epi32(temp4, temp5); //w1+w7-w3-(w3>>1)
  862|  4.74k|    temp12 = _mm_sub_epi32(temp12, temp13);
  863|  4.74k|    temp4 = _mm_packs_epi32(temp4, temp12);
  864|       |    /* y4j = (w2j >> 1) - w6j                                              */
  865|  4.74k|    temp5 = _mm_srai_epi16(resq_r2_2, 1); //w2>>1
  866|  4.74k|    temp5 = _mm_sub_epi16(temp5, resq_r6_2); //(w2>>1)-w6
  867|       |    /* y5j = -w1j + w7j + w5j + (w5j >> 1)                                   */
  868|  4.74k|    temp6 = _mm_sub_epi32(resq_r7_1, resq_r1_1); //w7-w1
  869|  4.74k|    temp14 = _mm_sub_epi32(resq_r7_2, resq_r1_2);
  870|  4.74k|    temp6 = _mm_add_epi32(temp6, resq_r5_1); //w7-w1+w5
  871|  4.74k|    temp14 = _mm_add_epi32(temp14, resq_r5_2);
  872|  4.74k|    temp7 = _mm_srai_epi32(resq_r5_1, 1); //w5>>1
  873|  4.74k|    temp15 = _mm_srai_epi32(resq_r5_2, 1);
  874|  4.74k|    temp6 = _mm_add_epi32(temp6, temp7); //w7-w1_w5+(w5>>1)
  875|  4.74k|    temp14 = _mm_add_epi32(temp14, temp15);
  876|  4.74k|    temp6 = _mm_packs_epi32(temp6, temp14);
  877|       |    /* y6j = w2j + (w6j >> 1)                                              */
  878|  4.74k|    temp7 = _mm_srai_epi16(resq_r6_2, 1); //w6>>1
  879|  4.74k|    temp7 = _mm_add_epi16(temp7, resq_r2_2); //(w6>>1)+w2
  880|       |    /* y7j = w3j + w5j + w1j + (w1j >> 1)                                    */
  881|  4.74k|    temp8 = _mm_add_epi32(resq_r3_1, resq_r5_1); //w3+w5
  882|  4.74k|    temp16 = _mm_add_epi32(resq_r3_2, resq_r5_2);
  883|  4.74k|    temp8 = _mm_add_epi32(temp8, resq_r1_1); //w3+w5+w1
  884|  4.74k|    temp16 = _mm_add_epi32(temp16, resq_r1_2);
  885|  4.74k|    temp17 = _mm_srai_epi32(resq_r1_1, 1); //w1>>1
  886|  4.74k|    temp18 = _mm_srai_epi32(resq_r1_2, 1);
  887|  4.74k|    temp8 = _mm_add_epi32(temp8, temp17); //w3+w5+w1+(w1>>1)
  888|  4.74k|    temp16 = _mm_add_epi32(temp16, temp18);
  889|  4.74k|    temp8 = _mm_packs_epi32(temp8, temp16);
  890|       |    /*------------------------------------------------------------------*/
  891|       |    /*------------------------------------------------------------------*/
  892|       |    /* z0j = y0j + y6j                                                        */
  893|  4.74k|    resq_r0_1 = _mm_add_epi16(temp1, temp7);
  894|       |    /* z1j = y1j + (y7j >> 2)                                                */
  895|  4.74k|    resq_r1_1 = _mm_srai_epi16(temp8, 2);
  896|  4.74k|    resq_r1_1 = _mm_add_epi16(resq_r1_1, temp2);
  897|       |    /* z2j = y2j + y4j                                                        */
  898|  4.74k|    resq_r2_1 = _mm_add_epi16(temp3, temp5);
  899|       |    /* z3j = y3j + (y5j >> 2)                                                */
  900|  4.74k|    resq_r3_1 = _mm_srai_epi16(temp6, 2);
  901|  4.74k|    resq_r3_1 = _mm_add_epi16(resq_r3_1, temp4);
  902|       |    /* z4j = y2j - y4j                                                        */
  903|  4.74k|    resq_r4_1 = _mm_sub_epi16(temp3, temp5);
  904|       |    /* z5j = (y3j >> 2) - y5j                                                 */
  905|  4.74k|    resq_r5_1 = _mm_srai_epi16(temp4, 2);
  906|  4.74k|    resq_r5_1 = _mm_sub_epi16(resq_r5_1, temp6);
  907|       |    /* z6j = y0j - y6j                                                     */
  908|  4.74k|    resq_r6_1 = _mm_sub_epi16(temp1, temp7);
  909|       |    /* z7j = y7j - (y1j >> 2)                                                 */
  910|  4.74k|    resq_r7_1 = _mm_srai_epi16(temp2, 2);
  911|  4.74k|    resq_r7_1 = _mm_sub_epi16(temp8, resq_r7_1);
  912|       |    /*------------------------------------------------------------------*/
  913|       |
  914|       |    /*------------------------------------------------------------------*/
  915|       |    /* x0j = z0j + z7j                                                        */
  916|  4.74k|    temp1 = _mm_add_epi16(resq_r0_1, resq_r7_1);
  917|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp1);
  918|  4.74k|    temp10 = _mm_unpacklo_epi16(temp1, sign_reg);
  919|  4.74k|    temp11 = _mm_unpackhi_epi16(temp1, sign_reg);
  920|  4.74k|    temp10 = _mm_add_epi32(temp10, value_32);
  921|  4.74k|    temp11 = _mm_add_epi32(temp11, value_32);
  922|  4.74k|    temp10 = _mm_srai_epi32(temp10, 6);
  923|  4.74k|    temp11 = _mm_srai_epi32(temp11, 6);
  924|  4.74k|    temp10 = _mm_packs_epi32(temp10, temp11);
  925|  4.74k|    temp1 = _mm_add_epi16(temp10, pred_r0_1);
  926|       |    /* x1j = z2j + z5j                                                        */
  927|  4.74k|    temp2 = _mm_add_epi16(resq_r2_1, resq_r5_1);
  928|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp2);
  929|  4.74k|    temp10 = _mm_unpacklo_epi16(temp2, sign_reg);
  930|  4.74k|    temp11 = _mm_unpackhi_epi16(temp2, sign_reg);
  931|  4.74k|    temp10 = _mm_add_epi32(temp10, value_32);
  932|  4.74k|    temp11 = _mm_add_epi32(temp11, value_32);
  933|  4.74k|    temp10 = _mm_srai_epi32(temp10, 6);
  934|  4.74k|    temp11 = _mm_srai_epi32(temp11, 6);
  935|  4.74k|    temp10 = _mm_packs_epi32(temp10, temp11);
  936|  4.74k|    temp2 = _mm_add_epi16(temp10, pred_r1_1);
  937|       |    /* x2j = z4j + z3j                                                        */
  938|  4.74k|    temp3 = _mm_add_epi16(resq_r4_1, resq_r3_1);
  939|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp3);
  940|  4.74k|    temp10 = _mm_unpacklo_epi16(temp3, sign_reg);
  941|  4.74k|    temp11 = _mm_unpackhi_epi16(temp3, sign_reg);
  942|  4.74k|    temp10 = _mm_add_epi32(temp10, value_32);
  943|  4.74k|    temp11 = _mm_add_epi32(temp11, value_32);
  944|  4.74k|    temp10 = _mm_srai_epi32(temp10, 6);
  945|  4.74k|    temp11 = _mm_srai_epi32(temp11, 6);
  946|  4.74k|    temp10 = _mm_packs_epi32(temp10, temp11);
  947|  4.74k|    temp3 = _mm_add_epi16(temp10, pred_r2_1);
  948|       |    /* x3j = z6j + z1j                                                        */
  949|  4.74k|    temp4 = _mm_add_epi16(resq_r6_1, resq_r1_1);
  950|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp4);
  951|  4.74k|    temp10 = _mm_unpacklo_epi16(temp4, sign_reg);
  952|  4.74k|    temp11 = _mm_unpackhi_epi16(temp4, sign_reg);
  953|  4.74k|    temp10 = _mm_add_epi32(temp10, value_32);
  954|  4.74k|    temp11 = _mm_add_epi32(temp11, value_32);
  955|  4.74k|    temp10 = _mm_srai_epi32(temp10, 6);
  956|  4.74k|    temp11 = _mm_srai_epi32(temp11, 6);
  957|  4.74k|    temp10 = _mm_packs_epi32(temp10, temp11);
  958|  4.74k|    temp4 = _mm_add_epi16(temp10, pred_r3_1);
  959|       |    /* x4j = z6j - z1j                                                        */
  960|  4.74k|    temp5 = _mm_sub_epi16(resq_r6_1, resq_r1_1);
  961|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp5);
  962|  4.74k|    temp10 = _mm_unpacklo_epi16(temp5, sign_reg);
  963|  4.74k|    temp11 = _mm_unpackhi_epi16(temp5, sign_reg);
  964|  4.74k|    temp10 = _mm_add_epi32(temp10, value_32);
  965|  4.74k|    temp11 = _mm_add_epi32(temp11, value_32);
  966|  4.74k|    temp10 = _mm_srai_epi32(temp10, 6);
  967|  4.74k|    temp11 = _mm_srai_epi32(temp11, 6);
  968|  4.74k|    temp10 = _mm_packs_epi32(temp10, temp11);
  969|  4.74k|    temp5 = _mm_add_epi16(temp10, pred_r4_1);
  970|       |    /* x5j = z4j - z3j                                                        */
  971|  4.74k|    temp6 = _mm_sub_epi16(resq_r4_1, resq_r3_1);
  972|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp6);
  973|  4.74k|    temp10 = _mm_unpacklo_epi16(temp6, sign_reg);
  974|  4.74k|    temp11 = _mm_unpackhi_epi16(temp6, sign_reg);
  975|  4.74k|    temp10 = _mm_add_epi32(temp10, value_32);
  976|  4.74k|    temp11 = _mm_add_epi32(temp11, value_32);
  977|  4.74k|    temp10 = _mm_srai_epi32(temp10, 6);
  978|  4.74k|    temp11 = _mm_srai_epi32(temp11, 6);
  979|  4.74k|    temp10 = _mm_packs_epi32(temp10, temp11);
  980|  4.74k|    temp6 = _mm_add_epi16(temp10, pred_r5_1);
  981|       |    /* x6j = z2j - z5j                                                        */
  982|  4.74k|    temp7 = _mm_sub_epi16(resq_r2_1, resq_r5_1);
  983|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp7);
  984|  4.74k|    temp10 = _mm_unpacklo_epi16(temp7, sign_reg);
  985|  4.74k|    temp11 = _mm_unpackhi_epi16(temp7, sign_reg);
  986|  4.74k|    temp10 = _mm_add_epi32(temp10, value_32);
  987|  4.74k|    temp11 = _mm_add_epi32(temp11, value_32);
  988|  4.74k|    temp10 = _mm_srai_epi32(temp10, 6);
  989|  4.74k|    temp11 = _mm_srai_epi32(temp11, 6);
  990|  4.74k|    temp10 = _mm_packs_epi32(temp10, temp11);
  991|  4.74k|    temp7 = _mm_add_epi16(temp10, pred_r6_1);
  992|       |    /* x7j = z0j - z7j                                                        */
  993|  4.74k|    temp8 = _mm_sub_epi16(resq_r0_1, resq_r7_1);
  994|  4.74k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp8);
  995|  4.74k|    temp10 = _mm_unpacklo_epi16(temp8, sign_reg);
  996|  4.74k|    temp11 = _mm_unpackhi_epi16(temp8, sign_reg);
  997|  4.74k|    temp10 = _mm_add_epi32(temp10, value_32);
  998|  4.74k|    temp11 = _mm_add_epi32(temp11, value_32);
  999|  4.74k|    temp10 = _mm_srai_epi32(temp10, 6);
 1000|  4.74k|    temp11 = _mm_srai_epi32(temp11, 6);
 1001|  4.74k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1002|  4.74k|    temp8 = _mm_add_epi16(temp10, pred_r7_1);
 1003|       |    /*------------------------------------------------------------------*/
 1004|       |    //Clipping the results to 8 bits
 1005|  4.74k|    sign_reg = _mm_cmpgt_epi16(temp1, zero_8x16b); // sign check
 1006|  4.74k|    temp1 = _mm_and_si128(temp1, sign_reg);
 1007|  4.74k|    sign_reg = _mm_cmpgt_epi16(temp2, zero_8x16b); // sign check
 1008|  4.74k|    temp2 = _mm_and_si128(temp2, sign_reg);
 1009|  4.74k|    sign_reg = _mm_cmpgt_epi16(temp3, zero_8x16b); // sign check
 1010|  4.74k|    temp3 = _mm_and_si128(temp3, sign_reg);
 1011|  4.74k|    sign_reg = _mm_cmpgt_epi16(temp4, zero_8x16b); // sign check
 1012|  4.74k|    temp4 = _mm_and_si128(temp4, sign_reg);
 1013|  4.74k|    sign_reg = _mm_cmpgt_epi16(temp5, zero_8x16b); // sign check
 1014|  4.74k|    temp5 = _mm_and_si128(temp5, sign_reg);
 1015|  4.74k|    sign_reg = _mm_cmpgt_epi16(temp6, zero_8x16b); // sign check
 1016|  4.74k|    temp6 = _mm_and_si128(temp6, sign_reg);
 1017|  4.74k|    sign_reg = _mm_cmpgt_epi16(temp7, zero_8x16b); // sign check
 1018|  4.74k|    temp7 = _mm_and_si128(temp7, sign_reg);
 1019|  4.74k|    sign_reg = _mm_cmpgt_epi16(temp8, zero_8x16b); // sign check
 1020|  4.74k|    temp8 = _mm_and_si128(temp8, sign_reg);
 1021|       |
 1022|  4.74k|    resq_r0_2 = _mm_packus_epi16(temp1, zero_8x16b);
 1023|  4.74k|    resq_r1_2 = _mm_packus_epi16(temp2, zero_8x16b);
 1024|  4.74k|    resq_r2_2 = _mm_packus_epi16(temp3, zero_8x16b);
 1025|  4.74k|    resq_r3_2 = _mm_packus_epi16(temp4, zero_8x16b);
 1026|  4.74k|    resq_r4_2 = _mm_packus_epi16(temp5, zero_8x16b);
 1027|  4.74k|    resq_r5_2 = _mm_packus_epi16(temp6, zero_8x16b);
 1028|  4.74k|    resq_r6_2 = _mm_packus_epi16(temp7, zero_8x16b);
 1029|  4.74k|    resq_r7_2 = _mm_packus_epi16(temp8, zero_8x16b);
 1030|       |
 1031|  4.74k|    _mm_storel_epi64((__m128i *) (&pu1_out[0]), resq_r0_2);
 1032|  4.74k|    _mm_storel_epi64((__m128i *) (&pu1_out[out_strd]), resq_r1_2);
 1033|  4.74k|    _mm_storel_epi64((__m128i *) (&pu1_out[2 * out_strd]), resq_r2_2);
 1034|  4.74k|    _mm_storel_epi64((__m128i *) (&pu1_out[3 * out_strd]), resq_r3_2);
 1035|  4.74k|    _mm_storel_epi64((__m128i *) (&pu1_out[4 * out_strd]), resq_r4_2);
 1036|  4.74k|    _mm_storel_epi64((__m128i *) (&pu1_out[5 * out_strd]), resq_r5_2);
 1037|  4.74k|    _mm_storel_epi64((__m128i *) (&pu1_out[6 * out_strd]), resq_r6_2);
 1038|  4.74k|    _mm_storel_epi64((__m128i *) (&pu1_out[7 * out_strd]), resq_r7_2);
 1039|  4.74k|}

ih264_intra_pred_luma_4x4_mode_vert_ssse3:
  122|    286|{
  123|    286|    UWORD8 *pu1_top;
  124|    286|    WORD32 dst_strd2, dst_strd3;
  125|    286|    WORD32 i4_top;
  126|       |
  127|    286|    UNUSED(src_strd);
  ------------------
  |  |   45|    286|#define UNUSED(x) ((void)(x))
  ------------------
  128|    286|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    286|#define UNUSED(x) ((void)(x))
  ------------------
  129|       |
  130|    286|    pu1_top = pu1_src + BLK_SIZE + 1;
  ------------------
  |  |  511|    286|#define BLK_SIZE            4
  ------------------
  131|       |
  132|    286|    i4_top = *((WORD32 *)pu1_top);
  133|       |
  134|    286|    dst_strd2 = dst_strd << 1;
  135|    286|    dst_strd3 = dst_strd + dst_strd2;
  136|       |
  137|    286|    *((WORD32 *)(pu1_dst)) = i4_top;
  138|    286|    *((WORD32 *)(pu1_dst + dst_strd)) = i4_top;
  139|    286|    *((WORD32 *)(pu1_dst + dst_strd2)) = i4_top;
  140|    286|    *((WORD32 *)(pu1_dst + dst_strd3)) = i4_top;
  141|    286|}
ih264_intra_pred_luma_4x4_mode_horz_ssse3:
  181|     75|{
  182|     75|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
  183|     75|    WORD32 row1,row2,row3,row4;
  184|     75|    UWORD8 val;
  185|     75|    WORD32 dst_strd2, dst_strd3;
  186|       |
  187|     75|    UNUSED(src_strd);
  ------------------
  |  |   45|     75|#define UNUSED(x) ((void)(x))
  ------------------
  188|     75|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|     75|#define UNUSED(x) ((void)(x))
  ------------------
  189|     75|    pu1_left = pu1_src + BLK_SIZE - 1;
  ------------------
  |  |  511|     75|#define BLK_SIZE            4
  ------------------
  190|       |
  191|     75|    val  = *pu1_left;
  192|     75|    row1 = val + (val << 8) + (val << 16) + (val << 24);
  193|     75|    val  = *(pu1_left - 1);
  194|     75|    row2 = val + (val << 8) + (val << 16) + (val << 24);
  195|     75|    val  = *(pu1_left - 2);
  196|     75|    row3 = val + (val << 8) + (val << 16) + (val << 24);
  197|     75|    val  = *(pu1_left - 3);
  198|     75|    row4 = val + (val << 8) + (val << 16) + (val << 24);
  199|       |
  200|     75|    dst_strd2 = dst_strd << 1;
  201|     75|    dst_strd3 = dst_strd + dst_strd2;
  202|       |
  203|     75|    *((WORD32 *)(pu1_dst)) = row1;
  204|     75|    *((WORD32 *)(pu1_dst + dst_strd)) = row2;
  205|     75|    *((WORD32 *)(pu1_dst + dst_strd2)) = row3;
  206|     75|    *((WORD32 *)(pu1_dst + dst_strd3)) = row4;
  207|     75|}
ih264_intra_pred_luma_4x4_mode_dc_ssse3:
  246|  3.99k|{
  247|  3.99k|    UWORD8 u1_useleft; /* availability of left predictors (only for DC) */
  248|  3.99k|    UWORD8 u1_usetop; /* availability of top predictors (only for DC) */
  249|  3.99k|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
  250|  3.99k|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
  251|  3.99k|    WORD32 dst_strd2, dst_strd3;
  252|  3.99k|    WORD32 val = 0;
  253|  3.99k|    UNUSED(src_strd);
  ------------------
  |  |   45|  3.99k|#define UNUSED(x) ((void)(x))
  ------------------
  254|  3.99k|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|  3.99k|#define UNUSED(x) ((void)(x))
  ------------------
  255|  3.99k|    u1_useleft = BOOLEAN(ngbr_avail & LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|  3.99k|#define BOOLEAN(x) (!!(x))
  ------------------
  256|  3.99k|    u1_usetop = BOOLEAN(ngbr_avail & TOP_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|  3.99k|#define BOOLEAN(x) (!!(x))
  ------------------
  257|  3.99k|    pu1_top = pu1_src + BLK_SIZE + 1;
  ------------------
  |  |  511|  3.99k|#define BLK_SIZE            4
  ------------------
  258|  3.99k|    pu1_left = pu1_src + BLK_SIZE - 1;
  ------------------
  |  |  511|  3.99k|#define BLK_SIZE            4
  ------------------
  259|       |
  260|  3.99k|    if(u1_useleft)
  ------------------
  |  Branch (260:8): [True: 2.83k, False: 1.16k]
  ------------------
  261|  2.83k|    {
  262|  2.83k|        val += *pu1_left--;
  263|  2.83k|        val += *pu1_left--;
  264|  2.83k|        val += *pu1_left--;
  265|  2.83k|        val += *pu1_left + 2;
  266|  2.83k|    }
  267|  3.99k|    if(u1_usetop)
  ------------------
  |  Branch (267:8): [True: 2.84k, False: 1.14k]
  ------------------
  268|  2.84k|    {
  269|  2.84k|        val += *pu1_top + *(pu1_top + 1) + *(pu1_top + 2) + *(pu1_top + 3)
  270|  2.84k|                        + 2;
  271|  2.84k|    }
  272|       |    /* Since 2 is added if either left/top pred is there,
  273|       |     val still being zero implies both preds are not there */
  274|  3.99k|    val = (val) ? (val >> (1 + u1_useleft + u1_usetop)) : 128;
  ------------------
  |  Branch (274:11): [True: 3.70k, False: 284]
  ------------------
  275|       |
  276|  3.99k|    val = val + (val << 8) + (val << 16) + (val << 24);
  277|       |
  278|  3.99k|    dst_strd2 = dst_strd << 1;
  279|  3.99k|    dst_strd3 = dst_strd + dst_strd2;
  280|       |
  281|  3.99k|    *((WORD32 *)(pu1_dst)) = val;
  282|  3.99k|    *((WORD32 *)(pu1_dst + dst_strd)) = val;
  283|  3.99k|    *((WORD32 *)(pu1_dst + dst_strd2)) = val;
  284|  3.99k|    *((WORD32 *)(pu1_dst + dst_strd3)) = val;
  285|  3.99k|}
ih264_intra_pred_luma_4x4_mode_diag_dl_ssse3:
  324|    394|{
  325|    394|    UWORD8 *pu1_top;
  326|    394|    WORD32 dst_strd2, dst_strd3;
  327|       |
  328|    394|    __m128i top_16x8b, top_8x16b, top_sh_8x16b;
  329|    394|    __m128i res1_8x16b, res2_8x16b, res_16x8b;
  330|    394|    __m128i zero_vector, const_2_8x16b;
  331|    394|    WORD32 row1,row2,row3,row4;
  332|       |
  333|    394|    UNUSED(src_strd);
  ------------------
  |  |   45|    394|#define UNUSED(x) ((void)(x))
  ------------------
  334|    394|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    394|#define UNUSED(x) ((void)(x))
  ------------------
  335|       |
  336|    394|    pu1_top = pu1_src + BLK_SIZE + 1;
  ------------------
  |  |  511|    394|#define BLK_SIZE            4
  ------------------
  337|       |
  338|    394|    top_16x8b = _mm_loadl_epi64((__m128i *)pu1_top);
  339|    394|    zero_vector = _mm_setzero_si128();
  340|    394|    top_8x16b = _mm_unpacklo_epi8(top_16x8b, zero_vector);    //t0 t1 t2 t3 t4 t5 t6 t7
  341|       |
  342|    394|    top_sh_8x16b = _mm_srli_si128(top_8x16b, 2);              //t1 t2 t3 t4 t5 t6 t7 0
  343|    394|    const_2_8x16b = _mm_set1_epi16(2);
  344|       |
  345|    394|    top_sh_8x16b = _mm_shufflehi_epi16(top_sh_8x16b, 0xa4);   //t1 t2 t3 t4 t5 t6 t7 t7
  346|    394|    res1_8x16b = _mm_add_epi16(top_8x16b, top_sh_8x16b);
  347|    394|    res2_8x16b = _mm_srli_si128(res1_8x16b, 2);
  348|       |
  349|    394|    res1_8x16b = _mm_add_epi16(res1_8x16b, const_2_8x16b);
  350|    394|    res1_8x16b = _mm_add_epi16(res2_8x16b, res1_8x16b);
  351|    394|    res1_8x16b = _mm_srai_epi16(res1_8x16b, 2);
  352|       |
  353|    394|    dst_strd2 = dst_strd << 1;
  354|    394|    dst_strd3 = dst_strd + dst_strd2;
  355|       |
  356|    394|    res_16x8b = _mm_packus_epi16(res1_8x16b, res1_8x16b);
  357|    394|    row1 = _mm_cvtsi128_si32(res_16x8b);
  358|    394|    res_16x8b = _mm_srli_si128(res_16x8b, 1);
  359|    394|    row2 = _mm_cvtsi128_si32(res_16x8b);
  360|    394|    res_16x8b = _mm_srli_si128(res_16x8b, 1);
  361|    394|    row3 = _mm_cvtsi128_si32(res_16x8b);
  362|    394|    res_16x8b = _mm_srli_si128(res_16x8b, 1);
  363|    394|    row4 = _mm_cvtsi128_si32(res_16x8b);
  364|       |
  365|    394|    *((WORD32 *)(pu1_dst)) = row1;
  366|    394|    *((WORD32 *)(pu1_dst + dst_strd)) = row2;
  367|    394|    *((WORD32 *)(pu1_dst + dst_strd2)) = row3;
  368|    394|    *((WORD32 *)(pu1_dst + dst_strd3)) = row4;
  369|    394|}
ih264_intra_pred_luma_4x4_mode_diag_dr_ssse3:
  408|     89|{
  409|     89|    UWORD8 *pu1_left;
  410|     89|    WORD32 dst_strd2, dst_strd3;
  411|       |
  412|     89|    __m128i top_left_16x8b, top_left_8x16b;
  413|     89|    __m128i top_left_sh_16x8b, top_left_sh_8x16b;
  414|     89|    __m128i res1_8x16b, res2_8x16b;
  415|     89|    __m128i res1_16x8b, res2_16x8b;
  416|     89|    __m128i zero_vector, const_2_8x16b;
  417|     89|    WORD32 row1,row2,row3,row4;
  418|       |
  419|     89|    UNUSED(src_strd);
  ------------------
  |  |   45|     89|#define UNUSED(x) ((void)(x))
  ------------------
  420|     89|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|     89|#define UNUSED(x) ((void)(x))
  ------------------
  421|       |
  422|     89|    pu1_left = pu1_src + BLK_SIZE - 1;
  ------------------
  |  |  511|     89|#define BLK_SIZE            4
  ------------------
  423|       |
  424|     89|    top_left_16x8b = _mm_loadu_si128((__m128i *)(pu1_left - 3));             //l3 l2 l1 l0 tl t0 t1 t2...
  425|     89|    zero_vector = _mm_setzero_si128();
  426|     89|    top_left_sh_16x8b = _mm_srli_si128(top_left_16x8b, 1);                   //l2 l1 l0 tl t0 t1 t2 t3...
  427|       |
  428|     89|    top_left_8x16b = _mm_unpacklo_epi8(top_left_16x8b, zero_vector);
  429|     89|    top_left_sh_8x16b = _mm_unpacklo_epi8(top_left_sh_16x8b, zero_vector);
  430|       |
  431|     89|    res1_8x16b = _mm_add_epi16(top_left_8x16b, top_left_sh_8x16b);           //l3+l2 l2+l1 l1+l0 l0+tl tl+t0 t0+t1 t1+t2 t2+t3...
  432|     89|    const_2_8x16b = _mm_set1_epi16(2);
  433|     89|    res2_8x16b = _mm_srli_si128(res1_8x16b, 2);                              //l2+l1 l1+l0 l0+tl tl+t0 t0+t1 t1+t2 t2+t3...
  434|       |
  435|     89|    res1_8x16b = _mm_add_epi16(res1_8x16b, const_2_8x16b);
  436|     89|    res1_8x16b = _mm_add_epi16(res2_8x16b, res1_8x16b);                      //l3+2*l2+l1+2 l2+2*l1+l0+2...
  437|     89|    res1_8x16b = _mm_srai_epi16(res1_8x16b, 2);
  438|     89|    res1_16x8b = _mm_packus_epi16(res1_8x16b, res1_8x16b);
  439|       |
  440|     89|    dst_strd2 = dst_strd << 1;
  441|     89|    dst_strd3 = dst_strd + dst_strd2;
  442|       |
  443|     89|    res2_16x8b = _mm_srli_si128(res1_16x8b, 3);
  444|       |
  445|     89|    row1 = _mm_cvtsi128_si32(res2_16x8b);
  446|     89|    res2_16x8b = _mm_srli_si128(res1_16x8b, 2);
  447|     89|    row2 = _mm_cvtsi128_si32(res2_16x8b);
  448|     89|    res2_16x8b = _mm_srli_si128(res1_16x8b, 1);
  449|     89|    row3 = _mm_cvtsi128_si32(res2_16x8b);
  450|     89|    row4 = _mm_cvtsi128_si32(res1_16x8b);
  451|       |
  452|     89|    *((WORD32 *)(pu1_dst)) = row1;
  453|     89|    *((WORD32 *)(pu1_dst + dst_strd)) = row2;
  454|     89|    *((WORD32 *)(pu1_dst + dst_strd2)) = row3;
  455|     89|    *((WORD32 *)(pu1_dst + dst_strd3)) = row4;
  456|     89|}
ih264_intra_pred_luma_4x4_mode_vert_r_ssse3:
  495|    106|{
  496|    106|    UWORD8 *pu1_left;
  497|    106|    WORD32 dst_strd2, dst_strd3;
  498|       |
  499|    106|    __m128i val_16x8b, temp_16x8b;
  500|    106|    __m128i w11_a1_16x8b, w11_a2_16x8b;
  501|    106|    __m128i w121_a1_8x16b, w121_a2_8x16b, w121_sh_8x16b;
  502|    106|    __m128i row1_16x8b, row2_16x8b, row3_16x8b, row4_16x8b;
  503|    106|    __m128i zero_vector, const_2_8x16b;
  504|    106|    WORD32 row1,row2,row3,row4;
  505|       |
  506|    106|    UNUSED(src_strd);
  ------------------
  |  |   45|    106|#define UNUSED(x) ((void)(x))
  ------------------
  507|    106|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    106|#define UNUSED(x) ((void)(x))
  ------------------
  508|       |
  509|    106|    pu1_left = pu1_src + BLK_SIZE - 1;
  ------------------
  |  |  511|    106|#define BLK_SIZE            4
  ------------------
  510|       |
  511|    106|    val_16x8b = _mm_loadl_epi64((__m128i *)(pu1_left - 2));
  512|    106|    zero_vector = _mm_setzero_si128();
  513|       |
  514|    106|    w121_a1_8x16b = _mm_unpacklo_epi8(val_16x8b, zero_vector);        //l2 l1 l0 tl t0 t1 t2 t3
  515|    106|    w11_a1_16x8b = _mm_srli_si128(val_16x8b, 3);
  516|    106|    w121_a2_8x16b = _mm_srli_si128(w121_a1_8x16b, 2);                 //l1 l0 tl t0 t1 t2 t3 0
  517|    106|    w11_a2_16x8b = _mm_srli_si128(val_16x8b, 4);
  518|       |
  519|    106|    w121_a1_8x16b = _mm_add_epi16(w121_a1_8x16b, w121_a2_8x16b);      //l2+l1 l1+l0 l0+tl tl+t0 t0+t1 t1+t2 t2+t3 t3
  520|    106|    row1_16x8b = _mm_avg_epu8(w11_a1_16x8b, w11_a2_16x8b);
  521|    106|    w121_a2_8x16b = _mm_srli_si128(w121_a1_8x16b, 2);                 //l1+l0 l0+tl tl+t0 t0+t1 t1+t2 t2+t3 t3    0
  522|       |
  523|    106|    const_2_8x16b = _mm_set1_epi16(2);
  524|    106|    w121_a1_8x16b = _mm_add_epi16(w121_a1_8x16b, w121_a2_8x16b);      //l2+2*l1+l0 l1+2*l0+tl ...
  525|    106|    w121_a1_8x16b = _mm_add_epi16(w121_a1_8x16b, const_2_8x16b);
  526|    106|    w121_a1_8x16b = _mm_srai_epi16(w121_a1_8x16b, 2);
  527|       |
  528|    106|    w121_sh_8x16b = _mm_shufflelo_epi16(w121_a1_8x16b, 0xe1);
  529|    106|    w121_sh_8x16b = _mm_srli_si128(w121_sh_8x16b, 2);
  530|       |
  531|    106|    row4_16x8b = _mm_packus_epi16(w121_sh_8x16b, w121_sh_8x16b);
  532|    106|    temp_16x8b = _mm_slli_si128(w121_a1_8x16b, 13);
  533|    106|    row2_16x8b = _mm_srli_si128(row4_16x8b, 1);
  534|    106|    row3_16x8b = _mm_alignr_epi8(row1_16x8b, temp_16x8b, 15);
  535|       |
  536|    106|    dst_strd2 = dst_strd << 1;
  537|    106|    dst_strd3 = dst_strd + dst_strd2;
  538|       |
  539|    106|    row1 = _mm_cvtsi128_si32(row1_16x8b);
  540|    106|    row2 = _mm_cvtsi128_si32(row2_16x8b);
  541|    106|    row3 = _mm_cvtsi128_si32(row3_16x8b);
  542|    106|    row4 = _mm_cvtsi128_si32(row4_16x8b);
  543|       |
  544|    106|    *((WORD32 *)(pu1_dst)) = row1;
  545|    106|    *((WORD32 *)(pu1_dst + dst_strd)) = row2;
  546|    106|    *((WORD32 *)(pu1_dst + dst_strd2)) = row3;
  547|    106|    *((WORD32 *)(pu1_dst + dst_strd3)) = row4;
  548|    106|}
ih264_intra_pred_luma_4x4_mode_horz_d_ssse3:
  587|    416|{
  588|    416|    UWORD8 *pu1_left;
  589|    416|    WORD32 dst_strd2, dst_strd3;
  590|    416|    WORD32 val_121_t0t1;
  591|       |
  592|    416|    __m128i val_16x8b, val_sh_16x8b;
  593|    416|    __m128i w11_16x8b;
  594|    416|    __m128i w121_a1_8x16b, w121_a2_8x16b, w121_16x8b;
  595|    416|    __m128i row1_16x8b, row2_16x8b, row3_16x8b, row4_16x8b;
  596|       |
  597|    416|    __m128i zero_vector, const_2_8x16b;
  598|    416|    WORD32 row1,row2,row3,row4;
  599|       |
  600|    416|    UNUSED(src_strd);
  ------------------
  |  |   45|    416|#define UNUSED(x) ((void)(x))
  ------------------
  601|    416|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    416|#define UNUSED(x) ((void)(x))
  ------------------
  602|       |
  603|    416|    pu1_left = pu1_src + BLK_SIZE - 1;
  ------------------
  |  |  511|    416|#define BLK_SIZE            4
  ------------------
  604|       |
  605|    416|    val_16x8b = _mm_loadl_epi64((__m128i *)(pu1_left - 3));
  606|    416|    zero_vector = _mm_setzero_si128();
  607|    416|    val_sh_16x8b = _mm_srli_si128(val_16x8b, 1);
  608|    416|    w11_16x8b = _mm_avg_epu8(val_16x8b, val_sh_16x8b);
  609|       |
  610|    416|    w121_a1_8x16b = _mm_unpacklo_epi8(val_16x8b, zero_vector);        //l3 l2 l1 l0 tl t0 t1 t2
  611|    416|    w121_a2_8x16b = _mm_srli_si128(w121_a1_8x16b, 2);                 //l2 l1 l0 tl t0 t1 t2 0
  612|    416|    w121_a1_8x16b = _mm_add_epi16(w121_a1_8x16b, w121_a2_8x16b);      //l3+l2 l2+l1 l1+l0 l0+tl tl+t0 t0+t1 t1+t2 t2
  613|    416|    w121_a2_8x16b = _mm_srli_si128(w121_a1_8x16b, 2);                 //l2+l1 l1+l0 l0+tl tl+t0 t0+t1 t1+t2 t2    0
  614|       |
  615|    416|    zero_vector = _mm_setzero_si128();
  616|    416|    const_2_8x16b = _mm_set1_epi16(2);
  617|       |
  618|    416|    w121_a1_8x16b = _mm_add_epi16(w121_a1_8x16b, w121_a2_8x16b);      //l3+2*l2+l1 l2+2*l1+l0 l1+2*l0+tl ...
  619|    416|    w121_a1_8x16b = _mm_add_epi16(w121_a1_8x16b, const_2_8x16b);
  620|    416|    w121_a1_8x16b = _mm_srai_epi16(w121_a1_8x16b, 2);
  621|       |
  622|    416|    w121_16x8b = _mm_packus_epi16(w121_a1_8x16b, w121_a1_8x16b);
  623|       |
  624|    416|    row4_16x8b = _mm_unpacklo_epi8(w11_16x8b, w121_16x8b);
  625|    416|    val_121_t0t1 = _mm_extract_epi16(w121_16x8b, 2);
  626|    416|    row4_16x8b = _mm_insert_epi16(row4_16x8b, val_121_t0t1, 4);
  627|       |
  628|    416|    dst_strd2 = dst_strd << 1;
  629|    416|    dst_strd3 = dst_strd + dst_strd2;
  630|       |
  631|    416|    row1_16x8b = _mm_srli_si128(row4_16x8b, 6);
  632|    416|    row2_16x8b = _mm_srli_si128(row4_16x8b, 4);
  633|    416|    row3_16x8b = _mm_srli_si128(row4_16x8b, 2);
  634|       |
  635|    416|    row1 = _mm_cvtsi128_si32(row1_16x8b);
  636|    416|    row2 = _mm_cvtsi128_si32(row2_16x8b);
  637|    416|    row3 = _mm_cvtsi128_si32(row3_16x8b);
  638|    416|    row4 = _mm_cvtsi128_si32(row4_16x8b);
  639|       |
  640|    416|    *((WORD32 *)(pu1_dst)) = row1;
  641|    416|    *((WORD32 *)(pu1_dst + dst_strd)) = row2;
  642|    416|    *((WORD32 *)(pu1_dst + dst_strd2)) = row3;
  643|    416|    *((WORD32 *)(pu1_dst + dst_strd3)) = row4;
  644|    416|}
ih264_intra_pred_luma_4x4_mode_vert_l_ssse3:
  683|    139|{
  684|    139|    UWORD8 *pu1_top;
  685|    139|    WORD32 dst_strd2, dst_strd3;
  686|       |
  687|    139|    __m128i val_16x8b, val_sh_16x8b;
  688|    139|    __m128i w121_a1_8x16b, w121_a2_8x16b;
  689|    139|    __m128i row1_16x8b, row2_16x8b, row3_16x8b, row4_16x8b;
  690|       |
  691|    139|    __m128i zero_vector, const_2_8x16b;
  692|    139|    WORD32 row1,row2,row3,row4;
  693|       |
  694|    139|    UNUSED(src_strd);
  ------------------
  |  |   45|    139|#define UNUSED(x) ((void)(x))
  ------------------
  695|    139|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    139|#define UNUSED(x) ((void)(x))
  ------------------
  696|       |
  697|    139|    pu1_top = pu1_src +BLK_SIZE + 1;
  ------------------
  |  |  511|    139|#define BLK_SIZE            4
  ------------------
  698|       |
  699|    139|    val_16x8b = _mm_loadl_epi64((__m128i *)pu1_top);
  700|    139|    zero_vector = _mm_setzero_si128();
  701|    139|    val_sh_16x8b = _mm_srli_si128(val_16x8b, 1);
  702|    139|    row1_16x8b = _mm_avg_epu8(val_16x8b, val_sh_16x8b);
  703|       |
  704|    139|    w121_a1_8x16b = _mm_unpacklo_epi8(val_16x8b, zero_vector);        //t0 t1 t2 t3 t4 t5...
  705|    139|    w121_a2_8x16b = _mm_srli_si128(w121_a1_8x16b, 2);                 //t1 t2 t3 t4 t5 t6...
  706|    139|    w121_a1_8x16b = _mm_add_epi16(w121_a1_8x16b, w121_a2_8x16b);      //t0+t1 t1+t2 t2+t3 t3+t4 t4+t5...
  707|    139|    w121_a2_8x16b = _mm_srli_si128(w121_a1_8x16b, 2);                 //t1+t2 t2+t3 t3+t4 t4+t5 t5+t6...
  708|       |
  709|    139|    zero_vector = _mm_setzero_si128();
  710|    139|    const_2_8x16b = _mm_set1_epi16(2);
  711|       |
  712|    139|    w121_a1_8x16b = _mm_add_epi16(w121_a1_8x16b, w121_a2_8x16b);      //t0+2*t1+t2 t1+2*t2+t3 t2+2*t3+t4...
  713|    139|    w121_a1_8x16b = _mm_add_epi16(w121_a1_8x16b, const_2_8x16b);
  714|    139|    w121_a1_8x16b = _mm_srai_epi16(w121_a1_8x16b, 2);
  715|       |
  716|    139|    row2_16x8b = _mm_packus_epi16(w121_a1_8x16b, w121_a1_8x16b);
  717|       |
  718|    139|    dst_strd2 = dst_strd << 1;
  719|    139|    dst_strd3 = dst_strd + dst_strd2;
  720|       |
  721|    139|    row3_16x8b = _mm_srli_si128(row1_16x8b, 1);
  722|    139|    row4_16x8b = _mm_srli_si128(row2_16x8b, 1);
  723|       |
  724|    139|    row1 = _mm_cvtsi128_si32(row1_16x8b);
  725|    139|    row2 = _mm_cvtsi128_si32(row2_16x8b);
  726|    139|    row3 = _mm_cvtsi128_si32(row3_16x8b);
  727|    139|    row4 = _mm_cvtsi128_si32(row4_16x8b);
  728|       |
  729|    139|    *((WORD32 *)(pu1_dst)) = row1;
  730|    139|    *((WORD32 *)(pu1_dst + dst_strd)) = row2;
  731|    139|    *((WORD32 *)(pu1_dst + dst_strd2)) = row3;
  732|    139|    *((WORD32 *)(pu1_dst + dst_strd3)) = row4;
  733|    139|}
ih264_intra_pred_luma_4x4_mode_horz_u_ssse3:
  772|  1.11k|{
  773|  1.11k|    UWORD8 *pu1_left;
  774|  1.11k|    WORD32 dst_strd2, dst_strd3;
  775|       |
  776|  1.11k|    __m128i val_16x8b, val_sh_16x8b;
  777|  1.11k|    __m128i w11_16x8b;
  778|  1.11k|    __m128i w121_a1_8x16b, w121_a2_8x16b, w121_16x8b;
  779|  1.11k|    __m128i row1_16x8b, row2_16x8b, row3_16x8b, row4_16x8b;
  780|       |
  781|  1.11k|    __m128i zero_vector, const_2_8x16b, rev_16x8b;
  782|  1.11k|    WORD32 row1,row2,row3,row4;
  783|       |
  784|  1.11k|    UNUSED(src_strd);
  ------------------
  |  |   45|  1.11k|#define UNUSED(x) ((void)(x))
  ------------------
  785|  1.11k|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|  1.11k|#define UNUSED(x) ((void)(x))
  ------------------
  786|       |
  787|  1.11k|    pu1_left = pu1_src + BLK_SIZE - 1;
  ------------------
  |  |  511|  1.11k|#define BLK_SIZE            4
  ------------------
  788|       |
  789|  1.11k|    zero_vector = _mm_setzero_si128();
  790|  1.11k|    rev_16x8b = _mm_setr_epi8(3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  791|       |
  792|  1.11k|    val_16x8b = _mm_loadl_epi64((__m128i *)(pu1_left - 3));           //l3 l2 l1 l0 0  0  0...
  793|  1.11k|    val_16x8b = _mm_shuffle_epi8(val_16x8b, rev_16x8b);                //l0 l1 l2 l3 l3 l3 l3...
  794|       |
  795|  1.11k|    val_sh_16x8b = _mm_srli_si128(val_16x8b, 1);
  796|  1.11k|    w11_16x8b = _mm_avg_epu8(val_16x8b, val_sh_16x8b);
  797|       |
  798|  1.11k|    w121_a1_8x16b = _mm_unpacklo_epi8(val_16x8b, zero_vector);        //l0 l1 l2 l3 l3 l3...
  799|  1.11k|    w121_a2_8x16b = _mm_srli_si128(w121_a1_8x16b, 2);                 //l1 l2 l3 l3 l3 l3...
  800|       |
  801|  1.11k|    w121_a1_8x16b = _mm_add_epi16(w121_a1_8x16b, w121_a2_8x16b);      //l0+t1 l1+l2 l2+l3 2*l3 2*l3...
  802|  1.11k|    w121_a2_8x16b = _mm_srli_si128(w121_a1_8x16b, 2);                 //l1+t2 l2+l3 2*l3  2*l3 2*l3...
  803|       |
  804|  1.11k|    zero_vector = _mm_setzero_si128();
  805|  1.11k|    const_2_8x16b = _mm_set1_epi16(2);
  806|       |
  807|  1.11k|    w121_a1_8x16b = _mm_add_epi16(w121_a1_8x16b, w121_a2_8x16b);      //l0+2*l1+l2 l1+2*l2+l3 l2+3*l3 4*l3 4*l3...
  808|  1.11k|    w121_a1_8x16b = _mm_add_epi16(w121_a1_8x16b, const_2_8x16b);
  809|  1.11k|    w121_a1_8x16b = _mm_srai_epi16(w121_a1_8x16b, 2);
  810|       |
  811|  1.11k|    w121_16x8b = _mm_packus_epi16(w121_a1_8x16b, w121_a1_8x16b);
  812|       |
  813|  1.11k|    dst_strd2 = dst_strd << 1;
  814|  1.11k|    dst_strd3 = dst_strd + dst_strd2;
  815|       |
  816|  1.11k|    row1_16x8b = _mm_unpacklo_epi8(w11_16x8b, w121_16x8b);
  817|  1.11k|    row2_16x8b = _mm_srli_si128(row1_16x8b, 2);
  818|  1.11k|    row3_16x8b = _mm_srli_si128(row1_16x8b, 4);
  819|  1.11k|    row4_16x8b = _mm_srli_si128(row1_16x8b, 6);
  820|       |
  821|  1.11k|    row1 = _mm_cvtsi128_si32(row1_16x8b);
  822|  1.11k|    row2 = _mm_cvtsi128_si32(row2_16x8b);
  823|  1.11k|    row3 = _mm_cvtsi128_si32(row3_16x8b);
  824|  1.11k|    row4 = _mm_cvtsi128_si32(row4_16x8b);
  825|       |
  826|  1.11k|    *((WORD32 *)(pu1_dst)) = row1;
  827|  1.11k|    *((WORD32 *)(pu1_dst + dst_strd)) = row2;
  828|  1.11k|    *((WORD32 *)(pu1_dst + dst_strd2)) = row3;
  829|  1.11k|    *((WORD32 *)(pu1_dst + dst_strd3)) = row4;
  830|  1.11k|}
ih264_intra_pred_luma_8x8_mode_vert_ssse3:
  872|    941|{
  873|    941|    UWORD8 *pu1_top = NULL;
  874|    941|    __m128i top_8x8b;
  875|    941|    UNUSED(src_strd);
  ------------------
  |  |   45|    941|#define UNUSED(x) ((void)(x))
  ------------------
  876|    941|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    941|#define UNUSED(x) ((void)(x))
  ------------------
  877|    941|    pu1_top = pu1_src + BLK8x8SIZE + 1;
  ------------------
  |  |  510|    941|#define BLK8x8SIZE          8
  ------------------
  878|       |
  879|    941|    top_8x8b = _mm_loadl_epi64((__m128i *)pu1_top);
  880|       |
  881|    941|    _mm_storel_epi64((__m128i *)(pu1_dst + 0 * dst_strd), top_8x8b);
  882|    941|    _mm_storel_epi64((__m128i *)(pu1_dst + 1 * dst_strd), top_8x8b);
  883|    941|    _mm_storel_epi64((__m128i *)(pu1_dst + 2 * dst_strd), top_8x8b);
  884|    941|    _mm_storel_epi64((__m128i *)(pu1_dst + 3 * dst_strd), top_8x8b);
  885|    941|    _mm_storel_epi64((__m128i *)(pu1_dst + 4 * dst_strd), top_8x8b);
  886|    941|    _mm_storel_epi64((__m128i *)(pu1_dst + 5 * dst_strd), top_8x8b);
  887|    941|    _mm_storel_epi64((__m128i *)(pu1_dst + 6 * dst_strd), top_8x8b);
  888|    941|    _mm_storel_epi64((__m128i *)(pu1_dst + 7 * dst_strd), top_8x8b);
  889|    941|}
ih264_intra_pred_luma_8x8_mode_horz_ssse3:
  929|    818|{
  930|    818|    UWORD8 *pu1_left = pu1_src + BLK8x8SIZE - 1;
  ------------------
  |  |  510|    818|#define BLK8x8SIZE          8
  ------------------
  931|    818|    __m128i row1_8x8b, row2_8x8b, row3_8x8b, row4_8x8b;
  932|    818|    __m128i row5_8x8b, row6_8x8b, row7_8x8b, row8_8x8b;
  933|       |
  934|    818|    UNUSED(src_strd);
  ------------------
  |  |   45|    818|#define UNUSED(x) ((void)(x))
  ------------------
  935|    818|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    818|#define UNUSED(x) ((void)(x))
  ------------------
  936|       |
  937|    818|    row1_8x8b = _mm_set1_epi8(pu1_left[0]);
  938|    818|    row2_8x8b = _mm_set1_epi8(pu1_left[-1]);
  939|    818|    row3_8x8b = _mm_set1_epi8(pu1_left[-2]);
  940|    818|    row4_8x8b = _mm_set1_epi8(pu1_left[-3]);
  941|    818|    row5_8x8b = _mm_set1_epi8(pu1_left[-4]);
  942|    818|    row6_8x8b = _mm_set1_epi8(pu1_left[-5]);
  943|    818|    row7_8x8b = _mm_set1_epi8(pu1_left[-6]);
  944|    818|    row8_8x8b = _mm_set1_epi8(pu1_left[-7]);
  945|       |
  946|    818|    _mm_storel_epi64((__m128i *)(pu1_dst + 0 * dst_strd), row1_8x8b);
  947|    818|    _mm_storel_epi64((__m128i *)(pu1_dst + 1 * dst_strd), row2_8x8b);
  948|    818|    _mm_storel_epi64((__m128i *)(pu1_dst + 2 * dst_strd), row3_8x8b);
  949|    818|    _mm_storel_epi64((__m128i *)(pu1_dst + 3 * dst_strd), row4_8x8b);
  950|    818|    _mm_storel_epi64((__m128i *)(pu1_dst + 4 * dst_strd), row5_8x8b);
  951|    818|    _mm_storel_epi64((__m128i *)(pu1_dst + 5 * dst_strd), row6_8x8b);
  952|    818|    _mm_storel_epi64((__m128i *)(pu1_dst + 6 * dst_strd), row7_8x8b);
  953|    818|    _mm_storel_epi64((__m128i *)(pu1_dst + 7 * dst_strd), row8_8x8b);
  954|    818|}
ih264_intra_pred_luma_8x8_mode_dc_ssse3:
  993|    141|{
  994|    141|    UWORD8 u1_useleft; /* availability of left predictors (only for DC) */
  995|    141|    UWORD8 u1_usetop; /* availability of top predictors (only for DC) */
  996|    141|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
  997|    141|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
  998|    141|    __m128i dc_val_8x8b;
  999|    141|    WORD32 dc_val = 0;
 1000|    141|    UNUSED(src_strd);
  ------------------
  |  |   45|    141|#define UNUSED(x) ((void)(x))
  ------------------
 1001|       |
 1002|    141|    u1_useleft = BOOLEAN(ngbr_avail & LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|    141|#define BOOLEAN(x) (!!(x))
  ------------------
 1003|    141|    u1_usetop = BOOLEAN(ngbr_avail & TOP_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|    141|#define BOOLEAN(x) (!!(x))
  ------------------
 1004|    141|    pu1_top = pu1_src + BLK8x8SIZE + 1;
  ------------------
  |  |  510|    141|#define BLK8x8SIZE          8
  ------------------
 1005|    141|    pu1_left = pu1_src + BLK8x8SIZE - 1;
  ------------------
  |  |  510|    141|#define BLK8x8SIZE          8
  ------------------
 1006|       |
 1007|    141|    if(u1_useleft || u1_usetop)
  ------------------
  |  Branch (1007:8): [True: 88, False: 53]
  |  Branch (1007:22): [True: 42, False: 11]
  ------------------
 1008|    130|    {
 1009|    130|        WORD32 shft = 2;
 1010|    130|        __m128i val_8x8b, zero_8x8b, sum_8x16b;
 1011|       |
 1012|    130|        zero_8x8b = _mm_setzero_si128();
 1013|       |
 1014|    130|        if(u1_useleft)
  ------------------
  |  Branch (1014:12): [True: 88, False: 42]
  ------------------
 1015|     88|        {
 1016|     88|            val_8x8b = _mm_loadl_epi64((__m128i *)(pu1_left - 7));
 1017|     88|            sum_8x16b = _mm_sad_epu8(zero_8x8b, val_8x8b);
 1018|       |
 1019|     88|            shft++;
 1020|     88|            dc_val += 4;
 1021|     88|            dc_val += _mm_extract_epi16(sum_8x16b, 0);
 1022|     88|        }
 1023|    130|        if(u1_usetop)
  ------------------
  |  Branch (1023:12): [True: 109, False: 21]
  ------------------
 1024|    109|        {
 1025|    109|            val_8x8b = _mm_loadl_epi64((__m128i *)pu1_top);
 1026|    109|            sum_8x16b = _mm_sad_epu8(zero_8x8b, val_8x8b);
 1027|       |
 1028|    109|            shft++;
 1029|    109|            dc_val += 4;
 1030|    109|            dc_val += _mm_extract_epi16(sum_8x16b, 0);
 1031|    109|        }
 1032|    130|        dc_val = dc_val >> shft;
 1033|    130|    }
 1034|     11|    else
 1035|     11|        dc_val = 128;
 1036|       |
 1037|    141|    dc_val_8x8b = _mm_set1_epi8(dc_val);
 1038|       |
 1039|    141|    _mm_storel_epi64((__m128i *)(pu1_dst + 0 * dst_strd), dc_val_8x8b);
 1040|    141|    _mm_storel_epi64((__m128i *)(pu1_dst + 1 * dst_strd), dc_val_8x8b);
 1041|    141|    _mm_storel_epi64((__m128i *)(pu1_dst + 2 * dst_strd), dc_val_8x8b);
 1042|    141|    _mm_storel_epi64((__m128i *)(pu1_dst + 3 * dst_strd), dc_val_8x8b);
 1043|    141|    _mm_storel_epi64((__m128i *)(pu1_dst + 4 * dst_strd), dc_val_8x8b);
 1044|    141|    _mm_storel_epi64((__m128i *)(pu1_dst + 5 * dst_strd), dc_val_8x8b);
 1045|    141|    _mm_storel_epi64((__m128i *)(pu1_dst + 6 * dst_strd), dc_val_8x8b);
 1046|    141|    _mm_storel_epi64((__m128i *)(pu1_dst + 7 * dst_strd), dc_val_8x8b);
 1047|    141|}
ih264_intra_pred_luma_8x8_mode_diag_dl_ssse3:
 1086|     24|{
 1087|     24|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
 1088|     24|    __m128i top_16x8;
 1089|     24|    __m128i out_15x16;
 1090|     24|    __m128i a0_8x16, a1_8x16, a2_8x16;
 1091|     24|    __m128i temp1, temp2;
 1092|     24|    __m128i res1_8x16, res2_8x16;
 1093|     24|    __m128i zero = _mm_setzero_si128();
 1094|     24|    __m128i const_val2_8x16 = _mm_set1_epi16(2);
 1095|       |
 1096|     24|    UNUSED(src_strd);
  ------------------
  |  |   45|     24|#define UNUSED(x) ((void)(x))
  ------------------
 1097|     24|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|     24|#define UNUSED(x) ((void)(x))
  ------------------
 1098|       |
 1099|     24|    pu1_top = pu1_src + BLK8x8SIZE + 1;
  ------------------
  |  |  510|     24|#define BLK8x8SIZE          8
  ------------------
 1100|       |
 1101|     24|    top_16x8 = _mm_loadu_si128((__m128i *)(pu1_top));
 1102|       |
 1103|     24|    temp1 = _mm_srli_si128(top_16x8, 1);
 1104|     24|    temp2 = _mm_srli_si128(top_16x8, 2);
 1105|     24|    a0_8x16 = _mm_unpacklo_epi8(top_16x8, zero);
 1106|     24|    a1_8x16 = _mm_unpacklo_epi8(temp1, zero);
 1107|     24|    a2_8x16 = _mm_unpacklo_epi8(temp2, zero);
 1108|       |
 1109|     24|    a0_8x16 = _mm_add_epi16(a0_8x16, a2_8x16);
 1110|     24|    a1_8x16 = _mm_add_epi16(a1_8x16, a1_8x16);
 1111|     24|    a0_8x16 = _mm_add_epi16(a0_8x16, const_val2_8x16);
 1112|     24|    a0_8x16 = _mm_add_epi16(a0_8x16, a1_8x16);
 1113|     24|    res1_8x16 = _mm_srai_epi16(a0_8x16, 2);
 1114|       |
 1115|     24|    temp2 = _mm_srli_si128(top_16x8, 2);
 1116|     24|    temp1 = _mm_srli_si128(top_16x8, 1);
 1117|     24|    a2_8x16 = _mm_unpackhi_epi8(temp2, zero);
 1118|     24|    a0_8x16 = _mm_unpackhi_epi8(top_16x8, zero);
 1119|     24|    a2_8x16 = _mm_shufflehi_epi16(a2_8x16, 0x14);
 1120|     24|    a1_8x16 = _mm_unpackhi_epi8(temp1, zero);
 1121|       |
 1122|     24|    a0_8x16 = _mm_add_epi16(a0_8x16, a2_8x16);
 1123|     24|    a1_8x16 = _mm_add_epi16(a1_8x16, a1_8x16);
 1124|     24|    a0_8x16 = _mm_add_epi16(a0_8x16, const_val2_8x16);
 1125|     24|    a0_8x16 = _mm_add_epi16(a0_8x16, a1_8x16);
 1126|     24|    res2_8x16 = _mm_srai_epi16(a0_8x16, 2);
 1127|       |
 1128|     24|    out_15x16 = _mm_packus_epi16(res1_8x16, res2_8x16);
 1129|       |
 1130|     24|    _mm_storel_epi64((__m128i *)(pu1_dst + 0 * dst_strd), out_15x16);
 1131|     24|    out_15x16 = _mm_srli_si128(out_15x16, 1);
 1132|     24|    _mm_storel_epi64((__m128i *)(pu1_dst + 1 * dst_strd), out_15x16);
 1133|     24|    out_15x16 = _mm_srli_si128(out_15x16, 1);
 1134|     24|    _mm_storel_epi64((__m128i *)(pu1_dst + 2 * dst_strd), out_15x16);
 1135|     24|    out_15x16 = _mm_srli_si128(out_15x16, 1);
 1136|     24|    _mm_storel_epi64((__m128i *)(pu1_dst + 3 * dst_strd), out_15x16);
 1137|     24|    out_15x16 = _mm_srli_si128(out_15x16, 1);
 1138|     24|    _mm_storel_epi64((__m128i *)(pu1_dst + 4 * dst_strd), out_15x16);
 1139|     24|    out_15x16 = _mm_srli_si128(out_15x16, 1);
 1140|     24|    _mm_storel_epi64((__m128i *)(pu1_dst + 5 * dst_strd), out_15x16);
 1141|     24|    out_15x16 = _mm_srli_si128(out_15x16, 1);
 1142|     24|    _mm_storel_epi64((__m128i *)(pu1_dst + 6 * dst_strd), out_15x16);
 1143|       |    out_15x16 = _mm_srli_si128(out_15x16, 1);
 1144|     24|    _mm_storel_epi64((__m128i *)(pu1_dst + 7 * dst_strd), out_15x16);
 1145|     24|}
ih264_intra_pred_luma_8x8_mode_diag_dr_ssse3:
 1184|     17|{
 1185|     17|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
 1186|     17|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
 1187|     17|    __m128i top_8x8, left_16x8;
 1188|     17|    __m128i out_15x16;
 1189|     17|    __m128i a0_8x16, a1_8x16, a2_8x16;
 1190|     17|    __m128i temp1, temp2;
 1191|     17|    __m128i res1_8x16, res2_8x16;
 1192|     17|    __m128i zero = _mm_setzero_si128();
 1193|     17|    __m128i const_val2_8x16 = _mm_set1_epi16(2);
 1194|     17|    __m128i str_8x8;
 1195|       |
 1196|     17|    UNUSED(src_strd);
  ------------------
  |  |   45|     17|#define UNUSED(x) ((void)(x))
  ------------------
 1197|     17|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|     17|#define UNUSED(x) ((void)(x))
  ------------------
 1198|       |
 1199|     17|    pu1_left = pu1_src + BLK8x8SIZE - 1;
  ------------------
  |  |  510|     17|#define BLK8x8SIZE          8
  ------------------
 1200|     17|    pu1_top = pu1_src + BLK8x8SIZE + 1;
  ------------------
  |  |  510|     17|#define BLK8x8SIZE          8
  ------------------
 1201|       |
 1202|     17|    left_16x8 = _mm_loadu_si128((__m128i *)(pu1_left - 7));
 1203|       |
 1204|     17|    temp1 = _mm_srli_si128(left_16x8, 1);
 1205|     17|    temp2 = _mm_srli_si128(left_16x8, 2);
 1206|     17|    a0_8x16 = _mm_unpacklo_epi8(left_16x8, zero);
 1207|     17|    a1_8x16 = _mm_unpacklo_epi8(temp1, zero);
 1208|     17|    a2_8x16 = _mm_unpacklo_epi8(temp2, zero);
 1209|       |
 1210|     17|    a0_8x16 = _mm_add_epi16(a0_8x16, a2_8x16);
 1211|     17|    a1_8x16 = _mm_add_epi16(a1_8x16, a1_8x16);
 1212|     17|    a0_8x16 = _mm_add_epi16(a0_8x16, const_val2_8x16);
 1213|     17|    a0_8x16 = _mm_add_epi16(a0_8x16, a1_8x16);
 1214|     17|    res1_8x16 = _mm_srai_epi16(a0_8x16, 2);
 1215|       |
 1216|     17|    top_8x8 = _mm_loadu_si128((__m128i *)(pu1_top - 1));
 1217|       |
 1218|     17|    temp1 = _mm_srli_si128(top_8x8, 1);
 1219|     17|    temp2 = _mm_srli_si128(top_8x8, 2);
 1220|     17|    a0_8x16 = _mm_unpacklo_epi8(top_8x8, zero);
 1221|     17|    a1_8x16 = _mm_unpacklo_epi8(temp1, zero);
 1222|     17|    a2_8x16 = _mm_unpacklo_epi8(temp2, zero);
 1223|       |
 1224|     17|    a0_8x16 = _mm_add_epi16(a0_8x16, a2_8x16);
 1225|     17|    a1_8x16 = _mm_add_epi16(a1_8x16, a1_8x16);
 1226|     17|    a0_8x16 = _mm_add_epi16(a0_8x16, const_val2_8x16);
 1227|     17|    a0_8x16 = _mm_add_epi16(a0_8x16, a1_8x16);
 1228|     17|    res2_8x16 = _mm_srai_epi16(a0_8x16, 2);
 1229|       |
 1230|     17|    out_15x16 = _mm_packus_epi16(res1_8x16, res2_8x16);
 1231|       |
 1232|     17|    str_8x8 = _mm_srli_si128(out_15x16, 7);
 1233|     17|    _mm_storel_epi64((__m128i *)(pu1_dst + 0 * dst_strd), str_8x8);
 1234|     17|    str_8x8 = _mm_srli_si128(out_15x16, 6);
 1235|     17|    _mm_storel_epi64((__m128i *)(pu1_dst + 1 * dst_strd), str_8x8);
 1236|     17|    str_8x8 = _mm_srli_si128(out_15x16, 5);
 1237|     17|    _mm_storel_epi64((__m128i *)(pu1_dst + 2 * dst_strd), str_8x8);
 1238|     17|    str_8x8 = _mm_srli_si128(out_15x16, 4);
 1239|     17|    _mm_storel_epi64((__m128i *)(pu1_dst + 3 * dst_strd), str_8x8);
 1240|     17|    str_8x8 = _mm_srli_si128(out_15x16, 3);
 1241|     17|    _mm_storel_epi64((__m128i *)(pu1_dst + 4 * dst_strd), str_8x8);
 1242|     17|    str_8x8 = _mm_srli_si128(out_15x16, 2);
 1243|     17|    _mm_storel_epi64((__m128i *)(pu1_dst + 5 * dst_strd), str_8x8);
 1244|       |    str_8x8 = _mm_srli_si128(out_15x16, 1);
 1245|     17|    _mm_storel_epi64((__m128i *)(pu1_dst + 6 * dst_strd), str_8x8);
 1246|     17|    _mm_storel_epi64((__m128i *)(pu1_dst + 7 * dst_strd), out_15x16);
 1247|     17|}
ih264_intra_pred_luma_8x8_mode_vert_r_ssse3:
 1286|      9|{
 1287|      9|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
 1288|      9|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
 1289|      9|    __m128i top_8x8, left_16x8;
 1290|      9|    __m128i out1_16x16, out2_16x16;
 1291|      9|    __m128i a0_8x16, a1_8x16, a2_8x16;
 1292|      9|    __m128i temp1, temp2;
 1293|      9|    __m128i res1_8x16, res2_8x16, res3_8x16;
 1294|      9|    __m128i zero = _mm_setzero_si128();
 1295|      9|    __m128i const_val2_8x16 = _mm_set1_epi16(2);
 1296|      9|    __m128i str_8x8;
 1297|      9|    __m128i mask = _mm_set1_epi32(0xFFFF);
 1298|       |
 1299|      9|    UNUSED(src_strd);
  ------------------
  |  |   45|      9|#define UNUSED(x) ((void)(x))
  ------------------
 1300|      9|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|      9|#define UNUSED(x) ((void)(x))
  ------------------
 1301|       |
 1302|      9|    pu1_left = pu1_src + BLK8x8SIZE - 1;
  ------------------
  |  |  510|      9|#define BLK8x8SIZE          8
  ------------------
 1303|      9|    pu1_top = pu1_src + BLK8x8SIZE + 1;
  ------------------
  |  |  510|      9|#define BLK8x8SIZE          8
  ------------------
 1304|       |
 1305|      9|    left_16x8 = _mm_loadu_si128((__m128i *)(pu1_left - 6));
 1306|       |
 1307|      9|    temp1 = _mm_srli_si128(left_16x8, 1);
 1308|      9|    temp2 = _mm_srli_si128(left_16x8, 2);
 1309|      9|    a0_8x16 = _mm_unpacklo_epi8(left_16x8, zero);
 1310|      9|    a1_8x16 = _mm_unpacklo_epi8(temp1, zero);
 1311|      9|    a2_8x16 = _mm_unpacklo_epi8(temp2, zero);
 1312|       |
 1313|      9|    a0_8x16 = _mm_add_epi16(a0_8x16, a2_8x16);
 1314|      9|    a1_8x16 = _mm_add_epi16(a1_8x16, a1_8x16);
 1315|      9|    a0_8x16 = _mm_add_epi16(a0_8x16, const_val2_8x16);
 1316|      9|    a0_8x16 = _mm_add_epi16(a0_8x16, a1_8x16);
 1317|      9|    res1_8x16 = _mm_srai_epi16(a0_8x16, 2);
 1318|       |
 1319|      9|    top_8x8 = _mm_loadu_si128((__m128i *)(pu1_top - 1));
 1320|       |
 1321|      9|    temp1 = _mm_srli_si128(top_8x8, 1);
 1322|      9|    temp2 = _mm_srli_si128(top_8x8, 2);
 1323|      9|    a0_8x16 = _mm_unpacklo_epi8(top_8x8, zero);
 1324|      9|    a1_8x16 = _mm_unpacklo_epi8(temp1, zero);
 1325|      9|    a2_8x16 = _mm_unpacklo_epi8(temp2, zero);
 1326|       |
 1327|      9|    res3_8x16 = _mm_avg_epu16(a0_8x16, a1_8x16);
 1328|       |
 1329|      9|    a0_8x16 = _mm_add_epi16(a0_8x16, a2_8x16);
 1330|      9|    a1_8x16 = _mm_add_epi16(a1_8x16, a1_8x16);
 1331|      9|    a0_8x16 = _mm_add_epi16(a0_8x16, const_val2_8x16);
 1332|      9|    a0_8x16 = _mm_add_epi16(a0_8x16, a1_8x16);
 1333|      9|    res2_8x16 = _mm_srai_epi16(a0_8x16, 2);
 1334|       |
 1335|      9|    str_8x8 = _mm_packus_epi16(res3_8x16, zero);
 1336|      9|    _mm_storel_epi64((__m128i *)(pu1_dst + 0 * dst_strd), str_8x8);
 1337|       |
 1338|      9|    temp1 = _mm_and_si128(res1_8x16, mask);
 1339|      9|    temp1 = _mm_packs_epi32(temp1, temp1);
 1340|      9|    out1_16x16 = _mm_packus_epi16(temp1, res2_8x16);
 1341|       |
 1342|      9|    res1_8x16 = _mm_slli_si128(res1_8x16, 2);
 1343|      9|    temp1 = _mm_and_si128(res1_8x16, mask);
 1344|      9|    temp1 = _mm_packs_epi32(temp1, temp1);
 1345|      9|    out2_16x16 = _mm_packus_epi16(temp1, res3_8x16);
 1346|       |
 1347|      9|    str_8x8 = _mm_srli_si128(out1_16x16, 7);
 1348|      9|    _mm_storel_epi64((__m128i *)(pu1_dst + 1 * dst_strd), str_8x8);
 1349|       |
 1350|      9|    str_8x8 = _mm_srli_si128(out2_16x16, 7);
 1351|      9|    _mm_storel_epi64((__m128i *)(pu1_dst + 2 * dst_strd), str_8x8);
 1352|       |
 1353|      9|    str_8x8 = _mm_srli_si128(out1_16x16, 6);
 1354|      9|    _mm_storel_epi64((__m128i *)(pu1_dst + 3 * dst_strd), str_8x8);
 1355|       |
 1356|      9|    str_8x8 = _mm_srli_si128(out2_16x16, 6);
 1357|      9|    _mm_storel_epi64((__m128i *)(pu1_dst + 4 * dst_strd), str_8x8);
 1358|       |
 1359|      9|    str_8x8 = _mm_srli_si128(out1_16x16, 5);
 1360|      9|    _mm_storel_epi64((__m128i *)(pu1_dst + 5 * dst_strd), str_8x8);
 1361|       |
 1362|      9|    str_8x8 = _mm_srli_si128(out2_16x16, 5);
 1363|      9|    _mm_storel_epi64((__m128i *)(pu1_dst + 6 * dst_strd), str_8x8);
 1364|       |
 1365|       |    str_8x8 = _mm_srli_si128(out1_16x16, 4);
 1366|      9|    _mm_storel_epi64((__m128i *)(pu1_dst + 7 * dst_strd), str_8x8);
 1367|      9|}
ih264_intra_pred_luma_8x8_mode_horz_d_ssse3:
 1406|      5|{
 1407|      5|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
 1408|      5|    __m128i pels_16x16;
 1409|      5|    __m128i temp1, temp2, temp3, temp4;
 1410|      5|    __m128i a0_8x16, a1_8x16, a2_8x16;
 1411|      5|    __m128i zero = _mm_setzero_si128();
 1412|      5|    __m128i const_val2_8x16 = _mm_set1_epi16(2);
 1413|      5|    __m128i res1_8x16, res2_8x16;
 1414|      5|    __m128i out1_16x16, out2_16x16;
 1415|      5|    __m128i str_8x8;
 1416|      5|    UNUSED(src_strd);
  ------------------
  |  |   45|      5|#define UNUSED(x) ((void)(x))
  ------------------
 1417|      5|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|      5|#define UNUSED(x) ((void)(x))
  ------------------
 1418|       |
 1419|      5|    pu1_left = pu1_src + BLK8x8SIZE - 1;
  ------------------
  |  |  510|      5|#define BLK8x8SIZE          8
  ------------------
 1420|       |
 1421|      5|    pels_16x16 = _mm_loadu_si128((__m128i *)(pu1_left - 7));
 1422|       |
 1423|      5|    temp1 = _mm_srli_si128(pels_16x16, 1);
 1424|      5|    temp2 = _mm_srli_si128(pels_16x16, 2);
 1425|      5|    a0_8x16 = _mm_unpacklo_epi8(pels_16x16, zero);
 1426|      5|    a1_8x16 = _mm_unpacklo_epi8(temp1, zero);
 1427|      5|    a2_8x16 = _mm_unpacklo_epi8(temp2, zero);
 1428|       |
 1429|      5|    res1_8x16 = _mm_avg_epu16(a0_8x16, a1_8x16);
 1430|       |
 1431|      5|    a0_8x16 = _mm_add_epi16(a0_8x16, a2_8x16);
 1432|      5|    a1_8x16 = _mm_add_epi16(a1_8x16, a1_8x16);
 1433|      5|    a0_8x16 = _mm_add_epi16(a0_8x16, const_val2_8x16);
 1434|      5|    a0_8x16 = _mm_add_epi16(a0_8x16, a1_8x16);
 1435|      5|    res2_8x16 = _mm_srai_epi16(a0_8x16, 2);
 1436|       |
 1437|      5|    temp3 = _mm_unpacklo_epi16(res1_8x16, res2_8x16);
 1438|      5|    temp4 = _mm_unpackhi_epi16(res1_8x16, res2_8x16);
 1439|      5|    out2_16x16 = _mm_packus_epi16(temp3, temp4);
 1440|       |
 1441|      5|    a0_8x16 = _mm_unpackhi_epi8(pels_16x16, zero);
 1442|      5|    a1_8x16 = _mm_unpackhi_epi8(temp1, zero);
 1443|      5|    a2_8x16 = _mm_unpackhi_epi8(temp2, zero);
 1444|       |
 1445|      5|    a0_8x16 = _mm_add_epi16(a0_8x16, a2_8x16);
 1446|      5|    a1_8x16 = _mm_add_epi16(a1_8x16, a1_8x16);
 1447|      5|    a0_8x16 = _mm_add_epi16(a0_8x16, const_val2_8x16);
 1448|      5|    a0_8x16 = _mm_add_epi16(a0_8x16, a1_8x16);
 1449|      5|    res2_8x16 = _mm_srai_epi16(a0_8x16, 2);
 1450|       |
 1451|      5|    out1_16x16 = _mm_packus_epi16(res2_8x16, zero);
 1452|      5|    temp1 = _mm_srli_si128(out2_16x16, 8);
 1453|      5|    out1_16x16 = _mm_unpacklo_epi64(temp1, out1_16x16);
 1454|       |
 1455|      5|    str_8x8 = _mm_srli_si128(out1_16x16, 6);
 1456|      5|    _mm_storel_epi64((__m128i *)(pu1_dst + 0 * dst_strd), str_8x8);
 1457|      5|    str_8x8 = _mm_srli_si128(out1_16x16, 4);
 1458|      5|    _mm_storel_epi64((__m128i *)(pu1_dst + 1 * dst_strd), str_8x8);
 1459|      5|    str_8x8 = _mm_srli_si128(out1_16x16, 2);
 1460|      5|    _mm_storel_epi64((__m128i *)(pu1_dst + 2 * dst_strd), str_8x8);
 1461|      5|    _mm_storel_epi64((__m128i *)(pu1_dst + 3 * dst_strd), out1_16x16);
 1462|       |
 1463|      5|    str_8x8 = _mm_srli_si128(out2_16x16, 6);
 1464|      5|    _mm_storel_epi64((__m128i *)(pu1_dst + 4 * dst_strd), str_8x8);
 1465|      5|    str_8x8 = _mm_srli_si128(out2_16x16, 4);
 1466|      5|    _mm_storel_epi64((__m128i *)(pu1_dst + 5 * dst_strd), str_8x8);
 1467|       |    str_8x8 = _mm_srli_si128(out2_16x16, 2);
 1468|      5|    _mm_storel_epi64((__m128i *)(pu1_dst + 6 * dst_strd), str_8x8);
 1469|      5|    _mm_storel_epi64((__m128i *)(pu1_dst + 7 * dst_strd), out2_16x16);
 1470|      5|}
ih264_intra_pred_luma_8x8_mode_vert_l_ssse3:
 1510|     36|{
 1511|     36|    UWORD8 *pu1_top = NULL; /* Pointer to start of top predictors */
 1512|     36|    __m128i top_16x16;
 1513|     36|    __m128i temp1, temp2;
 1514|     36|    __m128i a0_8x16, a1_8x16, a2_8x16;
 1515|     36|    __m128i zero = _mm_setzero_si128();
 1516|     36|    __m128i const_val2_8x16 = _mm_set1_epi16(2);
 1517|     36|    __m128i res1_8x16, res2_8x16, res3_8x16, res4_8x16;
 1518|     36|    __m128i out1_16x16, out2_16x16;
 1519|     36|    UNUSED(src_strd);
  ------------------
  |  |   45|     36|#define UNUSED(x) ((void)(x))
  ------------------
 1520|     36|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|     36|#define UNUSED(x) ((void)(x))
  ------------------
 1521|     36|    pu1_top = pu1_src + BLK8x8SIZE + 1;
  ------------------
  |  |  510|     36|#define BLK8x8SIZE          8
  ------------------
 1522|       |
 1523|     36|    top_16x16 = _mm_loadu_si128((__m128i *)(pu1_top));
 1524|     36|    temp1 = _mm_srli_si128(top_16x16, 1);
 1525|     36|    temp2 = _mm_srli_si128(top_16x16, 2);
 1526|     36|    a0_8x16 = _mm_unpacklo_epi8(top_16x16, zero);
 1527|     36|    a1_8x16 = _mm_unpacklo_epi8(temp1, zero);
 1528|     36|    a2_8x16 = _mm_unpacklo_epi8(temp2, zero);
 1529|       |
 1530|     36|    res1_8x16 = _mm_avg_epu16(a0_8x16, a1_8x16);
 1531|       |
 1532|     36|    a0_8x16 = _mm_add_epi16(a0_8x16, a2_8x16);
 1533|     36|    a1_8x16 = _mm_add_epi16(a1_8x16, a1_8x16);
 1534|     36|    a0_8x16 = _mm_add_epi16(a0_8x16, const_val2_8x16);
 1535|     36|    a0_8x16 = _mm_add_epi16(a0_8x16, a1_8x16);
 1536|     36|    res2_8x16 = _mm_srai_epi16(a0_8x16, 2);
 1537|       |
 1538|     36|    a0_8x16 = _mm_unpackhi_epi8(top_16x16, zero);
 1539|     36|    a1_8x16 = _mm_unpackhi_epi8(temp1, zero);
 1540|     36|    a2_8x16 = _mm_unpackhi_epi8(temp2, zero);
 1541|       |
 1542|     36|    res3_8x16 = _mm_avg_epu16(a0_8x16, a1_8x16);
 1543|       |
 1544|     36|    a0_8x16 = _mm_add_epi16(a0_8x16, a2_8x16);
 1545|     36|    a1_8x16 = _mm_add_epi16(a1_8x16, a1_8x16);
 1546|     36|    a0_8x16 = _mm_add_epi16(a0_8x16, const_val2_8x16);
 1547|     36|    a0_8x16 = _mm_add_epi16(a0_8x16, a1_8x16);
 1548|     36|    res4_8x16 = _mm_srai_epi16(a0_8x16, 2);
 1549|       |
 1550|     36|    out1_16x16 = _mm_packus_epi16(res1_8x16, res3_8x16);
 1551|     36|    out2_16x16 = _mm_packus_epi16(res2_8x16, res4_8x16);
 1552|       |
 1553|     36|    _mm_storel_epi64((__m128i *)(pu1_dst + 0 * dst_strd), out1_16x16);
 1554|     36|    _mm_storel_epi64((__m128i *)(pu1_dst + 1 * dst_strd), out2_16x16);
 1555|     36|    out1_16x16 = _mm_srli_si128(out1_16x16, 1);
 1556|     36|    out2_16x16 = _mm_srli_si128(out2_16x16, 1);
 1557|     36|    _mm_storel_epi64((__m128i *)(pu1_dst + 2 * dst_strd), out1_16x16);
 1558|     36|    _mm_storel_epi64((__m128i *)(pu1_dst + 3 * dst_strd), out2_16x16);
 1559|     36|    out1_16x16 = _mm_srli_si128(out1_16x16, 1);
 1560|     36|    out2_16x16 = _mm_srli_si128(out2_16x16, 1);
 1561|     36|    _mm_storel_epi64((__m128i *)(pu1_dst + 4 * dst_strd), out1_16x16);
 1562|     36|    _mm_storel_epi64((__m128i *)(pu1_dst + 5 * dst_strd), out2_16x16);
 1563|     36|    out1_16x16 = _mm_srli_si128(out1_16x16, 1);
 1564|       |    out2_16x16 = _mm_srli_si128(out2_16x16, 1);
 1565|     36|    _mm_storel_epi64((__m128i *)(pu1_dst + 6 * dst_strd), out1_16x16);
 1566|     36|    _mm_storel_epi64((__m128i *)(pu1_dst + 7 * dst_strd), out2_16x16);
 1567|     36|}
ih264_intra_pred_luma_8x8_mode_horz_u_ssse3:
 1606|     45|{
 1607|     45|    UWORD8 *pu1_left = NULL; /* Pointer to start of left predictors */
 1608|     45|    __m128i left_16x16;
 1609|     45|    __m128i temp1, temp2;
 1610|     45|    __m128i a0_8x16, a1_8x16, a2_8x16;
 1611|     45|    __m128i zero = _mm_setzero_si128();
 1612|     45|    __m128i const_val2_8x16 = _mm_set1_epi16(2);
 1613|     45|    __m128i res1_8x16, res2_8x16;
 1614|     45|    __m128i out1_16x16;
 1615|     45|    __m128i str_8x8;
 1616|     45|    __m128i shuffle_16x16;
 1617|     45|    UNUSED(src_strd);
  ------------------
  |  |   45|     45|#define UNUSED(x) ((void)(x))
  ------------------
 1618|     45|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|     45|#define UNUSED(x) ((void)(x))
  ------------------
 1619|       |
 1620|     45|    pu1_left = pu1_src + BLK8x8SIZE - 1;
  ------------------
  |  |  510|     45|#define BLK8x8SIZE          8
  ------------------
 1621|     45|    shuffle_16x16 = _mm_set_epi8(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
 1622|     45|                                 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
 1623|     45|                                 0x0F);
 1624|       |
 1625|     45|    left_16x16 = _mm_loadu_si128((__m128i *)(pu1_left - 7));
 1626|     45|    temp1 = _mm_srli_si128(left_16x16, 1);
 1627|     45|    a0_8x16 = _mm_unpacklo_epi8(left_16x16, zero);
 1628|     45|    a0_8x16 = _mm_slli_si128(a0_8x16, 2);
 1629|     45|    a1_8x16 = _mm_unpacklo_epi8(left_16x16, zero);
 1630|     45|    a0_8x16 = _mm_shufflelo_epi16(a0_8x16, 0xE5);
 1631|     45|    a2_8x16 = _mm_unpacklo_epi8(temp1, zero);
 1632|       |
 1633|     45|    res1_8x16 = _mm_avg_epu16(a0_8x16, a1_8x16);
 1634|       |
 1635|     45|    a0_8x16 = _mm_add_epi16(a0_8x16, a2_8x16);
 1636|     45|    a1_8x16 = _mm_add_epi16(a1_8x16, a1_8x16);
 1637|     45|    a0_8x16 = _mm_add_epi16(a0_8x16, const_val2_8x16);
 1638|     45|    a0_8x16 = _mm_add_epi16(a0_8x16, a1_8x16);
 1639|     45|    res2_8x16 = _mm_srai_epi16(a0_8x16, 2);
 1640|       |
 1641|     45|    temp1 = _mm_unpacklo_epi16(res1_8x16, res2_8x16);
 1642|     45|    temp2 = _mm_unpackhi_epi16(res1_8x16, res2_8x16);
 1643|     45|    out1_16x16 = _mm_packus_epi16(temp1, temp2);
 1644|     45|    out1_16x16 = _mm_shuffle_epi8(out1_16x16, shuffle_16x16);
 1645|       |
 1646|     45|    str_8x8 = _mm_srli_si128(out1_16x16, 1);
 1647|     45|    _mm_storel_epi64((__m128i *)(pu1_dst + 0 * dst_strd), str_8x8);
 1648|     45|    str_8x8 = _mm_srli_si128(out1_16x16, 3);
 1649|     45|    _mm_storel_epi64((__m128i *)(pu1_dst + 1 * dst_strd), str_8x8);
 1650|     45|    str_8x8 = _mm_srli_si128(out1_16x16, 5);
 1651|     45|    _mm_storel_epi64((__m128i *)(pu1_dst + 2 * dst_strd), str_8x8);
 1652|     45|    str_8x8 = _mm_srli_si128(out1_16x16, 7);
 1653|     45|    _mm_storel_epi64((__m128i *)(pu1_dst + 3 * dst_strd), str_8x8);
 1654|     45|    temp1 = _mm_set1_epi8(pu1_left[-7]);
 1655|     45|    str_8x8 = _mm_unpacklo_epi64(str_8x8, temp1);
 1656|     45|    str_8x8 = _mm_srli_si128(str_8x8, 2);
 1657|     45|    _mm_storel_epi64((__m128i *)(pu1_dst + 4 * dst_strd), str_8x8);
 1658|     45|    str_8x8 = _mm_srli_si128(str_8x8, 2);
 1659|     45|    _mm_storel_epi64((__m128i *)(pu1_dst + 5 * dst_strd), str_8x8);
 1660|     45|    str_8x8 = _mm_srli_si128(str_8x8, 2);
 1661|     45|    _mm_storel_epi64((__m128i *)(pu1_dst + 6 * dst_strd), str_8x8);
 1662|     45|    str_8x8 = _mm_srli_si128(str_8x8, 2);
 1663|     45|    _mm_storel_epi64((__m128i *)(pu1_dst + 7 * dst_strd), str_8x8);
 1664|       |
 1665|     45|}
ih264_intra_pred_luma_16x16_mode_vert_ssse3:
 1707|    670|{
 1708|    670|    UWORD8 *pu1_top;
 1709|    670|    WORD32 dst_strd2, dst_strd3, dst_strd4;
 1710|       |
 1711|    670|    __m128i top_16x8b;
 1712|       |
 1713|    670|    UNUSED(src_strd);
  ------------------
  |  |   45|    670|#define UNUSED(x) ((void)(x))
  ------------------
 1714|    670|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|    670|#define UNUSED(x) ((void)(x))
  ------------------
 1715|       |
 1716|    670|    pu1_top = pu1_src + MB_SIZE + 1;
  ------------------
  |  |  509|    670|#define MB_SIZE             16
  ------------------
 1717|       |
 1718|    670|    dst_strd2 = dst_strd << 1;
 1719|    670|    dst_strd4 = dst_strd << 2;
 1720|       |
 1721|    670|    top_16x8b = _mm_loadu_si128((__m128i *)pu1_top);
 1722|       |
 1723|    670|    dst_strd3 = dst_strd + dst_strd2;
 1724|       |
 1725|    670|    _mm_storeu_si128((__m128i *)pu1_dst, top_16x8b);
 1726|    670|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), top_16x8b);
 1727|    670|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd2), top_16x8b);
 1728|    670|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd3), top_16x8b);
 1729|    670|    pu1_dst += dst_strd4;
 1730|       |
 1731|    670|    _mm_storeu_si128((__m128i *)pu1_dst, top_16x8b);
 1732|    670|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), top_16x8b);
 1733|    670|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd2), top_16x8b);
 1734|    670|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd3), top_16x8b);
 1735|    670|    pu1_dst += dst_strd4;
 1736|       |
 1737|    670|    _mm_storeu_si128((__m128i *)pu1_dst, top_16x8b);
 1738|    670|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), top_16x8b);
 1739|    670|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd2), top_16x8b);
 1740|    670|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd3), top_16x8b);
 1741|    670|    pu1_dst += dst_strd4;
 1742|       |
 1743|    670|    _mm_storeu_si128((__m128i *)pu1_dst, top_16x8b);
 1744|    670|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), top_16x8b);
 1745|    670|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd2), top_16x8b);
 1746|    670|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd3), top_16x8b);
 1747|    670|}
ih264_intra_pred_luma_16x16_mode_horz_ssse3:
 1786|     53|{
 1787|     53|    UWORD8 *pu1_left;
 1788|     53|    WORD32 dst_strd2, dst_strd3, dst_strd4;
 1789|       |
 1790|     53|    __m128i row1_16x8b, row2_16x8b, row3_16x8b, row4_16x8b;
 1791|       |
 1792|     53|    UNUSED(src_strd);
  ------------------
  |  |   45|     53|#define UNUSED(x) ((void)(x))
  ------------------
 1793|     53|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|     53|#define UNUSED(x) ((void)(x))
  ------------------
 1794|       |
 1795|     53|    pu1_left = pu1_src + MB_SIZE - 1;
  ------------------
  |  |  509|     53|#define MB_SIZE             16
  ------------------
 1796|       |
 1797|     53|    dst_strd4 = dst_strd << 2;
 1798|       |
 1799|     53|    dst_strd2 = dst_strd << 1;
 1800|     53|    dst_strd3 = dst_strd4 - dst_strd;
 1801|       |
 1802|     53|    row1_16x8b = _mm_set1_epi8(*(pu1_left));
 1803|     53|    row2_16x8b = _mm_set1_epi8(*(pu1_left - 1));
 1804|     53|    row3_16x8b = _mm_set1_epi8(*(pu1_left - 2));
 1805|     53|    row4_16x8b = _mm_set1_epi8(*(pu1_left - 3));
 1806|       |
 1807|     53|    _mm_storeu_si128((__m128i *)pu1_dst, row1_16x8b);
 1808|     53|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), row2_16x8b);
 1809|     53|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd2), row3_16x8b);
 1810|     53|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd3), row4_16x8b);
 1811|       |
 1812|     53|    pu1_dst += dst_strd4;
 1813|     53|    row1_16x8b = _mm_set1_epi8(*(pu1_left - 4));
 1814|     53|    row2_16x8b = _mm_set1_epi8(*(pu1_left - 5));
 1815|     53|    row3_16x8b = _mm_set1_epi8(*(pu1_left - 6));
 1816|     53|    row4_16x8b = _mm_set1_epi8(*(pu1_left - 7));
 1817|       |
 1818|     53|    _mm_storeu_si128((__m128i *)pu1_dst, row1_16x8b);
 1819|     53|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), row2_16x8b);
 1820|     53|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd2), row3_16x8b);
 1821|     53|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd3), row4_16x8b);
 1822|       |
 1823|     53|    pu1_dst += dst_strd4;
 1824|     53|    row1_16x8b = _mm_set1_epi8(*(pu1_left - 8));
 1825|     53|    row2_16x8b = _mm_set1_epi8(*(pu1_left - 9));
 1826|     53|    row3_16x8b = _mm_set1_epi8(*(pu1_left - 10));
 1827|     53|    row4_16x8b = _mm_set1_epi8(*(pu1_left - 11));
 1828|       |
 1829|     53|    _mm_storeu_si128((__m128i *)pu1_dst, row1_16x8b);
 1830|     53|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), row2_16x8b);
 1831|     53|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd2), row3_16x8b);
 1832|     53|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd3), row4_16x8b);
 1833|       |
 1834|     53|    pu1_dst += dst_strd4;
 1835|     53|    row1_16x8b = _mm_set1_epi8(*(pu1_left - 12));
 1836|     53|    row2_16x8b = _mm_set1_epi8(*(pu1_left - 13));
 1837|     53|    row3_16x8b = _mm_set1_epi8(*(pu1_left - 14));
 1838|     53|    row4_16x8b = _mm_set1_epi8(*(pu1_left - 15));
 1839|       |
 1840|     53|    _mm_storeu_si128((__m128i *)pu1_dst, row1_16x8b);
 1841|     53|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), row2_16x8b);
 1842|     53|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd2), row3_16x8b);
 1843|     53|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd3), row4_16x8b);
 1844|     53|}
ih264_intra_pred_luma_16x16_mode_dc_ssse3:
 1883|     41|{
 1884|     41|    WORD8 u1_useleft, u1_usetop;
 1885|     41|    WORD32 dc_val;
 1886|       |
 1887|     41|    WORD32 dst_strd2, dst_strd3, dst_strd4;
 1888|       |
 1889|     41|    __m128i dc_val_16x8b;
 1890|       |
 1891|     41|    UNUSED(src_strd);
  ------------------
  |  |   45|     41|#define UNUSED(x) ((void)(x))
  ------------------
 1892|       |
 1893|     41|    u1_useleft = BOOLEAN(ngbr_avail & LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|     41|#define BOOLEAN(x) (!!(x))
  ------------------
 1894|     41|    u1_usetop = BOOLEAN(ngbr_avail & TOP_MB_AVAILABLE_MASK);
  ------------------
  |  |   84|     41|#define BOOLEAN(x) (!!(x))
  ------------------
 1895|       |
 1896|     41|    if(u1_useleft || u1_usetop)
  ------------------
  |  Branch (1896:8): [True: 17, False: 24]
  |  Branch (1896:22): [True: 13, False: 11]
  ------------------
 1897|     30|    {
 1898|     30|        WORD32 shft;
 1899|     30|        __m128i val_16x8b, zero_16x8b, sum_8x16b;
 1900|       |
 1901|     30|        dc_val = 0;
 1902|     30|        shft = 3;
 1903|       |
 1904|     30|        zero_16x8b = _mm_setzero_si128();
 1905|       |
 1906|     30|        if(u1_useleft)
  ------------------
  |  Branch (1906:12): [True: 17, False: 13]
  ------------------
 1907|     17|        {
 1908|     17|            UWORD8 *pu1_left;
 1909|       |
 1910|     17|            pu1_left = pu1_src + MB_SIZE - 1;
  ------------------
  |  |  509|     17|#define MB_SIZE             16
  ------------------
 1911|       |
 1912|     17|            val_16x8b = _mm_loadu_si128((__m128i *)(pu1_left - 15));
 1913|     17|            sum_8x16b = _mm_sad_epu8(zero_16x8b, val_16x8b);
 1914|       |
 1915|     17|            shft++;
 1916|     17|            dc_val += 8;
 1917|     17|            dc_val += _mm_extract_epi16(sum_8x16b, 0);
 1918|     17|            dc_val += _mm_extract_epi16(sum_8x16b, 4);
 1919|     17|        }
 1920|     30|        if(u1_usetop)
  ------------------
  |  Branch (1920:12): [True: 29, False: 1]
  ------------------
 1921|     29|        {
 1922|     29|            UWORD8 *pu1_top;
 1923|       |
 1924|     29|            pu1_top = pu1_src + MB_SIZE + 1;
  ------------------
  |  |  509|     29|#define MB_SIZE             16
  ------------------
 1925|       |
 1926|     29|            val_16x8b = _mm_loadu_si128((__m128i *)pu1_top);
 1927|     29|            sum_8x16b = _mm_sad_epu8(zero_16x8b, val_16x8b);
 1928|       |
 1929|     29|            shft++;
 1930|     29|            dc_val += 8;
 1931|     29|            dc_val += _mm_extract_epi16(sum_8x16b, 0);
 1932|     29|            dc_val += _mm_extract_epi16(sum_8x16b, 4);
 1933|     29|        }
 1934|     30|        dc_val = dc_val >> shft;
 1935|     30|    }
 1936|     11|    else
 1937|     11|        dc_val = 128;
 1938|       |
 1939|     41|    dc_val_16x8b =  _mm_set1_epi8(dc_val);
 1940|       |
 1941|     41|    dst_strd2 = dst_strd << 1;
 1942|     41|    dst_strd4 = dst_strd << 2;
 1943|     41|    dst_strd3 = dst_strd + dst_strd2;
 1944|       |
 1945|     41|    _mm_storeu_si128((__m128i *)pu1_dst, dc_val_16x8b);
 1946|     41|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), dc_val_16x8b);
 1947|     41|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd2), dc_val_16x8b);
 1948|     41|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd3), dc_val_16x8b);
 1949|     41|    pu1_dst += dst_strd4;
 1950|       |
 1951|     41|    _mm_storeu_si128((__m128i *)pu1_dst, dc_val_16x8b);
 1952|     41|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), dc_val_16x8b);
 1953|     41|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd2), dc_val_16x8b);
 1954|     41|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd3), dc_val_16x8b);
 1955|     41|    pu1_dst += dst_strd4;
 1956|       |
 1957|     41|    _mm_storeu_si128((__m128i *)pu1_dst, dc_val_16x8b);
 1958|     41|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), dc_val_16x8b);
 1959|     41|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd2), dc_val_16x8b);
 1960|     41|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd3), dc_val_16x8b);
 1961|     41|    pu1_dst += dst_strd4;
 1962|       |
 1963|     41|    _mm_storeu_si128((__m128i *)pu1_dst, dc_val_16x8b);
 1964|     41|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), dc_val_16x8b);
 1965|     41|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd2), dc_val_16x8b);
 1966|     41|    _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd3), dc_val_16x8b);
 1967|     41|}
ih264_intra_pred_luma_16x16_mode_plane_ssse3:
 2006|     68|{
 2007|     68|    UWORD8 *pu1_left, *pu1_top;
 2008|     68|    WORD32 a, b, c;
 2009|       |
 2010|     68|    __m128i rev_8x16b, mul_8x16b, zero_16x8b;
 2011|       |
 2012|     68|    UNUSED(src_strd);
  ------------------
  |  |   45|     68|#define UNUSED(x) ((void)(x))
  ------------------
 2013|     68|    UNUSED(ngbr_avail);
  ------------------
  |  |   45|     68|#define UNUSED(x) ((void)(x))
  ------------------
 2014|       |
 2015|     68|    pu1_top = pu1_src + MB_SIZE + 1;
  ------------------
  |  |  509|     68|#define MB_SIZE             16
  ------------------
 2016|     68|    pu1_left = pu1_src + MB_SIZE - 1;
  ------------------
  |  |  509|     68|#define MB_SIZE             16
  ------------------
 2017|       |
 2018|     68|    rev_8x16b = _mm_setr_epi16(0x0f0e, 0x0d0c, 0x0b0a, 0x0908, 0x0706, 0x0504, 0x0302, 0x0100);
 2019|       |    //used to reverse the order of 16-bit values in a vector
 2020|       |
 2021|     68|    mul_8x16b = _mm_setr_epi16(1, 2, 3, 4, 5, 6, 7, 8);
 2022|     68|    zero_16x8b = _mm_setzero_si128();
 2023|       |
 2024|       |    //calculating a, b and c
 2025|     68|    {
 2026|     68|        WORD32 h, v;
 2027|       |
 2028|     68|        __m128i h_val1_16x8b, h_val2_16x8b;
 2029|     68|        __m128i h_val1_8x16b, h_val2_8x16b, h_val_4x32b;
 2030|     68|        __m128i v_val1_16x8b, v_val2_16x8b;
 2031|     68|        __m128i v_val1_8x16b, v_val2_8x16b, v_val_4x32b;
 2032|     68|        __m128i hv_val_4x32b;
 2033|       |
 2034|     68|        a = (pu1_top[15] + pu1_left[-15]) << 4;
 2035|       |
 2036|     68|        h_val1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_top + 8));
 2037|     68|        h_val2_16x8b = _mm_loadl_epi64((__m128i *)(pu1_top - 1));
 2038|     68|        v_val1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_left - 15));
 2039|     68|        v_val2_16x8b = _mm_loadl_epi64((__m128i *)(pu1_left - 6));
 2040|       |
 2041|     68|        h_val1_8x16b = _mm_unpacklo_epi8(h_val1_16x8b, zero_16x8b);
 2042|     68|        h_val2_8x16b = _mm_unpacklo_epi8(h_val2_16x8b, zero_16x8b);
 2043|     68|        v_val1_8x16b = _mm_unpacklo_epi8(v_val1_16x8b, zero_16x8b);
 2044|     68|        v_val2_8x16b = _mm_unpacklo_epi8(v_val2_16x8b, zero_16x8b);
 2045|       |
 2046|     68|        h_val2_8x16b = _mm_shuffle_epi8(h_val2_8x16b, rev_8x16b);
 2047|     68|        v_val1_8x16b = _mm_shuffle_epi8(v_val1_8x16b, rev_8x16b);
 2048|       |
 2049|     68|        h_val1_8x16b = _mm_sub_epi16(h_val1_8x16b, h_val2_8x16b);
 2050|     68|        v_val1_8x16b = _mm_sub_epi16(v_val1_8x16b, v_val2_8x16b);
 2051|       |
 2052|     68|        h_val_4x32b = _mm_madd_epi16(mul_8x16b, h_val1_8x16b);
 2053|     68|        v_val_4x32b = _mm_madd_epi16(mul_8x16b, v_val1_8x16b);
 2054|       |
 2055|     68|        hv_val_4x32b = _mm_hadd_epi32(h_val_4x32b, v_val_4x32b);
 2056|     68|        hv_val_4x32b = _mm_hadd_epi32(hv_val_4x32b, hv_val_4x32b);
 2057|       |
 2058|     68|        h = _mm_extract_epi16(hv_val_4x32b, 0);
 2059|     68|        v = _mm_extract_epi16(hv_val_4x32b, 2);
 2060|     68|        h = (h << 16) >> 16;
 2061|     68|        v = (v << 16) >> 16;
 2062|       |
 2063|     68|        b = ((h << 2) + h + 32) >> 6;
 2064|     68|        c = ((v << 2) + v + 32) >> 6;
 2065|     68|    }
 2066|       |
 2067|       |    //using a, b and c to compute the fitted plane values
 2068|     68|    {
 2069|     68|        __m128i const_8x16b, b_8x16b, c_8x16b, c2_8x16b;
 2070|     68|        __m128i res1_l_8x16b, res1_h_8x16b;
 2071|     68|        __m128i res2_l_8x16b, res2_h_8x16b;
 2072|     68|        __m128i res1_sh_l_8x16b, res1_sh_h_8x16b, res1_16x8b;
 2073|     68|        __m128i res2_sh_l_8x16b, res2_sh_h_8x16b, res2_16x8b;
 2074|       |
 2075|     68|        b_8x16b = _mm_set1_epi16(b);
 2076|     68|        c_8x16b = _mm_set1_epi16(c);
 2077|     68|        c2_8x16b = _mm_set1_epi16(c << 1);
 2078|     68|        const_8x16b = _mm_set1_epi16(a - c*7 + 16);
 2079|       |
 2080|     68|        res1_h_8x16b = _mm_mullo_epi16(mul_8x16b, b_8x16b);
 2081|       |        //contains {b*1, b*2, b*3,... b*8}
 2082|       |
 2083|     68|        res1_l_8x16b = _mm_shuffle_epi8(res1_h_8x16b, rev_8x16b);
 2084|     68|        res1_l_8x16b = _mm_srli_si128(res1_l_8x16b, 2);
 2085|     68|        res1_l_8x16b = _mm_sub_epi16(zero_16x8b, res1_l_8x16b);
 2086|       |        //contains {-b*7, -b*6,... -b*1, b*0}
 2087|       |
 2088|       |        // rows 1, 2
 2089|     68|        res1_h_8x16b = _mm_add_epi16(res1_h_8x16b, const_8x16b);
 2090|     68|        res1_l_8x16b = _mm_add_epi16(res1_l_8x16b, const_8x16b);
 2091|     68|        res2_h_8x16b = _mm_add_epi16(res1_h_8x16b, c_8x16b);
 2092|     68|        res2_l_8x16b = _mm_add_epi16(res1_l_8x16b, c_8x16b);
 2093|       |
 2094|     68|        res1_sh_h_8x16b = _mm_srai_epi16(res1_h_8x16b, 5);
 2095|     68|        res1_sh_l_8x16b = _mm_srai_epi16(res1_l_8x16b, 5);
 2096|     68|        res2_sh_h_8x16b = _mm_srai_epi16(res2_h_8x16b, 5);
 2097|     68|        res2_sh_l_8x16b = _mm_srai_epi16(res2_l_8x16b, 5);
 2098|       |
 2099|     68|        res1_16x8b = _mm_packus_epi16(res1_sh_l_8x16b, res1_sh_h_8x16b);
 2100|     68|        res2_16x8b = _mm_packus_epi16(res2_sh_l_8x16b, res2_sh_h_8x16b);
 2101|       |
 2102|     68|        _mm_storeu_si128((__m128i *)pu1_dst, res1_16x8b);
 2103|     68|        _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), res2_16x8b);
 2104|       |
 2105|       |        // rows 3, 4
 2106|     68|        res1_h_8x16b = _mm_add_epi16(res1_h_8x16b, c2_8x16b);
 2107|     68|        res1_l_8x16b = _mm_add_epi16(res1_l_8x16b, c2_8x16b);
 2108|     68|        res2_h_8x16b = _mm_add_epi16(res2_h_8x16b, c2_8x16b);
 2109|     68|        res2_l_8x16b = _mm_add_epi16(res2_l_8x16b, c2_8x16b);
 2110|       |
 2111|     68|        res1_sh_h_8x16b = _mm_srai_epi16(res1_h_8x16b, 5);
 2112|     68|        res1_sh_l_8x16b = _mm_srai_epi16(res1_l_8x16b, 5);
 2113|     68|        res2_sh_h_8x16b = _mm_srai_epi16(res2_h_8x16b, 5);
 2114|     68|        res2_sh_l_8x16b = _mm_srai_epi16(res2_l_8x16b, 5);
 2115|       |
 2116|     68|        pu1_dst += dst_strd << 1;
 2117|       |
 2118|     68|        res1_16x8b = _mm_packus_epi16(res1_sh_l_8x16b, res1_sh_h_8x16b);
 2119|     68|        res2_16x8b = _mm_packus_epi16(res2_sh_l_8x16b, res2_sh_h_8x16b);
 2120|       |
 2121|     68|        _mm_storeu_si128((__m128i *)pu1_dst, res1_16x8b);
 2122|     68|        _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), res2_16x8b);
 2123|       |
 2124|       |        // rows 5, 6
 2125|     68|        res1_h_8x16b = _mm_add_epi16(res1_h_8x16b, c2_8x16b);
 2126|     68|        res1_l_8x16b = _mm_add_epi16(res1_l_8x16b, c2_8x16b);
 2127|     68|        res2_h_8x16b = _mm_add_epi16(res2_h_8x16b, c2_8x16b);
 2128|     68|        res2_l_8x16b = _mm_add_epi16(res2_l_8x16b, c2_8x16b);
 2129|       |
 2130|     68|        res1_sh_h_8x16b = _mm_srai_epi16(res1_h_8x16b, 5);
 2131|     68|        res1_sh_l_8x16b = _mm_srai_epi16(res1_l_8x16b, 5);
 2132|     68|        res2_sh_h_8x16b = _mm_srai_epi16(res2_h_8x16b, 5);
 2133|     68|        res2_sh_l_8x16b = _mm_srai_epi16(res2_l_8x16b, 5);
 2134|       |
 2135|     68|        pu1_dst += dst_strd << 1;
 2136|       |
 2137|     68|        res1_16x8b = _mm_packus_epi16(res1_sh_l_8x16b, res1_sh_h_8x16b);
 2138|     68|        res2_16x8b = _mm_packus_epi16(res2_sh_l_8x16b, res2_sh_h_8x16b);
 2139|       |
 2140|     68|        _mm_storeu_si128((__m128i *)pu1_dst, res1_16x8b);
 2141|     68|        _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), res2_16x8b);
 2142|       |
 2143|       |        // rows 7, 8
 2144|     68|        res1_h_8x16b = _mm_add_epi16(res1_h_8x16b, c2_8x16b);
 2145|     68|        res1_l_8x16b = _mm_add_epi16(res1_l_8x16b, c2_8x16b);
 2146|     68|        res2_h_8x16b = _mm_add_epi16(res2_h_8x16b, c2_8x16b);
 2147|     68|        res2_l_8x16b = _mm_add_epi16(res2_l_8x16b, c2_8x16b);
 2148|       |
 2149|     68|        res1_sh_h_8x16b = _mm_srai_epi16(res1_h_8x16b, 5);
 2150|     68|        res1_sh_l_8x16b = _mm_srai_epi16(res1_l_8x16b, 5);
 2151|     68|        res2_sh_h_8x16b = _mm_srai_epi16(res2_h_8x16b, 5);
 2152|     68|        res2_sh_l_8x16b = _mm_srai_epi16(res2_l_8x16b, 5);
 2153|       |
 2154|     68|        pu1_dst += dst_strd << 1;
 2155|       |
 2156|     68|        res1_16x8b = _mm_packus_epi16(res1_sh_l_8x16b, res1_sh_h_8x16b);
 2157|     68|        res2_16x8b = _mm_packus_epi16(res2_sh_l_8x16b, res2_sh_h_8x16b);
 2158|       |
 2159|     68|        _mm_storeu_si128((__m128i *)pu1_dst, res1_16x8b);
 2160|     68|        _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), res2_16x8b);
 2161|       |
 2162|       |        // rows 9, 10
 2163|     68|        res1_h_8x16b = _mm_add_epi16(res1_h_8x16b, c2_8x16b);
 2164|     68|        res1_l_8x16b = _mm_add_epi16(res1_l_8x16b, c2_8x16b);
 2165|     68|        res2_h_8x16b = _mm_add_epi16(res2_h_8x16b, c2_8x16b);
 2166|     68|        res2_l_8x16b = _mm_add_epi16(res2_l_8x16b, c2_8x16b);
 2167|       |
 2168|     68|        res1_sh_h_8x16b = _mm_srai_epi16(res1_h_8x16b, 5);
 2169|     68|        res1_sh_l_8x16b = _mm_srai_epi16(res1_l_8x16b, 5);
 2170|     68|        res2_sh_h_8x16b = _mm_srai_epi16(res2_h_8x16b, 5);
 2171|     68|        res2_sh_l_8x16b = _mm_srai_epi16(res2_l_8x16b, 5);
 2172|       |
 2173|     68|        pu1_dst += dst_strd << 1;
 2174|       |
 2175|     68|        res1_16x8b = _mm_packus_epi16(res1_sh_l_8x16b, res1_sh_h_8x16b);
 2176|     68|        res2_16x8b = _mm_packus_epi16(res2_sh_l_8x16b, res2_sh_h_8x16b);
 2177|       |
 2178|     68|        _mm_storeu_si128((__m128i *)pu1_dst, res1_16x8b);
 2179|     68|        _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), res2_16x8b);
 2180|       |
 2181|       |        // rows 11, 12
 2182|     68|        res1_h_8x16b = _mm_add_epi16(res1_h_8x16b, c2_8x16b);
 2183|     68|        res1_l_8x16b = _mm_add_epi16(res1_l_8x16b, c2_8x16b);
 2184|     68|        res2_h_8x16b = _mm_add_epi16(res2_h_8x16b, c2_8x16b);
 2185|     68|        res2_l_8x16b = _mm_add_epi16(res2_l_8x16b, c2_8x16b);
 2186|       |
 2187|     68|        res1_sh_h_8x16b = _mm_srai_epi16(res1_h_8x16b, 5);
 2188|     68|        res1_sh_l_8x16b = _mm_srai_epi16(res1_l_8x16b, 5);
 2189|     68|        res2_sh_h_8x16b = _mm_srai_epi16(res2_h_8x16b, 5);
 2190|     68|        res2_sh_l_8x16b = _mm_srai_epi16(res2_l_8x16b, 5);
 2191|       |
 2192|     68|        pu1_dst += dst_strd << 1;
 2193|       |
 2194|     68|        res1_16x8b = _mm_packus_epi16(res1_sh_l_8x16b, res1_sh_h_8x16b);
 2195|     68|        res2_16x8b = _mm_packus_epi16(res2_sh_l_8x16b, res2_sh_h_8x16b);
 2196|       |
 2197|     68|        _mm_storeu_si128((__m128i *)pu1_dst, res1_16x8b);
 2198|     68|        _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), res2_16x8b);
 2199|       |
 2200|       |        // rows 13, 14
 2201|     68|        res1_h_8x16b = _mm_add_epi16(res1_h_8x16b, c2_8x16b);
 2202|     68|        res1_l_8x16b = _mm_add_epi16(res1_l_8x16b, c2_8x16b);
 2203|     68|        res2_h_8x16b = _mm_add_epi16(res2_h_8x16b, c2_8x16b);
 2204|     68|        res2_l_8x16b = _mm_add_epi16(res2_l_8x16b, c2_8x16b);
 2205|       |
 2206|     68|        res1_sh_h_8x16b = _mm_srai_epi16(res1_h_8x16b, 5);
 2207|     68|        res1_sh_l_8x16b = _mm_srai_epi16(res1_l_8x16b, 5);
 2208|     68|        res2_sh_h_8x16b = _mm_srai_epi16(res2_h_8x16b, 5);
 2209|     68|        res2_sh_l_8x16b = _mm_srai_epi16(res2_l_8x16b, 5);
 2210|       |
 2211|     68|        pu1_dst += dst_strd << 1;
 2212|       |
 2213|     68|        res1_16x8b = _mm_packus_epi16(res1_sh_l_8x16b, res1_sh_h_8x16b);
 2214|     68|        res2_16x8b = _mm_packus_epi16(res2_sh_l_8x16b, res2_sh_h_8x16b);
 2215|       |
 2216|     68|        _mm_storeu_si128((__m128i *)pu1_dst, res1_16x8b);
 2217|     68|        _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), res2_16x8b);
 2218|       |
 2219|       |        // rows 15, 16
 2220|     68|        res1_h_8x16b = _mm_add_epi16(res1_h_8x16b, c2_8x16b);
 2221|     68|        res1_l_8x16b = _mm_add_epi16(res1_l_8x16b, c2_8x16b);
 2222|     68|        res2_h_8x16b = _mm_add_epi16(res2_h_8x16b, c2_8x16b);
 2223|     68|        res2_l_8x16b = _mm_add_epi16(res2_l_8x16b, c2_8x16b);
 2224|       |
 2225|     68|        res1_sh_h_8x16b = _mm_srai_epi16(res1_h_8x16b, 5);
 2226|     68|        res1_sh_l_8x16b = _mm_srai_epi16(res1_l_8x16b, 5);
 2227|     68|        res2_sh_h_8x16b = _mm_srai_epi16(res2_h_8x16b, 5);
 2228|     68|        res2_sh_l_8x16b = _mm_srai_epi16(res2_l_8x16b, 5);
 2229|       |
 2230|     68|        pu1_dst += dst_strd << 1;
 2231|       |
 2232|     68|        res1_16x8b = _mm_packus_epi16(res1_sh_l_8x16b, res1_sh_h_8x16b);
 2233|     68|        res2_16x8b = _mm_packus_epi16(res2_sh_l_8x16b, res2_sh_h_8x16b);
 2234|       |
 2235|     68|        _mm_storeu_si128((__m128i *)pu1_dst, res1_16x8b);
 2236|     68|        _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), res2_16x8b);
 2237|     68|    }
 2238|     68|}

ih264_pad_left_luma_ssse3:
   96|  1.27k|{
   97|  1.27k|    WORD32 row;
   98|  1.27k|    WORD32 i;
   99|  1.27k|    UWORD8 *pu1_dst;
  100|       |
  101|  1.27k|    ASSERT(pad_size % 8 == 0);
  ------------------
  |  |   56|  1.27k|#define ASSERT(x) assert((x))
  ------------------
  |  Branch (101:5): [True: 0, False: 1.27k]
  |  Branch (101:5): [True: 1.27k, False: 0]
  ------------------
  102|       |
  103|   276k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (103:18): [True: 275k, False: 1.27k]
  ------------------
  104|   275k|    {
  105|   275k|        __m128i src_temp0_16x8b;
  106|       |
  107|   275k|        pu1_dst = pu1_src - pad_size;
  108|   275k|        src_temp0_16x8b = _mm_set1_epi8(*pu1_src);
  109|  1.37M|        for(i = 0; i < pad_size; i += 8)
  ------------------
  |  Branch (109:20): [True: 1.10M, False: 275k]
  ------------------
  110|  1.10M|        {
  111|  1.10M|            _mm_storel_epi64((__m128i *)(pu1_dst + i), src_temp0_16x8b);
  112|  1.10M|        }
  113|   275k|        pu1_src += src_strd;
  114|   275k|    }
  115|       |
  116|  1.27k|}
ih264_pad_left_chroma_ssse3:
  163|  1.27k|{
  164|  1.27k|    WORD32 row;
  165|  1.27k|    WORD32 col;
  166|  1.27k|    UWORD8 *pu1_dst;
  167|       |
  168|  1.27k|    ASSERT(pad_size % 8 == 0);
  ------------------
  |  |   56|  1.27k|#define ASSERT(x) assert((x))
  ------------------
  |  Branch (168:5): [True: 0, False: 1.27k]
  |  Branch (168:5): [True: 1.27k, False: 0]
  ------------------
  169|   138k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (169:18): [True: 137k, False: 1.27k]
  ------------------
  170|   137k|    {
  171|   137k|        __m128i src_temp0_16x8b;
  172|       |
  173|   137k|        pu1_dst = pu1_src - pad_size;
  174|   137k|        src_temp0_16x8b = _mm_set1_epi16(*((UWORD16 *)pu1_src));
  175|   687k|        for(col = 0; col < pad_size; col += 8)
  ------------------
  |  Branch (175:22): [True: 550k, False: 137k]
  ------------------
  176|   550k|        {
  177|   550k|            _mm_storel_epi64((__m128i *)(pu1_dst + col), src_temp0_16x8b);
  178|   550k|        }
  179|   137k|        pu1_src += src_strd;
  180|   137k|    }
  181|       |
  182|  1.27k|}
ih264_pad_right_luma_ssse3:
  229|  1.27k|{
  230|  1.27k|    WORD32 row;
  231|  1.27k|    WORD32 col;
  232|  1.27k|    UWORD8 *pu1_dst;
  233|       |
  234|  1.27k|    ASSERT(pad_size % 8 == 0);
  ------------------
  |  |   56|  1.27k|#define ASSERT(x) assert((x))
  ------------------
  |  Branch (234:5): [True: 0, False: 1.27k]
  |  Branch (234:5): [True: 1.27k, False: 0]
  ------------------
  235|       |
  236|   276k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (236:18): [True: 275k, False: 1.27k]
  ------------------
  237|   275k|    {
  238|   275k|        __m128i src_temp0_16x8b;
  239|       |
  240|   275k|        pu1_dst = pu1_src;
  241|   275k|        src_temp0_16x8b = _mm_set1_epi8(*(pu1_src - 1));
  242|  1.37M|        for(col = 0; col < pad_size; col += 8)
  ------------------
  |  Branch (242:22): [True: 1.10M, False: 275k]
  ------------------
  243|  1.10M|        {
  244|  1.10M|            _mm_storel_epi64((__m128i *)(pu1_dst + col), src_temp0_16x8b);
  245|  1.10M|        }
  246|   275k|        pu1_src += src_strd;
  247|   275k|    }
  248|       |
  249|  1.27k|}
ih264_pad_right_chroma_ssse3:
  296|  1.27k|{
  297|  1.27k|    WORD32 row;
  298|  1.27k|    WORD32 col;
  299|  1.27k|    UWORD8 *pu1_dst;
  300|       |
  301|  1.27k|    ASSERT(pad_size % 8 == 0);
  ------------------
  |  |   56|  1.27k|#define ASSERT(x) assert((x))
  ------------------
  |  Branch (301:5): [True: 0, False: 1.27k]
  |  Branch (301:5): [True: 1.27k, False: 0]
  ------------------
  302|       |
  303|   138k|    for(row = 0; row < ht; row++)
  ------------------
  |  Branch (303:18): [True: 137k, False: 1.27k]
  ------------------
  304|   137k|    {
  305|   137k|        __m128i src_temp0_16x8b;
  306|       |
  307|   137k|        pu1_dst = pu1_src;
  308|   137k|        src_temp0_16x8b = _mm_set1_epi16(*((UWORD16 *)(pu1_src - 2)));
  309|   687k|        for(col = 0; col < pad_size; col += 8)
  ------------------
  |  Branch (309:22): [True: 550k, False: 137k]
  ------------------
  310|   550k|        {
  311|   550k|            _mm_storel_epi64((__m128i *)(pu1_dst + col), src_temp0_16x8b);
  312|   550k|        }
  313|       |
  314|   137k|        pu1_src += src_strd;
  315|   137k|    }
  316|  1.27k|}

isvcd_parse_epslice.c:CLZ:
   97|  14.8k|{
   98|  14.8k|    if(u4_word)
  ------------------
  |  Branch (98:8): [True: 14.6k, False: 187]
  ------------------
   99|  14.6k|    return(__builtin_clz(u4_word));
  100|    187|    else
  101|    187|        return 31;
  102|  14.8k|}
ih264_iquant_itrans_recon_sse42.c:loadu_32:
   47|  54.7k|{
   48|  54.7k|  struct __loadu_si32 {
   49|  54.7k|    int __v;
   50|  54.7k|  } __attribute__((__packed__, __may_alias__));
   51|  54.7k|  int __u = ((struct __loadu_si32*)__a)->__v;
   52|  54.7k|  return __extension__ (__m128i)(__v4si){__u, 0, 0, 0};
   53|  54.7k|}
ih264d_cabac.c:CLZ:
   97|   833k|{
   98|   833k|    if(u4_word)
  ------------------
  |  Branch (98:8): [True: 833k, False: 0]
  ------------------
   99|   833k|    return(__builtin_clz(u4_word));
  100|      0|    else
  101|      0|        return 31;
  102|   833k|}
ih264d_parse_cabac.c:CLZ:
   97|  9.12M|{
   98|  9.12M|    if(u4_word)
  ------------------
  |  Branch (98:8): [True: 9.12M, False: 0]
  ------------------
   99|  9.12M|    return(__builtin_clz(u4_word));
  100|      0|    else
  101|      0|        return 31;
  102|  9.12M|}
ih264d_parse_cavlc.c:CLZ:
   97|   354k|{
   98|   354k|    if(u4_word)
  ------------------
  |  Branch (98:8): [True: 351k, False: 3.22k]
  ------------------
   99|   351k|    return(__builtin_clz(u4_word));
  100|  3.22k|    else
  101|  3.22k|        return 31;
  102|   354k|}
ih264d_parse_islice.c:CLZ:
   97|  4.72k|{
   98|  4.72k|    if(u4_word)
  ------------------
  |  Branch (98:8): [True: 4.71k, False: 7]
  ------------------
   99|  4.71k|    return(__builtin_clz(u4_word));
  100|      7|    else
  101|      7|        return 31;
  102|  4.72k|}
ih264d_parse_mb_header.c:CLZ:
   97|  2.14M|{
   98|  2.14M|    if(u4_word)
  ------------------
  |  Branch (98:8): [True: 2.14M, False: 0]
  ------------------
   99|  2.14M|    return(__builtin_clz(u4_word));
  100|      0|    else
  101|      0|        return 31;
  102|  2.14M|}
ih264d_parse_pslice.c:CLZ:
   97|  10.7k|{
   98|  10.7k|    if(u4_word)
  ------------------
  |  Branch (98:8): [True: 10.4k, False: 257]
  ------------------
   99|  10.4k|    return(__builtin_clz(u4_word));
  100|    257|    else
  101|    257|        return 31;
  102|  10.7k|}
ih264d_process_intra_mb.c:CLZ:
   97|   996k|{
   98|   996k|    if(u4_word)
  ------------------
  |  Branch (98:8): [True: 996k, False: 0]
  ------------------
   99|   996k|    return(__builtin_clz(u4_word));
  100|      0|    else
  101|      0|        return 31;
  102|   996k|}
ih264d_utils.c:CLZ:
   97|  63.5k|{
   98|  63.5k|    if(u4_word)
  ------------------
  |  Branch (98:8): [True: 63.5k, False: 0]
  ------------------
   99|  63.5k|    return(__builtin_clz(u4_word));
  100|      0|    else
  101|      0|        return 31;
  102|  63.5k|}
isvcd_parse_cavlc.c:CLZ:
   97|      3|{
   98|      3|    if(u4_word)
  ------------------
  |  Branch (98:8): [True: 3, False: 0]
  ------------------
   99|      3|    return(__builtin_clz(u4_word));
  100|      0|    else
  101|      0|        return 31;
  102|      3|}
isvcd_parse_eislice.c:CLZ:
   97|  2.60k|{
   98|  2.60k|    if(u4_word)
  ------------------
  |  Branch (98:8): [True: 2.59k, False: 13]
  ------------------
   99|  2.59k|    return(__builtin_clz(u4_word));
  100|     13|    else
  101|     13|        return 31;
  102|  2.60k|}
ih264d_parse_bslice.c:CLZ:
   97|  3.06k|{
   98|  3.06k|    if(u4_word)
  ------------------
  |  Branch (98:8): [True: 3.04k, False: 25]
  ------------------
   99|  3.04k|    return(__builtin_clz(u4_word));
  100|     25|    else
  101|     25|        return 31;
  102|  3.06k|}

ih264_default_weighted_pred_luma_sse42:
   93|  15.7k|{
   94|  15.7k|    __m128i y0_0_16x8b, y0_1_16x8b, y0_2_16x8b, y0_3_16x8b;
   95|  15.7k|    __m128i y1_0_16x8b, y1_1_16x8b, y1_2_16x8b, y1_3_16x8b;
   96|       |
   97|  15.7k|    if(wd == 4)
  ------------------
  |  Branch (97:8): [True: 676, False: 15.0k]
  ------------------
   98|    676|    {
   99|    676|        do
  100|    840|        {
  101|    840|            y0_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src1);
  102|    840|            y0_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src1 + src_strd1));
  103|    840|            y0_2_16x8b = _mm_loadl_epi64(
  104|    840|                            (__m128i *)(pu1_src1 + (src_strd1 << 1)));
  105|    840|            y0_3_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src1 + src_strd1 * 3));
  106|       |
  107|    840|            y1_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src2);
  108|    840|            y1_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src2 + src_strd2));
  109|    840|            y1_2_16x8b = _mm_loadl_epi64(
  110|    840|                            (__m128i *)(pu1_src2 + (src_strd2 << 1)));
  111|    840|            y1_3_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src2 + src_strd2 * 3));
  112|       |
  113|    840|            y0_0_16x8b = _mm_avg_epu8(y0_0_16x8b, y1_0_16x8b);
  114|    840|            y0_1_16x8b = _mm_avg_epu8(y0_1_16x8b, y1_1_16x8b);
  115|    840|            y0_2_16x8b = _mm_avg_epu8(y0_2_16x8b, y1_2_16x8b);
  116|    840|            y0_3_16x8b = _mm_avg_epu8(y0_3_16x8b, y1_3_16x8b);
  117|       |
  118|    840|            *((WORD32 *)(pu1_dst)) = _mm_cvtsi128_si32(y0_0_16x8b);
  119|    840|            *((WORD32 *)(pu1_dst + dst_strd)) = _mm_cvtsi128_si32(y0_1_16x8b);
  120|    840|            *((WORD32 *)(pu1_dst + (dst_strd << 1))) = _mm_cvtsi128_si32(y0_2_16x8b);
  121|    840|            *((WORD32 *)(pu1_dst + dst_strd * 3)) = _mm_cvtsi128_si32(y0_3_16x8b);
  122|       |
  123|    840|            ht -= 4;
  124|    840|            pu1_src1 += src_strd1 << 2;
  125|    840|            pu1_src2 += src_strd2 << 2;
  126|    840|            pu1_dst += dst_strd << 2;
  127|    840|        }
  128|    840|        while(ht > 0);
  ------------------
  |  Branch (128:15): [True: 164, False: 676]
  ------------------
  129|    676|    }
  130|  15.0k|    else if(wd == 8)
  ------------------
  |  Branch (130:13): [True: 4.24k, False: 10.8k]
  ------------------
  131|  4.24k|    {
  132|  4.24k|        do
  133|  11.1k|        {
  134|  11.1k|            y0_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src1);
  135|  11.1k|            y0_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src1 + src_strd1));
  136|  11.1k|            y0_2_16x8b = _mm_loadl_epi64(
  137|  11.1k|                            (__m128i *)(pu1_src1 + (src_strd1 << 1)));
  138|  11.1k|            y0_3_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src1 + src_strd1 * 3));
  139|       |
  140|  11.1k|            y1_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src2);
  141|  11.1k|            y1_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src2 + src_strd2));
  142|  11.1k|            y1_2_16x8b = _mm_loadl_epi64(
  143|  11.1k|                            (__m128i *)(pu1_src2 + (src_strd2 << 1)));
  144|  11.1k|            y1_3_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src2 + src_strd2 * 3));
  145|       |
  146|  11.1k|            y0_0_16x8b = _mm_avg_epu8(y0_0_16x8b, y1_0_16x8b);
  147|  11.1k|            y0_1_16x8b = _mm_avg_epu8(y0_1_16x8b, y1_1_16x8b);
  148|  11.1k|            y0_2_16x8b = _mm_avg_epu8(y0_2_16x8b, y1_2_16x8b);
  149|  11.1k|            y0_3_16x8b = _mm_avg_epu8(y0_3_16x8b, y1_3_16x8b);
  150|       |
  151|  11.1k|            _mm_storel_epi64((__m128i *)pu1_dst, y0_0_16x8b);
  152|  11.1k|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), y0_1_16x8b);
  153|  11.1k|            _mm_storel_epi64((__m128i *)(pu1_dst + (dst_strd << 1)), y0_2_16x8b);
  154|  11.1k|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd * 3), y0_3_16x8b);
  155|       |
  156|  11.1k|            ht -= 4;
  157|  11.1k|            pu1_src1 += src_strd1 << 2;
  158|  11.1k|            pu1_src2 += src_strd2 << 2;
  159|  11.1k|            pu1_dst += dst_strd << 2;
  160|  11.1k|        }
  161|  11.1k|        while(ht > 0);
  ------------------
  |  Branch (161:15): [True: 6.94k, False: 4.24k]
  ------------------
  162|  4.24k|    }
  163|  10.8k|    else // wd == 16
  164|  10.8k|    {
  165|  10.8k|        __m128i y0_4_16x8b, y0_5_16x8b, y0_6_16x8b, y0_7_16x8b;
  166|  10.8k|        __m128i y1_4_16x8b, y1_5_16x8b, y1_6_16x8b, y1_7_16x8b;
  167|       |
  168|  10.8k|        do
  169|  20.7k|        {
  170|  20.7k|            y0_0_16x8b = _mm_loadu_si128((__m128i *)pu1_src1);
  171|  20.7k|            y0_1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src1 + src_strd1));
  172|  20.7k|            y0_2_16x8b = _mm_loadu_si128(
  173|  20.7k|                            (__m128i *)(pu1_src1 + (src_strd1 << 1)));
  174|  20.7k|            y0_3_16x8b = _mm_loadu_si128((__m128i *)(pu1_src1 + src_strd1 * 3));
  175|  20.7k|            y0_4_16x8b = _mm_loadu_si128(
  176|  20.7k|                            (__m128i *)(pu1_src1 + (src_strd1 << 2)));
  177|  20.7k|            y0_5_16x8b = _mm_loadu_si128((__m128i *)(pu1_src1 + src_strd1 * 5));
  178|  20.7k|            y0_6_16x8b = _mm_loadu_si128((__m128i *)(pu1_src1 + src_strd1 * 6));
  179|  20.7k|            y0_7_16x8b = _mm_loadu_si128((__m128i *)(pu1_src1 + src_strd1 * 7));
  180|       |
  181|  20.7k|            y1_0_16x8b = _mm_loadu_si128((__m128i *)pu1_src2);
  182|  20.7k|            y1_1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src2 + src_strd2));
  183|  20.7k|            y1_2_16x8b = _mm_loadu_si128(
  184|  20.7k|                            (__m128i *)(pu1_src2 + (src_strd2 << 1)));
  185|  20.7k|            y1_3_16x8b = _mm_loadu_si128((__m128i *)(pu1_src2 + src_strd2 * 3));
  186|  20.7k|            y1_4_16x8b = _mm_loadu_si128(
  187|  20.7k|                            (__m128i *)(pu1_src2 + (src_strd2 << 2)));
  188|  20.7k|            y1_5_16x8b = _mm_loadu_si128((__m128i *)(pu1_src2 + src_strd2 * 5));
  189|  20.7k|            y1_6_16x8b = _mm_loadu_si128((__m128i *)(pu1_src2 + src_strd2 * 6));
  190|  20.7k|            y1_7_16x8b = _mm_loadu_si128((__m128i *)(pu1_src2 + src_strd2 * 7));
  191|       |
  192|  20.7k|            y0_0_16x8b = _mm_avg_epu8(y0_0_16x8b, y1_0_16x8b);
  193|  20.7k|            y0_1_16x8b = _mm_avg_epu8(y0_1_16x8b, y1_1_16x8b);
  194|  20.7k|            y0_2_16x8b = _mm_avg_epu8(y0_2_16x8b, y1_2_16x8b);
  195|  20.7k|            y0_3_16x8b = _mm_avg_epu8(y0_3_16x8b, y1_3_16x8b);
  196|  20.7k|            y0_4_16x8b = _mm_avg_epu8(y0_4_16x8b, y1_4_16x8b);
  197|  20.7k|            y0_5_16x8b = _mm_avg_epu8(y0_5_16x8b, y1_5_16x8b);
  198|  20.7k|            y0_6_16x8b = _mm_avg_epu8(y0_6_16x8b, y1_6_16x8b);
  199|  20.7k|            y0_7_16x8b = _mm_avg_epu8(y0_7_16x8b, y1_7_16x8b);
  200|       |
  201|  20.7k|            _mm_storeu_si128((__m128i *)pu1_dst, y0_0_16x8b);
  202|  20.7k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), y0_1_16x8b);
  203|  20.7k|            _mm_storeu_si128((__m128i *)(pu1_dst + (dst_strd << 1)), y0_2_16x8b);
  204|  20.7k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd * 3), y0_3_16x8b);
  205|  20.7k|            _mm_storeu_si128((__m128i *)(pu1_dst + (dst_strd << 2)), y0_4_16x8b);
  206|  20.7k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd * 5), y0_5_16x8b);
  207|  20.7k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd * 6), y0_6_16x8b);
  208|  20.7k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd * 7), y0_7_16x8b);
  209|       |
  210|  20.7k|            ht -= 8;
  211|  20.7k|            pu1_src1 += src_strd1 << 3;
  212|  20.7k|            pu1_src2 += src_strd2 << 3;
  213|  20.7k|            pu1_dst += dst_strd << 3;
  214|  20.7k|        }
  215|  20.7k|        while(ht > 0);
  ------------------
  |  Branch (215:15): [True: 9.86k, False: 10.8k]
  ------------------
  216|  10.8k|    }
  217|  15.7k|}
ih264_default_weighted_pred_chroma_sse42:
  256|  15.7k|{
  257|  15.7k|    __m128i uv0_0_16x8b, uv0_1_16x8b;
  258|  15.7k|    __m128i uv1_0_16x8b, uv1_1_16x8b;
  259|       |
  260|  15.7k|    if(wd == 2)
  ------------------
  |  Branch (260:8): [True: 676, False: 15.0k]
  ------------------
  261|    676|    {
  262|    676|        do
  263|    840|        {
  264|    840|            uv0_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src1);
  265|    840|            uv0_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src1 + src_strd1));
  266|       |
  267|    840|            uv1_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src2);
  268|    840|            uv1_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src2 + src_strd2));
  269|       |
  270|    840|            uv0_0_16x8b = _mm_avg_epu8(uv0_0_16x8b, uv1_0_16x8b);
  271|    840|            uv0_1_16x8b = _mm_avg_epu8(uv0_1_16x8b, uv1_1_16x8b);
  272|       |
  273|    840|            *((WORD32 *)(pu1_dst)) = _mm_cvtsi128_si32(uv0_0_16x8b);
  274|    840|            *((WORD32 *)(pu1_dst + dst_strd)) = _mm_cvtsi128_si32(uv0_1_16x8b);
  275|       |
  276|    840|            ht -= 2;
  277|    840|            pu1_src1 += src_strd1 << 1;
  278|    840|            pu1_src2 += src_strd2 << 1;
  279|    840|            pu1_dst += dst_strd << 1;
  280|    840|        }
  281|    840|        while(ht > 0);
  ------------------
  |  Branch (281:15): [True: 164, False: 676]
  ------------------
  282|    676|    }
  283|  15.0k|    else if(wd == 4)
  ------------------
  |  Branch (283:13): [True: 4.24k, False: 10.8k]
  ------------------
  284|  4.24k|    {
  285|  4.24k|        do
  286|  11.1k|        {
  287|  11.1k|            uv0_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src1);
  288|  11.1k|            uv0_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src1 + src_strd1));
  289|       |
  290|  11.1k|            uv1_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src2);
  291|  11.1k|            uv1_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src2 + src_strd2));
  292|       |
  293|  11.1k|            uv0_0_16x8b = _mm_avg_epu8(uv0_0_16x8b, uv1_0_16x8b);
  294|  11.1k|            uv0_1_16x8b = _mm_avg_epu8(uv0_1_16x8b, uv1_1_16x8b);
  295|       |
  296|  11.1k|            _mm_storel_epi64((__m128i *)pu1_dst, uv0_0_16x8b);
  297|  11.1k|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), uv0_1_16x8b);
  298|       |
  299|  11.1k|            ht -= 2;
  300|  11.1k|            pu1_src1 += src_strd1 << 1;
  301|  11.1k|            pu1_src2 += src_strd2 << 1;
  302|  11.1k|            pu1_dst += dst_strd << 1;
  303|  11.1k|        }
  304|  11.1k|        while(ht > 0);
  ------------------
  |  Branch (304:15): [True: 6.94k, False: 4.24k]
  ------------------
  305|  4.24k|    }
  306|  10.8k|    else // wd == 8
  307|  10.8k|    {
  308|  10.8k|        __m128i uv0_2_16x8b, uv0_3_16x8b;
  309|  10.8k|        __m128i uv1_2_16x8b, uv1_3_16x8b;
  310|       |
  311|  10.8k|        do
  312|  20.7k|        {
  313|  20.7k|            uv0_0_16x8b = _mm_loadu_si128((__m128i *)pu1_src1);
  314|  20.7k|            uv0_1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src1 + src_strd1));
  315|  20.7k|            uv0_2_16x8b = _mm_loadu_si128(
  316|  20.7k|                            (__m128i *)(pu1_src1 + (src_strd1 << 1)));
  317|  20.7k|            uv0_3_16x8b = _mm_loadu_si128(
  318|  20.7k|                            (__m128i *)(pu1_src1 + src_strd1 * 3));
  319|       |
  320|  20.7k|            uv1_0_16x8b = _mm_loadu_si128((__m128i *)pu1_src2);
  321|  20.7k|            uv1_1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src2 + src_strd2));
  322|  20.7k|            uv1_2_16x8b = _mm_loadu_si128(
  323|  20.7k|                            (__m128i *)(pu1_src2 + (src_strd2 << 1)));
  324|  20.7k|            uv1_3_16x8b = _mm_loadu_si128(
  325|  20.7k|                            (__m128i *)(pu1_src2 + src_strd2 * 3));
  326|       |
  327|  20.7k|            uv0_0_16x8b = _mm_avg_epu8(uv0_0_16x8b, uv1_0_16x8b);
  328|  20.7k|            uv0_1_16x8b = _mm_avg_epu8(uv0_1_16x8b, uv1_1_16x8b);
  329|  20.7k|            uv0_2_16x8b = _mm_avg_epu8(uv0_2_16x8b, uv1_2_16x8b);
  330|  20.7k|            uv0_3_16x8b = _mm_avg_epu8(uv0_3_16x8b, uv1_3_16x8b);
  331|       |
  332|  20.7k|            _mm_storeu_si128((__m128i *)pu1_dst, uv0_0_16x8b);
  333|  20.7k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), uv0_1_16x8b);
  334|  20.7k|            _mm_storeu_si128(
  335|  20.7k|                            (__m128i *)(pu1_dst + (dst_strd << 1)), uv0_2_16x8b);
  336|  20.7k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd * 3), uv0_3_16x8b);
  337|       |
  338|  20.7k|            ht -= 4;
  339|  20.7k|            pu1_src1 += src_strd1 << 2;
  340|  20.7k|            pu1_src2 += src_strd2 << 2;
  341|  20.7k|            pu1_dst += dst_strd << 2;
  342|  20.7k|        }
  343|  20.7k|        while(ht > 0);
  ------------------
  |  Branch (343:15): [True: 9.86k, False: 10.8k]
  ------------------
  344|  10.8k|    }
  345|  15.7k|}
ih264_weighted_pred_luma_sse42:
  387|  45.7k|{
  388|  45.7k|    __m128i y_0_16x8b, y_1_16x8b, y_2_16x8b, y_3_16x8b;
  389|       |
  390|  45.7k|    __m128i wt_8x16b, round_8x16b, ofst_8x16b;
  391|       |
  392|  45.7k|    WORD32 round_val;
  393|       |
  394|  45.7k|    wt = (WORD16)(wt & 0xffff);
  395|  45.7k|    round_val = 1 << (log_wd - 1);
  396|  45.7k|    ofst = (WORD8)(ofst & 0xff);
  397|       |
  398|  45.7k|    wt_8x16b = _mm_set1_epi16(wt);
  399|  45.7k|    round_8x16b = _mm_set1_epi16(round_val);
  400|  45.7k|    ofst_8x16b = _mm_set1_epi16(ofst);
  401|       |
  402|  45.7k|    if(wd == 4)
  ------------------
  |  Branch (402:8): [True: 266, False: 45.4k]
  ------------------
  403|    266|    {
  404|    266|        __m128i y_0_8x16b, y_2_8x16b;
  405|       |
  406|    266|        do
  407|    408|        {
  408|    408|            y_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  409|    408|            y_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + src_strd));
  410|    408|            y_2_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + (src_strd << 1)));
  411|    408|            y_3_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + src_strd * 3));
  412|       |
  413|    408|            y_0_16x8b = _mm_unpacklo_epi32(y_0_16x8b, y_1_16x8b);
  414|    408|            y_2_16x8b = _mm_unpacklo_epi32(y_2_16x8b, y_3_16x8b);
  415|       |
  416|    408|            y_0_8x16b = _mm_cvtepu8_epi16(y_0_16x8b);
  417|    408|            y_2_8x16b = _mm_cvtepu8_epi16(y_2_16x8b);
  418|       |
  419|    408|            y_0_8x16b = _mm_mullo_epi16(y_0_8x16b, wt_8x16b);
  420|    408|            y_2_8x16b = _mm_mullo_epi16(y_2_8x16b, wt_8x16b);
  421|       |
  422|    408|            y_0_8x16b = _mm_adds_epi16(round_8x16b, y_0_8x16b);
  423|    408|            y_2_8x16b = _mm_adds_epi16(round_8x16b, y_2_8x16b);
  424|       |
  425|    408|            y_0_8x16b = _mm_srai_epi16(y_0_8x16b, log_wd);
  426|    408|            y_2_8x16b = _mm_srai_epi16(y_2_8x16b, log_wd);
  427|       |
  428|    408|            y_0_8x16b = _mm_adds_epi16(ofst_8x16b, y_0_8x16b);
  429|    408|            y_2_8x16b = _mm_adds_epi16(ofst_8x16b, y_2_8x16b);
  430|       |
  431|    408|            y_0_16x8b = _mm_packus_epi16(y_0_8x16b, y_2_8x16b);
  432|    408|            y_1_16x8b = _mm_srli_si128(y_0_16x8b, 4);
  433|    408|            y_2_16x8b = _mm_srli_si128(y_0_16x8b, 8);
  434|    408|            y_3_16x8b = _mm_srli_si128(y_0_16x8b, 12);
  435|       |
  436|    408|            *((WORD32 *)(pu1_dst)) = _mm_cvtsi128_si32(y_0_16x8b);
  437|    408|            *((WORD32 *)(pu1_dst + dst_strd)) = _mm_cvtsi128_si32(y_1_16x8b);
  438|    408|            *((WORD32 *)(pu1_dst + (dst_strd << 1))) = _mm_cvtsi128_si32(y_2_16x8b);
  439|    408|            *((WORD32 *)(pu1_dst + dst_strd * 3)) = _mm_cvtsi128_si32(y_3_16x8b);
  440|       |
  441|    408|            ht -= 4;
  442|    408|            pu1_src += src_strd << 2;
  443|    408|            pu1_dst += dst_strd << 2;
  444|    408|        }
  445|    408|        while(ht > 0);
  ------------------
  |  Branch (445:15): [True: 142, False: 266]
  ------------------
  446|    266|    }
  447|  45.4k|    else if(wd == 8)
  ------------------
  |  Branch (447:13): [True: 3.19k, False: 42.2k]
  ------------------
  448|  3.19k|    {
  449|  3.19k|        __m128i y_0_8x16b, y_1_8x16b, y_2_8x16b, y_3_8x16b;
  450|       |
  451|  3.19k|        do
  452|  8.94k|        {
  453|  8.94k|            y_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  454|  8.94k|            y_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + src_strd));
  455|  8.94k|            y_2_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + (src_strd << 1)));
  456|  8.94k|            y_3_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + src_strd * 3));
  457|       |
  458|  8.94k|            y_0_8x16b = _mm_cvtepu8_epi16(y_0_16x8b);
  459|  8.94k|            y_1_8x16b = _mm_cvtepu8_epi16(y_1_16x8b);
  460|  8.94k|            y_2_8x16b = _mm_cvtepu8_epi16(y_2_16x8b);
  461|  8.94k|            y_3_8x16b = _mm_cvtepu8_epi16(y_3_16x8b);
  462|       |
  463|  8.94k|            y_0_8x16b = _mm_mullo_epi16(y_0_8x16b, wt_8x16b);
  464|  8.94k|            y_1_8x16b = _mm_mullo_epi16(y_1_8x16b, wt_8x16b);
  465|  8.94k|            y_2_8x16b = _mm_mullo_epi16(y_2_8x16b, wt_8x16b);
  466|  8.94k|            y_3_8x16b = _mm_mullo_epi16(y_3_8x16b, wt_8x16b);
  467|       |
  468|  8.94k|            y_0_8x16b = _mm_adds_epi16(round_8x16b, y_0_8x16b);
  469|  8.94k|            y_1_8x16b = _mm_adds_epi16(round_8x16b, y_1_8x16b);
  470|  8.94k|            y_2_8x16b = _mm_adds_epi16(round_8x16b, y_2_8x16b);
  471|  8.94k|            y_3_8x16b = _mm_adds_epi16(round_8x16b, y_3_8x16b);
  472|       |
  473|  8.94k|            y_0_8x16b = _mm_srai_epi16(y_0_8x16b, log_wd);
  474|  8.94k|            y_1_8x16b = _mm_srai_epi16(y_1_8x16b, log_wd);
  475|  8.94k|            y_2_8x16b = _mm_srai_epi16(y_2_8x16b, log_wd);
  476|  8.94k|            y_3_8x16b = _mm_srai_epi16(y_3_8x16b, log_wd);
  477|       |
  478|  8.94k|            y_0_8x16b = _mm_adds_epi16(ofst_8x16b, y_0_8x16b);
  479|  8.94k|            y_1_8x16b = _mm_adds_epi16(ofst_8x16b, y_1_8x16b);
  480|  8.94k|            y_2_8x16b = _mm_adds_epi16(ofst_8x16b, y_2_8x16b);
  481|  8.94k|            y_3_8x16b = _mm_adds_epi16(ofst_8x16b, y_3_8x16b);
  482|       |
  483|  8.94k|            y_0_16x8b = _mm_packus_epi16(y_0_8x16b, y_1_8x16b);
  484|  8.94k|            y_2_16x8b = _mm_packus_epi16(y_2_8x16b, y_3_8x16b);
  485|  8.94k|            y_1_16x8b = _mm_srli_si128(y_0_16x8b, 8);
  486|  8.94k|            y_3_16x8b = _mm_srli_si128(y_2_16x8b, 8);
  487|       |
  488|  8.94k|            _mm_storel_epi64((__m128i *)pu1_dst, y_0_16x8b);
  489|  8.94k|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), y_1_16x8b);
  490|  8.94k|            _mm_storel_epi64((__m128i *)(pu1_dst + (dst_strd << 1)), y_2_16x8b);
  491|  8.94k|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd * 3), y_3_16x8b);
  492|       |
  493|  8.94k|            ht -= 4;
  494|  8.94k|            pu1_src += src_strd << 2;
  495|  8.94k|            pu1_dst += dst_strd << 2;
  496|  8.94k|        }
  497|  8.94k|        while(ht > 0);
  ------------------
  |  Branch (497:15): [True: 5.75k, False: 3.19k]
  ------------------
  498|  3.19k|    }
  499|  42.2k|    else // wd == 16
  500|  42.2k|    {
  501|  42.2k|        __m128i y_0L_8x16b, y_1L_8x16b, y_2L_8x16b, y_3L_8x16b;
  502|  42.2k|        __m128i y_0H_8x16b, y_1H_8x16b, y_2H_8x16b, y_3H_8x16b;
  503|       |
  504|  42.2k|        __m128i zero_16x8b;
  505|  42.2k|        zero_16x8b = _mm_set1_epi8(0);
  506|       |
  507|  42.2k|        do
  508|   165k|        {
  509|   165k|            y_0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
  510|   165k|            y_1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));
  511|   165k|            y_2_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + (src_strd << 1)));
  512|   165k|            y_3_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd * 3));
  513|       |
  514|   165k|            y_0L_8x16b = _mm_cvtepu8_epi16(y_0_16x8b);
  515|   165k|            y_0H_8x16b = _mm_unpackhi_epi8(y_0_16x8b, zero_16x8b);
  516|   165k|            y_1L_8x16b = _mm_cvtepu8_epi16(y_1_16x8b);
  517|   165k|            y_1H_8x16b = _mm_unpackhi_epi8(y_1_16x8b, zero_16x8b);
  518|   165k|            y_2L_8x16b = _mm_cvtepu8_epi16(y_2_16x8b);
  519|   165k|            y_2H_8x16b = _mm_unpackhi_epi8(y_2_16x8b, zero_16x8b);
  520|   165k|            y_3L_8x16b = _mm_cvtepu8_epi16(y_3_16x8b);
  521|   165k|            y_3H_8x16b = _mm_unpackhi_epi8(y_3_16x8b, zero_16x8b);
  522|       |
  523|   165k|            y_0L_8x16b = _mm_mullo_epi16(y_0L_8x16b, wt_8x16b);
  524|   165k|            y_0H_8x16b = _mm_mullo_epi16(y_0H_8x16b, wt_8x16b);
  525|   165k|            y_1L_8x16b = _mm_mullo_epi16(y_1L_8x16b, wt_8x16b);
  526|   165k|            y_1H_8x16b = _mm_mullo_epi16(y_1H_8x16b, wt_8x16b);
  527|   165k|            y_2L_8x16b = _mm_mullo_epi16(y_2L_8x16b, wt_8x16b);
  528|   165k|            y_2H_8x16b = _mm_mullo_epi16(y_2H_8x16b, wt_8x16b);
  529|   165k|            y_3L_8x16b = _mm_mullo_epi16(y_3L_8x16b, wt_8x16b);
  530|   165k|            y_3H_8x16b = _mm_mullo_epi16(y_3H_8x16b, wt_8x16b);
  531|       |
  532|   165k|            y_0L_8x16b = _mm_adds_epi16(round_8x16b, y_0L_8x16b);
  533|   165k|            y_0H_8x16b = _mm_adds_epi16(round_8x16b, y_0H_8x16b);
  534|   165k|            y_1L_8x16b = _mm_adds_epi16(round_8x16b, y_1L_8x16b);
  535|   165k|            y_1H_8x16b = _mm_adds_epi16(round_8x16b, y_1H_8x16b);
  536|   165k|            y_2L_8x16b = _mm_adds_epi16(round_8x16b, y_2L_8x16b);
  537|   165k|            y_2H_8x16b = _mm_adds_epi16(round_8x16b, y_2H_8x16b);
  538|   165k|            y_3L_8x16b = _mm_adds_epi16(round_8x16b, y_3L_8x16b);
  539|   165k|            y_3H_8x16b = _mm_adds_epi16(round_8x16b, y_3H_8x16b);
  540|       |
  541|   165k|            y_0L_8x16b = _mm_srai_epi16(y_0L_8x16b, log_wd);
  542|   165k|            y_0H_8x16b = _mm_srai_epi16(y_0H_8x16b, log_wd);
  543|   165k|            y_1L_8x16b = _mm_srai_epi16(y_1L_8x16b, log_wd);
  544|   165k|            y_1H_8x16b = _mm_srai_epi16(y_1H_8x16b, log_wd);
  545|   165k|            y_2L_8x16b = _mm_srai_epi16(y_2L_8x16b, log_wd);
  546|   165k|            y_2H_8x16b = _mm_srai_epi16(y_2H_8x16b, log_wd);
  547|   165k|            y_3L_8x16b = _mm_srai_epi16(y_3L_8x16b, log_wd);
  548|   165k|            y_3H_8x16b = _mm_srai_epi16(y_3H_8x16b, log_wd);
  549|       |
  550|   165k|            y_0L_8x16b = _mm_adds_epi16(ofst_8x16b, y_0L_8x16b);
  551|   165k|            y_0H_8x16b = _mm_adds_epi16(ofst_8x16b, y_0H_8x16b);
  552|   165k|            y_1L_8x16b = _mm_adds_epi16(ofst_8x16b, y_1L_8x16b);
  553|   165k|            y_1H_8x16b = _mm_adds_epi16(ofst_8x16b, y_1H_8x16b);
  554|   165k|            y_2L_8x16b = _mm_adds_epi16(ofst_8x16b, y_2L_8x16b);
  555|   165k|            y_2H_8x16b = _mm_adds_epi16(ofst_8x16b, y_2H_8x16b);
  556|   165k|            y_3L_8x16b = _mm_adds_epi16(ofst_8x16b, y_3L_8x16b);
  557|   165k|            y_3H_8x16b = _mm_adds_epi16(ofst_8x16b, y_3H_8x16b);
  558|       |
  559|   165k|            y_0_16x8b = _mm_packus_epi16(y_0L_8x16b, y_0H_8x16b);
  560|   165k|            y_1_16x8b = _mm_packus_epi16(y_1L_8x16b, y_1H_8x16b);
  561|   165k|            y_2_16x8b = _mm_packus_epi16(y_2L_8x16b, y_2H_8x16b);
  562|   165k|            y_3_16x8b = _mm_packus_epi16(y_3L_8x16b, y_3H_8x16b);
  563|       |
  564|   165k|            _mm_storeu_si128((__m128i *)pu1_dst, y_0_16x8b);
  565|   165k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), y_1_16x8b);
  566|   165k|            _mm_storeu_si128((__m128i *)(pu1_dst + (dst_strd << 1)), y_2_16x8b);
  567|   165k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd * 3), y_3_16x8b);
  568|       |
  569|   165k|            ht -= 4;
  570|   165k|            pu1_src += src_strd << 2;
  571|   165k|            pu1_dst += dst_strd << 2;
  572|   165k|        }
  573|   165k|        while(ht > 0);
  ------------------
  |  Branch (573:15): [True: 123k, False: 42.2k]
  ------------------
  574|  42.2k|    }
  575|  45.7k|}
ih264_weighted_pred_chroma_sse42:
  617|  45.7k|{
  618|  45.7k|    __m128i y_0_16x8b, y_1_16x8b;
  619|       |
  620|  45.7k|    __m128i wt_8x16b, round_8x16b, ofst_8x16b;
  621|       |
  622|  45.7k|    WORD32 ofst_u, ofst_v;
  623|  45.7k|    WORD32 round_val;
  624|       |
  625|  45.7k|    ofst_u = (WORD8)(ofst & 0xff);
  626|  45.7k|    ofst_v = (WORD8)(ofst >> 8);
  627|  45.7k|    round_val = 1 << (log_wd - 1);
  628|  45.7k|    ofst = (ofst_u & 0xffff) | (ofst_v << 16);
  629|       |
  630|  45.7k|    wt_8x16b = _mm_set1_epi32(wt);
  631|  45.7k|    round_8x16b = _mm_set1_epi16(round_val);
  632|  45.7k|    ofst_8x16b = _mm_set1_epi32(ofst);
  633|       |
  634|  45.7k|    if(wd == 2)
  ------------------
  |  Branch (634:8): [True: 266, False: 45.4k]
  ------------------
  635|    266|    {
  636|    266|        __m128i y_0_8x16b;
  637|       |
  638|    266|        do
  639|    408|        {
  640|    408|            y_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  641|    408|            y_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + src_strd));
  642|       |
  643|    408|            y_0_16x8b = _mm_unpacklo_epi32(y_0_16x8b, y_1_16x8b);
  644|       |
  645|    408|            y_0_8x16b = _mm_cvtepu8_epi16(y_0_16x8b);
  646|       |
  647|    408|            y_0_8x16b = _mm_mullo_epi16(y_0_8x16b, wt_8x16b);
  648|       |
  649|    408|            y_0_8x16b = _mm_adds_epi16(round_8x16b, y_0_8x16b);
  650|       |
  651|    408|            y_0_8x16b = _mm_srai_epi16(y_0_8x16b, log_wd);
  652|       |
  653|    408|            y_0_8x16b = _mm_adds_epi16(ofst_8x16b, y_0_8x16b);
  654|       |
  655|    408|            y_0_16x8b = _mm_packus_epi16(y_0_8x16b, y_0_8x16b);
  656|    408|            y_1_16x8b = _mm_srli_si128(y_0_16x8b, 4);
  657|       |
  658|    408|            *((WORD32 *)(pu1_dst)) = _mm_cvtsi128_si32(y_0_16x8b);
  659|    408|            *((WORD32 *)(pu1_dst + dst_strd)) = _mm_cvtsi128_si32(y_1_16x8b);
  660|       |
  661|    408|            ht -= 2;
  662|    408|            pu1_src += src_strd << 1;
  663|    408|            pu1_dst += dst_strd << 1;
  664|    408|        }
  665|    408|        while(ht > 0);
  ------------------
  |  Branch (665:15): [True: 142, False: 266]
  ------------------
  666|    266|    }
  667|  45.4k|    else if(wd == 4)
  ------------------
  |  Branch (667:13): [True: 3.19k, False: 42.2k]
  ------------------
  668|  3.19k|    {
  669|  3.19k|        __m128i y_0_8x16b, y_1_8x16b;
  670|       |
  671|  3.19k|        do
  672|  8.94k|        {
  673|  8.94k|            y_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src);
  674|  8.94k|            y_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src + src_strd));
  675|       |
  676|  8.94k|            y_0_8x16b = _mm_cvtepu8_epi16(y_0_16x8b);
  677|  8.94k|            y_1_8x16b = _mm_cvtepu8_epi16(y_1_16x8b);
  678|       |
  679|  8.94k|            y_0_8x16b = _mm_mullo_epi16(y_0_8x16b, wt_8x16b);
  680|  8.94k|            y_1_8x16b = _mm_mullo_epi16(y_1_8x16b, wt_8x16b);
  681|       |
  682|  8.94k|            y_0_8x16b = _mm_adds_epi16(round_8x16b, y_0_8x16b);
  683|  8.94k|            y_1_8x16b = _mm_adds_epi16(round_8x16b, y_1_8x16b);
  684|       |
  685|  8.94k|            y_0_8x16b = _mm_srai_epi16(y_0_8x16b, log_wd);
  686|  8.94k|            y_1_8x16b = _mm_srai_epi16(y_1_8x16b, log_wd);
  687|       |
  688|  8.94k|            y_0_8x16b = _mm_adds_epi16(ofst_8x16b, y_0_8x16b);
  689|  8.94k|            y_1_8x16b = _mm_adds_epi16(ofst_8x16b, y_1_8x16b);
  690|       |
  691|  8.94k|            y_0_16x8b = _mm_packus_epi16(y_0_8x16b, y_1_8x16b);
  692|  8.94k|            y_1_16x8b = _mm_srli_si128(y_0_16x8b, 8);
  693|       |
  694|  8.94k|            _mm_storel_epi64((__m128i *)pu1_dst, y_0_16x8b);
  695|  8.94k|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), y_1_16x8b);
  696|       |
  697|  8.94k|            ht -= 2;
  698|  8.94k|            pu1_src += src_strd << 1;
  699|  8.94k|            pu1_dst += dst_strd << 1;
  700|  8.94k|        }
  701|  8.94k|        while(ht > 0);
  ------------------
  |  Branch (701:15): [True: 5.75k, False: 3.19k]
  ------------------
  702|  3.19k|    }
  703|  42.2k|    else // wd == 16
  704|  42.2k|    {
  705|  42.2k|        __m128i y_2_16x8b, y_3_16x8b;
  706|  42.2k|        __m128i y_0L_8x16b, y_1L_8x16b, y_2L_8x16b, y_3L_8x16b;
  707|  42.2k|        __m128i y_0H_8x16b, y_1H_8x16b, y_2H_8x16b, y_3H_8x16b;
  708|       |
  709|  42.2k|        __m128i zero_16x8b;
  710|  42.2k|        zero_16x8b = _mm_set1_epi8(0);
  711|       |
  712|  42.2k|        do
  713|  82.8k|        {
  714|  82.8k|            y_0_16x8b = _mm_loadu_si128((__m128i *)pu1_src);
  715|  82.8k|            y_1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd));
  716|  82.8k|            y_2_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + (src_strd << 1)));
  717|  82.8k|            y_3_16x8b = _mm_loadu_si128((__m128i *)(pu1_src + src_strd * 3));
  718|       |
  719|  82.8k|            y_0L_8x16b = _mm_cvtepu8_epi16(y_0_16x8b);
  720|  82.8k|            y_0H_8x16b = _mm_unpackhi_epi8(y_0_16x8b, zero_16x8b);
  721|  82.8k|            y_1L_8x16b = _mm_cvtepu8_epi16(y_1_16x8b);
  722|  82.8k|            y_1H_8x16b = _mm_unpackhi_epi8(y_1_16x8b, zero_16x8b);
  723|  82.8k|            y_2L_8x16b = _mm_cvtepu8_epi16(y_2_16x8b);
  724|  82.8k|            y_2H_8x16b = _mm_unpackhi_epi8(y_2_16x8b, zero_16x8b);
  725|  82.8k|            y_3L_8x16b = _mm_cvtepu8_epi16(y_3_16x8b);
  726|  82.8k|            y_3H_8x16b = _mm_unpackhi_epi8(y_3_16x8b, zero_16x8b);
  727|       |
  728|  82.8k|            y_0L_8x16b = _mm_mullo_epi16(y_0L_8x16b, wt_8x16b);
  729|  82.8k|            y_0H_8x16b = _mm_mullo_epi16(y_0H_8x16b, wt_8x16b);
  730|  82.8k|            y_1L_8x16b = _mm_mullo_epi16(y_1L_8x16b, wt_8x16b);
  731|  82.8k|            y_1H_8x16b = _mm_mullo_epi16(y_1H_8x16b, wt_8x16b);
  732|  82.8k|            y_2L_8x16b = _mm_mullo_epi16(y_2L_8x16b, wt_8x16b);
  733|  82.8k|            y_2H_8x16b = _mm_mullo_epi16(y_2H_8x16b, wt_8x16b);
  734|  82.8k|            y_3L_8x16b = _mm_mullo_epi16(y_3L_8x16b, wt_8x16b);
  735|  82.8k|            y_3H_8x16b = _mm_mullo_epi16(y_3H_8x16b, wt_8x16b);
  736|       |
  737|  82.8k|            y_0L_8x16b = _mm_adds_epi16(round_8x16b, y_0L_8x16b);
  738|  82.8k|            y_0H_8x16b = _mm_adds_epi16(round_8x16b, y_0H_8x16b);
  739|  82.8k|            y_1L_8x16b = _mm_adds_epi16(round_8x16b, y_1L_8x16b);
  740|  82.8k|            y_1H_8x16b = _mm_adds_epi16(round_8x16b, y_1H_8x16b);
  741|  82.8k|            y_2L_8x16b = _mm_adds_epi16(round_8x16b, y_2L_8x16b);
  742|  82.8k|            y_2H_8x16b = _mm_adds_epi16(round_8x16b, y_2H_8x16b);
  743|  82.8k|            y_3L_8x16b = _mm_adds_epi16(round_8x16b, y_3L_8x16b);
  744|  82.8k|            y_3H_8x16b = _mm_adds_epi16(round_8x16b, y_3H_8x16b);
  745|       |
  746|  82.8k|            y_0L_8x16b = _mm_srai_epi16(y_0L_8x16b, log_wd);
  747|  82.8k|            y_0H_8x16b = _mm_srai_epi16(y_0H_8x16b, log_wd);
  748|  82.8k|            y_1L_8x16b = _mm_srai_epi16(y_1L_8x16b, log_wd);
  749|  82.8k|            y_1H_8x16b = _mm_srai_epi16(y_1H_8x16b, log_wd);
  750|  82.8k|            y_2L_8x16b = _mm_srai_epi16(y_2L_8x16b, log_wd);
  751|  82.8k|            y_2H_8x16b = _mm_srai_epi16(y_2H_8x16b, log_wd);
  752|  82.8k|            y_3L_8x16b = _mm_srai_epi16(y_3L_8x16b, log_wd);
  753|  82.8k|            y_3H_8x16b = _mm_srai_epi16(y_3H_8x16b, log_wd);
  754|       |
  755|  82.8k|            y_0L_8x16b = _mm_adds_epi16(ofst_8x16b, y_0L_8x16b);
  756|  82.8k|            y_0H_8x16b = _mm_adds_epi16(ofst_8x16b, y_0H_8x16b);
  757|  82.8k|            y_1L_8x16b = _mm_adds_epi16(ofst_8x16b, y_1L_8x16b);
  758|  82.8k|            y_1H_8x16b = _mm_adds_epi16(ofst_8x16b, y_1H_8x16b);
  759|  82.8k|            y_2L_8x16b = _mm_adds_epi16(ofst_8x16b, y_2L_8x16b);
  760|  82.8k|            y_2H_8x16b = _mm_adds_epi16(ofst_8x16b, y_2H_8x16b);
  761|  82.8k|            y_3L_8x16b = _mm_adds_epi16(ofst_8x16b, y_3L_8x16b);
  762|  82.8k|            y_3H_8x16b = _mm_adds_epi16(ofst_8x16b, y_3H_8x16b);
  763|       |
  764|  82.8k|            y_0_16x8b = _mm_packus_epi16(y_0L_8x16b, y_0H_8x16b);
  765|  82.8k|            y_1_16x8b = _mm_packus_epi16(y_1L_8x16b, y_1H_8x16b);
  766|  82.8k|            y_2_16x8b = _mm_packus_epi16(y_2L_8x16b, y_2H_8x16b);
  767|  82.8k|            y_3_16x8b = _mm_packus_epi16(y_3L_8x16b, y_3H_8x16b);
  768|       |
  769|  82.8k|            _mm_storeu_si128((__m128i *)pu1_dst, y_0_16x8b);
  770|  82.8k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), y_1_16x8b);
  771|  82.8k|            _mm_storeu_si128((__m128i *)(pu1_dst + (dst_strd << 1)), y_2_16x8b);
  772|  82.8k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd * 3), y_3_16x8b);
  773|       |
  774|  82.8k|            ht -= 4;
  775|  82.8k|            pu1_src += src_strd << 2;
  776|  82.8k|            pu1_dst += dst_strd << 2;
  777|  82.8k|        }
  778|  82.8k|        while(ht > 0);
  ------------------
  |  Branch (778:15): [True: 40.5k, False: 42.2k]
  ------------------
  779|  42.2k|    }
  780|  45.7k|}
ih264_weighted_bi_pred_luma_sse42:
  830|    701|{
  831|    701|    __m128i y1_0_16x8b, y1_1_16x8b;
  832|    701|    __m128i y2_0_16x8b, y2_1_16x8b;
  833|       |
  834|    701|    __m128i wt1_8x16b, wt2_8x16b;
  835|    701|    __m128i ofst_8x16b, round_8x16b;
  836|       |
  837|    701|    WORD32 ofst;
  838|    701|    WORD32 round_val, shft;
  839|       |
  840|    701|    wt1 = (WORD16)(wt1 & 0xffff);
  841|    701|    wt2 = (WORD16)(wt2 & 0xffff);
  842|    701|    round_val = 1 << log_wd;
  843|    701|    shft = log_wd + 1;
  844|    701|    ofst1 = (WORD8)(ofst1 & 0xff);
  845|    701|    ofst2 = (WORD8)(ofst2 & 0xff);
  846|    701|    ofst = (ofst1 + ofst2 + 1) >> 1;
  847|       |
  848|    701|    wt1_8x16b = _mm_set1_epi16(wt1);
  849|    701|    wt2_8x16b = _mm_set1_epi16(wt2);
  850|    701|    round_8x16b = _mm_set1_epi16(round_val);
  851|    701|    ofst_8x16b = _mm_set1_epi16(ofst);
  852|       |
  853|    701|    if(wd == 4)
  ------------------
  |  Branch (853:8): [True: 0, False: 701]
  ------------------
  854|      0|    {
  855|      0|        __m128i y1_2_16x8b, y1_3_16x8b;
  856|      0|        __m128i y2_2_16x8b, y2_3_16x8b;
  857|       |
  858|      0|        __m128i y1_0_8x16b, y1_2_8x16b;
  859|      0|        __m128i y2_0_8x16b, y2_2_8x16b;
  860|       |
  861|      0|        do
  862|      0|        {
  863|      0|            y1_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src1);
  864|      0|            y1_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src1 + src_strd1));
  865|      0|            y1_2_16x8b = _mm_loadl_epi64(
  866|      0|                            (__m128i *)(pu1_src1 + (src_strd1 << 1)));
  867|      0|            y1_3_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src1 + src_strd1 * 3));
  868|       |
  869|      0|            y2_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src2);
  870|      0|            y2_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src2 + src_strd2));
  871|      0|            y2_2_16x8b = _mm_loadl_epi64(
  872|      0|                            (__m128i *)(pu1_src2 + (src_strd2 << 1)));
  873|      0|            y2_3_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src2 + src_strd2 * 3));
  874|       |
  875|      0|            y1_0_16x8b = _mm_unpacklo_epi32(y1_0_16x8b, y1_1_16x8b);
  876|      0|            y1_2_16x8b = _mm_unpacklo_epi32(y1_2_16x8b, y1_3_16x8b);
  877|      0|            y2_0_16x8b = _mm_unpacklo_epi32(y2_0_16x8b, y2_1_16x8b);
  878|      0|            y2_2_16x8b = _mm_unpacklo_epi32(y2_2_16x8b, y2_3_16x8b);
  879|       |
  880|      0|            y1_0_8x16b = _mm_cvtepu8_epi16(y1_0_16x8b);
  881|      0|            y1_2_8x16b = _mm_cvtepu8_epi16(y1_2_16x8b);
  882|      0|            y2_0_8x16b = _mm_cvtepu8_epi16(y2_0_16x8b);
  883|      0|            y2_2_8x16b = _mm_cvtepu8_epi16(y2_2_16x8b);
  884|       |
  885|      0|            y1_0_8x16b = _mm_mullo_epi16(y1_0_8x16b, wt1_8x16b);
  886|      0|            y2_0_8x16b = _mm_mullo_epi16(y2_0_8x16b, wt2_8x16b);
  887|      0|            y1_2_8x16b = _mm_mullo_epi16(y1_2_8x16b, wt1_8x16b);
  888|      0|            y2_2_8x16b = _mm_mullo_epi16(y2_2_8x16b, wt2_8x16b);
  889|       |
  890|      0|            y1_0_8x16b = _mm_adds_epi16(y1_0_8x16b, y2_0_8x16b);
  891|      0|            y1_2_8x16b = _mm_adds_epi16(y1_2_8x16b, y2_2_8x16b);
  892|       |
  893|      0|            y1_0_8x16b = _mm_adds_epi16(round_8x16b, y1_0_8x16b);
  894|      0|            y1_2_8x16b = _mm_adds_epi16(round_8x16b, y1_2_8x16b);
  895|       |
  896|      0|            y1_0_8x16b = _mm_srai_epi16(y1_0_8x16b, shft);
  897|      0|            y1_2_8x16b = _mm_srai_epi16(y1_2_8x16b, shft);
  898|       |
  899|      0|            y1_0_8x16b = _mm_adds_epi16(ofst_8x16b, y1_0_8x16b);
  900|      0|            y1_2_8x16b = _mm_adds_epi16(ofst_8x16b, y1_2_8x16b);
  901|       |
  902|      0|            y1_0_16x8b = _mm_packus_epi16(y1_0_8x16b, y1_2_8x16b);
  903|      0|            y1_1_16x8b = _mm_srli_si128(y1_0_16x8b, 4);
  904|      0|            y1_2_16x8b = _mm_srli_si128(y1_0_16x8b, 8);
  905|      0|            y1_3_16x8b = _mm_srli_si128(y1_0_16x8b, 12);
  906|       |
  907|      0|            *((WORD32 *)(pu1_dst)) = _mm_cvtsi128_si32(y1_0_16x8b);
  908|      0|            *((WORD32 *)(pu1_dst + dst_strd)) = _mm_cvtsi128_si32(y1_1_16x8b);
  909|      0|            *((WORD32 *)(pu1_dst + (dst_strd << 1))) = _mm_cvtsi128_si32(y1_2_16x8b);
  910|      0|            *((WORD32 *)(pu1_dst + dst_strd * 3)) = _mm_cvtsi128_si32(y1_3_16x8b);
  911|       |
  912|       |
  913|      0|            ht -= 4;
  914|      0|            pu1_src1 += src_strd1 << 2;
  915|      0|            pu1_src2 += src_strd2 << 2;
  916|      0|            pu1_dst += dst_strd << 2;
  917|      0|        }
  918|      0|        while(ht > 0);
  ------------------
  |  Branch (918:15): [True: 0, False: 0]
  ------------------
  919|      0|    }
  920|    701|    else if(wd == 8)
  ------------------
  |  Branch (920:13): [True: 44, False: 657]
  ------------------
  921|     44|    {
  922|     44|        __m128i y1_2_16x8b, y1_3_16x8b;
  923|     44|        __m128i y2_2_16x8b, y2_3_16x8b;
  924|       |
  925|     44|        __m128i y1_0_8x16b, y1_1_8x16b, y1_2_8x16b, y1_3_8x16b;
  926|     44|        __m128i y2_0_8x16b, y2_1_8x16b, y2_2_8x16b, y2_3_8x16b;
  927|       |
  928|     44|        do
  929|     96|        {
  930|     96|            y1_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src1);
  931|     96|            y1_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src1 + src_strd1));
  932|     96|            y1_2_16x8b = _mm_loadl_epi64(
  933|     96|                            (__m128i *)(pu1_src1 + (src_strd1 << 1)));
  934|     96|            y1_3_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src1 + src_strd1 * 3));
  935|       |
  936|     96|            y2_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src2);
  937|     96|            y2_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src2 + src_strd2));
  938|     96|            y2_2_16x8b = _mm_loadl_epi64(
  939|     96|                            (__m128i *)(pu1_src2 + (src_strd2 << 1)));
  940|     96|            y2_3_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src2 + src_strd2 * 3));
  941|       |
  942|     96|            y1_0_8x16b = _mm_cvtepu8_epi16(y1_0_16x8b);
  943|     96|            y1_1_8x16b = _mm_cvtepu8_epi16(y1_1_16x8b);
  944|     96|            y1_2_8x16b = _mm_cvtepu8_epi16(y1_2_16x8b);
  945|     96|            y1_3_8x16b = _mm_cvtepu8_epi16(y1_3_16x8b);
  946|       |
  947|     96|            y2_0_8x16b = _mm_cvtepu8_epi16(y2_0_16x8b);
  948|     96|            y2_1_8x16b = _mm_cvtepu8_epi16(y2_1_16x8b);
  949|     96|            y2_2_8x16b = _mm_cvtepu8_epi16(y2_2_16x8b);
  950|     96|            y2_3_8x16b = _mm_cvtepu8_epi16(y2_3_16x8b);
  951|       |
  952|     96|            y1_0_8x16b = _mm_mullo_epi16(y1_0_8x16b, wt1_8x16b);
  953|     96|            y2_0_8x16b = _mm_mullo_epi16(y2_0_8x16b, wt2_8x16b);
  954|     96|            y1_1_8x16b = _mm_mullo_epi16(y1_1_8x16b, wt1_8x16b);
  955|     96|            y2_1_8x16b = _mm_mullo_epi16(y2_1_8x16b, wt2_8x16b);
  956|       |
  957|     96|            y1_2_8x16b = _mm_mullo_epi16(y1_2_8x16b, wt1_8x16b);
  958|     96|            y2_2_8x16b = _mm_mullo_epi16(y2_2_8x16b, wt2_8x16b);
  959|     96|            y1_3_8x16b = _mm_mullo_epi16(y1_3_8x16b, wt1_8x16b);
  960|     96|            y2_3_8x16b = _mm_mullo_epi16(y2_3_8x16b, wt2_8x16b);
  961|       |
  962|     96|            y1_0_8x16b = _mm_adds_epi16(y1_0_8x16b, y2_0_8x16b);
  963|     96|            y1_1_8x16b = _mm_adds_epi16(y1_1_8x16b, y2_1_8x16b);
  964|     96|            y1_2_8x16b = _mm_adds_epi16(y1_2_8x16b, y2_2_8x16b);
  965|     96|            y1_3_8x16b = _mm_adds_epi16(y1_3_8x16b, y2_3_8x16b);
  966|       |
  967|     96|            y1_0_8x16b = _mm_adds_epi16(round_8x16b, y1_0_8x16b);
  968|     96|            y1_1_8x16b = _mm_adds_epi16(round_8x16b, y1_1_8x16b);
  969|     96|            y1_2_8x16b = _mm_adds_epi16(round_8x16b, y1_2_8x16b);
  970|     96|            y1_3_8x16b = _mm_adds_epi16(round_8x16b, y1_3_8x16b);
  971|       |
  972|     96|            y1_0_8x16b = _mm_srai_epi16(y1_0_8x16b, shft);
  973|     96|            y1_1_8x16b = _mm_srai_epi16(y1_1_8x16b, shft);
  974|     96|            y1_2_8x16b = _mm_srai_epi16(y1_2_8x16b, shft);
  975|     96|            y1_3_8x16b = _mm_srai_epi16(y1_3_8x16b, shft);
  976|       |
  977|     96|            y1_0_8x16b = _mm_adds_epi16(ofst_8x16b, y1_0_8x16b);
  978|     96|            y1_1_8x16b = _mm_adds_epi16(ofst_8x16b, y1_1_8x16b);
  979|     96|            y1_2_8x16b = _mm_adds_epi16(ofst_8x16b, y1_2_8x16b);
  980|     96|            y1_3_8x16b = _mm_adds_epi16(ofst_8x16b, y1_3_8x16b);
  981|       |
  982|     96|            y1_0_16x8b = _mm_packus_epi16(y1_0_8x16b, y1_1_8x16b);
  983|     96|            y1_2_16x8b = _mm_packus_epi16(y1_2_8x16b, y1_3_8x16b);
  984|     96|            y1_1_16x8b = _mm_srli_si128(y1_0_16x8b, 8);
  985|     96|            y1_3_16x8b = _mm_srli_si128(y1_2_16x8b, 8);
  986|       |
  987|     96|            _mm_storel_epi64((__m128i *)pu1_dst, y1_0_16x8b);
  988|     96|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), y1_1_16x8b);
  989|     96|            _mm_storel_epi64((__m128i *)(pu1_dst + (dst_strd << 1)), y1_2_16x8b);
  990|     96|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd * 3), y1_3_16x8b);
  991|       |
  992|     96|            ht -= 4;
  993|     96|            pu1_src1 += src_strd1 << 2;
  994|     96|            pu1_src2 += src_strd2 << 2;
  995|     96|            pu1_dst += dst_strd << 2;
  996|     96|        }
  997|     96|        while(ht > 0);
  ------------------
  |  Branch (997:15): [True: 52, False: 44]
  ------------------
  998|     44|    }
  999|    657|    else // wd == 16
 1000|    657|    {
 1001|    657|        __m128i y1_0L_8x16b, y1_0H_8x16b, y1_1L_8x16b, y1_1H_8x16b;
 1002|    657|        __m128i y2_0L_8x16b, y2_0H_8x16b, y2_1L_8x16b, y2_1H_8x16b;
 1003|       |
 1004|    657|        __m128i zero_16x8b;
 1005|    657|        zero_16x8b = _mm_set1_epi8(0);
 1006|       |
 1007|    657|        do
 1008|  5.20k|        {
 1009|  5.20k|            y1_0_16x8b = _mm_loadu_si128((__m128i *)pu1_src1);
 1010|  5.20k|            y1_1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src1 + src_strd1));
 1011|  5.20k|            y2_0_16x8b = _mm_loadu_si128((__m128i *)pu1_src2);
 1012|  5.20k|            y2_1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src2 + src_strd2));
 1013|       |
 1014|  5.20k|            y1_0L_8x16b = _mm_cvtepu8_epi16(y1_0_16x8b);
 1015|  5.20k|            y1_0H_8x16b = _mm_unpackhi_epi8(y1_0_16x8b, zero_16x8b);
 1016|  5.20k|            y1_1L_8x16b = _mm_cvtepu8_epi16(y1_1_16x8b);
 1017|  5.20k|            y1_1H_8x16b = _mm_unpackhi_epi8(y1_1_16x8b, zero_16x8b);
 1018|       |
 1019|  5.20k|            y2_0L_8x16b = _mm_cvtepu8_epi16(y2_0_16x8b);
 1020|  5.20k|            y2_0H_8x16b = _mm_unpackhi_epi8(y2_0_16x8b, zero_16x8b);
 1021|  5.20k|            y2_1L_8x16b = _mm_cvtepu8_epi16(y2_1_16x8b);
 1022|  5.20k|            y2_1H_8x16b = _mm_unpackhi_epi8(y2_1_16x8b, zero_16x8b);
 1023|       |
 1024|  5.20k|            y1_0L_8x16b = _mm_mullo_epi16(y1_0L_8x16b, wt1_8x16b);
 1025|  5.20k|            y1_0H_8x16b = _mm_mullo_epi16(y1_0H_8x16b, wt1_8x16b);
 1026|  5.20k|            y1_1L_8x16b = _mm_mullo_epi16(y1_1L_8x16b, wt1_8x16b);
 1027|  5.20k|            y1_1H_8x16b = _mm_mullo_epi16(y1_1H_8x16b, wt1_8x16b);
 1028|       |
 1029|  5.20k|            y2_0L_8x16b = _mm_mullo_epi16(y2_0L_8x16b, wt2_8x16b);
 1030|  5.20k|            y2_0H_8x16b = _mm_mullo_epi16(y2_0H_8x16b, wt2_8x16b);
 1031|  5.20k|            y2_1L_8x16b = _mm_mullo_epi16(y2_1L_8x16b, wt2_8x16b);
 1032|  5.20k|            y2_1H_8x16b = _mm_mullo_epi16(y2_1H_8x16b, wt2_8x16b);
 1033|       |
 1034|  5.20k|            y1_0L_8x16b = _mm_adds_epi16(y1_0L_8x16b, y2_0L_8x16b);
 1035|  5.20k|            y1_0H_8x16b = _mm_adds_epi16(y1_0H_8x16b, y2_0H_8x16b);
 1036|  5.20k|            y1_1L_8x16b = _mm_adds_epi16(y1_1L_8x16b, y2_1L_8x16b);
 1037|  5.20k|            y1_1H_8x16b = _mm_adds_epi16(y1_1H_8x16b, y2_1H_8x16b);
 1038|       |
 1039|  5.20k|            y1_0L_8x16b = _mm_adds_epi16(round_8x16b, y1_0L_8x16b);
 1040|  5.20k|            y1_0H_8x16b = _mm_adds_epi16(round_8x16b, y1_0H_8x16b);
 1041|  5.20k|            y1_1L_8x16b = _mm_adds_epi16(round_8x16b, y1_1L_8x16b);
 1042|  5.20k|            y1_1H_8x16b = _mm_adds_epi16(round_8x16b, y1_1H_8x16b);
 1043|       |
 1044|  5.20k|            y1_0L_8x16b = _mm_srai_epi16(y1_0L_8x16b, shft);
 1045|  5.20k|            y1_0H_8x16b = _mm_srai_epi16(y1_0H_8x16b, shft);
 1046|  5.20k|            y1_1L_8x16b = _mm_srai_epi16(y1_1L_8x16b, shft);
 1047|  5.20k|            y1_1H_8x16b = _mm_srai_epi16(y1_1H_8x16b, shft);
 1048|       |
 1049|  5.20k|            y1_0L_8x16b = _mm_adds_epi16(ofst_8x16b, y1_0L_8x16b);
 1050|  5.20k|            y1_0H_8x16b = _mm_adds_epi16(ofst_8x16b, y1_0H_8x16b);
 1051|  5.20k|            y1_1L_8x16b = _mm_adds_epi16(ofst_8x16b, y1_1L_8x16b);
 1052|  5.20k|            y1_1H_8x16b = _mm_adds_epi16(ofst_8x16b, y1_1H_8x16b);
 1053|       |
 1054|  5.20k|            y1_0_16x8b = _mm_packus_epi16(y1_0L_8x16b, y1_0H_8x16b);
 1055|  5.20k|            y1_1_16x8b = _mm_packus_epi16(y1_1L_8x16b, y1_1H_8x16b);
 1056|       |
 1057|  5.20k|            _mm_storeu_si128((__m128i *)pu1_dst, y1_0_16x8b);
 1058|  5.20k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), y1_1_16x8b);
 1059|       |
 1060|  5.20k|            ht -= 2;
 1061|  5.20k|            pu1_src1 += src_strd1 << 1;
 1062|  5.20k|            pu1_src2 += src_strd2 << 1;
 1063|  5.20k|            pu1_dst += dst_strd << 1;
 1064|  5.20k|        }
 1065|  5.20k|        while(ht > 0);
  ------------------
  |  Branch (1065:15): [True: 4.54k, False: 657]
  ------------------
 1066|    657|    }
 1067|    701|}
ih264_weighted_bi_pred_chroma_sse42:
 1117|    701|{
 1118|    701|    __m128i y1_0_16x8b, y1_1_16x8b;
 1119|    701|    __m128i y2_0_16x8b, y2_1_16x8b;
 1120|       |
 1121|    701|    __m128i wt1_8x16b, wt2_8x16b;
 1122|    701|    __m128i ofst_8x16b, round_8x16b;
 1123|       |
 1124|    701|    WORD32 ofst1_u, ofst2_u, ofst_u;
 1125|    701|    WORD32 ofst1_v, ofst2_v, ofst_v;
 1126|    701|    WORD32 round_val, shft, ofst_val;
 1127|       |
 1128|    701|    round_val = 1 << log_wd;
 1129|    701|    shft = log_wd + 1;
 1130|       |
 1131|    701|    ofst1_u = (WORD8)(ofst1 & 0xff);
 1132|    701|    ofst1_v = (WORD8)(ofst1 >> 8);
 1133|    701|    ofst2_u = (WORD8)(ofst2 & 0xff);
 1134|    701|    ofst2_v = (WORD8)(ofst2 >> 8);
 1135|       |
 1136|    701|    wt1_8x16b = _mm_set1_epi32(wt1);
 1137|    701|    wt2_8x16b = _mm_set1_epi32(wt2);
 1138|       |
 1139|    701|    ofst_u = (ofst1_u + ofst2_u + 1) >> 1;
 1140|    701|    ofst_v = (ofst1_v + ofst2_v + 1) >> 1;
 1141|    701|    ofst_val = (ofst_u & 0xffff) | (ofst_v << 16);
 1142|       |
 1143|    701|    round_8x16b = _mm_set1_epi16(round_val);
 1144|    701|    ofst_8x16b = _mm_set1_epi32(ofst_val);
 1145|       |
 1146|    701|    if(wd == 2)
  ------------------
  |  Branch (1146:8): [True: 0, False: 701]
  ------------------
 1147|      0|    {
 1148|      0|        __m128i y1_0_8x16b, y2_0_8x16b;
 1149|       |
 1150|      0|        do
 1151|      0|        {
 1152|      0|            y1_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src1);
 1153|      0|            y1_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src1 + src_strd1));
 1154|       |
 1155|      0|            y2_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src2);
 1156|      0|            y2_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src2 + src_strd2));
 1157|       |
 1158|      0|            y1_0_16x8b = _mm_unpacklo_epi32(y1_0_16x8b, y1_1_16x8b);
 1159|      0|            y2_0_16x8b = _mm_unpacklo_epi32(y2_0_16x8b, y2_1_16x8b);
 1160|       |
 1161|      0|            y1_0_8x16b = _mm_cvtepu8_epi16(y1_0_16x8b);
 1162|      0|            y2_0_8x16b = _mm_cvtepu8_epi16(y2_0_16x8b);
 1163|       |
 1164|      0|            y1_0_8x16b = _mm_mullo_epi16(y1_0_8x16b, wt1_8x16b);
 1165|      0|            y2_0_8x16b = _mm_mullo_epi16(y2_0_8x16b, wt2_8x16b);
 1166|       |
 1167|      0|            y1_0_8x16b = _mm_adds_epi16(y1_0_8x16b, y2_0_8x16b);
 1168|      0|            y1_0_8x16b = _mm_adds_epi16(round_8x16b, y1_0_8x16b);
 1169|       |
 1170|      0|            y1_0_8x16b = _mm_srai_epi16(y1_0_8x16b, shft);
 1171|      0|            y1_0_8x16b = _mm_adds_epi16(ofst_8x16b, y1_0_8x16b);
 1172|       |
 1173|      0|            y1_0_16x8b = _mm_packus_epi16(y1_0_8x16b, y1_0_8x16b);
 1174|      0|            y1_1_16x8b = _mm_srli_si128(y1_0_16x8b, 4);
 1175|       |
 1176|      0|            *((WORD32 *)(pu1_dst)) = _mm_cvtsi128_si32(y1_0_16x8b);
 1177|      0|            *((WORD32 *)(pu1_dst + dst_strd)) = _mm_cvtsi128_si32(y1_1_16x8b);
 1178|       |
 1179|      0|            ht -= 2;
 1180|      0|            pu1_src1 += src_strd1 << 1;
 1181|      0|            pu1_src2 += src_strd2 << 1;
 1182|      0|            pu1_dst += dst_strd << 1;
 1183|      0|        }
 1184|      0|        while(ht > 0);
  ------------------
  |  Branch (1184:15): [True: 0, False: 0]
  ------------------
 1185|      0|    }
 1186|    701|    else if(wd == 4)
  ------------------
  |  Branch (1186:13): [True: 44, False: 657]
  ------------------
 1187|     44|    {
 1188|     44|        __m128i y1_0_8x16b, y1_1_8x16b;
 1189|     44|        __m128i y2_0_8x16b, y2_1_8x16b;
 1190|       |
 1191|     44|        do
 1192|     96|        {
 1193|     96|            y1_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src1);
 1194|     96|            y1_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src1 + src_strd1));
 1195|       |
 1196|     96|            y2_0_16x8b = _mm_loadl_epi64((__m128i *)pu1_src2);
 1197|     96|            y2_1_16x8b = _mm_loadl_epi64((__m128i *)(pu1_src2 + src_strd2));
 1198|       |
 1199|     96|            y1_0_8x16b = _mm_cvtepu8_epi16(y1_0_16x8b);
 1200|     96|            y1_1_8x16b = _mm_cvtepu8_epi16(y1_1_16x8b);
 1201|       |
 1202|     96|            y2_0_8x16b = _mm_cvtepu8_epi16(y2_0_16x8b);
 1203|     96|            y2_1_8x16b = _mm_cvtepu8_epi16(y2_1_16x8b);
 1204|       |
 1205|     96|            y1_0_8x16b = _mm_mullo_epi16(y1_0_8x16b, wt1_8x16b);
 1206|     96|            y2_0_8x16b = _mm_mullo_epi16(y2_0_8x16b, wt2_8x16b);
 1207|     96|            y1_1_8x16b = _mm_mullo_epi16(y1_1_8x16b, wt1_8x16b);
 1208|     96|            y2_1_8x16b = _mm_mullo_epi16(y2_1_8x16b, wt2_8x16b);
 1209|       |
 1210|     96|            y1_0_8x16b = _mm_adds_epi16(y1_0_8x16b, y2_0_8x16b);
 1211|     96|            y1_1_8x16b = _mm_adds_epi16(y1_1_8x16b, y2_1_8x16b);
 1212|       |
 1213|     96|            y1_0_8x16b = _mm_adds_epi16(round_8x16b, y1_0_8x16b);
 1214|     96|            y1_1_8x16b = _mm_adds_epi16(round_8x16b, y1_1_8x16b);
 1215|       |
 1216|     96|            y1_0_8x16b = _mm_srai_epi16(y1_0_8x16b, shft);
 1217|     96|            y1_1_8x16b = _mm_srai_epi16(y1_1_8x16b, shft);
 1218|       |
 1219|     96|            y1_0_8x16b = _mm_adds_epi16(ofst_8x16b, y1_0_8x16b);
 1220|     96|            y1_1_8x16b = _mm_adds_epi16(ofst_8x16b, y1_1_8x16b);
 1221|       |
 1222|     96|            y1_0_16x8b = _mm_packus_epi16(y1_0_8x16b, y1_1_8x16b);
 1223|     96|            y1_1_16x8b = _mm_srli_si128(y1_0_16x8b, 8);
 1224|       |
 1225|     96|            _mm_storel_epi64((__m128i *)pu1_dst, y1_0_16x8b);
 1226|     96|            _mm_storel_epi64((__m128i *)(pu1_dst + dst_strd), y1_1_16x8b);
 1227|       |
 1228|     96|            ht -= 2;
 1229|     96|            pu1_src1 += src_strd1 << 1;
 1230|     96|            pu1_src2 += src_strd2 << 1;
 1231|     96|            pu1_dst += dst_strd << 1;
 1232|     96|        }
 1233|     96|        while(ht > 0);
  ------------------
  |  Branch (1233:15): [True: 52, False: 44]
  ------------------
 1234|     44|    }
 1235|    657|    else // wd == 8
 1236|    657|    {
 1237|    657|        __m128i y1_0L_8x16b, y1_0H_8x16b, y1_1L_8x16b, y1_1H_8x16b;
 1238|    657|        __m128i y2_0L_8x16b, y2_0H_8x16b, y2_1L_8x16b, y2_1H_8x16b;
 1239|       |
 1240|    657|        __m128i zero_16x8b;
 1241|    657|        zero_16x8b = _mm_set1_epi8(0);
 1242|       |
 1243|    657|        do
 1244|  2.60k|        {
 1245|  2.60k|            y1_0_16x8b = _mm_loadu_si128((__m128i *)pu1_src1);
 1246|  2.60k|            y1_1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src1 + src_strd1));
 1247|  2.60k|            y2_0_16x8b = _mm_loadu_si128((__m128i *)pu1_src2);
 1248|  2.60k|            y2_1_16x8b = _mm_loadu_si128((__m128i *)(pu1_src2 + src_strd2));
 1249|       |
 1250|  2.60k|            y1_0L_8x16b = _mm_cvtepu8_epi16(y1_0_16x8b);
 1251|  2.60k|            y1_0H_8x16b = _mm_unpackhi_epi8(y1_0_16x8b, zero_16x8b);
 1252|  2.60k|            y1_1L_8x16b = _mm_cvtepu8_epi16(y1_1_16x8b);
 1253|  2.60k|            y1_1H_8x16b = _mm_unpackhi_epi8(y1_1_16x8b, zero_16x8b);
 1254|       |
 1255|  2.60k|            y2_0L_8x16b = _mm_cvtepu8_epi16(y2_0_16x8b);
 1256|  2.60k|            y2_0H_8x16b = _mm_unpackhi_epi8(y2_0_16x8b, zero_16x8b);
 1257|  2.60k|            y2_1L_8x16b = _mm_cvtepu8_epi16(y2_1_16x8b);
 1258|  2.60k|            y2_1H_8x16b = _mm_unpackhi_epi8(y2_1_16x8b, zero_16x8b);
 1259|       |
 1260|  2.60k|            y1_0L_8x16b = _mm_mullo_epi16(y1_0L_8x16b, wt1_8x16b);
 1261|  2.60k|            y1_0H_8x16b = _mm_mullo_epi16(y1_0H_8x16b, wt1_8x16b);
 1262|  2.60k|            y1_1L_8x16b = _mm_mullo_epi16(y1_1L_8x16b, wt1_8x16b);
 1263|  2.60k|            y1_1H_8x16b = _mm_mullo_epi16(y1_1H_8x16b, wt1_8x16b);
 1264|       |
 1265|  2.60k|            y2_0L_8x16b = _mm_mullo_epi16(y2_0L_8x16b, wt2_8x16b);
 1266|  2.60k|            y2_0H_8x16b = _mm_mullo_epi16(y2_0H_8x16b, wt2_8x16b);
 1267|  2.60k|            y2_1L_8x16b = _mm_mullo_epi16(y2_1L_8x16b, wt2_8x16b);
 1268|  2.60k|            y2_1H_8x16b = _mm_mullo_epi16(y2_1H_8x16b, wt2_8x16b);
 1269|       |
 1270|  2.60k|            y1_0L_8x16b = _mm_adds_epi16(y1_0L_8x16b, y2_0L_8x16b);
 1271|  2.60k|            y1_0H_8x16b = _mm_adds_epi16(y1_0H_8x16b, y2_0H_8x16b);
 1272|  2.60k|            y1_1L_8x16b = _mm_adds_epi16(y1_1L_8x16b, y2_1L_8x16b);
 1273|  2.60k|            y1_1H_8x16b = _mm_adds_epi16(y1_1H_8x16b, y2_1H_8x16b);
 1274|       |
 1275|  2.60k|            y1_0L_8x16b = _mm_adds_epi16(round_8x16b, y1_0L_8x16b);
 1276|  2.60k|            y1_0H_8x16b = _mm_adds_epi16(round_8x16b, y1_0H_8x16b);
 1277|  2.60k|            y1_1L_8x16b = _mm_adds_epi16(round_8x16b, y1_1L_8x16b);
 1278|  2.60k|            y1_1H_8x16b = _mm_adds_epi16(round_8x16b, y1_1H_8x16b);
 1279|       |
 1280|  2.60k|            y1_0L_8x16b = _mm_srai_epi16(y1_0L_8x16b, shft);
 1281|  2.60k|            y1_0H_8x16b = _mm_srai_epi16(y1_0H_8x16b, shft);
 1282|  2.60k|            y1_1L_8x16b = _mm_srai_epi16(y1_1L_8x16b, shft);
 1283|  2.60k|            y1_1H_8x16b = _mm_srai_epi16(y1_1H_8x16b, shft);
 1284|       |
 1285|  2.60k|            y1_0L_8x16b = _mm_adds_epi16(ofst_8x16b, y1_0L_8x16b);
 1286|  2.60k|            y1_0H_8x16b = _mm_adds_epi16(ofst_8x16b, y1_0H_8x16b);
 1287|  2.60k|            y1_1L_8x16b = _mm_adds_epi16(ofst_8x16b, y1_1L_8x16b);
 1288|  2.60k|            y1_1H_8x16b = _mm_adds_epi16(ofst_8x16b, y1_1H_8x16b);
 1289|       |
 1290|  2.60k|            y1_0_16x8b = _mm_packus_epi16(y1_0L_8x16b, y1_0H_8x16b);
 1291|  2.60k|            y1_1_16x8b = _mm_packus_epi16(y1_1L_8x16b, y1_1H_8x16b);
 1292|       |
 1293|  2.60k|            _mm_storeu_si128((__m128i *)pu1_dst, y1_0_16x8b);
 1294|  2.60k|            _mm_storeu_si128((__m128i *)(pu1_dst + dst_strd), y1_1_16x8b);
 1295|       |
 1296|  2.60k|            ht -= 2;
 1297|  2.60k|            pu1_src1 += src_strd1 << 1;
 1298|  2.60k|            pu1_src2 += src_strd2 << 1;
 1299|  2.60k|            pu1_dst += dst_strd << 1;
 1300|  2.60k|        }
 1301|  2.60k|        while(ht > 0);
  ------------------
  |  Branch (1301:15): [True: 1.94k, False: 657]
  ------------------
 1302|    657|    }
 1303|    701|}

ih264d_export_sei_params:
  191|  6.11k|{
  192|  6.11k|    WORD32 i4_status = IV_SUCCESS;
  193|  6.11k|    sei *ps_sei = (sei *)ps_dec->pv_disp_sei_params;
  194|       |
  195|  6.11k|    i4_status = ih264d_export_sei_mdcv_params(ps_sei_decode_op, ps_sei, &ps_dec->s_sei_export);
  196|  6.11k|    i4_status = ih264d_export_sei_cll_params(ps_sei_decode_op, ps_sei, &ps_dec->s_sei_export);
  197|  6.11k|    i4_status = ih264d_export_sei_ave_params(ps_sei_decode_op, ps_sei, &ps_dec->s_sei_export);
  198|  6.11k|    i4_status = ih264d_export_sei_ccv_params(ps_sei_decode_op, ps_sei, &ps_dec->s_sei_export);
  199|  6.11k|    i4_status = ih264d_export_sei_sii_params(ps_sei_decode_op, ps_sei, &ps_dec->s_sei_export);
  200|  6.11k|    i4_status = ih264d_export_sei_fgc_params(ps_sei_decode_op, ps_sei, &ps_dec->s_sei_export);
  201|       |
  202|  6.11k|    UNUSED(i4_status);
  ------------------
  |  |   45|  6.11k|#define UNUSED(x) ((void)(x))
  ------------------
  203|  6.11k|}
ih264d_map_error:
 1928|  4.23k|{
 1929|  4.23k|    UWORD32 temp = 0;
 1930|       |
 1931|  4.23k|    switch(i4_err_status)
  ------------------
  |  Branch (1931:12): [True: 257, False: 3.97k]
  ------------------
 1932|  4.23k|    {
 1933|      0|        case ERROR_MEM_ALLOC_ISRAM_T:
  ------------------
  |  Branch (1933:9): [True: 0, False: 4.23k]
  ------------------
 1934|      0|        case ERROR_MEM_ALLOC_SDRAM_T:
  ------------------
  |  Branch (1934:9): [True: 0, False: 4.23k]
  ------------------
 1935|      0|        case ERROR_BUF_MGR:
  ------------------
  |  Branch (1935:9): [True: 0, False: 4.23k]
  ------------------
 1936|      0|        case ERROR_MB_GROUP_ASSGN_T:
  ------------------
  |  Branch (1936:9): [True: 0, False: 4.23k]
  ------------------
 1937|      0|        case ERROR_FRAME_LIMIT_OVER:
  ------------------
  |  Branch (1937:9): [True: 0, False: 4.23k]
  ------------------
 1938|      0|        case ERROR_ACTUAL_RESOLUTION_GREATER_THAN_INIT:
  ------------------
  |  Branch (1938:9): [True: 0, False: 4.23k]
  ------------------
 1939|      0|        case ERROR_PROFILE_NOT_SUPPORTED:
  ------------------
  |  Branch (1939:9): [True: 0, False: 4.23k]
  ------------------
 1940|      0|        case ERROR_INIT_NOT_DONE:
  ------------------
  |  Branch (1940:9): [True: 0, False: 4.23k]
  ------------------
 1941|      0|        case IVD_MEM_ALLOC_FAILED:
  ------------------
  |  Branch (1941:9): [True: 0, False: 4.23k]
  ------------------
 1942|     35|        case ERROR_FEATURE_UNAVAIL:
  ------------------
  |  Branch (1942:9): [True: 35, False: 4.19k]
  ------------------
 1943|     48|        case IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED:
  ------------------
  |  Branch (1943:9): [True: 13, False: 4.21k]
  ------------------
 1944|     48|            temp = 1 << IVD_FATALERROR;
 1945|     48|            H264_DEC_DEBUG_PRINT("\nFatal Error\n");
  ------------------
  |  |   39|     48|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
 1946|     48|            break;
 1947|       |
 1948|      0|        case ERROR_DBP_MANAGER_T:
  ------------------
  |  Branch (1948:9): [True: 0, False: 4.23k]
  ------------------
 1949|      0|        case ERROR_GAPS_IN_FRM_NUM:
  ------------------
  |  Branch (1949:9): [True: 0, False: 4.23k]
  ------------------
 1950|      0|        case ERROR_UNKNOWN_NAL:
  ------------------
  |  Branch (1950:9): [True: 0, False: 4.23k]
  ------------------
 1951|      0|        case ERROR_INV_MB_SLC_GRP_T:
  ------------------
  |  Branch (1951:9): [True: 0, False: 4.23k]
  ------------------
 1952|      0|        case ERROR_MULTIPLE_SLC_GRP_T:
  ------------------
  |  Branch (1952:9): [True: 0, False: 4.23k]
  ------------------
 1953|      0|        case ERROR_UNKNOWN_LEVEL:
  ------------------
  |  Branch (1953:9): [True: 0, False: 4.23k]
  ------------------
 1954|      0|        case ERROR_UNAVAIL_PICBUF_T:
  ------------------
  |  Branch (1954:9): [True: 0, False: 4.23k]
  ------------------
 1955|      0|        case ERROR_UNAVAIL_MVBUF_T:
  ------------------
  |  Branch (1955:9): [True: 0, False: 4.23k]
  ------------------
 1956|      0|        case ERROR_UNAVAIL_DISPBUF_T:
  ------------------
  |  Branch (1956:9): [True: 0, False: 4.23k]
  ------------------
 1957|      1|        case ERROR_NUM_REF:
  ------------------
  |  Branch (1957:9): [True: 1, False: 4.22k]
  ------------------
 1958|      1|        case ERROR_REFIDX_ORDER_T:
  ------------------
  |  Branch (1958:9): [True: 0, False: 4.23k]
  ------------------
 1959|      1|        case ERROR_PIC0_NOT_FOUND_T:
  ------------------
  |  Branch (1959:9): [True: 0, False: 4.23k]
  ------------------
 1960|      1|        case ERROR_MB_TYPE:
  ------------------
  |  Branch (1960:9): [True: 0, False: 4.23k]
  ------------------
 1961|      1|        case ERROR_SUB_MB_TYPE:
  ------------------
  |  Branch (1961:9): [True: 0, False: 4.23k]
  ------------------
 1962|      1|        case ERROR_CBP:
  ------------------
  |  Branch (1962:9): [True: 0, False: 4.23k]
  ------------------
 1963|     44|        case ERROR_REF_IDX:
  ------------------
  |  Branch (1963:9): [True: 43, False: 4.18k]
  ------------------
 1964|     44|        case ERROR_NUM_MV:
  ------------------
  |  Branch (1964:9): [True: 0, False: 4.23k]
  ------------------
 1965|     44|        case ERROR_CHROMA_PRED_MODE:
  ------------------
  |  Branch (1965:9): [True: 0, False: 4.23k]
  ------------------
 1966|     44|        case ERROR_INTRAPRED:
  ------------------
  |  Branch (1966:9): [True: 0, False: 4.23k]
  ------------------
 1967|     44|        case ERROR_NEXT_MB_ADDRESS_T:
  ------------------
  |  Branch (1967:9): [True: 0, False: 4.23k]
  ------------------
 1968|     44|        case ERROR_MB_ADDRESS_T:
  ------------------
  |  Branch (1968:9): [True: 0, False: 4.23k]
  ------------------
 1969|     44|        case ERROR_PIC1_NOT_FOUND_T:
  ------------------
  |  Branch (1969:9): [True: 0, False: 4.23k]
  ------------------
 1970|     44|        case ERROR_CAVLC_NUM_COEFF_T:
  ------------------
  |  Branch (1970:9): [True: 0, False: 4.23k]
  ------------------
 1971|     44|        case ERROR_CAVLC_SCAN_POS_T:
  ------------------
  |  Branch (1971:9): [True: 0, False: 4.23k]
  ------------------
 1972|     44|        case ERROR_PRED_WEIGHT_TABLE_T:
  ------------------
  |  Branch (1972:9): [True: 0, False: 4.23k]
  ------------------
 1973|     44|        case ERROR_CORRUPTED_SLICE:
  ------------------
  |  Branch (1973:9): [True: 0, False: 4.23k]
  ------------------
 1974|     44|            temp = 1 << IVD_CORRUPTEDDATA;
 1975|     44|            break;
 1976|       |
 1977|      0|        case ERROR_NOT_SUPP_RESOLUTION:
  ------------------
  |  Branch (1977:9): [True: 0, False: 4.23k]
  ------------------
 1978|      0|        case ERROR_ACTUAL_LEVEL_GREATER_THAN_INIT:
  ------------------
  |  Branch (1978:9): [True: 0, False: 4.23k]
  ------------------
 1979|      0|            temp = 1 << IVD_UNSUPPORTEDINPUT;
 1980|      0|            break;
 1981|       |
 1982|      0|        case ERROR_INVALID_PIC_PARAM:
  ------------------
  |  Branch (1982:9): [True: 0, False: 4.23k]
  ------------------
 1983|      0|        case ERROR_INVALID_SEQ_PARAM:
  ------------------
  |  Branch (1983:9): [True: 0, False: 4.23k]
  ------------------
 1984|      0|        case ERROR_EGC_EXCEED_32_1_T:
  ------------------
  |  Branch (1984:9): [True: 0, False: 4.23k]
  ------------------
 1985|      0|        case ERROR_EGC_EXCEED_32_2_T:
  ------------------
  |  Branch (1985:9): [True: 0, False: 4.23k]
  ------------------
 1986|      0|        case ERROR_INV_RANGE_TEV_T:
  ------------------
  |  Branch (1986:9): [True: 0, False: 4.23k]
  ------------------
 1987|      0|        case ERROR_INV_SLC_TYPE_T:
  ------------------
  |  Branch (1987:9): [True: 0, False: 4.23k]
  ------------------
 1988|     14|        case ERROR_INV_POC_TYPE_T:
  ------------------
  |  Branch (1988:9): [True: 14, False: 4.21k]
  ------------------
 1989|     81|        case ERROR_INV_RANGE_QP_T:
  ------------------
  |  Branch (1989:9): [True: 67, False: 4.16k]
  ------------------
 1990|    120|        case ERROR_INV_SPS_PPS_T:
  ------------------
  |  Branch (1990:9): [True: 39, False: 4.19k]
  ------------------
 1991|    120|        case ERROR_INV_SLICE_HDR_T:
  ------------------
  |  Branch (1991:9): [True: 0, False: 4.23k]
  ------------------
 1992|    120|        case ERROR_INV_SEI_MDCV_PARAMS:
  ------------------
  |  Branch (1992:9): [True: 0, False: 4.23k]
  ------------------
 1993|    120|        case ERROR_INV_SEI_CLL_PARAMS:
  ------------------
  |  Branch (1993:9): [True: 0, False: 4.23k]
  ------------------
 1994|    120|        case ERROR_INV_SEI_AVE_PARAMS:
  ------------------
  |  Branch (1994:9): [True: 0, False: 4.23k]
  ------------------
 1995|    121|        case ERROR_INV_SEI_CCV_PARAMS:
  ------------------
  |  Branch (1995:9): [True: 1, False: 4.22k]
  ------------------
 1996|    122|        case ERROR_INV_SEI_SII_PARAMS:
  ------------------
  |  Branch (1996:9): [True: 1, False: 4.22k]
  ------------------
 1997|       |
 1998|    122|            temp = 1 << IVD_CORRUPTEDHEADER;
 1999|    122|            break;
 2000|       |
 2001|      0|        case ERROR_EOB_FLUSHBITS_T:
  ------------------
  |  Branch (2001:9): [True: 0, False: 4.23k]
  ------------------
 2002|     43|        case ERROR_EOB_GETBITS_T:
  ------------------
  |  Branch (2002:9): [True: 43, False: 4.18k]
  ------------------
 2003|     43|        case ERROR_EOB_GETBIT_T:
  ------------------
  |  Branch (2003:9): [True: 0, False: 4.23k]
  ------------------
 2004|     43|        case ERROR_EOB_BYPASS_T:
  ------------------
  |  Branch (2004:9): [True: 0, False: 4.23k]
  ------------------
 2005|     43|        case ERROR_EOB_DECISION_T:
  ------------------
  |  Branch (2005:9): [True: 0, False: 4.23k]
  ------------------
 2006|     43|        case ERROR_EOB_TERMINATE_T:
  ------------------
  |  Branch (2006:9): [True: 0, False: 4.23k]
  ------------------
 2007|     43|        case ERROR_EOB_READCOEFF4X4CAB_T:
  ------------------
  |  Branch (2007:9): [True: 0, False: 4.23k]
  ------------------
 2008|     43|            temp = 1 << IVD_INSUFFICIENTDATA;
 2009|     43|            break;
 2010|      0|        case ERROR_DYNAMIC_RESOLUTION_NOT_SUPPORTED:
  ------------------
  |  Branch (2010:9): [True: 0, False: 4.23k]
  ------------------
 2011|      0|        case ERROR_DISP_WIDTH_RESET_TO_PIC_WIDTH:
  ------------------
  |  Branch (2011:9): [True: 0, False: 4.23k]
  ------------------
 2012|      0|            temp = 1 << IVD_UNSUPPORTEDPARAM | 1 << IVD_FATALERROR;
 2013|      0|            break;
 2014|       |
 2015|      0|        case ERROR_DANGLING_FIELD_IN_PIC:
  ------------------
  |  Branch (2015:9): [True: 0, False: 4.23k]
  ------------------
 2016|      0|            temp = 1 << IVD_APPLIEDCONCEALMENT;
 2017|      0|            break;
 2018|       |
 2019|  4.23k|    }
 2020|       |
 2021|  4.23k|    return temp;
 2022|       |
 2023|  4.23k|}
ih264d_get_outbuf_size:
 2029|  4.27k|{
 2030|  4.27k|    UWORD32 u4_min_num_out_bufs = 0;
 2031|       |
 2032|  4.27k|    if(u1_chroma_format == IV_YUV_420P)
  ------------------
  |  Branch (2032:8): [True: 1.12k, False: 3.15k]
  ------------------
 2033|  1.12k|        u4_min_num_out_bufs = MIN_OUT_BUFS_420;
  ------------------
  |  |  120|  1.12k|#define MIN_OUT_BUFS_420        3
  ------------------
 2034|  3.15k|    else if(u1_chroma_format == IV_YUV_422ILE)
  ------------------
  |  Branch (2034:13): [True: 0, False: 3.15k]
  ------------------
 2035|      0|        u4_min_num_out_bufs = MIN_OUT_BUFS_422ILE;
  ------------------
  |  |  121|      0|#define MIN_OUT_BUFS_422ILE     1
  ------------------
 2036|  3.15k|    else if(u1_chroma_format == IV_RGB_565)
  ------------------
  |  Branch (2036:13): [True: 0, False: 3.15k]
  ------------------
 2037|      0|        u4_min_num_out_bufs = MIN_OUT_BUFS_RGB565;
  ------------------
  |  |  122|      0|#define MIN_OUT_BUFS_RGB565     1
  ------------------
 2038|  3.15k|    else if((u1_chroma_format == IV_YUV_420SP_UV)
  ------------------
  |  Branch (2038:13): [True: 2.05k, False: 1.09k]
  ------------------
 2039|  1.09k|                    || (u1_chroma_format == IV_YUV_420SP_VU))
  ------------------
  |  Branch (2039:24): [True: 1.09k, False: 0]
  ------------------
 2040|  3.15k|        u4_min_num_out_bufs = MIN_OUT_BUFS_420SP;
  ------------------
  |  |  123|  3.15k|#define MIN_OUT_BUFS_420SP      2
  ------------------
 2041|       |
 2042|  4.27k|    if(u1_chroma_format == IV_YUV_420P)
  ------------------
  |  Branch (2042:8): [True: 1.12k, False: 3.15k]
  ------------------
 2043|  1.12k|    {
 2044|  1.12k|        p_buf_size[0] = (pic_wd * pic_ht);
 2045|  1.12k|        p_buf_size[1] = (pic_wd * pic_ht) >> 2;
 2046|  1.12k|        p_buf_size[2] = (pic_wd * pic_ht) >> 2;
 2047|  1.12k|    }
 2048|  3.15k|    else if(u1_chroma_format == IV_YUV_422ILE)
  ------------------
  |  Branch (2048:13): [True: 0, False: 3.15k]
  ------------------
 2049|      0|    {
 2050|      0|        p_buf_size[0] = (pic_wd * pic_ht) * 2;
 2051|      0|        p_buf_size[1] = p_buf_size[2] = 0;
 2052|      0|    }
 2053|  3.15k|    else if(u1_chroma_format == IV_RGB_565)
  ------------------
  |  Branch (2053:13): [True: 0, False: 3.15k]
  ------------------
 2054|      0|    {
 2055|      0|        p_buf_size[0] = (pic_wd * pic_ht) * 2;
 2056|      0|        p_buf_size[1] = p_buf_size[2] = 0;
 2057|      0|    }
 2058|  3.15k|    else if((u1_chroma_format == IV_YUV_420SP_UV)
  ------------------
  |  Branch (2058:13): [True: 2.05k, False: 1.09k]
  ------------------
 2059|  1.09k|                    || (u1_chroma_format == IV_YUV_420SP_VU))
  ------------------
  |  Branch (2059:24): [True: 1.09k, False: 0]
  ------------------
 2060|  3.15k|    {
 2061|  3.15k|        p_buf_size[0] = (pic_wd * pic_ht);
 2062|  3.15k|        p_buf_size[1] = (pic_wd * pic_ht) >> 1;
 2063|  3.15k|        p_buf_size[2] = 0;
 2064|  3.15k|    }
 2065|       |
 2066|  4.27k|    return u4_min_num_out_bufs;
 2067|  4.27k|}
check_app_out_buf_size:
 2070|  4.27k|{
 2071|  4.27k|    UWORD32 au4_min_out_buf_size[IVD_VIDDEC_MAX_IO_BUFFERS];
 2072|  4.27k|    UWORD32 u4_min_num_out_bufs, i;
 2073|  4.27k|    UWORD32 pic_wd, pic_ht;
 2074|       |
 2075|  4.27k|    if(0 == ps_dec->u4_share_disp_buf)
  ------------------
  |  Branch (2075:8): [True: 4.27k, False: 0]
  ------------------
 2076|  4.27k|    {
 2077|  4.27k|        pic_wd = ps_dec->u2_disp_width;
 2078|  4.27k|        pic_ht = ps_dec->u2_disp_height;
 2079|       |
 2080|  4.27k|    }
 2081|      0|    else
 2082|      0|    {
 2083|      0|        pic_wd = ps_dec->u2_frm_wd_y;
 2084|      0|        pic_ht = ps_dec->u2_frm_ht_y;
 2085|      0|    }
 2086|       |
 2087|  4.27k|    if(ps_dec->u4_app_disp_width > pic_wd)
  ------------------
  |  Branch (2087:8): [True: 0, False: 4.27k]
  ------------------
 2088|      0|        pic_wd = ps_dec->u4_app_disp_width;
 2089|       |
 2090|  4.27k|    u4_min_num_out_bufs = ih264d_get_outbuf_size(pic_wd, pic_ht,
 2091|  4.27k|                                                 ps_dec->u1_chroma_format,
 2092|  4.27k|                                                 &au4_min_out_buf_size[0]);
 2093|       |
 2094|       |
 2095|  4.27k|    if(0 == ps_dec->u4_share_disp_buf)
  ------------------
  |  Branch (2095:8): [True: 4.27k, False: 0]
  ------------------
 2096|  4.27k|    {
 2097|  4.27k|        if(ps_dec->ps_out_buffer->u4_num_bufs < u4_min_num_out_bufs)
  ------------------
  |  Branch (2097:12): [True: 0, False: 4.27k]
  ------------------
 2098|      0|            return IV_FAIL;
 2099|       |
 2100|  13.5k|        for(i = 0; i < u4_min_num_out_bufs; i++)
  ------------------
  |  Branch (2100:20): [True: 9.46k, False: 4.10k]
  ------------------
 2101|  9.46k|        {
 2102|  9.46k|            if(ps_dec->ps_out_buffer->u4_min_out_buf_size[i]
  ------------------
  |  Branch (2102:16): [True: 172, False: 9.29k]
  ------------------
 2103|  9.46k|                            < au4_min_out_buf_size[i])
 2104|    172|                return (IV_FAIL);
 2105|  9.46k|        }
 2106|  4.27k|    }
 2107|      0|    else
 2108|      0|    {
 2109|      0|        if(ps_dec->disp_bufs[0].u4_num_bufs < u4_min_num_out_bufs)
  ------------------
  |  Branch (2109:12): [True: 0, False: 0]
  ------------------
 2110|      0|            return IV_FAIL;
 2111|       |
 2112|      0|        for(i = 0; i < u4_min_num_out_bufs; i++)
  ------------------
  |  Branch (2112:20): [True: 0, False: 0]
  ------------------
 2113|      0|        {
 2114|       |            /* We need to check only with the disp_buffer[0], because we have
 2115|       |             * already ensured that all the buffers are of the same size in
 2116|       |             * ih264d_set_display_frame.
 2117|       |             */
 2118|      0|            if(ps_dec->disp_bufs[0].u4_bufsize[i] < au4_min_out_buf_size[i])
  ------------------
  |  Branch (2118:16): [True: 0, False: 0]
  ------------------
 2119|      0|                return (IV_FAIL);
 2120|      0|        }
 2121|       |
 2122|      0|    }
 2123|       |
 2124|  4.10k|    return (IV_SUCCESS);
 2125|  4.27k|}

ih264d_get_bit_h264:
   64|  3.79M|{
   65|  3.79M|    UWORD32 u4_code;
   66|       |
   67|  3.79M|    GETBIT(u4_code, ps_stream->u4_ofst, ps_stream->pu4_buffer);
  ------------------
  |  |  105|  3.79M|#define   GETBIT(u4_code, u4_offset, pu4_bitstream)                         \
  |  |  106|  3.79M|{                                                                           \
  |  |  107|  3.79M|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  108|  3.79M|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  109|  3.79M|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  110|  3.79M|    u4_code = pu4_buf[u4_word_off] << u4_bit_off;                           \
  |  |  111|  3.79M|    (u4_offset)++;                                                          \
  |  |  112|  3.79M|    u4_code = (u4_code >> 31);                                              \
  |  |  113|  3.79M|}
  ------------------
   68|  3.79M|    return (u4_code);
   69|  3.79M|}
ih264d_get_bits_h264:
   91|  6.62M|{
   92|  6.62M|    UWORD32 u4_code = 0;
   93|  6.62M|    if(u4_num_bits)
  ------------------
  |  Branch (93:8): [True: 6.62M, False: 0]
  ------------------
   94|  6.62M|        GETBITS(u4_code, ps_bitstrm->u4_ofst, ps_bitstrm->pu4_buffer, u4_num_bits);
  ------------------
  |  |  120|  6.62M|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|  6.62M|{                                                                           \
  |  |  122|  6.62M|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|  6.62M|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|  6.62M|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|  6.62M|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|  6.62M|                                                                            \
  |  |  127|  6.62M|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 6.51M, False: 109k]
  |  |  ------------------
  |  |  128|  6.62M|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  6.51M|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|  6.62M|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  6.62M|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|  6.62M|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|  6.62M|}                                                                           \
  ------------------
   95|  6.62M|    return (u4_code);
   96|  6.62M|}
ih264d_flush_bits_h264:
  151|  2.41k|{
  152|  2.41k|    ps_bitstrm->u4_ofst += u4_num_bits;
  153|       |
  154|  2.41k|    if(ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  ------------------
  |  Branch (154:8): [True: 0, False: 2.41k]
  ------------------
  155|      0|    {
  156|      0|        return ERROR_EOB_FLUSHBITS_T;
  157|      0|    }
  158|  2.41k|    return OK;
  ------------------
  |  |  114|  2.41k|#define OK        0
  ------------------
  159|  2.41k|}
ih264d_check_byte_aligned:
  176|   535k|{
  177|   535k|    if(ps_bitstrm->u4_ofst & 0x07)
  ------------------
  |  Branch (177:8): [True: 462k, False: 73.0k]
  ------------------
  178|   462k|        return (0);
  179|  73.0k|    else
  180|  73.0k|        return (1);
  181|   535k|}

ih264d_init_cabac_dec_envirnoment:
   64|  3.83k|{
   65|  3.83k|    UWORD32 u4_code_int_val_ofst;
   66|       |
   67|  3.83k|    ps_cab_env->u4_code_int_range = (HALF - 2) << 23;
  ------------------
  |  |   45|  3.83k|#define   HALF      (1 << (B_BITS-1))
  |  |  ------------------
  |  |  |  |   43|  3.83k|#define   B_BITS    10
  |  |  ------------------
  ------------------
   68|  3.83k|    NEXTBITS(u4_code_int_val_ofst, ps_bitstrm->u4_ofst, ps_bitstrm->pu4_buffer,
  ------------------
  |  |  137|  3.83k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|  3.83k|{                                                                           \
  |  |  139|  3.83k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|  3.83k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|  3.83k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|  3.83k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|  3.83k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 2.66k, False: 1.17k]
  |  |  ------------------
  |  |  144|  3.83k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  2.66k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|  3.83k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  3.83k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|  3.83k|}
  ------------------
   69|  3.83k|             32);
   70|  3.83k|    FLUSHBITS(ps_bitstrm->u4_ofst, 9)
  ------------------
  |  |  193|  3.83k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|  3.83k|{                                                                           \
  |  |  195|  3.83k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|  3.83k|}
  ------------------
   71|       |
   72|  3.83k|    if(EXCEED_OFFSET(ps_bitstrm))
  ------------------
  |  |   93|  3.83k|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 238, False: 3.59k]
  |  |  ------------------
  ------------------
   73|    238|        return ERROR_EOB_FLUSHBITS_T;
   74|       |
   75|  3.59k|    ps_cab_env->u4_code_int_val_ofst = u4_code_int_val_ofst;
   76|       |
   77|       |    /*brief description of the design adopted for CABAC*/
   78|       |    /*according to the standard the u4_code_int_range needs to be initialized 0x 1FE(10 bits) and
   79|       |     9 bits from the bit stream need to be read and into the u4_code_int_val_ofst.As and when the
   80|       |     u4_code_int_range becomes less than 10 bits we need to renormalize and read from the bitstream*
   81|       |
   82|       |     In the implemented design
   83|       |     initially
   84|       |
   85|       |     range_new = range <<23
   86|       |     valOffset_new = valOffset << 23 + 23 bits(read from the bit stream)
   87|       |
   88|       |     Thus we have read 23 more bits ahead of time.
   89|       |
   90|       |     It can be mathematical proved that even with the modified range and u4_ofst the operations
   91|       |     like comparison and subtraction needed for a bin decode are still valid(both in the regular case and the bypass case)
   92|       |
   93|       |     As bins are decoded..we consume the bits that we have already read into the valOffset.The clz of Range
   94|       |     gives us the number of bits we consumed of the 23 bits that we have read ahead of time.
   95|       |
   96|       |     when the number bits we have consumed exceeds 23 ,we renormalize..and  we read from the bitstream again*/
   97|       |
   98|  3.59k|RESET_BIN_COUNTS(ps_cab_env)
   99|       |
  100|  3.59k|    return OK;
  ------------------
  |  |  114|  3.59k|#define OK        0
  ------------------
  101|  3.83k|}
ih264d_init_cabac_contexts:
  124|  2.61k|{
  125|       |
  126|  2.61k|    bin_ctxt_model_t *p_cabac_ctxt_table_t = ps_dec->p_cabac_ctxt_table_t;
  127|  2.61k|    UWORD8 u1_qp_y = ps_dec->ps_cur_slice->u1_slice_qp;
  128|  2.61k|    UWORD8 u1_cabac_init_Idc = 0;
  129|       |
  130|  2.61k|    if(I_SLICE != u1_slice_type)
  ------------------
  |  |  370|  2.61k|#define I_SLICE  2
  ------------------
  |  Branch (130:8): [True: 1.90k, False: 711]
  ------------------
  131|  1.90k|    {
  132|  1.90k|        u1_cabac_init_Idc = ps_dec->ps_cur_slice->u1_cabac_init_idc;
  133|  1.90k|    }
  134|       |
  135|  2.61k|    {
  136|       |        /* MAKING ps_dec->p_ctxt_inc_mb_map a scratch buffer */
  137|       |        /* 0th entry of CtxtIncMbMap will be always be containing default values
  138|       |         for CABAC context representing MB not available */
  139|  2.61k|        ctxt_inc_mb_info_t *p_DefCtxt = ps_dec->p_ctxt_inc_mb_map - 1;
  140|  2.61k|        UWORD8 *pu1_temp;
  141|  2.61k|        WORD8 i;
  142|  2.61k|        p_DefCtxt->u1_mb_type = CAB_SKIP;
  ------------------
  |  |  402|  2.61k|#define CAB_SKIP          0x10 /* 0001 0000 */
  ------------------
  143|       |
  144|  2.61k|        p_DefCtxt->u1_cbp = 0x0f;
  145|  2.61k|        p_DefCtxt->u1_intra_chroma_pred_mode = 0;
  146|       |
  147|  2.61k|        p_DefCtxt->u1_yuv_dc_csbp = 0x7;
  148|       |
  149|  2.61k|        p_DefCtxt->u1_transform8x8_ctxt = 0;
  150|       |
  151|  2.61k|        pu1_temp = (UWORD8*)p_DefCtxt->i1_ref_idx;
  152|  13.0k|        for(i = 0; i < 4; i++, pu1_temp++)
  ------------------
  |  Branch (152:20): [True: 10.4k, False: 2.61k]
  ------------------
  153|  10.4k|            (*pu1_temp) = 0;
  154|  2.61k|        pu1_temp = (UWORD8*)p_DefCtxt->u1_mv;
  155|  44.5k|        for(i = 0; i < 16; i++, pu1_temp++)
  ------------------
  |  Branch (155:20): [True: 41.9k, False: 2.61k]
  ------------------
  156|  41.9k|            (*pu1_temp) = 0;
  157|  2.61k|        ps_dec->ps_def_ctxt_mb_info = p_DefCtxt;
  158|  2.61k|    }
  159|       |
  160|  2.61k|    if(u1_slice_type == I_SLICE)
  ------------------
  |  |  370|  2.61k|#define I_SLICE  2
  ------------------
  |  Branch (160:8): [True: 711, False: 1.90k]
  ------------------
  161|    711|    {
  162|    711|        u1_cabac_init_Idc = 3;
  163|    711|        ps_dec->p_mb_type_t = p_cabac_ctxt_table_t + MB_TYPE_I_SLICE;
  164|    711|    }
  165|  1.90k|    else if(u1_slice_type == P_SLICE)
  ------------------
  |  |  368|  1.90k|#define P_SLICE  0
  ------------------
  |  Branch (165:13): [True: 706, False: 1.20k]
  ------------------
  166|    706|    {
  167|    706|        ps_dec->p_mb_type_t = p_cabac_ctxt_table_t + MB_TYPE_P_SLICE;
  168|    706|        ps_dec->p_mb_skip_flag_t = p_cabac_ctxt_table_t + MB_SKIP_FLAG_P_SLICE;
  169|    706|        ps_dec->p_sub_mb_type_t = p_cabac_ctxt_table_t + SUB_MB_TYPE_P_SLICE;
  170|    706|    }
  171|  1.20k|    else if(u1_slice_type == B_SLICE)
  ------------------
  |  |  369|  1.20k|#define B_SLICE  1
  ------------------
  |  Branch (171:13): [True: 1.20k, False: 0]
  ------------------
  172|  1.20k|    {
  173|  1.20k|        ps_dec->p_mb_type_t = p_cabac_ctxt_table_t + MB_TYPE_B_SLICE;
  174|  1.20k|        ps_dec->p_mb_skip_flag_t = p_cabac_ctxt_table_t + MB_SKIP_FLAG_B_SLICE;
  175|  1.20k|        ps_dec->p_sub_mb_type_t = p_cabac_ctxt_table_t + SUB_MB_TYPE_B_SLICE;
  176|  1.20k|    }
  177|  2.61k|    {
  178|  2.61k|        bin_ctxt_model_t *p_cabac_ctxt_table_t_tmp = p_cabac_ctxt_table_t;
  179|  2.61k|        if(ps_dec->ps_cur_slice->u1_field_pic_flag)
  ------------------
  |  Branch (179:12): [True: 0, False: 2.61k]
  ------------------
  180|      0|        {
  181|      0|            p_cabac_ctxt_table_t_tmp += SIGNIFICANT_COEFF_FLAG_FLD;
  182|       |
  183|      0|        }
  184|  2.61k|        else
  185|  2.61k|        {
  186|  2.61k|            p_cabac_ctxt_table_t_tmp += SIGNIFICANT_COEFF_FLAG_FRAME;
  187|  2.61k|        }
  188|  2.61k|        {
  189|  2.61k|            bin_ctxt_model_t * * p_significant_coeff_flag_t =
  190|  2.61k|                            ps_dec->p_significant_coeff_flag_t;
  191|  2.61k|            p_significant_coeff_flag_t[0] = p_cabac_ctxt_table_t_tmp
  192|  2.61k|                            + SIG_COEFF_CTXT_CAT_0_OFFSET;
  193|  2.61k|            p_significant_coeff_flag_t[1] = p_cabac_ctxt_table_t_tmp
  194|  2.61k|                            + SIG_COEFF_CTXT_CAT_1_OFFSET;
  195|  2.61k|            p_significant_coeff_flag_t[2] = p_cabac_ctxt_table_t_tmp
  196|  2.61k|                            + SIG_COEFF_CTXT_CAT_2_OFFSET;
  197|  2.61k|            p_significant_coeff_flag_t[3] = p_cabac_ctxt_table_t_tmp
  198|  2.61k|                            + SIG_COEFF_CTXT_CAT_3_OFFSET;
  199|  2.61k|            p_significant_coeff_flag_t[4] = p_cabac_ctxt_table_t_tmp
  200|  2.61k|                            + SIG_COEFF_CTXT_CAT_4_OFFSET;
  201|       |
  202|  2.61k|            p_significant_coeff_flag_t[5] = p_cabac_ctxt_table_t_tmp
  203|  2.61k|                            + SIG_COEFF_CTXT_CAT_5_OFFSET;
  204|       |
  205|  2.61k|        }
  206|  2.61k|    }
  207|       |
  208|  2.61k|    memcpy(p_cabac_ctxt_table_t,
  209|  2.61k|           gau1_ih264d_cabac_ctxt_init_table[u1_cabac_init_Idc][u1_qp_y],
  210|  2.61k|           NUM_CABAC_CTXTS * sizeof(bin_ctxt_model_t));
  ------------------
  |  |   81|  2.61k|#define NUM_CABAC_CTXTS 460
  ------------------
  211|  2.61k|}
ih264d_decode_bin:
  237|   557k|{
  238|       |
  239|   557k|    UWORD32 u4_qnt_int_range, u4_code_int_range, u4_code_int_val_ofst,
  240|   557k|                    u4_int_range_lps;
  241|       |
  242|   557k|    UWORD32 u4_symbol, u4_mps_state;
  243|       |
  244|   557k|    bin_ctxt_model_t *ps_bin_ctxt;
  245|       |
  246|   557k|    UWORD32 table_lookup;
  247|   557k|    const UWORD32 *pu4_table = (const UWORD32 *)ps_cab_env->cabac_table;
  248|   557k|    UWORD32 u4_clz;
  249|       |
  250|   557k|    ps_bin_ctxt = ps_src_bin_ctxt + u4_ctx_inc;
  251|       |
  252|   557k|    u4_code_int_range = ps_cab_env->u4_code_int_range;
  253|   557k|    u4_code_int_val_ofst = ps_cab_env->u4_code_int_val_ofst;
  254|       |
  255|   557k|    u4_mps_state = (ps_bin_ctxt->u1_mps_state);
  256|   557k|    u4_clz = CLZ(u4_code_int_range);
  257|       |
  258|   557k|    u4_qnt_int_range = u4_code_int_range << u4_clz;
  259|   557k|    u4_qnt_int_range = (u4_qnt_int_range >> 29) & 0x3;
  260|       |
  261|   557k|    table_lookup = pu4_table[(u4_mps_state << 2) + u4_qnt_int_range];
  262|   557k|    u4_int_range_lps = table_lookup & 0xff;
  263|       |
  264|   557k|    u4_int_range_lps = u4_int_range_lps << (23 - u4_clz);
  265|   557k|    u4_code_int_range = u4_code_int_range - u4_int_range_lps;
  266|       |
  267|   557k|    u4_symbol = ((u4_mps_state >> 6) & 0x1);
  268|       |
  269|   557k|    u4_mps_state = (table_lookup >> 8) & 0x7F;
  270|       |
  271|   557k|    CHECK_IF_LPS(u4_code_int_range, u4_code_int_val_ofst, u4_symbol,
  ------------------
  |  |  184|   557k|                    u4_codeIntRangeLPS_m,u1_mps_state_m,table_lookup_m)                     \
  |  |  185|   557k|{                                                                                         \
  |  |  186|   557k|  if(u4_codeIntValOffset_m >= u4_codeIntRange_m)                                            \
  |  |  ------------------
  |  |  |  Branch (186:6): [True: 67.7k, False: 489k]
  |  |  ------------------
  |  |  187|   557k|  {                                                                                         \
  |  |  188|  67.7k|      u4_symbol_m = 1 - u4_symbol_m;                                                        \
  |  |  189|  67.7k|      u4_codeIntValOffset_m -= u4_codeIntRange_m;                                           \
  |  |  190|  67.7k|      u4_codeIntRange_m = u4_codeIntRangeLPS_m;                                             \
  |  |  191|  67.7k|      u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                       \
  |  |  192|  67.7k|  }                                                                                         \
  |  |  193|   557k|}
  ------------------
  272|   557k|                 u4_int_range_lps, u4_mps_state, table_lookup)
  273|       |
  274|   557k|    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_8)
  ------------------
  |  |  113|   557k|#define ONE_RIGHT_SHIFTED_BY_8 1<<8
  ------------------
  |  Branch (274:8): [True: 3.98k, False: 553k]
  ------------------
  275|  3.98k|    {
  276|  3.98k|        UWORD32 *pu4_buffer, u4_offset;
  277|       |
  278|  3.98k|        pu4_buffer = ps_bitstrm->pu4_buffer;
  279|  3.98k|        u4_offset = ps_bitstrm->u4_ofst;
  280|       |
  281|  3.98k|        RENORM_RANGE_OFFSET(u4_code_int_range, u4_code_int_val_ofst, u4_offset,
  ------------------
  |  |  170|  3.98k|  {                                                                                         \
  |  |  171|  3.98k|    UWORD32 read_bits_m,u4_clz_m  ;                                                         \
  |  |  172|  3.98k|    u4_clz_m = CLZ(u4_codeIntRange_m);                                                  \
  |  |  173|  3.98k|    NEXTBITS(read_bits_m,(u4_offset_m+23),pu4_buffer_m,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|  3.98k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|  3.98k|{                                                                           \
  |  |  |  |  139|  3.98k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|  3.98k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|  3.98k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|  3.98k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|  3.98k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 3.80k, False: 187]
  |  |  |  |  ------------------
  |  |  |  |  144|  3.98k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  3.80k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|  3.98k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  3.98k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|  3.98k|}
  |  |  ------------------
  |  |  174|  3.98k|    FLUSHBITS(u4_offset_m,(u4_clz_m))                                                       \
  |  |  ------------------
  |  |  |  |  193|  3.98k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|  3.98k|{                                                                           \
  |  |  |  |  195|  3.98k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|  3.98k|}
  |  |  ------------------
  |  |  175|  3.98k|    u4_codeIntRange_m = u4_codeIntRange_m << u4_clz_m;                                      \
  |  |  176|  3.98k|    u4_codeIntValOffset_m = (u4_codeIntValOffset_m << u4_clz_m) | read_bits_m;              \
  |  |  177|  3.98k|  }
  ------------------
  282|  3.98k|                            pu4_buffer)
  283|       |
  284|  3.98k|        ps_bitstrm->u4_ofst = u4_offset;
  285|  3.98k|    }
  286|       |
  287|   557k|    INC_BIN_COUNT(ps_cab_env)
  288|       |
  289|   557k|    ps_cab_env->u4_code_int_val_ofst = u4_code_int_val_ofst;
  290|   557k|    ps_cab_env->u4_code_int_range = u4_code_int_range;
  291|   557k|    ps_bin_ctxt->u1_mps_state = u4_mps_state;
  292|       |
  293|   557k|    return (u4_symbol);
  294|   557k|}
ih264d_decode_terminate:
  315|  89.1k|{
  316|  89.1k|    UWORD32 u4_symbol;
  317|  89.1k|    UWORD32 u4_code_int_val_ofst, u4_code_int_range;
  318|  89.1k|    UWORD32 u4_clz;
  319|       |
  320|  89.1k|    u4_code_int_range = ps_cab_env->u4_code_int_range;
  321|  89.1k|    u4_code_int_val_ofst = ps_cab_env->u4_code_int_val_ofst;
  322|       |
  323|  89.1k|    u4_clz = CLZ(u4_code_int_range);
  324|  89.1k|    u4_code_int_range -= (2 << (23 - u4_clz));
  325|       |
  326|  89.1k|    if(u4_code_int_val_ofst >= u4_code_int_range)
  ------------------
  |  Branch (326:8): [True: 1.33k, False: 87.8k]
  ------------------
  327|  1.33k|    {
  328|       |        /* S=1 */
  329|  1.33k|        u4_symbol = 1;
  330|       |
  331|  1.33k|        {
  332|       |
  333|       |            /*the u4_ofst needs to be updated before termination*/
  334|  1.33k|            ps_stream->u4_ofst += u4_clz;
  335|       |
  336|  1.33k|        }
  337|       |
  338|  1.33k|    }
  339|  87.8k|    else
  340|  87.8k|    {
  341|       |        /* S=0 */
  342|  87.8k|        u4_symbol = 0;
  343|       |
  344|  87.8k|        if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_8)
  ------------------
  |  |  113|  87.8k|#define ONE_RIGHT_SHIFTED_BY_8 1<<8
  ------------------
  |  Branch (344:12): [True: 24, False: 87.8k]
  ------------------
  345|     24|        {
  346|     24|            UWORD32 *pu4_buffer, u4_offset;
  347|       |
  348|     24|            pu4_buffer = ps_stream->pu4_buffer;
  349|     24|            u4_offset = ps_stream->u4_ofst;
  350|       |
  351|     24|            RENORM_RANGE_OFFSET(u4_code_int_range, u4_code_int_val_ofst, u4_offset,
  ------------------
  |  |  170|     24|  {                                                                                         \
  |  |  171|     24|    UWORD32 read_bits_m,u4_clz_m  ;                                                         \
  |  |  172|     24|    u4_clz_m = CLZ(u4_codeIntRange_m);                                                  \
  |  |  173|     24|    NEXTBITS(read_bits_m,(u4_offset_m+23),pu4_buffer_m,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|     24|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|     24|{                                                                           \
  |  |  |  |  139|     24|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|     24|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|     24|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|     24|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|     24|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 24, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  144|     24|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|     24|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|     24|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|     24|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|     24|}
  |  |  ------------------
  |  |  174|     24|    FLUSHBITS(u4_offset_m,(u4_clz_m))                                                       \
  |  |  ------------------
  |  |  |  |  193|     24|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|     24|{                                                                           \
  |  |  |  |  195|     24|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|     24|}
  |  |  ------------------
  |  |  175|     24|    u4_codeIntRange_m = u4_codeIntRange_m << u4_clz_m;                                      \
  |  |  176|     24|    u4_codeIntValOffset_m = (u4_codeIntValOffset_m << u4_clz_m) | read_bits_m;              \
  |  |  177|     24|  }
  ------------------
  352|     24|                                pu4_buffer)
  353|     24|            ps_stream->u4_ofst = u4_offset;
  354|     24|        }
  355|  87.8k|    }
  356|       |
  357|  89.1k|    ps_cab_env->u4_code_int_range = u4_code_int_range;
  358|  89.1k|    ps_cab_env->u4_code_int_val_ofst = u4_code_int_val_ofst;
  359|       |
  360|  89.1k|    INC_BIN_COUNT(ps_cab_env)
  361|       |
  362|  89.1k|    return (u4_symbol);
  363|  89.1k|}
ih264d_decode_bins_tunary:
  394|  9.82k|{
  395|  9.82k|    UWORD32 u4_value;
  396|  9.82k|    UWORD32 u4_symbol;
  397|  9.82k|    UWORD8 u4_ctx_Inc;
  398|  9.82k|    bin_ctxt_model_t *ps_bin_ctxt;
  399|  9.82k|    UWORD32 u4_code_int_range, u4_code_int_val_ofst;
  400|  9.82k|    const UWORD32 *pu4_table = (const UWORD32 *)ps_cab_env->cabac_table;
  401|       |
  402|  9.82k|    u4_value = 0;
  403|       |
  404|       |    /*u1_max_bins has to be less than or equal to 4, u1_max_bins <= 4 for  this function*/
  405|       |
  406|       |    /*here the valid length is assumed to be equal to 3 ,so the calling function is expected
  407|       |     to duplicate CtxInc if valid lenth is 2 and cmaxbin is greater than2*/
  408|  9.82k|    u4_code_int_range = ps_cab_env->u4_code_int_range;
  409|  9.82k|    u4_code_int_val_ofst = ps_cab_env->u4_code_int_val_ofst;
  410|       |
  411|  9.82k|    do
  412|  19.8k|    {
  413|  19.8k|        u4_ctx_Inc = u4_ctx_inc & 0xF;
  414|  19.8k|        u4_ctx_inc = u4_ctx_inc >> 4;
  415|       |
  416|  19.8k|        ps_bin_ctxt = ps_src_bin_ctxt + u4_ctx_Inc;
  417|       |
  418|  19.8k|        DECODE_ONE_BIN_MACRO(ps_bin_ctxt, u4_code_int_range, u4_code_int_val_ofst,
  ------------------
  |  |  217|  19.8k|                     p_DecBitStream_arg,u4_symbol)                                           \
  |  |  218|  19.8k|{                                                                                       \
  |  |  219|  19.8k|    bin_ctxt_model_t *p_binCtxt_m = (bin_ctxt_model_t *) p_binCtxt_arg;                           \
  |  |  220|  19.8k|    dec_bit_stream_t *p_DecBitStream_m = (dec_bit_stream_t *) p_DecBitStream_arg;                 \
  |  |  221|  19.8k|    const UWORD32 *pu4_table_m = (const UWORD32 *) pu4_table_arg;                         \
  |  |  222|  19.8k|                                                                                        \
  |  |  223|  19.8k|    UWORD32 u4_quantCodeIntRange_m,u4_codeIntRangeLPS_m;                                    \
  |  |  224|  19.8k|    UWORD32 u1_mps_state_m;                                                               \
  |  |  225|  19.8k|    UWORD32 table_lookup_m;                                                               \
  |  |  226|  19.8k|    UWORD32 u4_clz_m;                                                                     \
  |  |  227|  19.8k|                                                                                        \
  |  |  228|  19.8k|    u1_mps_state_m = (p_binCtxt_m->u1_mps_state);                                           \
  |  |  229|  19.8k|    u4_clz_m = CLZ(u4_code_int_range);                                                  \
  |  |  230|  19.8k|    u4_quantCodeIntRange_m = u4_code_int_range << u4_clz_m;                                   \
  |  |  231|  19.8k|    u4_quantCodeIntRange_m = (u4_quantCodeIntRange_m >> 29) & 0x3;                          \
  |  |  232|  19.8k|    table_lookup_m = pu4_table_m[(u1_mps_state_m << 2)+u4_quantCodeIntRange_m];                 \
  |  |  233|  19.8k|    u4_codeIntRangeLPS_m = table_lookup_m & 0xff;                                           \
  |  |  234|  19.8k|                                                                                        \
  |  |  235|  19.8k|    u4_codeIntRangeLPS_m = u4_codeIntRangeLPS_m << (23 - u4_clz_m);                           \
  |  |  236|  19.8k|    u4_code_int_range = u4_code_int_range - u4_codeIntRangeLPS_m;                             \
  |  |  237|  19.8k|    u4_symbol = ((u1_mps_state_m>> 6) & 0x1);                                             \
  |  |  238|  19.8k|    /*if mps*/                                                                          \
  |  |  239|  19.8k|    u1_mps_state_m = (table_lookup_m >> 8) & 0x7F;                                          \
  |  |  240|  19.8k|    if(u4_code_int_val_ofst >= u4_code_int_range)                                          \
  |  |  ------------------
  |  |  |  Branch (240:8): [True: 4.30k, False: 15.5k]
  |  |  ------------------
  |  |  241|  19.8k|  {                                                                                     \
  |  |  242|  4.30k|                                                                                        \
  |  |  243|  4.30k|    u4_symbol = 1 - u4_symbol;                                                          \
  |  |  244|  4.30k|    u4_code_int_val_ofst -= u4_code_int_range;                                             \
  |  |  245|  4.30k|    u4_code_int_range = u4_codeIntRangeLPS_m;                                               \
  |  |  246|  4.30k|    u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                         \
  |  |  247|  4.30k|  }                                                                                     \
  |  |  248|  19.8k|    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_8)                                        \
  |  |  ------------------
  |  |  |  |  113|  39.6k|#define ONE_RIGHT_SHIFTED_BY_8 1<<8
  |  |  ------------------
  |  |  |  Branch (248:8): [True: 567, False: 19.2k]
  |  |  ------------------
  |  |  249|  19.8k|    {                                                                                   \
  |  |  250|    567|        UWORD32 *pu4_buffer,u4_offset;                                                  \
  |  |  251|    567|        UWORD32 read_bits,u4_clz_m  ;                                                     \
  |  |  252|    567|                                                                                        \
  |  |  253|    567|        pu4_buffer = p_DecBitStream_m->pu4_buffer;                                         \
  |  |  254|    567|        u4_offset = p_DecBitStream_m->u4_ofst;                                          \
  |  |  255|    567|        u4_clz_m = CLZ(u4_code_int_range);                                              \
  |  |  256|    567|        NEXTBITS(read_bits,(u4_offset+23),pu4_buffer,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|    567|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|    567|{                                                                           \
  |  |  |  |  139|    567|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|    567|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|    567|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|    567|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|    567|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 510, False: 57]
  |  |  |  |  ------------------
  |  |  |  |  144|    567|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|    510|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|    567|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|    567|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|    567|}
  |  |  ------------------
  |  |  257|    567|        FLUSHBITS(u4_offset,(u4_clz_m))                                                   \
  |  |  ------------------
  |  |  |  |  193|    567|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|    567|{                                                                           \
  |  |  |  |  195|    567|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|    567|}
  |  |  ------------------
  |  |  258|    567|        u4_code_int_range = u4_code_int_range << u4_clz_m;                                    \
  |  |  259|    567|        u4_code_int_val_ofst= (u4_code_int_val_ofst << u4_clz_m) | read_bits;               \
  |  |  260|    567|                                                                                        \
  |  |  261|    567|                                                                                        \
  |  |  262|    567|        p_DecBitStream_m->u4_ofst = u4_offset;                                          \
  |  |  263|    567|    }                                                                                   \
  |  |  264|  19.8k|    p_binCtxt_m->u1_mps_state = u1_mps_state_m;                                             \
  |  |  265|  19.8k|}
  ------------------
  419|  19.8k|                             pu4_table, ps_bitstrm, u4_symbol)
  420|       |
  421|  19.8k|        INC_BIN_COUNT(ps_cab_env);INC_DECISION_BINS(ps_cab_env);
  422|       |
  423|  19.8k|        u4_value++;
  424|  19.8k|    }
  425|  19.8k|    while((u4_value < u1_max_bins) & (u4_symbol));
  ------------------
  |  Branch (425:11): [True: 9.99k, False: 9.82k]
  ------------------
  426|       |
  427|  9.82k|    u4_value = u4_value - 1 + u4_symbol;
  428|       |
  429|  9.82k|    ps_cab_env->u4_code_int_range = u4_code_int_range;
  430|  9.82k|    ps_cab_env->u4_code_int_val_ofst = u4_code_int_val_ofst;
  431|       |
  432|  9.82k|    return (u4_value);
  433|       |
  434|  9.82k|}
ih264d_decode_bins:
  465|  13.1k|{
  466|  13.1k|    UWORD32 u4_value;
  467|  13.1k|    UWORD32 u4_symbol, i;
  468|  13.1k|    UWORD32 u4_ctxt_inc;
  469|  13.1k|    bin_ctxt_model_t *ps_bin_ctxt;
  470|  13.1k|    UWORD32 u4_code_int_range, u4_code_int_val_ofst;
  471|  13.1k|    const UWORD32 *pu4_table = (const UWORD32 *)ps_cab_env->cabac_table;
  472|       |
  473|  13.1k|    i = 0;
  474|       |
  475|  13.1k|    u4_value = 0;
  476|       |
  477|       |    /*u1_max_bins has to be less than or equal to 4, u1_max_bins <= 4 for  this fucntion*/
  478|  13.1k|    u4_code_int_range = ps_cab_env->u4_code_int_range;
  479|  13.1k|    u4_code_int_val_ofst = ps_cab_env->u4_code_int_val_ofst;
  480|       |
  481|  13.1k|    do
  482|  34.0k|    {
  483|  34.0k|        u4_ctxt_inc = u4_ctx_inc & 0xf;
  484|  34.0k|        u4_ctx_inc = u4_ctx_inc >> 4;
  485|       |
  486|  34.0k|        ps_bin_ctxt = ps_src_bin_ctxt + u4_ctxt_inc;
  487|       |
  488|  34.0k|        DECODE_ONE_BIN_MACRO(ps_bin_ctxt, u4_code_int_range, u4_code_int_val_ofst,
  ------------------
  |  |  217|  34.0k|                     p_DecBitStream_arg,u4_symbol)                                           \
  |  |  218|  34.0k|{                                                                                       \
  |  |  219|  34.0k|    bin_ctxt_model_t *p_binCtxt_m = (bin_ctxt_model_t *) p_binCtxt_arg;                           \
  |  |  220|  34.0k|    dec_bit_stream_t *p_DecBitStream_m = (dec_bit_stream_t *) p_DecBitStream_arg;                 \
  |  |  221|  34.0k|    const UWORD32 *pu4_table_m = (const UWORD32 *) pu4_table_arg;                         \
  |  |  222|  34.0k|                                                                                        \
  |  |  223|  34.0k|    UWORD32 u4_quantCodeIntRange_m,u4_codeIntRangeLPS_m;                                    \
  |  |  224|  34.0k|    UWORD32 u1_mps_state_m;                                                               \
  |  |  225|  34.0k|    UWORD32 table_lookup_m;                                                               \
  |  |  226|  34.0k|    UWORD32 u4_clz_m;                                                                     \
  |  |  227|  34.0k|                                                                                        \
  |  |  228|  34.0k|    u1_mps_state_m = (p_binCtxt_m->u1_mps_state);                                           \
  |  |  229|  34.0k|    u4_clz_m = CLZ(u4_code_int_range);                                                  \
  |  |  230|  34.0k|    u4_quantCodeIntRange_m = u4_code_int_range << u4_clz_m;                                   \
  |  |  231|  34.0k|    u4_quantCodeIntRange_m = (u4_quantCodeIntRange_m >> 29) & 0x3;                          \
  |  |  232|  34.0k|    table_lookup_m = pu4_table_m[(u1_mps_state_m << 2)+u4_quantCodeIntRange_m];                 \
  |  |  233|  34.0k|    u4_codeIntRangeLPS_m = table_lookup_m & 0xff;                                           \
  |  |  234|  34.0k|                                                                                        \
  |  |  235|  34.0k|    u4_codeIntRangeLPS_m = u4_codeIntRangeLPS_m << (23 - u4_clz_m);                           \
  |  |  236|  34.0k|    u4_code_int_range = u4_code_int_range - u4_codeIntRangeLPS_m;                             \
  |  |  237|  34.0k|    u4_symbol = ((u1_mps_state_m>> 6) & 0x1);                                             \
  |  |  238|  34.0k|    /*if mps*/                                                                          \
  |  |  239|  34.0k|    u1_mps_state_m = (table_lookup_m >> 8) & 0x7F;                                          \
  |  |  240|  34.0k|    if(u4_code_int_val_ofst >= u4_code_int_range)                                          \
  |  |  ------------------
  |  |  |  Branch (240:8): [True: 15.6k, False: 18.4k]
  |  |  ------------------
  |  |  241|  34.0k|  {                                                                                     \
  |  |  242|  15.6k|                                                                                        \
  |  |  243|  15.6k|    u4_symbol = 1 - u4_symbol;                                                          \
  |  |  244|  15.6k|    u4_code_int_val_ofst -= u4_code_int_range;                                             \
  |  |  245|  15.6k|    u4_code_int_range = u4_codeIntRangeLPS_m;                                               \
  |  |  246|  15.6k|    u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                         \
  |  |  247|  15.6k|  }                                                                                     \
  |  |  248|  34.0k|    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_8)                                        \
  |  |  ------------------
  |  |  |  |  113|  68.1k|#define ONE_RIGHT_SHIFTED_BY_8 1<<8
  |  |  ------------------
  |  |  |  Branch (248:8): [True: 623, False: 33.4k]
  |  |  ------------------
  |  |  249|  34.0k|    {                                                                                   \
  |  |  250|    623|        UWORD32 *pu4_buffer,u4_offset;                                                  \
  |  |  251|    623|        UWORD32 read_bits,u4_clz_m  ;                                                     \
  |  |  252|    623|                                                                                        \
  |  |  253|    623|        pu4_buffer = p_DecBitStream_m->pu4_buffer;                                         \
  |  |  254|    623|        u4_offset = p_DecBitStream_m->u4_ofst;                                          \
  |  |  255|    623|        u4_clz_m = CLZ(u4_code_int_range);                                              \
  |  |  256|    623|        NEXTBITS(read_bits,(u4_offset+23),pu4_buffer,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|    623|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|    623|{                                                                           \
  |  |  |  |  139|    623|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|    623|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|    623|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|    623|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|    623|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 605, False: 18]
  |  |  |  |  ------------------
  |  |  |  |  144|    623|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|    605|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|    623|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|    623|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|    623|}
  |  |  ------------------
  |  |  257|    623|        FLUSHBITS(u4_offset,(u4_clz_m))                                                   \
  |  |  ------------------
  |  |  |  |  193|    623|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|    623|{                                                                           \
  |  |  |  |  195|    623|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|    623|}
  |  |  ------------------
  |  |  258|    623|        u4_code_int_range = u4_code_int_range << u4_clz_m;                                    \
  |  |  259|    623|        u4_code_int_val_ofst= (u4_code_int_val_ofst << u4_clz_m) | read_bits;               \
  |  |  260|    623|                                                                                        \
  |  |  261|    623|                                                                                        \
  |  |  262|    623|        p_DecBitStream_m->u4_ofst = u4_offset;                                          \
  |  |  263|    623|    }                                                                                   \
  |  |  264|  34.0k|    p_binCtxt_m->u1_mps_state = u1_mps_state_m;                                             \
  |  |  265|  34.0k|}
  ------------------
  489|  34.0k|                             pu4_table, ps_bitstrm, u4_symbol)
  490|       |
  491|  34.0k|        INC_BIN_COUNT(ps_cab_env);INC_DECISION_BINS(ps_cab_env);
  492|       |
  493|  34.0k|        u4_value = (u4_value << 1) | (u4_symbol);
  494|       |
  495|  34.0k|        i++;
  496|  34.0k|    }
  497|  34.0k|    while(i < u1_max_bins);
  ------------------
  |  Branch (497:11): [True: 20.8k, False: 13.1k]
  ------------------
  498|       |
  499|  13.1k|    ps_cab_env->u4_code_int_range = u4_code_int_range;
  500|  13.1k|    ps_cab_env->u4_code_int_val_ofst = u4_code_int_val_ofst;
  501|       |
  502|  13.1k|    return (u4_value);
  503|       |
  504|  13.1k|}
ih264d_decode_bins_unary:
  533|  73.9k|{
  534|  73.9k|    UWORD32 u4_value;
  535|  73.9k|    UWORD32 u4_symbol;
  536|  73.9k|    bin_ctxt_model_t *ps_bin_ctxt;
  537|  73.9k|    UWORD32 u4_ctx_Inc;
  538|  73.9k|    UWORD32 u4_code_int_range, u4_code_int_val_ofst;
  539|  73.9k|    const UWORD32 *pu4_table = (const UWORD32 *)ps_cab_env->cabac_table;
  540|       |
  541|       |    /* in this function the valid length for u4_ctx_inc is always taken to be,so if the
  542|       |     the valid length is lessthan 5 the caller need to duplicate accordingly*/
  543|       |
  544|       |    /*u1_max_bins is always greater or equal to 9 we have the check for u1_max_bins only after the 2 loop*/
  545|  73.9k|    u4_value = 0;
  546|  73.9k|    u4_code_int_range = ps_cab_env->u4_code_int_range;
  547|  73.9k|    u4_code_int_val_ofst = ps_cab_env->u4_code_int_val_ofst;
  548|       |
  549|  73.9k|    do
  550|  99.3k|    {
  551|  99.3k|        u4_ctx_Inc = u4_ctx_inc & 0xf;
  552|  99.3k|        u4_ctx_inc = u4_ctx_inc >> 4;
  553|       |
  554|  99.3k|        ps_bin_ctxt = ps_src_bin_ctxt + u4_ctx_Inc;
  555|       |
  556|  99.3k|        DECODE_ONE_BIN_MACRO(ps_bin_ctxt, u4_code_int_range, u4_code_int_val_ofst,
  ------------------
  |  |  217|  99.3k|                     p_DecBitStream_arg,u4_symbol)                                           \
  |  |  218|  99.3k|{                                                                                       \
  |  |  219|  99.3k|    bin_ctxt_model_t *p_binCtxt_m = (bin_ctxt_model_t *) p_binCtxt_arg;                           \
  |  |  220|  99.3k|    dec_bit_stream_t *p_DecBitStream_m = (dec_bit_stream_t *) p_DecBitStream_arg;                 \
  |  |  221|  99.3k|    const UWORD32 *pu4_table_m = (const UWORD32 *) pu4_table_arg;                         \
  |  |  222|  99.3k|                                                                                        \
  |  |  223|  99.3k|    UWORD32 u4_quantCodeIntRange_m,u4_codeIntRangeLPS_m;                                    \
  |  |  224|  99.3k|    UWORD32 u1_mps_state_m;                                                               \
  |  |  225|  99.3k|    UWORD32 table_lookup_m;                                                               \
  |  |  226|  99.3k|    UWORD32 u4_clz_m;                                                                     \
  |  |  227|  99.3k|                                                                                        \
  |  |  228|  99.3k|    u1_mps_state_m = (p_binCtxt_m->u1_mps_state);                                           \
  |  |  229|  99.3k|    u4_clz_m = CLZ(u4_code_int_range);                                                  \
  |  |  230|  99.3k|    u4_quantCodeIntRange_m = u4_code_int_range << u4_clz_m;                                   \
  |  |  231|  99.3k|    u4_quantCodeIntRange_m = (u4_quantCodeIntRange_m >> 29) & 0x3;                          \
  |  |  232|  99.3k|    table_lookup_m = pu4_table_m[(u1_mps_state_m << 2)+u4_quantCodeIntRange_m];                 \
  |  |  233|  99.3k|    u4_codeIntRangeLPS_m = table_lookup_m & 0xff;                                           \
  |  |  234|  99.3k|                                                                                        \
  |  |  235|  99.3k|    u4_codeIntRangeLPS_m = u4_codeIntRangeLPS_m << (23 - u4_clz_m);                           \
  |  |  236|  99.3k|    u4_code_int_range = u4_code_int_range - u4_codeIntRangeLPS_m;                             \
  |  |  237|  99.3k|    u4_symbol = ((u1_mps_state_m>> 6) & 0x1);                                             \
  |  |  238|  99.3k|    /*if mps*/                                                                          \
  |  |  239|  99.3k|    u1_mps_state_m = (table_lookup_m >> 8) & 0x7F;                                          \
  |  |  240|  99.3k|    if(u4_code_int_val_ofst >= u4_code_int_range)                                          \
  |  |  ------------------
  |  |  |  Branch (240:8): [True: 16.2k, False: 83.1k]
  |  |  ------------------
  |  |  241|  99.3k|  {                                                                                     \
  |  |  242|  16.2k|                                                                                        \
  |  |  243|  16.2k|    u4_symbol = 1 - u4_symbol;                                                          \
  |  |  244|  16.2k|    u4_code_int_val_ofst -= u4_code_int_range;                                             \
  |  |  245|  16.2k|    u4_code_int_range = u4_codeIntRangeLPS_m;                                               \
  |  |  246|  16.2k|    u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                         \
  |  |  247|  16.2k|  }                                                                                     \
  |  |  248|  99.3k|    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_8)                                        \
  |  |  ------------------
  |  |  |  |  113|   198k|#define ONE_RIGHT_SHIFTED_BY_8 1<<8
  |  |  ------------------
  |  |  |  Branch (248:8): [True: 978, False: 98.3k]
  |  |  ------------------
  |  |  249|  99.3k|    {                                                                                   \
  |  |  250|    978|        UWORD32 *pu4_buffer,u4_offset;                                                  \
  |  |  251|    978|        UWORD32 read_bits,u4_clz_m  ;                                                     \
  |  |  252|    978|                                                                                        \
  |  |  253|    978|        pu4_buffer = p_DecBitStream_m->pu4_buffer;                                         \
  |  |  254|    978|        u4_offset = p_DecBitStream_m->u4_ofst;                                          \
  |  |  255|    978|        u4_clz_m = CLZ(u4_code_int_range);                                              \
  |  |  256|    978|        NEXTBITS(read_bits,(u4_offset+23),pu4_buffer,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|    978|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|    978|{                                                                           \
  |  |  |  |  139|    978|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|    978|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|    978|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|    978|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|    978|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 973, False: 5]
  |  |  |  |  ------------------
  |  |  |  |  144|    978|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|    973|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|    978|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|    978|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|    978|}
  |  |  ------------------
  |  |  257|    978|        FLUSHBITS(u4_offset,(u4_clz_m))                                                   \
  |  |  ------------------
  |  |  |  |  193|    978|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|    978|{                                                                           \
  |  |  |  |  195|    978|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|    978|}
  |  |  ------------------
  |  |  258|    978|        u4_code_int_range = u4_code_int_range << u4_clz_m;                                    \
  |  |  259|    978|        u4_code_int_val_ofst= (u4_code_int_val_ofst << u4_clz_m) | read_bits;               \
  |  |  260|    978|                                                                                        \
  |  |  261|    978|                                                                                        \
  |  |  262|    978|        p_DecBitStream_m->u4_ofst = u4_offset;                                          \
  |  |  263|    978|    }                                                                                   \
  |  |  264|  99.3k|    p_binCtxt_m->u1_mps_state = u1_mps_state_m;                                             \
  |  |  265|  99.3k|}
  ------------------
  557|  99.3k|                             pu4_table, ps_bitstrm, u4_symbol)
  558|       |
  559|  99.3k|        INC_BIN_COUNT(ps_cab_env);INC_DECISION_BINS(ps_cab_env);
  560|       |
  561|  99.3k|        u4_value++;
  562|       |
  563|  99.3k|    }
  564|  99.3k|    while(u4_symbol && u4_value < 4);
  ------------------
  |  Branch (564:11): [True: 26.3k, False: 73.0k]
  |  Branch (564:24): [True: 25.3k, False: 916]
  ------------------
  565|       |
  566|  73.9k|    if(u4_symbol && (u4_value < u1_max_bins))
  ------------------
  |  Branch (566:8): [True: 916, False: 73.0k]
  |  Branch (566:21): [True: 916, False: 0]
  ------------------
  567|    916|    {
  568|       |
  569|    916|        u4_ctx_Inc = u4_ctx_inc & 0xf;
  570|       |
  571|    916|        ps_bin_ctxt = ps_src_bin_ctxt + u4_ctx_Inc;
  572|       |
  573|    916|        do
  574|  5.12k|        {
  575|       |
  576|  5.12k|            DECODE_ONE_BIN_MACRO(ps_bin_ctxt, u4_code_int_range, u4_code_int_val_ofst,
  ------------------
  |  |  217|  5.12k|                     p_DecBitStream_arg,u4_symbol)                                           \
  |  |  218|  5.12k|{                                                                                       \
  |  |  219|  5.12k|    bin_ctxt_model_t *p_binCtxt_m = (bin_ctxt_model_t *) p_binCtxt_arg;                           \
  |  |  220|  5.12k|    dec_bit_stream_t *p_DecBitStream_m = (dec_bit_stream_t *) p_DecBitStream_arg;                 \
  |  |  221|  5.12k|    const UWORD32 *pu4_table_m = (const UWORD32 *) pu4_table_arg;                         \
  |  |  222|  5.12k|                                                                                        \
  |  |  223|  5.12k|    UWORD32 u4_quantCodeIntRange_m,u4_codeIntRangeLPS_m;                                    \
  |  |  224|  5.12k|    UWORD32 u1_mps_state_m;                                                               \
  |  |  225|  5.12k|    UWORD32 table_lookup_m;                                                               \
  |  |  226|  5.12k|    UWORD32 u4_clz_m;                                                                     \
  |  |  227|  5.12k|                                                                                        \
  |  |  228|  5.12k|    u1_mps_state_m = (p_binCtxt_m->u1_mps_state);                                           \
  |  |  229|  5.12k|    u4_clz_m = CLZ(u4_code_int_range);                                                  \
  |  |  230|  5.12k|    u4_quantCodeIntRange_m = u4_code_int_range << u4_clz_m;                                   \
  |  |  231|  5.12k|    u4_quantCodeIntRange_m = (u4_quantCodeIntRange_m >> 29) & 0x3;                          \
  |  |  232|  5.12k|    table_lookup_m = pu4_table_m[(u1_mps_state_m << 2)+u4_quantCodeIntRange_m];                 \
  |  |  233|  5.12k|    u4_codeIntRangeLPS_m = table_lookup_m & 0xff;                                           \
  |  |  234|  5.12k|                                                                                        \
  |  |  235|  5.12k|    u4_codeIntRangeLPS_m = u4_codeIntRangeLPS_m << (23 - u4_clz_m);                           \
  |  |  236|  5.12k|    u4_code_int_range = u4_code_int_range - u4_codeIntRangeLPS_m;                             \
  |  |  237|  5.12k|    u4_symbol = ((u1_mps_state_m>> 6) & 0x1);                                             \
  |  |  238|  5.12k|    /*if mps*/                                                                          \
  |  |  239|  5.12k|    u1_mps_state_m = (table_lookup_m >> 8) & 0x7F;                                          \
  |  |  240|  5.12k|    if(u4_code_int_val_ofst >= u4_code_int_range)                                          \
  |  |  ------------------
  |  |  |  Branch (240:8): [True: 848, False: 4.27k]
  |  |  ------------------
  |  |  241|  5.12k|  {                                                                                     \
  |  |  242|    848|                                                                                        \
  |  |  243|    848|    u4_symbol = 1 - u4_symbol;                                                          \
  |  |  244|    848|    u4_code_int_val_ofst -= u4_code_int_range;                                             \
  |  |  245|    848|    u4_code_int_range = u4_codeIntRangeLPS_m;                                               \
  |  |  246|    848|    u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                         \
  |  |  247|    848|  }                                                                                     \
  |  |  248|  5.12k|    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_8)                                        \
  |  |  ------------------
  |  |  |  |  113|  10.2k|#define ONE_RIGHT_SHIFTED_BY_8 1<<8
  |  |  ------------------
  |  |  |  Branch (248:8): [True: 2, False: 5.12k]
  |  |  ------------------
  |  |  249|  5.12k|    {                                                                                   \
  |  |  250|      2|        UWORD32 *pu4_buffer,u4_offset;                                                  \
  |  |  251|      2|        UWORD32 read_bits,u4_clz_m  ;                                                     \
  |  |  252|      2|                                                                                        \
  |  |  253|      2|        pu4_buffer = p_DecBitStream_m->pu4_buffer;                                         \
  |  |  254|      2|        u4_offset = p_DecBitStream_m->u4_ofst;                                          \
  |  |  255|      2|        u4_clz_m = CLZ(u4_code_int_range);                                              \
  |  |  256|      2|        NEXTBITS(read_bits,(u4_offset+23),pu4_buffer,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|      2|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|      2|{                                                                           \
  |  |  |  |  139|      2|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|      2|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|      2|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|      2|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|      2|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 2, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  144|      2|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      2|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|      2|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      2|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|      2|}
  |  |  ------------------
  |  |  257|      2|        FLUSHBITS(u4_offset,(u4_clz_m))                                                   \
  |  |  ------------------
  |  |  |  |  193|      2|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|      2|{                                                                           \
  |  |  |  |  195|      2|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|      2|}
  |  |  ------------------
  |  |  258|      2|        u4_code_int_range = u4_code_int_range << u4_clz_m;                                    \
  |  |  259|      2|        u4_code_int_val_ofst= (u4_code_int_val_ofst << u4_clz_m) | read_bits;               \
  |  |  260|      2|                                                                                        \
  |  |  261|      2|                                                                                        \
  |  |  262|      2|        p_DecBitStream_m->u4_ofst = u4_offset;                                          \
  |  |  263|      2|    }                                                                                   \
  |  |  264|  5.12k|    p_binCtxt_m->u1_mps_state = u1_mps_state_m;                                             \
  |  |  265|  5.12k|}
  ------------------
  577|  5.12k|                                 pu4_table, ps_bitstrm, u4_symbol)
  578|       |
  579|  5.12k|            INC_BIN_COUNT(ps_cab_env);INC_DECISION_BINS(ps_cab_env);
  580|       |
  581|  5.12k|            u4_value++;
  582|       |
  583|  5.12k|        }
  584|  5.12k|        while(u4_symbol && (u4_value < u1_max_bins));
  ------------------
  |  Branch (584:15): [True: 4.22k, False: 897]
  |  Branch (584:28): [True: 4.20k, False: 19]
  ------------------
  585|       |
  586|    916|    }
  587|       |
  588|  73.9k|    ps_cab_env->u4_code_int_range = u4_code_int_range;
  589|  73.9k|    ps_cab_env->u4_code_int_val_ofst = u4_code_int_val_ofst;
  590|       |
  591|  73.9k|    u4_value = u4_value - 1 + u4_symbol;
  592|       |
  593|  73.9k|    return (u4_value);
  594|       |
  595|  73.9k|}
ih264d_decode_bypass_bins_unary:
  622|   118k|{
  623|   118k|    UWORD32 u4_value;
  624|   118k|    UWORD32 u4_bin;
  625|   118k|    UWORD32 u4_code_int_val_ofst, u4_code_int_range;
  626|       |
  627|   118k|    UWORD32 u1_max_bins;
  628|       |
  629|   118k|    u4_code_int_val_ofst = ps_cab_env->u4_code_int_val_ofst;
  630|   118k|    u4_code_int_range = ps_cab_env->u4_code_int_range;
  631|       |
  632|   118k|    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_9)
  ------------------
  |  |  114|   118k|#define ONE_RIGHT_SHIFTED_BY_9    1<<9
  ------------------
  |  Branch (632:8): [True: 1.44k, False: 117k]
  ------------------
  633|  1.44k|    {
  634|  1.44k|        UWORD32 *pu4_buffer, u4_offset;
  635|       |
  636|  1.44k|        pu4_buffer = ps_bitstrm->pu4_buffer;
  637|  1.44k|        u4_offset = ps_bitstrm->u4_ofst;
  638|       |
  639|  1.44k|        RENORM_RANGE_OFFSET(u4_code_int_range, u4_code_int_val_ofst, u4_offset,
  ------------------
  |  |  170|  1.44k|  {                                                                                         \
  |  |  171|  1.44k|    UWORD32 read_bits_m,u4_clz_m  ;                                                         \
  |  |  172|  1.44k|    u4_clz_m = CLZ(u4_codeIntRange_m);                                                  \
  |  |  173|  1.44k|    NEXTBITS(read_bits_m,(u4_offset_m+23),pu4_buffer_m,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|  1.44k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|  1.44k|{                                                                           \
  |  |  |  |  139|  1.44k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|  1.44k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|  1.44k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|  1.44k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|  1.44k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 1.40k, False: 39]
  |  |  |  |  ------------------
  |  |  |  |  144|  1.44k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  1.40k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|  1.44k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  1.44k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|  1.44k|}
  |  |  ------------------
  |  |  174|  1.44k|    FLUSHBITS(u4_offset_m,(u4_clz_m))                                                       \
  |  |  ------------------
  |  |  |  |  193|  1.44k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|  1.44k|{                                                                           \
  |  |  |  |  195|  1.44k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|  1.44k|}
  |  |  ------------------
  |  |  175|  1.44k|    u4_codeIntRange_m = u4_codeIntRange_m << u4_clz_m;                                      \
  |  |  176|  1.44k|    u4_codeIntValOffset_m = (u4_codeIntValOffset_m << u4_clz_m) | read_bits_m;              \
  |  |  177|  1.44k|  }
  ------------------
  640|  1.44k|                            pu4_buffer)
  641|  1.44k|        ps_bitstrm->u4_ofst = u4_offset;
  642|  1.44k|    }
  643|       |
  644|       |    /*as it is called only form mvd*/
  645|   118k|    u1_max_bins = 32;
  646|   118k|    u4_value = 0;
  647|       |
  648|   118k|    do
  649|   146k|    {
  650|   146k|        u4_value++;
  651|       |
  652|   146k|        u4_code_int_range = u4_code_int_range >> 1;
  653|   146k|        if(u4_code_int_val_ofst >= u4_code_int_range)
  ------------------
  |  Branch (653:12): [True: 27.4k, False: 118k]
  ------------------
  654|  27.4k|        {
  655|       |            /* S=1 */
  656|  27.4k|            u4_bin = 1;
  657|  27.4k|            u4_code_int_val_ofst -= u4_code_int_range;
  658|  27.4k|        }
  659|   118k|        else
  660|   118k|        {
  661|       |            /* S=0 */
  662|   118k|            u4_bin = 0;
  663|   118k|        }
  664|       |
  665|   146k|        INC_BIN_COUNT(ps_cab_env);INC_BYPASS_BINS(ps_cab_env);
  666|       |
  667|   146k|        if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_9)
  ------------------
  |  |  114|   146k|#define ONE_RIGHT_SHIFTED_BY_9    1<<9
  ------------------
  |  Branch (667:12): [True: 8.69k, False: 137k]
  ------------------
  668|  8.69k|        {
  669|  8.69k|            UWORD32 *pu4_buffer, u4_offset;
  670|       |
  671|  8.69k|            pu4_buffer = ps_bitstrm->pu4_buffer;
  672|  8.69k|            u4_offset = ps_bitstrm->u4_ofst;
  673|       |
  674|  8.69k|            RENORM_RANGE_OFFSET(u4_code_int_range, u4_code_int_val_ofst, u4_offset,
  ------------------
  |  |  170|  8.69k|  {                                                                                         \
  |  |  171|  8.69k|    UWORD32 read_bits_m,u4_clz_m  ;                                                         \
  |  |  172|  8.69k|    u4_clz_m = CLZ(u4_codeIntRange_m);                                                  \
  |  |  173|  8.69k|    NEXTBITS(read_bits_m,(u4_offset_m+23),pu4_buffer_m,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|  8.69k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|  8.69k|{                                                                           \
  |  |  |  |  139|  8.69k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|  8.69k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|  8.69k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|  8.69k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|  8.69k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 8.35k, False: 337]
  |  |  |  |  ------------------
  |  |  |  |  144|  8.69k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  8.35k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|  8.69k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  8.69k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|  8.69k|}
  |  |  ------------------
  |  |  174|  8.69k|    FLUSHBITS(u4_offset_m,(u4_clz_m))                                                       \
  |  |  ------------------
  |  |  |  |  193|  8.69k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|  8.69k|{                                                                           \
  |  |  |  |  195|  8.69k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|  8.69k|}
  |  |  ------------------
  |  |  175|  8.69k|    u4_codeIntRange_m = u4_codeIntRange_m << u4_clz_m;                                      \
  |  |  176|  8.69k|    u4_codeIntValOffset_m = (u4_codeIntValOffset_m << u4_clz_m) | read_bits_m;              \
  |  |  177|  8.69k|  }
  ------------------
  675|  8.69k|                                pu4_buffer)
  676|       |
  677|  8.69k|            ps_bitstrm->u4_ofst = u4_offset;
  678|  8.69k|        }
  679|       |
  680|   146k|    }
  681|   146k|    while(u4_bin && (u4_value < u1_max_bins));
  ------------------
  |  Branch (681:11): [True: 27.4k, False: 118k]
  |  Branch (681:21): [True: 27.4k, False: 0]
  ------------------
  682|       |
  683|   118k|    ps_cab_env->u4_code_int_val_ofst = u4_code_int_val_ofst;
  684|   118k|    ps_cab_env->u4_code_int_range = u4_code_int_range;
  685|   118k|    u4_value = (u4_value - 1 + u4_bin);
  686|       |
  687|   118k|return (u4_value);
  688|   118k|}
ih264d_decode_bypass_bins:
  716|   118k|{
  717|   118k|    UWORD32 u4_bins;
  718|   118k|    UWORD32 u4_bin;
  719|   118k|    UWORD32 u4_code_int_val_ofst, u4_code_int_range;
  720|       |
  721|   118k|    u4_bins = 0;
  722|   118k|    u4_code_int_val_ofst = ps_cab_env->u4_code_int_val_ofst;
  723|   118k|    u4_code_int_range = ps_cab_env->u4_code_int_range;
  724|       |
  725|   118k|    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_9)
  ------------------
  |  |  114|   118k|#define ONE_RIGHT_SHIFTED_BY_9    1<<9
  ------------------
  |  Branch (725:8): [True: 0, False: 118k]
  ------------------
  726|      0|    {
  727|      0|        UWORD32 *pu4_buffer, u4_offset;
  728|       |
  729|      0|        pu4_buffer = ps_bitstrm->pu4_buffer;
  730|      0|        u4_offset = ps_bitstrm->u4_ofst;
  731|       |
  732|      0|        RENORM_RANGE_OFFSET(u4_code_int_range, u4_code_int_val_ofst, u4_offset,
  ------------------
  |  |  170|      0|  {                                                                                         \
  |  |  171|      0|    UWORD32 read_bits_m,u4_clz_m  ;                                                         \
  |  |  172|      0|    u4_clz_m = CLZ(u4_codeIntRange_m);                                                  \
  |  |  173|      0|    NEXTBITS(read_bits_m,(u4_offset_m+23),pu4_buffer_m,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|      0|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|      0|{                                                                           \
  |  |  |  |  139|      0|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|      0|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|      0|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|      0|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|      0|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  144|      0|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|      0|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|      0|}
  |  |  ------------------
  |  |  174|      0|    FLUSHBITS(u4_offset_m,(u4_clz_m))                                                       \
  |  |  ------------------
  |  |  |  |  193|      0|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|      0|{                                                                           \
  |  |  |  |  195|      0|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|      0|}
  |  |  ------------------
  |  |  175|      0|    u4_codeIntRange_m = u4_codeIntRange_m << u4_clz_m;                                      \
  |  |  176|      0|    u4_codeIntValOffset_m = (u4_codeIntValOffset_m << u4_clz_m) | read_bits_m;              \
  |  |  177|      0|  }
  ------------------
  733|      0|                            pu4_buffer)
  734|      0|        ps_bitstrm->u4_ofst = u4_offset;
  735|      0|    }
  736|       |
  737|   118k|    do
  738|   383k|    {
  739|       |
  740|   383k|        u4_code_int_range = u4_code_int_range >> 1;
  741|       |
  742|   383k|        if(u4_code_int_val_ofst >= u4_code_int_range)
  ------------------
  |  Branch (742:12): [True: 56.4k, False: 326k]
  ------------------
  743|  56.4k|        {
  744|       |            /* S=1 */
  745|  56.4k|            u4_bin = 1;
  746|  56.4k|            u4_code_int_val_ofst -= u4_code_int_range;
  747|  56.4k|        }
  748|   326k|        else
  749|   326k|        {
  750|       |            /* S=0 */
  751|   326k|            u4_bin = 0;
  752|   326k|        }
  753|       |
  754|   383k|        INC_BIN_COUNT(ps_cab_env);INC_BYPASS_BINS(ps_cab_env);
  755|       |
  756|   383k|        u4_bins = ((u4_bins << 1) | u4_bin);
  757|   383k|        u1_max_bins--;
  758|       |
  759|   383k|        if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_9)
  ------------------
  |  |  114|   383k|#define ONE_RIGHT_SHIFTED_BY_9    1<<9
  ------------------
  |  Branch (759:12): [True: 12.7k, False: 370k]
  ------------------
  760|  12.7k|        {
  761|  12.7k|            UWORD32 *pu4_buffer, u4_offset;
  762|       |
  763|  12.7k|            pu4_buffer = ps_bitstrm->pu4_buffer;
  764|  12.7k|            u4_offset = ps_bitstrm->u4_ofst;
  765|       |
  766|  12.7k|            RENORM_RANGE_OFFSET(u4_code_int_range, u4_code_int_val_ofst, u4_offset,
  ------------------
  |  |  170|  12.7k|  {                                                                                         \
  |  |  171|  12.7k|    UWORD32 read_bits_m,u4_clz_m  ;                                                         \
  |  |  172|  12.7k|    u4_clz_m = CLZ(u4_codeIntRange_m);                                                  \
  |  |  173|  12.7k|    NEXTBITS(read_bits_m,(u4_offset_m+23),pu4_buffer_m,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|  12.7k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|  12.7k|{                                                                           \
  |  |  |  |  139|  12.7k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|  12.7k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|  12.7k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|  12.7k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|  12.7k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 12.1k, False: 566]
  |  |  |  |  ------------------
  |  |  |  |  144|  12.7k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  12.1k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|  12.7k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  12.7k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|  12.7k|}
  |  |  ------------------
  |  |  174|  12.7k|    FLUSHBITS(u4_offset_m,(u4_clz_m))                                                       \
  |  |  ------------------
  |  |  |  |  193|  12.7k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|  12.7k|{                                                                           \
  |  |  |  |  195|  12.7k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|  12.7k|}
  |  |  ------------------
  |  |  175|  12.7k|    u4_codeIntRange_m = u4_codeIntRange_m << u4_clz_m;                                      \
  |  |  176|  12.7k|    u4_codeIntValOffset_m = (u4_codeIntValOffset_m << u4_clz_m) | read_bits_m;              \
  |  |  177|  12.7k|  }
  ------------------
  767|  12.7k|                                pu4_buffer)
  768|  12.7k|            ps_bitstrm->u4_ofst = u4_offset;
  769|  12.7k|        }
  770|       |
  771|   383k|    }
  772|   383k|    while(u1_max_bins);
  ------------------
  |  Branch (772:11): [True: 264k, False: 118k]
  ------------------
  773|       |
  774|   118k|    ps_cab_env->u4_code_int_val_ofst = u4_code_int_val_ofst;
  775|   118k|    ps_cab_env->u4_code_int_range = u4_code_int_range;
  776|       |
  777|   118k|    return (u4_bins);
  778|   118k|}

ih264d_update_csbp_8x8:
   32|  82.3k|{
   33|  82.3k|    UWORD16 u2_mod_csbp;
   34|       |
   35|  82.3k|    u2_mod_csbp = u2_luma_csbp;
   36|       |
   37|  82.3k|    if(u2_mod_csbp & 0x0033)
  ------------------
  |  Branch (37:8): [True: 27.9k, False: 54.4k]
  ------------------
   38|  27.9k|    {
   39|  27.9k|        u2_mod_csbp |= 0x0033;
   40|  27.9k|    }
   41|       |
   42|  82.3k|    if(u2_mod_csbp & 0x00CC)
  ------------------
  |  Branch (42:8): [True: 27.1k, False: 55.2k]
  ------------------
   43|  27.1k|    {
   44|  27.1k|        u2_mod_csbp |= 0x00CC;
   45|  27.1k|    }
   46|       |
   47|  82.3k|    if(u2_mod_csbp & 0x3300)
  ------------------
  |  Branch (47:8): [True: 27.3k, False: 54.9k]
  ------------------
   48|  27.3k|    {
   49|  27.3k|        u2_mod_csbp |= 0x3300;
   50|  27.3k|    }
   51|       |
   52|  82.3k|    if(u2_mod_csbp & 0xCC00)
  ------------------
  |  Branch (52:8): [True: 29.0k, False: 53.2k]
  ------------------
   53|  29.0k|    {
   54|  29.0k|        u2_mod_csbp |= 0xCC00;
   55|  29.0k|    }
   56|       |
   57|  82.3k|    return u2_mod_csbp;
   58|  82.3k|}
ih264d_fill_bs2_horz_vert:
  115|   213k|{
  116|       |    /*************************************************************************/
  117|       |    /*u4_nbr_horz_csbp=11C|10C|9C|8C|7C|6C|5C|4C|3C|2C|1C|0C|15T|14T|13T|12T */
  118|       |    /*************************************************************************/
  119|   213k|    UWORD32 u4_nbr_horz_csbp = (u4_cur_mb_csbp << 4) | (u4_top_mb_csbp >> 12);
  120|   213k|    UWORD32 u4_horz_bs2_dec = u4_cur_mb_csbp | u4_nbr_horz_csbp;
  121|       |
  122|       |    /*************************************************************************/
  123|       |    /*u4_left_mb_masked_csbp = 15L|0|0|0|11L|0|0|0|7L|0|0|0|3L|0|0|0         */
  124|       |    /*************************************************************************/
  125|   213k|    UWORD32 u4_left_mb_masked_csbp = u4_left_mb_csbp & CSBP_RIGHT_BLOCK_MASK;
  ------------------
  |  |  108|   213k|#define CSBP_RIGHT_BLOCK_MASK 0x8888
  ------------------
  126|       |
  127|       |    /*************************************************************************/
  128|       |    /*u4_cur_mb_masked_csbp =14C|13C|12C|x|10C|9C|8C|x|6C|5C|4C|x|2C|1C|0C|x */
  129|       |    /*************************************************************************/
  130|   213k|    UWORD32 u4_cur_mb_masked_csbp = (u4_cur_mb_csbp << 1)
  131|   213k|                    & (~CSBP_LEFT_BLOCK_MASK);
  ------------------
  |  |  107|   213k|#define CSBP_LEFT_BLOCK_MASK 0x1111
  ------------------
  132|       |
  133|       |    /*************************************************************************/
  134|       |    /*u4_nbr_vert_csbp=14C|13C|12C|15L|10C|9C|8C|11L|6C|5C|4C|7L|2C|1C|0C|3L */
  135|       |    /*************************************************************************/
  136|   213k|    UWORD32 u4_nbr_vert_csbp = (u4_cur_mb_masked_csbp)
  137|   213k|                    | (u4_left_mb_masked_csbp >> 3);
  138|       |
  139|   213k|    UWORD32 u4_vert_bs2_dec = u4_cur_mb_csbp | u4_nbr_vert_csbp;
  140|       |
  141|   213k|    UWORD32 u4_reordered_vert_bs2_dec, u4_temp;
  142|       |
  143|   213k|    PROFILE_DISABLE_BOUNDARY_STRENGTH()
  ------------------
  |  |  125|   213k|#define PROFILE_DISABLE_BOUNDARY_STRENGTH() ;
  ------------------
  144|       |
  145|       |    /*************************************************************************/
  146|       |    /* Fill horz edges (0,1,2,3) boundary strengths 2 using look up table    */
  147|       |    /*************************************************************************/
  148|   213k|    pu4_bs[0] = pu4_packed_bs2[u4_horz_bs2_dec & 0xF];
  149|   213k|    pu4_bs[1] = pu4_packed_bs2[(u4_horz_bs2_dec >> 4) & 0xF];
  150|   213k|    pu4_bs[2] = pu4_packed_bs2[(u4_horz_bs2_dec >> 8) & 0xF];
  151|   213k|    pu4_bs[3] = pu4_packed_bs2[(u4_horz_bs2_dec >> 12) & 0xF];
  152|       |
  153|       |    /*************************************************************************/
  154|       |    /* Do 4x4 tranpose of u4_vert_bs2_dec by using look up table for reorder */
  155|       |    /*************************************************************************/
  156|   213k|    u4_reordered_vert_bs2_dec = pu2_4x4_v2h_reorder[u4_vert_bs2_dec & 0xF];
  157|   213k|    u4_temp = pu2_4x4_v2h_reorder[(u4_vert_bs2_dec >> 4) & 0xF];
  158|   213k|    u4_reordered_vert_bs2_dec |= (u4_temp << 1);
  159|   213k|    u4_temp = pu2_4x4_v2h_reorder[(u4_vert_bs2_dec >> 8) & 0xF];
  160|   213k|    u4_reordered_vert_bs2_dec |= (u4_temp << 2);
  161|   213k|    u4_temp = pu2_4x4_v2h_reorder[(u4_vert_bs2_dec >> 12) & 0xF];
  162|   213k|    u4_reordered_vert_bs2_dec |= (u4_temp << 3);
  163|       |
  164|       |    /*************************************************************************/
  165|       |    /* Fill vert edges (4,5,6,7) boundary strengths 2 using look up table    */
  166|       |    /*************************************************************************/
  167|   213k|    pu4_bs[4] = pu4_packed_bs2[u4_reordered_vert_bs2_dec & 0xF];
  168|   213k|    pu4_bs[5] = pu4_packed_bs2[(u4_reordered_vert_bs2_dec >> 4) & 0xF];
  169|   213k|    pu4_bs[6] = pu4_packed_bs2[(u4_reordered_vert_bs2_dec >> 8) & 0xF];
  170|   213k|    pu4_bs[7] = pu4_packed_bs2[(u4_reordered_vert_bs2_dec >> 12) & 0xF];
  171|   213k|}
ih264d_fill_bs1_16x16mb_pslice:
  206|   137k|{
  207|   137k|    WORD16 i2_q_mv0, i2_q_mv1;
  208|   137k|    WORD16 i2_p_mv0, i2_p_mv1;
  209|   137k|    void *pv_cur_pic_addr0, *pv_cur_pic_addr1;
  210|   137k|    void *pv_nbr_pic_addr0, *pv_nbr_pic_addr1;
  211|   137k|    void **ppv_map_ref_idx_to_poc_l0; //,*ppv_map_ref_idx_to_poc_l1;
  212|   137k|    UWORD32 i;
  213|   137k|    UWORD32 u4_bs_horz = pu4_bs_table[0];
  214|   137k|    UWORD32 u4_bs_vert = pu4_bs_table[4];
  215|       |
  216|   137k|    PROFILE_DISABLE_BOUNDARY_STRENGTH()
  ------------------
  |  |  125|   137k|#define PROFILE_DISABLE_BOUNDARY_STRENGTH() ;
  ------------------
  217|       |
  218|   137k|    ppv_map_ref_idx_to_poc_l0 = ppv_map_ref_idx_to_poc;
  219|       |
  220|   137k|    i2_q_mv0 = ps_cur_mv_pred->i2_mv[0];
  221|   137k|    i2_q_mv1 = ps_cur_mv_pred->i2_mv[1];
  222|   137k|    pv_cur_pic_addr0 = ppv_map_ref_idx_to_poc_l0[ps_cur_mv_pred->i1_ref_frame[0]];
  223|   137k|    pv_cur_pic_addr1 = 0;
  224|       |
  225|       |    /*********************************/
  226|       |    /* Computing Bs for the top edge */
  227|       |    /*********************************/
  228|   688k|    for(i = 0; i < 4; i++, ps_top_mv_pred++)
  ------------------
  |  Branch (228:16): [True: 551k, False: 137k]
  ------------------
  229|   551k|    {
  230|   551k|        UWORD32 u4_idx = 24 - (i << 3);
  231|       |
  232|       |        /*********************************/
  233|       |        /* check if Bs is already set    */
  234|       |        /*********************************/
  235|   551k|        if(!((u4_bs_horz >> u4_idx) & 0xf))
  ------------------
  |  Branch (235:12): [True: 482k, False: 68.4k]
  ------------------
  236|   482k|        {
  237|       |            /************************************************************/
  238|       |            /* If Bs is not set, use left edge and current edge mvs and */
  239|       |            /* reference pictures addresses to evaluate Bs==1           */
  240|       |            /************************************************************/
  241|   482k|            UWORD32 u4_bs_temp1;
  242|   482k|            UWORD32 u4_bs;
  243|       |
  244|       |            /*********************************************************/
  245|       |            /* If any motion vector component differs by more than 1 */
  246|       |            /* integer pel or if reference pictures are different Bs */
  247|       |            /* is set to 1. Note that this condition shall be met for*/
  248|       |            /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/
  249|       |            /*********************************************************/
  250|   482k|            i2_p_mv0 = ps_top_mv_pred->i2_mv[0];
  251|   482k|            i2_p_mv1 = ps_top_mv_pred->i2_mv[1];
  252|   482k|            pv_nbr_pic_addr0 = u4_pic_addrress[i & 2];
  253|   482k|            pv_nbr_pic_addr1 = u4_pic_addrress[1 + (i & 2)];
  254|       |
  255|   482k|            u4_bs_temp1 = ((ABS((i2_p_mv0 - i2_q_mv0)) >= 4) ||
  ------------------
  |  |  100|   482k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 5.99k, False: 476k]
  |  |  ------------------
  ------------------
  |  Branch (255:28): [True: 4.64k, False: 477k]
  ------------------
  256|   477k|                           (ABS((i2_p_mv1 - i2_q_mv1)) >= i4_ver_mvlimit));
  ------------------
  |  |  100|   477k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 4.92k, False: 473k]
  |  |  ------------------
  ------------------
  |  Branch (256:28): [True: 679, False: 477k]
  ------------------
  257|       |
  258|   482k|            u4_bs = ((pv_cur_pic_addr0 != pv_nbr_pic_addr0)
  ------------------
  |  Branch (258:22): [True: 3.29k, False: 479k]
  ------------------
  259|   479k|                            || (pv_cur_pic_addr1 != pv_nbr_pic_addr1)
  ------------------
  |  Branch (259:32): [True: 98, False: 479k]
  ------------------
  260|   479k|                            || u4_bs_temp1);
  ------------------
  |  Branch (260:32): [True: 4.90k, False: 474k]
  ------------------
  261|       |
  262|   482k|            u4_bs_horz |= (u4_bs << u4_idx);
  263|   482k|        }
  264|   551k|    }
  265|   137k|    pu4_bs_table[0] = u4_bs_horz;
  266|       |
  267|       |    /***********************************/
  268|       |    /* Computing Bs for the left edge  */
  269|       |    /***********************************/
  270|   688k|    for(i = 0; i < 4; i++, ps_leftmost_mv_pred += 4)
  ------------------
  |  Branch (270:16): [True: 551k, False: 137k]
  ------------------
  271|   551k|    {
  272|   551k|        UWORD32 u4_idx = 24 - (i << 3);
  273|       |
  274|       |        /*********************************/
  275|       |        /* check if Bs is already set    */
  276|       |        /*********************************/
  277|   551k|        if(!((u4_bs_vert >> u4_idx) & 0xf))
  ------------------
  |  Branch (277:12): [True: 489k, False: 62.0k]
  ------------------
  278|   489k|        {
  279|       |            /****************************************************/
  280|       |            /* If Bs is not set, evalaute conditions for Bs=1   */
  281|       |            /****************************************************/
  282|   489k|            UWORD32 u4_bs_temp1;
  283|   489k|            UWORD32 u4_bs;
  284|       |            /*********************************************************/
  285|       |            /* If any motion vector component differs by more than 1 */
  286|       |            /* integer pel or if reference pictures are different Bs */
  287|       |            /* is set to 1. Note that this condition shall be met for*/
  288|       |            /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/
  289|       |            /*********************************************************/
  290|       |
  291|   489k|            i2_p_mv0 = ps_leftmost_mv_pred->i2_mv[0];
  292|   489k|            i2_p_mv1 = ps_leftmost_mv_pred->i2_mv[1];
  293|   489k|            pv_nbr_pic_addr0 = ps_left_addr->u4_add[i & 2];
  294|   489k|            pv_nbr_pic_addr1 = ps_left_addr->u4_add[1 + (i & 2)];
  295|       |
  296|   489k|            u4_bs_temp1 =
  297|   489k|                            ((ABS((i2_p_mv0 - i2_q_mv0))
  ------------------
  |  |  100|   489k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 6.01k, False: 483k]
  |  |  ------------------
  ------------------
  298|   489k|                                            >= 4)
  299|   489k|                                            | (ABS((i2_p_mv1 - i2_q_mv1))
  ------------------
  |  |  100|   489k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 4.96k, False: 484k]
  |  |  ------------------
  ------------------
  300|   489k|                                                            >= i4_ver_mvlimit));
  301|       |
  302|   489k|            u4_bs = ((pv_cur_pic_addr0 != pv_nbr_pic_addr0)
  ------------------
  |  Branch (302:22): [True: 702, False: 488k]
  ------------------
  303|   488k|                            || (pv_cur_pic_addr1 != pv_nbr_pic_addr1)
  ------------------
  |  Branch (303:32): [True: 0, False: 488k]
  ------------------
  304|   488k|                            || u4_bs_temp1);
  ------------------
  |  Branch (304:32): [True: 3.74k, False: 484k]
  ------------------
  305|       |
  306|   489k|            u4_bs_vert |= (u4_bs << u4_idx);
  307|   489k|        }
  308|   551k|    }
  309|   137k|    pu4_bs_table[4] = u4_bs_vert;
  310|       |
  311|   137k|    return;
  312|   137k|}
ih264d_fill_bs1_non16x16mb_pslice:
  347|  6.91k|{
  348|  6.91k|    UWORD32 edge;
  349|  6.91k|    void **ppv_map_ref_idx_to_poc_l0; //,*ppv_map_ref_idx_to_poc_l1;
  350|       |
  351|  6.91k|    PROFILE_DISABLE_BOUNDARY_STRENGTH()
  ------------------
  |  |  125|  6.91k|#define PROFILE_DISABLE_BOUNDARY_STRENGTH() ;
  ------------------
  352|       |
  353|  6.91k|    ppv_map_ref_idx_to_poc_l0 = ppv_map_ref_idx_to_poc;
  354|       |
  355|       |
  356|  34.5k|    for(edge = 0; edge < 4; edge++, ps_top_mv_pred = ps_cur_mv_pred - 4)
  ------------------
  |  Branch (356:19): [True: 27.6k, False: 6.91k]
  ------------------
  357|  27.6k|    {
  358|       |        /*********************************************************************/
  359|       |        /* Each iteration of this loop fills the four BS values of one HORIZ */
  360|       |        /* edge and one BS value for each of the four VERT edges.            */
  361|       |        /*********************************************************************/
  362|  27.6k|        WORD32 i;
  363|  27.6k|        UWORD32 u4_vert_idx = 24 - (edge << 3);
  364|  27.6k|        UWORD32 u4_bs_horz = pu4_bs_table[edge];
  365|  27.6k|        mv_pred_t *ps_left_mv_pred = ps_leftmost_mv_pred + (edge << 2);
  366|       |
  367|   138k|        for(i = 0; i < 4; i++, ps_top_mv_pred++, ps_cur_mv_pred++)
  ------------------
  |  Branch (367:20): [True: 110k, False: 27.6k]
  ------------------
  368|   110k|        {
  369|   110k|            WORD16 i2_cur_mv0, i2_cur_mv1;
  370|   110k|            WORD8 i1_cur_ref0;
  371|   110k|            void *pv_cur_pic_addr0, *pv_cur_pic_addr1 = 0;
  372|   110k|            void *pv_nbr_pic_addr0, *pv_nbr_pic_addr1;
  373|       |
  374|       |            /******************************************************/
  375|       |            /* Each iteration of this inner loop computes a HORIZ */
  376|       |            /* and a VERT BS value for a 4x4 block                */
  377|       |            /******************************************************/
  378|   110k|            UWORD32 u4_bs_vert = (pu4_bs_table[i + 4] >> u4_vert_idx) & 0xf;
  379|   110k|            UWORD32 u4_horz_idx = 24 - (i << 3);
  380|       |
  381|       |            /*****************************************************/
  382|       |            /* check if vert Bs for this block is already set    */
  383|       |            /*****************************************************/
  384|   110k|            if(!u4_bs_vert)
  ------------------
  |  Branch (384:16): [True: 40.8k, False: 69.7k]
  ------------------
  385|  40.8k|            {
  386|  40.8k|                WORD16 i2_left_mv0, i2_left_mv1;
  387|       |                /************************************************************/
  388|       |                /* If Bs is not set, use left edge and current edge mvs and */
  389|       |                /* reference pictures addresses to evaluate Bs==1           */
  390|       |                /************************************************************/
  391|  40.8k|                i2_left_mv0 = ps_left_mv_pred->i2_mv[0];
  392|  40.8k|                i2_left_mv1 = ps_left_mv_pred->i2_mv[1];
  393|       |
  394|  40.8k|                i2_cur_mv0 = ps_cur_mv_pred->i2_mv[0];
  395|  40.8k|                i2_cur_mv1 = ps_cur_mv_pred->i2_mv[1];
  396|       |
  397|  40.8k|                i1_cur_ref0 = ps_cur_mv_pred->i1_ref_frame[0];
  398|       |
  399|  40.8k|                pv_cur_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_cur_ref0];
  400|  40.8k|                if(i)
  ------------------
  |  Branch (400:20): [True: 31.4k, False: 9.41k]
  ------------------
  401|  31.4k|                {
  402|  31.4k|                    WORD8 i1_left_ref0 = ps_left_mv_pred->i1_ref_frame[0];
  403|  31.4k|                    pv_nbr_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_left_ref0];
  404|  31.4k|                    pv_nbr_pic_addr1 = 0;
  405|  31.4k|                }
  406|  9.41k|                else
  407|  9.41k|                {
  408|  9.41k|                    pv_nbr_pic_addr0 = ps_left_addr->u4_add[edge & 2];
  409|  9.41k|                    pv_nbr_pic_addr1 = ps_left_addr->u4_add[1 + (edge & 2)];
  410|  9.41k|                }
  411|       |
  412|  40.8k|                {
  413|  40.8k|                    UWORD32 u4_bs_temp1;
  414|       |                    /*********************************************************/
  415|       |                    /* If any motion vector component differs by more than 1 */
  416|       |                    /* integer pel or if reference pictures are different Bs */
  417|       |                    /* is set to 1. Note that this condition shall be met for*/
  418|       |                    /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/
  419|       |                    /*********************************************************/
  420|       |
  421|  40.8k|                    u4_bs_temp1 =
  422|  40.8k|                                    ((ABS((i2_left_mv0 - i2_cur_mv0))
  ------------------
  |  |  100|  40.8k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 8.70k, False: 32.1k]
  |  |  ------------------
  ------------------
  423|  40.8k|                                                    >= 4)
  424|  40.8k|                                                    | (ABS((i2_left_mv1
  ------------------
  |  |  100|  40.8k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 5.82k, False: 35.0k]
  |  |  ------------------
  ------------------
  425|  40.8k|                                                                    - i2_cur_mv1))
  426|  40.8k|                                                                    >= i4_ver_mvlimit));
  427|       |
  428|  40.8k|                    u4_bs_vert = ((pv_nbr_pic_addr0 != pv_cur_pic_addr0)
  ------------------
  |  Branch (428:35): [True: 357, False: 40.5k]
  ------------------
  429|  40.5k|                                    || (pv_nbr_pic_addr1 != pv_cur_pic_addr1)
  ------------------
  |  Branch (429:40): [True: 0, False: 40.5k]
  ------------------
  430|  40.5k|                                    || u4_bs_temp1);
  ------------------
  |  Branch (430:40): [True: 7.91k, False: 32.5k]
  ------------------
  431|       |
  432|  40.8k|                    pu4_bs_table[i + 4] |= (u4_bs_vert << u4_vert_idx);
  433|  40.8k|                }
  434|  40.8k|            }
  435|       |
  436|       |            /*****************************************************/
  437|       |            /* check if horz Bs for this block is already set    */
  438|       |            /*****************************************************/
  439|   110k|            if(!((u4_bs_horz >> u4_horz_idx) & 0xf))
  ------------------
  |  Branch (439:16): [True: 39.5k, False: 71.1k]
  ------------------
  440|  39.5k|            {
  441|  39.5k|                WORD16 i2_top_mv0, i2_top_mv1;
  442|       |                /************************************************************/
  443|       |                /* If Bs is not set, use top edge and current edge mvs and  */
  444|       |                /* reference pictures addresses to evaluate Bs==1           */
  445|       |                /************************************************************/
  446|  39.5k|                i2_cur_mv0 = ps_cur_mv_pred->i2_mv[0];
  447|  39.5k|                i2_cur_mv1 = ps_cur_mv_pred->i2_mv[1];
  448|       |
  449|  39.5k|                i1_cur_ref0 = ps_cur_mv_pred->i1_ref_frame[0];
  450|       |
  451|  39.5k|                i2_top_mv0 = ps_top_mv_pred->i2_mv[0];
  452|  39.5k|                i2_top_mv1 = ps_top_mv_pred->i2_mv[1];
  453|       |
  454|  39.5k|                pv_cur_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_cur_ref0];
  455|  39.5k|                if(edge)
  ------------------
  |  Branch (455:20): [True: 30.4k, False: 9.07k]
  ------------------
  456|  30.4k|                {
  457|  30.4k|                    WORD8 i1_top_ref0 = ps_top_mv_pred->i1_ref_frame[0];
  458|  30.4k|                    pv_nbr_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_top_ref0];
  459|  30.4k|                    pv_nbr_pic_addr1 = 0;
  460|  30.4k|                }
  461|  9.07k|                else
  462|  9.07k|                {
  463|  9.07k|                    pv_nbr_pic_addr0 = u4_pic_addrress[i & 2];
  464|  9.07k|                    pv_nbr_pic_addr1 = u4_pic_addrress[1 + (i & 2)];
  465|  9.07k|                }
  466|       |
  467|  39.5k|                {
  468|  39.5k|                    UWORD32 u4_bs_temp1;
  469|  39.5k|                    UWORD32 u4_bs;
  470|       |                    /*********************************************************/
  471|       |                    /* If any motion vector component differs by more than 1 */
  472|       |                    /* integer pel or if reference pictures are different Bs */
  473|       |                    /* is set to 1. Note that this condition shall be met for*/
  474|       |                    /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/
  475|       |                    /*********************************************************/
  476|       |
  477|  39.5k|                    u4_bs_temp1 =
  478|  39.5k|                                    ((ABS((i2_top_mv0 - i2_cur_mv0))
  ------------------
  |  |  100|  39.5k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 11.0k, False: 28.4k]
  |  |  ------------------
  ------------------
  479|  39.5k|                                                    >= 4)
  480|  39.5k|                                                    | (ABS((i2_top_mv1
  ------------------
  |  |  100|  39.5k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 6.07k, False: 33.4k]
  |  |  ------------------
  ------------------
  481|  39.5k|                                                                    - i2_cur_mv1))
  482|  39.5k|                                                                    >= i4_ver_mvlimit));
  483|       |
  484|  39.5k|                    u4_bs = ((pv_nbr_pic_addr0 != pv_cur_pic_addr0)
  ------------------
  |  Branch (484:30): [True: 806, False: 38.6k]
  ------------------
  485|  38.6k|                                    || (pv_nbr_pic_addr1 != pv_cur_pic_addr1)
  ------------------
  |  Branch (485:40): [True: 7, False: 38.6k]
  ------------------
  486|  38.6k|                                    || u4_bs_temp1);
  ------------------
  |  Branch (486:40): [True: 6.30k, False: 32.3k]
  ------------------
  487|       |
  488|  39.5k|                    u4_bs_horz |= (u4_bs << u4_horz_idx);
  489|  39.5k|                }
  490|  39.5k|            }
  491|       |
  492|   110k|            ps_left_mv_pred = ps_cur_mv_pred;
  493|   110k|        }
  494|       |
  495|  27.6k|        pu4_bs_table[edge] = u4_bs_horz;
  496|  27.6k|    }
  497|  6.91k|}
ih264d_fill_bs1_16x16mb_bslice:
  532|  48.6k|{
  533|  48.6k|    WORD16 i2_q_mv0, i2_q_mv1, i2_q_mv2, i2_q_mv3;
  534|  48.6k|    WORD16 i2_p_mv0, i2_p_mv1, i2_p_mv2, i2_p_mv3;
  535|  48.6k|    void *pv_cur_pic_addr0, *pv_cur_pic_addr1;
  536|  48.6k|    void *pv_nbr_pic_addr0, *pv_nbr_pic_addr1;
  537|  48.6k|    void **ppv_map_ref_idx_to_poc_l0, **ppv_map_ref_idx_to_poc_l1;
  538|  48.6k|    UWORD32 i;
  539|  48.6k|    UWORD32 u4_bs_horz = pu4_bs_table[0];
  540|  48.6k|    UWORD32 u4_bs_vert = pu4_bs_table[4];
  541|       |
  542|  48.6k|    PROFILE_DISABLE_BOUNDARY_STRENGTH()
  ------------------
  |  |  125|  48.6k|#define PROFILE_DISABLE_BOUNDARY_STRENGTH() ;
  ------------------
  543|       |
  544|  48.6k|    ppv_map_ref_idx_to_poc_l0 = ppv_map_ref_idx_to_poc;
  545|  48.6k|    ppv_map_ref_idx_to_poc_l1 = ppv_map_ref_idx_to_poc + POC_LIST_L0_TO_L1_DIFF;
  ------------------
  |  |   86|  48.6k|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  ------------------
  |  |  |  |  600|  48.6k|#define MAX_FRAMES              16
  |  |  ------------------
  ------------------
  546|  48.6k|    i2_q_mv0 = ps_cur_mv_pred->i2_mv[0];
  547|  48.6k|    i2_q_mv1 = ps_cur_mv_pred->i2_mv[1];
  548|  48.6k|    i2_q_mv2 = ps_cur_mv_pred->i2_mv[2];
  549|  48.6k|    i2_q_mv3 = ps_cur_mv_pred->i2_mv[3];
  550|  48.6k|    pv_cur_pic_addr0 = ppv_map_ref_idx_to_poc_l0[ps_cur_mv_pred->i1_ref_frame[0]];
  551|  48.6k|    pv_cur_pic_addr1 = ppv_map_ref_idx_to_poc_l1[ps_cur_mv_pred->i1_ref_frame[1]];
  552|       |
  553|       |    /*********************************/
  554|       |    /* Computing Bs for the top edge */
  555|       |    /*********************************/
  556|   243k|    for(i = 0; i < 4; i++, ps_top_mv_pred++)
  ------------------
  |  Branch (556:16): [True: 194k, False: 48.6k]
  ------------------
  557|   194k|    {
  558|   194k|        UWORD32 u4_idx = 24 - (i << 3);
  559|       |
  560|       |        /*********************************/
  561|       |        /* check if Bs is already set    */
  562|       |        /*********************************/
  563|   194k|        if(!((u4_bs_horz >> u4_idx) & 0xf))
  ------------------
  |  Branch (563:12): [True: 189k, False: 4.92k]
  ------------------
  564|   189k|        {
  565|       |            /************************************************************/
  566|       |            /* If Bs is not set, use left edge and current edge mvs and */
  567|       |            /* reference pictures addresses to evaluate Bs==1           */
  568|       |            /************************************************************/
  569|   189k|            UWORD32 u4_bs_temp1, u4_bs_temp2;
  570|   189k|            UWORD32 u4_bs;
  571|       |
  572|       |            /*********************************************************/
  573|       |            /* If any motion vector component differs by more than 1 */
  574|       |            /* integer pel or if reference pictures are different Bs */
  575|       |            /* is set to 1. Note that this condition shall be met for*/
  576|       |            /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/
  577|       |            /*********************************************************/
  578|   189k|            i2_p_mv0 = ps_top_mv_pred->i2_mv[0];
  579|   189k|            i2_p_mv1 = ps_top_mv_pred->i2_mv[1];
  580|   189k|            i2_p_mv2 = ps_top_mv_pred->i2_mv[2];
  581|   189k|            i2_p_mv3 = ps_top_mv_pred->i2_mv[3];
  582|   189k|            pv_nbr_pic_addr0 = u4_pic_addrress[i & 2];
  583|   189k|            pv_nbr_pic_addr1 = u4_pic_addrress[1 + (i & 2)];
  584|       |
  585|   189k|            u4_bs_temp1 =
  586|   189k|                            ((ABS((i2_p_mv0 - i2_q_mv0))
  ------------------
  |  |  100|   189k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 6.60k, False: 183k]
  |  |  ------------------
  ------------------
  587|   189k|                                            >= 4)
  588|   189k|                                            | (ABS((i2_p_mv1 - i2_q_mv1))
  ------------------
  |  |  100|   189k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 6.77k, False: 183k]
  |  |  ------------------
  ------------------
  589|   189k|                                                            >= i4_ver_mvlimit)
  590|   189k|                                            | (ABS((i2_p_mv2 - i2_q_mv2))
  ------------------
  |  |  100|   189k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 10.7k, False: 179k]
  |  |  ------------------
  ------------------
  591|   189k|                                                            >= 4)
  592|   189k|                                            | (ABS((i2_p_mv3 - i2_q_mv3))
  ------------------
  |  |  100|   189k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 7.85k, False: 181k]
  |  |  ------------------
  ------------------
  593|   189k|                                                            >= i4_ver_mvlimit));
  594|       |
  595|   189k|            u4_bs_temp2 =
  596|   189k|                            ((ABS((i2_p_mv0 - i2_q_mv2))
  ------------------
  |  |  100|   189k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 11.1k, False: 178k]
  |  |  ------------------
  ------------------
  597|   189k|                                            >= 4)
  598|   189k|                                            | (ABS((i2_p_mv1 - i2_q_mv3))
  ------------------
  |  |  100|   189k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 11.4k, False: 178k]
  |  |  ------------------
  ------------------
  599|   189k|                                                            >= i4_ver_mvlimit)
  600|   189k|                                            | (ABS((i2_p_mv2 - i2_q_mv0))
  ------------------
  |  |  100|   189k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 129k, False: 60.5k]
  |  |  ------------------
  ------------------
  601|   189k|                                                            >= 4)
  602|   189k|                                            | (ABS((i2_p_mv3 - i2_q_mv1))
  ------------------
  |  |  100|   189k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 126k, False: 62.8k]
  |  |  ------------------
  ------------------
  603|   189k|                                                            >= i4_ver_mvlimit));
  604|       |
  605|   189k|            u4_bs = ((pv_cur_pic_addr0 != pv_nbr_pic_addr0)
  ------------------
  |  Branch (605:22): [True: 19.6k, False: 170k]
  ------------------
  606|   170k|                            || (pv_cur_pic_addr1 != pv_nbr_pic_addr1)
  ------------------
  |  Branch (606:32): [True: 13.7k, False: 156k]
  ------------------
  607|   156k|                            || u4_bs_temp1)
  ------------------
  |  Branch (607:32): [True: 4.90k, False: 151k]
  ------------------
  608|  38.2k|                            && ((pv_cur_pic_addr0 != pv_nbr_pic_addr1)
  ------------------
  |  Branch (608:33): [True: 14.3k, False: 23.9k]
  ------------------
  609|  23.9k|                                            || (pv_cur_pic_addr1
  ------------------
  |  Branch (609:48): [True: 15.8k, False: 8.03k]
  ------------------
  610|  23.9k|                                                            != pv_nbr_pic_addr0)
  611|  8.03k|                                            || u4_bs_temp2);
  ------------------
  |  Branch (611:48): [True: 4.79k, False: 3.23k]
  ------------------
  612|       |
  613|   189k|            u4_bs_horz |= (u4_bs << u4_idx);
  614|   189k|        }
  615|   194k|    }
  616|  48.6k|    pu4_bs_table[0] = u4_bs_horz;
  617|       |
  618|       |    /***********************************/
  619|       |    /* Computing Bs for the left edge  */
  620|       |    /***********************************/
  621|   243k|    for(i = 0; i < 4; i++, ps_leftmost_mv_pred += 4)
  ------------------
  |  Branch (621:16): [True: 194k, False: 48.6k]
  ------------------
  622|   194k|    {
  623|   194k|        UWORD32 u4_idx = 24 - (i << 3);
  624|       |
  625|       |        /*********************************/
  626|       |        /* check if Bs is already set    */
  627|       |        /*********************************/
  628|   194k|        if(!((u4_bs_vert >> u4_idx) & 0xf))
  ------------------
  |  Branch (628:12): [True: 190k, False: 4.54k]
  ------------------
  629|   190k|        {
  630|       |            /****************************************************/
  631|       |            /* If Bs is not set, evalaute conditions for Bs=1   */
  632|       |            /****************************************************/
  633|   190k|            UWORD32 u4_bs_temp1, u4_bs_temp2;
  634|   190k|            UWORD32 u4_bs;
  635|       |            /*********************************************************/
  636|       |            /* If any motion vector component differs by more than 1 */
  637|       |            /* integer pel or if reference pictures are different Bs */
  638|       |            /* is set to 1. Note that this condition shall be met for*/
  639|       |            /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/
  640|       |            /*********************************************************/
  641|       |
  642|   190k|            i2_p_mv0 = ps_leftmost_mv_pred->i2_mv[0];
  643|   190k|            i2_p_mv1 = ps_leftmost_mv_pred->i2_mv[1];
  644|   190k|            i2_p_mv2 = ps_leftmost_mv_pred->i2_mv[2];
  645|   190k|            i2_p_mv3 = ps_leftmost_mv_pred->i2_mv[3];
  646|   190k|            pv_nbr_pic_addr0 = ps_left_addr->u4_add[i & 2];
  647|   190k|            pv_nbr_pic_addr1 = ps_left_addr->u4_add[1 + (i & 2)];
  648|       |
  649|   190k|            u4_bs_temp1 =
  650|   190k|                            ((ABS((i2_p_mv0 - i2_q_mv0))
  ------------------
  |  |  100|   190k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 4.56k, False: 185k]
  |  |  ------------------
  ------------------
  651|   190k|                                            >= 4)
  652|   190k|                                            | (ABS((i2_p_mv1 - i2_q_mv1))
  ------------------
  |  |  100|   190k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 4.11k, False: 186k]
  |  |  ------------------
  ------------------
  653|   190k|                                                            >= i4_ver_mvlimit)
  654|   190k|                                            | (ABS((i2_p_mv2 - i2_q_mv2))
  ------------------
  |  |  100|   190k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 8.39k, False: 181k]
  |  |  ------------------
  ------------------
  655|   190k|                                                            >= 4)
  656|   190k|                                            | (ABS((i2_p_mv3 - i2_q_mv3))
  ------------------
  |  |  100|   190k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 7.53k, False: 182k]
  |  |  ------------------
  ------------------
  657|   190k|                                                            >= i4_ver_mvlimit));
  658|       |
  659|   190k|            u4_bs_temp2 =
  660|   190k|                            ((ABS((i2_p_mv0 - i2_q_mv2))
  ------------------
  |  |  100|   190k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 9.94k, False: 180k]
  |  |  ------------------
  ------------------
  661|   190k|                                            >= 4)
  662|   190k|                                            | (ABS((i2_p_mv1 - i2_q_mv3))
  ------------------
  |  |  100|   190k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 10.2k, False: 179k]
  |  |  ------------------
  ------------------
  663|   190k|                                                            >= i4_ver_mvlimit)
  664|   190k|                                            | (ABS((i2_p_mv2 - i2_q_mv0))
  ------------------
  |  |  100|   190k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 138k, False: 51.7k]
  |  |  ------------------
  ------------------
  665|   190k|                                                            >= 4)
  666|   190k|                                            | (ABS((i2_p_mv3 - i2_q_mv1))
  ------------------
  |  |  100|   190k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 136k, False: 53.2k]
  |  |  ------------------
  ------------------
  667|   190k|                                                            >= i4_ver_mvlimit));
  668|       |
  669|   190k|            u4_bs = ((pv_cur_pic_addr0 != pv_nbr_pic_addr0)
  ------------------
  |  Branch (669:22): [True: 13.3k, False: 176k]
  ------------------
  670|   176k|                            || (pv_cur_pic_addr1 != pv_nbr_pic_addr1)
  ------------------
  |  Branch (670:32): [True: 9.23k, False: 167k]
  ------------------
  671|   167k|                            || u4_bs_temp1)
  ------------------
  |  Branch (671:32): [True: 4.87k, False: 162k]
  ------------------
  672|  27.4k|                            && ((pv_cur_pic_addr0 != pv_nbr_pic_addr1)
  ------------------
  |  Branch (672:33): [True: 11.7k, False: 15.7k]
  ------------------
  673|  15.7k|                                            || (pv_cur_pic_addr1
  ------------------
  |  Branch (673:48): [True: 9.60k, False: 6.12k]
  ------------------
  674|  15.7k|                                                            != pv_nbr_pic_addr0)
  675|  6.12k|                                            || u4_bs_temp2);
  ------------------
  |  Branch (675:48): [True: 5.20k, False: 914]
  ------------------
  676|       |
  677|   190k|            u4_bs_vert |= (u4_bs << u4_idx);
  678|   190k|        }
  679|   194k|    }
  680|  48.6k|    pu4_bs_table[4] = u4_bs_vert;
  681|       |
  682|  48.6k|    return;
  683|  48.6k|}
ih264d_fill_bs1_non16x16mb_bslice:
  718|  20.4k|{
  719|  20.4k|    UWORD32 edge;
  720|  20.4k|    void **ppv_map_ref_idx_to_poc_l0, **ppv_map_ref_idx_to_poc_l1;
  721|  20.4k|    ppv_map_ref_idx_to_poc_l0 = ppv_map_ref_idx_to_poc;
  722|  20.4k|    ppv_map_ref_idx_to_poc_l1 = ppv_map_ref_idx_to_poc + POC_LIST_L0_TO_L1_DIFF;
  ------------------
  |  |   86|  20.4k|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  ------------------
  |  |  |  |  600|  20.4k|#define MAX_FRAMES              16
  |  |  ------------------
  ------------------
  723|       |
  724|  20.4k|    PROFILE_DISABLE_BOUNDARY_STRENGTH()
  ------------------
  |  |  125|  20.4k|#define PROFILE_DISABLE_BOUNDARY_STRENGTH() ;
  ------------------
  725|       |
  726|   102k|    for(edge = 0; edge < 4; edge++, ps_top_mv_pred = ps_cur_mv_pred - 4)
  ------------------
  |  Branch (726:19): [True: 81.7k, False: 20.4k]
  ------------------
  727|  81.7k|    {
  728|       |        /*********************************************************************/
  729|       |        /* Each iteration of this loop fills the four BS values of one HORIZ */
  730|       |        /* edge and one BS value for each of the four VERT edges.            */
  731|       |        /*********************************************************************/
  732|  81.7k|        WORD32 i;
  733|  81.7k|        UWORD32 u4_vert_idx = 24 - (edge << 3);
  734|  81.7k|        UWORD32 u4_bs_horz = pu4_bs_table[edge];
  735|  81.7k|        mv_pred_t *ps_left_mv_pred = ps_leftmost_mv_pred + (edge << 2);
  736|       |
  737|   408k|        for(i = 0; i < 4; i++, ps_top_mv_pred++, ps_cur_mv_pred++)
  ------------------
  |  Branch (737:20): [True: 326k, False: 81.7k]
  ------------------
  738|   326k|        {
  739|   326k|            WORD16 i2_cur_mv0, i2_cur_mv1, i16_curMv2, i16_curMv3;
  740|   326k|            WORD8 i1_cur_ref0, i1_cur_ref1;
  741|   326k|            void *pv_cur_pic_addr0, *pv_cur_pic_addr1;
  742|   326k|            void *pv_nbr_pic_addr0, *pv_nbr_pic_addr1;
  743|       |
  744|       |            /******************************************************/
  745|       |            /* Each iteration of this inner loop computes a HORIZ */
  746|       |            /* and a VERT BS value for a 4x4 block                */
  747|       |            /******************************************************/
  748|   326k|            UWORD32 u4_bs_vert = (pu4_bs_table[i + 4] >> u4_vert_idx) & 0xf;
  749|   326k|            UWORD32 u4_horz_idx = 24 - (i << 3);
  750|       |
  751|       |            /*****************************************************/
  752|       |            /* check if vert Bs for this block is already set    */
  753|       |            /*****************************************************/
  754|   326k|            if(!u4_bs_vert)
  ------------------
  |  Branch (754:16): [True: 311k, False: 15.8k]
  ------------------
  755|   311k|            {
  756|   311k|                WORD16 i2_left_mv0, i2_left_mv1, i2_left_mv2, i2_left_mv3;
  757|       |                /************************************************************/
  758|       |                /* If Bs is not set, use left edge and current edge mvs and */
  759|       |                /* reference pictures addresses to evaluate Bs==1           */
  760|       |                /************************************************************/
  761|   311k|                i2_left_mv0 = ps_left_mv_pred->i2_mv[0];
  762|   311k|                i2_left_mv1 = ps_left_mv_pred->i2_mv[1];
  763|   311k|                i2_left_mv2 = ps_left_mv_pred->i2_mv[2];
  764|   311k|                i2_left_mv3 = ps_left_mv_pred->i2_mv[3];
  765|       |
  766|   311k|                i2_cur_mv0 = ps_cur_mv_pred->i2_mv[0];
  767|   311k|                i2_cur_mv1 = ps_cur_mv_pred->i2_mv[1];
  768|   311k|                i16_curMv2 = ps_cur_mv_pred->i2_mv[2];
  769|   311k|                i16_curMv3 = ps_cur_mv_pred->i2_mv[3];
  770|   311k|                i1_cur_ref0 = ps_cur_mv_pred->i1_ref_frame[0];
  771|   311k|                i1_cur_ref1 = ps_cur_mv_pred->i1_ref_frame[1];
  772|   311k|                pv_cur_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_cur_ref0];
  773|   311k|                pv_cur_pic_addr1 = ppv_map_ref_idx_to_poc_l1[i1_cur_ref1];
  774|       |
  775|   311k|                if(i)
  ------------------
  |  Branch (775:20): [True: 233k, False: 77.4k]
  ------------------
  776|   233k|                {
  777|   233k|                    WORD8 i1_left_ref0, i1_left_ref1;
  778|   233k|                    i1_left_ref0 = ps_left_mv_pred->i1_ref_frame[0];
  779|   233k|                    i1_left_ref1 = ps_left_mv_pred->i1_ref_frame[1];
  780|   233k|                    pv_nbr_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_left_ref0];
  781|   233k|                    pv_nbr_pic_addr1 = ppv_map_ref_idx_to_poc_l1[i1_left_ref1];
  782|   233k|                }
  783|  77.4k|                else
  784|  77.4k|                {
  785|  77.4k|                    pv_nbr_pic_addr0 = ps_left_addr->u4_add[edge & 2];
  786|  77.4k|                    pv_nbr_pic_addr1 = ps_left_addr->u4_add[1 + (edge & 2)];
  787|  77.4k|                }
  788|       |
  789|   311k|                {
  790|   311k|                    UWORD32 u4_bs_temp1, u4_bs_temp2;
  791|       |                    /*********************************************************/
  792|       |                    /* If any motion vector component differs by more than 1 */
  793|       |                    /* integer pel or if reference pictures are different Bs */
  794|       |                    /* is set to 1. Note that this condition shall be met for*/
  795|       |                    /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/
  796|       |                    /*********************************************************/
  797|       |
  798|   311k|                    u4_bs_temp1 =
  799|   311k|                                    ((ABS((i2_left_mv0 - i2_cur_mv0))
  ------------------
  |  |  100|   311k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 54.7k, False: 256k]
  |  |  ------------------
  ------------------
  800|   311k|                                                    >= 4)
  801|   311k|                                                    | (ABS((i2_left_mv1
  ------------------
  |  |  100|   311k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 50.6k, False: 260k]
  |  |  ------------------
  ------------------
  802|   311k|                                                                    - i2_cur_mv1))
  803|   311k|                                                                    >= i4_ver_mvlimit)
  804|   311k|                                                    | (ABS((i2_left_mv2
  ------------------
  |  |  100|   311k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 13.0k, False: 297k]
  |  |  ------------------
  ------------------
  805|   311k|                                                                    - i16_curMv2))
  806|   311k|                                                                    >= 4)
  807|   311k|                                                    | (ABS((i2_left_mv3
  ------------------
  |  |  100|   311k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 10.9k, False: 300k]
  |  |  ------------------
  ------------------
  808|   311k|                                                                    - i16_curMv3))
  809|   311k|                                                                    >= i4_ver_mvlimit));
  810|       |
  811|   311k|                    u4_bs_temp2 =
  812|   311k|                                    ((ABS((i2_left_mv0 - i16_curMv2))
  ------------------
  |  |  100|   311k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 28.5k, False: 282k]
  |  |  ------------------
  ------------------
  813|   311k|                                                    >= 4)
  814|   311k|                                                    | (ABS((i2_left_mv1
  ------------------
  |  |  100|   311k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 41.1k, False: 269k]
  |  |  ------------------
  ------------------
  815|   311k|                                                                    - i16_curMv3))
  816|   311k|                                                                    >= i4_ver_mvlimit)
  817|   311k|                                                    | (ABS((i2_left_mv2
  ------------------
  |  |  100|   311k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 235k, False: 75.2k]
  |  |  ------------------
  ------------------
  818|   311k|                                                                    - i2_cur_mv0))
  819|   311k|                                                                    >= 4)
  820|   311k|                                                    | (ABS((i2_left_mv3
  ------------------
  |  |  100|   311k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 218k, False: 92.9k]
  |  |  ------------------
  ------------------
  821|   311k|                                                                    - i2_cur_mv1))
  822|   311k|                                                                    >= i4_ver_mvlimit));
  823|       |
  824|   311k|                    u4_bs_vert =
  825|   311k|                                    ((pv_nbr_pic_addr0 != pv_cur_pic_addr0)
  ------------------
  |  Branch (825:38): [True: 20.6k, False: 290k]
  ------------------
  826|   290k|                                                    || (pv_nbr_pic_addr1
  ------------------
  |  Branch (826:56): [True: 13.0k, False: 277k]
  ------------------
  827|   290k|                                                                    != pv_cur_pic_addr1)
  828|   277k|                                                    || u4_bs_temp1)
  ------------------
  |  Branch (828:56): [True: 62.0k, False: 215k]
  ------------------
  829|  95.7k|                                                    && ((pv_nbr_pic_addr0
  ------------------
  |  Branch (829:57): [True: 71.3k, False: 24.4k]
  ------------------
  830|  95.7k|                                                                    != pv_cur_pic_addr1)
  831|  24.4k|                                                                    || (pv_nbr_pic_addr1
  ------------------
  |  Branch (831:72): [True: 14.2k, False: 10.2k]
  ------------------
  832|  24.4k|                                                                                    != pv_cur_pic_addr0)
  833|  10.2k|                                                                    || u4_bs_temp2);
  ------------------
  |  Branch (833:72): [True: 8.78k, False: 1.45k]
  ------------------
  834|       |
  835|   311k|                    pu4_bs_table[i + 4] |= (u4_bs_vert << u4_vert_idx);
  836|   311k|                }
  837|   311k|            }
  838|       |
  839|       |            /*****************************************************/
  840|       |            /* check if horz Bs for this block is already set    */
  841|       |            /*****************************************************/
  842|   326k|            if(!((u4_bs_horz >> u4_horz_idx) & 0xf))
  ------------------
  |  Branch (842:16): [True: 309k, False: 17.5k]
  ------------------
  843|   309k|            {
  844|   309k|                WORD16 i2_top_mv0, i2_top_mv1, i16_topMv2, i16_topMv3;
  845|       |                /************************************************************/
  846|       |                /* If Bs is not set, use top edge and current edge mvs and  */
  847|       |                /* reference pictures addresses to evaluate Bs==1           */
  848|       |                /************************************************************/
  849|   309k|                i2_cur_mv0 = ps_cur_mv_pred->i2_mv[0];
  850|   309k|                i2_cur_mv1 = ps_cur_mv_pred->i2_mv[1];
  851|   309k|                i16_curMv2 = ps_cur_mv_pred->i2_mv[2];
  852|   309k|                i16_curMv3 = ps_cur_mv_pred->i2_mv[3];
  853|   309k|                i1_cur_ref0 = ps_cur_mv_pred->i1_ref_frame[0];
  854|   309k|                i1_cur_ref1 = ps_cur_mv_pred->i1_ref_frame[1];
  855|       |
  856|   309k|                i2_top_mv0 = ps_top_mv_pred->i2_mv[0];
  857|   309k|                i2_top_mv1 = ps_top_mv_pred->i2_mv[1];
  858|   309k|                i16_topMv2 = ps_top_mv_pred->i2_mv[2];
  859|   309k|                i16_topMv3 = ps_top_mv_pred->i2_mv[3];
  860|   309k|                pv_cur_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_cur_ref0];
  861|   309k|                pv_cur_pic_addr1 = ppv_map_ref_idx_to_poc_l1[i1_cur_ref1];
  862|   309k|                if(edge)
  ------------------
  |  Branch (862:20): [True: 232k, False: 76.5k]
  ------------------
  863|   232k|                {
  864|   232k|                    WORD8 i1_top_ref0, i1_top_ref1;
  865|   232k|                    i1_top_ref0 = ps_top_mv_pred->i1_ref_frame[0];
  866|   232k|                    i1_top_ref1 = ps_top_mv_pred->i1_ref_frame[1];
  867|   232k|                    pv_nbr_pic_addr0 = ppv_map_ref_idx_to_poc_l0[i1_top_ref0];
  868|   232k|                    pv_nbr_pic_addr1 = ppv_map_ref_idx_to_poc_l1[i1_top_ref1];
  869|   232k|                }
  870|  76.5k|                else
  871|  76.5k|                {
  872|  76.5k|                    pv_nbr_pic_addr0 = u4_pic_addrress[i & 2];
  873|  76.5k|                    pv_nbr_pic_addr1 = u4_pic_addrress[1 + (i & 2)];
  874|  76.5k|                }
  875|       |
  876|   309k|                {
  877|   309k|                    UWORD32 u4_bs_temp1, u4_bs_temp2;
  878|   309k|                    UWORD32 u4_bs;
  879|       |                    /*********************************************************/
  880|       |                    /* If any motion vector component differs by more than 1 */
  881|       |                    /* integer pel or if reference pictures are different Bs */
  882|       |                    /* is set to 1. Note that this condition shall be met for*/
  883|       |                    /* both (fwd-fwd,bwd-bwd) and (fwd-bwd,bwd-fwd) direction*/
  884|       |                    /*********************************************************/
  885|       |
  886|   309k|                    u4_bs_temp1 =
  887|   309k|                                    ((ABS((i2_top_mv0 - i2_cur_mv0))
  ------------------
  |  |  100|   309k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 101k, False: 207k]
  |  |  ------------------
  ------------------
  888|   309k|                                                    >= 4)
  889|   309k|                                                    | (ABS((i2_top_mv1
  ------------------
  |  |  100|   309k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 95.3k, False: 213k]
  |  |  ------------------
  ------------------
  890|   309k|                                                                    - i2_cur_mv1))
  891|   309k|                                                                    >= i4_ver_mvlimit)
  892|   309k|                                                    | (ABS((i16_topMv2
  ------------------
  |  |  100|   309k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 13.0k, False: 296k]
  |  |  ------------------
  ------------------
  893|   309k|                                                                    - i16_curMv2))
  894|   309k|                                                                    >= 4)
  895|   309k|                                                    | (ABS((i16_topMv3
  ------------------
  |  |  100|   309k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 11.8k, False: 297k]
  |  |  ------------------
  ------------------
  896|   309k|                                                                    - i16_curMv3))
  897|   309k|                                                                    >= i4_ver_mvlimit));
  898|       |
  899|   309k|                    u4_bs_temp2 =
  900|   309k|                                    ((ABS((i2_top_mv0 - i16_curMv2))
  ------------------
  |  |  100|   309k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 27.1k, False: 282k]
  |  |  ------------------
  ------------------
  901|   309k|                                                    >= 4)
  902|   309k|                                                    | (ABS((i2_top_mv1
  ------------------
  |  |  100|   309k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 39.2k, False: 270k]
  |  |  ------------------
  ------------------
  903|   309k|                                                                    - i16_curMv3))
  904|   309k|                                                                    >= i4_ver_mvlimit)
  905|   309k|                                                    | (ABS((i16_topMv2
  ------------------
  |  |  100|   309k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 234k, False: 75.0k]
  |  |  ------------------
  ------------------
  906|   309k|                                                                    - i2_cur_mv0))
  907|   309k|                                                                    >= 4)
  908|   309k|                                                    | (ABS((i16_topMv3
  ------------------
  |  |  100|   309k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 216k, False: 92.4k]
  |  |  ------------------
  ------------------
  909|   309k|                                                                    - i2_cur_mv1))
  910|   309k|                                                                    >= i4_ver_mvlimit));
  911|       |
  912|   309k|                    u4_bs =
  913|   309k|                                    ((pv_nbr_pic_addr0 != pv_cur_pic_addr0)
  ------------------
  |  Branch (913:38): [True: 24.2k, False: 285k]
  ------------------
  914|   285k|                                                    || (pv_nbr_pic_addr1
  ------------------
  |  Branch (914:56): [True: 9.33k, False: 275k]
  ------------------
  915|   285k|                                                                    != pv_cur_pic_addr1)
  916|   275k|                                                    || u4_bs_temp1)
  ------------------
  |  Branch (916:56): [True: 94.6k, False: 181k]
  ------------------
  917|   128k|                                                    && ((pv_nbr_pic_addr0
  ------------------
  |  Branch (917:57): [True: 101k, False: 27.1k]
  ------------------
  918|   128k|                                                                    != pv_cur_pic_addr1)
  919|  27.1k|                                                                    || (pv_nbr_pic_addr1
  ------------------
  |  Branch (919:72): [True: 14.2k, False: 12.8k]
  ------------------
  920|  27.1k|                                                                                    != pv_cur_pic_addr0)
  921|  12.8k|                                                                    || u4_bs_temp2);
  ------------------
  |  Branch (921:72): [True: 8.82k, False: 4.07k]
  ------------------
  922|       |
  923|   309k|                    u4_bs_horz |= (u4_bs << u4_horz_idx);
  924|   309k|                }
  925|   309k|            }
  926|       |
  927|   326k|            ps_left_mv_pred = ps_cur_mv_pred;
  928|   326k|        }
  929|       |
  930|  81.7k|        pu4_bs_table[edge] = u4_bs_horz;
  931|  81.7k|    }
  932|  20.4k|}
ih264d_compute_bs_non_mbaff:
 1146|   253k|{
 1147|       |    /* Mvpred and Nnz for top and Courrent */
 1148|   253k|    mv_pred_t *ps_cur_mv_pred, *ps_top_mv_pred = NULL, *ps_left_mv_pred;
 1149|       |    /* deblk_mb_t Params */
 1150|   253k|    deblk_mb_t *ps_cur_mb_params; /*< Parameters of current MacroBlock */
 1151|   253k|    deblkmb_neighbour_t *ps_deblk_top_mb;
 1152|       |
 1153|       |    /* Reference Index to POC mapping*/
 1154|   253k|    void ** apv_map_ref_idx_to_poc;
 1155|   253k|    UWORD32 u4_leftmbtype;
 1156|       |
 1157|   253k|    UWORD16 u2_left_csbp, u2_top_csbp, u2_cur_csbp;
 1158|       |
 1159|       |    /* Set of flags */
 1160|   253k|    UWORD32 u4_cur_mb_intra, u1_top_mb_typ, u4_cur_mb_fld;
 1161|   253k|    UWORD32 u1_cur_mb_type;
 1162|   253k|    UWORD32 * pu4_bs_table;
 1163|       |
 1164|       |    /* Neighbour availability */
 1165|       |    /* Initialization */
 1166|   253k|    const UWORD32 u2_mbx = ps_cur_mb_info->u2_mbx;
 1167|   253k|    const UWORD32 u2_mby = ps_cur_mb_info->u2_mby;
 1168|   253k|    const UWORD32 u1_pingpong = u2_mbx & 0x01;
 1169|       |
 1170|   253k|    PROFILE_DISABLE_BOUNDARY_STRENGTH()
  ------------------
  |  |  125|   253k|#define PROFILE_DISABLE_BOUNDARY_STRENGTH() ;
  ------------------
 1171|       |
 1172|   253k|    ps_deblk_top_mb = ps_dec->ps_deblk_top_mb + u2_mbx;
 1173|       |
 1174|       |
 1175|       |    /* Pointer assignment for Current DeblkMB, Current Mv Pred  */
 1176|   253k|    ps_cur_mb_params = ps_dec->ps_deblk_mbn + u2_mbxn_mb;
 1177|   253k|    ps_cur_mv_pred = ps_dec->ps_mv_cur + (u2_mbxn_mb << 4);
 1178|       |
 1179|   253k|    apv_map_ref_idx_to_poc = ps_dec->ppv_map_ref_idx_to_poc + 1;
 1180|   253k|    u1_cur_mb_type = ps_cur_mb_params->u1_mb_type;
 1181|   253k|    u1_top_mb_typ = ps_deblk_top_mb->u1_mb_type;
 1182|   253k|    ps_deblk_top_mb->u1_mb_type = u1_cur_mb_type;
 1183|       |
 1184|   253k|    {
 1185|   253k|        UWORD8 mb_qp_temp;
 1186|       |
 1187|   253k|        ps_cur_mb_params->u1_topmb_qp = ps_deblk_top_mb->u1_mb_qp;
 1188|   253k|        ps_deblk_top_mb->u1_mb_qp = ps_cur_mb_params->u1_mb_qp;
 1189|       |
 1190|   253k|        ps_cur_mb_params->u1_left_mb_qp = ps_dec->deblk_left_mb[1].u1_mb_qp;
 1191|   253k|        ps_dec->deblk_left_mb[1].u1_mb_qp = ps_cur_mb_params->u1_mb_qp;
 1192|       |
 1193|   253k|    }
 1194|       |
 1195|       |    /* if no deblocking required for current Mb then continue */
 1196|       |    /* Check next Mbs   in Mb group                           */
 1197|   253k|    if(ps_cur_mb_params->u1_deblocking_mode & MB_DISABLE_FILTERING)
  ------------------
  |  |   70|   253k|#define MB_DISABLE_FILTERING          0x01
  ------------------
  |  Branch (1197:8): [True: 53.1k, False: 200k]
  ------------------
 1198|  53.1k|    {
 1199|  53.1k|        void ** pu4_map_ref_idx_to_poc_l1 = apv_map_ref_idx_to_poc +
 1200|  53.1k|        POC_LIST_L0_TO_L1_DIFF;
  ------------------
  |  |   86|  53.1k|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  ------------------
  |  |  |  |  600|  53.1k|#define MAX_FRAMES              16
  |  |  ------------------
  ------------------
 1201|  53.1k|        {
 1202|       |            /* Store Parameter for Top MvPred refernce frame Address */
 1203|       |
 1204|  53.1k|            void ** ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress;
 1205|  53.1k|            WORD8 * p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame;
 1206|  53.1k|            WORD8 * p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame;
 1207|       |
 1208|       |            /* Store Left addresses for Next Mb   */
 1209|  53.1k|            void ** ppv_left_mv_pred_addr =
 1210|  53.1k|                            ps_dec->ps_left_mvpred_addr[!u1_pingpong][1].u4_add;
 1211|  53.1k|            WORD8 * p1_refleft0 = (ps_cur_mv_pred + 3)->i1_ref_frame;
 1212|       |
 1213|       |
 1214|  53.1k|            ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]];
 1215|  53.1k|            ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]];
 1216|       |
 1217|  53.1k|            ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
 1218|  53.1k|            ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
 1219|  53.1k|            ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
 1220|  53.1k|            ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
 1221|       |
 1222|  53.1k|            ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refleft0[0]];
 1223|  53.1k|            ppv_left_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refleft0[1]];
 1224|       |            //}
 1225|       |            /* Storing the leftMbtype for next Mb */
 1226|  53.1k|            ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type;
 1227|  53.1k|        }
 1228|       |
 1229|  53.1k|        return;
 1230|  53.1k|    }
 1231|       |
 1232|       |    /* Flag for extra left Edge */
 1233|   200k|    ps_cur_mb_params->u1_single_call = 1;
 1234|       |
 1235|       |    /* Update the Left deblk_mb_t and Left MvPred Parameters           */
 1236|   200k|    if(!u2_mbx)
  ------------------
  |  Branch (1236:8): [True: 37.9k, False: 162k]
  ------------------
 1237|  37.9k|    {
 1238|  37.9k|        u4_leftmbtype = 0;
 1239|       |
 1240|       |        /* Initialize the ps_left_mv_pred with Junk but Valid Location */
 1241|       |        /* to avoid invalid memory access                           */
 1242|       |        /* this is read only pointer                                */
 1243|  37.9k|        ps_left_mv_pred = ps_dec->ps_mv_cur + 3;
 1244|  37.9k|    }
 1245|   162k|    else
 1246|   162k|    {
 1247|   162k|        u4_leftmbtype = ps_dec->deblk_left_mb[1].u1_mb_type;
 1248|       |
 1249|       |        /* Come to Left Most Edge of the MB */
 1250|   162k|        ps_left_mv_pred = (u2_mbxn_mb) ?
  ------------------
  |  Branch (1250:27): [True: 161k, False: 1.11k]
  ------------------
 1251|   161k|                        ps_dec->ps_mv_cur + ((u2_mbxn_mb - 1) << 4) + 3 :
 1252|   162k|                        ps_dec->ps_mv_left + 3;
 1253|   162k|    }
 1254|       |
 1255|   200k|    if(!u2_mby)
  ------------------
  |  Branch (1255:8): [True: 6.70k, False: 193k]
  ------------------
 1256|  6.70k|        u1_top_mb_typ = 0;
 1257|       |
 1258|       |    /* MvPred Pointer Calculation */
 1259|       |    /* CHANGED CODE */
 1260|   200k|    ps_top_mv_pred = ps_cur_mv_pred - (ps_dec->u2_frm_wd_in_mbs << 4) + 12;
 1261|       |
 1262|   200k|    u4_cur_mb_intra = u1_cur_mb_type & D_INTRA_MB;
  ------------------
  |  |  382|   200k|#define D_INTRA_MB        1
  ------------------
 1263|   200k|    u4_cur_mb_fld = !!(u1_cur_mb_type & D_FLD_MB);
  ------------------
  |  |  386|   200k|#define D_FLD_MB          0x80
  ------------------
 1264|       |    /* Compute BS function */
 1265|   200k|    pu4_bs_table = ps_cur_mb_params->u4_bs_table;
 1266|       |
 1267|   200k|    u2_cur_csbp = ps_cur_mb_info->ps_curmb->u2_luma_csbp;
 1268|   200k|    u2_left_csbp = ps_cur_mb_info->ps_left_mb->u2_luma_csbp;
 1269|   200k|    u2_top_csbp = ps_cur_mb_info->ps_top_mb->u2_luma_csbp;
 1270|       |    /* Compute BS function */
 1271|   200k|    if(ps_dec->ps_cur_sps->u1_profile_idc == HIGH_PROFILE_IDC)
  ------------------
  |  |  278|   200k|#define HIGH_PROFILE_IDC   100
  ------------------
  |  Branch (1271:8): [True: 73.0k, False: 127k]
  ------------------
 1272|  73.0k|    {
 1273|  73.0k|        if(ps_cur_mb_info->u1_tran_form8x8 == 1)
  ------------------
  |  Branch (1273:12): [True: 27.8k, False: 45.2k]
  ------------------
 1274|  27.8k|        {
 1275|  27.8k|            u2_cur_csbp = ih264d_update_csbp_8x8(
 1276|  27.8k|                            ps_cur_mb_info->ps_curmb->u2_luma_csbp);
 1277|  27.8k|        }
 1278|       |
 1279|  73.0k|        if(ps_cur_mb_info->ps_left_mb->u1_tran_form8x8 == 1)
  ------------------
  |  Branch (1279:12): [True: 15.8k, False: 57.2k]
  ------------------
 1280|  15.8k|        {
 1281|  15.8k|            u2_left_csbp = ih264d_update_csbp_8x8(
 1282|  15.8k|                            ps_cur_mb_info->ps_left_mb->u2_luma_csbp);
 1283|  15.8k|        }
 1284|       |
 1285|  73.0k|        if(ps_cur_mb_info->ps_top_mb->u1_tran_form8x8 == 1)
  ------------------
  |  Branch (1285:12): [True: 22.2k, False: 50.8k]
  ------------------
 1286|  22.2k|        {
 1287|  22.2k|            u2_top_csbp = ih264d_update_csbp_8x8(
 1288|  22.2k|                            ps_cur_mb_info->ps_top_mb->u2_luma_csbp);
 1289|  22.2k|        }
 1290|  73.0k|    }
 1291|   200k|    if(u4_cur_mb_intra)
  ------------------
  |  Branch (1291:8): [True: 6.45k, False: 194k]
  ------------------
 1292|  6.45k|    {
 1293|       |
 1294|  6.45k|        pu4_bs_table[4] = 0x04040404;
 1295|  6.45k|        pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404;
  ------------------
  |  Branch (1295:27): [True: 0, False: 6.45k]
  ------------------
 1296|  6.45k|        pu4_bs_table[1] = 0x03030303;
 1297|  6.45k|        pu4_bs_table[2] = 0x03030303;
 1298|  6.45k|        pu4_bs_table[3] = 0x03030303;
 1299|  6.45k|        pu4_bs_table[5] = 0x03030303;
 1300|  6.45k|        pu4_bs_table[6] = 0x03030303;
 1301|  6.45k|        pu4_bs_table[7] = 0x03030303;
 1302|  6.45k|    }
 1303|   194k|    else
 1304|   194k|    {
 1305|   194k|        UWORD32 u4_is_non16x16 = !!(u1_cur_mb_type & D_PRED_NON_16x16);
  ------------------
  |  |  383|   194k|#define D_PRED_NON_16x16  2
  ------------------
 1306|   194k|        UWORD32 u4_is_b = ps_dec->u1_B;
 1307|       |
 1308|   194k|        ih264d_fill_bs2_horz_vert(
 1309|   194k|                        pu4_bs_table, u2_left_csbp, u2_top_csbp, u2_cur_csbp,
 1310|   194k|                        (const UWORD32 *)(gau4_ih264d_packed_bs2),
 1311|   194k|                        (const UWORD16 *)(gau2_ih264d_4x4_v2h_reorder));
 1312|       |
 1313|   194k|        if(u4_leftmbtype & D_INTRA_MB)
  ------------------
  |  |  382|   194k|#define D_INTRA_MB        1
  ------------------
  |  Branch (1313:12): [True: 409, False: 193k]
  ------------------
 1314|    409|            pu4_bs_table[4] = 0x04040404;
 1315|       |
 1316|   194k|        if(u1_top_mb_typ & D_INTRA_MB)
  ------------------
  |  |  382|   194k|#define D_INTRA_MB        1
  ------------------
  |  Branch (1316:12): [True: 877, False: 193k]
  ------------------
 1317|    877|            pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404;
  ------------------
  |  Branch (1317:31): [True: 0, False: 877]
  ------------------
 1318|       |
 1319|   194k|        ps_dec->pf_fill_bs1[u4_is_b][u4_is_non16x16](
 1320|   194k|                        ps_cur_mv_pred, ps_top_mv_pred, apv_map_ref_idx_to_poc,
 1321|   194k|                        pu4_bs_table, ps_left_mv_pred,
 1322|   194k|                        &(ps_dec->ps_left_mvpred_addr[u1_pingpong][1]),
 1323|   194k|                        ps_cur_mb_info->ps_top_mb->u4_pic_addrress,
 1324|   194k|                        (4 >> u4_cur_mb_fld));
 1325|   194k|    }
 1326|       |
 1327|   200k|    {
 1328|   200k|        void ** pu4_map_ref_idx_to_poc_l1 = apv_map_ref_idx_to_poc +
 1329|   200k|        POC_LIST_L0_TO_L1_DIFF;
  ------------------
  |  |   86|   200k|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  ------------------
  |  |  |  |  600|   200k|#define MAX_FRAMES              16
  |  |  ------------------
  ------------------
 1330|   200k|        {
 1331|       |            /* Store Parameter for Top MvPred refernce frame Address */
 1332|       |
 1333|   200k|            void ** ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress;
 1334|   200k|            WORD8 * p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame;
 1335|   200k|            WORD8 * p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame;
 1336|       |
 1337|       |            /* Store Left addresses for Next Mb   */
 1338|   200k|            void ** ppv_left_mv_pred_addr =
 1339|   200k|                            ps_dec->ps_left_mvpred_addr[!u1_pingpong][1].u4_add;
 1340|   200k|            WORD8 * p1_refleft0 = (ps_cur_mv_pred + 3)->i1_ref_frame;
 1341|       |
 1342|   200k|            ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]];
 1343|   200k|            ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]];
 1344|       |
 1345|   200k|            ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
 1346|   200k|            ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
 1347|   200k|            ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
 1348|   200k|            ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
 1349|       |
 1350|   200k|            ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refleft0[0]];
 1351|   200k|            ppv_left_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refleft0[1]];
 1352|       |
 1353|       |            /* Storing the leftMbtype for next Mb */
 1354|   200k|            ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type;
 1355|       |
 1356|   200k|        }
 1357|   200k|    }
 1358|       |
 1359|       |    /* For transform 8x8 disable deblocking of the intrernal edges of a 8x8 block */
 1360|   200k|    if(ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (1360:8): [True: 29.4k, False: 171k]
  ------------------
 1361|  29.4k|    {
 1362|  29.4k|        pu4_bs_table[1] = 0;
 1363|  29.4k|        pu4_bs_table[3] = 0;
 1364|  29.4k|        pu4_bs_table[5] = 0;
 1365|  29.4k|        pu4_bs_table[7] = 0;
 1366|  29.4k|    }
 1367|   200k|}

ih264d_filter_boundary_left_nonmbaff:
   87|   358k|{
   88|   358k|    UWORD8 *pu1_y, *pu1_u, *pu1_v;
   89|   358k|    WORD32 uc_tmp, qp_avg;
   90|   358k|    WORD32 alpha_u = 0, beta_u = 0, alpha_v = 0, beta_v = 0;
   91|   358k|    WORD32 alpha_y = 0, beta_y = 0;
   92|       |
   93|   358k|    WORD32 idx_b_u, idx_a_u, idx_b_v, idx_a_v;
   94|   358k|    WORD32 idx_b_y, idx_a_y;
   95|       |
   96|   358k|    UWORD32 u4_bs_val;
   97|       |
   98|   358k|    UWORD8 *pu1_cliptab_u, *pu1_cliptab_v, *pu1_cliptab_y;
   99|       |
  100|   358k|    UWORD8 u1_double_cl = !ps_cur_mb->u1_single_call;
  101|   358k|    WORD32 ofst_a = ps_cur_mb->i1_slice_alpha_c0_offset;
  102|   358k|    WORD32 ofst_b = ps_cur_mb->i1_slice_beta_offset;
  103|       |
  104|   358k|    PROFILE_DISABLE_DEBLK()
  ------------------
  |  |   91|   358k|#define PROFILE_DISABLE_DEBLK() ;
  ------------------
  105|       |
  106|   358k|    pu1_y = ps_tfr_cxt->pu1_mb_y;
  107|   358k|    pu1_u = ps_tfr_cxt->pu1_mb_u;
  108|   358k|    pu1_v = ps_tfr_cxt->pu1_mb_v;
  109|       |
  110|       |    /* LUMA values */
  111|       |    /* Deblock rounding change */
  112|   358k|    qp_avg =
  113|   358k|                    (UWORD8)((ps_cur_mb->u1_left_mb_qp + ps_cur_mb->u1_mb_qp + 1)
  114|   358k|                                    >> 1);
  115|       |
  116|   358k|    idx_a_y = qp_avg + ofst_a;
  117|   358k|    alpha_y = gau1_ih264d_alpha_table[12 + idx_a_y];
  118|   358k|    idx_b_y = qp_avg + ofst_b;
  119|   358k|    beta_y = gau1_ih264d_beta_table[12 + idx_b_y];
  120|       |
  121|       |    /* Chroma cb values */
  122|   358k|    {
  123|   358k|        WORD32 mb_qp1, mb_qp2;
  124|   358k|        mb_qp1 = (ps_cur_mb->u1_left_mb_qp + i1_cb_qp_idx_ofst);
  125|   358k|        mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cb_qp_idx_ofst);
  126|   358k|        qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + mb_qp1]
  127|   358k|                        + gau1_ih264d_qp_scale_cr[12 + mb_qp2] + 1) >> 1);
  128|   358k|    }
  129|   358k|    idx_a_u = qp_avg + ofst_a;
  130|   358k|    alpha_u = gau1_ih264d_alpha_table[12 + idx_a_u];
  131|   358k|    idx_b_u = qp_avg + ofst_b;
  132|   358k|    beta_u = gau1_ih264d_beta_table[12 + idx_b_u];
  133|       |    /* Chroma cr values */
  134|   358k|    {
  135|   358k|        WORD32 mb_qp1, mb_qp2;
  136|   358k|        mb_qp1 = (ps_cur_mb->u1_left_mb_qp + i1_cr_qp_idx_ofst);
  137|   358k|        mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cr_qp_idx_ofst);
  138|   358k|        qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + mb_qp1]
  139|   358k|                        + gau1_ih264d_qp_scale_cr[12 + mb_qp2] + 1) >> 1);
  140|   358k|    }
  141|   358k|    idx_a_v = qp_avg + ofst_a;
  142|   358k|    alpha_v = gau1_ih264d_alpha_table[12 + idx_a_v];
  143|   358k|    idx_b_v = qp_avg + ofst_b;
  144|   358k|    beta_v = gau1_ih264d_beta_table[12 + idx_b_v];
  145|       |
  146|   358k|    if(u1_double_cl == 0)
  ------------------
  |  Branch (146:8): [True: 339k, False: 19.1k]
  ------------------
  147|   339k|    {
  148|   339k|        u4_bs_val = pu4_bs_tab[4];
  149|       |
  150|   339k|        if(0x04040404 == u4_bs_val)
  ------------------
  |  Branch (150:12): [True: 9.88k, False: 329k]
  ------------------
  151|  9.88k|        {
  152|  9.88k|            ps_dec->pf_deblk_luma_vert_bs4(pu1_y, i4_strd_y, alpha_y, beta_y);
  153|  9.88k|            ps_dec->pf_deblk_chroma_vert_bs4(pu1_u, i4_strd_uv, alpha_u,
  154|  9.88k|                                             beta_u, alpha_v, beta_v);
  155|  9.88k|        }
  156|   329k|        else
  157|   329k|        {
  158|   329k|            if(u4_bs_val)
  ------------------
  |  Branch (158:16): [True: 33.3k, False: 296k]
  ------------------
  159|  33.3k|            {
  160|       |
  161|  33.3k|                pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_y];
  162|  33.3k|                pu1_cliptab_u = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_u];
  163|  33.3k|                pu1_cliptab_v = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_v];
  164|  33.3k|                ps_dec->pf_deblk_luma_vert_bslt4(pu1_y, i4_strd_y, alpha_y,
  165|  33.3k|                                                 beta_y, u4_bs_val,
  166|  33.3k|                                                 pu1_cliptab_y);
  167|  33.3k|                ps_dec->pf_deblk_chroma_vert_bslt4(pu1_u, i4_strd_uv, alpha_u,
  168|  33.3k|                                                   beta_u, alpha_v, beta_v,
  169|  33.3k|                                                   u4_bs_val, pu1_cliptab_u,
  170|  33.3k|                                                   pu1_cliptab_v);
  171|       |
  172|  33.3k|            }
  173|   329k|        }
  174|       |
  175|   339k|    }
  176|  19.1k|    else
  177|  19.1k|    {
  178|       |
  179|  19.1k|        i4_strd_y <<= (!u1_cur_fld);
  180|  19.1k|        u4_bs_val = pu4_bs_tab[4];
  181|  19.1k|        i4_strd_uv <<= (!u1_cur_fld);
  182|       |
  183|  19.1k|        if(0x04040404 == u4_bs_val)
  ------------------
  |  Branch (183:12): [True: 0, False: 19.1k]
  ------------------
  184|      0|        {
  185|       |
  186|      0|            ps_dec->pf_deblk_luma_vert_bs4_mbaff(pu1_y, i4_strd_y, alpha_y,
  187|      0|                                                 beta_y);
  188|      0|            ps_dec->pf_deblk_chroma_vert_bs4_mbaff(pu1_u, i4_strd_uv, alpha_u,
  189|      0|                                                   beta_u, alpha_v, beta_v);
  190|       |
  191|      0|        }
  192|  19.1k|        else
  193|  19.1k|        {
  194|  19.1k|            if(u4_bs_val)
  ------------------
  |  Branch (194:16): [True: 0, False: 19.1k]
  ------------------
  195|      0|            {
  196|       |
  197|      0|                pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_y];
  198|      0|                pu1_cliptab_u = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_u];
  199|      0|                pu1_cliptab_v = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_v];
  200|       |
  201|      0|                ps_dec->pf_deblk_luma_vert_bslt4_mbaff(pu1_y, i4_strd_y,
  202|      0|                                                       alpha_y, beta_y,
  203|      0|                                                       u4_bs_val,
  204|      0|                                                       pu1_cliptab_y);
  205|      0|                ps_dec->pf_deblk_chroma_vert_bslt4_mbaff(pu1_u, i4_strd_uv,
  206|      0|                                                         alpha_u, beta_u,
  207|      0|                                                         alpha_v, beta_v,
  208|      0|                                                         u4_bs_val,
  209|      0|                                                         pu1_cliptab_u,
  210|      0|                                                         pu1_cliptab_v);
  211|      0|            }
  212|  19.1k|        }
  213|       |
  214|  19.1k|        {
  215|       |
  216|  19.1k|            UWORD16 u2_shift = (i4_strd_y >> 1) << (u1_cur_fld ? 4 : 0);
  ------------------
  |  Branch (216:53): [True: 0, False: 19.1k]
  ------------------
  217|  19.1k|            pu1_y += u2_shift;
  218|  19.1k|            u2_shift = (i4_strd_uv >> 1) << (u1_cur_fld ? 3 : 0);
  ------------------
  |  Branch (218:46): [True: 0, False: 19.1k]
  ------------------
  219|  19.1k|            pu1_u += u2_shift;
  220|  19.1k|            pu1_v += u2_shift;
  221|  19.1k|        }
  222|       |
  223|  19.1k|        qp_avg = (((ps_left_mb + 1)->u1_mb_qp + ps_cur_mb->u1_mb_qp + 1) >> 1);
  224|       |
  225|  19.1k|        idx_a_y = qp_avg + ofst_a;
  226|  19.1k|        alpha_y = gau1_ih264d_alpha_table[12 + idx_a_y];
  227|  19.1k|        idx_b_y = qp_avg + ofst_b;
  228|  19.1k|        beta_y = gau1_ih264d_beta_table[12 + idx_b_y];
  229|  19.1k|        u4_bs_val = pu4_bs_tab[9];
  230|       |
  231|  19.1k|        {
  232|  19.1k|            WORD32 mb_qp1, mb_qp2;
  233|  19.1k|            mb_qp1 = ((ps_left_mb + 1)->u1_mb_qp + i1_cb_qp_idx_ofst);
  234|  19.1k|            mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cb_qp_idx_ofst);
  235|  19.1k|            qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + mb_qp1]
  236|  19.1k|                            + gau1_ih264d_qp_scale_cr[12 + mb_qp2] + 1) >> 1);
  237|  19.1k|        }
  238|  19.1k|        idx_a_u = qp_avg + ofst_a;
  239|  19.1k|        alpha_u = gau1_ih264d_alpha_table[12 + idx_a_u];
  240|  19.1k|        idx_b_u = qp_avg + ofst_b;
  241|  19.1k|        beta_u = gau1_ih264d_beta_table[12 + idx_b_u];
  242|  19.1k|        u4_bs_val = pu4_bs_tab[9];
  243|  19.1k|        {
  244|  19.1k|            WORD32 mb_qp1, mb_qp2;
  245|  19.1k|            mb_qp1 = ((ps_left_mb + 1)->u1_mb_qp + i1_cr_qp_idx_ofst);
  246|  19.1k|            mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cr_qp_idx_ofst);
  247|  19.1k|            qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + mb_qp1]
  248|  19.1k|                            + gau1_ih264d_qp_scale_cr[12 + mb_qp2] + 1) >> 1);
  249|  19.1k|        }
  250|  19.1k|        idx_a_v = qp_avg + ofst_a;
  251|  19.1k|        alpha_v = gau1_ih264d_alpha_table[12 + idx_a_v];
  252|  19.1k|        idx_b_v = qp_avg + ofst_b;
  253|  19.1k|        beta_v = gau1_ih264d_beta_table[12 + idx_b_v];
  254|       |
  255|  19.1k|        if(0x04040404 == u4_bs_val)
  ------------------
  |  Branch (255:12): [True: 0, False: 19.1k]
  ------------------
  256|      0|        {
  257|      0|            ps_dec->pf_deblk_luma_vert_bs4_mbaff(pu1_y, i4_strd_y, alpha_y,
  258|      0|                                                 beta_y);
  259|      0|            ps_dec->pf_deblk_chroma_vert_bs4_mbaff(pu1_u, i4_strd_uv, alpha_u,
  260|      0|                                                   beta_u, alpha_v, beta_v);
  261|       |
  262|      0|        }
  263|  19.1k|        else
  264|  19.1k|        {
  265|  19.1k|            if(u4_bs_val)
  ------------------
  |  Branch (265:16): [True: 0, False: 19.1k]
  ------------------
  266|      0|            {
  267|       |
  268|      0|                pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_y];
  269|      0|                pu1_cliptab_u = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_u];
  270|      0|                pu1_cliptab_v = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_v];
  271|       |
  272|      0|                ps_dec->pf_deblk_luma_vert_bslt4_mbaff(pu1_y, i4_strd_y,
  273|      0|                                                       alpha_y, beta_y,
  274|      0|                                                       u4_bs_val,
  275|      0|                                                       pu1_cliptab_y);
  276|      0|                ps_dec->pf_deblk_chroma_vert_bslt4_mbaff(pu1_u, i4_strd_uv,
  277|      0|                                                         alpha_u, beta_u,
  278|      0|                                                         alpha_v, beta_v,
  279|      0|                                                         u4_bs_val,
  280|      0|                                                         pu1_cliptab_u,
  281|      0|                                                         pu1_cliptab_v);
  282|       |
  283|      0|            }
  284|  19.1k|        }
  285|  19.1k|    }
  286|       |
  287|   358k|}
ih264d_filter_boundary_top_nonmbaff:
  310|   392k|{
  311|   392k|    UWORD8 *pu1_y, *pu1_u;
  312|   392k|    WORD32 alpha_u = 0, beta_u = 0, alpha_v = 0, beta_v = 0;
  313|   392k|    WORD32 alpha_y = 0, beta_y = 0;
  314|   392k|    WORD32 qp_avg;
  315|   392k|    WORD32 idx_b_u, idx_a_u, idx_b_v, idx_a_v;
  316|   392k|    WORD32 idx_b_y, idx_a_y;
  317|   392k|    UWORD16 uc_tmp;
  318|       |
  319|   392k|    UWORD8 *pu1_cliptab_u, *pu1_cliptab_v, *pu1_cliptab_y;
  320|   392k|    WORD32 ofst_a = ps_cur_mb->i1_slice_alpha_c0_offset;
  321|   392k|    WORD32 ofst_b = ps_cur_mb->i1_slice_beta_offset;
  322|       |
  323|   392k|    UNUSED(ps_top_mb);
  ------------------
  |  |   45|   392k|#define UNUSED(x) ((void)(x))
  ------------------
  324|       |    /* LUMA values */
  325|       |    /* Deblock rounding change */
  326|   392k|    uc_tmp = ((ps_cur_mb->u1_topmb_qp + ps_cur_mb->u1_mb_qp + 1) >> 1);
  327|   392k|    qp_avg = (UWORD8)uc_tmp;
  328|   392k|    idx_a_y = qp_avg + ofst_a;
  329|   392k|    alpha_y = gau1_ih264d_alpha_table[12 + idx_a_y];
  330|   392k|    idx_b_y = qp_avg + ofst_b;
  331|   392k|    beta_y = gau1_ih264d_beta_table[12 + idx_b_y];
  332|   392k|    pu1_y = ps_tfr_cxt->pu1_mb_y;
  333|       |
  334|       |    /* CHROMA cb values */
  335|   392k|    {
  336|   392k|        WORD32 mb_qp1, mb_qp2;
  337|   392k|        mb_qp1 = (ps_cur_mb->u1_topmb_qp + i1_cb_qp_idx_ofst);
  338|   392k|        mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cb_qp_idx_ofst);
  339|   392k|        qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + mb_qp1]
  340|   392k|                        + gau1_ih264d_qp_scale_cr[12 + mb_qp2] + 1) >> 1);
  341|   392k|    }
  342|       |
  343|   392k|    idx_a_u = qp_avg + ofst_a;
  344|   392k|    alpha_u = gau1_ih264d_alpha_table[12 + idx_a_u];
  345|   392k|    idx_b_u = qp_avg + ofst_b;
  346|   392k|    beta_u = gau1_ih264d_beta_table[12 + idx_b_u];
  347|       |    /* CHROMA cr values */
  348|   392k|    {
  349|   392k|        WORD32 mb_qp1, mb_qp2;
  350|   392k|        mb_qp1 = (ps_cur_mb->u1_topmb_qp + i1_cr_qp_idx_ofst);
  351|   392k|        mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cr_qp_idx_ofst);
  352|   392k|        qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + mb_qp1]
  353|   392k|                        + gau1_ih264d_qp_scale_cr[12 + mb_qp2] + 1) >> 1);
  354|   392k|    }
  355|       |
  356|   392k|    idx_a_v = qp_avg + ofst_a;
  357|   392k|    alpha_v = gau1_ih264d_alpha_table[12 + idx_a_v];
  358|   392k|    idx_b_v = qp_avg + ofst_b;
  359|   392k|    beta_v = gau1_ih264d_beta_table[12 + idx_b_v];
  360|   392k|    pu1_u = ps_tfr_cxt->pu1_mb_u;
  361|       |
  362|   392k|    if(u4_bs == 0x04040404)
  ------------------
  |  Branch (362:8): [True: 11.1k, False: 381k]
  ------------------
  363|  11.1k|    {
  364|       |        /* Code specific to the assembly module */
  365|       |
  366|  11.1k|        ps_dec->pf_deblk_luma_horz_bs4(pu1_y, i4_strd_y, alpha_y, beta_y);
  367|  11.1k|        ps_dec->pf_deblk_chroma_horz_bs4(pu1_u, i4_strd_uv, alpha_u, beta_u,
  368|  11.1k|                                         alpha_v, beta_v);
  369|  11.1k|    }
  370|   381k|    else
  371|   381k|    {
  372|   381k|        if(u4_bs)
  ------------------
  |  Branch (372:12): [True: 42.4k, False: 338k]
  ------------------
  373|  42.4k|        {
  374|       |
  375|  42.4k|            pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_y];
  376|  42.4k|            pu1_cliptab_u =
  377|  42.4k|                            (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_u];
  378|  42.4k|            pu1_cliptab_v =
  379|  42.4k|                            (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_v];
  380|       |
  381|  42.4k|            ps_dec->pf_deblk_luma_horz_bslt4(pu1_y, i4_strd_y, alpha_y, beta_y,
  382|  42.4k|                                             u4_bs, pu1_cliptab_y);
  383|  42.4k|            ps_dec->pf_deblk_chroma_horz_bslt4(pu1_u, i4_strd_uv, alpha_u,
  384|  42.4k|                                               beta_u, alpha_v, beta_v,
  385|  42.4k|                                               u4_bs, pu1_cliptab_u,
  386|  42.4k|                                               pu1_cliptab_v);
  387|       |
  388|  42.4k|        }
  389|   381k|    }
  390|       |
  391|   392k|}
ih264d_deblock_mb_nonmbaff:
  399|   475k|{
  400|   475k|    UWORD8 *pu1_y, *pu1_u;
  401|   475k|    UWORD32 u4_bs;
  402|       |
  403|   475k|    WORD32 alpha, beta, alpha_u, beta_u, alpha_v, beta_v;
  404|       |
  405|   475k|    UWORD8 *pu1_cliptab_u;
  406|   475k|    UWORD8 *pu1_cliptab_v;
  407|   475k|    UWORD8 *pu1_cliptab_y;
  408|       |
  409|   475k|    UWORD32 * pu4_bs_tab;
  410|   475k|    WORD32 idx_a_y, idx_a_u, idx_a_v;
  411|   475k|    UWORD32 u4_deb_mode, u4_mbs_next;
  412|   475k|    UWORD32 u4_image_wd_mb;
  413|   475k|    deblk_mb_t *ps_top_mb,*ps_left_mb,*ps_cur_mb;
  414|       |
  415|   475k|    PROFILE_DISABLE_DEBLK()
  ------------------
  |  |   91|   475k|#define PROFILE_DISABLE_DEBLK() ;
  ------------------
  416|       |    /* Return from here to switch off deblocking */
  417|       |
  418|   475k|    u4_image_wd_mb = ps_dec->u2_frm_wd_in_mbs;
  419|       |
  420|   475k|    ps_cur_mb = ps_dec->ps_cur_deblk_mb;
  421|   475k|    pu4_bs_tab = ps_cur_mb->u4_bs_table;
  422|   475k|    u4_deb_mode = ps_cur_mb->u1_deblocking_mode;
  423|   475k|     if(!(u4_deb_mode & MB_DISABLE_FILTERING))
  ------------------
  |  |   70|   475k|#define MB_DISABLE_FILTERING          0x01
  ------------------
  |  Branch (423:9): [True: 412k, False: 62.8k]
  ------------------
  424|   412k|     {
  425|       |
  426|   412k|         if(ps_dec->u4_deblk_mb_x)
  ------------------
  |  Branch (426:13): [True: 358k, False: 53.2k]
  ------------------
  427|   358k|         {
  428|   358k|             ps_left_mb = ps_cur_mb - 1;
  429|       |
  430|   358k|         }
  431|  53.2k|         else
  432|  53.2k|         {
  433|  53.2k|             ps_left_mb = NULL;
  434|       |
  435|  53.2k|         }
  436|   412k|         if(ps_dec->u4_deblk_mb_y != 0)
  ------------------
  |  Branch (436:13): [True: 392k, False: 19.6k]
  ------------------
  437|   392k|         {
  438|   392k|             ps_top_mb = ps_cur_mb - (u4_image_wd_mb);
  439|   392k|         }
  440|  19.6k|         else
  441|  19.6k|         {
  442|  19.6k|             ps_top_mb = NULL;
  443|  19.6k|         }
  444|       |
  445|   412k|         if(u4_deb_mode & MB_DISABLE_LEFT_EDGE)
  ------------------
  |  |   72|   412k|#define MB_DISABLE_LEFT_EDGE          0x04
  ------------------
  |  Branch (445:13): [True: 2.78k, False: 409k]
  ------------------
  446|  2.78k|             ps_left_mb = NULL;
  447|   412k|         if(u4_deb_mode & MB_DISABLE_TOP_EDGE)
  ------------------
  |  |   71|   412k|#define MB_DISABLE_TOP_EDGE           0x02
  ------------------
  |  Branch (447:13): [True: 877, False: 411k]
  ------------------
  448|    877|             ps_top_mb = NULL;
  449|       |
  450|       |        /*---------------------------------------------------------------------*/
  451|       |        /* Filter wrt Left edge                                                */
  452|       |        /* except                                                              */
  453|       |        /*      - Left Egde is Picture Boundary                                */
  454|       |        /*      - Left Egde is part of Slice Boundary and Deblocking           */
  455|       |        /*        parameters of slice disable Filtering of Slice Boundary Edges*/
  456|       |        /*---------------------------------------------------------------------*/
  457|   412k|        if(ps_left_mb)
  ------------------
  |  Branch (457:12): [True: 358k, False: 53.3k]
  ------------------
  458|   358k|            ih264d_filter_boundary_left_nonmbaff(ps_dec, ps_tfr_cxt,
  459|   358k|                                                 i1_cb_qp_idx_ofst,
  460|   358k|                                                 i1_cr_qp_idx_ofst, ps_cur_mb,
  461|   358k|                                                 i4_strd_y, i4_strd_uv, ps_left_mb,
  462|   358k|                                                 pu4_bs_tab, 0);
  463|       |
  464|       |        /*--------------------------------------------------------------------*/
  465|       |        /* Filter wrt Other Vertical Edges                                    */
  466|       |        /*--------------------------------------------------------------------*/
  467|   412k|        {
  468|   412k|            WORD32 ofst_a, ofst_b, idx_b_y, idx_b_u,
  469|   412k|                            idx_b_v;
  470|   412k|            WORD32 qp_avg, qp_avg_u, qp_avg_v;
  471|   412k|            ofst_a = ps_cur_mb->i1_slice_alpha_c0_offset;
  472|   412k|            ofst_b = ps_cur_mb->i1_slice_beta_offset;
  473|       |
  474|   412k|            qp_avg = ps_cur_mb->u1_mb_qp;
  475|       |
  476|   412k|            idx_a_y = qp_avg + ofst_a;
  477|   412k|            alpha = gau1_ih264d_alpha_table[12 + idx_a_y];
  478|   412k|            idx_b_y = qp_avg + ofst_b;
  479|   412k|            beta = gau1_ih264d_beta_table[12 + idx_b_y];
  480|       |
  481|       |            /* CHROMA values */
  482|       |            /* CHROMA Cb values */
  483|   412k|            qp_avg_u = (qp_avg + i1_cb_qp_idx_ofst);
  484|   412k|            qp_avg_u = gau1_ih264d_qp_scale_cr[12 + qp_avg_u];
  485|   412k|            idx_a_u = qp_avg_u + ofst_a;
  486|   412k|            alpha_u = gau1_ih264d_alpha_table[12 + idx_a_u];
  487|   412k|            idx_b_u = qp_avg_u + ofst_b;
  488|   412k|            beta_u = gau1_ih264d_beta_table[12 + idx_b_u];
  489|       |            /* CHROMA Cr values */
  490|   412k|            qp_avg_v = (qp_avg + i1_cr_qp_idx_ofst);
  491|   412k|            qp_avg_v = gau1_ih264d_qp_scale_cr[12 + qp_avg_v];
  492|   412k|            idx_a_v = qp_avg_v + ofst_a;
  493|   412k|            alpha_v = gau1_ih264d_alpha_table[12 + idx_a_v];
  494|   412k|            idx_b_v = qp_avg_v + ofst_b;
  495|   412k|            beta_v = gau1_ih264d_beta_table[12 + idx_b_v];
  496|   412k|        }
  497|       |
  498|   412k|        pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_y]; //this for Luma
  499|   412k|        pu1_cliptab_u = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_u]; //this for chroma
  500|   412k|        pu1_cliptab_v = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_v]; //this for chroma
  501|       |
  502|       |        //edge=1
  503|       |
  504|       |
  505|   412k|        u4_bs = pu4_bs_tab[5];
  506|   412k|        pu1_y = ps_tfr_cxt->pu1_mb_y;
  507|   412k|        pu1_u = ps_tfr_cxt->pu1_mb_u;
  508|       |
  509|   412k|        if(u4_bs)
  ------------------
  |  Branch (509:12): [True: 19.5k, False: 392k]
  ------------------
  510|  19.5k|        {
  511|       |
  512|  19.5k|            ps_dec->pf_deblk_luma_vert_bslt4(pu1_y + 4, i4_strd_y, alpha, beta,
  513|  19.5k|                                             u4_bs, pu1_cliptab_y);
  514|       |
  515|  19.5k|        }
  516|       |        //edge=2
  517|       |
  518|   412k|        u4_bs = pu4_bs_tab[6];
  519|   412k|        if(u4_bs)
  ------------------
  |  Branch (519:12): [True: 49.3k, False: 362k]
  ------------------
  520|  49.3k|        {
  521|  49.3k|            ps_dec->pf_deblk_luma_vert_bslt4(pu1_y + 8, i4_strd_y, alpha, beta,
  522|  49.3k|                                             u4_bs, pu1_cliptab_y);
  523|  49.3k|            ps_dec->pf_deblk_chroma_vert_bslt4(pu1_u + 4 * YUV420SP_FACTOR,
  ------------------
  |  |  119|  49.3k|#define YUV420SP_FACTOR 2
  ------------------
  524|  49.3k|                                               i4_strd_uv, alpha_u, beta_u,
  525|  49.3k|                                               alpha_v, beta_v, u4_bs,
  526|  49.3k|                                               pu1_cliptab_u, pu1_cliptab_v);
  527|       |
  528|  49.3k|        }
  529|       |        //edge=3
  530|       |
  531|   412k|        u4_bs = pu4_bs_tab[7];
  532|   412k|        if(u4_bs)
  ------------------
  |  Branch (532:12): [True: 18.4k, False: 393k]
  ------------------
  533|  18.4k|        {
  534|  18.4k|            ps_dec->pf_deblk_luma_vert_bslt4(pu1_y + 12, i4_strd_y, alpha, beta,
  535|  18.4k|                                             u4_bs, pu1_cliptab_y);
  536|       |
  537|  18.4k|        }
  538|       |
  539|       |        /*--------------------------------------------------------------------*/
  540|       |        /* Filter wrt Top edge                                                */
  541|       |        /* except                                                             */
  542|       |        /*      - Top Egde is Picture Boundary                                */
  543|       |        /*      - Top Egde is part of Slice Boundary and Deblocking           */
  544|       |        /*        parameters of slice disable Filtering of Slice Boundary Edges*/
  545|       |        /*--------------------------------------------------------------------*/
  546|   412k|        if(ps_top_mb)
  ------------------
  |  Branch (546:12): [True: 392k, False: 19.9k]
  ------------------
  547|   392k|        {
  548|       |            /** if top MB and MB AFF and cur MB is frame and top is field then  */
  549|       |            /*  one extra top edge needs to be deblocked                        */
  550|       |
  551|   392k|            ih264d_filter_boundary_top_nonmbaff(ps_dec, ps_tfr_cxt,
  552|   392k|                                                i1_cb_qp_idx_ofst,
  553|   392k|                                                i1_cr_qp_idx_ofst, ps_cur_mb,
  554|   392k|                                                i4_strd_y, i4_strd_uv, ps_top_mb,
  555|   392k|                                                pu4_bs_tab[0]);
  556|       |
  557|   392k|        }
  558|       |
  559|       |        /*--------------------------------------------------------------------*/
  560|       |        /* Filter wrt Other Horizontal Edges                                  */
  561|       |        /*--------------------------------------------------------------------*/
  562|       |
  563|       |        //edge1
  564|   412k|        u4_bs = pu4_bs_tab[1];
  565|       |
  566|   412k|        if(u4_bs)
  ------------------
  |  Branch (566:12): [True: 18.5k, False: 393k]
  ------------------
  567|  18.5k|        {
  568|  18.5k|            ps_dec->pf_deblk_luma_horz_bslt4(pu1_y + (i4_strd_y << 2), i4_strd_y,
  569|  18.5k|                                             alpha, beta, u4_bs, pu1_cliptab_y);
  570|       |
  571|  18.5k|        }
  572|       |        //edge2
  573|   412k|        u4_bs = pu4_bs_tab[2];
  574|       |
  575|   412k|        if(u4_bs)
  ------------------
  |  Branch (575:12): [True: 48.3k, False: 363k]
  ------------------
  576|  48.3k|        {
  577|       |
  578|  48.3k|            ps_dec->pf_deblk_luma_horz_bslt4(pu1_y + (i4_strd_y << 3), i4_strd_y,
  579|  48.3k|                                             alpha, beta, u4_bs, pu1_cliptab_y);
  580|  48.3k|            ps_dec->pf_deblk_chroma_horz_bslt4(pu1_u + (i4_strd_uv << 2),
  581|  48.3k|                                               i4_strd_uv, alpha_u, beta_u,
  582|  48.3k|                                               alpha_v, beta_v, u4_bs,
  583|  48.3k|                                               pu1_cliptab_u, pu1_cliptab_v);
  584|       |
  585|  48.3k|        }
  586|       |        //edge3
  587|   412k|        u4_bs = pu4_bs_tab[3];
  588|   412k|        if(u4_bs)
  ------------------
  |  Branch (588:12): [True: 18.6k, False: 393k]
  ------------------
  589|  18.6k|        {
  590|  18.6k|            ps_dec->pf_deblk_luma_horz_bslt4(
  591|  18.6k|                            (pu1_y + (i4_strd_y << 3) + (i4_strd_y << 2)),
  592|  18.6k|                            i4_strd_y, alpha, beta, u4_bs, pu1_cliptab_y);
  593|       |
  594|  18.6k|        }
  595|   412k|     }
  596|       |
  597|   475k|     ps_dec->u4_deblk_mb_x++;
  598|   475k|     ps_dec->ps_cur_deblk_mb++;
  599|   475k|     ps_dec->u4_cur_deblk_mb_num++;
  600|   475k|     u4_mbs_next = u4_image_wd_mb - ps_dec->u4_deblk_mb_x;
  601|       |
  602|   475k|     ps_tfr_cxt->pu1_mb_y += 16;
  603|   475k|     ps_tfr_cxt->pu1_mb_u += 8 * YUV420SP_FACTOR;
  ------------------
  |  |  119|   475k|#define YUV420SP_FACTOR 2
  ------------------
  604|   475k|     ps_tfr_cxt->pu1_mb_v += 8;
  605|       |
  606|   475k|     if(!u4_mbs_next)
  ------------------
  |  Branch (606:9): [True: 79.5k, False: 395k]
  ------------------
  607|  79.5k|     {
  608|  79.5k|         ps_tfr_cxt->pu1_mb_y += ps_tfr_cxt->u4_y_inc;
  609|  79.5k|         ps_tfr_cxt->pu1_mb_u += ps_tfr_cxt->u4_uv_inc;
  610|  79.5k|         ps_tfr_cxt->pu1_mb_v += ps_tfr_cxt->u4_uv_inc;
  611|  79.5k|         ps_dec->u4_deblk_mb_y++;
  612|  79.5k|         ps_dec->u4_deblk_mb_x = 0;
  613|  79.5k|     }
  614|       |
  615|   475k|}
ih264d_init_deblk_tfr_ctxt:
  634|  7.77k|{
  635|       |
  636|  7.77k|    UWORD32 i4_wd_y;
  637|  7.77k|    UWORD32 i4_wd_uv;
  638|  7.77k|    UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag; /*< Field u4_flag  */
  639|  7.77k|    UNUSED(u2_image_wd_mb);
  ------------------
  |  |   45|  7.77k|#define UNUSED(x) ((void)(x))
  ------------------
  640|  7.77k|    ps_tfr_cxt->pu1_src_y = ps_dec->s_cur_pic.pu1_buf1 - 4;
  641|  7.77k|    ps_tfr_cxt->pu1_src_u = ps_dec->s_cur_pic.pu1_buf2 - 4;
  642|  7.77k|    ps_tfr_cxt->pu1_src_v = ps_dec->s_cur_pic.pu1_buf3 - 4;
  643|  7.77k|    ps_tfr_cxt->pu1_dest_y = ps_tfr_cxt->pu1_src_y;
  644|  7.77k|    ps_tfr_cxt->pu1_dest_u = ps_tfr_cxt->pu1_src_u;
  645|  7.77k|    ps_tfr_cxt->pu1_dest_v = ps_tfr_cxt->pu1_src_v;
  646|       |
  647|  7.77k|    ps_tfr_cxt->pu1_mb_y = ps_tfr_cxt->pu1_src_y + 4;
  648|  7.77k|    ps_tfr_cxt->pu1_mb_u = ps_tfr_cxt->pu1_src_u + 4;
  649|  7.77k|    ps_tfr_cxt->pu1_mb_v = ps_tfr_cxt->pu1_src_v + 4;
  650|       |
  651|  7.77k|    i4_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag;
  652|  7.77k|    i4_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag;
  653|  7.77k|    ps_tfr_cxt->u4_y_inc = ((i4_wd_y << u1_mbaff) * 16
  654|  7.77k|                    - (ps_dec->u2_frm_wd_in_mbs << 4));
  655|       |
  656|  7.77k|    ps_tfr_cxt->u4_uv_inc = (i4_wd_uv << u1_mbaff) * 8
  657|  7.77k|                    - (ps_dec->u2_frm_wd_in_mbs << 4);
  658|       |
  659|       |    /* padding related initialisations */
  660|  7.77k|    if(ps_dec->ps_cur_slice->u1_nal_ref_idc)
  ------------------
  |  Branch (660:8): [True: 6.68k, False: 1.08k]
  ------------------
  661|  6.68k|    {
  662|  6.68k|        ps_pad_mgr->u1_vert_pad_top = !(ps_dec->ps_cur_slice->u1_field_pic_flag
  ------------------
  |  Branch (662:41): [True: 0, False: 6.68k]
  ------------------
  663|      0|                        && ps_dec->ps_cur_slice->u1_bottom_field_flag);
  ------------------
  |  Branch (663:28): [True: 0, False: 0]
  ------------------
  664|  6.68k|        ps_pad_mgr->u1_vert_pad_bot =
  665|  6.68k|                        ((!ps_dec->ps_cur_slice->u1_field_pic_flag)
  ------------------
  |  Branch (665:26): [True: 6.68k, False: 0]
  ------------------
  666|      0|                                        || ps_dec->ps_cur_slice->u1_bottom_field_flag);
  ------------------
  |  Branch (666:44): [True: 0, False: 0]
  ------------------
  667|  6.68k|        ps_pad_mgr->u1_horz_pad = 1;
  668|  6.68k|    }
  669|  1.08k|    else
  670|  1.08k|    {
  671|  1.08k|        ps_pad_mgr->u1_horz_pad = 0;
  672|  1.08k|        ps_pad_mgr->u1_vert_pad_top = 0;
  673|  1.08k|        ps_pad_mgr->u1_vert_pad_bot = 0;
  674|  1.08k|    }
  675|  7.77k|}
ih264d_deblock_picture_progressive:
 1103|  3.42k|{
 1104|  3.42k|    deblk_mb_t *ps_cur_mb;
 1105|       |
 1106|  3.42k|    UWORD8 u1_vert_pad_top = 1;
 1107|  3.42k|    UWORD8 u1_mbs_next;
 1108|  3.42k|    UWORD8 u1_deb_mode;
 1109|  3.42k|    WORD32 i4_wd_y, i4_wd_uv;
 1110|       |
 1111|       |
 1112|       |    /**************************************************/
 1113|       |    /* one time loads from ps_dec which will be used  */
 1114|       |    /* frequently throughout the deblocking procedure */
 1115|       |    /**************************************************/
 1116|  3.42k|    pad_mgr_t * ps_pad_mgr = &ps_dec->s_pad_mgr;
 1117|       |
 1118|  3.42k|    tfr_ctxt_t s_tfr_ctxt;
 1119|  3.42k|    tfr_ctxt_t * ps_tfr_cxt = &s_tfr_ctxt; // = &ps_dec->s_tran_addrecon;
 1120|  3.42k|    UWORD16 u2_image_wd_mb = ps_dec->u2_frm_wd_in_mbs;
 1121|  3.42k|    UWORD16 u2_image_ht_mb = ps_dec->u2_frm_ht_in_mbs;
 1122|  3.42k|    UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
 1123|       |
 1124|  3.42k|    WORD8 i1_cb_qp_idx_ofst = ps_dec->ps_cur_pps->i1_chroma_qp_index_offset;
 1125|  3.42k|    WORD8 i1_cr_qp_idx_ofst =
 1126|  3.42k|                    ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset;
 1127|       |
 1128|       |    /* Set up Parameter for  deblocking */
 1129|  3.42k|    ih264d_init_deblk_tfr_ctxt(ps_dec, ps_pad_mgr, ps_tfr_cxt, u2_image_wd_mb,
 1130|  3.42k|                               0);
 1131|       |
 1132|       |    /* Pic level Initialisations */
 1133|       |
 1134|  3.42k|    i4_wd_y = ps_dec->u2_frm_wd_y;
 1135|  3.42k|    i4_wd_uv = ps_dec->u2_frm_wd_uv;
 1136|       |    /* Initial filling of the buffers with deblocking data */
 1137|  3.42k|    ps_cur_mb = ps_dec->ps_deblk_pic;
 1138|       |
 1139|  3.42k|    if(ps_dec->u4_app_disable_deblk_frm == 0)
  ------------------
  |  Branch (1139:8): [True: 3.42k, False: 0]
  ------------------
 1140|  3.42k|    {
 1141|  3.42k|        if(ps_dec->ps_cur_sps->u1_mb_aff_flag == 1)
  ------------------
  |  Branch (1141:12): [True: 0, False: 3.42k]
  ------------------
 1142|      0|        {
 1143|      0|            while( ps_dec->u4_deblk_mb_y < u2_image_ht_mb)
  ------------------
  |  Branch (1143:20): [True: 0, False: 0]
  ------------------
 1144|      0|            {
 1145|      0|                ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt,
 1146|      0|                                           i1_cb_qp_idx_ofst,
 1147|      0|                                           i1_cr_qp_idx_ofst,
 1148|      0|                                           i4_wd_y, i4_wd_uv);
 1149|      0|                ps_cur_mb++;
 1150|      0|            }
 1151|      0|        }
 1152|       |
 1153|  3.42k|    }
 1154|       |
 1155|       |    //Padd the Picture
 1156|       |    //Horizontal Padd
 1157|  3.42k|    if(ps_pad_mgr->u1_horz_pad)
  ------------------
  |  Branch (1157:8): [True: 2.89k, False: 530]
  ------------------
 1158|  2.89k|    {
 1159|  2.89k|        UWORD32 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag;
 1160|  2.89k|        ps_dec->pf_pad_left_luma(ps_tfr_cxt->pu1_src_y + 4,
 1161|  2.89k|                                 ps_dec->u2_frm_wd_y << u1_field_pic_flag,
 1162|  2.89k|                                 ps_dec->u2_pic_ht >> u1_field_pic_flag,
 1163|  2.89k|                                 PAD_LEN_Y_H);
  ------------------
  |  |  571|  2.89k|#define PAD_LEN_Y_H                   32
  ------------------
 1164|  2.89k|        ps_dec->pf_pad_right_luma(
 1165|  2.89k|                        ps_tfr_cxt->pu1_src_y + 4
 1166|  2.89k|                                        + (ps_dec->u2_frm_wd_in_mbs << 4),
 1167|  2.89k|                        ps_dec->u2_frm_wd_y << u1_field_pic_flag,
 1168|  2.89k|                        ps_dec->u2_pic_ht >> u1_field_pic_flag, PAD_LEN_Y_H);
  ------------------
  |  |  571|  2.89k|#define PAD_LEN_Y_H                   32
  ------------------
 1169|       |
 1170|  2.89k|        ps_dec->pf_pad_left_chroma(ps_tfr_cxt->pu1_src_u + 4,
 1171|  2.89k|                                   ps_dec->u2_frm_wd_uv << u1_field_pic_flag,
 1172|  2.89k|                                   (ps_dec->u2_pic_ht / 2) >> u1_field_pic_flag,
 1173|  2.89k|                                   PAD_LEN_UV_H * YUV420SP_FACTOR);
  ------------------
  |  |  573|  2.89k|#define PAD_LEN_UV_H                  16
  ------------------
                                                 PAD_LEN_UV_H * YUV420SP_FACTOR);
  ------------------
  |  |  119|  2.89k|#define YUV420SP_FACTOR 2
  ------------------
 1174|  2.89k|        ps_dec->pf_pad_right_chroma(
 1175|  2.89k|                        ps_tfr_cxt->pu1_src_u + 4
 1176|  2.89k|                                        + (ps_dec->u2_frm_wd_in_mbs << 4),
 1177|  2.89k|                        ps_dec->u2_frm_wd_uv << u1_field_pic_flag,
 1178|  2.89k|                        (ps_dec->u2_pic_ht / 2) >> u1_field_pic_flag,
 1179|  2.89k|                        PAD_LEN_UV_H * YUV420SP_FACTOR);
  ------------------
  |  |  573|  2.89k|#define PAD_LEN_UV_H                  16
  ------------------
                                      PAD_LEN_UV_H * YUV420SP_FACTOR);
  ------------------
  |  |  119|  2.89k|#define YUV420SP_FACTOR 2
  ------------------
 1180|       |
 1181|  2.89k|    }
 1182|       |
 1183|       |//Vertical Padd Top
 1184|  3.42k|    if(ps_pad_mgr->u1_vert_pad_top)
  ------------------
  |  Branch (1184:8): [True: 2.89k, False: 530]
  ------------------
 1185|  2.89k|    {
 1186|  2.89k|        ps_dec->pf_pad_top(ps_dec->ps_cur_pic->pu1_buf1 - PAD_LEN_Y_H,
  ------------------
  |  |  571|  2.89k|#define PAD_LEN_Y_H                   32
  ------------------
 1187|  2.89k|                           ps_dec->u2_frm_wd_y, ps_dec->u2_frm_wd_y,
 1188|  2.89k|                           ps_pad_mgr->u1_pad_len_y_v);
 1189|  2.89k|        ps_dec->pf_pad_top(
 1190|  2.89k|                        ps_dec->ps_cur_pic->pu1_buf2
 1191|  2.89k|                                        - PAD_LEN_UV_H * YUV420SP_FACTOR,
  ------------------
  |  |  573|  2.89k|#define PAD_LEN_UV_H                  16
  ------------------
                                                      - PAD_LEN_UV_H * YUV420SP_FACTOR,
  ------------------
  |  |  119|  2.89k|#define YUV420SP_FACTOR 2
  ------------------
 1192|  2.89k|                        ps_dec->u2_frm_wd_uv, ps_dec->u2_frm_wd_uv,
 1193|  2.89k|                        ps_pad_mgr->u1_pad_len_cr_v);
 1194|       |
 1195|  2.89k|    }
 1196|       |
 1197|       |//Vertical Padd Bottom
 1198|  3.42k|    if(ps_pad_mgr->u1_vert_pad_bot)
  ------------------
  |  Branch (1198:8): [True: 2.89k, False: 530]
  ------------------
 1199|  2.89k|    {
 1200|       |
 1201|  2.89k|        UWORD8 *pu1_buf;
 1202|  2.89k|        pu1_buf = ps_dec->ps_cur_pic->pu1_buf1 - PAD_LEN_Y_H;
  ------------------
  |  |  571|  2.89k|#define PAD_LEN_Y_H                   32
  ------------------
 1203|  2.89k|        pu1_buf += ps_dec->u2_pic_ht * ps_dec->u2_frm_wd_y;
 1204|  2.89k|        ps_dec->pf_pad_bottom(pu1_buf, ps_dec->u2_frm_wd_y, ps_dec->u2_frm_wd_y,
 1205|  2.89k|                              ps_pad_mgr->u1_pad_len_y_v);
 1206|  2.89k|        pu1_buf = ps_dec->ps_cur_pic->pu1_buf2 - PAD_LEN_UV_H * YUV420SP_FACTOR;
  ------------------
  |  |  573|  2.89k|#define PAD_LEN_UV_H                  16
  ------------------
                      pu1_buf = ps_dec->ps_cur_pic->pu1_buf2 - PAD_LEN_UV_H * YUV420SP_FACTOR;
  ------------------
  |  |  119|  2.89k|#define YUV420SP_FACTOR 2
  ------------------
 1207|  2.89k|        pu1_buf += (ps_dec->u2_pic_ht >> 1) * ps_dec->u2_frm_wd_uv;
 1208|       |
 1209|  2.89k|        ps_dec->pf_pad_bottom(pu1_buf, ps_dec->u2_frm_wd_uv,
 1210|  2.89k|                              ps_dec->u2_frm_wd_uv,
 1211|  2.89k|                              ps_pad_mgr->u1_pad_len_cr_v);
 1212|       |
 1213|  2.89k|    }
 1214|  3.42k|}
ih264d_set_deblocking_parameters:
 1237|   630k|{
 1238|       |    /*------------------------------------------------------------------*/
 1239|       |    /* Set the deblocking parameters                                  */
 1240|       |    /*------------------------------------------------------------------*/
 1241|   630k|    ps_cur_mb->i1_slice_alpha_c0_offset = ps_slice->i1_slice_alpha_c0_offset;
 1242|   630k|    ps_cur_mb->i1_slice_beta_offset = ps_slice->i1_slice_beta_offset;
 1243|   630k|    ps_cur_mb->u1_mb_type = (u1_mb_field_decoding_flag << 7);
 1244|       |
 1245|   630k|    switch(ps_slice->u1_disable_dblk_filter_idc)
  ------------------
  |  Branch (1245:12): [True: 630k, False: 0]
  ------------------
 1246|   630k|    {
 1247|   600k|        case DBLK_ENABLED:
  ------------------
  |  |  549|   600k|#define DBLK_ENABLED                  0
  ------------------
  |  Branch (1247:9): [True: 600k, False: 29.5k]
  ------------------
 1248|   600k|            ps_cur_mb->u1_deblocking_mode = MB_ENABLE_FILTERING;
  ------------------
  |  |   69|   600k|#define MB_ENABLE_FILTERING           0x00
  ------------------
 1249|   600k|            break;
 1250|  16.4k|        case DBLK_DISABLED:
  ------------------
  |  |  548|  16.4k|#define DBLK_DISABLED                 1
  ------------------
  |  Branch (1250:9): [True: 16.4k, False: 613k]
  ------------------
 1251|  16.4k|            ps_cur_mb->u1_deblocking_mode = MB_DISABLE_FILTERING;
  ------------------
  |  |   70|  16.4k|#define MB_DISABLE_FILTERING          0x01
  ------------------
 1252|  16.4k|            break;
 1253|  13.1k|        case SLICE_BOUNDARY_DBLK_DISABLED:
  ------------------
  |  |  547|  13.1k|#define SLICE_BOUNDARY_DBLK_DISABLED  2
  ------------------
  |  Branch (1253:9): [True: 13.1k, False: 617k]
  ------------------
 1254|  13.1k|        {
 1255|  13.1k|            ps_cur_mb->u1_deblocking_mode = MB_ENABLE_FILTERING;
  ------------------
  |  |   69|  13.1k|#define MB_ENABLE_FILTERING           0x00
  ------------------
 1256|  13.1k|            if(!(u1_mb_ngbr_availablity & LEFT_MB_AVAILABLE_MASK))
  ------------------
  |  |   53|  13.1k|#define LEFT_MB_AVAILABLE_MASK      0x01
  ------------------
  |  Branch (1256:16): [True: 3.73k, False: 9.39k]
  ------------------
 1257|  3.73k|                ps_cur_mb->u1_deblocking_mode |= MB_DISABLE_LEFT_EDGE;
  ------------------
  |  |   72|  3.73k|#define MB_DISABLE_LEFT_EDGE          0x04
  ------------------
 1258|  13.1k|            if(!(u1_mb_ngbr_availablity & TOP_MB_AVAILABLE_MASK))
  ------------------
  |  |   55|  13.1k|#define TOP_MB_AVAILABLE_MASK       0x04
  ------------------
  |  Branch (1258:16): [True: 1.06k, False: 12.0k]
  ------------------
 1259|  1.06k|                ps_cur_mb->u1_deblocking_mode |= MB_DISABLE_TOP_EDGE;
  ------------------
  |  |   71|  1.06k|#define MB_DISABLE_TOP_EDGE           0x02
  ------------------
 1260|  13.1k|            break;
 1261|      0|        }
 1262|   630k|    }
 1263|       |
 1264|   630k|    return (0);
 1265|   630k|}
ih264d_copy_intra_pred_line:
 1270|   489k|{
 1271|   489k|    UWORD8 *pu1_mb_last_row, u1_mb_field_decoding_flag;
 1272|   489k|    UWORD32 u4_recWidth, u4_recwidth_cr;
 1273|       |
 1274|   489k|    u1_mb_field_decoding_flag = ps_cur_mb_info->u1_mb_field_decodingflag;
 1275|       |
 1276|   489k|    u4_recWidth = ps_dec->u2_frm_wd_y << u1_mb_field_decoding_flag;
 1277|   489k|    u4_recwidth_cr = ps_dec->u2_frm_wd_uv << u1_mb_field_decoding_flag;
 1278|       |
 1279|   489k|    pu1_mb_last_row = ps_dec->ps_frame_buf_ip_recon->pu1_dest_y
 1280|   489k|                    + (u4_recWidth * (MB_SIZE - 1));
  ------------------
  |  |  554|   489k|#define MB_SIZE             16
  ------------------
 1281|   489k|    pu1_mb_last_row += MB_SIZE * nmb_index;
  ------------------
  |  |  554|   489k|#define MB_SIZE             16
  ------------------
 1282|   489k|    MEMCPY_16BYTES(ps_dec->pu1_cur_y_intra_pred_line, pu1_mb_last_row);
  ------------------
  |  |  657|   489k|#define MEMCPY_16BYTES(dst,src)                                 \
  |  |  658|   489k|{                                                               \
  |  |  659|   489k|    memcpy(dst,src,16);                                         \
  |  |  660|   489k|}
  ------------------
 1283|       |
 1284|   489k|    pu1_mb_last_row = ps_dec->ps_frame_buf_ip_recon->pu1_dest_u
 1285|   489k|                    + (u4_recwidth_cr * (BLK8x8SIZE - 1));
  ------------------
  |  |  555|   489k|#define BLK8x8SIZE          8
  ------------------
 1286|   489k|    pu1_mb_last_row += BLK8x8SIZE * nmb_index * YUV420SP_FACTOR;
  ------------------
  |  |  555|   489k|#define BLK8x8SIZE          8
  ------------------
                  pu1_mb_last_row += BLK8x8SIZE * nmb_index * YUV420SP_FACTOR;
  ------------------
  |  |  119|   489k|#define YUV420SP_FACTOR 2
  ------------------
 1287|       |
 1288|   489k|    MEMCPY_16BYTES(ps_dec->pu1_cur_u_intra_pred_line, pu1_mb_last_row);
  ------------------
  |  |  657|   489k|#define MEMCPY_16BYTES(dst,src)                                 \
  |  |  658|   489k|{                                                               \
  |  |  659|   489k|    memcpy(dst,src,16);                                         \
  |  |  660|   489k|}
  ------------------
 1289|       |
 1290|   489k|    ps_dec->pu1_cur_y_intra_pred_line = ps_dec->pu1_cur_y_intra_pred_line_base
 1291|   489k|                    + (MB_SIZE * (ps_cur_mb_info->u2_mbx + 1));
  ------------------
  |  |  554|   489k|#define MB_SIZE             16
  ------------------
 1292|   489k|    ps_dec->pu1_cur_u_intra_pred_line = ps_dec->pu1_cur_u_intra_pred_line_base
 1293|   489k|                    + (BLK8x8SIZE * (ps_cur_mb_info->u2_mbx + 1))
  ------------------
  |  |  555|   489k|#define BLK8x8SIZE          8
  ------------------
 1294|   489k|                                    * YUV420SP_FACTOR;
  ------------------
  |  |  119|   489k|#define YUV420SP_FACTOR 2
  ------------------
 1295|   489k|    ps_dec->pu1_cur_v_intra_pred_line = ps_dec->pu1_cur_v_intra_pred_line_base
 1296|   489k|                    + (BLK8x8SIZE * (ps_cur_mb_info->u2_mbx + 1));
  ------------------
  |  |  555|   489k|#define BLK8x8SIZE          8
  ------------------
 1297|       |
 1298|   489k|    if(ps_cur_mb_info->u2_mbx == (ps_dec->u2_frm_wd_in_mbs - 1))
  ------------------
  |  Branch (1298:8): [True: 81.7k, False: 408k]
  ------------------
 1299|  81.7k|    {
 1300|  81.7k|        UWORD8* pu1_temp;
 1301|       |
 1302|  81.7k|        ps_dec->pu1_cur_y_intra_pred_line =
 1303|  81.7k|                        ps_dec->pu1_cur_y_intra_pred_line_base;
 1304|  81.7k|        ps_dec->pu1_cur_u_intra_pred_line =
 1305|  81.7k|                        ps_dec->pu1_cur_u_intra_pred_line_base;
 1306|  81.7k|        ps_dec->pu1_cur_v_intra_pred_line =
 1307|  81.7k|                        ps_dec->pu1_cur_v_intra_pred_line_base;
 1308|       |
 1309|       |        /*swap current and previous rows*/
 1310|  81.7k|        pu1_temp = ps_dec->pu1_cur_y_intra_pred_line;
 1311|  81.7k|        ps_dec->pu1_cur_y_intra_pred_line = ps_dec->pu1_prev_y_intra_pred_line;
 1312|  81.7k|        ps_dec->pu1_prev_y_intra_pred_line = pu1_temp;
 1313|       |
 1314|  81.7k|        pu1_temp = ps_dec->pu1_cur_u_intra_pred_line;
 1315|  81.7k|        ps_dec->pu1_cur_u_intra_pred_line = ps_dec->pu1_prev_u_intra_pred_line;
 1316|  81.7k|        ps_dec->pu1_prev_u_intra_pred_line = pu1_temp;
 1317|       |
 1318|  81.7k|        pu1_temp = ps_dec->pu1_cur_v_intra_pred_line;
 1319|  81.7k|        ps_dec->pu1_cur_v_intra_pred_line = ps_dec->pu1_prev_v_intra_pred_line;
 1320|  81.7k|        ps_dec->pu1_prev_v_intra_pred_line = pu1_temp;
 1321|       |
 1322|  81.7k|        ps_dec->pu1_cur_y_intra_pred_line_base =
 1323|  81.7k|                        ps_dec->pu1_cur_y_intra_pred_line;
 1324|  81.7k|        ps_dec->pu1_cur_u_intra_pred_line_base =
 1325|  81.7k|                        ps_dec->pu1_cur_u_intra_pred_line;
 1326|  81.7k|        ps_dec->pu1_cur_v_intra_pred_line_base =
 1327|  81.7k|                        ps_dec->pu1_cur_v_intra_pred_line;
 1328|       |
 1329|       |
 1330|       |
 1331|       |
 1332|       |
 1333|  81.7k|    }
 1334|       |
 1335|   489k|}

ih264d_init_ref_bufs:
   81|  2.04k|{
   82|  2.04k|    UWORD32 i;
   83|  2.04k|    struct dpb_info_t *ps_dpb_info = ps_dpb_mgr->as_dpb_info;
   84|  67.5k|    for(i = 0; i < MAX_REF_BUFS; i++)
  ------------------
  |  |   75|  67.5k|#define MAX_REF_BUFS    32
  ------------------
  |  Branch (84:16): [True: 65.5k, False: 2.04k]
  ------------------
   85|  65.5k|    {
   86|  65.5k|        ps_dpb_info[i].u1_used_as_ref = UNUSED_FOR_REF;
  ------------------
  |  |  595|  65.5k|#define UNUSED_FOR_REF 0
  ------------------
   87|  65.5k|        ps_dpb_info[i].u1_lt_idx = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|  65.5k|#define MAX_REF_BUFS    32
  ------------------
   88|  65.5k|        ps_dpb_info[i].ps_prev_short = NULL;
   89|  65.5k|        ps_dpb_info[i].ps_prev_long = NULL;
   90|  65.5k|        ps_dpb_info[i].ps_pic_buf = NULL;
   91|  65.5k|        ps_dpb_info[i].s_top_field.u1_reference_info = UNUSED_FOR_REF;
  ------------------
  |  |  595|  65.5k|#define UNUSED_FOR_REF 0
  ------------------
   92|  65.5k|        ps_dpb_info[i].s_bot_field.u1_reference_info = UNUSED_FOR_REF;
  ------------------
  |  |  595|  65.5k|#define UNUSED_FOR_REF 0
  ------------------
   93|  65.5k|        ps_dpb_info[i].s_top_field.u1_long_term_frame_idx = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|  65.5k|#define MAX_REF_BUFS    32
  ------------------
   94|  65.5k|        ps_dpb_info[i].s_bot_field.u1_long_term_frame_idx = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|  65.5k|#define MAX_REF_BUFS    32
  ------------------
   95|       |
   96|  65.5k|    }
   97|  2.04k|    ps_dpb_mgr->u1_num_st_ref_bufs = ps_dpb_mgr->u1_num_lt_ref_bufs = 0;
   98|  2.04k|    ps_dpb_mgr->ps_dpb_st_head = NULL;
   99|  2.04k|    ps_dpb_mgr->ps_dpb_ht_head = NULL;
  100|  2.04k|    ps_dpb_mgr->i1_gaps_deleted = 0;
  101|  2.04k|    ps_dpb_mgr->i1_poc_buf_id_entries = 0;
  102|  2.04k|    ps_dpb_mgr->u1_mmco_error_in_seq = 0;
  103|       |
  104|  2.04k|    ps_dpb_mgr->u1_num_gaps = 0;
  105|  34.7k|    for(i = 0; i < MAX_FRAMES; i++)
  ------------------
  |  |  600|  34.7k|#define MAX_FRAMES              16
  ------------------
  |  Branch (105:16): [True: 32.7k, False: 2.04k]
  ------------------
  106|  32.7k|    {
  107|  32.7k|        ps_dpb_mgr->ai4_gaps_start_frm_num[i] = INVALID_FRAME_NUM;
  ------------------
  |  |  601|  32.7k|#define INVALID_FRAME_NUM       0x0fffffff
  ------------------
  108|  32.7k|        ps_dpb_mgr->ai4_gaps_end_frm_num[i] = 0;
  109|  32.7k|        ps_dpb_mgr->ai1_gaps_per_seq[i] = 0;
  110|  32.7k|        ps_dpb_mgr->ai4_poc_buf_id_map[i][0] = -1;
  111|  32.7k|        ps_dpb_mgr->ai4_poc_buf_id_map[i][1] = 0x7fffffff;
  112|  32.7k|        ps_dpb_mgr->ai4_poc_buf_id_map[i][2] = 0;
  113|  32.7k|    }
  114|       |
  115|  2.04k|}
ih264d_free_ref_pic_mv_bufs:
  118|  2.71k|{
  119|  2.71k|    dec_struct_t *ps_dec = (dec_struct_t *)pv_dec;
  120|       |
  121|  2.71k|    if((pic_buf_id == ps_dec->u1_pic_buf_id) &&
  ------------------
  |  Branch (121:8): [True: 687, False: 2.03k]
  ------------------
  122|    687|                    ps_dec->ps_cur_slice->u1_field_pic_flag &&
  ------------------
  |  Branch (122:21): [True: 0, False: 687]
  ------------------
  123|      0|                    (ps_dec->u1_top_bottom_decoded == 0))
  ------------------
  |  Branch (123:21): [True: 0, False: 0]
  ------------------
  124|      0|    {
  125|      0|        return;
  126|      0|    }
  127|       |
  128|  2.71k|    ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr,
  129|  2.71k|                          pic_buf_id,
  130|  2.71k|                          BUF_MGR_REF);
  ------------------
  |  |   50|  2.71k|#define BUF_MGR_REF          (1 << 2)
  ------------------
  131|  2.71k|    ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_mv_buf_mgr,
  132|  2.71k|                          ps_dec->as_buf_id_info_map[pic_buf_id].mv_buf_id,
  133|  2.71k|                          BUF_MGR_REF);
  ------------------
  |  |   50|  2.71k|#define BUF_MGR_REF          (1 << 2)
  ------------------
  134|  2.71k|}
ih264d_delete_lt_node:
  151|    933|{
  152|    933|    *pi4_status = 0;
  153|    933|    if(ps_dpb_mgr->u1_num_lt_ref_bufs > 0)
  ------------------
  |  Branch (153:8): [True: 4, False: 929]
  ------------------
  154|      4|    {
  155|      4|        WORD32 i;
  156|      4|        struct dpb_info_t *ps_next_dpb;
  157|       |        /* ps_unmark_node points to the node to be removed */
  158|       |        /* from long term list.                            */
  159|      4|        struct dpb_info_t *ps_unmark_node;
  160|       |        //Find the node with matching LTIndex
  161|      4|        ps_next_dpb = ps_dpb_mgr->ps_dpb_ht_head;
  162|      4|        if(ps_next_dpb->u1_lt_idx == u4_lt_idx)
  ------------------
  |  Branch (162:12): [True: 0, False: 4]
  ------------------
  163|      0|        {
  164|      0|            ps_unmark_node = ps_next_dpb;
  165|      0|        }
  166|      4|        else
  167|      4|        {
  168|      5|            for(i = 1; i < ps_dpb_mgr->u1_num_lt_ref_bufs; i++)
  ------------------
  |  Branch (168:24): [True: 2, False: 3]
  ------------------
  169|      2|            {
  170|      2|                if(ps_next_dpb->ps_prev_long->u1_lt_idx == u4_lt_idx)
  ------------------
  |  Branch (170:20): [True: 1, False: 1]
  ------------------
  171|      1|                    break;
  172|      1|                ps_next_dpb = ps_next_dpb->ps_prev_long;
  173|      1|            }
  174|      4|            if(i == ps_dpb_mgr->u1_num_lt_ref_bufs)
  ------------------
  |  Branch (174:16): [True: 3, False: 1]
  ------------------
  175|      3|                *pi4_status = 1;
  176|      1|            else
  177|      1|                ps_unmark_node = ps_next_dpb->ps_prev_long;
  178|      4|        }
  179|       |
  180|      4|        if(*pi4_status == 0)
  ------------------
  |  Branch (180:12): [True: 1, False: 3]
  ------------------
  181|      1|        {
  182|      1|            if(u1_fld_pic_flag)
  ------------------
  |  Branch (182:16): [True: 0, False: 1]
  ------------------
  183|      0|            {
  184|      0|                if(ps_lt_node_to_insert != ps_unmark_node)
  ------------------
  |  Branch (184:20): [True: 0, False: 0]
  ------------------
  185|      0|                {
  186|      0|                    UWORD8 u1_deleted = 0;
  187|       |                    /* for the ps_unmark_node mark the corresponding field */
  188|       |                    /* field as unused for reference                       */
  189|       |
  190|      0|                    if(ps_unmark_node->s_top_field.u1_long_term_frame_idx
  ------------------
  |  Branch (190:24): [True: 0, False: 0]
  ------------------
  191|      0|                                    == u4_lt_idx)
  192|      0|                    {
  193|      0|                        ps_unmark_node->s_top_field.u1_reference_info =
  194|      0|                                        UNUSED_FOR_REF;
  ------------------
  |  |  595|      0|#define UNUSED_FOR_REF 0
  ------------------
  195|      0|                        ps_unmark_node->s_top_field.u1_long_term_frame_idx =
  196|      0|                        MAX_REF_BUFS + 1;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  197|      0|                        u1_deleted = 1;
  198|      0|                    }
  199|      0|                    if(ps_unmark_node->s_bot_field.u1_long_term_frame_idx
  ------------------
  |  Branch (199:24): [True: 0, False: 0]
  ------------------
  200|      0|                                    == u4_lt_idx)
  201|      0|                    {
  202|      0|                        ps_unmark_node->s_bot_field.u1_reference_info =
  203|      0|                                        UNUSED_FOR_REF;
  ------------------
  |  |  595|      0|#define UNUSED_FOR_REF 0
  ------------------
  204|      0|                        ps_unmark_node->s_bot_field.u1_long_term_frame_idx =
  205|      0|                        MAX_REF_BUFS + 1;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  206|      0|                        u1_deleted = 1;
  207|      0|                    }
  208|       |
  209|      0|                    if(!u1_deleted)
  ------------------
  |  Branch (209:24): [True: 0, False: 0]
  ------------------
  210|      0|                    {
  211|       |
  212|      0|                        UWORD32 i4_error_code;
  213|      0|                        i4_error_code = ERROR_DBP_MANAGER_T;
  214|       |
  215|      0|                        return i4_error_code;
  216|      0|                    }
  217|      0|                }
  218|       |
  219|      0|                ps_unmark_node->u1_used_as_ref =
  220|      0|                                ps_unmark_node->s_top_field.u1_reference_info
  221|      0|                                                | ps_unmark_node->s_bot_field.u1_reference_info;
  222|      0|            }
  223|      1|            else
  224|      1|                ps_unmark_node->u1_used_as_ref = UNUSED_FOR_REF;
  ------------------
  |  |  595|      1|#define UNUSED_FOR_REF 0
  ------------------
  225|       |
  226|      1|            if(UNUSED_FOR_REF == ps_unmark_node->u1_used_as_ref)
  ------------------
  |  |  595|      1|#define UNUSED_FOR_REF 0
  ------------------
  |  Branch (226:16): [True: 1, False: 0]
  ------------------
  227|      1|            {
  228|      1|                if(ps_unmark_node == ps_dpb_mgr->ps_dpb_ht_head)
  ------------------
  |  Branch (228:20): [True: 0, False: 1]
  ------------------
  229|      0|                    ps_dpb_mgr->ps_dpb_ht_head = ps_next_dpb->ps_prev_long;
  230|       |
  231|      1|                ps_unmark_node->u1_lt_idx = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|      1|#define MAX_REF_BUFS    32
  ------------------
  232|      1|                ps_unmark_node->s_top_field.u1_reference_info =
  233|      1|                UNUSED_FOR_REF;
  ------------------
  |  |  595|      1|#define UNUSED_FOR_REF 0
  ------------------
  234|      1|                ps_unmark_node->s_bot_field.u1_reference_info =
  235|      1|                UNUSED_FOR_REF;
  ------------------
  |  |  595|      1|#define UNUSED_FOR_REF 0
  ------------------
  236|       |                // Release the physical buffer
  237|      1|                ih264d_free_ref_pic_mv_bufs(ps_dpb_mgr->pv_codec_handle,
  238|      1|                                            ps_unmark_node->u1_buf_id);
  239|      1|                ps_next_dpb->ps_prev_long = ps_unmark_node->ps_prev_long; //update link
  240|      1|                ps_unmark_node->ps_prev_long = NULL;
  241|      1|                ps_dpb_mgr->u1_num_lt_ref_bufs--; //decrement LT buf count
  242|      1|            }
  243|      1|        }
  244|      4|    }
  245|    933|    return OK;
  ------------------
  |  |  114|    933|#define OK        0
  ------------------
  246|    933|}
ih264d_insert_lt_node:
  263|    890|{
  264|    890|    UWORD8 u1_mark_top_field_long_term = 0;
  265|    890|    UWORD8 u1_mark_bot_field_long_term = 0;
  266|       |
  267|    890|    {
  268|    890|        if(u1_fld_pic_flag)
  ------------------
  |  Branch (268:12): [True: 0, False: 890]
  ------------------
  269|      0|        {
  270|       |            /* Assign corresponding field (top or bottom) long_term_frame_idx */
  271|       |
  272|      0|            if((ps_mov_node->s_top_field.u1_reference_info == IS_LONG_TERM)
  ------------------
  |  |  597|      0|#define IS_LONG_TERM   2
  ------------------
  |  Branch (272:16): [True: 0, False: 0]
  ------------------
  273|      0|                            && (ps_mov_node->s_bot_field.u1_reference_info
  ------------------
  |  Branch (273:32): [True: 0, False: 0]
  ------------------
  274|      0|                                            == IS_LONG_TERM))
  ------------------
  |  |  597|      0|#define IS_LONG_TERM   2
  ------------------
  275|      0|            {
  276|      0|                if(ps_mov_node->u1_lt_idx == u4_lt_idx)
  ------------------
  |  Branch (276:20): [True: 0, False: 0]
  ------------------
  277|      0|                    u1_mark_bot_field_long_term = 1;
  278|      0|                else
  279|      0|                {
  280|       |
  281|      0|                    UWORD32 i4_error_code;
  282|      0|                    i4_error_code = ERROR_DBP_MANAGER_T;
  283|       |
  284|      0|                    return i4_error_code;
  285|       |
  286|      0|                }
  287|      0|            }
  288|      0|            else if(ps_mov_node->s_top_field.u1_reference_info == IS_LONG_TERM)
  ------------------
  |  |  597|      0|#define IS_LONG_TERM   2
  ------------------
  |  Branch (288:21): [True: 0, False: 0]
  ------------------
  289|      0|            {
  290|      0|                u1_mark_top_field_long_term = 1;
  291|      0|            }
  292|       |
  293|      0|            if(!(u1_mark_top_field_long_term || u1_mark_bot_field_long_term))
  ------------------
  |  Branch (293:18): [True: 0, False: 0]
  |  Branch (293:49): [True: 0, False: 0]
  ------------------
  294|      0|            {
  295|      0|                UWORD32 i4_error_code;
  296|      0|                i4_error_code = ERROR_DBP_MANAGER_T;
  297|      0|                return i4_error_code;
  298|      0|            }
  299|      0|        }
  300|    890|        else
  301|    890|        {
  302|    890|            ps_mov_node->s_top_field.u1_reference_info = IS_LONG_TERM;
  ------------------
  |  |  597|    890|#define IS_LONG_TERM   2
  ------------------
  303|    890|            ps_mov_node->s_bot_field.u1_reference_info = IS_LONG_TERM;
  ------------------
  |  |  597|    890|#define IS_LONG_TERM   2
  ------------------
  304|    890|            ps_mov_node->s_top_field.u1_long_term_frame_idx = u4_lt_idx;
  305|    890|            ps_mov_node->s_bot_field.u1_long_term_frame_idx = u4_lt_idx;
  306|    890|            u1_mark_bot_field_long_term = 1;
  307|    890|            u1_mark_top_field_long_term = 1;
  308|    890|        }
  309|       |
  310|    890|        ps_mov_node->u1_lt_idx = u4_lt_idx; //Assign the LT index to the node
  311|    890|        ps_mov_node->ps_pic_buf->u1_long_term_frm_idx = u4_lt_idx;
  312|    890|        ps_mov_node->u1_used_as_ref = IS_LONG_TERM;
  ------------------
  |  |  597|    890|#define IS_LONG_TERM   2
  ------------------
  313|       |
  314|       |        /* Insert the new long term in the LT list with  u4_lt_idx    */
  315|       |        /* in ascending order.                                         */
  316|    890|        if(ps_dpb_mgr->u1_num_lt_ref_bufs > 0)
  ------------------
  |  Branch (316:12): [True: 3, False: 887]
  ------------------
  317|      3|        {
  318|      3|            struct dpb_info_t *ps_next_dpb = ps_dpb_mgr->ps_dpb_ht_head;
  319|      3|            if(u4_lt_idx < ps_next_dpb->u1_lt_idx)
  ------------------
  |  Branch (319:16): [True: 1, False: 2]
  ------------------
  320|      1|            {
  321|       |                //LTIndex to be inserted is the smallest LT index
  322|       |                //Update head and point prev to the next higher index
  323|      1|                ps_mov_node->ps_prev_long = ps_next_dpb;
  324|      1|                ps_dpb_mgr->ps_dpb_ht_head = ps_mov_node;
  325|      1|            }
  326|      2|            else
  327|      2|            {
  328|      2|                WORD32 i;
  329|      2|                struct dpb_info_t *ps_nxtDPB = ps_next_dpb;
  330|      2|                ps_next_dpb = ps_next_dpb->ps_prev_long;
  331|      2|                for(i = 1; i < ps_dpb_mgr->u1_num_lt_ref_bufs; i++)
  ------------------
  |  Branch (331:28): [True: 2, False: 0]
  ------------------
  332|      2|                {
  333|      2|                    if(ps_next_dpb->u1_lt_idx > u4_lt_idx)
  ------------------
  |  Branch (333:24): [True: 2, False: 0]
  ------------------
  334|      2|                        break;
  335|      0|                    ps_nxtDPB = ps_next_dpb;
  336|      0|                    ps_next_dpb = ps_next_dpb->ps_prev_long;
  337|      0|                }
  338|       |
  339|      2|                ps_nxtDPB->ps_prev_long = ps_mov_node;
  340|      2|                ps_mov_node->ps_prev_long = ps_next_dpb;
  341|      2|            }
  342|      3|        }
  343|    887|        else
  344|    887|        {
  345|    887|            ps_dpb_mgr->ps_dpb_ht_head = ps_mov_node;
  346|    887|            ps_mov_node->ps_prev_long = NULL;
  347|    887|        }
  348|       |        /* Identify the picture buffer as a long term picture buffer */
  349|    890|        ps_mov_node->ps_pic_buf->u1_is_short = 0;
  350|       |
  351|       |        /* Increment LT buf count only if new LT node inserted    */
  352|       |        /* If Increment during top_field is done, don't increment */
  353|       |        /* for bottom field, as both them are part of same pic.   */
  354|    890|        if(u1_mark_bot_field_long_term)
  ------------------
  |  Branch (354:12): [True: 890, False: 0]
  ------------------
  355|    890|            ps_dpb_mgr->u1_num_lt_ref_bufs++;
  356|       |
  357|    890|    }
  358|    890|    return OK;
  ------------------
  |  |  114|    890|#define OK        0
  ------------------
  359|    890|}
ih264d_insert_st_node:
  379|  2.86k|{
  380|  2.86k|    WORD32 i;
  381|  2.86k|    struct dpb_info_t *ps_dpb_info = ps_dpb_mgr->as_dpb_info;
  382|  2.86k|    UWORD8 u1_picture_type = ps_pic_buf->u1_picturetype;
  383|       |    /* Find an unused dpb location */
  384|  2.90k|    for(i = 0; i < MAX_REF_BUFS; i++)
  ------------------
  |  |   75|  2.90k|#define MAX_REF_BUFS    32
  ------------------
  |  Branch (384:16): [True: 2.90k, False: 0]
  ------------------
  385|  2.90k|    {
  386|  2.90k|        if((ps_dpb_info[i].ps_pic_buf == ps_pic_buf)
  ------------------
  |  Branch (386:12): [True: 0, False: 2.90k]
  ------------------
  387|      0|                        && ps_dpb_info[i].u1_used_as_ref)
  ------------------
  |  Branch (387:28): [True: 0, False: 0]
  ------------------
  388|      0|        {
  389|       |            /*signal an error in the case of frame pic*/
  390|      0|            if(ps_dpb_info[i].ps_pic_buf->u1_pic_type == FRM_PIC)
  ------------------
  |  |  352|      0|#define FRM_PIC         0x00
  ------------------
  |  Branch (390:16): [True: 0, False: 0]
  ------------------
  391|      0|            {
  392|      0|                return ERROR_DBP_MANAGER_T;
  393|      0|            }
  394|      0|            else
  395|      0|            {
  396|       |                /* Can occur only for field bottom pictures */
  397|      0|                ps_dpb_info[i].s_bot_field.u1_reference_info = IS_SHORT_TERM;
  ------------------
  |  |  596|      0|#define IS_SHORT_TERM  1
  ------------------
  398|      0|                return OK;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  399|      0|            }
  400|      0|        }
  401|       |
  402|  2.90k|        if((ps_dpb_info[i].u1_used_as_ref == UNUSED_FOR_REF)
  ------------------
  |  |  595|  2.90k|#define UNUSED_FOR_REF 0
  ------------------
  |  Branch (402:12): [True: 2.86k, False: 40]
  ------------------
  403|  2.86k|                        && (ps_dpb_info[i].s_top_field.u1_reference_info
  ------------------
  |  Branch (403:28): [True: 2.86k, False: 0]
  ------------------
  404|  2.86k|                                        == UNUSED_FOR_REF)
  ------------------
  |  |  595|  2.86k|#define UNUSED_FOR_REF 0
  ------------------
  405|  2.86k|                        && (ps_dpb_info[i].s_bot_field.u1_reference_info
  ------------------
  |  Branch (405:28): [True: 2.86k, False: 0]
  ------------------
  406|  2.86k|                                        == UNUSED_FOR_REF))
  ------------------
  |  |  595|  2.86k|#define UNUSED_FOR_REF 0
  ------------------
  407|  2.86k|            break;
  408|  2.90k|    }
  409|  2.86k|    if(i == MAX_REF_BUFS)
  ------------------
  |  |   75|  2.86k|#define MAX_REF_BUFS    32
  ------------------
  |  Branch (409:8): [True: 0, False: 2.86k]
  ------------------
  410|      0|    {
  411|      0|        UWORD32 i4_error_code;
  412|      0|        i4_error_code = ERROR_DBP_MANAGER_T;
  413|      0|        return i4_error_code;
  414|      0|    }
  415|       |
  416|       |    /* Create dpb info */
  417|  2.86k|    ps_dpb_info[i].ps_pic_buf = ps_pic_buf;
  418|  2.86k|    ps_dpb_info[i].ps_prev_short = ps_dpb_mgr->ps_dpb_st_head;
  419|  2.86k|    ps_dpb_info[i].u1_buf_id = u1_buf_id;
  420|  2.86k|    ps_dpb_info[i].u1_used_as_ref = TRUE;
  ------------------
  |  |  591|  2.86k|#define TRUE    1
  ------------------
  421|  2.86k|    ps_dpb_info[i].u1_lt_idx = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|  2.86k|#define MAX_REF_BUFS    32
  ------------------
  422|  2.86k|    ps_dpb_info[i].i4_frame_num = u4_cur_pic_num;
  423|  2.86k|    ps_dpb_info[i].ps_pic_buf->i4_frame_num = u4_cur_pic_num;
  424|       |
  425|       |    /* update the head node of linked list to point to the cur Pic */
  426|  2.86k|    ps_dpb_mgr->ps_dpb_st_head = ps_dpb_info + i;
  427|       |
  428|       |    // Increment Short term bufCount
  429|  2.86k|    ps_dpb_mgr->u1_num_st_ref_bufs++;
  430|       |    /* Identify the picture as a short term picture buffer */
  431|  2.86k|    ps_pic_buf->u1_is_short = IS_SHORT_TERM;
  ------------------
  |  |  596|  2.86k|#define IS_SHORT_TERM  1
  ------------------
  432|       |
  433|  2.86k|    if((u1_picture_type & 0x03) == FRM_PIC)
  ------------------
  |  |  352|  2.86k|#define FRM_PIC         0x00
  ------------------
  |  Branch (433:8): [True: 2.86k, False: 0]
  ------------------
  434|  2.86k|    {
  435|  2.86k|        ps_dpb_info[i].u1_used_as_ref = IS_SHORT_TERM;
  ------------------
  |  |  596|  2.86k|#define IS_SHORT_TERM  1
  ------------------
  436|  2.86k|        ps_dpb_info[i].s_top_field.u1_reference_info = IS_SHORT_TERM;
  ------------------
  |  |  596|  2.86k|#define IS_SHORT_TERM  1
  ------------------
  437|  2.86k|        ps_dpb_info[i].s_bot_field.u1_reference_info = IS_SHORT_TERM;
  ------------------
  |  |  596|  2.86k|#define IS_SHORT_TERM  1
  ------------------
  438|  2.86k|    }
  439|       |
  440|  2.86k|    if((u1_picture_type & 0x03) == TOP_FLD)
  ------------------
  |  |  353|  2.86k|#define TOP_FLD         0x01
  ------------------
  |  Branch (440:8): [True: 0, False: 2.86k]
  ------------------
  441|      0|        ps_dpb_info[i].s_top_field.u1_reference_info = IS_SHORT_TERM;
  ------------------
  |  |  596|      0|#define IS_SHORT_TERM  1
  ------------------
  442|       |
  443|  2.86k|    if((u1_picture_type & 0x03) == BOT_FLD)
  ------------------
  |  |  354|  2.86k|#define BOT_FLD         0x02
  ------------------
  |  Branch (443:8): [True: 0, False: 2.86k]
  ------------------
  444|      0|        ps_dpb_info[i].s_bot_field.u1_reference_info = IS_SHORT_TERM;
  ------------------
  |  |  596|      0|#define IS_SHORT_TERM  1
  ------------------
  445|       |
  446|  2.86k|    return OK;
  ------------------
  |  |  114|  2.86k|#define OK        0
  ------------------
  447|  2.86k|}
ih264d_delete_st_node_or_make_lt:
  468|    895|{
  469|    895|    WORD32 i;
  470|    895|    struct dpb_info_t *ps_next_dpb;
  471|    895|    WORD32 i4_frame_num = i4_pic_num;
  472|    895|    struct dpb_info_t *ps_unmark_node = NULL;
  473|    895|    UWORD8 u1_del_node = 0, u1_del_st = 0;
  474|    895|    UWORD8 u1_reference_type = UNUSED_FOR_REF;
  ------------------
  |  |  595|    895|#define UNUSED_FOR_REF 0
  ------------------
  475|    895|    WORD32 ret;
  476|       |
  477|    895|    if(u1_fld_pic_flag)
  ------------------
  |  Branch (477:8): [True: 0, False: 895]
  ------------------
  478|      0|    {
  479|      0|        i4_frame_num = i4_frame_num >> 1;
  480|       |
  481|      0|        if(u4_lt_idx == (MAX_REF_BUFS + 1))
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  |  Branch (481:12): [True: 0, False: 0]
  ------------------
  482|      0|            u1_reference_type = UNUSED_FOR_REF;
  ------------------
  |  |  595|      0|#define UNUSED_FOR_REF 0
  ------------------
  483|      0|        else
  484|      0|            u1_reference_type = IS_LONG_TERM;
  ------------------
  |  |  597|      0|#define IS_LONG_TERM   2
  ------------------
  485|      0|    }
  486|       |
  487|       |    //Find the node with matching picNum
  488|    895|    ps_next_dpb = ps_dpb_mgr->ps_dpb_st_head;
  489|    895|    if((WORD32)ps_next_dpb->i4_frame_num == i4_frame_num)
  ------------------
  |  Branch (489:8): [True: 891, False: 4]
  ------------------
  490|    891|    {
  491|    891|        ps_unmark_node = ps_next_dpb;
  492|    891|    }
  493|      4|    else
  494|      4|    {
  495|      4|        for(i = 1; i < ps_dpb_mgr->u1_num_st_ref_bufs; i++)
  ------------------
  |  Branch (495:20): [True: 0, False: 4]
  ------------------
  496|      0|        {
  497|      0|            if((WORD32)ps_next_dpb->ps_prev_short->i4_frame_num == i4_frame_num)
  ------------------
  |  Branch (497:16): [True: 0, False: 0]
  ------------------
  498|      0|                break;
  499|      0|            ps_next_dpb = ps_next_dpb->ps_prev_short;
  500|      0|        }
  501|       |
  502|      4|        if(i == ps_dpb_mgr->u1_num_st_ref_bufs)
  ------------------
  |  Branch (502:12): [True: 4, False: 0]
  ------------------
  503|      4|        {
  504|      4|            if(ps_dpb_mgr->u1_num_gaps)
  ------------------
  |  Branch (504:16): [True: 0, False: 4]
  ------------------
  505|      0|            {
  506|      0|                ret = ih264d_delete_gap_frm_mmco(ps_dpb_mgr, i4_frame_num, &u1_del_st);
  507|      0|                if(ret != OK)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (507:20): [True: 0, False: 0]
  ------------------
  508|      0|                    return ret;
  509|      0|            }
  510|      4|            else
  511|      4|            {
  512|      4|                UWORD32 i4_error_code;
  513|      4|                i4_error_code = ERROR_DBP_MANAGER_T;
  514|       |
  515|      4|                return i4_error_code;
  516|      4|            }
  517|       |
  518|      0|            if(u1_del_st)
  ------------------
  |  Branch (518:16): [True: 0, False: 0]
  ------------------
  519|      0|            {
  520|      0|                UWORD32 i4_error_code;
  521|      0|                i4_error_code = ERROR_DBP_MANAGER_T;
  522|      0|                return i4_error_code;
  523|      0|            }
  524|      0|            else
  525|      0|            {
  526|      0|                return 0;
  527|      0|            }
  528|      0|        }
  529|      0|        else
  530|      0|            ps_unmark_node = ps_next_dpb->ps_prev_short;
  531|      4|    }
  532|       |
  533|    891|    if(u1_fld_pic_flag)
  ------------------
  |  Branch (533:8): [True: 0, False: 891]
  ------------------
  534|      0|    {
  535|       |        /* Mark the corresponding field ( top or bot) as  */
  536|       |        /* UNUSED_FOR_REF or IS_LONG_TERM depending on    */
  537|       |        /* u1_reference_type.                             */
  538|      0|        if(ps_unmark_node->s_top_field.i4_pic_num == i4_pic_num)
  ------------------
  |  Branch (538:12): [True: 0, False: 0]
  ------------------
  539|      0|        {
  540|      0|            ps_unmark_node->s_top_field.u1_reference_info = u1_reference_type;
  541|      0|            ps_unmark_node->s_top_field.u1_long_term_frame_idx = u4_lt_idx;
  542|      0|            {
  543|      0|                UWORD8 *pu1_src = ps_unmark_node->ps_pic_buf->pu1_col_zero_flag;
  544|      0|                WORD32 i4_size = ((ps_dpb_mgr->u2_pic_wd
  545|      0|                                * ps_dpb_mgr->u2_pic_ht) >> 5);
  546|       |                /* memset the colocated zero u4_flag buffer */
  547|      0|                memset(pu1_src, 0, i4_size);
  548|      0|            }
  549|      0|        }
  550|       |
  551|      0|        else if(ps_unmark_node->s_bot_field.i4_pic_num == i4_pic_num)
  ------------------
  |  Branch (551:17): [True: 0, False: 0]
  ------------------
  552|      0|        {
  553|       |
  554|      0|            ps_unmark_node->s_bot_field.u1_reference_info = u1_reference_type;
  555|      0|            ps_unmark_node->s_bot_field.u1_long_term_frame_idx = u4_lt_idx;
  556|      0|            {
  557|      0|                UWORD8 *pu1_src =
  558|      0|                                ps_unmark_node->ps_pic_buf->pu1_col_zero_flag
  559|      0|                                                + ((ps_dpb_mgr->u2_pic_wd
  560|      0|                                                                * ps_dpb_mgr->u2_pic_ht)
  561|      0|                                                                >> 5);
  562|      0|                WORD32 i4_size = ((ps_dpb_mgr->u2_pic_wd
  563|      0|                                * ps_dpb_mgr->u2_pic_ht) >> 5);
  564|       |                /* memset the colocated zero u4_flag buffer */
  565|      0|                memset(pu1_src, 0, i4_size);
  566|      0|            }
  567|      0|        }
  568|      0|        ps_unmark_node->u1_used_as_ref =
  569|      0|                        ps_unmark_node->s_top_field.u1_reference_info
  570|      0|                                        | ps_unmark_node->s_bot_field.u1_reference_info;
  571|      0|    }
  572|    891|    else
  573|    891|    {
  574|    891|        ps_unmark_node->u1_used_as_ref = UNUSED_FOR_REF;
  ------------------
  |  |  595|    891|#define UNUSED_FOR_REF 0
  ------------------
  575|    891|        ps_unmark_node->s_top_field.u1_reference_info = UNUSED_FOR_REF;
  ------------------
  |  |  595|    891|#define UNUSED_FOR_REF 0
  ------------------
  576|    891|        ps_unmark_node->s_bot_field.u1_reference_info = UNUSED_FOR_REF;
  ------------------
  |  |  595|    891|#define UNUSED_FOR_REF 0
  ------------------
  577|       |
  578|    891|        {
  579|    891|            UWORD8 *pu1_src = ps_unmark_node->ps_pic_buf->pu1_col_zero_flag;
  580|       |
  581|    891|            WORD32 i4_size = ((ps_dpb_mgr->u2_pic_wd
  582|    891|                            * ps_dpb_mgr->u2_pic_ht) >> 4);
  583|       |            /* memset the colocated zero u4_flag buffer */
  584|    891|            memset(pu1_src, 0, i4_size);
  585|    891|        }
  586|    891|    }
  587|       |
  588|    891|    if(!(ps_unmark_node->u1_used_as_ref & IS_SHORT_TERM))
  ------------------
  |  |  596|    891|#define IS_SHORT_TERM  1
  ------------------
  |  Branch (588:8): [True: 891, False: 0]
  ------------------
  589|    891|    {
  590|    891|        if(ps_unmark_node == ps_dpb_mgr->ps_dpb_st_head)
  ------------------
  |  Branch (590:12): [True: 891, False: 0]
  ------------------
  591|    891|            ps_dpb_mgr->ps_dpb_st_head = ps_next_dpb->ps_prev_short;
  592|      0|        else
  593|      0|            ps_next_dpb->ps_prev_short = ps_unmark_node->ps_prev_short; //update link
  594|    891|        ps_dpb_mgr->u1_num_st_ref_bufs--; //decrement ST buf count
  595|    891|        u1_del_node = 1;
  596|    891|    }
  597|       |
  598|    891|    if(u4_lt_idx == MAX_REF_BUFS + 1)
  ------------------
  |  |   75|    891|#define MAX_REF_BUFS    32
  ------------------
  |  Branch (598:8): [True: 1, False: 890]
  ------------------
  599|      1|    {
  600|      1|        if(u1_del_node)
  ------------------
  |  Branch (600:12): [True: 1, False: 0]
  ------------------
  601|      1|        {
  602|       |            // Release the physical buffer
  603|      1|            ih264d_free_ref_pic_mv_bufs(ps_dpb_mgr->pv_codec_handle,
  604|      1|                                        ps_unmark_node->u1_buf_id);
  605|      1|            ps_unmark_node->ps_prev_short = NULL;
  606|      1|        }
  607|      1|    }
  608|    890|    else
  609|    890|    {
  610|    890|        WORD32 i4_status;
  611|       |        //If another node has the same LT index, delete that node
  612|    890|        ret = ih264d_delete_lt_node(ps_dpb_mgr, u4_lt_idx,
  613|    890|                              u1_fld_pic_flag, ps_unmark_node, &i4_status);
  614|    890|        if(ret != OK)
  ------------------
  |  |  114|    890|#define OK        0
  ------------------
  |  Branch (614:12): [True: 0, False: 890]
  ------------------
  615|      0|            return ret;
  616|       |        // Now insert the short term node as a long term node
  617|    890|        ret = ih264d_insert_lt_node(ps_dpb_mgr, ps_unmark_node, u4_lt_idx,
  618|    890|                              u1_fld_pic_flag);
  619|    890|        if(ret != OK)
  ------------------
  |  |  114|    890|#define OK        0
  ------------------
  |  Branch (619:12): [True: 0, False: 890]
  ------------------
  620|      0|            return ret;
  621|    890|    }
  622|    891|    return OK;
  ------------------
  |  |  114|    891|#define OK        0
  ------------------
  623|    891|}
ih264d_reset_ref_bufs:
  636|  4.82k|{
  637|  4.82k|    WORD32 i;
  638|  4.82k|    struct dpb_info_t *ps_dpb_info = ps_dpb_mgr->as_dpb_info;
  639|       |
  640|   159k|    for(i = 0; i < MAX_REF_BUFS; i++)
  ------------------
  |  |   75|   159k|#define MAX_REF_BUFS    32
  ------------------
  |  Branch (640:16): [True: 154k, False: 4.82k]
  ------------------
  641|   154k|    {
  642|   154k|        if(ps_dpb_info[i].u1_used_as_ref)
  ------------------
  |  Branch (642:12): [True: 2.70k, False: 151k]
  ------------------
  643|  2.70k|        {
  644|  2.70k|            ps_dpb_info[i].u1_used_as_ref = UNUSED_FOR_REF;
  ------------------
  |  |  595|  2.70k|#define UNUSED_FOR_REF 0
  ------------------
  645|  2.70k|            ps_dpb_info[i].u1_lt_idx = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|  2.70k|#define MAX_REF_BUFS    32
  ------------------
  646|  2.70k|            ps_dpb_info[i].ps_prev_short = NULL;
  647|  2.70k|            ps_dpb_info[i].ps_prev_long = NULL;
  648|  2.70k|            ps_dpb_info[i].ps_pic_buf = NULL;
  649|  2.70k|            ps_dpb_info[i].s_top_field.u1_reference_info = UNUSED_FOR_REF;
  ------------------
  |  |  595|  2.70k|#define UNUSED_FOR_REF 0
  ------------------
  650|  2.70k|            ps_dpb_info[i].s_bot_field.u1_reference_info = UNUSED_FOR_REF;
  ------------------
  |  |  595|  2.70k|#define UNUSED_FOR_REF 0
  ------------------
  651|  2.70k|            ps_dpb_info[i].s_top_field.u1_long_term_frame_idx = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|  2.70k|#define MAX_REF_BUFS    32
  ------------------
  652|  2.70k|            ps_dpb_info[i].s_bot_field.u1_long_term_frame_idx = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|  2.70k|#define MAX_REF_BUFS    32
  ------------------
  653|       |
  654|       |            //Release physical buffer
  655|  2.70k|            ih264d_free_ref_pic_mv_bufs(ps_dpb_mgr->pv_codec_handle,
  656|  2.70k|                                        ps_dpb_info[i].u1_buf_id);
  657|  2.70k|        }
  658|   154k|    }
  659|  4.82k|    ps_dpb_mgr->u1_num_st_ref_bufs = ps_dpb_mgr->u1_num_lt_ref_bufs = 0;
  660|  4.82k|    ps_dpb_mgr->ps_dpb_st_head = NULL;
  661|  4.82k|    ps_dpb_mgr->ps_dpb_ht_head = NULL;
  662|  4.82k|    ps_dpb_mgr->u1_mmco_error_in_seq = 0;
  663|       |
  664|       |    /* release all gaps */
  665|  4.82k|    ps_dpb_mgr->u1_num_gaps = 0;
  666|  81.9k|    for(i = 0; i < MAX_FRAMES; i++)
  ------------------
  |  |  600|  81.9k|#define MAX_FRAMES              16
  ------------------
  |  Branch (666:16): [True: 77.1k, False: 4.82k]
  ------------------
  667|  77.1k|    {
  668|  77.1k|        ps_dpb_mgr->ai4_gaps_start_frm_num[i] = INVALID_FRAME_NUM;
  ------------------
  |  |  601|  77.1k|#define INVALID_FRAME_NUM       0x0fffffff
  ------------------
  669|  77.1k|        ps_dpb_mgr->ai4_gaps_end_frm_num[i] = 0;
  670|  77.1k|        ps_dpb_mgr->ai1_gaps_per_seq[i] = 0;
  671|  77.1k|    }
  672|  4.82k|}
ih264d_update_default_index_list:
  687|  2.89k|{
  688|  2.89k|    WORD32 i;
  689|  2.89k|    struct dpb_info_t *ps_next_dpb = ps_dpb_mgr->ps_dpb_st_head;
  690|       |
  691|  4.90k|    for(i = 0; i < ps_dpb_mgr->u1_num_st_ref_bufs; i++)
  ------------------
  |  Branch (691:16): [True: 2.01k, False: 2.89k]
  ------------------
  692|  2.01k|    {
  693|  2.01k|        ps_dpb_mgr->ps_def_dpb[i] = ps_next_dpb->ps_pic_buf;
  694|  2.01k|        ps_next_dpb = ps_next_dpb->ps_prev_short;
  695|  2.01k|    }
  696|       |
  697|  2.89k|    ps_next_dpb = ps_dpb_mgr->ps_dpb_ht_head;
  698|  3.80k|    for(;i< ps_dpb_mgr->u1_num_st_ref_bufs + ps_dpb_mgr->u1_num_lt_ref_bufs; i++)
  ------------------
  |  Branch (698:10): [True: 913, False: 2.89k]
  ------------------
  699|    913|    {
  700|    913|        ps_dpb_mgr->ps_def_dpb[i] = ps_next_dpb->ps_pic_buf;
  701|    913|        ps_next_dpb = ps_next_dpb->ps_prev_long;
  702|    913|    }
  703|  2.89k|    return 0;
  704|  2.89k|}
ih264d_ref_idx_reordering:
  729|  1.47k|{
  730|  1.47k|    dpb_manager_t *ps_dpb_mgr = ps_dec->ps_dpb_mgr;
  731|  1.47k|    UWORD16 u4_cur_pic_num = ps_dec->ps_cur_slice->u2_frame_num;
  732|       |    /*< Maximum Picture Number Minus 1 */
  733|  1.47k|    UWORD32 ui_max_frame_num =
  734|  1.47k|                    ps_dec->ps_cur_sps->u2_u4_max_pic_num_minus1 + 1;
  735|       |
  736|  1.47k|    WORD32 i, count = 0;
  737|  1.47k|    UWORD32 ui_remapIdc, ui_nextUev;
  738|  1.47k|    WORD16 u2_pred_frame_num = u4_cur_pic_num;
  739|  1.47k|    WORD32 i_temp;
  740|  1.47k|    UWORD16 u2_def_mod_flag = 0; /* Flag to keep track of which indices have been remapped */
  741|  1.47k|    UWORD8 modCount = 0;
  742|  1.47k|    UWORD32 *pu4_bitstrm_buf = ps_dec->ps_bitstrm->pu4_buffer;
  743|  1.47k|    UWORD32 *pu4_bitstrm_ofst = &ps_dec->ps_bitstrm->u4_ofst;
  744|  1.47k|    dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice;
  745|  1.47k|    UWORD8 u1_field_pic_flag = ps_cur_slice->u1_field_pic_flag;
  746|       |
  747|  1.47k|    if(u1_field_pic_flag)
  ------------------
  |  Branch (747:8): [True: 0, False: 1.47k]
  ------------------
  748|      0|    {
  749|      0|        u4_cur_pic_num = u4_cur_pic_num * 2 + 1;
  750|      0|        ui_max_frame_num = ui_max_frame_num * 2;
  751|      0|    }
  752|       |
  753|  1.47k|    u2_pred_frame_num = u4_cur_pic_num;
  754|       |
  755|  1.47k|    ui_remapIdc = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  756|       |
  757|  1.48k|    while((ui_remapIdc != 3)
  ------------------
  |  Branch (757:11): [True: 1.44k, False: 33]
  ------------------
  758|  1.44k|                    && (count < ps_cur_slice->u1_num_ref_idx_lx_active[uc_lx]))
  ------------------
  |  Branch (758:24): [True: 1.44k, False: 4]
  ------------------
  759|  1.44k|    {
  760|  1.44k|        ui_nextUev = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  761|  1.44k|        if(ui_remapIdc != 2)
  ------------------
  |  Branch (761:12): [True: 1.29k, False: 146]
  ------------------
  762|  1.29k|        {
  763|  1.29k|            if(ui_nextUev > ui_max_frame_num)
  ------------------
  |  Branch (763:16): [True: 75, False: 1.22k]
  ------------------
  764|     75|                return ERROR_DBP_MANAGER_T;
  765|       |
  766|  1.22k|            ui_nextUev = ui_nextUev + 1;
  767|       |
  768|  1.22k|            if(ui_remapIdc == 0)
  ------------------
  |  Branch (768:16): [True: 1.04k, False: 175]
  ------------------
  769|  1.04k|            {
  770|       |                // diffPicNum is -ve
  771|  1.04k|                i_temp = (WORD32)u2_pred_frame_num - (WORD32)ui_nextUev;
  772|  1.04k|                if(i_temp < 0)
  ------------------
  |  Branch (772:20): [True: 184, False: 863]
  ------------------
  773|    184|                    i_temp += ui_max_frame_num;
  774|  1.04k|            }
  775|    175|            else
  776|    175|            {
  777|       |                // diffPicNum is +ve
  778|    175|                i_temp = (WORD32)u2_pred_frame_num + (WORD32)ui_nextUev;
  779|    175|                if(i_temp >= (WORD32)ui_max_frame_num)
  ------------------
  |  Branch (779:20): [True: 10, False: 165]
  ------------------
  780|     10|                    i_temp -= ui_max_frame_num;
  781|    175|            }
  782|       |            /* Find the dpb with the matching picNum (picNum==frameNum for framePic) */
  783|       |
  784|  1.22k|            if(i_temp > u4_cur_pic_num)
  ------------------
  |  Branch (784:16): [True: 351, False: 871]
  ------------------
  785|    351|                i_temp = i_temp - ui_max_frame_num;
  786|       |
  787|  2.34k|            for(i = 0; i < (ps_cur_slice->u1_initial_list_size[uc_lx]); i++)
  ------------------
  |  Branch (787:24): [True: 1.12k, False: 1.21k]
  ------------------
  788|  1.12k|            {
  789|  1.12k|                if(ps_dpb_mgr->ps_init_dpb[uc_lx][i]->i4_pic_num == i_temp)
  ------------------
  |  Branch (789:20): [True: 6, False: 1.12k]
  ------------------
  790|      6|                    break;
  791|  1.12k|            }
  792|  1.22k|            if(i == (ps_cur_slice->u1_initial_list_size[uc_lx]))
  ------------------
  |  Branch (792:16): [True: 1.21k, False: 6]
  ------------------
  793|  1.21k|            {
  794|  1.21k|                UWORD32 i4_error_code;
  795|  1.21k|                i4_error_code = ERROR_DBP_MANAGER_T;
  796|  1.21k|                return i4_error_code;
  797|  1.21k|            }
  798|       |
  799|      6|            u2_def_mod_flag |= (1 << i);
  800|      6|            ps_dpb_mgr->ps_mod_dpb[uc_lx][modCount++] =
  801|      6|                            ps_dpb_mgr->ps_init_dpb[uc_lx][i];
  802|      6|            u2_pred_frame_num = i_temp; //update predictor to be the picNum just obtained
  803|      6|        }
  804|    146|        else //2
  805|    146|        {
  806|    146|            UWORD8 u1_lt_idx;
  807|       |
  808|    146|            if(ui_nextUev > (MAX_REF_BUFS + 1))
  ------------------
  |  |   75|    146|#define MAX_REF_BUFS    32
  ------------------
  |  Branch (808:16): [True: 0, False: 146]
  ------------------
  809|      0|                return ERROR_DBP_MANAGER_T;
  810|       |
  811|    146|            u1_lt_idx = (UWORD8)ui_nextUev;
  812|       |
  813|    224|            for(i = 0; i < (ps_cur_slice->u1_initial_list_size[uc_lx]); i++)
  ------------------
  |  Branch (813:24): [True: 78, False: 146]
  ------------------
  814|     78|            {
  815|     78|                if(!ps_dpb_mgr->ps_init_dpb[uc_lx][i]->u1_is_short)
  ------------------
  |  Branch (815:20): [True: 5, False: 73]
  ------------------
  816|      5|                {
  817|      5|                    if(ps_dpb_mgr->ps_init_dpb[uc_lx][i]->u1_long_term_pic_num
  ------------------
  |  Branch (817:24): [True: 0, False: 5]
  ------------------
  818|      5|                                    == u1_lt_idx)
  819|      0|                        break;
  820|      5|                }
  821|     78|            }
  822|    146|            if(i == (ps_cur_slice->u1_initial_list_size[uc_lx]))
  ------------------
  |  Branch (822:16): [True: 146, False: 0]
  ------------------
  823|    146|            {
  824|    146|                UWORD32 i4_error_code;
  825|    146|                i4_error_code = ERROR_DBP_MANAGER_T;
  826|    146|                return i4_error_code;
  827|    146|            }
  828|       |
  829|      0|            u2_def_mod_flag |= (1 << i);
  830|      0|            ps_dpb_mgr->ps_mod_dpb[uc_lx][modCount++] =
  831|      0|                            ps_dpb_mgr->ps_init_dpb[uc_lx][i];
  832|      0|        }
  833|       |
  834|      6|        ui_remapIdc = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  835|       |        /* Get the remapping_idc - 0/1/2/3 */
  836|      6|        count++;
  837|      6|    }
  838|       |
  839|       |    //Handle the ref indices that were not remapped
  840|    105|    for(i = 0; i < (ps_cur_slice->u1_num_ref_idx_lx_active[uc_lx]); i++)
  ------------------
  |  Branch (840:16): [True: 68, False: 37]
  ------------------
  841|     68|    {
  842|     68|        if(!(u2_def_mod_flag & (1 << i)))
  ------------------
  |  Branch (842:12): [True: 68, False: 0]
  ------------------
  843|     68|            ps_dpb_mgr->ps_mod_dpb[uc_lx][modCount++] =
  844|     68|                            ps_dpb_mgr->ps_init_dpb[uc_lx][i];
  845|     68|    }
  846|     37|    return OK;
  ------------------
  |  |  114|     37|#define OK        0
  ------------------
  847|  1.47k|}
ih264d_read_mmco_commands:
  866|  4.28k|{
  867|  4.28k|    dec_pic_params_t *ps_pps = ps_dec->ps_cur_pps;
  868|  4.28k|    dec_seq_params_t *ps_sps = ps_pps->ps_sps;
  869|  4.28k|    dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm;
  870|  4.28k|    dpb_commands_t *ps_dpb_cmds = &(ps_dec->s_dpb_cmds_scratch);
  871|  4.28k|    dec_slice_params_t * ps_slice = ps_dec->ps_cur_slice;
  872|  4.28k|    WORD32 j;
  873|  4.28k|    UWORD8 u1_buf_mode;
  874|  4.28k|    struct MMCParams *ps_mmc_params;
  875|  4.28k|    UWORD32 *pu4_bitstrm_buf = ps_dec->ps_bitstrm->pu4_buffer;
  876|  4.28k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  877|  4.28k|    UWORD32 u4_bit_ofst = ps_dec->ps_bitstrm->u4_ofst;
  878|       |
  879|  4.28k|    ps_slice->u1_mmco_equalto5 = 0;
  880|  4.28k|    {
  881|  4.28k|        if(ps_dec->u1_nal_unit_type == IDR_SLICE_NAL)
  ------------------
  |  |  328|  4.28k|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (881:12): [True: 4.19k, False: 81]
  ------------------
  882|  4.19k|        {
  883|  4.19k|            ps_slice->u1_no_output_of_prior_pics_flag =
  884|  4.19k|                            ih264d_get_bit_h264(ps_bitstrm);
  885|  4.19k|            COPYTHECONTEXT("SH: no_output_of_prior_pics_flag",
  886|  4.19k|                            ps_slice->u1_no_output_of_prior_pics_flag);
  887|  4.19k|            ps_slice->u1_long_term_reference_flag = ih264d_get_bit_h264(
  888|  4.19k|                            ps_bitstrm);
  889|  4.19k|            COPYTHECONTEXT("SH: long_term_reference_flag",
  890|  4.19k|                            ps_slice->u1_long_term_reference_flag);
  891|  4.19k|            ps_dpb_cmds->u1_idr_pic = 1;
  892|  4.19k|            ps_dpb_cmds->u1_no_output_of_prior_pics_flag =
  893|  4.19k|                            ps_slice->u1_no_output_of_prior_pics_flag;
  894|  4.19k|            ps_dpb_cmds->u1_long_term_reference_flag =
  895|  4.19k|                            ps_slice->u1_long_term_reference_flag;
  896|  4.19k|        }
  897|     81|        else
  898|     81|        {
  899|     81|            u1_buf_mode = ih264d_get_bit_h264(ps_bitstrm); //0 - sliding window; 1 - arbitrary
  900|     81|            COPYTHECONTEXT("SH: adaptive_ref_pic_buffering_flag", u1_buf_mode);
  901|     81|            ps_dpb_cmds->u1_buf_mode = u1_buf_mode;
  902|     81|            j = 0;
  903|       |
  904|     81|            if(u1_buf_mode == 1)
  ------------------
  |  Branch (904:16): [True: 40, False: 41]
  ------------------
  905|     40|            {
  906|     40|                UWORD32 u4_mmco;
  907|     40|                UWORD32 u4_diff_pic_num;
  908|     40|                UWORD32 u4_lt_idx, u4_max_lt_idx_plus1;
  909|       |
  910|     40|                u4_mmco = ih264d_uev(pu4_bitstrm_ofst,
  911|     40|                                     pu4_bitstrm_buf);
  912|    301|                while(u4_mmco != END_OF_MMCO)
  ------------------
  |  |   43|    301|#define END_OF_MMCO                 0
  ------------------
  |  Branch (912:23): [True: 262, False: 39]
  ------------------
  913|    262|                {
  914|    262|                    if (j >= MAX_REF_BUFS)
  ------------------
  |  |   75|    262|#define MAX_REF_BUFS    32
  ------------------
  |  Branch (914:25): [True: 1, False: 261]
  ------------------
  915|      1|                    {
  916|       |#ifdef __ANDROID__
  917|       |                        ALOGE("b/25818142");
  918|       |                        android_errorWriteLog(0x534e4554, "25818142");
  919|       |#endif
  920|      1|                        ps_dpb_cmds->u1_num_of_commands = 0;
  921|      1|                        return -1;
  922|      1|                    }
  923|    261|                    ps_mmc_params = &ps_dpb_cmds->as_mmc_params[j];
  924|    261|                    ps_mmc_params->u4_mmco = u4_mmco;
  925|    261|                    switch(u4_mmco)
  926|    261|                    {
  927|     24|                        case MARK_ST_PICNUM_AS_NONREF:
  ------------------
  |  |   44|     24|#define MARK_ST_PICNUM_AS_NONREF    1
  ------------------
  |  Branch (927:25): [True: 24, False: 237]
  ------------------
  928|     24|                            u4_diff_pic_num = ih264d_uev(pu4_bitstrm_ofst,
  929|     24|                                                         pu4_bitstrm_buf);
  930|       |                            //Get absDiffPicnumMinus1
  931|     24|                            ps_mmc_params->u4_diff_pic_num = u4_diff_pic_num;
  932|     24|                            break;
  933|       |
  934|     15|                        case MARK_LT_INDEX_AS_NONREF:
  ------------------
  |  |   45|     15|#define MARK_LT_INDEX_AS_NONREF     2
  ------------------
  |  Branch (934:25): [True: 15, False: 246]
  ------------------
  935|     15|                            u4_lt_idx = ih264d_uev(pu4_bitstrm_ofst,
  936|     15|                                                   pu4_bitstrm_buf);
  937|     15|                            ps_mmc_params->u4_lt_idx = u4_lt_idx;
  938|     15|                            break;
  939|       |
  940|     15|                        case MARK_ST_PICNUM_AS_LT_INDEX:
  ------------------
  |  |   46|     15|#define MARK_ST_PICNUM_AS_LT_INDEX  3
  ------------------
  |  Branch (940:25): [True: 15, False: 246]
  ------------------
  941|     15|                            u4_diff_pic_num = ih264d_uev(pu4_bitstrm_ofst,
  942|     15|                                                         pu4_bitstrm_buf);
  943|     15|                            ps_mmc_params->u4_diff_pic_num = u4_diff_pic_num;
  944|     15|                            u4_lt_idx = ih264d_uev(pu4_bitstrm_ofst,
  945|     15|                                                   pu4_bitstrm_buf);
  946|     15|                            ps_mmc_params->u4_lt_idx = u4_lt_idx;
  947|     15|                            break;
  948|       |
  949|     39|                        case SET_MAX_LT_INDEX:
  ------------------
  |  |   47|     39|#define SET_MAX_LT_INDEX            4
  ------------------
  |  Branch (949:25): [True: 39, False: 222]
  ------------------
  950|     39|                        {
  951|     39|                            u4_max_lt_idx_plus1 = ih264d_uev(pu4_bitstrm_ofst,
  952|     39|                                                             pu4_bitstrm_buf);
  953|     39|                            if (u4_max_lt_idx_plus1 > ps_sps->u1_num_ref_frames)
  ------------------
  |  Branch (953:33): [True: 0, False: 39]
  ------------------
  954|      0|                            {
  955|       |                                /* Invalid max LT ref index */
  956|      0|                                return -1;
  957|      0|                            }
  958|     39|                            ps_mmc_params->u4_max_lt_idx_plus1 = u4_max_lt_idx_plus1;
  959|     39|                            break;
  960|     39|                        }
  961|      1|                        case RESET_REF_PICTURES:
  ------------------
  |  |   48|      1|#define RESET_REF_PICTURES          5
  ------------------
  |  Branch (961:25): [True: 1, False: 260]
  ------------------
  962|      1|                        {
  963|      1|                            ps_slice->u1_mmco_equalto5 = 1;
  964|      1|                            break;
  965|     39|                        }
  966|       |
  967|      6|                        case SET_LT_INDEX:
  ------------------
  |  |   49|      6|#define SET_LT_INDEX                6
  ------------------
  |  Branch (967:25): [True: 6, False: 255]
  ------------------
  968|      6|                            u4_lt_idx = ih264d_uev(pu4_bitstrm_ofst,
  969|      6|                                                   pu4_bitstrm_buf);
  970|      6|                            ps_mmc_params->u4_lt_idx = u4_lt_idx;
  971|      6|                            break;
  972|       |
  973|    161|                        default:
  ------------------
  |  Branch (973:25): [True: 161, False: 100]
  ------------------
  974|    161|                            break;
  975|    261|                    }
  976|    261|                    u4_mmco = ih264d_uev(pu4_bitstrm_ofst,
  977|    261|                                         pu4_bitstrm_buf);
  978|       |
  979|    261|                    j++;
  980|    261|                }
  981|     39|                ps_dpb_cmds->u1_num_of_commands = j;
  982|     39|            }
  983|     81|        }
  984|  4.27k|        ps_dpb_cmds->u1_dpb_commands_read = 1;
  985|  4.27k|        ps_dpb_cmds->u1_dpb_commands_read_slc = 1;
  986|       |
  987|  4.27k|    }
  988|      0|    u4_bit_ofst = ps_dec->ps_bitstrm->u4_ofst - u4_bit_ofst;
  989|  4.27k|    return u4_bit_ofst;
  990|  4.28k|}
ih264d_do_mmco_buffer:
 1017|     57|{
 1018|     57|    WORD32 i;
 1019|     57|    UWORD8 u1_buf_mode, u1_marked_lt;
 1020|     57|    struct dpb_info_t *ps_next_dpb;
 1021|     57|    UWORD8 u1_num_gaps;
 1022|     57|    UWORD8 u1_del_node = 1;
 1023|     57|    UWORD8 u1_insert_st_pic = 1;
 1024|     57|    WORD32 ret;
 1025|     57|    UNUSED(u1_nal_unit_type);
  ------------------
  |  |   45|     57|#define UNUSED(x) ((void)(x))
  ------------------
 1026|     57|    UNUSED(u2_u4_max_pic_num_minus1);
  ------------------
  |  |   45|     57|#define UNUSED(x) ((void)(x))
  ------------------
 1027|     57|    u1_buf_mode = ps_dpb_cmds->u1_buf_mode; //0 - sliding window; 1 - Adaptive
 1028|     57|    u1_marked_lt = 0;
 1029|     57|    u1_num_gaps = ps_dpb_mgr->u1_num_gaps;
 1030|       |
 1031|     57|    if(!u1_buf_mode)
  ------------------
  |  Branch (1031:8): [True: 22, False: 35]
  ------------------
 1032|     22|    {
 1033|       |        //Sliding window - implements 8.2.5.3
 1034|     22|        if((ps_dpb_mgr->u1_num_st_ref_bufs
  ------------------
  |  Branch (1034:12): [True: 1, False: 21]
  ------------------
 1035|     22|                        + ps_dpb_mgr->u1_num_lt_ref_bufs + u1_num_gaps)
 1036|     22|                        == u1_numRef_frames_for_seq)
 1037|      1|        {
 1038|      1|            UWORD8 u1_new_node_flag = 1;
 1039|      1|            if((0 == ps_dpb_mgr->u1_num_st_ref_bufs) && (0 == u1_num_gaps))
  ------------------
  |  Branch (1039:16): [True: 0, False: 1]
  |  Branch (1039:57): [True: 0, False: 0]
  ------------------
 1040|      0|            {
 1041|      0|                UWORD32 i4_error_code;
 1042|      0|                i4_error_code = ERROR_DBP_MANAGER_T;
 1043|      0|                return i4_error_code;
 1044|      0|            }
 1045|       |
 1046|       |            // Chase the links to reach the last but one picNum, if available
 1047|      1|            ps_next_dpb = ps_dpb_mgr->ps_dpb_st_head;
 1048|       |
 1049|      1|            if(ps_dpb_mgr->u1_num_st_ref_bufs > 1)
  ------------------
  |  Branch (1049:16): [True: 1, False: 0]
  ------------------
 1050|      1|            {
 1051|      1|                if(ps_next_dpb->i4_frame_num == (WORD32)u4_cur_pic_num)
  ------------------
  |  Branch (1051:20): [True: 0, False: 1]
  ------------------
 1052|      0|                {
 1053|       |                    /* Incase of  filed pictures top_field has been allocated   */
 1054|       |                    /* picture buffer and complementary bottom field pair comes */
 1055|       |                    /* then the sliding window mechanism should not allocate a  */
 1056|       |                    /* new node                                                 */
 1057|      0|                    u1_new_node_flag = 0;
 1058|      0|                }
 1059|       |
 1060|      1|                for(i = 1; i < (ps_dpb_mgr->u1_num_st_ref_bufs - 1); i++)
  ------------------
  |  Branch (1060:28): [True: 0, False: 1]
  ------------------
 1061|      0|                {
 1062|      0|                    if(ps_next_dpb == NULL)
  ------------------
  |  Branch (1062:24): [True: 0, False: 0]
  ------------------
 1063|      0|                    {
 1064|      0|                        UWORD32 i4_error_code;
 1065|      0|                        i4_error_code = ERROR_DBP_MANAGER_T;
 1066|      0|                        return i4_error_code;
 1067|      0|                    }
 1068|      0|                    if(ps_next_dpb->i4_frame_num == (WORD32)u4_cur_pic_num)
  ------------------
  |  Branch (1068:24): [True: 0, False: 0]
  ------------------
 1069|      0|                    {
 1070|       |                        /* Incase of  field pictures top_field has been allocated   */
 1071|       |                        /* picture buffer and complementary bottom field pair comes */
 1072|       |                        /* then the sliding window mechanism should not allocate a  */
 1073|       |                        /* new node                                                 */
 1074|      0|                        u1_new_node_flag = 0;
 1075|      0|                    }
 1076|      0|                    ps_next_dpb = ps_next_dpb->ps_prev_short;
 1077|      0|                }
 1078|       |
 1079|      1|                if(ps_next_dpb->ps_prev_short->ps_prev_short != NULL)
  ------------------
  |  Branch (1079:20): [True: 0, False: 1]
  ------------------
 1080|      0|                {
 1081|      0|                    UWORD32 i4_error_code;
 1082|      0|                    i4_error_code = ERROR_DBP_MANAGER_T;
 1083|      0|                    return i4_error_code;
 1084|      0|                }
 1085|       |
 1086|      1|                if(u1_new_node_flag)
  ------------------
  |  Branch (1086:20): [True: 1, False: 0]
  ------------------
 1087|      1|                {
 1088|      1|                    if(u1_num_gaps)
  ------------------
  |  Branch (1088:24): [True: 0, False: 1]
  ------------------
 1089|      0|                    {
 1090|      0|                        ret = ih264d_delete_gap_frm_sliding(ps_dpb_mgr,
 1091|      0|                                                            ps_next_dpb->ps_prev_short->i4_frame_num,
 1092|      0|                                                            &u1_del_node);
 1093|      0|                        if(ret != OK)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (1093:28): [True: 0, False: 0]
  ------------------
 1094|      0|                            return ret;
 1095|      0|                    }
 1096|       |
 1097|      1|                    if(u1_del_node)
  ------------------
  |  Branch (1097:24): [True: 1, False: 0]
  ------------------
 1098|      1|                    {
 1099|      1|                        ps_dpb_mgr->u1_num_st_ref_bufs--;
 1100|      1|                        ps_next_dpb->ps_prev_short->u1_used_as_ref =
 1101|      1|                                        UNUSED_FOR_REF;
  ------------------
  |  |  595|      1|#define UNUSED_FOR_REF 0
  ------------------
 1102|      1|                        ps_next_dpb->ps_prev_short->s_top_field.u1_reference_info =
 1103|      1|                                        UNUSED_FOR_REF;
  ------------------
  |  |  595|      1|#define UNUSED_FOR_REF 0
  ------------------
 1104|      1|                        ps_next_dpb->ps_prev_short->s_bot_field.u1_reference_info =
 1105|      1|                                        UNUSED_FOR_REF;
  ------------------
  |  |  595|      1|#define UNUSED_FOR_REF 0
  ------------------
 1106|      1|                        ih264d_free_ref_pic_mv_bufs(ps_dpb_mgr->pv_codec_handle,
 1107|      1|                                                    ps_next_dpb->ps_prev_short->u1_buf_id);
 1108|      1|                        ps_next_dpb->ps_prev_short->ps_pic_buf = NULL;
 1109|      1|                        ps_next_dpb->ps_prev_short = NULL;
 1110|      1|                    }
 1111|      1|                }
 1112|      1|            }
 1113|      0|            else
 1114|      0|            {
 1115|      0|                if(ps_dpb_mgr->u1_num_st_ref_bufs)
  ------------------
  |  Branch (1115:20): [True: 0, False: 0]
  ------------------
 1116|      0|                {
 1117|      0|                    ret = ih264d_delete_gap_frm_sliding(ps_dpb_mgr,
 1118|      0|                                                       ps_next_dpb->i4_frame_num,
 1119|      0|                                                       &u1_del_node);
 1120|      0|                    if(ret != OK)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (1120:24): [True: 0, False: 0]
  ------------------
 1121|      0|                        return ret;
 1122|      0|                    if((ps_next_dpb->i4_frame_num != (WORD32)u4_cur_pic_num)
  ------------------
  |  Branch (1122:24): [True: 0, False: 0]
  ------------------
 1123|      0|                                    && u1_del_node)
  ------------------
  |  Branch (1123:40): [True: 0, False: 0]
  ------------------
 1124|      0|                    {
 1125|      0|                        ps_dpb_mgr->u1_num_st_ref_bufs--;
 1126|      0|                        ps_next_dpb->u1_used_as_ref = FALSE;
  ------------------
  |  |  592|      0|#define FALSE   0
  ------------------
 1127|      0|                        ps_next_dpb->s_top_field.u1_reference_info =
 1128|      0|                                        UNUSED_FOR_REF;
  ------------------
  |  |  595|      0|#define UNUSED_FOR_REF 0
  ------------------
 1129|      0|                        ps_next_dpb->s_bot_field.u1_reference_info =
 1130|      0|                                        UNUSED_FOR_REF;
  ------------------
  |  |  595|      0|#define UNUSED_FOR_REF 0
  ------------------
 1131|      0|                        ih264d_free_ref_pic_mv_bufs(ps_dpb_mgr->pv_codec_handle,
 1132|      0|                                                    ps_next_dpb->u1_buf_id);
 1133|      0|                        ps_next_dpb->ps_pic_buf = NULL;
 1134|      0|                        ps_next_dpb->ps_prev_short = NULL;
 1135|      0|                        ps_dpb_mgr->ps_dpb_st_head = NULL;
 1136|      0|                        ps_next_dpb = NULL;
 1137|      0|                    }
 1138|      0|                    else if(ps_next_dpb->i4_frame_num == (WORD32)u4_cur_pic_num)
  ------------------
  |  Branch (1138:29): [True: 0, False: 0]
  ------------------
 1139|      0|                    {
 1140|      0|                        if(u1_curr_pic_in_err)
  ------------------
  |  Branch (1140:28): [True: 0, False: 0]
  ------------------
 1141|      0|                        {
 1142|      0|                            u1_insert_st_pic = 0;
 1143|      0|                        }
 1144|      0|                        else if(ps_dpb_mgr->u1_num_st_ref_bufs > 0)
  ------------------
  |  Branch (1144:33): [True: 0, False: 0]
  ------------------
 1145|      0|                        {
 1146|      0|                            ps_dpb_mgr->u1_num_st_ref_bufs--;
 1147|      0|                            ps_next_dpb->u1_used_as_ref = FALSE;
  ------------------
  |  |  592|      0|#define FALSE   0
  ------------------
 1148|      0|                            ps_next_dpb->s_top_field.u1_reference_info =
 1149|      0|                                            UNUSED_FOR_REF;
  ------------------
  |  |  595|      0|#define UNUSED_FOR_REF 0
  ------------------
 1150|      0|                            ps_next_dpb->s_bot_field.u1_reference_info =
 1151|      0|                                            UNUSED_FOR_REF;
  ------------------
  |  |  595|      0|#define UNUSED_FOR_REF 0
  ------------------
 1152|      0|                            ih264d_free_ref_pic_mv_bufs(ps_dpb_mgr->pv_codec_handle,
 1153|      0|                                                        ps_next_dpb->u1_buf_id);
 1154|      0|                            ps_next_dpb->ps_pic_buf = NULL;
 1155|      0|                            ps_next_dpb = NULL;
 1156|      0|                        }
 1157|      0|                    }
 1158|      0|                }
 1159|      0|                else
 1160|      0|                {
 1161|      0|                    ret = ih264d_delete_gap_frm_sliding(ps_dpb_mgr,
 1162|      0|                                                        INVALID_FRAME_NUM,
  ------------------
  |  |  601|      0|#define INVALID_FRAME_NUM       0x0fffffff
  ------------------
 1163|      0|                                                        &u1_del_node);
 1164|      0|                    if(ret != OK)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (1164:24): [True: 0, False: 0]
  ------------------
 1165|      0|                        return ret;
 1166|      0|                    if(u1_del_node)
  ------------------
  |  Branch (1166:24): [True: 0, False: 0]
  ------------------
 1167|      0|                    {
 1168|      0|                        UWORD32 i4_error_code;
 1169|      0|                        i4_error_code = ERROR_DBP_MANAGER_T;
 1170|      0|                        return i4_error_code;
 1171|      0|                    }
 1172|      0|                }
 1173|      0|            }
 1174|      1|        }
 1175|     22|    }
 1176|     35|    else
 1177|     35|    {
 1178|       |        //Adaptive memory control - implements 8.2.5.4
 1179|     35|        UWORD32 u4_mmco;
 1180|     35|        UWORD32 u4_diff_pic_num;
 1181|     35|        WORD32 i4_pic_num;
 1182|     35|        UWORD32 u4_lt_idx;
 1183|     35|        WORD32 j;
 1184|     35|        struct MMCParams *ps_mmc_params;
 1185|       |
 1186|    181|        for(j = 0; j < ps_dpb_cmds->u1_num_of_commands; j++)
  ------------------
  |  Branch (1186:20): [True: 163, False: 18]
  ------------------
 1187|    163|        {
 1188|    163|            ps_mmc_params = &ps_dpb_cmds->as_mmc_params[j];
 1189|    163|            u4_mmco = ps_mmc_params->u4_mmco; //Get MMCO
 1190|       |
 1191|    163|            switch(u4_mmco)
 1192|    163|            {
 1193|     43|                case MARK_ST_PICNUM_AS_NONREF:
  ------------------
  |  |   44|     43|#define MARK_ST_PICNUM_AS_NONREF    1
  ------------------
  |  Branch (1193:17): [True: 43, False: 120]
  ------------------
 1194|     43|                {
 1195|       |
 1196|     43|                    {
 1197|     43|                        UWORD32 i4_cur_pic_num = u4_cur_pic_num;
 1198|     43|                        WORD64 i8_pic_num;
 1199|     43|                        u4_diff_pic_num = ps_mmc_params->u4_diff_pic_num; //Get absDiffPicnumMinus1
 1200|     43|                        if(u1_fld_pic_flag)
  ------------------
  |  Branch (1200:28): [True: 0, False: 43]
  ------------------
 1201|      0|                            i4_cur_pic_num = i4_cur_pic_num * 2 + 1;
 1202|     43|                        i8_pic_num = ((WORD64)i4_cur_pic_num - ((WORD64)u4_diff_pic_num + 1));
 1203|     43|                        if(IS_OUT_OF_RANGE_S32(i8_pic_num))
  ------------------
  |  |   58|     43|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 3, False: 40]
  |  |  |  Branch (58:54): [True: 0, False: 40]
  |  |  ------------------
  ------------------
 1204|      3|                        {
 1205|      3|                            return ERROR_DBP_MANAGER_T;
 1206|      3|                        }
 1207|     40|                        i4_pic_num = i8_pic_num;
 1208|     40|                    }
 1209|       |
 1210|     40|                    if(ps_dpb_mgr->u1_num_st_ref_bufs > 0)
  ------------------
  |  Branch (1210:24): [True: 5, False: 35]
  ------------------
 1211|      5|                    {
 1212|      5|                        ret = ih264d_delete_st_node_or_make_lt(ps_dpb_mgr,
 1213|      5|                                                               i4_pic_num,
 1214|      5|                                                               MAX_REF_BUFS + 1,
  ------------------
  |  |   75|      5|#define MAX_REF_BUFS    32
  ------------------
 1215|      5|                                                               u1_fld_pic_flag);
 1216|      5|                        if(ret != OK)
  ------------------
  |  |  114|      5|#define OK        0
  ------------------
  |  Branch (1216:28): [True: 4, False: 1]
  ------------------
 1217|      4|                            return ret;
 1218|      5|                    }
 1219|     35|                    else
 1220|     35|                    {
 1221|     35|                        UWORD8 u1_dummy;
 1222|     35|                        ret = ih264d_delete_gap_frm_mmco(ps_dpb_mgr, i4_pic_num, &u1_dummy);
 1223|     35|                        if(ret != OK)
  ------------------
  |  |  114|     35|#define OK        0
  ------------------
  |  Branch (1223:28): [True: 0, False: 35]
  ------------------
 1224|      0|                            return ret;
 1225|     35|                    }
 1226|     36|                    break;
 1227|     40|                }
 1228|     43|                case MARK_LT_INDEX_AS_NONREF:
  ------------------
  |  |   45|     43|#define MARK_LT_INDEX_AS_NONREF     2
  ------------------
  |  Branch (1228:17): [True: 43, False: 120]
  ------------------
 1229|     43|                {
 1230|     43|                    WORD32 i4_status;
 1231|     43|                    u4_lt_idx = ps_mmc_params->u4_lt_idx; //Get long term index
 1232|     43|                    ret = ih264d_delete_lt_node(ps_dpb_mgr,
 1233|     43|                                                u4_lt_idx,
 1234|     43|                                                u1_fld_pic_flag,
 1235|     43|                                                0, &i4_status);
 1236|     43|                    if(ret != OK)
  ------------------
  |  |  114|     43|#define OK        0
  ------------------
  |  Branch (1236:24): [True: 0, False: 43]
  ------------------
 1237|      0|                        return ret;
 1238|     43|                    if(i4_status)
  ------------------
  |  Branch (1238:24): [True: 1, False: 42]
  ------------------
 1239|      1|                    {
 1240|      1|                        UWORD32 i4_error_code;
 1241|      1|                        i4_error_code = ERROR_DBP_MANAGER_T;
 1242|      1|                        return i4_error_code;
 1243|      1|                    }
 1244|     42|                    break;
 1245|     43|                }
 1246|       |
 1247|     42|                case MARK_ST_PICNUM_AS_LT_INDEX:
  ------------------
  |  |   46|     16|#define MARK_ST_PICNUM_AS_LT_INDEX  3
  ------------------
  |  Branch (1247:17): [True: 16, False: 147]
  ------------------
 1248|     16|                {
 1249|     16|                    {
 1250|     16|                        UWORD32 i4_cur_pic_num = u4_cur_pic_num;
 1251|     16|                        WORD64 i8_pic_num;
 1252|     16|                        u4_diff_pic_num = ps_mmc_params->u4_diff_pic_num; //Get absDiffPicnumMinus1
 1253|     16|                        if(u1_fld_pic_flag)
  ------------------
  |  Branch (1253:28): [True: 0, False: 16]
  ------------------
 1254|      0|                            i4_cur_pic_num = i4_cur_pic_num * 2 + 1;
 1255|       |
 1256|     16|                        i8_pic_num = (WORD64)i4_cur_pic_num - ((WORD64)u4_diff_pic_num + 1);
 1257|     16|                        if(IS_OUT_OF_RANGE_S32(i8_pic_num))
  ------------------
  |  |   58|     16|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 16]
  |  |  |  Branch (58:54): [True: 0, False: 16]
  |  |  ------------------
  ------------------
 1258|      0|                        {
 1259|      0|                            return ERROR_DBP_MANAGER_T;
 1260|      0|                        }
 1261|     16|                        i4_pic_num = i8_pic_num;
 1262|     16|                    }
 1263|       |
 1264|      0|                    u4_lt_idx = ps_mmc_params->u4_lt_idx; //Get long term index
 1265|       |
 1266|     16|                    if((ps_dpb_mgr->u1_max_lt_frame_idx == NO_LONG_TERM_INDICIES) ||
  ------------------
  |  |   53|     16|#define NO_LONG_TERM_INDICIES      255
  ------------------
  |  Branch (1266:24): [True: 0, False: 16]
  ------------------
 1267|     16|                        (u4_lt_idx > ps_dpb_mgr->u1_max_lt_frame_idx))
  ------------------
  |  Branch (1267:25): [True: 9, False: 7]
  ------------------
 1268|      9|                    {
 1269|      9|                        return ERROR_DBP_MANAGER_T;
 1270|      9|                    }
 1271|       |
 1272|      7|                    if(ps_dpb_mgr->u1_num_st_ref_bufs > 0)
  ------------------
  |  Branch (1272:24): [True: 0, False: 7]
  ------------------
 1273|      0|                    {
 1274|      0|                        ret = ih264d_delete_st_node_or_make_lt(ps_dpb_mgr,
 1275|      0|                                                               i4_pic_num, u4_lt_idx,
 1276|      0|                                                               u1_fld_pic_flag);
 1277|      0|                        if(ret != OK)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (1277:28): [True: 0, False: 0]
  ------------------
 1278|      0|                            return ret;
 1279|      0|                    }
 1280|      7|                    break;
 1281|      7|                }
 1282|     24|                case SET_MAX_LT_INDEX:
  ------------------
  |  |   47|     24|#define SET_MAX_LT_INDEX            4
  ------------------
  |  Branch (1282:17): [True: 24, False: 139]
  ------------------
 1283|     24|                {
 1284|     24|                    UWORD8 uc_numLT = ps_dpb_mgr->u1_num_lt_ref_bufs;
 1285|     24|                    u4_lt_idx = ps_mmc_params->u4_max_lt_idx_plus1; //Get Max_long_term_index_plus1
 1286|     24|                    if(u4_lt_idx <= ps_dpb_mgr->u1_max_lt_frame_idx
  ------------------
  |  Branch (1286:24): [True: 8, False: 16]
  ------------------
 1287|      8|                                    && uc_numLT > 0)
  ------------------
  |  Branch (1287:40): [True: 7, False: 1]
  ------------------
 1288|      7|                    {
 1289|      7|                        struct dpb_info_t *ps_nxtDPB;
 1290|       |                        //Set all LT buffers with index >= u4_lt_idx to nonreference
 1291|      7|                        ps_nxtDPB = ps_dpb_mgr->ps_dpb_ht_head;
 1292|      7|                        ps_next_dpb = ps_nxtDPB->ps_prev_long;
 1293|      7|                        if(ps_nxtDPB->u1_lt_idx >= u4_lt_idx)
  ------------------
  |  Branch (1293:28): [True: 6, False: 1]
  ------------------
 1294|      6|                        {
 1295|      6|                            i = 0;
 1296|      6|                            ps_dpb_mgr->ps_dpb_ht_head = NULL;
 1297|      6|                        }
 1298|      1|                        else
 1299|      1|                        {
 1300|      1|                            for(i = 1; i < uc_numLT; i++)
  ------------------
  |  Branch (1300:40): [True: 1, False: 0]
  ------------------
 1301|      1|                            {
 1302|      1|                                if(ps_next_dpb->u1_lt_idx >= u4_lt_idx)
  ------------------
  |  Branch (1302:36): [True: 1, False: 0]
  ------------------
 1303|      1|                                    break;
 1304|      0|                                ps_nxtDPB = ps_next_dpb;
 1305|      0|                                ps_next_dpb = ps_next_dpb->ps_prev_long;
 1306|      0|                            }
 1307|      1|                            ps_nxtDPB->ps_prev_long = NULL; //Terminate the link of the closest LTIndex that is <=Max
 1308|      1|                        }
 1309|      7|                        ps_dpb_mgr->u1_num_lt_ref_bufs = i;
 1310|      7|                        if(i == 0)
  ------------------
  |  Branch (1310:28): [True: 6, False: 1]
  ------------------
 1311|      6|                            ps_next_dpb = ps_nxtDPB;
 1312|       |
 1313|     15|                        for(; i < uc_numLT; i++)
  ------------------
  |  Branch (1313:31): [True: 8, False: 7]
  ------------------
 1314|      8|                        {
 1315|      8|                            ps_nxtDPB = ps_next_dpb;
 1316|      8|                            ps_nxtDPB->u1_lt_idx = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|      8|#define MAX_REF_BUFS    32
  ------------------
 1317|      8|                            ps_nxtDPB->u1_used_as_ref = UNUSED_FOR_REF;
  ------------------
  |  |  595|      8|#define UNUSED_FOR_REF 0
  ------------------
 1318|      8|                            ps_nxtDPB->s_top_field.u1_reference_info =
 1319|      8|                                            UNUSED_FOR_REF;
  ------------------
  |  |  595|      8|#define UNUSED_FOR_REF 0
  ------------------
 1320|      8|                            ps_nxtDPB->s_bot_field.u1_reference_info =
 1321|      8|                                            UNUSED_FOR_REF;
  ------------------
  |  |  595|      8|#define UNUSED_FOR_REF 0
  ------------------
 1322|       |
 1323|      8|                            ps_nxtDPB->ps_pic_buf = NULL;
 1324|       |                            //Release buffer
 1325|      8|                            ih264d_free_ref_pic_mv_bufs(ps_dpb_mgr->pv_codec_handle,
 1326|      8|                                                        ps_nxtDPB->u1_buf_id);
 1327|      8|                            ps_next_dpb = ps_nxtDPB->ps_prev_long;
 1328|      8|                            ps_nxtDPB->ps_prev_long = NULL;
 1329|      8|                        }
 1330|      7|                    }
 1331|     24|                    if(u4_lt_idx == 0)
  ------------------
  |  Branch (1331:24): [True: 0, False: 24]
  ------------------
 1332|      0|                    {
 1333|      0|                        ps_dpb_mgr->u1_max_lt_frame_idx = NO_LONG_TERM_INDICIES;
  ------------------
  |  |   53|      0|#define NO_LONG_TERM_INDICIES      255
  ------------------
 1334|      0|                    }
 1335|     24|                    else
 1336|     24|                    {
 1337|     24|                        ps_dpb_mgr->u1_max_lt_frame_idx = u4_lt_idx - 1;
 1338|     24|                    }
 1339|       |
 1340|     24|                    break;
 1341|      7|                }
 1342|     10|                case SET_LT_INDEX:
  ------------------
  |  |   49|     10|#define SET_LT_INDEX                6
  ------------------
  |  Branch (1342:17): [True: 10, False: 153]
  ------------------
 1343|     10|                {
 1344|     10|                    u4_lt_idx = ps_mmc_params->u4_lt_idx; //Get long term index
 1345|     10|                    if((ps_dpb_mgr->u1_max_lt_frame_idx == NO_LONG_TERM_INDICIES) ||
  ------------------
  |  |   53|     10|#define NO_LONG_TERM_INDICIES      255
  ------------------
  |  Branch (1345:24): [True: 0, False: 10]
  ------------------
 1346|     10|                        (u4_lt_idx > ps_dpb_mgr->u1_max_lt_frame_idx))
  ------------------
  |  Branch (1346:25): [True: 0, False: 10]
  ------------------
 1347|      0|                    {
 1348|      0|                        return ERROR_DBP_MANAGER_T;
 1349|      0|                    }
 1350|     10|                    ret = ih264d_insert_st_node(ps_dpb_mgr, ps_pic_buf, u1_buf_id,
 1351|     10|                                          u4_cur_pic_num);
 1352|     10|                    if(ret != OK)
  ------------------
  |  |  114|     10|#define OK        0
  ------------------
  |  Branch (1352:24): [True: 0, False: 10]
  ------------------
 1353|      0|                        return ret;
 1354|       |
 1355|     10|                    if(ps_dpb_mgr->u1_num_st_ref_bufs > 0)
  ------------------
  |  Branch (1355:24): [True: 10, False: 0]
  ------------------
 1356|       |
 1357|     10|                    {
 1358|     10|                        ret = ih264d_delete_st_node_or_make_lt(ps_dpb_mgr,
 1359|     10|                                                               u4_cur_pic_num,
 1360|     10|                                                               u4_lt_idx,
 1361|     10|                                                               u1_fld_pic_flag);
 1362|     10|                        if(ret != OK)
  ------------------
  |  |  114|     10|#define OK        0
  ------------------
  |  Branch (1362:28): [True: 0, False: 10]
  ------------------
 1363|      0|                            return ret;
 1364|     10|                    }
 1365|      0|                    else
 1366|      0|                    {
 1367|      0|                        return ERROR_DBP_MANAGER_T;
 1368|      0|                    }
 1369|       |
 1370|     10|                    u1_marked_lt = 1;
 1371|     10|                    break;
 1372|     10|                }
 1373|       |
 1374|     27|                default:
  ------------------
  |  Branch (1374:17): [True: 27, False: 136]
  ------------------
 1375|     27|                    break;
 1376|    163|            }
 1377|    146|            if(u4_mmco == RESET_REF_PICTURES || u4_mmco == RESET_ALL_PICTURES)
  ------------------
  |  |   48|    292|#define RESET_REF_PICTURES          5
  ------------------
                          if(u4_mmco == RESET_REF_PICTURES || u4_mmco == RESET_ALL_PICTURES)
  ------------------
  |  |   51|    146|#define RESET_ALL_PICTURES          8
  ------------------
  |  Branch (1377:16): [True: 0, False: 146]
  |  Branch (1377:49): [True: 0, False: 146]
  ------------------
 1378|      0|            {
 1379|      0|                ih264d_reset_ref_bufs(ps_dpb_mgr);
 1380|      0|                u4_cur_pic_num = 0;
 1381|      0|            }
 1382|    146|        }
 1383|     35|    }
 1384|     40|    if(!u1_marked_lt && u1_insert_st_pic)
  ------------------
  |  Branch (1384:8): [True: 30, False: 10]
  |  Branch (1384:25): [True: 30, False: 0]
  ------------------
 1385|     30|    {
 1386|     30|        ret = ih264d_insert_st_node(ps_dpb_mgr, ps_pic_buf, u1_buf_id,
 1387|     30|                              u4_cur_pic_num);
 1388|     30|        if(ret != OK)
  ------------------
  |  |  114|     30|#define OK        0
  ------------------
  |  Branch (1388:12): [True: 0, False: 30]
  ------------------
 1389|      0|            return ret;
 1390|     30|    }
 1391|     40|    return OK;
  ------------------
  |  |  114|     40|#define OK        0
  ------------------
 1392|     40|}
ih264d_delete_gap_frm_mmco:
 1614|     35|{
 1615|     35|    WORD8 i, j;
 1616|     35|    WORD32 *pi4_start, *pi4_end;
 1617|     35|    WORD32 i4_start_frm_num, i4_end_frm_num, i4_max_frm_num;
 1618|       |
 1619|       |    /* find the least frame num from gaps and current DPB node    */
 1620|       |    /* Delete the gaps                                            */
 1621|     35|    *pu1_del_node = 1;
 1622|     35|    pi4_start = ps_dpb_mgr->ai4_gaps_start_frm_num;
 1623|     35|    pi4_end = ps_dpb_mgr->ai4_gaps_end_frm_num;
 1624|     35|    i4_max_frm_num = ps_dpb_mgr->i4_max_frm_num;
 1625|       |
 1626|     35|    if(0 == ps_dpb_mgr->u1_num_gaps)
  ------------------
  |  Branch (1626:8): [True: 35, False: 0]
  ------------------
 1627|     35|        return OK;
  ------------------
  |  |  114|     35|#define OK        0
  ------------------
 1628|       |
 1629|      0|    if(i4_frame_num < 0)
  ------------------
  |  Branch (1629:8): [True: 0, False: 0]
  ------------------
 1630|      0|        i4_frame_num += i4_max_frm_num;
 1631|      0|    for(i = 0; i < MAX_FRAMES; i++)
  ------------------
  |  |  600|      0|#define MAX_FRAMES              16
  ------------------
  |  Branch (1631:16): [True: 0, False: 0]
  ------------------
 1632|      0|    {
 1633|      0|        i4_start_frm_num = pi4_start[i];
 1634|      0|        if(i4_start_frm_num < 0)
  ------------------
  |  Branch (1634:12): [True: 0, False: 0]
  ------------------
 1635|      0|            i4_start_frm_num += i4_max_frm_num;
 1636|      0|        if(INVALID_FRAME_NUM != i4_start_frm_num)
  ------------------
  |  |  601|      0|#define INVALID_FRAME_NUM       0x0fffffff
  ------------------
  |  Branch (1636:12): [True: 0, False: 0]
  ------------------
 1637|      0|        {
 1638|      0|            i4_end_frm_num = pi4_end[i];
 1639|      0|            if(i4_end_frm_num < 0)
  ------------------
  |  Branch (1639:16): [True: 0, False: 0]
  ------------------
 1640|      0|                i4_end_frm_num += i4_max_frm_num;
 1641|       |
 1642|      0|            if((i4_frame_num >= i4_start_frm_num)
  ------------------
  |  Branch (1642:16): [True: 0, False: 0]
  ------------------
 1643|      0|                            && (i4_frame_num <= i4_end_frm_num))
  ------------------
  |  Branch (1643:32): [True: 0, False: 0]
  ------------------
 1644|      0|            {
 1645|      0|                break;
 1646|      0|            }
 1647|      0|            else
 1648|      0|            {
 1649|      0|                if(((i4_frame_num + i4_max_frm_num) >= i4_start_frm_num)
  ------------------
  |  Branch (1649:20): [True: 0, False: 0]
  ------------------
 1650|      0|                                && ((i4_frame_num + i4_max_frm_num)
  ------------------
  |  Branch (1650:36): [True: 0, False: 0]
  ------------------
 1651|      0|                                                <= i4_end_frm_num))
 1652|      0|                {
 1653|      0|                    UWORD32 i4_error_code;
 1654|      0|                    i4_error_code = ERROR_DBP_MANAGER_T;
 1655|      0|                    return i4_error_code;
 1656|      0|                }
 1657|      0|            }
 1658|      0|        }
 1659|      0|    }
 1660|       |
 1661|       |    /* find frame_num index, in the poc_map which needs to be deleted */
 1662|      0|    for(j = 0; j < MAX_FRAMES; j++)
  ------------------
  |  |  600|      0|#define MAX_FRAMES              16
  ------------------
  |  Branch (1662:16): [True: 0, False: 0]
  ------------------
 1663|      0|    {
 1664|      0|        if(i4_frame_num == ps_dpb_mgr->ai4_poc_buf_id_map[j][2])
  ------------------
  |  Branch (1664:12): [True: 0, False: 0]
  ------------------
 1665|      0|            break;
 1666|      0|    }
 1667|       |
 1668|      0|    if(MAX_FRAMES != i)
  ------------------
  |  |  600|      0|#define MAX_FRAMES              16
  ------------------
  |  Branch (1668:8): [True: 0, False: 0]
  ------------------
 1669|      0|    {
 1670|      0|        if(j == MAX_FRAMES)
  ------------------
  |  |  600|      0|#define MAX_FRAMES              16
  ------------------
  |  Branch (1670:12): [True: 0, False: 0]
  ------------------
 1671|      0|        {
 1672|      0|            UWORD32 i4_error_code;
 1673|      0|            i4_error_code = ERROR_DBP_MANAGER_T;
 1674|      0|            return i4_error_code;
 1675|      0|        }
 1676|       |
 1677|      0|        ps_dpb_mgr->ai4_poc_buf_id_map[j][0] = -1;
 1678|      0|        ps_dpb_mgr->ai4_poc_buf_id_map[j][1] = 0x7fffffff;
 1679|      0|        ps_dpb_mgr->ai4_poc_buf_id_map[j][2] = GAP_FRAME_NUM;
  ------------------
  |  |   80|      0|#define GAP_FRAME_NUM           0x1fffffff
  ------------------
 1680|      0|        ps_dpb_mgr->i1_gaps_deleted++;
 1681|       |
 1682|      0|        ps_dpb_mgr->ai1_gaps_per_seq[i]--;
 1683|      0|        ps_dpb_mgr->u1_num_gaps--;
 1684|      0|        *pu1_del_node = 0;
 1685|      0|        if(0 == ps_dpb_mgr->ai1_gaps_per_seq[i])
  ------------------
  |  Branch (1685:12): [True: 0, False: 0]
  ------------------
 1686|      0|        {
 1687|      0|            ps_dpb_mgr->ai4_gaps_start_frm_num[i] = INVALID_FRAME_NUM;
  ------------------
  |  |  601|      0|#define INVALID_FRAME_NUM       0x0fffffff
  ------------------
 1688|      0|            ps_dpb_mgr->ai4_gaps_end_frm_num[i] = 0;
 1689|      0|        }
 1690|      0|    }
 1691|      0|    else
 1692|      0|    {
 1693|      0|        UWORD32 i4_error_code;
 1694|      0|        i4_error_code = ERROR_DBP_MANAGER_T;
 1695|      0|        return i4_error_code;
 1696|      0|    }
 1697|       |
 1698|      0|    return OK;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
 1699|      0|}
ih264d_delete_nonref_nondisplay_pics:
 2006|  6.30k|{
 2007|  6.30k|    WORD8 i;
 2008|  6.30k|    WORD32 (*i4_poc_buf_id_map)[3] = ps_dpb_mgr->ai4_poc_buf_id_map;
 2009|       |
 2010|       |    /* remove all gaps marked as unused for ref */
 2011|  6.30k|    for(i = 0; (i < MAX_FRAMES) && ps_dpb_mgr->i1_gaps_deleted; i++)
  ------------------
  |  |  600|  6.30k|#define MAX_FRAMES              16
  ------------------
  |  Branch (2011:16): [True: 6.30k, False: 0]
  |  Branch (2011:36): [True: 0, False: 6.30k]
  ------------------
 2012|      0|    {
 2013|      0|        if(GAP_FRAME_NUM == i4_poc_buf_id_map[i][2])
  ------------------
  |  |   80|      0|#define GAP_FRAME_NUM           0x1fffffff
  ------------------
  |  Branch (2013:12): [True: 0, False: 0]
  ------------------
 2014|      0|        {
 2015|      0|            ps_dpb_mgr->i1_gaps_deleted--;
 2016|      0|            ps_dpb_mgr->i1_poc_buf_id_entries--;
 2017|      0|            i4_poc_buf_id_map[i][0] = -1;
 2018|      0|            i4_poc_buf_id_map[i][1] = 0x7fffffff;
 2019|      0|            i4_poc_buf_id_map[i][2] = 0;
 2020|      0|        }
 2021|      0|    }
 2022|  6.30k|}
ih264d_insert_pic_in_display_list:
 2050|  3.42k|{
 2051|  3.42k|    WORD8 i;
 2052|  3.42k|    WORD32 (*i4_poc_buf_id_map)[3] = ps_dpb_mgr->ai4_poc_buf_id_map;
 2053|       |
 2054|  6.88k|    for(i = 0; i < MAX_FRAMES; i++)
  ------------------
  |  |  600|  6.88k|#define MAX_FRAMES              16
  ------------------
  |  Branch (2054:16): [True: 6.88k, False: 0]
  ------------------
 2055|  6.88k|    {
 2056|       |        /* Find an empty slot */
 2057|  6.88k|        if(i4_poc_buf_id_map[i][0] == -1)
  ------------------
  |  Branch (2057:12): [True: 3.42k, False: 3.46k]
  ------------------
 2058|  3.42k|        {
 2059|  3.42k|            if(GAP_FRAME_NUM == i4_poc_buf_id_map[i][2])
  ------------------
  |  |   80|  3.42k|#define GAP_FRAME_NUM           0x1fffffff
  ------------------
  |  Branch (2059:16): [True: 0, False: 3.42k]
  ------------------
 2060|      0|                ps_dpb_mgr->i1_gaps_deleted--;
 2061|  3.42k|            else
 2062|  3.42k|                ps_dpb_mgr->i1_poc_buf_id_entries++;
 2063|       |
 2064|  3.42k|            i4_poc_buf_id_map[i][0] = u1_buf_id;
 2065|  3.42k|            i4_poc_buf_id_map[i][1] = i4_display_poc;
 2066|  3.42k|            i4_poc_buf_id_map[i][2] = u4_frame_num;
 2067|       |
 2068|  3.42k|            break;
 2069|  3.42k|        }
 2070|  6.88k|    }
 2071|       |
 2072|  3.42k|    if(MAX_FRAMES == i)
  ------------------
  |  |  600|  3.42k|#define MAX_FRAMES              16
  ------------------
  |  Branch (2072:8): [True: 0, False: 3.42k]
  ------------------
 2073|      0|    {
 2074|       |
 2075|      0|        UWORD32 i4_error_code;
 2076|      0|        i4_error_code = ERROR_GAPS_IN_FRM_NUM;
 2077|      0|        return i4_error_code;
 2078|      0|    }
 2079|  3.42k|    return OK;
  ------------------
  |  |  114|  3.42k|#define OK        0
  ------------------
 2080|  3.42k|}

ih264d_fmt_conv_420sp_to_420sp:
  383|  2.94k|{
  384|  2.94k|    UWORD8 *pu1_src, *pu1_dst;
  385|  2.94k|    WORD32 num_rows, num_cols, src_strd, dst_strd;
  386|  2.94k|    WORD32 i;
  387|       |
  388|       |    /* copy luma */
  389|  2.94k|    pu1_src = (UWORD8 *)pu1_y_src;
  390|  2.94k|    pu1_dst = (UWORD8 *)pu1_y_dst;
  391|       |
  392|  2.94k|    num_rows = ht;
  393|  2.94k|    num_cols = wd;
  394|       |
  395|  2.94k|    src_strd = src_y_strd;
  396|  2.94k|    dst_strd = dst_y_strd;
  397|       |
  398|   393k|    for(i = 0; i < num_rows; i++)
  ------------------
  |  Branch (398:16): [True: 390k, False: 2.94k]
  ------------------
  399|   390k|    {
  400|   390k|        memcpy(pu1_dst, pu1_src, num_cols);
  401|   390k|        pu1_dst += dst_strd;
  402|   390k|        pu1_src += src_strd;
  403|   390k|    }
  404|       |
  405|       |    /* copy U and V */
  406|  2.94k|    pu1_src = (UWORD8 *)pu1_uv_src;
  407|  2.94k|    pu1_dst = (UWORD8 *)pu1_uv_dst;
  408|       |
  409|  2.94k|    num_rows = ht >> 1;
  410|  2.94k|    num_cols = wd;
  411|       |
  412|  2.94k|    src_strd = src_uv_strd;
  413|  2.94k|    dst_strd = dst_uv_strd;
  414|       |
  415|   198k|    for(i = 0; i < num_rows; i++)
  ------------------
  |  Branch (415:16): [True: 195k, False: 2.94k]
  ------------------
  416|   195k|    {
  417|   195k|        memcpy(pu1_dst, pu1_src, num_cols);
  418|   195k|        pu1_dst += dst_strd;
  419|   195k|        pu1_src += src_strd;
  420|   195k|    }
  421|  2.94k|    return;
  422|  2.94k|}
ih264d_fmt_conv_420sp_to_420sp_swap_uv:
  480|    198|{
  481|    198|    UWORD8 *pu1_src, *pu1_dst;
  482|    198|    WORD32 num_rows, num_cols, src_strd, dst_strd;
  483|    198|    WORD32 i;
  484|       |
  485|       |    /* copy luma */
  486|    198|    pu1_src = (UWORD8 *)pu1_y_src;
  487|    198|    pu1_dst = (UWORD8 *)pu1_y_dst;
  488|       |
  489|    198|    num_rows = ht;
  490|    198|    num_cols = wd;
  491|       |
  492|    198|    src_strd = src_y_strd;
  493|    198|    dst_strd = dst_y_strd;
  494|       |
  495|  32.5k|    for(i = 0; i < num_rows; i++)
  ------------------
  |  Branch (495:16): [True: 32.3k, False: 198]
  ------------------
  496|  32.3k|    {
  497|  32.3k|        memcpy(pu1_dst, pu1_src, num_cols);
  498|  32.3k|        pu1_dst += dst_strd;
  499|  32.3k|        pu1_src += src_strd;
  500|  32.3k|    }
  501|       |
  502|       |    /* copy U and V */
  503|    198|    pu1_src = (UWORD8 *)pu1_uv_src;
  504|    198|    pu1_dst = (UWORD8 *)pu1_uv_dst;
  505|       |
  506|    198|    num_rows = ht >> 1;
  507|    198|    num_cols = wd;
  508|       |
  509|    198|    src_strd = src_uv_strd;
  510|    198|    dst_strd = dst_uv_strd;
  511|       |
  512|  16.3k|    for(i = 0; i < num_rows; i++)
  ------------------
  |  Branch (512:16): [True: 16.1k, False: 198]
  ------------------
  513|  16.1k|    {
  514|  16.1k|        WORD32 j;
  515|   670k|        for(j = 0; j < num_cols; j += 2)
  ------------------
  |  Branch (515:20): [True: 654k, False: 16.1k]
  ------------------
  516|   654k|        {
  517|   654k|            pu1_dst[j + 0] = pu1_src[j + 1];
  518|   654k|            pu1_dst[j + 1] = pu1_src[j + 0];
  519|   654k|        }
  520|  16.1k|        pu1_dst += dst_strd;
  521|  16.1k|        pu1_src += src_strd;
  522|  16.1k|    }
  523|    198|    return;
  524|    198|}
ih264d_fmt_conv_420sp_to_420p:
  591|    679|{
  592|    679|    UWORD8 *pu1_src, *pu1_dst;
  593|    679|    UWORD8 *pu1_u_src, *pu1_v_src;
  594|    679|    WORD32 num_rows, num_cols, src_strd, dst_strd;
  595|    679|    WORD32 i, j;
  596|       |
  597|    679|    if(0 == disable_luma_copy)
  ------------------
  |  Branch (597:8): [True: 679, False: 0]
  ------------------
  598|    679|    {
  599|       |        /* copy luma */
  600|    679|        pu1_src = (UWORD8 *)pu1_y_src;
  601|    679|        pu1_dst = (UWORD8 *)pu1_y_dst;
  602|       |
  603|    679|        num_rows = ht;
  604|    679|        num_cols = wd;
  605|       |
  606|    679|        src_strd = src_y_strd;
  607|    679|        dst_strd = dst_y_strd;
  608|       |
  609|   150k|        for(i = 0; i < num_rows; i++)
  ------------------
  |  Branch (609:20): [True: 149k, False: 679]
  ------------------
  610|   149k|        {
  611|   149k|            memcpy(pu1_dst, pu1_src, num_cols);
  612|   149k|            pu1_dst += dst_strd;
  613|   149k|            pu1_src += src_strd;
  614|   149k|        }
  615|    679|    }
  616|       |    /* de-interleave U and V and copy to destination */
  617|    679|    if(is_u_first)
  ------------------
  |  Branch (617:8): [True: 679, False: 0]
  ------------------
  618|    679|    {
  619|    679|        pu1_u_src = (UWORD8 *)pu1_uv_src;
  620|    679|        pu1_v_src = (UWORD8 *)pu1_uv_src + 1;
  621|    679|    }
  622|      0|    else
  623|      0|    {
  624|      0|        pu1_u_src = (UWORD8 *)pu1_uv_src + 1;
  625|      0|        pu1_v_src = (UWORD8 *)pu1_uv_src;
  626|      0|    }
  627|       |
  628|    679|    num_rows = ht >> 1;
  629|    679|    num_cols = wd >> 1;
  630|       |
  631|    679|    src_strd = src_uv_strd;
  632|    679|    dst_strd = dst_uv_strd;
  633|       |
  634|  75.6k|    for(i = 0; i < num_rows; i++)
  ------------------
  |  Branch (634:16): [True: 74.9k, False: 679]
  ------------------
  635|  74.9k|    {
  636|  5.11M|        for(j = 0; j < num_cols; j++)
  ------------------
  |  Branch (636:20): [True: 5.04M, False: 74.9k]
  ------------------
  637|  5.04M|        {
  638|  5.04M|            pu1_u_dst[j] = pu1_u_src[j * 2];
  639|  5.04M|            pu1_v_dst[j] = pu1_v_src[j * 2];
  640|  5.04M|        }
  641|       |
  642|  74.9k|        pu1_u_dst += dst_strd;
  643|  74.9k|        pu1_v_dst += dst_strd;
  644|  74.9k|        pu1_u_src += src_strd;
  645|  74.9k|        pu1_v_src += src_strd;
  646|  74.9k|    }
  647|    679|    return;
  648|    679|}
ih264d_format_convert:
  672|  3.82k|{
  673|  3.82k|    UWORD32 convert_uv_only = 0;
  674|  3.82k|    iv_yuv_buf_t *ps_op_frm;
  675|  3.82k|    UWORD8 *pu1_y_src, *pu1_uv_src;
  676|  3.82k|    UWORD32 start_uv = u4_start_y >> 1;
  677|       |
  678|  3.82k|    if(1 == pv_disp_op->u4_error_code)
  ------------------
  |  Branch (678:8): [True: 0, False: 3.82k]
  ------------------
  679|      0|        return;
  680|       |
  681|  3.82k|    ps_op_frm = &(ps_dec->s_disp_frame_info);
  682|       |
  683|       |    /* Requires u4_start_y and u4_num_rows_y to be even */
  684|  3.82k|    if(u4_start_y & 1)
  ------------------
  |  Branch (684:8): [True: 0, False: 3.82k]
  ------------------
  685|      0|    {
  686|      0|        return;
  687|      0|    }
  688|       |
  689|  3.82k|    if((1 == ps_dec->u4_share_disp_buf) &&
  ------------------
  |  Branch (689:8): [True: 0, False: 3.82k]
  ------------------
  690|      0|       (pv_disp_op->e_output_format == IV_YUV_420SP_UV))
  ------------------
  |  Branch (690:8): [True: 0, False: 0]
  ------------------
  691|      0|    {
  692|      0|        return;
  693|      0|    }
  694|       |
  695|  3.82k|    pu1_y_src = (UWORD8 *)ps_op_frm->pv_y_buf;
  696|  3.82k|    pu1_y_src += u4_start_y * ps_op_frm->u4_y_strd,
  697|       |
  698|  3.82k|    pu1_uv_src = (UWORD8 *)ps_op_frm->pv_u_buf;
  699|  3.82k|    pu1_uv_src += start_uv * ps_op_frm->u4_u_strd;
  700|       |
  701|  3.82k|    if(pv_disp_op->e_output_format == IV_YUV_420P)
  ------------------
  |  Branch (701:8): [True: 679, False: 3.14k]
  ------------------
  702|    679|    {
  703|    679|        UWORD8 *pu1_y_dst, *pu1_u_dst, *pu1_v_dst;
  704|    679|        IV_COLOR_FORMAT_T e_output_format = pv_disp_op->e_output_format;
  705|       |
  706|    679|        if(0 == ps_dec->u4_share_disp_buf)
  ------------------
  |  Branch (706:12): [True: 679, False: 0]
  ------------------
  707|    679|        {
  708|    679|            convert_uv_only = 0;
  709|    679|        }
  710|      0|        else
  711|      0|        {
  712|      0|            convert_uv_only = 1;
  713|      0|        }
  714|       |
  715|    679|        pu1_y_dst = (UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_y_buf;
  716|    679|        pu1_y_dst += u4_start_y * pv_disp_op->s_disp_frm_buf.u4_y_strd;
  717|       |
  718|    679|        pu1_u_dst = (UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_u_buf;
  719|    679|        pu1_u_dst += start_uv * pv_disp_op->s_disp_frm_buf.u4_u_strd;
  720|       |
  721|    679|        pu1_v_dst = (UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_v_buf;
  722|    679|        pu1_v_dst += start_uv * pv_disp_op->s_disp_frm_buf.u4_v_strd;
  723|       |
  724|    679|        ih264d_fmt_conv_420sp_to_420p(pu1_y_src,
  725|    679|                                      pu1_uv_src,
  726|    679|                                      pu1_y_dst,
  727|    679|                                      pu1_u_dst,
  728|    679|                                      pu1_v_dst,
  729|    679|                                      ps_op_frm->u4_y_wd,
  730|    679|                                      u4_num_rows_y,
  731|    679|                                      ps_op_frm->u4_y_strd,
  732|    679|                                      ps_op_frm->u4_u_strd,
  733|    679|                                      pv_disp_op->s_disp_frm_buf.u4_y_strd,
  734|    679|                                      pv_disp_op->s_disp_frm_buf.u4_u_strd,
  735|    679|                                      1,
  736|    679|                                      convert_uv_only);
  737|       |
  738|    679|    }
  739|  3.14k|    else if((pv_disp_op->e_output_format == IV_YUV_420SP_UV) ||
  ------------------
  |  Branch (739:13): [True: 2.94k, False: 198]
  ------------------
  740|    198|            (pv_disp_op->e_output_format == IV_YUV_420SP_VU))
  ------------------
  |  Branch (740:13): [True: 198, False: 0]
  ------------------
  741|  3.14k|    {
  742|  3.14k|        UWORD8* pu1_y_dst, *pu1_uv_dst;
  743|       |
  744|  3.14k|        pu1_y_dst = (UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_y_buf;
  745|  3.14k|        pu1_y_dst +=  u4_start_y * pv_disp_op->s_disp_frm_buf.u4_y_strd;
  746|       |
  747|  3.14k|        pu1_uv_dst = (UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_u_buf;
  748|  3.14k|        pu1_uv_dst += start_uv * pv_disp_op->s_disp_frm_buf.u4_u_strd;
  749|       |
  750|  3.14k|        if(pv_disp_op->e_output_format == IV_YUV_420SP_UV)
  ------------------
  |  Branch (750:12): [True: 2.94k, False: 198]
  ------------------
  751|  2.94k|        {
  752|  2.94k|            ih264d_fmt_conv_420sp_to_420sp(pu1_y_src,
  753|  2.94k|                                           pu1_uv_src,
  754|  2.94k|                                           pu1_y_dst,
  755|  2.94k|                                           pu1_uv_dst,
  756|  2.94k|                                           ps_op_frm->u4_y_wd,
  757|  2.94k|                                           u4_num_rows_y,
  758|  2.94k|                                           ps_op_frm->u4_y_strd,
  759|  2.94k|                                           ps_op_frm->u4_u_strd,
  760|  2.94k|                                           pv_disp_op->s_disp_frm_buf.u4_y_strd,
  761|  2.94k|                                           pv_disp_op->s_disp_frm_buf.u4_u_strd);
  762|  2.94k|        }
  763|    198|        else
  764|    198|        {
  765|    198|            ih264d_fmt_conv_420sp_to_420sp_swap_uv(pu1_y_src,
  766|    198|                                                   pu1_uv_src,
  767|    198|                                                   pu1_y_dst,
  768|    198|                                                   pu1_uv_dst,
  769|    198|                                                   ps_op_frm->u4_y_wd,
  770|    198|                                                   u4_num_rows_y,
  771|    198|                                                   ps_op_frm->u4_y_strd,
  772|    198|                                                   ps_op_frm->u4_u_strd,
  773|    198|                                                   pv_disp_op->s_disp_frm_buf.u4_y_strd,
  774|    198|                                                   pv_disp_op->s_disp_frm_buf.u4_u_strd);
  775|    198|        }
  776|  3.14k|    }
  777|      0|    else if(pv_disp_op->e_output_format == IV_RGB_565)
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|    {
  779|      0|        UWORD16 *pu2_rgb_dst;
  780|       |
  781|      0|        pu2_rgb_dst = (UWORD16 *)pv_disp_op->s_disp_frm_buf.pv_y_buf;
  782|      0|        pu2_rgb_dst += u4_start_y * pv_disp_op->s_disp_frm_buf.u4_y_strd;
  783|       |
  784|      0|        ih264d_fmt_conv_420sp_to_rgb565(pu1_y_src,
  785|      0|                                        pu1_uv_src,
  786|      0|                                        pu2_rgb_dst,
  787|      0|                                        ps_op_frm->u4_y_wd,
  788|      0|                                        u4_num_rows_y,
  789|      0|                                        ps_op_frm->u4_y_strd,
  790|      0|                                        ps_op_frm->u4_u_strd,
  791|      0|                                        pv_disp_op->s_disp_frm_buf.u4_y_strd,
  792|      0|                                        1);
  793|      0|    }
  794|       |
  795|  3.82k|    if((u4_start_y + u4_num_rows_y) >= ps_dec->s_disp_frame_info.u4_y_ht)
  ------------------
  |  Branch (795:8): [True: 1.06k, False: 2.75k]
  ------------------
  796|  1.06k|    {
  797|       |
  798|  1.06k|        INSERT_LOGO(pv_disp_op->s_disp_frm_buf.pv_y_buf,
  799|  1.06k|                        pv_disp_op->s_disp_frm_buf.pv_u_buf,
  800|  1.06k|                        pv_disp_op->s_disp_frm_buf.pv_v_buf,
  801|  1.06k|                        pv_disp_op->s_disp_frm_buf.u4_y_strd,
  802|  1.06k|                        ps_dec->u2_disp_width,
  803|  1.06k|                        ps_dec->u2_disp_height,
  804|  1.06k|                        pv_disp_op->e_output_format,
  805|  1.06k|                        ps_op_frm->u4_y_wd,
  806|  1.06k|                        ps_op_frm->u4_y_ht);
  807|  1.06k|    }
  808|       |
  809|  3.82k|    return;
  810|  3.82k|}

ih264d_init_function_ptr_generic:
   82|  2.50k|{
   83|       |
   84|  2.50k|    WORD32 i = 0;
   85|       |
   86|       |    /* Init function pointers for intra pred leaf level functions luma
   87|       |     * Intra 16x16 */
   88|  2.50k|    ps_codec->apf_intra_pred_luma_16x16[0] =
   89|  2.50k|                    ih264_intra_pred_luma_16x16_mode_vert;
   90|  2.50k|    ps_codec->apf_intra_pred_luma_16x16[1] =
   91|  2.50k|                    ih264_intra_pred_luma_16x16_mode_horz;
   92|  2.50k|    ps_codec->apf_intra_pred_luma_16x16[2] =
   93|  2.50k|                    ih264_intra_pred_luma_16x16_mode_dc;
   94|  2.50k|    ps_codec->apf_intra_pred_luma_16x16[3] =
   95|  2.50k|                    ih264_intra_pred_luma_16x16_mode_plane;
   96|       |
   97|       |    /* Init function pointers for intra pred leaf level functions luma
   98|       |     * Intra 4x4 */
   99|  2.50k|    ps_codec->apf_intra_pred_luma_4x4[0] = ih264_intra_pred_luma_4x4_mode_vert;
  100|  2.50k|    ps_codec->apf_intra_pred_luma_4x4[1] = ih264_intra_pred_luma_4x4_mode_horz;
  101|  2.50k|    ps_codec->apf_intra_pred_luma_4x4[2] = ih264_intra_pred_luma_4x4_mode_dc;
  102|  2.50k|    ps_codec->apf_intra_pred_luma_4x4[3] =
  103|  2.50k|                    ih264_intra_pred_luma_4x4_mode_diag_dl;
  104|  2.50k|    ps_codec->apf_intra_pred_luma_4x4[4] =
  105|  2.50k|                    ih264_intra_pred_luma_4x4_mode_diag_dr;
  106|  2.50k|    ps_codec->apf_intra_pred_luma_4x4[5] =
  107|  2.50k|                    ih264_intra_pred_luma_4x4_mode_vert_r;
  108|  2.50k|    ps_codec->apf_intra_pred_luma_4x4[6] =
  109|  2.50k|                    ih264_intra_pred_luma_4x4_mode_horz_d;
  110|  2.50k|    ps_codec->apf_intra_pred_luma_4x4[7] =
  111|  2.50k|                    ih264_intra_pred_luma_4x4_mode_vert_l;
  112|  2.50k|    ps_codec->apf_intra_pred_luma_4x4[8] =
  113|  2.50k|                    ih264_intra_pred_luma_4x4_mode_horz_u;
  114|       |
  115|       |    /* Init function pointers for intra pred leaf level functions luma
  116|       |     * Intra 8x8 */
  117|  2.50k|    ps_codec->apf_intra_pred_luma_8x8[0] = ih264_intra_pred_luma_8x8_mode_vert;
  118|  2.50k|    ps_codec->apf_intra_pred_luma_8x8[1] = ih264_intra_pred_luma_8x8_mode_horz;
  119|  2.50k|    ps_codec->apf_intra_pred_luma_8x8[2] = ih264_intra_pred_luma_8x8_mode_dc;
  120|  2.50k|    ps_codec->apf_intra_pred_luma_8x8[3] =
  121|  2.50k|                    ih264_intra_pred_luma_8x8_mode_diag_dl;
  122|  2.50k|    ps_codec->apf_intra_pred_luma_8x8[4] =
  123|  2.50k|                    ih264_intra_pred_luma_8x8_mode_diag_dr;
  124|  2.50k|    ps_codec->apf_intra_pred_luma_8x8[5] =
  125|  2.50k|                    ih264_intra_pred_luma_8x8_mode_vert_r;
  126|  2.50k|    ps_codec->apf_intra_pred_luma_8x8[6] =
  127|  2.50k|                    ih264_intra_pred_luma_8x8_mode_horz_d;
  128|  2.50k|    ps_codec->apf_intra_pred_luma_8x8[7] =
  129|  2.50k|                    ih264_intra_pred_luma_8x8_mode_vert_l;
  130|  2.50k|    ps_codec->apf_intra_pred_luma_8x8[8] =
  131|  2.50k|                    ih264_intra_pred_luma_8x8_mode_horz_u;
  132|       |
  133|  2.50k|    ps_codec->pf_intra_pred_ref_filtering =
  134|  2.50k|                    ih264_intra_pred_luma_8x8_mode_ref_filtering;
  135|       |
  136|       |    /* Init function pointers for intra pred leaf level functions chroma
  137|       |     * Intra 8x8 */
  138|  2.50k|    ps_codec->apf_intra_pred_chroma[0] = ih264_intra_pred_chroma_8x8_mode_vert;
  139|  2.50k|    ps_codec->apf_intra_pred_chroma[1] = ih264_intra_pred_chroma_8x8_mode_horz;
  140|  2.50k|    ps_codec->apf_intra_pred_chroma[2] = ih264_intra_pred_chroma_8x8_mode_dc;
  141|  2.50k|    ps_codec->apf_intra_pred_chroma[3] = ih264_intra_pred_chroma_8x8_mode_plane;
  142|       |
  143|  2.50k|    ps_codec->pf_default_weighted_pred_luma = ih264_default_weighted_pred_luma;
  144|  2.50k|    ps_codec->pf_default_weighted_pred_chroma =
  145|  2.50k|                    ih264_default_weighted_pred_chroma;
  146|  2.50k|    ps_codec->pf_weighted_pred_luma = ih264_weighted_pred_luma;
  147|  2.50k|    ps_codec->pf_weighted_pred_chroma = ih264_weighted_pred_chroma;
  148|  2.50k|    ps_codec->pf_weighted_bi_pred_luma = ih264_weighted_bi_pred_luma;
  149|  2.50k|    ps_codec->pf_weighted_bi_pred_chroma = ih264_weighted_bi_pred_chroma;
  150|       |
  151|       |    /* Padding Functions */
  152|  2.50k|    ps_codec->pf_pad_top = ih264_pad_top;
  153|  2.50k|    ps_codec->pf_pad_bottom = ih264_pad_bottom;
  154|  2.50k|    ps_codec->pf_pad_left_luma = ih264_pad_left_luma;
  155|  2.50k|    ps_codec->pf_pad_left_chroma = ih264_pad_left_chroma;
  156|  2.50k|    ps_codec->pf_pad_right_luma = ih264_pad_right_luma;
  157|  2.50k|    ps_codec->pf_pad_right_chroma = ih264_pad_right_chroma;
  158|       |
  159|  2.50k|    ps_codec->pf_iquant_itrans_recon_luma_4x4 = ih264_iquant_itrans_recon_4x4;
  160|  2.50k|    ps_codec->pf_iquant_itrans_recon_luma_4x4_dc =
  161|  2.50k|                    ih264_iquant_itrans_recon_4x4_dc;
  162|  2.50k|    ps_codec->pf_iquant_itrans_recon_luma_8x8 = ih264_iquant_itrans_recon_8x8;
  163|  2.50k|    ps_codec->pf_iquant_itrans_recon_luma_8x8_dc =
  164|  2.50k|                    ih264_iquant_itrans_recon_8x8_dc;
  165|  2.50k|    ps_codec->pf_iquant_itrans_recon_chroma_4x4 =
  166|  2.50k|                    ih264_iquant_itrans_recon_chroma_4x4;
  167|  2.50k|    ps_codec->pf_iquant_itrans_recon_chroma_4x4_dc =
  168|  2.50k|                    ih264_iquant_itrans_recon_chroma_4x4_dc;
  169|  2.50k|    ps_codec->pf_ihadamard_scaling_4x4 = ih264_ihadamard_scaling_4x4;
  170|       |
  171|       |    /* Init fn ptr luma deblocking */
  172|  2.50k|    ps_codec->pf_deblk_luma_vert_bs4 = ih264_deblk_luma_vert_bs4;
  173|  2.50k|    ps_codec->pf_deblk_luma_vert_bslt4 = ih264_deblk_luma_vert_bslt4;
  174|  2.50k|    ps_codec->pf_deblk_luma_vert_bs4_mbaff = ih264_deblk_luma_vert_bs4_mbaff;
  175|  2.50k|    ps_codec->pf_deblk_luma_vert_bslt4_mbaff =
  176|  2.50k|                    ih264_deblk_luma_vert_bslt4_mbaff;
  177|       |
  178|  2.50k|    ps_codec->pf_deblk_luma_horz_bs4 = ih264_deblk_luma_horz_bs4;
  179|  2.50k|    ps_codec->pf_deblk_luma_horz_bslt4 = ih264_deblk_luma_horz_bslt4;
  180|       |
  181|       |    /* Init fn ptr chroma deblocking */
  182|  2.50k|    ps_codec->pf_deblk_chroma_vert_bs4 = ih264_deblk_chroma_vert_bs4;
  183|  2.50k|    ps_codec->pf_deblk_chroma_vert_bslt4 = ih264_deblk_chroma_vert_bslt4;
  184|  2.50k|    ps_codec->pf_deblk_chroma_vert_bs4_mbaff =
  185|  2.50k|                    ih264_deblk_chroma_vert_bs4_mbaff;
  186|  2.50k|    ps_codec->pf_deblk_chroma_vert_bslt4_mbaff =
  187|  2.50k|                    ih264_deblk_chroma_vert_bslt4_mbaff;
  188|       |
  189|  2.50k|    ps_codec->pf_deblk_chroma_horz_bs4 = ih264_deblk_chroma_horz_bs4;
  190|  2.50k|    ps_codec->pf_deblk_chroma_horz_bslt4 = ih264_deblk_chroma_horz_bslt4;
  191|       |
  192|       |    /* Inter pred leaf level functions */
  193|  2.50k|    ps_codec->apf_inter_pred_luma[0] = ih264_inter_pred_luma_copy;
  194|  2.50k|    ps_codec->apf_inter_pred_luma[1] = ih264_inter_pred_luma_horz_qpel;
  195|  2.50k|    ps_codec->apf_inter_pred_luma[2] = ih264_inter_pred_luma_horz;
  196|  2.50k|    ps_codec->apf_inter_pred_luma[3] = ih264_inter_pred_luma_horz_qpel;
  197|  2.50k|    ps_codec->apf_inter_pred_luma[4] = ih264_inter_pred_luma_vert_qpel;
  198|  2.50k|    ps_codec->apf_inter_pred_luma[5] =
  199|  2.50k|                    ih264_inter_pred_luma_horz_qpel_vert_qpel;
  200|  2.50k|    ps_codec->apf_inter_pred_luma[6] =
  201|  2.50k|                    ih264_inter_pred_luma_horz_hpel_vert_qpel;
  202|  2.50k|    ps_codec->apf_inter_pred_luma[7] =
  203|  2.50k|                    ih264_inter_pred_luma_horz_qpel_vert_qpel;
  204|  2.50k|    ps_codec->apf_inter_pred_luma[8] = ih264_inter_pred_luma_vert;
  205|  2.50k|    ps_codec->apf_inter_pred_luma[9] =
  206|  2.50k|                    ih264_inter_pred_luma_horz_qpel_vert_hpel;
  207|  2.50k|    ps_codec->apf_inter_pred_luma[10] =
  208|  2.50k|                    ih264_inter_pred_luma_horz_hpel_vert_hpel;
  209|  2.50k|    ps_codec->apf_inter_pred_luma[11] =
  210|  2.50k|                    ih264_inter_pred_luma_horz_qpel_vert_hpel;
  211|  2.50k|    ps_codec->apf_inter_pred_luma[12] = ih264_inter_pred_luma_vert_qpel;
  212|  2.50k|    ps_codec->apf_inter_pred_luma[13] =
  213|  2.50k|                    ih264_inter_pred_luma_horz_qpel_vert_qpel;
  214|  2.50k|    ps_codec->apf_inter_pred_luma[14] =
  215|  2.50k|                    ih264_inter_pred_luma_horz_hpel_vert_qpel;
  216|  2.50k|    ps_codec->apf_inter_pred_luma[15] =
  217|  2.50k|                    ih264_inter_pred_luma_horz_qpel_vert_qpel;
  218|       |
  219|  2.50k|    ps_codec->pf_inter_pred_chroma = ih264_inter_pred_chroma;
  220|       |
  221|  2.50k|    return;
  222|  2.50k|}

ih264d_fill_pred_info:
  113|   735k|{
  114|   735k|    WORD32 insert_bits;
  115|       |
  116|   735k|    ps_pred_pkd->i2_mv[0] = pi2_mv[0];
  117|   735k|    ps_pred_pkd->i2_mv[1] = pi2_mv[1];
  118|       |
  119|   735k|    insert_bits = sub_mb_num & 3; /*sub mb x*/
  120|   735k|    ps_pred_pkd->i1_size_pos_info = insert_bits;
  121|   735k|    insert_bits = sub_mb_num >> 2;/*sub mb y*/
  122|   735k|    ps_pred_pkd->i1_size_pos_info |= insert_bits << 2;
  123|   735k|    insert_bits = part_width >> 1;
  124|   735k|    ps_pred_pkd->i1_size_pos_info |= insert_bits << 4;
  125|   735k|    insert_bits = part_height >> 1;
  126|   735k|    ps_pred_pkd->i1_size_pos_info |= insert_bits << 6;
  127|       |
  128|   735k|    ps_pred_pkd->i1_ref_idx_info = i1_ref_idx;
  129|   735k|    ps_pred_pkd->i1_ref_idx_info |= (pred_dir << 6);
  130|   735k|    ps_pred_pkd->i1_buf_id = i1_buf_id;
  131|   735k|    ps_pred_pkd->pu4_wt_offst = pu4_wt_offset;
  132|   735k|    ps_pred_pkd->u1_pic_type = u1_pic_type;
  133|       |
  134|       |
  135|   735k|}
ih264d_form_mb_part_info_bp:
  178|   314k|{
  179|       |    /* The reference buffer pointer */
  180|   314k|    WORD32 i2_frm_x, i2_frm_y;
  181|   314k|    WORD32 i2_tmp_mv_x, i2_tmp_mv_y;
  182|   314k|    WORD32 i2_rec_x, i2_rec_y;
  183|       |
  184|   314k|    WORD32 u2_pic_ht;
  185|   314k|    WORD32 u2_frm_wd;
  186|   314k|    WORD32 u2_rec_wd;
  187|   314k|    UWORD8 u1_sub_x = 0,u1_sub_y=0 ;
  188|   314k|    UWORD8  u1_part_wd = 0,u1_part_ht = 0;
  189|   314k|    WORD16 i2_mv_x,i2_mv_y;
  190|       |
  191|       |    /********************************************/
  192|       |    /* i1_mc_wd       width reqd for mcomp      */
  193|       |    /* u1_dma_ht      height reqd for mcomp     */
  194|       |    /* u1_dma_wd      width aligned to 4 bytes  */
  195|       |    /* u1_dx          fractional part of width  */
  196|       |    /* u1_dx          fractional part of height */
  197|       |    /********************************************/
  198|   314k|    UWORD32 i1_mc_wd;
  199|       |
  200|   314k|    WORD32 u1_dma_ht;
  201|       |
  202|   314k|    UWORD32 u1_dma_wd;
  203|   314k|    UWORD32 u1_dx;
  204|   314k|    UWORD32 u1_dy;
  205|   314k|    pred_info_t * ps_pred = ps_dec->ps_pred + ps_dec->u4_pred_info_idx;
  206|   314k|    dec_slice_params_t * const ps_cur_slice = ps_dec->ps_cur_slice;
  207|   314k|    tfr_ctxt_t *ps_frame_buf;
  208|   314k|    struct pic_buffer_t *ps_ref_frm;
  209|   314k|    UWORD8 u1_scale_ref,u1_mbaff,u1_field;
  210|   314k|    pic_buffer_t  **pps_ref_frame;
  211|   314k|    WORD8 i1_size_pos_info,i1_buf_id;
  212|       |
  213|   314k|    PROFILE_DISABLE_MB_PART_INFO()
  ------------------
  |  |  131|   314k|#define PROFILE_DISABLE_MB_PART_INFO() ;
  ------------------
  214|       |
  215|   314k|     UNUSED(ps_cur_mb_info);
  ------------------
  |  |   45|   314k|#define UNUSED(x) ((void)(x))
  ------------------
  216|   314k|     i1_size_pos_info = ps_pred_pkd->i1_size_pos_info;
  217|   314k|     GET_XPOS_PRED(u1_sub_x,i1_size_pos_info);
  ------------------
  |  |  165|   314k|#define GET_XPOS_PRED(u1_out,pkd_info)                        \
  |  |  166|   314k|{                                                               \
  |  |  167|   314k|    WORD32 bit_field;                                           \
  |  |  168|   314k|    bit_field = pkd_info & 0x3;                                 \
  |  |  169|   314k|    u1_out = bit_field;                                       \
  |  |  170|   314k|}
  ------------------
  218|   314k|     GET_YPOS_PRED(u1_sub_y,i1_size_pos_info);
  ------------------
  |  |  173|   314k|#define GET_YPOS_PRED(u1_out,pkd_info)                        \
  |  |  174|   314k|{                                                               \
  |  |  175|   314k|    WORD32 bit_field;                                           \
  |  |  176|   314k|    bit_field = pkd_info >> 2;                                  \
  |  |  177|   314k|    u1_out = bit_field & 0x3;                                  \
  |  |  178|   314k|}
  ------------------
  219|   314k|     GET_WIDTH_PRED(u1_part_wd,i1_size_pos_info);
  ------------------
  |  |  182|   314k|#define GET_WIDTH_PRED(u1_out,pkd_info)                        \
  |  |  183|   314k|{                                                               \
  |  |  184|   314k|    WORD32 bit_field;                                           \
  |  |  185|   314k|    bit_field = pkd_info >> 4;                                  \
  |  |  186|   314k|    bit_field = (bit_field & 0x3) << 1 ;                        \
  |  |  187|   314k|    u1_out = (bit_field == 0)?1:bit_field;                       \
  |  |  ------------------
  |  |  |  Branch (187:14): [True: 2.00k, False: 312k]
  |  |  ------------------
  |  |  188|   314k|    }
  ------------------
  220|   314k|     GET_HEIGHT_PRED(u1_part_ht,i1_size_pos_info);
  ------------------
  |  |  190|   314k|#define GET_HEIGHT_PRED(u1_out,pkd_info)                        \
  |  |  191|   314k|{                                                               \
  |  |  192|   314k|    WORD32 bit_field;                                           \
  |  |  193|   314k|    bit_field = pkd_info >> 6;                                  \
  |  |  194|   314k|    bit_field = (bit_field & 0x3) << 1 ;                        \
  |  |  195|   314k|    u1_out = (bit_field == 0)?1:bit_field;                      \
  |  |  ------------------
  |  |  |  Branch (195:14): [True: 1.33k, False: 313k]
  |  |  ------------------
  |  |  196|   314k|}
  ------------------
  221|   314k|     i2_mv_x = ps_pred_pkd->i2_mv[0];
  222|   314k|     i2_mv_y = ps_pred_pkd->i2_mv[1];
  223|   314k|     i1_buf_id = ps_pred_pkd->i1_buf_id;
  224|       |
  225|       |
  226|   314k|     ps_ref_frm = ps_dec->apv_buf_id_pic_buf_map[i1_buf_id];
  227|       |
  228|       |
  229|   314k|    {
  230|   314k|        ps_frame_buf = &ps_dec->s_tran_addrecon;
  231|   314k|    }
  232|       |
  233|       |
  234|       |    /* Transfer Setup Y */
  235|   314k|    {
  236|   314k|        UWORD8 *pu1_pred, *pu1_rec;
  237|       |
  238|       |        /* calculating rounded motion vectors and fractional components */
  239|   314k|        i2_tmp_mv_x = i2_mv_x;
  240|   314k|        i2_tmp_mv_y = i2_mv_y;
  241|   314k|        u1_dx = i2_tmp_mv_x & 0x3;
  242|   314k|        u1_dy = i2_tmp_mv_y & 0x3;
  243|   314k|        i2_tmp_mv_x >>= 2;
  244|   314k|        i2_tmp_mv_y >>= 2;
  245|   314k|        i1_mc_wd = u1_part_wd << 2;
  246|   314k|        u1_dma_ht = u1_part_ht << 2;
  247|   314k|        if(u1_dx)
  ------------------
  |  Branch (247:12): [True: 2.45k, False: 312k]
  ------------------
  248|  2.45k|        {
  249|  2.45k|            i2_tmp_mv_x -= 2;
  250|  2.45k|            i1_mc_wd += 5;
  251|  2.45k|        }
  252|   314k|        if(u1_dy)
  ------------------
  |  Branch (252:12): [True: 1.00k, False: 313k]
  ------------------
  253|  1.00k|        {
  254|  1.00k|            i2_tmp_mv_y -= 2;
  255|  1.00k|            u1_dma_ht += 5;
  256|  1.00k|        }
  257|       |
  258|       |        /********************************************************************/
  259|       |        /* Calulating the horizontal and the vertical u4_ofst from top left  */
  260|       |        /* edge of the reference frame, and subsequent clipping             */
  261|       |        /********************************************************************/
  262|   314k|        u2_pic_ht = ps_dec->u2_pic_ht;
  263|   314k|        u2_frm_wd = ps_dec->u2_frm_wd_y;
  264|   314k|        i2_rec_x = u1_sub_x << 2;
  265|   314k|        i2_rec_y = u1_sub_y << 2;
  266|       |
  267|   314k|        i2_frm_x = (u2_mb_x << 4) + i2_rec_x + i2_tmp_mv_x;
  268|   314k|        i2_frm_y = (u2_mb_y << 4) + i2_rec_y + i2_tmp_mv_y;
  269|       |
  270|   314k|        i2_frm_x = CLIP3(MAX_OFFSET_OUTSIDE_X_FRM, (ps_dec->u2_pic_wd - 1),
  ------------------
  |  |   77|   314k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 3, False: 314k]
  |  |  |  Branch (77:54): [True: 1, False: 314k]
  |  |  ------------------
  ------------------
  271|   314k|                         i2_frm_x);
  272|   314k|        i2_frm_y = CLIP3(((1 - u1_dma_ht)), (u2_pic_ht - (1)), i2_frm_y);
  ------------------
  |  |   77|   314k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 2, False: 314k]
  |  |  |  Branch (77:54): [True: 21, False: 314k]
  |  |  ------------------
  ------------------
  273|       |
  274|   314k|        pu1_pred = ps_ref_frm->pu1_buf1 + i2_frm_y * u2_frm_wd + i2_frm_x;
  275|       |
  276|   314k|        u1_dma_wd = (i1_mc_wd + 3) & 0xFC;
  277|       |
  278|       |        /********************************************************************/
  279|       |        /* Calulating the horizontal and the vertical u4_ofst from top left  */
  280|       |        /* edge of the recon buffer                                         */
  281|       |        /********************************************************************/
  282|   314k|        u2_rec_wd = MB_SIZE;
  ------------------
  |  |  554|   314k|#define MB_SIZE             16
  ------------------
  283|   314k|        {
  284|   314k|            u2_rec_wd = ps_dec->u2_frm_wd_y;
  285|   314k|            i2_rec_x += (mb_index << 4);
  286|   314k|            pu1_rec = ps_frame_buf->pu1_dest_y + i2_rec_y * u2_rec_wd
  287|   314k|                            + i2_rec_x;
  288|   314k|        }
  289|       |
  290|       |        /* filling the pred and dma structures for Y */
  291|   314k|        u2_frm_wd = ps_dec->u2_frm_wd_y;
  292|       |
  293|   314k|        ps_pred->u2_u1_ref_buf_wd = u1_dma_wd;
  294|   314k|        ps_pred->i1_dma_ht = u1_dma_ht;
  295|   314k|        ps_pred->i1_mc_wd = i1_mc_wd;
  296|   314k|        ps_pred->u2_frm_wd = u2_frm_wd;
  297|   314k|        ps_pred->pu1_rec_y_u = pu1_rec;
  298|   314k|        ps_pred->u2_dst_stride = u2_rec_wd;
  299|       |
  300|   314k|        ps_pred->i1_mb_partwidth = u1_part_wd << 2;
  301|   314k|        ps_pred->i1_mb_partheight = u1_part_ht << 2;
  302|   314k|        ps_pred->u1_dydx = (u1_dy << 2) + u1_dx;
  303|       |
  304|   314k|        ps_pred->pu1_y_ref = pu1_pred;
  305|       |
  306|   314k|    }
  307|       |
  308|       |    /* Increment ps_pred index */
  309|   314k|    ps_pred++;
  310|       |
  311|       |    /* Transfer Setup U & V */
  312|   314k|    {
  313|   314k|        WORD32 i4_ref_offset, i4_rec_offset;
  314|   314k|        UWORD8 *pu1_pred_u, *pu1_pred_v;
  315|       |
  316|       |
  317|       |        /* calculating rounded motion vectors and fractional components */
  318|   314k|        i2_tmp_mv_x = i2_mv_x;
  319|   314k|        i2_tmp_mv_y = i2_mv_y;
  320|       |
  321|       |        /************************************************************************/
  322|       |        /* Table 8-9: Derivation of the vertical component of the chroma vector */
  323|       |        /* in field coding mode                                                 */
  324|       |        /************************************************************************/
  325|       |
  326|       |        /* Eighth sample of the chroma MV */
  327|   314k|        u1_dx = i2_tmp_mv_x & 0x7;
  328|   314k|        u1_dy = i2_tmp_mv_y & 0x7;
  329|       |
  330|       |        /********************************************************************/
  331|       |        /* Calculating the full pel MV for chroma which is 1/2 of the Luma  */
  332|       |        /* MV in full pel units                                             */
  333|       |        /********************************************************************/
  334|   314k|        i2_mv_x = i2_tmp_mv_x;
  335|   314k|        i2_mv_y = i2_tmp_mv_y;
  336|   314k|        i2_tmp_mv_x = SIGN_POW2_DIV(i2_tmp_mv_x, 3);
  ------------------
  |  |   67|   314k|#define SIGN_POW2_DIV(x, y) (((x) < 0) ? (-((-(x)) >> (y))) : ((x) >> (y)))
  |  |  ------------------
  |  |  |  Branch (67:30): [True: 93, False: 314k]
  |  |  ------------------
  ------------------
  337|   314k|        i2_tmp_mv_y = SIGN_POW2_DIV(i2_tmp_mv_y, 3);
  ------------------
  |  |   67|   314k|#define SIGN_POW2_DIV(x, y) (((x) < 0) ? (-((-(x)) >> (y))) : ((x) >> (y)))
  |  |  ------------------
  |  |  |  Branch (67:30): [True: 774, False: 314k]
  |  |  ------------------
  ------------------
  338|   314k|        i1_mc_wd = u1_part_wd << 1;
  339|   314k|        u1_dma_ht = u1_part_ht << 1;
  340|   314k|        if(u1_dx)
  ------------------
  |  Branch (340:12): [True: 2.92k, False: 312k]
  ------------------
  341|  2.92k|        {
  342|  2.92k|            i2_tmp_mv_x -= (i2_mv_x < 0);
  343|  2.92k|            i1_mc_wd++;
  344|  2.92k|        }
  345|   314k|        if(u1_dy != 0)
  ------------------
  |  Branch (345:12): [True: 1.02k, False: 313k]
  ------------------
  346|  1.02k|        {
  347|  1.02k|            i2_tmp_mv_y -= (i2_mv_y < 0);
  348|  1.02k|            u1_dma_ht++;
  349|  1.02k|        }
  350|       |
  351|       |        /********************************************************************/
  352|       |        /* Calulating the horizontal and the vertical u4_ofst from top left  */
  353|       |        /* edge of the reference frame, and subsequent clipping             */
  354|       |        /********************************************************************/
  355|   314k|        u2_pic_ht >>= 1;
  356|   314k|        u2_frm_wd = ps_dec->u2_frm_wd_uv;
  357|   314k|        i2_rec_x = u1_sub_x << 1;
  358|   314k|        i2_rec_y = u1_sub_y << 1;
  359|       |
  360|   314k|        i2_frm_x = (u2_mb_x << 3) + i2_rec_x + i2_tmp_mv_x;
  361|   314k|        i2_frm_y = (u2_mb_y << 3) + i2_rec_y + i2_tmp_mv_y;
  362|       |
  363|   314k|        i2_frm_x = CLIP3(MAX_OFFSET_OUTSIDE_UV_FRM,
  ------------------
  |  |   77|   314k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 3, False: 314k]
  |  |  |  Branch (77:54): [True: 31, False: 314k]
  |  |  ------------------
  ------------------
  364|   314k|                         ((ps_dec->u2_pic_wd >> 1) - 1), i2_frm_x);
  365|   314k|        i2_frm_y = CLIP3(((1 - u1_dma_ht)), (u2_pic_ht - (1)), i2_frm_y);
  ------------------
  |  |   77|   314k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 2, False: 314k]
  |  |  |  Branch (77:54): [True: 21, False: 314k]
  |  |  ------------------
  ------------------
  366|       |
  367|   314k|        i4_ref_offset = i2_frm_y * u2_frm_wd + i2_frm_x * YUV420SP_FACTOR;
  ------------------
  |  |  119|   314k|#define YUV420SP_FACTOR 2
  ------------------
  368|   314k|        u1_dma_wd = (i1_mc_wd + 3) & 0xFC;
  369|       |
  370|       |        /********************************************************************/
  371|       |        /* Calulating the horizontal and the vertical u4_ofst from top left  */
  372|       |        /* edge of the recon buffer                                         */
  373|       |        /********************************************************************/
  374|       |        /* CHANGED CODE */
  375|   314k|        u2_rec_wd = BLK8x8SIZE * YUV420SP_FACTOR;
  ------------------
  |  |  555|   314k|#define BLK8x8SIZE          8
  ------------------
                      u2_rec_wd = BLK8x8SIZE * YUV420SP_FACTOR;
  ------------------
  |  |  119|   314k|#define YUV420SP_FACTOR 2
  ------------------
  376|   314k|        i4_rec_offset = i2_rec_y * u2_rec_wd + i2_rec_x * YUV420SP_FACTOR;
  ------------------
  |  |  119|   314k|#define YUV420SP_FACTOR 2
  ------------------
  377|       |
  378|   314k|        {
  379|   314k|            u2_rec_wd = ps_dec->u2_frm_wd_uv;
  380|   314k|            i2_rec_x += (mb_index << 3);
  381|   314k|            i4_rec_offset = i2_rec_y * u2_rec_wd + i2_rec_x * YUV420SP_FACTOR;
  ------------------
  |  |  119|   314k|#define YUV420SP_FACTOR 2
  ------------------
  382|   314k|            ps_pred->pu1_rec_y_u = ps_frame_buf->pu1_dest_u + i4_rec_offset;
  383|   314k|            ps_pred->u1_pi1_wt_ofst_rec_v = ps_frame_buf->pu1_dest_v
  384|   314k|                            + i4_rec_offset;
  385|   314k|        }
  386|       |
  387|       |        /* CHANGED CODE */
  388|       |
  389|       |        /* filling the common pred structures for U */
  390|   314k|        u2_frm_wd = ps_dec->u2_frm_wd_uv;
  391|       |
  392|   314k|        ps_pred->u2_u1_ref_buf_wd = u1_dma_wd;
  393|   314k|        ps_pred->i1_dma_ht = u1_dma_ht;
  394|   314k|        ps_pred->i1_mc_wd = i1_mc_wd;
  395|       |
  396|   314k|        ps_pred->u2_frm_wd = u2_frm_wd;
  397|   314k|        ps_pred->u2_dst_stride = u2_rec_wd;
  398|       |
  399|   314k|        ps_pred->i1_mb_partwidth = u1_part_wd << 1;
  400|   314k|        ps_pred->i1_mb_partheight = u1_part_ht << 1;
  401|   314k|        ps_pred->u1_dydx = (u1_dy << 3) + u1_dx;
  402|       |
  403|   314k|        pu1_pred_u = ps_ref_frm->pu1_buf2 + i4_ref_offset;
  404|   314k|        pu1_pred_v = ps_ref_frm->pu1_buf3 + i4_ref_offset;
  405|       |
  406|       |        /* Copy U & V partitions */
  407|   314k|        ps_pred->pu1_u_ref = pu1_pred_u;
  408|       |
  409|       |        /* Increment the reference buffer Index */
  410|   314k|        ps_pred->pu1_v_ref = pu1_pred_v;
  411|   314k|    }
  412|       |
  413|       |    /* Increment ps_pred index */
  414|   314k|    ps_dec->u4_pred_info_idx += 2;
  415|       |
  416|   314k|    return OK;
  ------------------
  |  |  114|   314k|#define OK        0
  ------------------
  417|       |
  418|   314k|}
ih264d_form_mb_part_info_mp:
  455|   178k|{
  456|       |    /* The reference buffer pointer */
  457|   178k|    UWORD8 *pu1_ref_buf;
  458|   178k|    WORD16 i2_frm_x, i2_frm_y, i2_tmp_mv_x, i2_tmp_mv_y, i2_pod_ht;
  459|   178k|    WORD16 i2_rec_x, i2_rec_y;
  460|   178k|    UWORD16 u2_pic_ht, u2_frm_wd, u2_rec_wd;
  461|   178k|    UWORD8 u1_wght_pred_type, u1_wted_bipred_idc;
  462|   178k|    UWORD16 u2_tot_ref_scratch_size;
  463|   178k|    UWORD8 u1_sub_x = 0;
  464|   178k|    UWORD8 u1_sub_y = 0;
  465|   178k|    UWORD8 u1_is_bi_dir = 0;
  466|       |
  467|       |    /********************************************/
  468|       |    /* i1_mc_wd       width reqd for mcomp      */
  469|       |    /* u1_dma_ht      height reqd for mcomp     */
  470|       |    /* u1_dma_wd      width aligned to 4 bytes  */
  471|       |    /* u1_dx          fractional part of width  */
  472|       |    /* u1_dx          fractional part of height */
  473|       |    /********************************************/
  474|   178k|    UWORD8 i1_mc_wd, u1_dma_ht, u1_dma_wd, u1_dx, u1_dy;
  475|   178k|    pred_info_t * ps_pred ;
  476|   178k|    dec_slice_params_t * const ps_cur_slice = ps_dec->ps_cur_slice;
  477|   178k|    const UWORD8 u1_slice_type = ps_dec->ps_decode_cur_slice->slice_type;
  478|   178k|    UWORD8 u1_pod_bot, u1_pod_top;
  479|       |
  480|       |    /* load the pictype for pod u4_flag & chroma motion vector derivation */
  481|   178k|    UWORD8 u1_ref_pic_type ;
  482|       |
  483|       |    /* set default value to flags specifying field nature of picture & mb */
  484|   178k|    UWORD32 u1_mb_fld = 0, u1_mb_or_pic_fld;
  485|   178k|    UWORD32 u1_mb_bot = 0, u1_pic_bot = 0, u1_mb_or_pic_bot;
  486|   178k|    tfr_ctxt_t *ps_frame_buf;
  487|       |    /* calculate flags specifying field nature of picture & mb */
  488|   178k|    const UWORD32 u1_pic_fld = ps_cur_slice->u1_field_pic_flag;
  489|   178k|    WORD8 i1_pred;
  490|   178k|    WORD8 i1_size_pos_info,i1_buf_id,i1_ref_idx;
  491|   178k|    UWORD8 u1_part_wd,u1_part_ht;
  492|   178k|    WORD16 i2_mv_x,i2_mv_y;
  493|   178k|    struct pic_buffer_t *ps_ref_frm;
  494|   178k|    UWORD32 *pu4_wt_offset;
  495|   178k|    UWORD8 *pu1_buf1,*pu1_buf2,*pu1_buf3;
  496|       |
  497|       |
  498|   178k|    PROFILE_DISABLE_MB_PART_INFO()
  ------------------
  |  |  131|   178k|#define PROFILE_DISABLE_MB_PART_INFO() ;
  ------------------
  499|       |
  500|   178k|    ps_pred = ps_dec->ps_pred + ps_dec->u4_pred_info_idx;
  501|       |
  502|       |
  503|   178k|     i1_size_pos_info = ps_pred_pkd->i1_size_pos_info;
  504|   178k|     GET_XPOS_PRED(u1_sub_x,i1_size_pos_info);
  ------------------
  |  |  165|   178k|#define GET_XPOS_PRED(u1_out,pkd_info)                        \
  |  |  166|   178k|{                                                               \
  |  |  167|   178k|    WORD32 bit_field;                                           \
  |  |  168|   178k|    bit_field = pkd_info & 0x3;                                 \
  |  |  169|   178k|    u1_out = bit_field;                                       \
  |  |  170|   178k|}
  ------------------
  505|   178k|     GET_YPOS_PRED(u1_sub_y,i1_size_pos_info);
  ------------------
  |  |  173|   178k|#define GET_YPOS_PRED(u1_out,pkd_info)                        \
  |  |  174|   178k|{                                                               \
  |  |  175|   178k|    WORD32 bit_field;                                           \
  |  |  176|   178k|    bit_field = pkd_info >> 2;                                  \
  |  |  177|   178k|    u1_out = bit_field & 0x3;                                  \
  |  |  178|   178k|}
  ------------------
  506|   178k|     GET_WIDTH_PRED(u1_part_wd,i1_size_pos_info);
  ------------------
  |  |  182|   178k|#define GET_WIDTH_PRED(u1_out,pkd_info)                        \
  |  |  183|   178k|{                                                               \
  |  |  184|   178k|    WORD32 bit_field;                                           \
  |  |  185|   178k|    bit_field = pkd_info >> 4;                                  \
  |  |  186|   178k|    bit_field = (bit_field & 0x3) << 1 ;                        \
  |  |  187|   178k|    u1_out = (bit_field == 0)?1:bit_field;                       \
  |  |  ------------------
  |  |  |  Branch (187:14): [True: 19.5k, False: 159k]
  |  |  ------------------
  |  |  188|   178k|    }
  ------------------
  507|   178k|     GET_HEIGHT_PRED(u1_part_ht,i1_size_pos_info);
  ------------------
  |  |  190|   178k|#define GET_HEIGHT_PRED(u1_out,pkd_info)                        \
  |  |  191|   178k|{                                                               \
  |  |  192|   178k|    WORD32 bit_field;                                           \
  |  |  193|   178k|    bit_field = pkd_info >> 6;                                  \
  |  |  194|   178k|    bit_field = (bit_field & 0x3) << 1 ;                        \
  |  |  195|   178k|    u1_out = (bit_field == 0)?1:bit_field;                      \
  |  |  ------------------
  |  |  |  Branch (195:14): [True: 18.1k, False: 160k]
  |  |  ------------------
  |  |  196|   178k|}
  ------------------
  508|   178k|     i2_mv_x = ps_pred_pkd->i2_mv[0];
  509|   178k|     i2_mv_y = ps_pred_pkd->i2_mv[1];
  510|   178k|     i1_ref_idx = ps_pred_pkd->i1_ref_idx_info & 0x3f;
  511|   178k|     i1_buf_id = ps_pred_pkd->i1_buf_id;
  512|   178k|     ps_ref_frm = ps_dec->apv_buf_id_pic_buf_map[i1_buf_id];
  513|       |
  514|   178k|     i1_pred = (ps_pred_pkd->i1_ref_idx_info & 0xC0) >> 6;
  515|   178k|     u1_is_bi_dir = (i1_pred == BI_PRED);
  ------------------
  |  |  485|   178k|#define BI_PRED   3
  ------------------
  516|       |
  517|       |
  518|   178k|    u1_ref_pic_type = ps_pred_pkd->u1_pic_type & PIC_MASK;
  ------------------
  |  |  359|   178k|#define PIC_MASK        0x03
  ------------------
  519|       |
  520|   178k|    pu1_buf1  = ps_ref_frm->pu1_buf1;
  521|   178k|    pu1_buf2  = ps_ref_frm->pu1_buf2;
  522|   178k|    pu1_buf3  = ps_ref_frm->pu1_buf3;
  523|       |
  524|   178k|    if(u1_ref_pic_type == BOT_FLD)
  ------------------
  |  |  354|   178k|#define BOT_FLD         0x02
  ------------------
  |  Branch (524:8): [True: 0, False: 178k]
  ------------------
  525|      0|    {
  526|      0|        pu1_buf1 += ps_ref_frm->u2_frm_wd_y;
  527|      0|        pu1_buf2 += ps_ref_frm->u2_frm_wd_uv;
  528|      0|        pu1_buf3 += ps_ref_frm->u2_frm_wd_uv;
  529|       |
  530|      0|    }
  531|       |
  532|       |
  533|       |
  534|   178k|    if(ps_dec->ps_cur_pps->u1_wted_pred_flag)
  ------------------
  |  Branch (534:8): [True: 111k, False: 67.3k]
  ------------------
  535|   111k|    {
  536|   111k|            pu4_wt_offset = (UWORD32*)&ps_dec->pu4_wt_ofsts[2
  537|   111k|                            * X3(i1_ref_idx)];
  ------------------
  |  |   92|   111k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  538|   111k|    }
  539|       |
  540|       |
  541|   178k|    pu4_wt_offset = ps_pred_pkd->pu4_wt_offst;
  542|       |
  543|       |
  544|       |    /* Pointer to the frame buffer */
  545|   178k|    {
  546|   178k|        ps_frame_buf = &ps_dec->s_tran_addrecon;
  547|       |        /* CHANGED CODE */
  548|   178k|    }
  549|       |
  550|   178k|    if(!u1_pic_fld)
  ------------------
  |  Branch (550:8): [True: 178k, False: 0]
  ------------------
  551|   178k|    {
  552|   178k|        u1_mb_fld = ps_cur_mb_info->u1_mb_field_decodingflag;
  553|   178k|        u1_mb_bot = 1 - ps_cur_mb_info->u1_topmb;
  554|   178k|    }
  555|      0|    else
  556|      0|        u1_pic_bot = ps_cur_slice->u1_bottom_field_flag;
  557|       |
  558|       |    /****************************************************************/
  559|       |    /* calculating the flags the tell whether to use frame-padding  */
  560|       |    /* or use software pad-on-demand                                */
  561|       |    /****************************************************************/
  562|   178k|    u1_mb_or_pic_bot = u1_mb_bot | u1_pic_bot;
  563|   178k|    u1_mb_or_pic_fld = u1_mb_fld | u1_pic_fld;
  564|   178k|    u1_pod_bot = u1_mb_or_pic_fld && (u1_ref_pic_type == TOP_FLD);
  ------------------
  |  |  353|      0|#define TOP_FLD         0x01
  ------------------
  |  Branch (564:18): [True: 0, False: 178k]
  |  Branch (564:38): [True: 0, False: 0]
  ------------------
  565|   178k|    u1_pod_top = u1_mb_or_pic_fld && (u1_ref_pic_type == BOT_FLD);
  ------------------
  |  |  354|      0|#define BOT_FLD         0x02
  ------------------
  |  Branch (565:18): [True: 0, False: 178k]
  |  Branch (565:38): [True: 0, False: 0]
  ------------------
  566|       |
  567|       |    /* Weighted Pred additions */
  568|   178k|    u1_wted_bipred_idc = ps_dec->ps_cur_pps->u1_wted_bipred_idc;
  569|       |
  570|   178k|    if((u1_slice_type == P_SLICE) || (u1_slice_type == SP_SLICE))
  ------------------
  |  |  368|   178k|#define P_SLICE  0
  ------------------
                  if((u1_slice_type == P_SLICE) || (u1_slice_type == SP_SLICE))
  ------------------
  |  |  371|  82.6k|#define SP_SLICE 3
  ------------------
  |  Branch (570:8): [True: 96.2k, False: 82.6k]
  |  Branch (570:38): [True: 0, False: 82.6k]
  ------------------
  571|  96.2k|    {
  572|       |        /* P Slice only */
  573|  96.2k|        u1_wght_pred_type = ps_dec->ps_cur_pps->u1_wted_pred_flag;
  574|       |
  575|  96.2k|    }
  576|  82.6k|    else
  577|  82.6k|    {
  578|       |        /* B Slice only */
  579|  82.6k|        u1_wght_pred_type = 1 + u1_is_bi_dir;
  580|  82.6k|        if(u1_wted_bipred_idc == 0)
  ------------------
  |  Branch (580:12): [True: 75.5k, False: 7.19k]
  ------------------
  581|  75.5k|            u1_wght_pred_type = 0;
  582|  82.6k|        if((u1_wted_bipred_idc == 2) && (!u1_is_bi_dir))
  ------------------
  |  Branch (582:12): [True: 7.19k, False: 75.5k]
  |  Branch (582:41): [True: 5.41k, False: 1.77k]
  ------------------
  583|  5.41k|            u1_wght_pred_type = 0;
  584|  82.6k|    }
  585|       |    /* load the scratch reference buffer index */
  586|   178k|    pu1_ref_buf = ps_dec->pu1_ref_buff + ps_dec->u4_dma_buf_idx;
  587|   178k|    u2_tot_ref_scratch_size = 0;
  588|       |
  589|       |
  590|       |    /* Transfer Setup Y */
  591|   178k|    {
  592|   178k|        UWORD8 *pu1_pred, *pu1_rec;
  593|       |        /* calculating rounded motion vectors and fractional components */
  594|   178k|        i2_tmp_mv_x = i2_mv_x;
  595|   178k|        i2_tmp_mv_y = i2_mv_y;
  596|       |
  597|   178k|        u1_dx = i2_tmp_mv_x & 0x3;
  598|   178k|        u1_dy = i2_tmp_mv_y & 0x3;
  599|   178k|        i2_tmp_mv_x >>= 2;
  600|   178k|        i2_tmp_mv_y >>= 2;
  601|   178k|        i1_mc_wd = u1_part_wd << 2;
  602|   178k|        u1_dma_ht = u1_part_ht << 2;
  603|   178k|        if(u1_dx)
  ------------------
  |  Branch (603:12): [True: 55.7k, False: 123k]
  ------------------
  604|  55.7k|        {
  605|  55.7k|            i2_tmp_mv_x -= 2;
  606|  55.7k|            i1_mc_wd += 5;
  607|  55.7k|        }
  608|   178k|        if(u1_dy)
  ------------------
  |  Branch (608:12): [True: 48.9k, False: 129k]
  ------------------
  609|  48.9k|        {
  610|  48.9k|            i2_tmp_mv_y -= 2;
  611|  48.9k|            u1_dma_ht += 5;
  612|  48.9k|        }
  613|       |
  614|       |        /********************************************************************/
  615|       |        /* Calulating the horizontal and the vertical u4_ofst from top left  */
  616|       |        /* edge of the reference frame, and subsequent clipping             */
  617|       |        /********************************************************************/
  618|   178k|        u2_pic_ht = ps_dec->u2_pic_ht >> u1_pic_fld;
  619|   178k|        u2_frm_wd = ps_dec->u2_frm_wd_y << u1_pic_fld;
  620|   178k|        i2_frm_x = (u2_mb_x << 4) + (u1_sub_x << 2) + i2_tmp_mv_x;
  621|   178k|        i2_frm_y = ((u2_mb_y + (u1_mb_bot && !u1_mb_fld)) << 4)
  ------------------
  |  Branch (621:33): [True: 0, False: 178k]
  |  Branch (621:46): [True: 0, False: 0]
  ------------------
  622|   178k|                        + (((u1_sub_y << 2) + i2_tmp_mv_y) << u1_mb_fld);
  623|       |
  624|   178k|        i2_frm_x = CLIP3(MAX_OFFSET_OUTSIDE_X_FRM, (ps_dec->u2_pic_wd - 1),
  ------------------
  |  |   77|   178k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 668, False: 178k]
  |  |  |  Branch (77:54): [True: 5.97k, False: 172k]
  |  |  ------------------
  ------------------
  625|   178k|                         i2_frm_x);
  626|   178k|        i2_frm_y = CLIP3(((1 - u1_dma_ht) << u1_mb_fld),
  ------------------
  |  |   77|   178k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 290, False: 178k]
  |  |  |  Branch (77:54): [True: 736, False: 177k]
  |  |  ------------------
  ------------------
  627|   178k|                         (u2_pic_ht - (1 << u1_mb_fld)), i2_frm_y);
  628|       |
  629|   178k|        pu1_pred = pu1_buf1 + i2_frm_y * u2_frm_wd + i2_frm_x;
  630|   178k|        u1_dma_wd = (i1_mc_wd + 3) & 0xFC;
  631|       |        /********************************************************************/
  632|       |        /* Calulating the horizontal and the vertical u4_ofst from top left  */
  633|       |        /* edge of the recon buffer                                         */
  634|       |        /********************************************************************/
  635|       |        /* CHANGED CODE */
  636|   178k|        u2_rec_wd = MB_SIZE;
  ------------------
  |  |  554|   178k|#define MB_SIZE             16
  ------------------
  637|   178k|        i2_rec_x = u1_sub_x << 2;
  638|   178k|        i2_rec_y = u1_sub_y << 2;
  639|   178k|        {
  640|   178k|            u2_rec_wd = ps_dec->u2_frm_wd_y << u1_mb_or_pic_fld;
  641|   178k|            i2_rec_x += (mb_index << 4);
  642|   178k|            pu1_rec = ps_frame_buf->pu1_dest_y + i2_rec_y * u2_rec_wd
  643|   178k|                            + i2_rec_x;
  644|   178k|            if(u1_mb_bot)
  ------------------
  |  Branch (644:16): [True: 0, False: 178k]
  ------------------
  645|      0|                pu1_rec += ps_dec->u2_frm_wd_y << ((u1_mb_fld) ? 0 : 4);
  ------------------
  |  Branch (645:52): [True: 0, False: 0]
  ------------------
  646|   178k|        }
  647|       |
  648|       |        /* CHANGED CODE */
  649|       |
  650|       |        /* filling the pred and dma structures for Y */
  651|   178k|        u2_frm_wd = ps_dec->u2_frm_wd_y << u1_mb_or_pic_fld;
  652|       |
  653|   178k|        ps_pred->pu1_dma_dest_addr = pu1_ref_buf;
  654|   178k|        ps_pred->u2_u1_ref_buf_wd = u1_dma_wd;
  655|   178k|        ps_pred->u2_frm_wd = u2_frm_wd;
  656|   178k|        ps_pred->i1_dma_ht = u1_dma_ht;
  657|   178k|        ps_pred->i1_mc_wd = i1_mc_wd;
  658|   178k|        ps_pred->pu1_rec_y_u = pu1_rec;
  659|   178k|        ps_pred->u2_dst_stride = u2_rec_wd;
  660|       |
  661|   178k|        ps_pred->i1_mb_partwidth = u1_part_wd << 2;
  662|   178k|        ps_pred->i1_mb_partheight = u1_part_ht << 2;
  663|   178k|        ps_pred->u1_dydx = (u1_dy << 2) + u1_dx;
  664|   178k|        ps_pred->u1_is_bi_direct = u1_is_bi_dir;
  665|   178k|        ps_pred->u1_pi1_wt_ofst_rec_v = (UWORD8 *)pu4_wt_offset;
  666|   178k|        ps_pred->u1_wght_pred_type = u1_wght_pred_type;
  667|   178k|        ps_pred->i1_pod_ht = 0;
  668|       |
  669|       |        /* Increment the Reference buffer Indices */
  670|   178k|        pu1_ref_buf += u1_dma_wd * u1_dma_ht;
  671|   178k|        u2_tot_ref_scratch_size += u1_dma_wd * u1_dma_ht;
  672|       |
  673|       |        /* unrestricted field motion comp for top region outside frame */
  674|   178k|        i2_pod_ht = (-i2_frm_y) >> u1_mb_fld;
  675|   178k|        if((i2_pod_ht > 0) && u1_pod_top)
  ------------------
  |  Branch (675:12): [True: 5.23k, False: 173k]
  |  Branch (675:31): [True: 0, False: 5.23k]
  ------------------
  676|      0|        {
  677|      0|            ps_pred->i1_pod_ht = (WORD8)(-i2_pod_ht);
  678|      0|            u1_dma_ht -= i2_pod_ht;
  679|      0|            pu1_pred += i2_pod_ht * u2_frm_wd;
  680|      0|        }
  681|       |        /* unrestricted field motion comp for bottom region outside frame */
  682|   178k|        else if(u1_pod_bot)
  ------------------
  |  Branch (682:17): [True: 0, False: 178k]
  ------------------
  683|      0|        {
  684|      0|            i2_pod_ht = u1_dma_ht + ((i2_frm_y - u2_pic_ht) >> u1_mb_fld);
  685|      0|            if(i2_pod_ht > 0)
  ------------------
  |  Branch (685:16): [True: 0, False: 0]
  ------------------
  686|      0|            {
  687|      0|                u1_dma_ht -= i2_pod_ht;
  688|      0|                ps_pred->i1_pod_ht = (WORD8)i2_pod_ht;
  689|      0|            }
  690|      0|        }
  691|       |
  692|       |        /* Copy Y partition */
  693|       |
  694|       |        /*
  695|       |         * ps_pred->i1_pod_ht is non zero when MBAFF is present. In case of MBAFF the reference data
  696|       |         * is copied in the Scrath buffer so that the padding_on_demand doesnot corrupt the frame data
  697|       |         */
  698|   178k|        if(ps_pred->i1_pod_ht)
  ------------------
  |  Branch (698:12): [True: 0, False: 178k]
  ------------------
  699|      0|        {
  700|      0|            ps_pred->pu1_pred = pu1_pred;
  701|      0|            ps_pred->u1_dma_ht_y = u1_dma_ht;
  702|      0|            ps_pred->u1_dma_wd_y = u1_dma_wd;
  703|      0|        }
  704|   178k|        ps_pred->pu1_y_ref = pu1_pred;
  705|   178k|    }
  706|       |
  707|       |
  708|       |
  709|       |    /* Increment ps_pred index */
  710|   178k|    ps_pred++;
  711|       |
  712|       |    /* Transfer Setup U & V */
  713|   178k|    {
  714|   178k|        WORD32 i4_ref_offset, i4_rec_offset;
  715|   178k|        UWORD8 *pu1_pred_u, *pu1_pred_v, u1_tmp_dma_ht;
  716|       |        /* CHANGED CODE */
  717|   178k|        UWORD8 u1_chroma_cbp = (UWORD8)(ps_cur_mb_info->u1_cbp >> 4);
  718|       |        /* CHANGED CODE */
  719|       |
  720|       |        /* calculating rounded motion vectors and fractional components */
  721|   178k|        i2_tmp_mv_x = i2_mv_x;
  722|   178k|        i2_tmp_mv_y = i2_mv_y;
  723|       |
  724|       |        /************************************************************************/
  725|       |        /* Table 8-9: Derivation of the vertical component of the chroma vector */
  726|       |        /* in field coding mode                                                 */
  727|       |        /************************************************************************/
  728|   178k|        if(u1_pod_bot && u1_mb_or_pic_bot)
  ------------------
  |  Branch (728:12): [True: 0, False: 178k]
  |  Branch (728:26): [True: 0, False: 0]
  ------------------
  729|      0|            i2_tmp_mv_y += 2;
  730|   178k|        if(u1_pod_top && !u1_mb_or_pic_bot)
  ------------------
  |  Branch (730:12): [True: 0, False: 178k]
  |  Branch (730:26): [True: 0, False: 0]
  ------------------
  731|      0|            i2_tmp_mv_y -= 2;
  732|       |
  733|       |        /* Eighth sample of the chroma MV */
  734|   178k|        u1_dx = i2_tmp_mv_x & 0x7;
  735|   178k|        u1_dy = i2_tmp_mv_y & 0x7;
  736|       |
  737|       |        /********************************************************************/
  738|       |        /* Calculating the full pel MV for chroma which is 1/2 of the Luma  */
  739|       |        /* MV in full pel units                                             */
  740|       |        /********************************************************************/
  741|   178k|        i2_mv_x = i2_tmp_mv_x;
  742|   178k|        i2_mv_y = i2_tmp_mv_y;
  743|   178k|        i2_tmp_mv_x = SIGN_POW2_DIV(i2_tmp_mv_x, 3);
  ------------------
  |  |   67|   178k|#define SIGN_POW2_DIV(x, y) (((x) < 0) ? (-((-(x)) >> (y))) : ((x) >> (y)))
  |  |  ------------------
  |  |  |  Branch (67:30): [True: 20.5k, False: 158k]
  |  |  ------------------
  ------------------
  744|   178k|        i2_tmp_mv_y = SIGN_POW2_DIV(i2_tmp_mv_y, 3);
  ------------------
  |  |   67|   178k|#define SIGN_POW2_DIV(x, y) (((x) < 0) ? (-((-(x)) >> (y))) : ((x) >> (y)))
  |  |  ------------------
  |  |  |  Branch (67:30): [True: 20.3k, False: 158k]
  |  |  ------------------
  ------------------
  745|   178k|        i1_mc_wd = u1_part_wd << 1;
  746|   178k|        u1_dma_ht = u1_part_ht << 1;
  747|   178k|        if(u1_dx)
  ------------------
  |  Branch (747:12): [True: 61.7k, False: 117k]
  ------------------
  748|  61.7k|        {
  749|  61.7k|            if(i2_mv_x < 0)
  ------------------
  |  Branch (749:16): [True: 19.1k, False: 42.6k]
  ------------------
  750|  19.1k|                i2_tmp_mv_x -= 1;
  751|  61.7k|            i1_mc_wd++;
  752|  61.7k|        }
  753|   178k|        if(u1_dy != 0)
  ------------------
  |  Branch (753:12): [True: 55.8k, False: 123k]
  ------------------
  754|  55.8k|        {
  755|  55.8k|            if(i2_mv_y < 0)
  ------------------
  |  Branch (755:16): [True: 19.2k, False: 36.5k]
  ------------------
  756|  19.2k|                i2_tmp_mv_y -= 1;
  757|  55.8k|            u1_dma_ht++;
  758|  55.8k|        }
  759|       |
  760|       |        /********************************************************************/
  761|       |        /* Calulating the horizontal and the vertical u4_ofst from top left  */
  762|       |        /* edge of the reference frame, and subsequent clipping             */
  763|       |        /********************************************************************/
  764|   178k|        u2_pic_ht >>= 1;
  765|   178k|        u2_frm_wd = ps_dec->u2_frm_wd_uv << u1_pic_fld;
  766|   178k|        i2_frm_x = (u2_mb_x << 3) + (u1_sub_x << 1) + i2_tmp_mv_x;
  767|   178k|        i2_frm_y = ((u2_mb_y + (u1_mb_bot && !u1_mb_fld)) << 3)
  ------------------
  |  Branch (767:33): [True: 0, False: 178k]
  |  Branch (767:46): [True: 0, False: 0]
  ------------------
  768|   178k|                        + (((u1_sub_y << 1) + i2_tmp_mv_y) << u1_mb_fld);
  769|       |
  770|   178k|        i2_frm_x = CLIP3(MAX_OFFSET_OUTSIDE_UV_FRM,
  ------------------
  |  |   77|   178k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 756, False: 178k]
  |  |  |  Branch (77:54): [True: 7.07k, False: 171k]
  |  |  ------------------
  ------------------
  771|   178k|                         ((ps_dec->u2_pic_wd >> 1) - 1), i2_frm_x);
  772|   178k|        i2_frm_y = CLIP3(((1 - u1_dma_ht) << u1_mb_fld),
  ------------------
  |  |   77|   178k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 293, False: 178k]
  |  |  |  Branch (77:54): [True: 742, False: 177k]
  |  |  ------------------
  ------------------
  773|   178k|                         (u2_pic_ht - (1 << u1_mb_fld)), i2_frm_y);
  774|       |
  775|   178k|        i4_ref_offset = i2_frm_y * u2_frm_wd + i2_frm_x * YUV420SP_FACTOR;
  ------------------
  |  |  119|   178k|#define YUV420SP_FACTOR 2
  ------------------
  776|   178k|        u1_dma_wd = (i1_mc_wd + 3) & 0xFC;
  777|       |
  778|       |        /********************************************************************/
  779|       |        /* Calulating the horizontal and the vertical u4_ofst from top left  */
  780|       |        /* edge of the recon buffer                                         */
  781|       |        /********************************************************************/
  782|       |        /* CHANGED CODE */
  783|   178k|        u2_rec_wd = BLK8x8SIZE * YUV420SP_FACTOR;
  ------------------
  |  |  555|   178k|#define BLK8x8SIZE          8
  ------------------
                      u2_rec_wd = BLK8x8SIZE * YUV420SP_FACTOR;
  ------------------
  |  |  119|   178k|#define YUV420SP_FACTOR 2
  ------------------
  784|   178k|        i2_rec_x = u1_sub_x << 1;
  785|   178k|        i2_rec_y = u1_sub_y << 1;
  786|   178k|        i4_rec_offset = i2_rec_y * u2_rec_wd + i2_rec_x * YUV420SP_FACTOR;
  ------------------
  |  |  119|   178k|#define YUV420SP_FACTOR 2
  ------------------
  787|   178k|        {
  788|   178k|            u2_rec_wd = ps_dec->u2_frm_wd_uv << u1_mb_or_pic_fld;
  789|       |
  790|   178k|            i2_rec_x += (mb_index << 3);
  791|   178k|            i4_rec_offset = i2_rec_y * u2_rec_wd + i2_rec_x * YUV420SP_FACTOR;
  ------------------
  |  |  119|   178k|#define YUV420SP_FACTOR 2
  ------------------
  792|   178k|            if(u1_mb_bot)
  ------------------
  |  Branch (792:16): [True: 0, False: 178k]
  ------------------
  793|      0|                i4_rec_offset += ps_dec->u2_frm_wd_uv << ((u1_mb_fld) ? 0 : 3);
  ------------------
  |  Branch (793:59): [True: 0, False: 0]
  ------------------
  794|   178k|            ps_pred->pu1_rec_y_u = ps_frame_buf->pu1_dest_u + i4_rec_offset;
  795|   178k|            ps_pred->u1_pi1_wt_ofst_rec_v = ps_frame_buf->pu1_dest_v
  796|   178k|                            + i4_rec_offset;
  797|       |
  798|   178k|        }
  799|       |
  800|       |        /* CHANGED CODE */
  801|       |
  802|       |        /* filling the common pred structures for U */
  803|   178k|        u2_frm_wd = ps_dec->u2_frm_wd_uv << u1_mb_or_pic_fld;
  804|   178k|        u1_tmp_dma_ht = u1_dma_ht;
  805|   178k|        ps_pred->u2_u1_ref_buf_wd = u1_dma_wd;
  806|   178k|        ps_pred->u2_frm_wd = u2_frm_wd;
  807|   178k|        ps_pred->i1_dma_ht = u1_dma_ht;
  808|   178k|        ps_pred->i1_mc_wd = i1_mc_wd;
  809|   178k|        ps_pred->u2_dst_stride = u2_rec_wd;
  810|       |
  811|   178k|        ps_pred->i1_mb_partwidth = u1_part_wd << 1;
  812|   178k|        ps_pred->i1_mb_partheight = u1_part_ht << 1;
  813|   178k|        ps_pred->u1_dydx = (u1_dy << 3) + u1_dx;
  814|   178k|        ps_pred->u1_is_bi_direct = u1_is_bi_dir;
  815|   178k|        ps_pred->u1_wght_pred_type = u1_wght_pred_type;
  816|   178k|        ps_pred->i1_pod_ht = 0;
  817|       |
  818|   178k|        ps_pred->pu1_dma_dest_addr = pu1_ref_buf;
  819|       |
  820|       |        /* unrestricted field motion comp for top region outside frame */
  821|   178k|        i2_pod_ht = (-i2_frm_y) >> u1_mb_fld;
  822|   178k|        if((i2_pod_ht > 0) && u1_pod_top)
  ------------------
  |  Branch (822:12): [True: 3.38k, False: 175k]
  |  Branch (822:31): [True: 0, False: 3.38k]
  ------------------
  823|      0|        {
  824|      0|            i4_ref_offset += i2_pod_ht * u2_frm_wd;
  825|      0|            u1_dma_ht -= i2_pod_ht;
  826|      0|            ps_pred->i1_pod_ht = (WORD8)(-i2_pod_ht);
  827|      0|        }
  828|       |        /* unrestricted field motion comp for bottom region outside frame */
  829|   178k|        else if(u1_pod_bot)
  ------------------
  |  Branch (829:17): [True: 0, False: 178k]
  ------------------
  830|      0|        {
  831|      0|            i2_pod_ht = u1_dma_ht + ((i2_frm_y - u2_pic_ht) >> u1_mb_fld);
  832|      0|            if(i2_pod_ht > 0)
  ------------------
  |  Branch (832:16): [True: 0, False: 0]
  ------------------
  833|      0|            {
  834|      0|                u1_dma_ht -= i2_pod_ht;
  835|      0|                ps_pred->i1_pod_ht = (WORD8)i2_pod_ht;
  836|      0|            }
  837|      0|        }
  838|       |
  839|   178k|        pu1_pred_u = pu1_buf2 + i4_ref_offset;
  840|   178k|        pu1_pred_v = pu1_buf3 + i4_ref_offset;
  841|       |
  842|       |        /* Copy U & V partitions */
  843|   178k|        if(ps_pred->i1_pod_ht)
  ------------------
  |  Branch (843:12): [True: 0, False: 178k]
  ------------------
  844|      0|        {
  845|      0|            ps_pred->pu1_pred_u = pu1_pred_u;
  846|      0|            ps_pred->u1_dma_ht_uv = u1_dma_ht;
  847|      0|            ps_pred->u1_dma_wd_uv = u1_dma_wd;
  848|       |
  849|      0|        }
  850|   178k|        ps_pred->pu1_u_ref = pu1_pred_u;
  851|       |
  852|       |        /* Increment the reference buffer Index */
  853|   178k|        u2_tot_ref_scratch_size += (u1_dma_wd * u1_tmp_dma_ht) << 1;
  854|       |
  855|   178k|        if(ps_pred->i1_pod_ht)
  ------------------
  |  Branch (855:12): [True: 0, False: 178k]
  ------------------
  856|      0|        {
  857|      0|            ps_pred->pu1_pred_v = pu1_pred_v;
  858|      0|            ps_pred->u1_dma_ht_uv = u1_dma_ht;
  859|      0|            ps_pred->u1_dma_wd_uv = u1_dma_wd;
  860|      0|        }
  861|       |
  862|   178k|        ps_pred->pu1_v_ref = pu1_pred_v;
  863|   178k|    }
  864|       |
  865|       |    /* Increment ps_pred index */
  866|   178k|    ps_dec->u4_pred_info_idx += 2;
  867|       |
  868|       |
  869|       |    /* Increment the reference buffer Index */
  870|   178k|    ps_dec->u4_dma_buf_idx += u2_tot_ref_scratch_size;
  871|       |
  872|   178k|    if(ps_dec->u4_dma_buf_idx > MAX_REF_BUF_SIZE)
  ------------------
  |  |   67|   178k|#define MAX_REF_BUF_SIZE       (3776*2*2)
  ------------------
  |  Branch (872:8): [True: 0, False: 178k]
  ------------------
  873|      0|        return ERROR_NUM_MV;
  874|       |
  875|   178k|    return OK;
  ------------------
  |  |  114|   178k|#define OK        0
  ------------------
  876|       |
  877|       |
  878|       |
  879|   178k|}
ih264d_motion_compensate_bp:
  904|   313k|{
  905|   313k|    pred_info_t *ps_pred ;
  906|   313k|    UWORD8 *puc_ref, *pu1_dest_y;
  907|   313k|    UWORD8 *pu1_dest_u;
  908|   313k|    UWORD32 u2_num_pels, u2_ref_wd_y, u2_ref_wd_uv, u2_dst_wd;
  909|       |
  910|   313k|    UWORD32 u4_wd_y, u4_ht_y, u4_wd_uv;
  911|   313k|    UWORD32 u4_ht_uv;
  912|   313k|    UWORD8 *puc_pred0 = (UWORD8 *)(ps_dec->pi2_pred1);
  913|       |
  914|       |
  915|   313k|    PROFILE_DISABLE_INTER_PRED()
  ------------------
  |  |  119|   313k|#define PROFILE_DISABLE_INTER_PRED() ;
  ------------------
  916|   313k|    UNUSED(ps_cur_mb_info);
  ------------------
  |  |   45|   313k|#define UNUSED(x) ((void)(x))
  ------------------
  917|   313k|    ps_pred = ps_dec->ps_pred ;
  918|       |
  919|   628k|    for(u2_num_pels = 0; u2_num_pels < 256;)
  ------------------
  |  Branch (919:26): [True: 314k, False: 313k]
  ------------------
  920|   314k|    {
  921|   314k|        UWORD32 uc_dx, uc_dy;
  922|       |        /* Pointer to the destination buffer. If the CBPs of all 8x8 blocks in
  923|       |         the MB partition are zero then it would be better to copy the
  924|       |         predictor valus directly to the current frame buffer */
  925|       |        /*
  926|       |         * ps_pred->i1_pod_ht is non zero when MBAFF is present. In case of MBAFF the reference data
  927|       |         * is copied in the Scrath buffer so that the padding_on_demand doesnot corrupt the frame data
  928|       |         */
  929|       |
  930|   314k|        u2_ref_wd_y = ps_pred->u2_frm_wd;
  931|   314k|        puc_ref = ps_pred->pu1_y_ref;
  932|   314k|        if(ps_pred->u1_dydx & 0x3)
  ------------------
  |  Branch (932:12): [True: 2.45k, False: 312k]
  ------------------
  933|  2.45k|            puc_ref += 2;
  934|   314k|        if(ps_pred->u1_dydx >> 2)
  ------------------
  |  Branch (934:12): [True: 1.00k, False: 313k]
  ------------------
  935|  1.00k|            puc_ref += 2 * u2_ref_wd_y;
  936|       |
  937|   314k|        u4_wd_y = ps_pred->i1_mb_partwidth;
  938|   314k|        u4_ht_y = ps_pred->i1_mb_partheight;
  939|   314k|        uc_dx = ps_pred->u1_dydx;
  940|   314k|        uc_dy = uc_dx >> 2;
  941|   314k|        uc_dx &= 0x3;
  942|       |
  943|   314k|        pu1_dest_y = ps_pred->pu1_rec_y_u;
  944|   314k|        u2_dst_wd = ps_pred->u2_dst_stride;
  945|       |
  946|   314k|        ps_dec->apf_inter_pred_luma[ps_pred->u1_dydx](puc_ref, pu1_dest_y,
  947|   314k|                                                      u2_ref_wd_y,
  948|   314k|                                                      u2_dst_wd,
  949|   314k|                                                      u4_ht_y,
  950|   314k|                                                      u4_wd_y, puc_pred0,
  951|   314k|                                                      ps_pred->u1_dydx);
  952|       |
  953|   314k|        ps_pred++;
  954|       |
  955|       |        /* Interpolate samples for the chroma components */
  956|   314k|        {
  957|   314k|            UWORD8 *pu1_ref_u;
  958|       |
  959|   314k|            u2_ref_wd_uv = ps_pred->u2_frm_wd;
  960|   314k|            pu1_ref_u = ps_pred->pu1_u_ref;
  961|       |
  962|   314k|            u4_wd_uv = ps_pred->i1_mb_partwidth;
  963|   314k|            u4_ht_uv = ps_pred->i1_mb_partheight;
  964|   314k|            uc_dx = ps_pred->u1_dydx; /* 8*dy + dx */
  965|   314k|            uc_dy = uc_dx >> 3;
  966|   314k|            uc_dx &= 0x7;
  967|       |
  968|   314k|            pu1_dest_u = ps_pred->pu1_rec_y_u;
  969|   314k|            u2_dst_wd = ps_pred->u2_dst_stride;
  970|       |
  971|   314k|            ps_pred++;
  972|   314k|            ps_dec->pf_inter_pred_chroma(pu1_ref_u, pu1_dest_u, u2_ref_wd_uv,
  973|   314k|                                         u2_dst_wd, uc_dx, uc_dy,
  974|   314k|                                         u4_ht_uv, u4_wd_uv);
  975|       |
  976|   314k|        }
  977|       |
  978|   314k|        u2_num_pels += (UWORD8)u4_wd_y * (UWORD8)u4_ht_y;
  979|       |
  980|   314k|    }
  981|   313k|}
ih264d_motion_compensate_mp:
 1006|   115k|{
 1007|   115k|    pred_info_t *ps_pred ;
 1008|   115k|    pred_info_t *ps_pred_y_forw, *ps_pred_y_back, *ps_pred_cr_forw;
 1009|   115k|    UWORD8 *puc_ref, *pu1_dest_y, *puc_pred0, *puc_pred1;
 1010|   115k|    UWORD8 *pu1_dest_u, *pu1_dest_v;
 1011|   115k|    WORD16 *pi16_intm;
 1012|   115k|    UWORD32 u2_num_pels, u2_ref_wd_y, u2_ref_wd_uv, u2_dst_wd;
 1013|   115k|    UWORD32 u2_dest_wd_y, u2_dest_wd_uv;
 1014|   115k|    UWORD32 u2_row_buf_wd_y = 0;
 1015|   115k|    UWORD32 u2_row_buf_wd_uv = 0;
 1016|   115k|    UWORD32 u2_log2Y_crwd;
 1017|   115k|    UWORD32 u4_wd_y, u4_ht_y, u1_dir, u4_wd_uv;
 1018|   115k|    UWORD32 u4_ht_uv;
 1019|   115k|    UWORD8 *pu1_temp_mc_buffer = ps_dec->pu1_temp_mc_buffer;
 1020|   115k|    WORD32 i2_pod_ht;
 1021|   115k|    UWORD32 u2_pic_ht, u2_frm_wd, u2_rec_wd;
 1022|   115k|    UWORD32 u1_pod_bot, u1_pod_top;
 1023|   115k|    UWORD8 *pu1_pred, *pu1_dma_dst;
 1024|   115k|    UWORD32 u1_dma_wd, u1_dma_ht;
 1025|       |
 1026|   115k|    dec_slice_params_t * const ps_cur_slice = ps_dec->ps_cur_slice;
 1027|       |
 1028|       |    /* set default value to flags specifying field nature of picture & mb */
 1029|   115k|    UWORD32 u1_mb_fld = 0, u1_mb_or_pic_fld;
 1030|   115k|    UWORD32 u1_mb_or_pic_bot;
 1031|       |    /* calculate flags specifying field nature of picture & mb */
 1032|   115k|    const UWORD8 u1_pic_fld = ps_cur_slice->u1_field_pic_flag;
 1033|       |
 1034|   115k|    PROFILE_DISABLE_INTER_PRED()
  ------------------
  |  |  119|   115k|#define PROFILE_DISABLE_INTER_PRED() ;
  ------------------
 1035|   115k|    ps_pred = ps_dec->ps_pred ;
 1036|       |    /* Initialize both ps_pred_y_forw, ps_pred_cr_forw and ps_pred_y_back
 1037|       |     * to avoid static analysis warnings */
 1038|   115k|    ps_pred_y_forw = ps_pred;
 1039|   115k|    ps_pred_y_back = ps_pred;
 1040|   115k|    ps_pred_cr_forw = ps_pred;
 1041|       |
 1042|   115k|    u2_log2Y_crwd = ps_dec->ps_decode_cur_slice->u2_log2Y_crwd;
 1043|       |
 1044|   115k|    if(!u1_pic_fld)
  ------------------
  |  Branch (1044:8): [True: 115k, False: 0]
  ------------------
 1045|   115k|    {
 1046|   115k|        u1_mb_fld = ps_cur_mb_info->u1_mb_field_decodingflag;
 1047|   115k|    }
 1048|       |
 1049|   115k|    u1_mb_or_pic_fld = u1_mb_fld | u1_pic_fld;
 1050|       |
 1051|   115k|    pi16_intm = ps_dec->pi2_pred1;
 1052|   115k|    puc_pred0 = (UWORD8 *)pi16_intm;
 1053|   115k|    puc_pred1 = puc_pred0 + PRED_BUFFER_WIDTH * PRED_BUFFER_HEIGHT * sizeof(WORD16);
  ------------------
  |  |   55|   115k|#define PRED_BUFFER_WIDTH   24*2
  ------------------
                  puc_pred1 = puc_pred0 + PRED_BUFFER_WIDTH * PRED_BUFFER_HEIGHT * sizeof(WORD16);
  ------------------
  |  |   56|   115k|#define PRED_BUFFER_HEIGHT  24*2
  ------------------
 1054|       |
 1055|   273k|    for(u2_num_pels = 0; u2_num_pels < 256;)
  ------------------
  |  Branch (1055:26): [True: 157k, False: 115k]
  ------------------
 1056|   157k|    {
 1057|   157k|        UWORD8 uc_dx, uc_dy;
 1058|   157k|        const UWORD8 u1_is_bi_direct = ps_pred->u1_is_bi_direct;
 1059|   336k|        for(u1_dir = 0; u1_dir <= u1_is_bi_direct; u1_dir++)
  ------------------
  |  Branch (1059:25): [True: 178k, False: 157k]
  ------------------
 1060|   178k|        {
 1061|       |            /* Pointer to the destination buffer. If the CBPs of all 8x8 blocks in
 1062|       |             the MB partition are zero then it would be better to copy the
 1063|       |             predictor valus directly to the current frame buffer */
 1064|       |            /*
 1065|       |             * ps_pred->i1_pod_ht is non zero when MBAFF is present. In case of MBAFF the reference data
 1066|       |             * is copied in the Scrath buffer so that the padding_on_demand doesnot corrupt the frame data
 1067|       |             */
 1068|       |
 1069|   178k|            if(ps_pred->i1_pod_ht)
  ------------------
  |  Branch (1069:16): [True: 0, False: 178k]
  ------------------
 1070|      0|            {
 1071|      0|                u2_ref_wd_y = ps_pred->u2_u1_ref_buf_wd;
 1072|      0|                puc_ref = ps_pred->pu1_dma_dest_addr;
 1073|      0|            }
 1074|   178k|            else
 1075|   178k|            {
 1076|   178k|                u2_ref_wd_y = ps_pred->u2_frm_wd;
 1077|   178k|                puc_ref = ps_pred->pu1_y_ref;
 1078|       |
 1079|   178k|            }
 1080|       |
 1081|   178k|            if(ps_pred->u1_dydx & 0x3)
  ------------------
  |  Branch (1081:16): [True: 55.7k, False: 123k]
  ------------------
 1082|  55.7k|                puc_ref += 2;
 1083|   178k|            if(ps_pred->u1_dydx >> 2)
  ------------------
  |  Branch (1083:16): [True: 48.9k, False: 129k]
  ------------------
 1084|  48.9k|                puc_ref += 2 * u2_ref_wd_y;
 1085|   178k|            u4_wd_y = ps_pred->i1_mb_partwidth;
 1086|   178k|            u4_ht_y = ps_pred->i1_mb_partheight;
 1087|       |
 1088|   178k|            uc_dx = ps_pred->u1_dydx;
 1089|   178k|            uc_dy = uc_dx >> 2;
 1090|   178k|            uc_dx &= 0x3;
 1091|   178k|            if(u1_dir == 0)
  ------------------
  |  Branch (1091:16): [True: 157k, False: 21.0k]
  ------------------
 1092|   157k|            {
 1093|   157k|                pu1_dest_y = ps_pred->pu1_rec_y_u;
 1094|   157k|                u2_row_buf_wd_y = ps_pred->u2_dst_stride;
 1095|   157k|                u2_dst_wd = ps_pred->u2_dst_stride;
 1096|   157k|                u2_dest_wd_y = u2_dst_wd;
 1097|   157k|                ps_pred_y_forw = ps_pred;
 1098|   157k|            }
 1099|  21.0k|            else
 1100|  21.0k|            {
 1101|  21.0k|                pu1_dest_y = pu1_temp_mc_buffer;
 1102|  21.0k|                u2_dst_wd = MB_SIZE;
  ------------------
  |  |  554|  21.0k|#define MB_SIZE             16
  ------------------
 1103|  21.0k|                u2_dest_wd_y = u2_dst_wd;
 1104|  21.0k|                ps_pred_y_back = ps_pred;
 1105|  21.0k|                ps_pred_y_back->pu1_rec_y_u = pu1_dest_y;
 1106|  21.0k|            }
 1107|       |
 1108|       |            /* padding on demand (POD) for y done here */
 1109|       |
 1110|   178k|            if(ps_pred->i1_pod_ht)
  ------------------
  |  Branch (1110:16): [True: 0, False: 178k]
  ------------------
 1111|      0|            {
 1112|      0|                pu1_pred = ps_pred->pu1_pred;
 1113|      0|                pu1_dma_dst = ps_pred->pu1_dma_dest_addr;
 1114|      0|                u1_dma_wd = ps_pred->u1_dma_wd_y;
 1115|      0|                u1_dma_ht = ps_pred->u1_dma_ht_y;
 1116|      0|                u2_frm_wd = ps_dec->u2_frm_wd_y << u1_mb_or_pic_fld;
 1117|      0|                if(ps_pred->i1_pod_ht < 0)
  ------------------
  |  Branch (1117:20): [True: 0, False: 0]
  ------------------
 1118|      0|                {
 1119|      0|                    pu1_dma_dst = pu1_dma_dst - (ps_pred->i1_pod_ht * ps_pred->u2_u1_ref_buf_wd);
 1120|      0|                }
 1121|      0|                ih264d_copy_2d1d(pu1_pred, pu1_dma_dst, u2_frm_wd, u1_dma_wd,
 1122|      0|                                 u1_dma_ht);
 1123|      0|                ih264d_pad_on_demand(ps_pred, LUM_BLK);
  ------------------
  |  |  286|      0|#define LUM_BLK              0
  ------------------
 1124|      0|            }
 1125|   178k|            ps_dec->apf_inter_pred_luma[ps_pred->u1_dydx](puc_ref, pu1_dest_y,
 1126|   178k|                                                          u2_ref_wd_y,
 1127|   178k|                                                          u2_dst_wd,
 1128|   178k|                                                          u4_ht_y,
 1129|   178k|                                                          u4_wd_y,
 1130|   178k|                                                          puc_pred0,
 1131|   178k|                                                          ps_pred->u1_dydx);
 1132|   178k|            ps_pred++;
 1133|       |
 1134|       |            /* Interpolate samples for the chroma components */
 1135|   178k|            {
 1136|   178k|                UWORD8 *pu1_ref_u;
 1137|   178k|                UWORD32 u1_dma_ht;
 1138|       |
 1139|       |                /* padding on demand (POD) for U and V done here */
 1140|   178k|                u1_dma_ht = ps_pred->i1_dma_ht;
 1141|       |
 1142|   178k|                if(ps_pred->i1_pod_ht)
  ------------------
  |  Branch (1142:20): [True: 0, False: 178k]
  ------------------
 1143|      0|                {
 1144|      0|                    pu1_pred = ps_pred->pu1_pred_u;
 1145|      0|                    pu1_dma_dst = ps_pred->pu1_dma_dest_addr;
 1146|      0|                    u1_dma_ht = ps_pred->u1_dma_ht_uv;
 1147|      0|                    u1_dma_wd = ps_pred->u1_dma_wd_uv * YUV420SP_FACTOR;
  ------------------
  |  |  119|      0|#define YUV420SP_FACTOR 2
  ------------------
 1148|      0|                    u2_frm_wd = ps_dec->u2_frm_wd_uv << u1_mb_or_pic_fld;
 1149|      0|                    if(ps_pred->i1_pod_ht < 0)
  ------------------
  |  Branch (1149:24): [True: 0, False: 0]
  ------------------
 1150|      0|                    {
 1151|       |                        /*Top POD*/
 1152|      0|                        pu1_dma_dst -= (ps_pred->i1_pod_ht
 1153|      0|                                        * ps_pred->u2_u1_ref_buf_wd
 1154|      0|                                        * YUV420SP_FACTOR);
  ------------------
  |  |  119|      0|#define YUV420SP_FACTOR 2
  ------------------
 1155|      0|                    }
 1156|       |
 1157|      0|                    ih264d_copy_2d1d(pu1_pred, pu1_dma_dst, u2_frm_wd,
 1158|      0|                                     u1_dma_wd, u1_dma_ht);
 1159|       |
 1160|      0|                    pu1_dma_dst += (ps_pred->i1_dma_ht
 1161|      0|                                    * ps_pred->u2_u1_ref_buf_wd);
 1162|      0|                    pu1_pred = ps_pred->pu1_pred_v;
 1163|       |
 1164|      0|                    ih264d_pad_on_demand(ps_pred, CHROM_BLK);
  ------------------
  |  |  287|      0|#define CHROM_BLK            1
  ------------------
 1165|      0|                }
 1166|       |
 1167|   178k|                if(ps_pred->i1_pod_ht)
  ------------------
  |  Branch (1167:20): [True: 0, False: 178k]
  ------------------
 1168|      0|                {
 1169|      0|                    pu1_ref_u = ps_pred->pu1_dma_dest_addr;
 1170|       |
 1171|      0|                    u2_ref_wd_uv = ps_pred->u2_u1_ref_buf_wd
 1172|      0|                                    * YUV420SP_FACTOR;
  ------------------
  |  |  119|      0|#define YUV420SP_FACTOR 2
  ------------------
 1173|      0|                }
 1174|   178k|                else
 1175|   178k|                {
 1176|   178k|                    u2_ref_wd_uv = ps_pred->u2_frm_wd;
 1177|   178k|                    pu1_ref_u = ps_pred->pu1_u_ref;
 1178|       |
 1179|   178k|                }
 1180|       |
 1181|   178k|                u4_wd_uv = ps_pred->i1_mb_partwidth;
 1182|   178k|                u4_ht_uv = ps_pred->i1_mb_partheight;
 1183|   178k|                uc_dx = ps_pred->u1_dydx; /* 8*dy + dx */
 1184|   178k|                uc_dy = uc_dx >> 3;
 1185|   178k|                uc_dx &= 0x7;
 1186|   178k|                if(u1_dir == 0)
  ------------------
  |  Branch (1186:20): [True: 157k, False: 21.0k]
  ------------------
 1187|   157k|                {
 1188|   157k|                    pu1_dest_u = ps_pred->pu1_rec_y_u;
 1189|       |
 1190|   157k|                    pu1_dest_v = ps_pred->u1_pi1_wt_ofst_rec_v;
 1191|   157k|                    u2_row_buf_wd_uv = ps_pred->u2_dst_stride;
 1192|   157k|                    u2_dst_wd = ps_pred->u2_dst_stride;
 1193|   157k|                    u2_dest_wd_uv = u2_dst_wd;
 1194|   157k|                    ps_pred_cr_forw = ps_pred;
 1195|   157k|                }
 1196|  21.0k|                else
 1197|  21.0k|                {
 1198|  21.0k|                    pu1_dest_u = puc_pred0;
 1199|       |
 1200|  21.0k|                    pu1_dest_v = puc_pred1;
 1201|  21.0k|                    u2_dest_wd_uv = BUFFER_WIDTH;
  ------------------
  |  |   42|  21.0k|#define BUFFER_WIDTH        16
  ------------------
 1202|  21.0k|                    u2_dst_wd = BUFFER_WIDTH;
  ------------------
  |  |   42|  21.0k|#define BUFFER_WIDTH        16
  ------------------
 1203|  21.0k|                    ps_pred->pu1_rec_y_u = pu1_dest_u;
 1204|  21.0k|                    ps_pred->u1_pi1_wt_ofst_rec_v = pu1_dest_v;
 1205|  21.0k|                }
 1206|       |
 1207|   178k|                ps_pred++;
 1208|   178k|                ps_dec->pf_inter_pred_chroma(pu1_ref_u, pu1_dest_u,
 1209|   178k|                                             u2_ref_wd_uv, u2_dst_wd,
 1210|   178k|                                             uc_dx, uc_dy, u4_ht_uv,
 1211|   178k|                                             u4_wd_uv);
 1212|       |
 1213|   178k|                if(ps_cur_mb_info->u1_Mux == 1)
  ------------------
  |  Branch (1213:20): [True: 36, False: 178k]
  ------------------
 1214|     36|                {
 1215|       |                    /******************************************************************/
 1216|       |                    /* padding on demand (POD) for U and V done here                  */
 1217|       |                    /* ps_pred now points to the Y entry of the 0,0 component         */
 1218|       |                    /* Y need not be checked for POD because Y lies within            */
 1219|       |                    /* the picture((0,0) mv for Y doesnot get changed. But (0,0) for  */
 1220|       |                    /* U and V can need POD beacause of cross-field mv adjustments    */
 1221|       |                    /* (Table 8-9 of standard)                                        */
 1222|       |                    /******************************************************************/
 1223|     36|                    if((ps_pred + 1)->i1_pod_ht)
  ------------------
  |  Branch (1223:24): [True: 0, False: 36]
  ------------------
 1224|      0|                    {
 1225|      0|                        pu1_pred = (ps_pred + 1)->pu1_pred_u;
 1226|      0|                        pu1_dma_dst = (ps_pred + 1)->pu1_dma_dest_addr;
 1227|      0|                        u1_dma_ht = (ps_pred + 1)->u1_dma_ht_uv;
 1228|      0|                        u1_dma_wd = (ps_pred + 1)->u1_dma_wd_uv
 1229|      0|                                        * YUV420SP_FACTOR;
  ------------------
  |  |  119|      0|#define YUV420SP_FACTOR 2
  ------------------
 1230|      0|                        u2_frm_wd = ps_dec->u2_frm_wd_uv << u1_mb_or_pic_fld;
 1231|      0|                        if((ps_pred + 1)->i1_pod_ht < 0)
  ------------------
  |  Branch (1231:28): [True: 0, False: 0]
  ------------------
 1232|      0|                        {
 1233|       |                            /*Top POD*/
 1234|      0|                            pu1_dma_dst -= ((ps_pred + 1)->i1_pod_ht
 1235|      0|                                            * (ps_pred + 1)->u2_u1_ref_buf_wd
 1236|      0|                                            * YUV420SP_FACTOR);
  ------------------
  |  |  119|      0|#define YUV420SP_FACTOR 2
  ------------------
 1237|      0|                        }
 1238|      0|                        ih264d_copy_2d1d(pu1_pred, pu1_dma_dst, u2_frm_wd,
 1239|      0|                                         u1_dma_wd, u1_dma_ht);
 1240|      0|                        pu1_dma_dst += ((ps_pred + 1)->i1_dma_ht
 1241|      0|                                        * (ps_pred + 1)->u2_u1_ref_buf_wd); //(u1_dma_ht * u1_dma_wd);//
 1242|      0|                        pu1_pred = (ps_pred + 1)->pu1_pred_v;
 1243|      0|                        ih264d_pad_on_demand(ps_pred + 1, CHROM_BLK);
  ------------------
  |  |  287|      0|#define CHROM_BLK            1
  ------------------
 1244|       |
 1245|      0|                    }
 1246|       |
 1247|     36|                    ih264d_multiplex_ref_data(ps_dec, ps_pred, pu1_dest_y,
 1248|     36|                                              pu1_dest_u, ps_cur_mb_info,
 1249|     36|                                              u2_dest_wd_y, u2_dest_wd_uv,
 1250|     36|                                              u1_dir);
 1251|     36|                    ps_pred += 2;
 1252|     36|                }
 1253|   178k|            }
 1254|   178k|        }
 1255|   157k|        if(u1_dir != 0)
  ------------------
  |  Branch (1255:12): [True: 157k, False: 0]
  ------------------
 1256|   157k|            u2_ref_wd_y = MB_SIZE;
  ------------------
  |  |  554|   157k|#define MB_SIZE             16
  ------------------
 1257|       |
 1258|   157k|        u2_num_pels += u4_wd_y * u4_ht_y;
 1259|       |        /* if BI_DIRECT, average the two pred's, and put in ..PredBuffer[0] */
 1260|   157k|        if((u1_is_bi_direct != 0) || (ps_pred_y_forw->u1_wght_pred_type != 0))
  ------------------
  |  Branch (1260:12): [True: 21.0k, False: 136k]
  |  Branch (1260:38): [True: 95.7k, False: 40.9k]
  ------------------
 1261|   116k|        {
 1262|       |
 1263|   116k|            switch(ps_pred_y_forw->u1_wght_pred_type)
  ------------------
  |  Branch (1263:20): [True: 116k, False: 0]
  ------------------
 1264|   116k|            {
 1265|  20.1k|                case 0:
  ------------------
  |  Branch (1265:17): [True: 20.1k, False: 96.6k]
  ------------------
 1266|  20.1k|                    ps_dec->pf_default_weighted_pred_luma(
 1267|  20.1k|                                    ps_pred_y_forw->pu1_rec_y_u, pu1_dest_y,
 1268|  20.1k|                                    ps_pred_y_forw->pu1_rec_y_u,
 1269|  20.1k|                                    u2_row_buf_wd_y, u2_ref_wd_y,
 1270|  20.1k|                                    u2_row_buf_wd_y, u4_ht_uv * 2,
 1271|  20.1k|                                    u4_wd_uv * 2);
 1272|       |
 1273|  20.1k|                    ps_dec->pf_default_weighted_pred_chroma(
 1274|  20.1k|                                    ps_pred_cr_forw->pu1_rec_y_u, pu1_dest_u,
 1275|  20.1k|                                    ps_pred_cr_forw->pu1_rec_y_u,
 1276|  20.1k|                                    u2_row_buf_wd_uv, u2_dst_wd,
 1277|  20.1k|                                    u2_row_buf_wd_uv, u4_ht_uv,
 1278|  20.1k|                                    u4_wd_uv);
 1279|       |
 1280|  20.1k|                    break;
 1281|  95.7k|                case 1:
  ------------------
  |  Branch (1281:17): [True: 95.7k, False: 21.0k]
  ------------------
 1282|  95.7k|                {
 1283|  95.7k|                    UWORD32 *pu4_weight_ofst =
 1284|  95.7k|                                    (UWORD32*)ps_pred_y_forw->u1_pi1_wt_ofst_rec_v;
 1285|  95.7k|                    UWORD32 u4_wt_ofst_u, u4_wt_ofst_v;
 1286|  95.7k|                    UWORD32 u4_wt_ofst_y =
 1287|  95.7k|                                    (UWORD32)(pu4_weight_ofst[0]);
 1288|  95.7k|                    WORD32 weight = (WORD16)(u4_wt_ofst_y & 0xffff);
 1289|  95.7k|                    WORD32 ofst = (WORD8)(u4_wt_ofst_y >> 16);
 1290|       |
 1291|  95.7k|                    ps_dec->pf_weighted_pred_luma(ps_pred_y_forw->pu1_rec_y_u,
 1292|  95.7k|                                                  ps_pred_y_forw->pu1_rec_y_u,
 1293|  95.7k|                                                  u2_row_buf_wd_y,
 1294|  95.7k|                                                  u2_row_buf_wd_y,
 1295|  95.7k|                                                  (u2_log2Y_crwd & 0x0ff),
 1296|  95.7k|                                                  weight, ofst, u4_ht_y,
 1297|  95.7k|                                                  u4_wd_y);
 1298|       |
 1299|  95.7k|                    u4_wt_ofst_u = (UWORD32)(pu4_weight_ofst[2]);
 1300|  95.7k|                    u4_wt_ofst_v = (UWORD32)(pu4_weight_ofst[4]);
 1301|  95.7k|                    weight = ((u4_wt_ofst_v & 0xffff) << 16)
 1302|  95.7k|                                    | (u4_wt_ofst_u & 0xffff);
 1303|  95.7k|                    ofst = ((u4_wt_ofst_v >> 16) << 8)
 1304|  95.7k|                                    | ((u4_wt_ofst_u >> 16) & 0xFF);
 1305|       |
 1306|  95.7k|                    ps_dec->pf_weighted_pred_chroma(
 1307|  95.7k|                                    ps_pred_cr_forw->pu1_rec_y_u,
 1308|  95.7k|                                    ps_pred_cr_forw->pu1_rec_y_u,
 1309|  95.7k|                                    u2_row_buf_wd_uv, u2_row_buf_wd_uv,
 1310|  95.7k|                                    (u2_log2Y_crwd >> 8), weight, ofst,
 1311|  95.7k|                                    u4_ht_y >> 1, u4_wd_y >> 1);
 1312|  95.7k|                }
 1313|       |
 1314|  95.7k|                    break;
 1315|    889|                case 2:
  ------------------
  |  Branch (1315:17): [True: 889, False: 115k]
  ------------------
 1316|    889|                {
 1317|    889|                    UWORD32 *pu4_weight_ofst =
 1318|    889|                                    (UWORD32*)ps_pred_y_forw->u1_pi1_wt_ofst_rec_v;
 1319|    889|                    UWORD32 u4_wt_ofst_u, u4_wt_ofst_v;
 1320|    889|                    UWORD32 u4_wt_ofst_y;
 1321|    889|                    WORD32 weight1, weight2;
 1322|    889|                    WORD32 ofst1, ofst2;
 1323|       |
 1324|    889|                    u4_wt_ofst_y = (UWORD32)(pu4_weight_ofst[0]);
 1325|       |
 1326|    889|                    weight1 = (WORD16)(u4_wt_ofst_y & 0xffff);
 1327|    889|                    ofst1 = (WORD8)(u4_wt_ofst_y >> 16);
 1328|       |
 1329|    889|                    u4_wt_ofst_y = (UWORD32)(pu4_weight_ofst[1]);
 1330|    889|                    weight2 = (WORD16)(u4_wt_ofst_y & 0xffff);
 1331|    889|                    ofst2 = (WORD8)(u4_wt_ofst_y >> 16);
 1332|       |
 1333|    889|                    ps_dec->pf_weighted_bi_pred_luma(ps_pred_y_forw->pu1_rec_y_u,
 1334|    889|                                                     ps_pred_y_back->pu1_rec_y_u,
 1335|    889|                                                     ps_pred_y_forw->pu1_rec_y_u,
 1336|    889|                                                     u2_row_buf_wd_y,
 1337|    889|                                                     u2_ref_wd_y,
 1338|    889|                                                     u2_row_buf_wd_y,
 1339|    889|                                                     (u2_log2Y_crwd & 0x0ff),
 1340|    889|                                                     weight1, weight2, ofst1,
 1341|    889|                                                     ofst2, u4_ht_y,
 1342|    889|                                                     u4_wd_y);
 1343|       |
 1344|    889|                    u4_wt_ofst_u = (UWORD32)(pu4_weight_ofst[2]);
 1345|    889|                    u4_wt_ofst_v = (UWORD32)(pu4_weight_ofst[4]);
 1346|    889|                    weight1 = ((u4_wt_ofst_v & 0xffff) << 16)
 1347|    889|                                    | (u4_wt_ofst_u & 0xffff);
 1348|    889|                    ofst1 = ((u4_wt_ofst_v >> 16) << 8)
 1349|    889|                                    | ((u4_wt_ofst_u >> 16) & 0xFF);
 1350|       |
 1351|    889|                    u4_wt_ofst_u = (UWORD32)(pu4_weight_ofst[3]);
 1352|    889|                    u4_wt_ofst_v = (UWORD32)(pu4_weight_ofst[5]);
 1353|    889|                    weight2 = ((u4_wt_ofst_v & 0xffff) << 16)
 1354|    889|                                    | (u4_wt_ofst_u & 0xffff);
 1355|    889|                    ofst2 = ((u4_wt_ofst_v >> 16) << 8)
 1356|    889|                                    | ((u4_wt_ofst_u >> 16) & 0xFF);
 1357|       |
 1358|    889|                    ps_dec->pf_weighted_bi_pred_chroma(
 1359|    889|                                    (ps_pred_y_forw + 1)->pu1_rec_y_u,
 1360|    889|                                    (ps_pred_y_back + 1)->pu1_rec_y_u,
 1361|    889|                                    (ps_pred_y_forw + 1)->pu1_rec_y_u,
 1362|    889|                                    u2_row_buf_wd_uv, u2_dst_wd,
 1363|    889|                                    u2_row_buf_wd_uv, (u2_log2Y_crwd >> 8),
 1364|    889|                                    weight1, weight2, ofst1, ofst2,
 1365|    889|                                    u4_ht_y >> 1, u4_wd_y >> 1);
 1366|    889|                }
 1367|       |
 1368|    889|                    break;
 1369|   116k|            }
 1370|       |
 1371|   116k|        }
 1372|   157k|    }
 1373|   115k|}
ih264d_multiplex_ref_data:
 1397|     36|{
 1398|     36|    UWORD16 u2_mask = ps_cur_mb_info->u2_mask[u1_dir];
 1399|     36|    UWORD8 *pu1_ref_y, *pu1_ref_u;
 1400|     36|    UWORD8 uc_cond, i, j, u1_dydx;
 1401|     36|    UWORD16 u2_ref_wd_y, u2_ref_wd_uv;
 1402|       |
 1403|     36|    PROFILE_DISABLE_INTER_PRED()
  ------------------
  |  |  119|     36|#define PROFILE_DISABLE_INTER_PRED() ;
  ------------------
 1404|       |
 1405|     36|    if(ps_pred->i1_pod_ht)
  ------------------
  |  Branch (1405:8): [True: 0, False: 36]
  ------------------
 1406|      0|    {
 1407|      0|        pu1_ref_y = ps_pred->pu1_dma_dest_addr;
 1408|       |
 1409|      0|        u2_ref_wd_y = ps_pred->u2_u1_ref_buf_wd;
 1410|      0|    }
 1411|     36|    else
 1412|     36|    {
 1413|     36|        pu1_ref_y = ps_pred->pu1_y_ref;
 1414|     36|        u2_ref_wd_y = ps_pred->u2_frm_wd;
 1415|     36|    }
 1416|       |
 1417|     36|    ps_pred++;
 1418|     36|    if(ps_pred->i1_pod_ht)
  ------------------
  |  Branch (1418:8): [True: 0, False: 36]
  ------------------
 1419|      0|    {
 1420|      0|        pu1_ref_u = ps_pred->pu1_dma_dest_addr;
 1421|      0|        u2_ref_wd_uv = ps_pred->u2_u1_ref_buf_wd * YUV420SP_FACTOR;
  ------------------
  |  |  119|      0|#define YUV420SP_FACTOR 2
  ------------------
 1422|       |
 1423|      0|    }
 1424|     36|    else
 1425|     36|    {
 1426|     36|        pu1_ref_u = ps_pred->pu1_u_ref;
 1427|     36|        u2_ref_wd_uv = ps_pred->u2_frm_wd;
 1428|       |
 1429|     36|    }
 1430|       |
 1431|     36|    u1_dydx = ps_pred->u1_dydx;
 1432|       |
 1433|     36|    {
 1434|     36|        UWORD8 uc_dx, uc_dy;
 1435|     36|        UWORD8 *pu1_scratch_u;
 1436|       |
 1437|     36|        uc_dx = u1_dydx & 0x3;
 1438|     36|        uc_dy = u1_dydx >> 3;
 1439|     36|        if(u1_dydx != 0)
  ------------------
  |  Branch (1439:12): [True: 0, False: 36]
  ------------------
 1440|      0|        {
 1441|      0|            pred_info_t * ps_prv_pred = ps_pred - 2;
 1442|      0|            pu1_scratch_u = ps_prv_pred->pu1_dma_dest_addr;
 1443|      0|            ps_dec->pf_inter_pred_chroma(pu1_ref_u, pu1_scratch_u,
 1444|      0|                                         u2_ref_wd_uv, 16, uc_dx, uc_dy, 8,
 1445|      0|                                         8);
 1446|       |
 1447|       |            /* Modify ref pointer and refWidth to point to scratch    */
 1448|       |            /* buffer to be used below in ih264d_copy_multiplex_data functions */
 1449|       |            /* CHANGED CODE */
 1450|      0|            pu1_ref_u = pu1_scratch_u;
 1451|      0|            u2_ref_wd_uv = 8 * YUV420SP_FACTOR;
  ------------------
  |  |  119|      0|#define YUV420SP_FACTOR 2
  ------------------
 1452|      0|        }
 1453|     36|    }
 1454|     36|    {
 1455|    180|        for(i = 0; i < 4; i++)
  ------------------
  |  Branch (1455:20): [True: 144, False: 36]
  ------------------
 1456|    144|        {
 1457|    720|            for(j = 0; j < 4; j++)
  ------------------
  |  Branch (1457:24): [True: 576, False: 144]
  ------------------
 1458|    576|            {
 1459|    576|                uc_cond = u2_mask & 1;
 1460|    576|                u2_mask >>= 1;
 1461|    576|                if(uc_cond)
  ------------------
  |  Branch (1461:20): [True: 56, False: 520]
  ------------------
 1462|     56|                {
 1463|     56|                    *(UWORD32 *)(pu1_dest_y + u2_dest_wd_y) =
 1464|     56|                                    *(UWORD32 *)(pu1_ref_y + u2_ref_wd_y);
 1465|     56|                    *(UWORD32 *)(pu1_dest_y + 2 * u2_dest_wd_y) =
 1466|     56|                                    *(UWORD32 *)(pu1_ref_y + 2 * u2_ref_wd_y);
 1467|     56|                    *(UWORD32 *)(pu1_dest_y + 3 * u2_dest_wd_y) =
 1468|     56|                                    *(UWORD32 *)(pu1_ref_y + 3 * u2_ref_wd_y);
 1469|     56|                    {
 1470|     56|                        UWORD32 *dst, *src;
 1471|     56|                        dst = (UWORD32 *)pu1_dest_y;
 1472|     56|                        src = (UWORD32 *)pu1_ref_y;
 1473|     56|                        *dst = *src;
 1474|     56|                        dst++;
 1475|     56|                        src++;
 1476|     56|                        pu1_dest_y = (UWORD8 *)dst;
 1477|     56|                        pu1_ref_y = (UWORD8 *)src;
 1478|     56|                    }
 1479|     56|                    *(UWORD32 *)(pu1_dest_u + u2_dest_wd_uv) =
 1480|     56|                                    *(UWORD32 *)(pu1_ref_u + u2_ref_wd_uv);
 1481|     56|                    {
 1482|     56|                        UWORD32 *dst, *src;
 1483|     56|                        dst = (UWORD32 *)pu1_dest_u;
 1484|     56|                        src = (UWORD32 *)pu1_ref_u;
 1485|     56|                        *dst = *src;
 1486|     56|                        dst++;
 1487|     56|                        src++;
 1488|     56|                        pu1_dest_u = (UWORD8 *)dst;
 1489|     56|                        pu1_ref_u = (UWORD8 *)src;
 1490|     56|                    }
 1491|       |
 1492|     56|                }
 1493|    520|                else
 1494|    520|                {
 1495|    520|                    pu1_dest_y += 4;
 1496|    520|                    pu1_ref_y += 4;
 1497|    520|                    pu1_dest_u += 2 * YUV420SP_FACTOR;
  ------------------
  |  |  119|    520|#define YUV420SP_FACTOR 2
  ------------------
 1498|    520|                    pu1_ref_u += 2 * YUV420SP_FACTOR;
  ------------------
  |  |  119|    520|#define YUV420SP_FACTOR 2
  ------------------
 1499|    520|                }
 1500|    576|            }
 1501|    144|            pu1_ref_y += 4 * (u2_ref_wd_y - 4);
 1502|    144|            pu1_ref_u += 2 * (u2_ref_wd_uv - 4 * YUV420SP_FACTOR);
  ------------------
  |  |  119|    144|#define YUV420SP_FACTOR 2
  ------------------
 1503|    144|            pu1_dest_y += 4 * (u2_dest_wd_y - 4);
 1504|    144|            pu1_dest_u += 2 * (u2_dest_wd_uv - 4 * YUV420SP_FACTOR);
  ------------------
  |  |  119|    144|#define YUV420SP_FACTOR 2
  ------------------
 1505|    144|        }
 1506|     36|    }
 1507|     36|}

ih264d_transfer_mb_group_data:
 1396|  82.9k|{
 1397|  82.9k|    dec_mb_info_t *ps_cur_mb_info = ps_dec->ps_nmb_info;
 1398|  82.9k|    tfr_ctxt_t *ps_trns_addr = &ps_dec->s_tran_addrecon;
 1399|  82.9k|    UWORD16 u2_mb_y;
 1400|  82.9k|    UWORD32 y_offset;
 1401|  82.9k|    UWORD32 u4_frame_stride;
 1402|  82.9k|    mb_neigbour_params_t *ps_temp;
 1403|  82.9k|    const UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
 1404|  82.9k|    UNUSED(u4_end_of_row_next);
  ------------------
  |  |   45|  82.9k|#define UNUSED(x) ((void)(x))
  ------------------
 1405|       |
 1406|  82.9k|    ps_trns_addr->pu1_dest_y += ps_trns_addr->u4_inc_y[u4_end_of_row];
 1407|  82.9k|    ps_trns_addr->pu1_dest_u += ps_trns_addr->u4_inc_uv[u4_end_of_row];
 1408|  82.9k|    ps_trns_addr->pu1_dest_v += ps_trns_addr->u4_inc_uv[u4_end_of_row];
 1409|       |
 1410|       |    /* Swap top and current pointers */
 1411|  82.9k|    if(u4_end_of_row)
  ------------------
  |  Branch (1411:8): [True: 81.7k, False: 1.18k]
  ------------------
 1412|  81.7k|    {
 1413|       |
 1414|  81.7k|        if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (1414:12): [True: 5.25k, False: 76.5k]
  ------------------
 1415|  5.25k|        {
 1416|  5.25k|            u2_mb_y = ps_dec->i2_dec_thread_mb_y;
 1417|  5.25k|        }
 1418|  76.5k|        else
 1419|  76.5k|        {
 1420|  76.5k|            ps_temp = ps_dec->ps_cur_mb_row;
 1421|  76.5k|            ps_dec->ps_cur_mb_row = ps_dec->ps_top_mb_row;
 1422|  76.5k|            ps_dec->ps_top_mb_row = ps_temp;
 1423|       |
 1424|  76.5k|            u2_mb_y = ps_dec->u2_mby + (1 + u1_mbaff);
 1425|  76.5k|        }
 1426|       |
 1427|  81.7k|        u4_frame_stride = ps_dec->u2_frm_wd_y
 1428|  81.7k|                        << ps_dec->ps_cur_slice->u1_field_pic_flag;
 1429|  81.7k|        y_offset = (u2_mb_y * u4_frame_stride) << 4;
 1430|  81.7k|        ps_trns_addr->pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1 + y_offset;
 1431|       |
 1432|  81.7k|        u4_frame_stride = ps_dec->u2_frm_wd_uv
 1433|  81.7k|                        << ps_dec->ps_cur_slice->u1_field_pic_flag;
 1434|  81.7k|        y_offset = (u2_mb_y * u4_frame_stride) << 3;
 1435|  81.7k|        ps_trns_addr->pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2 + y_offset;
 1436|  81.7k|        ps_trns_addr->pu1_dest_v = ps_dec->s_cur_pic.pu1_buf3 + y_offset;
 1437|       |
 1438|  81.7k|        ps_trns_addr->pu1_mb_y = ps_trns_addr->pu1_dest_y;
 1439|  81.7k|        ps_trns_addr->pu1_mb_u = ps_trns_addr->pu1_dest_u;
 1440|  81.7k|        ps_trns_addr->pu1_mb_v = ps_trns_addr->pu1_dest_v;
 1441|  81.7k|    }
 1442|       |
 1443|       |    /*
 1444|       |     * The Slice boundary is also a valid condition to transfer. So recalculate
 1445|       |     * the Left increment, in case the number of MBs is lesser than the
 1446|       |     * N MB value. u4_num_mbs will be equal to N of N MB if the entire N Mb is
 1447|       |     * decoded.
 1448|       |     */
 1449|  82.9k|    ps_dec->s_tran_addrecon.u2_mv_left_inc = ((WORD16)(u4_num_mbs >> u1_mbaff) - 1)
 1450|  82.9k|                    << (4 + u1_mbaff);
 1451|  82.9k|    ps_dec->s_tran_addrecon.u2_mv_top_left_inc = (WORD16)(u4_num_mbs << 2) - 1
 1452|  82.9k|                    - (u1_mbaff << 2);
 1453|       |
 1454|  82.9k|    if(ps_dec->u1_separate_parse == 0)
  ------------------
  |  Branch (1454:8): [True: 77.4k, False: 5.50k]
  ------------------
 1455|  77.4k|    {
 1456|       |        /* reassign left MV and cur MV pointers */
 1457|  77.4k|        ps_dec->ps_mv_left = ps_dec->ps_mv_cur
 1458|  77.4k|                        + ps_dec->s_tran_addrecon.u2_mv_left_inc;
 1459|       |
 1460|  77.4k|        ps_dec->ps_mv_cur += (u4_num_mbs << 4);
 1461|  77.4k|    }
 1462|       |
 1463|       |    /* Increment deblock parameters pointer in external memory */
 1464|       |
 1465|  82.9k|    if(ps_dec->u1_separate_parse == 0)
  ------------------
  |  Branch (1465:8): [True: 77.4k, False: 5.50k]
  ------------------
 1466|  77.4k|    {
 1467|  77.4k|        ps_dec->ps_deblk_mbn += u4_num_mbs;
 1468|  77.4k|    }
 1469|       |
 1470|  82.9k|}

ih264d_get_motion_vector_predictor:
   80|   133k|{
   81|   133k|    WORD8 c_temp;
   82|   133k|    UWORD8 uc_B2 = (u1_B << 1);
   83|       |
   84|       |    /* If only one of the candidate blocks has a reference frame equal to
   85|       |     the current block then use the same block as the final predictor */
   86|   133k|    c_temp =
   87|   133k|                    (ps_mv_pred[LEFT]->i1_ref_frame[u1_B] == u1_ref_idx)
  ------------------
  |  |  512|   133k|#define LEFT  0
  ------------------
   88|   133k|                                    | ((ps_mv_pred[TOP]->i1_ref_frame[u1_B]
  ------------------
  |  |  514|   133k|#define TOP   1
  ------------------
   89|   133k|                                                    == u1_ref_idx) << 1)
   90|   133k|                                    | ((ps_mv_pred[TOP_R]->i1_ref_frame[u1_B]
  ------------------
  |  |  516|   133k|#define TOP_R 2
  ------------------
   91|   133k|                                                    == u1_ref_idx) << 2);
   92|   133k|    c_temp = pu1_mv_pred_condition[c_temp];
   93|       |
   94|   133k|    if(c_temp != -1)
  ------------------
  |  Branch (94:8): [True: 9.89k, False: 123k]
  ------------------
   95|  9.89k|    {
   96|       |        /* Case when only when one of the cadidate block has the same
   97|       |         reference frame as the current block */
   98|  9.89k|        ps_result->i2_mv[uc_B2 + 0] = ps_mv_pred[c_temp]->i2_mv[uc_B2 + 0];
   99|  9.89k|        ps_result->i2_mv[uc_B2 + 1] = ps_mv_pred[c_temp]->i2_mv[uc_B2 + 1];
  100|  9.89k|    }
  101|   123k|    else
  102|   123k|    {
  103|   123k|        WORD32 D0, D1;
  104|   123k|        D0 = MIN(ps_mv_pred[0]->i2_mv[uc_B2 + 0],
  ------------------
  |  |   61|   123k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 25.7k, False: 97.6k]
  |  |  ------------------
  ------------------
  105|   123k|                 ps_mv_pred[1]->i2_mv[uc_B2 + 0]);
  106|   123k|        D1 = MAX(ps_mv_pred[0]->i2_mv[uc_B2 + 0],
  ------------------
  |  |   60|   123k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 46.4k, False: 76.9k]
  |  |  ------------------
  ------------------
  107|   123k|                 ps_mv_pred[1]->i2_mv[uc_B2 + 0]);
  108|   123k|        D1 = MIN(D1, ps_mv_pred[2]->i2_mv[uc_B2 + 0]);
  ------------------
  |  |   61|   123k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 25.5k, False: 97.8k]
  |  |  ------------------
  ------------------
  109|   123k|        ps_result->i2_mv[uc_B2 + 0] = (WORD16)(MAX(D0, D1));
  ------------------
  |  |   60|   123k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 15.9k, False: 107k]
  |  |  ------------------
  ------------------
  110|       |
  111|   123k|        D0 = MIN(ps_mv_pred[0]->i2_mv[uc_B2 + 1],
  ------------------
  |  |   61|   123k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 25.1k, False: 98.2k]
  |  |  ------------------
  ------------------
  112|   123k|                 ps_mv_pred[1]->i2_mv[uc_B2 + 1]);
  113|   123k|        D1 = MAX(ps_mv_pred[0]->i2_mv[uc_B2 + 1],
  ------------------
  |  |   60|   123k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 43.7k, False: 79.6k]
  |  |  ------------------
  ------------------
  114|   123k|                 ps_mv_pred[1]->i2_mv[uc_B2 + 1]);
  115|   123k|        D1 = MIN(D1, ps_mv_pred[2]->i2_mv[uc_B2 + 1]);
  ------------------
  |  |   61|   123k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 22.3k, False: 101k]
  |  |  ------------------
  ------------------
  116|   123k|        ps_result->i2_mv[uc_B2 + 1] = (WORD16)(MAX(D0, D1));
  ------------------
  |  |   60|   123k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 14.4k, False: 108k]
  |  |  ------------------
  ------------------
  117|       |
  118|   123k|    }
  119|   133k|}
ih264d_non_mbaff_mv_pred:
  342|   677k|{
  343|   677k|    UWORD16 u2_b_in = 0, u2_c_in = 0, u2_d_in = 0;
  344|   677k|    UWORD32 u4_sub_mb_x = (u4_sub_mb_num & 3), uc_sub_mb_y = (u4_sub_mb_num >> 2);
  345|       |
  346|       |    /* Checking in the subMB exists, calculating their motion vectors to be
  347|       |     used as predictors and the reference frames of those subMBs */
  348|       |
  349|   677k|    ps_mv_pred[LEFT] = &ps_dec->s_default_mv_pred;
  ------------------
  |  |  512|   677k|#define LEFT  0
  ------------------
  350|   677k|    ps_mv_pred[TOP] = &(ps_dec->s_default_mv_pred);
  ------------------
  |  |  514|   677k|#define TOP   1
  ------------------
  351|   677k|    ps_mv_pred[TOP_R] = &(ps_dec->s_default_mv_pred);
  ------------------
  |  |  516|   677k|#define TOP_R 2
  ------------------
  352|       |    /* Check if the left subMb is available */
  353|       |
  354|   677k|    if(u4_sub_mb_x)
  ------------------
  |  Branch (354:8): [True: 53.0k, False: 624k]
  ------------------
  355|  53.0k|    {
  356|  53.0k|        ps_mv_pred[LEFT] = (ps_mv_nmb - 1);
  ------------------
  |  |  512|  53.0k|#define LEFT  0
  ------------------
  357|  53.0k|    }
  358|   624k|    else
  359|   624k|    {
  360|   624k|        if(ps_cur_mb_info->u1_mb_ngbr_availablity & LEFT_MB_AVAILABLE_MASK)
  ------------------
  |  |   53|   624k|#define LEFT_MB_AVAILABLE_MASK      0x01
  ------------------
  |  Branch (360:12): [True: 508k, False: 115k]
  ------------------
  361|   508k|        {
  362|   508k|            ps_mv_pred[LEFT] = (ps_mv_nmb - 13);
  ------------------
  |  |  512|   508k|#define LEFT  0
  ------------------
  363|   508k|        }
  364|   624k|    }
  365|       |
  366|       |    /* Check if the top subMB is available */
  367|   677k|    if(uc_sub_mb_y)
  ------------------
  |  Branch (367:8): [True: 51.2k, False: 625k]
  ------------------
  368|  51.2k|    {
  369|  51.2k|        u2_b_in = 1;
  370|  51.2k|        ps_mv_ntop = ps_mv_nmb - 4;
  371|  51.2k|        ps_mv_pred[TOP] = ps_mv_ntop;
  ------------------
  |  |  514|  51.2k|#define TOP   1
  ------------------
  372|       |
  373|  51.2k|    }
  374|   625k|    else
  375|   625k|    {
  376|   625k|        u2_b_in = (ps_cur_mb_info->u1_mb_ngbr_availablity & TOP_MB_AVAILABLE_MASK);
  ------------------
  |  |   55|   625k|#define TOP_MB_AVAILABLE_MASK       0x04
  ------------------
  377|   625k|        if(u2_b_in)
  ------------------
  |  Branch (377:12): [True: 588k, False: 37.2k]
  ------------------
  378|   588k|        {
  379|   588k|            ps_mv_pred[TOP] = ps_mv_ntop;
  ------------------
  |  |  514|   588k|#define TOP   1
  ------------------
  380|   588k|        }
  381|   625k|    }
  382|       |
  383|       |    /* Check if the top right subMb is available. The top right subMb is
  384|       |     defined as the top right subMb at the top right corner of the MB
  385|       |     partition. The top right subMb index starting from the top left
  386|       |     corner of the MB partition is given by
  387|       |     TopRightSubMbIndx = TopLeftSubMbIndx + (WidthOfMbPartition - 6) / 2
  388|       |     */
  389|   677k|    u2_c_in = CHECKBIT(ps_cur_mb_info->u2_top_right_avail_mask,
  ------------------
  |  |   54|   677k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  ------------------
  390|   677k|                        (u4_sub_mb_num + uc_mb_part_width - 1));
  391|   677k|    if(u2_c_in)
  ------------------
  |  Branch (391:8): [True: 506k, False: 171k]
  ------------------
  392|   506k|    {
  393|   506k|        ps_mv_pred[TOP_R] = (ps_mv_ntop + uc_mb_part_width);
  ------------------
  |  |  516|   506k|#define TOP_R 2
  ------------------
  394|       |
  395|   506k|        if(uc_sub_mb_y == 0)
  ------------------
  |  Branch (395:12): [True: 483k, False: 22.3k]
  ------------------
  396|   483k|        {
  397|       |            /* CHANGED CODE */
  398|   483k|            if((u4_sub_mb_x + uc_mb_part_width) > 3)
  ------------------
  |  Branch (398:16): [True: 460k, False: 23.1k]
  ------------------
  399|   460k|                ps_mv_pred[TOP_R] += 12;
  ------------------
  |  |  516|   460k|#define TOP_R 2
  ------------------
  400|   483k|        }
  401|   506k|    }
  402|   171k|    else
  403|   171k|    {
  404|   171k|        u2_d_in = CHECKBIT(ps_cur_mb_info->u2_top_left_avail_mask, u4_sub_mb_num);
  ------------------
  |  |   54|   171k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  ------------------
  405|       |        /* Check if the the top left subMB is available */
  406|   171k|        if(u2_d_in)
  ------------------
  |  Branch (406:12): [True: 132k, False: 38.5k]
  ------------------
  407|   132k|        {
  408|       |            /* CHANGED CODE */
  409|   132k|            ps_mv_pred[TOP_R] = (ps_mv_ntop - 1);
  ------------------
  |  |  516|   132k|#define TOP_R 2
  ------------------
  410|   132k|            if(u4_sub_mb_x == 0)
  ------------------
  |  Branch (410:16): [True: 107k, False: 25.1k]
  ------------------
  411|   107k|            {
  412|   107k|                if(uc_sub_mb_y)
  ------------------
  |  Branch (412:20): [True: 5.94k, False: 101k]
  ------------------
  413|  5.94k|                {
  414|  5.94k|                    ps_mv_pred[TOP_R] = (ps_mv_nmb - 17);
  ------------------
  |  |  516|  5.94k|#define TOP_R 2
  ------------------
  415|  5.94k|                }
  416|   101k|                else
  417|   101k|                {
  418|       |                    /* CHANGED CODE */
  419|   101k|                    ps_mv_pred[TOP_R] -= 12;
  ------------------
  |  |  516|   101k|#define TOP_R 2
  ------------------
  420|   101k|                }
  421|   107k|            }
  422|   132k|        }
  423|  38.5k|        else if(u2_b_in == 0)
  ------------------
  |  Branch (423:17): [True: 36.2k, False: 2.28k]
  ------------------
  424|  36.2k|        {
  425|       |            /* If all the subMBs B, C, D are all out of the frame then their MV
  426|       |             and their reference picture is equal to that of A */
  427|  36.2k|            ps_mv_pred[TOP] = ps_mv_pred[LEFT];
  ------------------
  |  |  514|  36.2k|#define TOP   1
  ------------------
                          ps_mv_pred[TOP] = ps_mv_pred[LEFT];
  ------------------
  |  |  512|  36.2k|#define LEFT  0
  ------------------
  428|  36.2k|            ps_mv_pred[TOP_R] = ps_mv_pred[LEFT];
  ------------------
  |  |  516|  36.2k|#define TOP_R 2
  ------------------
                          ps_mv_pred[TOP_R] = ps_mv_pred[LEFT];
  ------------------
  |  |  512|  36.2k|#define LEFT  0
  ------------------
  429|  36.2k|        }
  430|   171k|    }
  431|   677k|}
ih264d_mvpred_nonmbaffB:
  468|   125k|{
  469|   125k|    UWORD8 u1_a_in, u1_b_in, uc_temp1, uc_temp2, uc_temp3;
  470|   125k|    mv_pred_t *ps_mv_pred[3];
  471|   125k|    UWORD8 uc_B2, uc_lx, u1_ref_idx;
  472|   125k|    UWORD8 u1_direct_zero_pred_flag = 0;
  473|       |
  474|   125k|    ih264d_non_mbaff_mv_pred(ps_mv_pred, u4_sub_mb_num, ps_mv_nmb, ps_mv_ntop,
  475|   125k|                             ps_dec, uc_mb_part_width, ps_cur_mb_info);
  476|       |
  477|   256k|    for(uc_lx = u1_lx_start; uc_lx < u1_lxend; uc_lx++)
  ------------------
  |  Branch (477:30): [True: 131k, False: 125k]
  ------------------
  478|   131k|    {
  479|   131k|        u1_ref_idx = ps_mv_final_pred->i1_ref_frame[uc_lx];
  480|   131k|        uc_B2 = (uc_lx << 1);
  481|   131k|        switch(u1_mb_mc_mode)
  482|   131k|        {
  483|  7.87k|            case PRED_16x8:
  ------------------
  |  |  451|  7.87k|#define PRED_16x8   1
  ------------------
  |  Branch (483:13): [True: 7.87k, False: 123k]
  ------------------
  484|       |                /* Directional prediction for a 16x8 MB partition */
  485|  7.87k|                if(u4_sub_mb_num == 0)
  ------------------
  |  Branch (485:20): [True: 4.12k, False: 3.74k]
  ------------------
  486|  4.12k|                {
  487|       |                    /* Calculating the MV pred for the top 16x8 block */
  488|  4.12k|                    if(ps_mv_pred[TOP]->i1_ref_frame[uc_lx] == u1_ref_idx)
  ------------------
  |  |  514|  4.12k|#define TOP   1
  ------------------
  |  Branch (488:24): [True: 2.82k, False: 1.30k]
  ------------------
  489|  2.82k|                    {
  490|       |                        /* If the reference frame used by the top subMB is same as the
  491|       |                         reference frame used by the current block then MV predictor to
  492|       |                         be used for the current block is same as the MV of the top
  493|       |                         subMB */
  494|  2.82k|                        ps_mv_final_pred->i2_mv[uc_B2 + 0] =
  495|  2.82k|                                        ps_mv_pred[TOP]->i2_mv[uc_B2 + 0];
  ------------------
  |  |  514|  2.82k|#define TOP   1
  ------------------
  496|  2.82k|                        ps_mv_final_pred->i2_mv[uc_B2 + 1] =
  497|  2.82k|                                        ps_mv_pred[TOP]->i2_mv[uc_B2 + 1];
  ------------------
  |  |  514|  2.82k|#define TOP   1
  ------------------
  498|  2.82k|                    }
  499|  1.30k|                    else
  500|  1.30k|                    {
  501|       |                        /* The MV predictor is calculated according to the process
  502|       |                         defined in 8.4.1.2.1 */
  503|  1.30k|                        ih264d_get_motion_vector_predictor(
  504|  1.30k|                                        ps_mv_final_pred,
  505|  1.30k|                                        ps_mv_pred,
  506|  1.30k|                                        u1_ref_idx,
  507|  1.30k|                                        uc_lx,
  508|  1.30k|                                        (const UWORD8 *)gau1_ih264d_mv_pred_condition);
  509|  1.30k|                    }
  510|  4.12k|                }
  511|  3.74k|                else
  512|  3.74k|                {
  513|  3.74k|                    if(ps_mv_pred[LEFT]->i1_ref_frame[uc_lx] == u1_ref_idx)
  ------------------
  |  |  512|  3.74k|#define LEFT  0
  ------------------
  |  Branch (513:24): [True: 2.49k, False: 1.25k]
  ------------------
  514|  2.49k|                    {
  515|       |                        /* If the reference frame used by the left subMB is same as the
  516|       |                         reference frame used by the current block then MV predictor to
  517|       |                         be used for the current block is same as the MV of the left
  518|       |                         subMB */
  519|  2.49k|                        ps_mv_final_pred->i2_mv[uc_B2 + 0] =
  520|  2.49k|                                        ps_mv_pred[LEFT]->i2_mv[uc_B2 + 0];
  ------------------
  |  |  512|  2.49k|#define LEFT  0
  ------------------
  521|  2.49k|                        ps_mv_final_pred->i2_mv[uc_B2 + 1] =
  522|  2.49k|                                        ps_mv_pred[LEFT]->i2_mv[uc_B2 + 1];
  ------------------
  |  |  512|  2.49k|#define LEFT  0
  ------------------
  523|  2.49k|                    }
  524|  1.25k|                    else
  525|  1.25k|                    {
  526|       |                        /* The MV predictor is calculated according to the process
  527|       |                         defined in 8.4.1.2.1 */
  528|  1.25k|                        ih264d_get_motion_vector_predictor(
  529|  1.25k|                                        ps_mv_final_pred,
  530|  1.25k|                                        ps_mv_pred,
  531|  1.25k|                                        u1_ref_idx,
  532|  1.25k|                                        uc_lx,
  533|  1.25k|                                        (const UWORD8 *)gau1_ih264d_mv_pred_condition);
  534|  1.25k|                    }
  535|  3.74k|                }
  536|  7.87k|                break;
  537|  9.54k|            case PRED_8x16:
  ------------------
  |  |  452|  9.54k|#define PRED_8x16   2
  ------------------
  |  Branch (537:13): [True: 9.54k, False: 121k]
  ------------------
  538|       |                /* Directional prediction for a 8x16 MB partition */
  539|  9.54k|                if(u4_sub_mb_num == 0)
  ------------------
  |  Branch (539:20): [True: 4.81k, False: 4.72k]
  ------------------
  540|  4.81k|                {
  541|  4.81k|                    if(ps_mv_pred[LEFT]->i1_ref_frame[uc_lx] == u1_ref_idx)
  ------------------
  |  |  512|  4.81k|#define LEFT  0
  ------------------
  |  Branch (541:24): [True: 2.92k, False: 1.88k]
  ------------------
  542|  2.92k|                    {
  543|       |                        /* If the reference frame used by the left subMB is same as the
  544|       |                         reference frame used by the current block then MV predictor to
  545|       |                         be used for the current block is same as the MV of the left
  546|       |                         subMB */
  547|  2.92k|                        ps_mv_final_pred->i2_mv[uc_B2 + 0] =
  548|  2.92k|                                        ps_mv_pred[LEFT]->i2_mv[uc_B2 + 0];
  ------------------
  |  |  512|  2.92k|#define LEFT  0
  ------------------
  549|  2.92k|                        ps_mv_final_pred->i2_mv[uc_B2 + 1] =
  550|  2.92k|                                        ps_mv_pred[LEFT]->i2_mv[uc_B2 + 1];
  ------------------
  |  |  512|  2.92k|#define LEFT  0
  ------------------
  551|  2.92k|                    }
  552|  1.88k|                    else
  553|  1.88k|                    {
  554|       |                        /* The MV predictor is calculated according to the process
  555|       |                         defined in 8.4.1.2.1 */
  556|  1.88k|                        ih264d_get_motion_vector_predictor(
  557|  1.88k|                                        ps_mv_final_pred,
  558|  1.88k|                                        ps_mv_pred,
  559|  1.88k|                                        u1_ref_idx,
  560|  1.88k|                                        uc_lx,
  561|  1.88k|                                        (const UWORD8 *)gau1_ih264d_mv_pred_condition);
  562|  1.88k|                    }
  563|  4.81k|                }
  564|  4.72k|                else
  565|  4.72k|                {
  566|  4.72k|                    if(ps_mv_pred[TOP_R]->i1_ref_frame[uc_lx] == u1_ref_idx)
  ------------------
  |  |  516|  4.72k|#define TOP_R 2
  ------------------
  |  Branch (566:24): [True: 2.90k, False: 1.82k]
  ------------------
  567|  2.90k|                    {
  568|       |                        /* If the reference frame used by the top right subMB is same as
  569|       |                         the reference frame used by the current block then MV
  570|       |                         predictor to be used for the current block is same as the MV
  571|       |                         of the left subMB */
  572|  2.90k|                        ps_mv_final_pred->i2_mv[uc_B2 + 0] =
  573|  2.90k|                                        ps_mv_pred[TOP_R]->i2_mv[uc_B2 + 0];
  ------------------
  |  |  516|  2.90k|#define TOP_R 2
  ------------------
  574|  2.90k|                        ps_mv_final_pred->i2_mv[uc_B2 + 1] =
  575|  2.90k|                                        ps_mv_pred[TOP_R]->i2_mv[uc_B2 + 1];
  ------------------
  |  |  516|  2.90k|#define TOP_R 2
  ------------------
  576|  2.90k|                    }
  577|  1.82k|                    else
  578|  1.82k|                    {
  579|       |                        /* The MV predictor is calculated according to the process
  580|       |                         defined in 8.4.1.2.1 */
  581|  1.82k|                        ih264d_get_motion_vector_predictor(
  582|  1.82k|                                        ps_mv_final_pred,
  583|  1.82k|                                        ps_mv_pred,
  584|  1.82k|                                        u1_ref_idx,
  585|  1.82k|                                        uc_lx,
  586|  1.82k|                                        (const UWORD8 *)gau1_ih264d_mv_pred_condition);
  587|  1.82k|                    }
  588|  4.72k|                }
  589|  9.54k|                break;
  590|  6.72k|            case B_DIRECT_SPATIAL:
  ------------------
  |  |  489|  6.72k|#define B_DIRECT_SPATIAL  26
  ------------------
  |  Branch (590:13): [True: 6.72k, False: 124k]
  ------------------
  591|       |                /* Case when the MB has been skipped */
  592|       |                /* If either of left or the top subMB is not present
  593|       |                 OR
  594|       |                 If both the MV components of either the left or the top subMB are
  595|       |                 zero and their reference frame pointer pointing to 0
  596|       |                 then MV for the skipped MB is zero
  597|       |                 else the Median of the mv_pred_t is used */
  598|  6.72k|                uc_temp1 = (UWORD8)ps_mv_pred[LEFT]->i1_ref_frame[0];
  ------------------
  |  |  512|  6.72k|#define LEFT  0
  ------------------
  599|  6.72k|                uc_temp2 = (UWORD8)ps_mv_pred[TOP]->i1_ref_frame[0];
  ------------------
  |  |  514|  6.72k|#define TOP   1
  ------------------
  600|  6.72k|                uc_temp3 = (UWORD8)ps_mv_pred[TOP_R]->i1_ref_frame[0];
  ------------------
  |  |  516|  6.72k|#define TOP_R 2
  ------------------
  601|       |
  602|  6.72k|                ps_mv_final_pred->i1_ref_frame[0] = MIN(uc_temp1,
  ------------------
  |  |   61|  13.4k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 40, False: 6.68k]
  |  |  |  Branch (61:24): [True: 561, False: 6.16k]
  |  |  |  Branch (61:32): [True: 561, False: 6.12k]
  |  |  ------------------
  ------------------
  603|  6.72k|                                                      MIN(uc_temp2, uc_temp3));
  604|       |
  605|  6.72k|                uc_temp1 = (UWORD8)ps_mv_pred[LEFT]->i1_ref_frame[1];
  ------------------
  |  |  512|  6.72k|#define LEFT  0
  ------------------
  606|  6.72k|                uc_temp2 = (UWORD8)ps_mv_pred[TOP]->i1_ref_frame[1];
  ------------------
  |  |  514|  6.72k|#define TOP   1
  ------------------
  607|  6.72k|                uc_temp3 = (UWORD8)ps_mv_pred[TOP_R]->i1_ref_frame[1];
  ------------------
  |  |  516|  6.72k|#define TOP_R 2
  ------------------
  608|       |
  609|  6.72k|                ps_mv_final_pred->i1_ref_frame[1] = MIN(uc_temp1,
  ------------------
  |  |   61|  13.4k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 26, False: 6.69k]
  |  |  |  Branch (61:24): [True: 442, False: 6.28k]
  |  |  |  Branch (61:32): [True: 442, False: 6.25k]
  |  |  ------------------
  ------------------
  610|  6.72k|                                                      MIN(uc_temp2, uc_temp3));
  611|       |
  612|  6.72k|                if((ps_mv_final_pred->i1_ref_frame[0] < 0)
  ------------------
  |  Branch (612:20): [True: 611, False: 6.11k]
  ------------------
  613|    611|                                && (ps_mv_final_pred->i1_ref_frame[1] < 0))
  ------------------
  |  Branch (613:36): [True: 392, False: 219]
  ------------------
  614|    392|                {
  615|    392|                    u1_direct_zero_pred_flag = 1;
  616|    392|                    ps_mv_final_pred->i1_ref_frame[0] = 0;
  617|    392|                    ps_mv_final_pred->i1_ref_frame[1] = 0;
  618|    392|                }
  619|  6.72k|                ih264d_get_motion_vector_predictor(
  620|  6.72k|                                ps_mv_final_pred, ps_mv_pred,
  621|  6.72k|                                ps_mv_final_pred->i1_ref_frame[0], 0,
  622|  6.72k|                                (const UWORD8 *)gau1_ih264d_mv_pred_condition);
  623|       |
  624|  6.72k|                ih264d_get_motion_vector_predictor(
  625|  6.72k|                                ps_mv_final_pred, ps_mv_pred,
  626|  6.72k|                                ps_mv_final_pred->i1_ref_frame[1], 1,
  627|  6.72k|                                (const UWORD8 *)gau1_ih264d_mv_pred_condition);
  628|       |
  629|  6.72k|                break;
  630|  44.4k|            case MB_SKIP:
  ------------------
  |  |  456|  44.4k|#define MB_SKIP     255
  ------------------
  |  Branch (630:13): [True: 44.4k, False: 86.8k]
  ------------------
  631|       |                /* Case when the MB has been skipped */
  632|       |                /* If either of left or the top subMB is not present
  633|       |                 OR
  634|       |                 If both the MV components of either the left or the top subMB are
  635|       |                 zero and their reference frame pointer pointing to 0
  636|       |                 then MV for the skipped MB is zero
  637|       |                 else the Median of the mv_pred_t is used */
  638|  44.4k|                u1_a_in = (ps_cur_mb_info->u1_mb_ngbr_availablity &
  639|  44.4k|                LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   53|  44.4k|#define LEFT_MB_AVAILABLE_MASK      0x01
  ------------------
  640|  44.4k|                u1_b_in = (ps_cur_mb_info->u1_mb_ngbr_availablity &
  641|  44.4k|                TOP_MB_AVAILABLE_MASK);
  ------------------
  |  |   55|  44.4k|#define TOP_MB_AVAILABLE_MASK       0x04
  ------------------
  642|  44.4k|                if(((u1_a_in * u1_b_in) == 0)
  ------------------
  |  Branch (642:20): [True: 14.7k, False: 29.6k]
  ------------------
  643|  29.6k|                                || ((ps_mv_pred[LEFT]->i2_mv[0]
  ------------------
  |  |  512|  29.6k|#define LEFT  0
  ------------------
  |  Branch (643:36): [True: 29.6k, False: 0]
  ------------------
  644|  29.6k|                                                | ps_mv_pred[LEFT]->i2_mv[1]
  ------------------
  |  |  512|  29.6k|#define LEFT  0
  ------------------
  645|  29.6k|                                                | ps_mv_pred[LEFT]->i1_ref_frame[0])
  ------------------
  |  |  512|  29.6k|#define LEFT  0
  ------------------
  646|  29.6k|                                                == 0)
  647|      0|                                || ((ps_mv_pred[TOP]->i2_mv[0]
  ------------------
  |  |  514|      0|#define TOP   1
  ------------------
  |  Branch (647:36): [True: 0, False: 0]
  ------------------
  648|      0|                                                | ps_mv_pred[TOP]->i2_mv[1]
  ------------------
  |  |  514|      0|#define TOP   1
  ------------------
  649|      0|                                                | ps_mv_pred[TOP]->i1_ref_frame[0])
  ------------------
  |  |  514|      0|#define TOP   1
  ------------------
  650|      0|                                                == 0))
  651|  44.4k|                {
  652|  44.4k|                    ps_mv_final_pred->i2_mv[0] = 0;
  653|  44.4k|                    ps_mv_final_pred->i2_mv[1] = 0;
  654|  44.4k|                    break;
  655|  44.4k|                }
  656|       |                /* If the condition above is not true calculate the MV predictor
  657|       |                 according to the process defined in sec 8.4.1.2.1 */
  658|  62.7k|            default:
  ------------------
  |  Branch (658:13): [True: 62.7k, False: 68.5k]
  ------------------
  659|  62.7k|                ih264d_get_motion_vector_predictor(
  660|  62.7k|                                ps_mv_final_pred, ps_mv_pred, u1_ref_idx, uc_lx,
  661|  62.7k|                                (const UWORD8 *)gau1_ih264d_mv_pred_condition);
  662|  62.7k|                break;
  663|   131k|        }
  664|   131k|    }
  665|   125k|    return (u1_direct_zero_pred_flag);
  666|   125k|}
ih264d_mvpred_nonmbaff:
  703|   551k|{
  704|   551k|    UWORD8 u1_a_in, u1_b_in, uc_temp1, uc_temp2, uc_temp3;
  705|   551k|    mv_pred_t *ps_mv_pred[3];
  706|   551k|    UWORD8 u1_ref_idx;
  707|   551k|    UWORD8 u1_direct_zero_pred_flag = 0;
  708|   551k|    UNUSED(u1_lx_start);
  ------------------
  |  |   45|   551k|#define UNUSED(x) ((void)(x))
  ------------------
  709|   551k|    UNUSED(u1_lxend);
  ------------------
  |  |   45|   551k|#define UNUSED(x) ((void)(x))
  ------------------
  710|   551k|    ih264d_non_mbaff_mv_pred(ps_mv_pred, u4_sub_mb_num, ps_mv_nmb, ps_mv_ntop,
  711|   551k|                             ps_dec, uc_mb_part_width, ps_cur_mb_info);
  712|       |
  713|   551k|    u1_ref_idx = ps_mv_final_pred->i1_ref_frame[0];
  714|       |
  715|   551k|    switch(u1_mb_mc_mode)
  716|   551k|    {
  717|  4.45k|        case PRED_16x8:
  ------------------
  |  |  451|  4.45k|#define PRED_16x8   1
  ------------------
  |  Branch (717:9): [True: 4.45k, False: 547k]
  ------------------
  718|       |            /* Directional prediction for a 16x8 MB partition */
  719|  4.45k|            if(u4_sub_mb_num == 0)
  ------------------
  |  Branch (719:16): [True: 2.23k, False: 2.22k]
  ------------------
  720|  2.23k|            {
  721|       |                /* Calculating the MV pred for the top 16x8 block */
  722|  2.23k|                if(ps_mv_pred[TOP]->i1_ref_frame[0] == u1_ref_idx)
  ------------------
  |  |  514|  2.23k|#define TOP   1
  ------------------
  |  Branch (722:20): [True: 1.96k, False: 270]
  ------------------
  723|  1.96k|                {
  724|       |                    /* If the reference frame used by the top subMB is same as the
  725|       |                     reference frame used by the current block then MV predictor to
  726|       |                     be used for the current block is same as the MV of the top
  727|       |                     subMB */
  728|       |
  729|  1.96k|                    ps_mv_final_pred->i2_mv[0] = ps_mv_pred[TOP]->i2_mv[0];
  ------------------
  |  |  514|  1.96k|#define TOP   1
  ------------------
  730|  1.96k|                    ps_mv_final_pred->i2_mv[1] = ps_mv_pred[TOP]->i2_mv[1];
  ------------------
  |  |  514|  1.96k|#define TOP   1
  ------------------
  731|  1.96k|                }
  732|    270|                else
  733|    270|                {
  734|       |                    /* The MV predictor is calculated according to the process
  735|       |                     defined in 8.4.1.2.1 */
  736|    270|                    ih264d_get_motion_vector_predictor(
  737|    270|                                    ps_mv_final_pred,
  738|    270|                                    ps_mv_pred,
  739|    270|                                    u1_ref_idx,
  740|    270|                                    0,
  741|    270|                                    (const UWORD8 *)gau1_ih264d_mv_pred_condition);
  742|    270|                }
  743|  2.23k|            }
  744|  2.22k|            else
  745|  2.22k|            {
  746|  2.22k|                if(ps_mv_pred[LEFT]->i1_ref_frame[0] == u1_ref_idx)
  ------------------
  |  |  512|  2.22k|#define LEFT  0
  ------------------
  |  Branch (746:20): [True: 719, False: 1.50k]
  ------------------
  747|    719|                {
  748|       |                    /* If the reference frame used by the left subMB is same as the
  749|       |                     reference frame used by the current block then MV predictor to
  750|       |                     be used for the current block is same as the MV of the left
  751|       |                     subMB */
  752|       |
  753|    719|                    ps_mv_final_pred->i2_mv[0] = ps_mv_pred[LEFT]->i2_mv[0];
  ------------------
  |  |  512|    719|#define LEFT  0
  ------------------
  754|    719|                    ps_mv_final_pred->i2_mv[1] = ps_mv_pred[LEFT]->i2_mv[1];
  ------------------
  |  |  512|    719|#define LEFT  0
  ------------------
  755|    719|                }
  756|  1.50k|                else
  757|  1.50k|                {
  758|       |                    /* The MV predictor is calculated according to the process
  759|       |                     defined in 8.4.1.2.1 */
  760|  1.50k|                    ih264d_get_motion_vector_predictor(
  761|  1.50k|                                    ps_mv_final_pred,
  762|  1.50k|                                    ps_mv_pred,
  763|  1.50k|                                    u1_ref_idx,
  764|  1.50k|                                    0,
  765|  1.50k|                                    (const UWORD8 *)gau1_ih264d_mv_pred_condition);
  766|  1.50k|                }
  767|  2.22k|            }
  768|  4.45k|            break;
  769|  7.63k|        case PRED_8x16:
  ------------------
  |  |  452|  7.63k|#define PRED_8x16   2
  ------------------
  |  Branch (769:9): [True: 7.63k, False: 544k]
  ------------------
  770|       |            /* Directional prediction for a 8x16 MB partition */
  771|  7.63k|            if(u4_sub_mb_num == 0)
  ------------------
  |  Branch (771:16): [True: 3.81k, False: 3.82k]
  ------------------
  772|  3.81k|            {
  773|  3.81k|                if(ps_mv_pred[LEFT]->i1_ref_frame[0] == u1_ref_idx)
  ------------------
  |  |  512|  3.81k|#define LEFT  0
  ------------------
  |  Branch (773:20): [True: 1.52k, False: 2.28k]
  ------------------
  774|  1.52k|                {
  775|       |                    /* If the reference frame used by the left subMB is same as the
  776|       |                     reference frame used by the current block then MV predictor to
  777|       |                     be used for the current block is same as the MV of the left
  778|       |                     subMB */
  779|       |
  780|  1.52k|                    ps_mv_final_pred->i2_mv[0] = ps_mv_pred[LEFT]->i2_mv[0];
  ------------------
  |  |  512|  1.52k|#define LEFT  0
  ------------------
  781|  1.52k|                    ps_mv_final_pred->i2_mv[1] = ps_mv_pred[LEFT]->i2_mv[1];
  ------------------
  |  |  512|  1.52k|#define LEFT  0
  ------------------
  782|  1.52k|                }
  783|  2.28k|                else
  784|  2.28k|                {
  785|       |                    /* The MV predictor is calculated according to the process
  786|       |                     defined in 8.4.1.2.1 */
  787|  2.28k|                    ih264d_get_motion_vector_predictor(
  788|  2.28k|                                    ps_mv_final_pred,
  789|  2.28k|                                    ps_mv_pred,
  790|  2.28k|                                    u1_ref_idx,
  791|  2.28k|                                    0,
  792|  2.28k|                                    (const UWORD8 *)gau1_ih264d_mv_pred_condition);
  793|  2.28k|                }
  794|  3.81k|            }
  795|  3.82k|            else
  796|  3.82k|            {
  797|  3.82k|                if(ps_mv_pred[TOP_R]->i1_ref_frame[0] == u1_ref_idx)
  ------------------
  |  |  516|  3.82k|#define TOP_R 2
  ------------------
  |  Branch (797:20): [True: 2.96k, False: 858]
  ------------------
  798|  2.96k|                {
  799|       |                    /* If the reference frame used by the top right subMB is same as
  800|       |                     the reference frame used by the current block then MV
  801|       |                     predictor to be used for the current block is same as the MV
  802|       |                     of the left subMB */
  803|       |
  804|  2.96k|                    ps_mv_final_pred->i2_mv[0] = ps_mv_pred[TOP_R]->i2_mv[0];
  ------------------
  |  |  516|  2.96k|#define TOP_R 2
  ------------------
  805|  2.96k|                    ps_mv_final_pred->i2_mv[1] = ps_mv_pred[TOP_R]->i2_mv[1];
  ------------------
  |  |  516|  2.96k|#define TOP_R 2
  ------------------
  806|  2.96k|                }
  807|    858|                else
  808|    858|                {
  809|       |                    /* The MV predictor is calculated according to the process
  810|       |                     defined in 8.4.1.2.1 */
  811|    858|                    ih264d_get_motion_vector_predictor(
  812|    858|                                    ps_mv_final_pred,
  813|    858|                                    ps_mv_pred,
  814|    858|                                    u1_ref_idx,
  815|    858|                                    0,
  816|    858|                                    (const UWORD8 *)gau1_ih264d_mv_pred_condition);
  817|    858|                }
  818|  3.82k|            }
  819|  7.63k|            break;
  820|      0|        case B_DIRECT_SPATIAL:
  ------------------
  |  |  489|      0|#define B_DIRECT_SPATIAL  26
  ------------------
  |  Branch (820:9): [True: 0, False: 551k]
  ------------------
  821|       |            /* Case when the MB has been skipped */
  822|       |            /* If either of left or the top subMB is not present
  823|       |             OR
  824|       |             If both the MV components of either the left or the top subMB are
  825|       |             zero and their reference frame pointer pointing to 0
  826|       |             then MV for the skipped MB is zero
  827|       |             else the Median of the mv_pred_t is used */
  828|      0|            uc_temp1 = (UWORD8)ps_mv_pred[LEFT]->i1_ref_frame[0];
  ------------------
  |  |  512|      0|#define LEFT  0
  ------------------
  829|      0|            uc_temp2 = (UWORD8)ps_mv_pred[TOP]->i1_ref_frame[0];
  ------------------
  |  |  514|      0|#define TOP   1
  ------------------
  830|      0|            uc_temp3 = (UWORD8)ps_mv_pred[TOP_R]->i1_ref_frame[0];
  ------------------
  |  |  516|      0|#define TOP_R 2
  ------------------
  831|       |
  832|      0|            ps_mv_final_pred->i1_ref_frame[0] = MIN(uc_temp1,
  ------------------
  |  |   61|      0|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 0, False: 0]
  |  |  |  Branch (61:24): [True: 0, False: 0]
  |  |  |  Branch (61:32): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  833|      0|                                                  MIN(uc_temp2, uc_temp3));
  834|       |
  835|      0|            uc_temp1 = (UWORD8)ps_mv_pred[LEFT]->i1_ref_frame[1];
  ------------------
  |  |  512|      0|#define LEFT  0
  ------------------
  836|      0|            uc_temp2 = (UWORD8)ps_mv_pred[TOP]->i1_ref_frame[1];
  ------------------
  |  |  514|      0|#define TOP   1
  ------------------
  837|      0|            uc_temp3 = (UWORD8)ps_mv_pred[TOP_R]->i1_ref_frame[1];
  ------------------
  |  |  516|      0|#define TOP_R 2
  ------------------
  838|       |
  839|      0|            ps_mv_final_pred->i1_ref_frame[1] = MIN(uc_temp1,
  ------------------
  |  |   61|      0|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 0, False: 0]
  |  |  |  Branch (61:24): [True: 0, False: 0]
  |  |  |  Branch (61:32): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  840|      0|                                                  MIN(uc_temp2, uc_temp3));
  841|       |
  842|      0|            if((ps_mv_final_pred->i1_ref_frame[0] < 0)
  ------------------
  |  Branch (842:16): [True: 0, False: 0]
  ------------------
  843|      0|                            && (ps_mv_final_pred->i1_ref_frame[1] < 0))
  ------------------
  |  Branch (843:32): [True: 0, False: 0]
  ------------------
  844|      0|            {
  845|      0|                u1_direct_zero_pred_flag = 1;
  846|      0|                ps_mv_final_pred->i1_ref_frame[0] = 0;
  847|      0|                ps_mv_final_pred->i1_ref_frame[1] = 0;
  848|      0|            }
  849|      0|            ih264d_get_motion_vector_predictor(
  850|      0|                            ps_mv_final_pred, ps_mv_pred,
  851|      0|                            ps_mv_final_pred->i1_ref_frame[0], 0,
  852|      0|                            (const UWORD8 *)gau1_ih264d_mv_pred_condition);
  853|       |
  854|      0|            ih264d_get_motion_vector_predictor(
  855|      0|                            ps_mv_final_pred, ps_mv_pred,
  856|      0|                            ps_mv_final_pred->i1_ref_frame[1], 1,
  857|      0|                            (const UWORD8 *)gau1_ih264d_mv_pred_condition);
  858|       |
  859|      0|            break;
  860|   494k|        case MB_SKIP:
  ------------------
  |  |  456|   494k|#define MB_SKIP     255
  ------------------
  |  Branch (860:9): [True: 494k, False: 57.4k]
  ------------------
  861|       |            /* Case when the MB has been skipped */
  862|       |            /* If either of left or the top subMB is not present
  863|       |             OR
  864|       |             If both the MV components of either the left or the top subMB are
  865|       |             zero and their reference frame pointer pointing to 0
  866|       |             then MV for the skipped MB is zero
  867|       |             else the Median of the mv_pred_t is used */
  868|   494k|            u1_a_in = (ps_cur_mb_info->u1_mb_ngbr_availablity &
  869|   494k|            LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   53|   494k|#define LEFT_MB_AVAILABLE_MASK      0x01
  ------------------
  870|   494k|            u1_b_in = (ps_cur_mb_info->u1_mb_ngbr_availablity &
  871|   494k|            TOP_MB_AVAILABLE_MASK);
  ------------------
  |  |   55|   494k|#define TOP_MB_AVAILABLE_MASK       0x04
  ------------------
  872|   494k|            if(((u1_a_in * u1_b_in) == 0)
  ------------------
  |  Branch (872:16): [True: 101k, False: 393k]
  ------------------
  873|   393k|                            || ((ps_mv_pred[LEFT]->i2_mv[0]
  ------------------
  |  |  512|   393k|#define LEFT  0
  ------------------
  |  Branch (873:32): [True: 391k, False: 1.47k]
  ------------------
  874|   393k|                                            | ps_mv_pred[LEFT]->i2_mv[1]
  ------------------
  |  |  512|   393k|#define LEFT  0
  ------------------
  875|   393k|                                            | ps_mv_pred[LEFT]->i1_ref_frame[0])
  ------------------
  |  |  512|   393k|#define LEFT  0
  ------------------
  876|   393k|                                            == 0)
  877|  1.47k|                            || ((ps_mv_pred[TOP]->i2_mv[0]
  ------------------
  |  |  514|  1.47k|#define TOP   1
  ------------------
  |  Branch (877:32): [True: 864, False: 608]
  ------------------
  878|  1.47k|                                            | ps_mv_pred[TOP]->i2_mv[1]
  ------------------
  |  |  514|  1.47k|#define TOP   1
  ------------------
  879|  1.47k|                                            | ps_mv_pred[TOP]->i1_ref_frame[0])
  ------------------
  |  |  514|  1.47k|#define TOP   1
  ------------------
  880|  1.47k|                                            == 0))
  881|   493k|            {
  882|       |
  883|   493k|                ps_mv_final_pred->i2_mv[0] = 0;
  884|   493k|                ps_mv_final_pred->i2_mv[1] = 0;
  885|   493k|                break;
  886|   493k|            }
  887|       |            /* If the condition above is not true calculate the MV predictor
  888|       |             according to the process defined in sec 8.4.1.2.1 */
  889|  45.9k|        default:
  ------------------
  |  Branch (889:9): [True: 45.3k, False: 506k]
  ------------------
  890|  45.9k|            ih264d_get_motion_vector_predictor(
  891|  45.9k|                            ps_mv_final_pred, ps_mv_pred, u1_ref_idx, 0,
  892|  45.9k|                            (const UWORD8 *)gau1_ih264d_mv_pred_condition);
  893|  45.9k|            break;
  894|   551k|    }
  895|       |
  896|   551k|    return (u1_direct_zero_pred_flag);
  897|   551k|}
ih264d_rep_mv_colz:
 1175|   719k|{
 1176|       |
 1177|   719k|    UWORD8 k, m;
 1178|   719k|    UWORD8 *pu1_colz = ps_dec->pu1_col_zero_flag + ps_dec->i4_submb_ofst
 1179|   719k|                    + u4_sub_mb_num;
 1180|       |
 1181|  3.35M|    for(k = 0; k < u1_ht; k++)
  ------------------
  |  Branch (1181:16): [True: 2.63M, False: 719k]
  ------------------
 1182|  2.63M|    {
 1183|  12.6M|        for(m = 0; m < u1_wd; m++)
  ------------------
  |  Branch (1183:20): [True: 10.0M, False: 2.63M]
  ------------------
 1184|  10.0M|        {
 1185|  10.0M|            *(ps_mv_pred_dst + m) = *(ps_mv_pred_src);
 1186|  10.0M|            *(pu1_colz + m) = u1_colz;
 1187|       |
 1188|  10.0M|        }
 1189|  2.63M|        pu1_colz += SUB_BLK_WIDTH;
  ------------------
  |  |  560|  2.63M|#define SUB_BLK_WIDTH                 4
  ------------------
 1190|  2.63M|        ps_mv_pred_dst += SUB_BLK_WIDTH;
  ------------------
  |  |  560|  2.63M|#define SUB_BLK_WIDTH                 4
  ------------------
 1191|  2.63M|    }
 1192|   719k|}

ih264d_parse_bmb_non_direct_cavlc:
   79|    598|{
   80|    598|    dec_bit_stream_t * ps_bitstrm = ps_dec->ps_bitstrm;
   81|    598|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
   82|    598|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
   83|    598|    UWORD8 * pu1_sub_mb_pred_modes = (UWORD8 *)(gau1_ih264d_submb_pred_modes) + 4;
   84|    598|    const UWORD8 (*pu1_mb_pred_modes)[32] =
   85|    598|                    (const UWORD8 (*)[32])gau1_ih264d_mb_pred_modes;
   86|    598|    const UWORD8 * pu1_num_mb_part = (const UWORD8 *)gau1_ih264d_num_mb_part;
   87|    598|    const UWORD8 * pu1_sub_mb_mc_mode = (const UWORD8 *)(gau1_ih264d_submb_mc_mode)
   88|    598|                    + 4;
   89|       |
   90|    598|    parse_pmbarams_t * ps_parse_mb_data = ps_dec->ps_parse_mb_data
   91|    598|                    + u4_num_mbsNby2;
   92|    598|    UWORD8 * pu1_col_info = ps_parse_mb_data->u1_col_info;
   93|    598|    WORD8 (*pi1_ref_idx)[MAX_REFIDX_INFO_PER_MB] = ps_parse_mb_data->i1_ref_idx;
   94|    598|    UWORD8 u1_mb_type = ps_cur_mb_info->u1_mb_type;
   95|    598|    UWORD8 u1_mb_mc_mode, u1_num_mb_part, u1_sub_mb = !(u1_mb_type ^ B_8x8);
  ------------------
  |  |  480|    598|#define B_8x8    22
  ------------------
   96|    598|    UWORD32 u4_mb_mc_mode = 0, u4_mb_pred_mode = 0;
   97|    598|    WORD32 ret;
   98|       |
   99|    598|    if(u1_sub_mb)
  ------------------
  |  Branch (99:8): [True: 0, False: 598]
  ------------------
  100|      0|    {
  101|      0|        UWORD8 uc_i;
  102|      0|        u1_mb_mc_mode = 0;
  103|      0|        u1_num_mb_part = 4;
  104|       |        /* Reading the subMB type */
  105|      0|        for(uc_i = 0; uc_i < 4; uc_i++)
  ------------------
  |  Branch (105:23): [True: 0, False: 0]
  ------------------
  106|      0|        {
  107|       |
  108|      0|            UWORD32 ui_sub_mb_mode;
  109|       |
  110|       |//Inlined ih264d_uev
  111|      0|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  112|      0|            UWORD32 u4_word, u4_ldz;
  113|       |
  114|       |            /***************************************************************/
  115|       |            /* Find leading zeros in next 32 bits                          */
  116|       |            /***************************************************************/
  117|      0|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|      0|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|      0|{                                                                           \
  |  |  152|      0|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|      0|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|      0|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|      0|                                                                            \
  |  |  156|      0|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|      0|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  158|      0|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|      0|}
  ------------------
  118|      0|            u4_ldz = CLZ(u4_word);
  119|       |            /* Flush the ps_bitstrm */
  120|      0|            u4_bitstream_offset += (u4_ldz + 1);
  121|       |            /* Read the suffix from the ps_bitstrm */
  122|      0|            u4_word = 0;
  123|      0|            if(u4_ldz)
  ------------------
  |  Branch (123:16): [True: 0, False: 0]
  ------------------
  124|      0|                GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|      0|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|      0|{                                                                           \
  |  |  122|      0|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|      0|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|      0|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|      0|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|      0|                                                                            \
  |  |  127|      0|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  128|      0|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|      0|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|      0|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|      0|}                                                                           \
  ------------------
  125|      0|                        u4_ldz);
  126|      0|            *pu4_bitstrm_ofst = u4_bitstream_offset;
  127|      0|            ui_sub_mb_mode = ((1 << u4_ldz) + u4_word - 1);
  128|       |//Inlined ih264d_uev
  129|       |
  130|      0|            if(ui_sub_mb_mode > 12)
  ------------------
  |  Branch (130:16): [True: 0, False: 0]
  ------------------
  131|      0|                return ERROR_SUB_MB_TYPE;
  132|      0|            else
  133|      0|            {
  134|      0|                UWORD8 u1_subMbPredMode = pu1_sub_mb_pred_modes[ui_sub_mb_mode];
  135|      0|                u4_mb_mc_mode = (u4_mb_mc_mode << 8)
  136|      0|                                | pu1_sub_mb_mc_mode[ui_sub_mb_mode];
  137|      0|                u4_mb_pred_mode = (u4_mb_pred_mode << 8) | u1_subMbPredMode;
  138|      0|                pi1_ref_idx[0][uc_i] = ((u1_subMbPredMode & PRED_L0) - 1) >> 1;
  ------------------
  |  |  483|      0|#define PRED_L0   1
  ------------------
  139|      0|                pi1_ref_idx[1][uc_i] = ((u1_subMbPredMode & PRED_L1) - 1) >> 1;
  ------------------
  |  |  484|      0|#define PRED_L1   2
  ------------------
  140|      0|                COPYTHECONTEXT("sub_mb_type", u1_subMbPredMode);
  141|      0|            }
  142|       |            /* Storing collocated Mb and SubMb mode information */
  143|      0|            *pu1_col_info++ = ((PRED_8x8) << 6)
  ------------------
  |  |  453|      0|#define PRED_8x8    3
  ------------------
  144|      0|                            | ((pu1_sub_mb_mc_mode[ui_sub_mb_mode] << 4));
  145|      0|            if(ui_sub_mb_mode != B_DIRECT_8x8)
  ------------------
  |  |  465|      0|#define B_DIRECT_8x8    0
  ------------------
  |  Branch (145:16): [True: 0, False: 0]
  ------------------
  146|      0|            {
  147|      0|                if(ui_sub_mb_mode > B_BI_8x8)
  ------------------
  |  |  468|      0|#define B_BI_8x8        3
  ------------------
  |  Branch (147:20): [True: 0, False: 0]
  ------------------
  148|      0|                {
  149|      0|                    ps_dec->s_high_profile.u1_no_submb_part_size_lt8x8_flag = 0;
  150|      0|                }
  151|      0|            }
  152|      0|            else if(!ps_dec->s_high_profile.u1_direct_8x8_inference_flag)
  ------------------
  |  Branch (152:21): [True: 0, False: 0]
  ------------------
  153|      0|            {
  154|      0|                ps_dec->s_high_profile.u1_no_submb_part_size_lt8x8_flag = 0;
  155|      0|            }
  156|      0|        }
  157|      0|    }
  158|    598|    else
  159|    598|    {
  160|    598|        UWORD8 u1_mb_pred_mode_idx = 5 + u1_mb_type;
  161|    598|        UWORD8 u1_mb_pred_mode_part0 = pu1_mb_pred_modes[0][u1_mb_pred_mode_idx];
  162|    598|        UWORD8 u1_mb_pred_mode_part1 = pu1_mb_pred_modes[1][u1_mb_pred_mode_idx];
  163|    598|        u1_mb_mc_mode = ps_cur_mb_info->u1_mb_mc_mode;
  164|    598|        u1_num_mb_part = pu1_num_mb_part[u1_mb_mc_mode];
  165|       |
  166|    598|        pi1_ref_idx[0][0] = ((u1_mb_pred_mode_part0 & PRED_L0) - 1) >> 1;
  ------------------
  |  |  483|    598|#define PRED_L0   1
  ------------------
  167|    598|        pi1_ref_idx[1][0] = ((u1_mb_pred_mode_part0 & PRED_L1) - 1) >> 1;
  ------------------
  |  |  484|    598|#define PRED_L1   2
  ------------------
  168|    598|        pi1_ref_idx[0][1] = ((u1_mb_pred_mode_part1 & PRED_L0) - 1) >> 1;
  ------------------
  |  |  483|    598|#define PRED_L0   1
  ------------------
  169|    598|        pi1_ref_idx[1][1] = ((u1_mb_pred_mode_part1 & PRED_L1) - 1) >> 1;
  ------------------
  |  |  484|    598|#define PRED_L1   2
  ------------------
  170|       |
  171|    598|        u4_mb_pred_mode = (u1_mb_pred_mode_part0 << 8) | u1_mb_pred_mode_part1;
  172|    598|        u4_mb_mc_mode = u1_mb_mc_mode | (u1_mb_mc_mode << 8);
  173|    598|        u4_mb_mc_mode <<= 16;
  174|    598|        u4_mb_pred_mode <<= 16;
  175|       |
  176|       |        /* Storing collocated Mb and SubMb mode information */
  177|    598|        *pu1_col_info++ = (u1_mb_mc_mode << 6);
  178|    598|        if(u1_mb_mc_mode)
  ------------------
  |  Branch (178:12): [True: 196, False: 402]
  ------------------
  179|    196|            *pu1_col_info++ = (u1_mb_mc_mode << 6);
  180|    598|    }
  181|       |
  182|    598|    {
  183|    598|        UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  184|    598|        UWORD8 uc_field = ps_cur_mb_info->u1_mb_field_decodingflag;
  185|    598|        UWORD8 *pu1_num_ref_idx_lx_active =
  186|    598|                        ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active;
  187|    598|        const UWORD8 u1_mbaff_field = (u1_mbaff & uc_field);
  188|    598|        UWORD8 u4_num_ref_idx_lx_active;
  189|       |
  190|    598|        u4_num_ref_idx_lx_active = (pu1_num_ref_idx_lx_active[0]
  191|    598|                        << u1_mbaff_field) - 1;
  192|       |
  193|    598|        if(u4_num_ref_idx_lx_active)
  ------------------
  |  Branch (193:12): [True: 5, False: 593]
  ------------------
  194|      5|        {
  195|      5|            if(1 == u4_num_ref_idx_lx_active)
  ------------------
  |  Branch (195:16): [True: 0, False: 5]
  ------------------
  196|      0|                ih264d_parse_bmb_ref_index_cavlc_range1(
  197|      0|                                u1_num_mb_part, ps_bitstrm, pi1_ref_idx[0],
  198|      0|                                u4_num_ref_idx_lx_active);
  199|      5|            else
  200|      5|            {
  201|      5|                ret = ih264d_parse_bmb_ref_index_cavlc(u1_num_mb_part, ps_bitstrm,
  202|      5|                                                 pi1_ref_idx[0],
  203|      5|                                                 u4_num_ref_idx_lx_active);
  204|      5|                if(ret != OK)
  ------------------
  |  |  114|      5|#define OK        0
  ------------------
  |  Branch (204:20): [True: 0, False: 5]
  ------------------
  205|      0|                    return ret;
  206|      5|            }
  207|      5|        }
  208|       |
  209|    598|        u4_num_ref_idx_lx_active = (pu1_num_ref_idx_lx_active[1]
  210|    598|                        << u1_mbaff_field) - 1;
  211|       |
  212|    598|        if(u4_num_ref_idx_lx_active)
  ------------------
  |  Branch (212:12): [True: 78, False: 520]
  ------------------
  213|     78|        {
  214|     78|            if(1 == u4_num_ref_idx_lx_active)
  ------------------
  |  Branch (214:16): [True: 5, False: 73]
  ------------------
  215|      5|                ih264d_parse_bmb_ref_index_cavlc_range1(
  216|      5|                                u1_num_mb_part, ps_bitstrm, pi1_ref_idx[1],
  217|      5|                                u4_num_ref_idx_lx_active);
  218|     73|            else
  219|     73|            {
  220|     73|                ret = ih264d_parse_bmb_ref_index_cavlc(u1_num_mb_part, ps_bitstrm,
  221|     73|                                                 pi1_ref_idx[1],
  222|     73|                                                 u4_num_ref_idx_lx_active);
  223|     73|                if(ret != OK)
  ------------------
  |  |  114|     73|#define OK        0
  ------------------
  |  Branch (223:20): [True: 15, False: 58]
  ------------------
  224|     15|                    return ret;
  225|     73|            }
  226|     78|        }
  227|    598|    }
  228|       |
  229|       |    /* Read MotionVectors */
  230|    583|    {
  231|    583|        const UWORD8 * pu1_top_left_sub_mb_indx;
  232|       |
  233|    583|        const UWORD8 * pu1_sub_mb_indx_mod =
  234|    583|                        (const UWORD8 *)(gau1_ih264d_submb_indx_mod)
  235|    583|                                        + (u1_sub_mb * 6);
  236|    583|        const UWORD8 * pu1_sub_mb_partw = (const UWORD8 *)gau1_ih264d_submb_partw;
  237|    583|        const UWORD8 * pu1_sub_mb_parth = (const UWORD8 *)gau1_ih264d_submb_parth;
  238|    583|        const UWORD8 * pu1_num_sub_mb_part =
  239|    583|                        (const UWORD8 *)gau1_ih264d_num_submb_part;
  240|    583|        const UWORD8 * pu1_mb_partw = (const UWORD8 *)gau1_ih264d_mb_partw;
  241|    583|        const UWORD8 * pu1_mb_parth = (const UWORD8 *)gau1_ih264d_mb_parth;
  242|    583|        UWORD8 u1_p_idx = 0, u1_num_submb_part, uc_lx;
  243|    583|        parse_part_params_t * ps_part;
  244|    583|        mv_pred_t *ps_mv_start = ps_dec->ps_mv_cur + (u4_mb_num << 4);
  245|    583|        UWORD8 u1_mb_part_wd, u1_mb_part_ht;
  246|       |
  247|       |        /* Initialisations */
  248|    583|        ps_part = ps_dec->ps_part;
  249|       |        /* Default Initialization for Non subMb Case Mode */
  250|    583|        u1_mb_part_wd = pu1_mb_partw[u1_mb_mc_mode];
  251|    583|        u1_mb_part_ht = pu1_mb_parth[u1_mb_mc_mode];
  252|    583|        u1_num_submb_part = 1;
  253|       |
  254|       |        /* Decoding the MV for the subMB */
  255|  1.74k|        for(uc_lx = 0; uc_lx < 2; uc_lx++)
  ------------------
  |  Branch (255:24): [True: 1.16k, False: 583]
  ------------------
  256|  1.16k|        {
  257|  1.16k|            UWORD8 u1_sub_mb_num = 0, u1_pred_mode, uc_i;
  258|  1.16k|            UWORD32 u4_mb_mc_mode_tmp = u4_mb_mc_mode;
  259|  1.16k|            UWORD32 u4_mb_pred_mode_tmp = u4_mb_pred_mode;
  260|  1.16k|            UWORD16 u2_sub_mb_num = 0x028A; // for sub mb case
  261|  1.16k|            UWORD8 u1_b2 = uc_lx << 1;
  262|  1.16k|            u1_pred_mode = (uc_lx) ? PRED_L1 : PRED_L0;
  ------------------
  |  |  484|    583|#define PRED_L1   2
  ------------------
                          u1_pred_mode = (uc_lx) ? PRED_L1 : PRED_L0;
  ------------------
  |  |  483|  1.74k|#define PRED_L0   1
  ------------------
  |  Branch (262:28): [True: 583, False: 583]
  ------------------
  263|  1.16k|            pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_mb_mc_mode << 1);
  264|       |
  265|  2.72k|            for(uc_i = 0; uc_i < u1_num_mb_part; uc_i++)
  ------------------
  |  Branch (265:27): [True: 1.55k, False: 1.16k]
  ------------------
  266|  1.55k|            {
  267|  1.55k|                UWORD8 u1_mb_mc_mode, uc_j;
  268|  1.55k|                UWORD8 i1_pred = u4_mb_pred_mode_tmp >> 24;
  269|  1.55k|                u1_mb_mc_mode = u4_mb_mc_mode_tmp >> 24;
  270|  1.55k|                u4_mb_pred_mode_tmp <<= 8;
  271|  1.55k|                u4_mb_mc_mode_tmp <<= 8;
  272|       |                /* subMb prediction mode */
  273|  1.55k|                if(u1_sub_mb)
  ------------------
  |  Branch (273:20): [True: 0, False: 1.55k]
  ------------------
  274|      0|                {
  275|       |
  276|      0|                    u1_mb_part_wd = pu1_sub_mb_partw[u1_mb_mc_mode];
  277|      0|                    u1_mb_part_ht = pu1_sub_mb_parth[u1_mb_mc_mode];
  278|      0|                    u1_sub_mb_num = u2_sub_mb_num >> 12;
  279|      0|                    u1_num_submb_part = pu1_num_sub_mb_part[u1_mb_mc_mode];
  280|      0|                    pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod
  281|      0|                                    + (u1_mb_mc_mode << 1);
  282|      0|                    u2_sub_mb_num <<= 4;
  283|      0|                }
  284|  3.11k|                for(uc_j = 0; uc_j < u1_num_submb_part;
  ------------------
  |  Branch (284:31): [True: 1.55k, False: 1.55k]
  ------------------
  285|  1.55k|                                uc_j++, pu1_top_left_sub_mb_indx++)
  286|  1.55k|                {
  287|  1.55k|                    mv_pred_t * ps_mv;
  288|  1.55k|                    u1_sub_mb_num = u1_sub_mb_num + *pu1_top_left_sub_mb_indx;
  289|  1.55k|                    ps_mv = ps_mv_start + u1_sub_mb_num;
  290|       |
  291|       |                    /* Storing Info for partitions, writing only once */
  292|  1.55k|                    if(uc_lx)
  ------------------
  |  Branch (292:24): [True: 779, False: 779]
  ------------------
  293|    779|                    {
  294|    779|                        ps_part->u1_is_direct = (!i1_pred);
  295|    779|                        ps_part->u1_pred_mode = i1_pred;
  296|    779|                        ps_part->u1_sub_mb_num = u1_sub_mb_num;
  297|    779|                        ps_part->u1_partheight = u1_mb_part_ht;
  298|    779|                        ps_part->u1_partwidth = u1_mb_part_wd;
  299|       |                        /* Increment partition Index */
  300|    779|                        u1_p_idx++;
  301|    779|                        ps_part++;
  302|    779|                    }
  303|       |
  304|  1.55k|                    if(i1_pred & u1_pred_mode)
  ------------------
  |  Branch (304:24): [True: 881, False: 677]
  ------------------
  305|    881|                    {
  306|    881|                        WORD16 i2_mvx, i2_mvy;
  307|       |
  308|       |//inlining ih264d_sev
  309|    881|                        {
  310|    881|                            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  311|    881|                            UWORD32 u4_word, u4_ldz, u4_abs_val;
  312|       |
  313|       |                            /***************************************************************/
  314|       |                            /* Find leading zeros in next 32 bits                          */
  315|       |                            /***************************************************************/
  316|    881|                            NEXTBITS_32(u4_word, u4_bitstream_offset,
  ------------------
  |  |  150|    881|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|    881|{                                                                           \
  |  |  152|    881|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|    881|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|    881|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|    881|                                                                            \
  |  |  156|    881|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|    881|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 830, False: 51]
  |  |  ------------------
  |  |  158|    881|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|    830|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|    881|}
  ------------------
  317|    881|                                        pu4_bitstrm_buf);
  318|    881|                            u4_ldz = CLZ(u4_word);
  319|       |
  320|       |                            /* Flush the ps_bitstrm */
  321|    881|                            u4_bitstream_offset += (u4_ldz + 1);
  322|       |
  323|       |                            /* Read the suffix from the ps_bitstrm */
  324|    881|                            u4_word = 0;
  325|    881|                            if(u4_ldz)
  ------------------
  |  Branch (325:32): [True: 475, False: 406]
  ------------------
  326|    475|                                GETBITS(u4_word, u4_bitstream_offset,
  ------------------
  |  |  120|    475|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    475|{                                                                           \
  |  |  122|    475|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    475|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    475|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    475|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    475|                                                                            \
  |  |  127|    475|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 473, False: 2]
  |  |  ------------------
  |  |  128|    475|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    473|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    475|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    475|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    475|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    475|}                                                                           \
  ------------------
  327|    881|                                        pu4_bitstrm_buf, u4_ldz);
  328|       |
  329|    881|                            *pu4_bitstrm_ofst = u4_bitstream_offset;
  330|    881|                            u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1;
  331|       |
  332|    881|                            if(u4_word & 0x1)
  ------------------
  |  Branch (332:32): [True: 232, False: 649]
  ------------------
  333|    232|                                i2_mvx = (-(WORD32)u4_abs_val);
  334|    649|                            else
  335|    649|                                i2_mvx = (u4_abs_val);
  336|    881|                        }
  337|       |//inlinined ih264d_sev
  338|       |
  339|       |//inlining ih264d_sev
  340|    881|                        {
  341|    881|                            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  342|    881|                            UWORD32 u4_word, u4_ldz, u4_abs_val;
  343|       |
  344|       |                            /***************************************************************/
  345|       |                            /* Find leading zeros in next 32 bits                          */
  346|       |                            /***************************************************************/
  347|    881|                            NEXTBITS_32(u4_word, u4_bitstream_offset,
  ------------------
  |  |  150|    881|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|    881|{                                                                           \
  |  |  152|    881|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|    881|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|    881|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|    881|                                                                            \
  |  |  156|    881|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|    881|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 881, False: 0]
  |  |  ------------------
  |  |  158|    881|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|    881|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|    881|}
  ------------------
  348|    881|                                        pu4_bitstrm_buf);
  349|    881|                            u4_ldz = CLZ(u4_word);
  350|       |
  351|       |                            /* Flush the ps_bitstrm */
  352|    881|                            u4_bitstream_offset += (u4_ldz + 1);
  353|       |
  354|       |                            /* Read the suffix from the ps_bitstrm */
  355|    881|                            u4_word = 0;
  356|    881|                            if(u4_ldz)
  ------------------
  |  Branch (356:32): [True: 287, False: 594]
  ------------------
  357|    287|                                GETBITS(u4_word, u4_bitstream_offset,
  ------------------
  |  |  120|    287|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    287|{                                                                           \
  |  |  122|    287|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    287|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    287|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    287|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    287|                                                                            \
  |  |  127|    287|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 286, False: 1]
  |  |  ------------------
  |  |  128|    287|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    286|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    287|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    287|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    287|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    287|}                                                                           \
  ------------------
  358|    881|                                        pu4_bitstrm_buf, u4_ldz);
  359|       |
  360|    881|                            *pu4_bitstrm_ofst = u4_bitstream_offset;
  361|    881|                            u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1;
  362|       |
  363|    881|                            if(u4_word & 0x1)
  ------------------
  |  Branch (363:32): [True: 120, False: 761]
  ------------------
  364|    120|                                i2_mvy = (-(WORD32)u4_abs_val);
  365|    761|                            else
  366|    761|                                i2_mvy = (u4_abs_val);
  367|    881|                        }
  368|       |//inlinined ih264d_sev
  369|       |
  370|       |                        /* Storing Mv residuals */
  371|    881|                        ps_mv->i2_mv[u1_b2] = i2_mvx;
  372|    881|                        ps_mv->i2_mv[u1_b2 + 1] = i2_mvy;
  373|    881|                    }
  374|  1.55k|                }
  375|  1.55k|            }
  376|  1.16k|        }
  377|       |        /* write back to the scratch partition info */
  378|    583|        ps_dec->ps_part = ps_part;
  379|    583|        ps_parse_mb_data->u1_num_part = u1_sub_mb ? u1_p_idx : u1_num_mb_part;
  ------------------
  |  Branch (379:41): [True: 0, False: 583]
  ------------------
  380|       |
  381|    583|    }
  382|    583|    return OK;
  ------------------
  |  |  114|    583|#define OK        0
  ------------------
  383|    598|}
ih264d_parse_bmb_non_direct_cabac:
  402|  25.4k|{
  403|       |    /* Loads from ps_dec */
  404|  25.4k|    decoding_envirnoment_t * ps_cab_env = &ps_dec->s_cab_dec_env;
  405|  25.4k|    dec_bit_stream_t * ps_bitstrm = ps_dec->ps_bitstrm;
  406|  25.4k|    ctxt_inc_mb_info_t *p_curr_ctxt = ps_dec->ps_curr_ctxt_mb_info;
  407|  25.4k|    parse_pmbarams_t * ps_parse_mb_data = ps_dec->ps_parse_mb_data
  408|  25.4k|                    + u4_num_mbsNby2;
  409|       |
  410|       |    /* table pointer loads */
  411|  25.4k|    const UWORD8 * pu1_sub_mb_pred_modes = (UWORD8 *)(gau1_ih264d_submb_pred_modes)
  412|  25.4k|                    + 4;
  413|  25.4k|    const UWORD8 (*pu1_mb_pred_modes)[32] =
  414|  25.4k|                    (const UWORD8 (*)[32])gau1_ih264d_mb_pred_modes;
  415|  25.4k|    const UWORD8 *pu1_num_mb_part = (const UWORD8 *)gau1_ih264d_num_mb_part;
  416|  25.4k|    const UWORD8 *pu1_sub_mb_mc_mode = (UWORD8 *)(gau1_ih264d_submb_mc_mode) + 4;
  417|       |
  418|  25.4k|    const UWORD8 u1_mb_type = ps_cur_mb_info->u1_mb_type;
  419|  25.4k|    UWORD8 * pu1_col_info = ps_parse_mb_data->u1_col_info;
  420|  25.4k|    WORD8 *pi1_ref_idx_l0 = &ps_parse_mb_data->i1_ref_idx[0][0];
  421|  25.4k|    WORD8 *pi1_ref_idx_l1 = &ps_parse_mb_data->i1_ref_idx[1][0];
  422|  25.4k|    UWORD8 u1_dec_ref_l0, u1_dec_ref_l1;
  423|       |
  424|  25.4k|    UWORD8 u1_num_mb_part, u1_mb_mc_mode, u1_sub_mb, u1_mbpred_mode = 5
  425|  25.4k|                    + u1_mb_type;
  426|  25.4k|    UWORD32 u4_mb_mc_mode = 0, u4_mb_pred_mode = 0;
  427|  25.4k|    WORD32 ret;
  428|       |
  429|  25.4k|    p_curr_ctxt->u1_mb_type = CAB_NON_BD16x16;
  ------------------
  |  |  397|  25.4k|#define CAB_NON_BD16x16   0x05 /* 0000 0101 */
  ------------------
  430|  25.4k|    u1_sub_mb = !(u1_mb_type ^ B_8x8);
  ------------------
  |  |  480|  25.4k|#define B_8x8    22
  ------------------
  431|       |
  432|  25.4k|    {
  433|  25.4k|        UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  434|  25.4k|        UWORD8 *pu1_num_ref_idx_lx_active =
  435|  25.4k|                        ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active;
  436|  25.4k|        UWORD8 uc_field = ps_cur_mb_info->u1_mb_field_decodingflag;
  437|  25.4k|        UWORD8 u1_mbaff_field = (u1_mbaff & uc_field);
  438|  25.4k|        u1_dec_ref_l0 = (pu1_num_ref_idx_lx_active[0] << u1_mbaff_field) - 1;
  439|  25.4k|        u1_dec_ref_l1 = (pu1_num_ref_idx_lx_active[1] << u1_mbaff_field) - 1;
  440|  25.4k|    }
  441|       |
  442|  25.4k|    if(u1_sub_mb)
  ------------------
  |  Branch (442:8): [True: 13.9k, False: 11.4k]
  ------------------
  443|  13.9k|    {
  444|  13.9k|        const UWORD8 u1_colz = ((PRED_8x8) << 6);
  ------------------
  |  |  453|  13.9k|#define PRED_8x8    3
  ------------------
  445|  13.9k|        UWORD8 uc_i;
  446|  13.9k|        u1_mb_mc_mode = 0;
  447|  13.9k|        u1_num_mb_part = 4;
  448|       |        /* Reading the subMB type */
  449|  69.5k|        for(uc_i = 0; uc_i < 4; uc_i++)
  ------------------
  |  Branch (449:23): [True: 55.6k, False: 13.9k]
  ------------------
  450|  55.6k|        {
  451|  55.6k|            UWORD8 u1_sub_mb_mode, u1_subMbPredModes;
  452|  55.6k|            u1_sub_mb_mode = ih264d_parse_submb_type_cabac(
  453|  55.6k|                            1, ps_cab_env, ps_bitstrm,
  454|  55.6k|                            ps_dec->p_sub_mb_type_t);
  455|       |
  456|  55.6k|            if(u1_sub_mb_mode > 12)
  ------------------
  |  Branch (456:16): [True: 0, False: 55.6k]
  ------------------
  457|      0|                return ERROR_SUB_MB_TYPE;
  458|       |
  459|  55.6k|            u1_subMbPredModes = pu1_sub_mb_pred_modes[u1_sub_mb_mode];
  460|  55.6k|            u4_mb_mc_mode = (u4_mb_mc_mode << 8) | pu1_sub_mb_mc_mode[u1_sub_mb_mode];
  461|  55.6k|            u4_mb_pred_mode = (u4_mb_pred_mode << 8) | u1_subMbPredModes;
  462|  55.6k|            *pi1_ref_idx_l0++ =
  463|  55.6k|                            (u1_subMbPredModes & PRED_L0) ? u1_dec_ref_l0 : -1;
  ------------------
  |  |  483|  55.6k|#define PRED_L0   1
  ------------------
  |  Branch (463:29): [True: 48.8k, False: 6.86k]
  ------------------
  464|  55.6k|            *pi1_ref_idx_l1++ =
  465|  55.6k|                            (u1_subMbPredModes & PRED_L1) ? u1_dec_ref_l1 : -1;
  ------------------
  |  |  484|  55.6k|#define PRED_L1   2
  ------------------
  |  Branch (465:29): [True: 3.99k, False: 51.6k]
  ------------------
  466|  55.6k|            COPYTHECONTEXT("sub_mb_type", u1_sub_mb_mode);
  467|       |            /* Storing collocated Mb and SubMb mode information */
  468|  55.6k|            *pu1_col_info++ =
  469|  55.6k|                            (u1_colz | (pu1_sub_mb_mc_mode[u1_sub_mb_mode] << 4));
  470|  55.6k|            if(u1_sub_mb_mode != B_DIRECT_8x8)
  ------------------
  |  |  465|  55.6k|#define B_DIRECT_8x8    0
  ------------------
  |  Branch (470:16): [True: 51.8k, False: 3.87k]
  ------------------
  471|  51.8k|            {
  472|  51.8k|                if(u1_sub_mb_mode > B_BI_8x8)
  ------------------
  |  |  468|  51.8k|#define B_BI_8x8        3
  ------------------
  |  Branch (472:20): [True: 2.83k, False: 48.9k]
  ------------------
  473|  2.83k|                {
  474|  2.83k|                    ps_dec->s_high_profile.u1_no_submb_part_size_lt8x8_flag = 0;
  475|  2.83k|                }
  476|  51.8k|            }
  477|  3.87k|            else if(!ps_dec->s_high_profile.u1_direct_8x8_inference_flag)
  ------------------
  |  Branch (477:21): [True: 3.37k, False: 497]
  ------------------
  478|  3.37k|            {
  479|  3.37k|                ps_dec->s_high_profile.u1_no_submb_part_size_lt8x8_flag = 0;
  480|  3.37k|            }
  481|  55.6k|        }
  482|  13.9k|        pi1_ref_idx_l0 -= 4;
  483|  13.9k|        pi1_ref_idx_l1 -= 4;
  484|  13.9k|    }
  485|  11.4k|    else
  486|  11.4k|    {
  487|  11.4k|        UWORD8 u1_mb_pred_mode_part0 = pu1_mb_pred_modes[0][u1_mbpred_mode];
  488|  11.4k|        UWORD8 u1_mb_pred_mode_part1 = pu1_mb_pred_modes[1][u1_mbpred_mode];
  489|  11.4k|        u1_mb_mc_mode = ps_cur_mb_info->u1_mb_mc_mode;
  490|  11.4k|        u1_num_mb_part = pu1_num_mb_part[u1_mb_mc_mode];
  491|       |        /* Storing collocated Mb and SubMb mode information */
  492|  11.4k|        *pu1_col_info++ = (u1_mb_mc_mode << 6);
  493|  11.4k|        if(u1_mb_mc_mode)
  ------------------
  |  Branch (493:12): [True: 7.05k, False: 4.44k]
  ------------------
  494|  7.05k|            *pu1_col_info++ = (u1_mb_mc_mode << 6);
  495|  11.4k|        u4_mb_mc_mode = u1_mb_mc_mode | (u1_mb_mc_mode << 8);
  496|  11.4k|        u4_mb_mc_mode <<= 16;
  497|  11.4k|        u4_mb_pred_mode = ((u1_mb_pred_mode_part0 << 8) | u1_mb_pred_mode_part1) << 16;
  498|       |
  499|  11.4k|        *pi1_ref_idx_l0++ = (u1_mb_pred_mode_part0 & PRED_L0) ? u1_dec_ref_l0 : -1;
  ------------------
  |  |  483|  11.4k|#define PRED_L0   1
  ------------------
  |  Branch (499:29): [True: 6.04k, False: 5.44k]
  ------------------
  500|  11.4k|        *pi1_ref_idx_l0-- = (u1_mb_pred_mode_part1 & PRED_L0) ? u1_dec_ref_l0 : -1;
  ------------------
  |  |  483|  11.4k|#define PRED_L0   1
  ------------------
  |  Branch (500:29): [True: 8.39k, False: 3.10k]
  ------------------
  501|  11.4k|        *pi1_ref_idx_l1++ = (u1_mb_pred_mode_part0 & PRED_L1) ? u1_dec_ref_l1 : -1;
  ------------------
  |  |  484|  11.4k|#define PRED_L1   2
  ------------------
  |  Branch (501:29): [True: 8.61k, False: 2.87k]
  ------------------
  502|  11.4k|        *pi1_ref_idx_l1-- = (u1_mb_pred_mode_part1 & PRED_L1) ? u1_dec_ref_l1 : -1;
  ------------------
  |  |  484|  11.4k|#define PRED_L1   2
  ------------------
  |  Branch (502:29): [True: 9.11k, False: 2.38k]
  ------------------
  503|  11.4k|    }
  504|  25.4k|    {
  505|  25.4k|        WORD8 *pi1_lft_cxt = ps_dec->pi1_left_ref_idx_ctxt_inc;
  506|  25.4k|        WORD8 *pi1_top_cxt = p_curr_ctxt->i1_ref_idx;
  507|       |
  508|  25.4k|        ret = ih264d_parse_ref_idx_cabac(u1_num_mb_part, 0, u1_dec_ref_l0,
  509|  25.4k|                                   u1_mb_mc_mode, pi1_ref_idx_l0, pi1_lft_cxt,
  510|  25.4k|                                   pi1_top_cxt, ps_cab_env, ps_bitstrm,
  511|  25.4k|                                   ps_dec->p_ref_idx_t);
  512|  25.4k|        if(ret != OK)
  ------------------
  |  |  114|  25.4k|#define OK        0
  ------------------
  |  Branch (512:12): [True: 20, False: 25.3k]
  ------------------
  513|     20|            return ret;
  514|       |
  515|  25.3k|        ret = ih264d_parse_ref_idx_cabac(u1_num_mb_part, 2, u1_dec_ref_l1,
  516|  25.3k|                                   u1_mb_mc_mode, pi1_ref_idx_l1, pi1_lft_cxt,
  517|  25.3k|                                   pi1_top_cxt, ps_cab_env, ps_bitstrm,
  518|  25.3k|                                   ps_dec->p_ref_idx_t);
  519|  25.3k|        if(ret != OK)
  ------------------
  |  |  114|  25.3k|#define OK        0
  ------------------
  |  Branch (519:12): [True: 87, False: 25.3k]
  ------------------
  520|     87|            return ret;
  521|  25.3k|    }
  522|       |    /* Read MotionVectors */
  523|  25.3k|    {
  524|  25.3k|        const UWORD8 *pu1_top_left_sub_mb_indx;
  525|  25.3k|        UWORD8 uc_j, uc_lx;
  526|  25.3k|        UWORD8 u1_mb_part_wd, u1_mb_part_ht;
  527|       |
  528|  25.3k|        const UWORD8 *pu1_sub_mb_indx_mod =
  529|  25.3k|                        (const UWORD8 *)gau1_ih264d_submb_indx_mod
  530|  25.3k|                                        + (u1_sub_mb * 6);
  531|  25.3k|        const UWORD8 *pu1_sub_mb_partw = (const UWORD8 *)gau1_ih264d_submb_partw;
  532|  25.3k|        const UWORD8 *pu1_sub_mb_parth = (const UWORD8 *)gau1_ih264d_submb_parth;
  533|  25.3k|        const UWORD8 *pu1_num_sub_mb_part =
  534|  25.3k|                        (const UWORD8 *)gau1_ih264d_num_submb_part;
  535|  25.3k|        const UWORD8 *pu1_mb_partw = (const UWORD8 *)gau1_ih264d_mb_partw;
  536|  25.3k|        const UWORD8 *pu1_mb_parth = (const UWORD8 *)gau1_ih264d_mb_parth;
  537|       |
  538|  25.3k|        UWORD8 u1_p_idx = 0;
  539|  25.3k|        UWORD8 u1_num_submb_part;
  540|  25.3k|        parse_part_params_t *ps_part;
  541|       |        /* Initialisations */
  542|  25.3k|        mv_pred_t *ps_mv_start = ps_dec->ps_mv_cur + (u4_mb_num << 4);
  543|  25.3k|        ps_part = ps_dec->ps_part;
  544|       |
  545|       |        /* Default initialization for non subMb case */
  546|  25.3k|        u1_mb_part_wd = pu1_mb_partw[u1_mb_mc_mode];
  547|  25.3k|        u1_mb_part_ht = pu1_mb_parth[u1_mb_mc_mode];
  548|  25.3k|        u1_num_submb_part = 1;
  549|       |
  550|       |        /* Decoding the MV for the subMB */
  551|  75.9k|        for(uc_lx = 0; uc_lx < 2; uc_lx++)
  ------------------
  |  Branch (551:24): [True: 50.6k, False: 25.3k]
  ------------------
  552|  50.6k|        {
  553|  50.6k|            UWORD32 u4_sub_mb_num = 0;
  554|  50.6k|            UWORD32 u4_mb_pred_mode_tmp = u4_mb_pred_mode;
  555|  50.6k|            UWORD32 u4_mb_mc_mode_tmp = u4_mb_mc_mode;
  556|  50.6k|            UWORD8 u1_mb_mc_mode_1, u1_pred_mode, uc_i;
  557|  50.6k|            UWORD16 u2_sub_mb_num = 0x028A;
  558|  50.6k|            UWORD8 u1_b2 = uc_lx << 1;
  559|  50.6k|            u1_pred_mode = (uc_lx) ? PRED_L1 : PRED_L0;
  ------------------
  |  |  484|  25.3k|#define PRED_L1   2
  ------------------
                          u1_pred_mode = (uc_lx) ? PRED_L1 : PRED_L0;
  ------------------
  |  |  483|  75.9k|#define PRED_L0   1
  ------------------
  |  Branch (559:28): [True: 25.3k, False: 25.3k]
  ------------------
  560|       |            /* Default for Cabac */
  561|  50.6k|            pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_mb_mc_mode << 1);
  562|   198k|            for(uc_i = 0; uc_i < u1_num_mb_part; uc_i++)
  ------------------
  |  Branch (562:27): [True: 148k, False: 50.6k]
  ------------------
  563|   148k|            {
  564|       |
  565|   148k|                WORD8 i1_pred = (UWORD8)(u4_mb_pred_mode_tmp >> 24);
  566|   148k|                u1_mb_mc_mode_1 = (UWORD8)(u4_mb_mc_mode_tmp >> 24);
  567|   148k|                u4_mb_pred_mode_tmp <<= 8;
  568|   148k|                u4_mb_mc_mode_tmp <<= 8;
  569|       |
  570|       |                /* subMb prediction mode */
  571|   148k|                if(u1_sub_mb)
  ------------------
  |  Branch (571:20): [True: 111k, False: 36.8k]
  ------------------
  572|   111k|                {
  573|   111k|                    u1_mb_part_wd = pu1_sub_mb_partw[u1_mb_mc_mode_1];
  574|   111k|                    u1_mb_part_ht = pu1_sub_mb_parth[u1_mb_mc_mode_1];
  575|   111k|                    u4_sub_mb_num = u2_sub_mb_num >> 12;
  576|   111k|                    pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_mb_mc_mode_1 << 1);
  577|   111k|                    u1_num_submb_part = pu1_num_sub_mb_part[u1_mb_mc_mode_1];
  578|   111k|                    u2_sub_mb_num = u2_sub_mb_num << 4;
  579|   111k|                }
  580|       |
  581|   303k|                for(uc_j = 0; uc_j < u1_num_submb_part;
  ------------------
  |  Branch (581:31): [True: 155k, False: 148k]
  ------------------
  582|   155k|                                uc_j++, pu1_top_left_sub_mb_indx++)
  583|   155k|                {
  584|   155k|                    mv_pred_t *ps_mv;
  585|   155k|                    u4_sub_mb_num = u4_sub_mb_num + *pu1_top_left_sub_mb_indx;
  586|   155k|                    ps_mv = ps_mv_start + u4_sub_mb_num;
  587|       |
  588|       |                    /* Storing Info for partitions, writing only once */
  589|   155k|                    if(uc_lx)
  ------------------
  |  Branch (589:24): [True: 77.5k, False: 77.5k]
  ------------------
  590|  77.5k|                    {
  591|  77.5k|                        ps_part->u1_is_direct = (!i1_pred);
  592|  77.5k|                        ps_part->u1_pred_mode = i1_pred;
  593|  77.5k|                        ps_part->u1_sub_mb_num = u4_sub_mb_num;
  594|  77.5k|                        ps_part->u1_partheight = u1_mb_part_ht;
  595|  77.5k|                        ps_part->u1_partwidth = u1_mb_part_wd;
  596|       |
  597|       |                        /* Increment partition Index */
  598|  77.5k|                        u1_p_idx++;
  599|  77.5k|                        ps_part++;
  600|  77.5k|                    }
  601|       |
  602|   155k|                    ih264d_get_mvd_cabac(u4_sub_mb_num, u1_b2, u1_mb_part_wd,
  603|   155k|                                         u1_mb_part_ht,
  604|   155k|                                         (UWORD8)(i1_pred & u1_pred_mode), ps_dec,
  605|   155k|                                         ps_mv);
  606|   155k|                }
  607|   148k|            }
  608|  50.6k|        }
  609|       |        /* write back to the scratch partition info */
  610|       |
  611|  25.3k|        ps_dec->ps_part = ps_part;
  612|  25.3k|        ps_parse_mb_data->u1_num_part = u1_sub_mb ? u1_p_idx : u1_num_mb_part;
  ------------------
  |  Branch (612:41): [True: 13.9k, False: 11.3k]
  ------------------
  613|       |
  614|  25.3k|    }
  615|       |
  616|  25.3k|    return OK;
  ------------------
  |  |  114|  25.3k|#define OK        0
  ------------------
  617|  25.3k|}
ih264d_parse_bmb_cabac:
  634|  27.0k|{
  635|  27.0k|    UWORD8 u1_cbp;
  636|  27.0k|    deblk_mb_t * ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u4_mb_num;
  637|  27.0k|    const UWORD8 *puc_mb_mc_mode = (const UWORD8 *)gau1_ih264d_mb_mc_mode;
  638|  27.0k|    UWORD8 u1_mb_type = ps_cur_mb_info->u1_mb_type;
  639|  27.0k|    ctxt_inc_mb_info_t *p_curr_ctxt = ps_dec->ps_curr_ctxt_mb_info;
  640|       |
  641|  27.0k|    WORD32 ret;
  642|  27.0k|    UWORD8 u1_Bdirect_tranform_read = 1;
  643|  27.0k|    ps_dec->s_high_profile.u1_no_submb_part_size_lt8x8_flag = 1;
  644|       |
  645|  27.0k|    ps_cur_mb_info->u1_mb_mc_mode = puc_mb_mc_mode[5 + u1_mb_type];
  646|       |
  647|  27.0k|    ps_cur_mb_info->u1_yuv_dc_block_flag = 0;
  648|       |
  649|  27.0k|    ps_cur_deblk_mb->u1_mb_type |= D_B_SLICE;
  ------------------
  |  |  384|  27.0k|#define D_B_SLICE         4
  ------------------
  650|  27.0k|    if(u1_mb_type != B_DIRECT)
  ------------------
  |  |  482|  27.0k|#define B_DIRECT  0
  ------------------
  |  Branch (650:8): [True: 25.4k, False: 1.66k]
  ------------------
  651|  25.4k|    {
  652|  25.4k|        ret = ih264d_parse_bmb_non_direct_cabac(ps_dec, ps_cur_mb_info, u4_mb_num,
  653|  25.4k|                                          u4_num_mbsNby2);
  654|  25.4k|        if(ret != OK)
  ------------------
  |  |  114|  25.4k|#define OK        0
  ------------------
  |  Branch (654:12): [True: 107, False: 25.3k]
  ------------------
  655|    107|            return ret;
  656|  25.4k|    }
  657|  1.66k|    else
  658|  1.66k|    {
  659|       |
  660|       |        /************ STORING PARTITION INFO ***********/
  661|  1.66k|        parse_part_params_t * ps_part_info;
  662|  1.66k|        ps_part_info = ps_dec->ps_part;
  663|  1.66k|        ps_part_info->u1_is_direct = PART_DIRECT_16x16;
  ------------------
  |  |  571|  1.66k|#define PART_DIRECT_16x16              2
  ------------------
  664|  1.66k|        ps_part_info->u1_sub_mb_num = 0;
  665|  1.66k|        ps_dec->ps_part++;
  666|  1.66k|        p_curr_ctxt->u1_mb_type = CAB_BD16x16;
  ------------------
  |  |  396|  1.66k|#define CAB_BD16x16       0x04 /* 0000 0100 */
  ------------------
  667|       |
  668|  1.66k|        MEMSET_16BYTES(&ps_dec->pu1_left_mv_ctxt_inc[0][0], 0);
  ------------------
  |  |  652|  1.66k|#define MEMSET_16BYTES(pu4_start,value)                         \
  |  |  653|  1.66k|{                                                               \
  |  |  654|  1.66k|    memset(pu4_start,value,16);                                 \
  |  |  655|  1.66k|}
  ------------------
  669|  1.66k|        memset(ps_dec->pi1_left_ref_idx_ctxt_inc, 0, 4);
  670|  1.66k|        MEMSET_16BYTES(p_curr_ctxt->u1_mv, 0);
  ------------------
  |  |  652|  1.66k|#define MEMSET_16BYTES(pu4_start,value)                         \
  |  |  653|  1.66k|{                                                               \
  |  |  654|  1.66k|    memset(pu4_start,value,16);                                 \
  |  |  655|  1.66k|}
  ------------------
  671|  1.66k|        memset(p_curr_ctxt->i1_ref_idx, 0, 4);
  672|       |
  673|       |        /* check whether transform8x8 u4_flag to be read or not */
  674|  1.66k|        u1_Bdirect_tranform_read =
  675|  1.66k|                        ps_dec->s_high_profile.u1_direct_8x8_inference_flag;
  676|  1.66k|    }
  677|       |
  678|       |    /* Read the Coded block pattern */
  679|  26.9k|    u1_cbp = (WORD8)ih264d_parse_ctx_cbp_cabac(ps_dec);
  680|  26.9k|    p_curr_ctxt->u1_cbp = u1_cbp;
  681|  26.9k|    ps_cur_mb_info->u1_cbp = u1_cbp;
  682|       |
  683|  26.9k|    if(u1_cbp > 47)
  ------------------
  |  Branch (683:8): [True: 0, False: 26.9k]
  ------------------
  684|      0|        return ERROR_CBP;
  685|       |
  686|  26.9k|    COPYTHECONTEXT("coded_block_pattern", u1_cbp);
  687|       |
  688|  26.9k|    ps_cur_mb_info->u1_tran_form8x8 = 0;
  689|  26.9k|    ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
  690|       |
  691|  26.9k|    if((ps_dec->s_high_profile.u1_transform8x8_present) && (u1_cbp & (0xf))
  ------------------
  |  Branch (691:8): [True: 2.77k, False: 24.1k]
  |  Branch (691:60): [True: 2.25k, False: 520]
  ------------------
  692|  2.25k|                    && (ps_dec->s_high_profile.u1_no_submb_part_size_lt8x8_flag)
  ------------------
  |  Branch (692:24): [True: 1.95k, False: 297]
  ------------------
  693|  1.95k|                    && (u1_Bdirect_tranform_read))
  ------------------
  |  Branch (693:24): [True: 1.95k, False: 0]
  ------------------
  694|  1.95k|    {
  695|  1.95k|        ps_cur_mb_info->u1_tran_form8x8 = ih264d_parse_transform8x8flag_cabac(
  696|  1.95k|                        ps_dec, ps_cur_mb_info);
  697|  1.95k|        COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8);
  698|       |
  699|  1.95k|        ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8;
  700|  1.95k|        p_curr_ctxt->u1_transform8x8_ctxt = ps_cur_mb_info->u1_tran_form8x8;
  701|  1.95k|    }
  702|  25.0k|    else
  703|  25.0k|    {
  704|  25.0k|        p_curr_ctxt->u1_transform8x8_ctxt = 0;
  705|  25.0k|    }
  706|       |
  707|  26.9k|    p_curr_ctxt->u1_intra_chroma_pred_mode = 0;
  708|  26.9k|    p_curr_ctxt->u1_yuv_dc_csbp &= 0xFE;
  709|  26.9k|    ps_dec->pu1_left_yuv_dc_csbp[0] &= 0x6;
  710|       |
  711|       |    /* Read mb_qp_delta */
  712|  26.9k|    if(u1_cbp)
  ------------------
  |  Branch (712:8): [True: 7.57k, False: 19.3k]
  ------------------
  713|  7.57k|    {
  714|  7.57k|        WORD8 c_temp;
  715|  7.57k|        ret = ih264d_parse_mb_qp_delta_cabac(ps_dec, &c_temp);
  716|  7.57k|        if(ret != OK)
  ------------------
  |  |  114|  7.57k|#define OK        0
  ------------------
  |  Branch (716:12): [True: 0, False: 7.57k]
  ------------------
  717|      0|            return ret;
  718|  7.57k|        COPYTHECONTEXT("mb_qp_delta", c_temp);
  719|  7.57k|        if(c_temp)
  ------------------
  |  Branch (719:12): [True: 789, False: 6.78k]
  ------------------
  720|    789|        {
  721|    789|            ret = ih264d_update_qp(ps_dec, c_temp);
  722|    789|            if(ret != OK)
  ------------------
  |  |  114|    789|#define OK        0
  ------------------
  |  Branch (722:16): [True: 0, False: 789]
  ------------------
  723|      0|                return ret;
  724|    789|        }
  725|  7.57k|    }
  726|  19.3k|    else
  727|  19.3k|        ps_dec->i1_prev_mb_qp_delta = 0;
  728|       |
  729|  26.9k|    ih264d_parse_residual4x4_cabac(ps_dec, ps_cur_mb_info, 0);
  730|  26.9k|    if(EXCEED_OFFSET(ps_dec->ps_bitstrm))
  ------------------
  |  |   93|  26.9k|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 229, False: 26.7k]
  |  |  ------------------
  ------------------
  731|    229|        return ERROR_EOB_TERMINATE_T;
  732|  26.7k|    return OK;
  ------------------
  |  |  114|  26.7k|#define OK        0
  ------------------
  733|  26.9k|}
ih264d_parse_bmb_cavlc:
  749|    913|{
  750|    913|    UWORD32 u4_cbp;
  751|    913|    deblk_mb_t * ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u4_mb_num;
  752|    913|    dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
  753|    913|    UWORD32 * pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  754|    913|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  755|    913|    const UWORD8 *puc_mb_mc_mode = (const UWORD8 *)gau1_ih264d_mb_mc_mode;
  756|    913|    UWORD8 u1_mb_type = ps_cur_mb_info->u1_mb_type;
  757|       |
  758|    913|    WORD32 ret;
  759|    913|    UWORD8 u1_Bdirect_tranform_read = 1;
  760|    913|    ps_dec->s_high_profile.u1_no_submb_part_size_lt8x8_flag = 1;
  761|    913|    ps_cur_mb_info->u1_tran_form8x8 = 0;
  762|    913|    ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
  763|       |
  764|    913|    ps_cur_mb_info->u1_yuv_dc_block_flag = 0;
  765|       |
  766|    913|    ps_cur_mb_info->u1_mb_mc_mode = puc_mb_mc_mode[5 + u1_mb_type];
  767|       |
  768|    913|    ps_cur_deblk_mb->u1_mb_type |= D_B_SLICE;
  ------------------
  |  |  384|    913|#define D_B_SLICE         4
  ------------------
  769|    913|    if(u1_mb_type != B_DIRECT)
  ------------------
  |  |  482|    913|#define B_DIRECT  0
  ------------------
  |  Branch (769:8): [True: 598, False: 315]
  ------------------
  770|    598|    {
  771|    598|        ret = ih264d_parse_bmb_non_direct_cavlc(ps_dec, ps_cur_mb_info, u4_mb_num,
  772|    598|                                          u4_num_mbsNby2);
  773|    598|        if(ret != OK)
  ------------------
  |  |  114|    598|#define OK        0
  ------------------
  |  Branch (773:12): [True: 15, False: 583]
  ------------------
  774|     15|            return ret;
  775|    598|    }
  776|    315|    else
  777|    315|    {
  778|       |        /************ STORING PARTITION INFO ***********/
  779|    315|        parse_part_params_t * ps_part_info;
  780|    315|        ps_part_info = ps_dec->ps_part;
  781|    315|        ps_part_info->u1_is_direct = PART_DIRECT_16x16;
  ------------------
  |  |  571|    315|#define PART_DIRECT_16x16              2
  ------------------
  782|    315|        ps_part_info->u1_sub_mb_num = 0;
  783|    315|        ps_dec->ps_part++;
  784|       |        /* check whether transform8x8 u4_flag to be read or not */
  785|    315|        u1_Bdirect_tranform_read =
  786|    315|                        ps_dec->s_high_profile.u1_direct_8x8_inference_flag;
  787|    315|    }
  788|       |
  789|       |    /* Read the Coded block pattern */
  790|    898|    {
  791|    898|        const UWORD8 * puc_CbpInter = gau1_ih264d_cbp_inter;
  792|       |//Inlined ih264d_uev
  793|    898|        UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  794|    898|        UWORD32 u4_word, u4_ldz;
  795|       |
  796|       |        /***************************************************************/
  797|       |        /* Find leading zeros in next 32 bits                          */
  798|       |        /***************************************************************/
  799|    898|        NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|    898|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|    898|{                                                                           \
  |  |  152|    898|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|    898|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|    898|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|    898|                                                                            \
  |  |  156|    898|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|    898|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 840, False: 58]
  |  |  ------------------
  |  |  158|    898|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|    840|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|    898|}
  ------------------
  800|    898|        u4_ldz = CLZ(u4_word);
  801|       |        /* Flush the ps_bitstrm */
  802|    898|        u4_bitstream_offset += (u4_ldz + 1);
  803|       |        /* Read the suffix from the ps_bitstrm */
  804|    898|        u4_word = 0;
  805|    898|        if(u4_ldz)
  ------------------
  |  Branch (805:12): [True: 419, False: 479]
  ------------------
  806|    419|            GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|    419|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    419|{                                                                           \
  |  |  122|    419|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    419|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    419|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    419|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    419|                                                                            \
  |  |  127|    419|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 417, False: 2]
  |  |  ------------------
  |  |  128|    419|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    417|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    419|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    419|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    419|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    419|}                                                                           \
  ------------------
  807|    898|        *pu4_bitstrm_ofst = u4_bitstream_offset;
  808|    898|        u4_cbp = ((1 << u4_ldz) + u4_word - 1);
  809|       |//Inlined ih264d_uev
  810|    898|        if(u4_cbp > 47)
  ------------------
  |  Branch (810:12): [True: 12, False: 886]
  ------------------
  811|     12|            return ERROR_CBP;
  812|    886|        u4_cbp = puc_CbpInter[u4_cbp];
  813|       |
  814|    886|        if((ps_dec->s_high_profile.u1_transform8x8_present) && (u4_cbp & (0xf))
  ------------------
  |  Branch (814:12): [True: 63, False: 823]
  |  Branch (814:64): [True: 3, False: 60]
  ------------------
  815|      3|                        && (ps_dec->s_high_profile.u1_no_submb_part_size_lt8x8_flag)
  ------------------
  |  Branch (815:28): [True: 3, False: 0]
  ------------------
  816|      3|                        && (u1_Bdirect_tranform_read))
  ------------------
  |  Branch (816:28): [True: 3, False: 0]
  ------------------
  817|      3|        {
  818|      3|            ps_cur_mb_info->u1_tran_form8x8 = ih264d_get_bit_h264(ps_bitstrm);
  819|      3|            COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8);
  820|      3|            ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8;
  821|      3|        }
  822|       |
  823|    886|    }
  824|       |
  825|      0|    COPYTHECONTEXT("coded_block_pattern", u4_cbp);
  826|    886|    ps_cur_mb_info->u1_cbp = u4_cbp;
  827|       |
  828|       |    /* Read mb_qp_delta */
  829|    886|    if(u4_cbp)
  ------------------
  |  Branch (829:8): [True: 407, False: 479]
  ------------------
  830|    407|    {
  831|    407|        WORD32 i_temp;
  832|       |//inlining ih264d_sev
  833|       |
  834|    407|        UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  835|    407|        UWORD32 u4_word, u4_ldz, u4_abs_val;
  836|       |
  837|       |        /***************************************************************/
  838|       |        /* Find leading zeros in next 32 bits                          */
  839|       |        /***************************************************************/
  840|    407|        NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|    407|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|    407|{                                                                           \
  |  |  152|    407|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|    407|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|    407|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|    407|                                                                            \
  |  |  156|    407|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|    407|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 407, False: 0]
  |  |  ------------------
  |  |  158|    407|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|    407|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|    407|}
  ------------------
  841|    407|        u4_ldz = CLZ(u4_word);
  842|       |
  843|       |        /* Flush the ps_bitstrm */
  844|    407|        u4_bitstream_offset += (u4_ldz + 1);
  845|       |
  846|       |        /* Read the suffix from the ps_bitstrm */
  847|    407|        u4_word = 0;
  848|    407|        if(u4_ldz)
  ------------------
  |  Branch (848:12): [True: 181, False: 226]
  ------------------
  849|    181|            GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|    181|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    181|{                                                                           \
  |  |  122|    181|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    181|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    181|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    181|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    181|                                                                            \
  |  |  127|    181|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 181, False: 0]
  |  |  ------------------
  |  |  128|    181|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    181|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    181|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    181|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    181|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    181|}                                                                           \
  ------------------
  850|       |
  851|    407|        *pu4_bitstrm_ofst = u4_bitstream_offset;
  852|    407|        u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1;
  853|       |
  854|    407|        if(u4_word & 0x1)
  ------------------
  |  Branch (854:12): [True: 62, False: 345]
  ------------------
  855|     62|            i_temp = (-(WORD32)u4_abs_val);
  856|    345|        else
  857|    345|            i_temp = (u4_abs_val);
  858|       |
  859|    407|        if(i_temp < -26 || i_temp > 25)
  ------------------
  |  Branch (859:12): [True: 0, False: 407]
  |  Branch (859:28): [True: 0, False: 407]
  ------------------
  860|      0|            return ERROR_INV_RANGE_QP_T;
  861|       |//inlinined ih264d_sev
  862|    407|        COPYTHECONTEXT("mb_qp_delta", i_temp);
  863|    407|        if(i_temp)
  ------------------
  |  Branch (863:12): [True: 181, False: 226]
  ------------------
  864|    181|        {
  865|    181|            ret = ih264d_update_qp(ps_dec, (WORD8)i_temp);
  866|    181|            if(ret != OK)
  ------------------
  |  |  114|    181|#define OK        0
  ------------------
  |  Branch (866:16): [True: 0, False: 181]
  ------------------
  867|      0|                return ret;
  868|    181|        }
  869|       |
  870|    407|        ret = ih264d_parse_residual4x4_cavlc(ps_dec, ps_cur_mb_info, 0);
  871|    407|        if(ret != OK)
  ------------------
  |  |  114|    407|#define OK        0
  ------------------
  |  Branch (871:12): [True: 10, False: 397]
  ------------------
  872|     10|            return ret;
  873|    397|        if(EXCEED_OFFSET(ps_bitstrm))
  ------------------
  |  |   93|    397|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 6, False: 391]
  |  |  ------------------
  ------------------
  874|      6|            return ERROR_EOB_TERMINATE_T;
  875|    397|    }
  876|    479|    else
  877|    479|    {
  878|    479|        ps_dec->i1_prev_mb_qp_delta = 0;
  879|    479|        ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CAVLC);
  ------------------
  |  |  338|    479|#define CAVLC  0
  ------------------
  880|    479|    }
  881|       |
  882|    870|    return OK;
  ------------------
  |  |  114|    870|#define OK        0
  ------------------
  883|    886|}
ih264d_mv_pred_ref_tfr_nby2_bmb:
  888|  7.84k|{
  889|  7.84k|    parse_pmbarams_t * ps_mb_part_info;
  890|  7.84k|    parse_part_params_t * ps_part;
  891|  7.84k|    mv_pred_t *ps_mv_nmb, *ps_mv_nmb_start, *ps_mv_ntop, *ps_mv_ntop_start;
  892|  7.84k|    pic_buffer_t * ps_ref_frame;
  893|  7.84k|    UWORD8 u1_direct_mode_width;
  894|  7.84k|    UWORD32 i;
  895|  7.84k|    UWORD8 j;
  896|  7.84k|    dec_mb_info_t * ps_cur_mb_info;
  897|  7.84k|    const UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  898|  7.84k|    UWORD8 u1_field;
  899|  7.84k|    WORD32 ret = 0;
  900|       |
  901|  7.84k|    ps_dec->i4_submb_ofst -= (WORD32)(u4_num_mbs - u4_mb_idx) << 4;
  902|  7.84k|    ps_mb_part_info = ps_dec->ps_parse_mb_data;
  903|  7.84k|    ps_part = ps_dec->ps_parse_part_params;
  904|       |
  905|       |    /* N/2 Mb MvPred and Transfer Setup Loop */
  906|  50.6k|    for(i = u4_mb_idx; i < u4_num_mbs; i++, ps_mb_part_info++)
  ------------------
  |  Branch (906:24): [True: 42.8k, False: 7.84k]
  ------------------
  907|  42.8k|    {
  908|  42.8k|        UWORD8 u1_colz = 0;
  909|  42.8k|        ps_dec->i4_submb_ofst += SUB_BLK_SIZE;
  ------------------
  |  |  562|  42.8k|#define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|  42.8k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  |  |               #define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|  42.8k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  ------------------
  910|       |        /* Restore the slice scratch MbX and MbY context */
  911|  42.8k|        ps_cur_mb_info = ps_dec->ps_nmb_info + i;
  912|       |
  913|       |
  914|  42.8k|        u1_field = ps_cur_mb_info->u1_mb_field_decodingflag;
  915|       |
  916|  42.8k|        ps_mv_nmb_start = ps_dec->ps_mv_cur + (i << 4);
  917|  42.8k|        ps_dec->u2_mbx = ps_cur_mb_info->u2_mbx;
  918|  42.8k|        ps_dec->u2_mby = ps_cur_mb_info->u2_mby;
  919|  42.8k|        ps_dec->u1_currB_type = 0;
  920|  42.8k|        ps_dec->u2_mv_2mb[i & 0x1] = 0;
  921|       |
  922|       |        /* Look for MV Prediction and Reference Transfer in Non-I Mbs */
  923|  42.8k|        if(!ps_mb_part_info->u4_isI_mb)
  ------------------
  |  Branch (923:12): [True: 42.4k, False: 396]
  ------------------
  924|  42.4k|        {
  925|  42.4k|            UWORD8 u1_blk_no;
  926|  42.4k|            WORD16 i1_ref_idx, i1_ref_idx1;
  927|  42.4k|            UWORD8 u1_pred_mode;
  928|  42.4k|            UWORD8 u1_sub_mb_x, u1_sub_mb_y, u1_sub_mb_num;
  929|  42.4k|            UWORD8 u1_lx, u1_lx_start, u1_lxend, u1_tmp_lx;
  930|  42.4k|            UWORD8 u1_num_part, u1_num_ref, u1_wd, u1_ht;
  931|  42.4k|            UWORD32 *pu4_wt_offst;
  932|  42.4k|            UWORD8 u1_scale_ref, u4_bot_mb;
  933|  42.4k|            deblk_mb_t * ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + i;
  934|  42.4k|            WORD8 (*pi1_ref_idx)[MAX_REFIDX_INFO_PER_MB] =
  935|  42.4k|                            ps_mb_part_info->i1_ref_idx;
  936|  42.4k|            WORD8 *pi1_ref_idx0 = pi1_ref_idx[0],
  937|  42.4k|                            *pi1_ref_idx1 = pi1_ref_idx[1];
  938|  42.4k|            UWORD32 **ppu4_wt_ofst = ps_mb_part_info->pu4_wt_offst;
  939|       |
  940|       |            /* MB Level initialisations */
  941|  42.4k|            ps_dec->u4_num_pmbair = i >> u1_mbaff;
  942|  42.4k|            ps_dec->u4_mb_idx_mv = i;
  943|       |
  944|       |            /* CHANGED CODE */
  945|  42.4k|            ps_mv_ntop_start = ps_mv_nmb_start
  946|  42.4k|                            - (ps_dec->u2_frm_wd_in_mbs << (4 + u1_mbaff)) + 12;
  947|       |
  948|  42.4k|            u1_num_part = ps_mb_part_info->u1_num_part;
  949|  42.4k|            ps_cur_deblk_mb->u1_mb_type |= (u1_num_part > 1) << 1;
  950|  42.4k|            u1_direct_mode_width = (1 == ps_mb_part_info->u1_num_part) ? 16 : 8;
  ------------------
  |  Branch (950:36): [True: 21.6k, False: 20.7k]
  ------------------
  951|       |
  952|       |
  953|  42.4k|            ps_cur_mb_info->u4_pred_info_pkd_idx = ps_dec->u4_pred_info_pkd_idx;
  954|  42.4k|            ps_cur_mb_info->u1_num_pred_parts = 0;
  955|       |
  956|       |            /****************************************************/
  957|       |            /* weighted u4_ofst pointer calculations, this loop  */
  958|       |            /* runs maximum 4 times, even in direct cases       */
  959|       |            /****************************************************/
  960|  42.4k|            u1_scale_ref = u1_mbaff & ps_cur_mb_info->u1_mb_field_decodingflag;
  961|  42.4k|            u4_bot_mb = 1 - ps_cur_mb_info->u1_topmb;
  962|  42.4k|            if(ps_dec->ps_cur_pps->u1_wted_bipred_idc)
  ------------------
  |  Branch (962:16): [True: 3.89k, False: 38.5k]
  ------------------
  963|  3.89k|            {
  964|  3.89k|                u1_num_ref = MIN(u1_num_part, 4);
  ------------------
  |  |   61|  3.89k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 3.89k, False: 0]
  |  |  ------------------
  ------------------
  965|  3.89k|                if(PART_DIRECT_16x16 != ps_part->u1_is_direct)
  ------------------
  |  |  571|  3.89k|#define PART_DIRECT_16x16              2
  ------------------
  |  Branch (965:20): [True: 108, False: 3.78k]
  ------------------
  966|    108|                {
  967|    222|                    for(u1_blk_no = 0; u1_blk_no < u1_num_ref; u1_blk_no++)
  ------------------
  |  Branch (967:40): [True: 114, False: 108]
  ------------------
  968|    114|                    {
  969|    114|                        i1_ref_idx = MAX(pi1_ref_idx0[u1_blk_no], 0);
  ------------------
  |  |   60|    114|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 114]
  |  |  ------------------
  ------------------
  970|    114|                        if(u1_scale_ref)
  ------------------
  |  Branch (970:28): [True: 0, False: 114]
  ------------------
  971|      0|                            i1_ref_idx >>= 1;
  972|    114|                        i1_ref_idx *=
  973|    114|                                        ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1];
  974|    114|                        if(u1_scale_ref)
  ------------------
  |  Branch (974:28): [True: 0, False: 114]
  ------------------
  975|      0|                            i1_ref_idx +=
  976|      0|                                            (MAX(pi1_ref_idx1[u1_blk_no], 0)
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  977|      0|                                                            >> 1);
  978|    114|                        else
  979|    114|                            i1_ref_idx += MAX(pi1_ref_idx1[u1_blk_no], 0);
  ------------------
  |  |   60|    114|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 1, False: 113]
  |  |  ------------------
  ------------------
  980|    114|                        pu4_wt_offst = (UWORD32*)&ps_dec->pu4_wt_ofsts[2
  981|    114|                                        * X3(i1_ref_idx)];
  ------------------
  |  |   92|    114|#define X3(a)   (((a) << 1) + (a))
  ------------------
  982|       |
  983|    114|                        if(pi1_ref_idx0[u1_blk_no] < 0)
  ------------------
  |  Branch (983:28): [True: 47, False: 67]
  ------------------
  984|     47|                            pu4_wt_offst += 1;
  985|       |
  986|    114|                        ppu4_wt_ofst[u1_blk_no] = pu4_wt_offst;
  987|    114|                        if(u1_scale_ref
  ------------------
  |  Branch (987:28): [True: 0, False: 114]
  ------------------
  988|      0|                                        && (ps_dec->ps_cur_pps->u1_wted_bipred_idc
  ------------------
  |  Branch (988:44): [True: 0, False: 0]
  ------------------
  989|      0|                                                        == 2))
  990|      0|                        {
  991|      0|                            i1_ref_idx = MAX(pi1_ref_idx0[u1_blk_no], 0);
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  992|      0|                            i1_ref_idx *=
  993|      0|                                            (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1]
  994|      0|                                                            << 1);
  995|      0|                            i1_ref_idx += MAX(pi1_ref_idx1[u1_blk_no], 0);
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  996|      0|                            if(u4_bot_mb)
  ------------------
  |  Branch (996:32): [True: 0, False: 0]
  ------------------
  997|      0|                            {
  998|      0|                                i1_ref_idx +=
  999|      0|                                                (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0]
 1000|      0|                                                                << 1)
 1001|      0|                                                                * (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1]
 1002|      0|                                                                                << 1);
 1003|      0|                            }
 1004|      0|                            pu4_wt_offst = (UWORD32*)&ps_dec->pu4_mbaff_wt_mat[2
 1005|      0|                                            * X3(i1_ref_idx)];
  ------------------
  |  |   92|      0|#define X3(a)   (((a) << 1) + (a))
  ------------------
 1006|      0|                            ppu4_wt_ofst[u1_blk_no] = pu4_wt_offst;
 1007|      0|                        }
 1008|    114|                    }
 1009|    108|                }
 1010|  3.89k|            }
 1011|       |
 1012|       |            /**************************************************/
 1013|       |            /* Loop on Partitions                             */
 1014|       |            /* direct mode is reflected as a single partition */
 1015|       |            /**************************************************/
 1016|   136k|            for(j = 0; j < u1_num_part; j++, ps_part++)
  ------------------
  |  Branch (1016:24): [True: 94.1k, False: 42.4k]
  ------------------
 1017|  94.1k|            {
 1018|  94.1k|                u1_sub_mb_num = ps_part->u1_sub_mb_num;
 1019|  94.1k|                ps_dec->u1_sub_mb_num = u1_sub_mb_num;
 1020|       |
 1021|  94.1k|                if(PART_NOT_DIRECT != ps_part->u1_is_direct)
  ------------------
  |  |  569|  94.1k|#define PART_NOT_DIRECT                0
  ------------------
  |  Branch (1021:20): [True: 20.7k, False: 73.4k]
  ------------------
 1022|  20.7k|                {
 1023|       |                    /**************************************************/
 1024|       |                    /* Direct Mode, Call DecodeSpatial/TemporalDirect */
 1025|       |                    /* only (those will in turn call FormMbPartInfo)  */
 1026|       |                    /**************************************************/
 1027|  20.7k|                    ret = ps_dec->ps_cur_slice->pf_decodeDirect(ps_dec,
 1028|  20.7k|                                                                u1_direct_mode_width,
 1029|  20.7k|                                                                ps_cur_mb_info, i);
 1030|  20.7k|                    if(ret != OK)
  ------------------
  |  |  114|  20.7k|#define OK        0
  ------------------
  |  Branch (1030:24): [True: 0, False: 20.7k]
  ------------------
 1031|      0|                        return ret;
 1032|  20.7k|                    ps_cur_deblk_mb->u1_mb_type |= (ps_dec->u1_currB_type << 1);
 1033|       |
 1034|  20.7k|                }
 1035|  73.4k|                else
 1036|  73.4k|                {
 1037|  73.4k|                    mv_pred_t s_mvPred;
 1038|       |                    /**************************************************/
 1039|       |                    /* Non Direct Mode, Call Motion Vector Predictor  */
 1040|       |                    /* and FormMbpartInfo                             */
 1041|       |                    /**************************************************/
 1042|  73.4k|                    u1_sub_mb_x = u1_sub_mb_num & 0x03;
 1043|  73.4k|                    u1_sub_mb_y = u1_sub_mb_num >> 2;
 1044|  73.4k|                    u1_blk_no =
 1045|  73.4k|                                    (u1_num_part < 4) ?
  ------------------
  |  Branch (1045:37): [True: 18.6k, False: 54.8k]
  ------------------
 1046|  18.6k|                                                    j :
 1047|  73.4k|                                                    (((u1_sub_mb_y >> 1) << 1)
 1048|  54.8k|                                                                    + (u1_sub_mb_x
 1049|  54.8k|                                                                                    >> 1));
 1050|       |
 1051|  73.4k|                    ps_mv_ntop = ps_mv_ntop_start + u1_sub_mb_x;
 1052|  73.4k|                    ps_mv_nmb = ps_mv_nmb_start + u1_sub_mb_num;
 1053|       |
 1054|  73.4k|                    u1_pred_mode = ps_part->u1_pred_mode;
 1055|  73.4k|                    u1_wd = ps_part->u1_partwidth;
 1056|  73.4k|                    u1_ht = ps_part->u1_partheight;
 1057|       |
 1058|  73.4k|                    u1_lx_start = 0;
 1059|  73.4k|                    u1_lxend = 2;
 1060|  73.4k|                    if( PRED_L0 == u1_pred_mode)
  ------------------
  |  |  483|  73.4k|#define PRED_L0   1
  ------------------
  |  Branch (1060:25): [True: 54.7k, False: 18.7k]
  ------------------
 1061|  54.7k|                    {
 1062|  54.7k|                        s_mvPred.i2_mv[2] = 0;
 1063|  54.7k|                        s_mvPred.i2_mv[3] = 0;
 1064|  54.7k|                        u1_lxend = 1;
 1065|  54.7k|                    }
 1066|  73.4k|                    if( PRED_L1 == u1_pred_mode)
  ------------------
  |  |  484|  73.4k|#define PRED_L1   2
  ------------------
  |  Branch (1066:25): [True: 12.6k, False: 60.7k]
  ------------------
 1067|  12.6k|                    {
 1068|  12.6k|                        s_mvPred.i2_mv[0] = 0;
 1069|  12.6k|                        s_mvPred.i2_mv[1] = 0;
 1070|  12.6k|                        u1_lx_start = 1;
 1071|  12.6k|                    }
 1072|       |
 1073|       |                    /* Populate the colpic info and reference frames */
 1074|  73.4k|                    s_mvPred.i1_ref_frame[0] = pi1_ref_idx0[u1_blk_no];
 1075|  73.4k|                    s_mvPred.i1_ref_frame[1] = pi1_ref_idx1[u1_blk_no];
 1076|       |
 1077|  73.4k|                    ps_dec->pf_mvpred(ps_dec, ps_cur_mb_info, ps_mv_nmb, ps_mv_ntop,
 1078|  73.4k|                                      &s_mvPred, u1_sub_mb_num, u1_wd,
 1079|  73.4k|                                      u1_lx_start, u1_lxend,
 1080|  73.4k|                                      ps_cur_mb_info->u1_mb_mc_mode);
 1081|       |
 1082|       |                    /**********************************************************/
 1083|       |                    /* Loop on number of predictors, 1 Each for Forw Backw    */
 1084|       |                    /* Loop 2 times for BiDirect mode                         */
 1085|       |                    /**********************************************************/
 1086|   153k|                    for(u1_lx = u1_lx_start; u1_lx < u1_lxend; u1_lx++)
  ------------------
  |  Branch (1086:46): [True: 79.5k, False: 73.4k]
  ------------------
 1087|  79.5k|                    {
 1088|  79.5k|                        WORD16 i2_mv_x, i2_mv_y;
 1089|       |
 1090|       |                        /********************************************************/
 1091|       |                        /* Predict Mv                                           */
 1092|       |                        /* Add Mv Residuals and store back                      */
 1093|       |                        /********************************************************/
 1094|  79.5k|                        i1_ref_idx = s_mvPred.i1_ref_frame[u1_lx];
 1095|  79.5k|                        u1_tmp_lx = (u1_lx << 1);
 1096|       |
 1097|  79.5k|                        i2_mv_x = ps_mv_nmb->i2_mv[u1_tmp_lx];
 1098|  79.5k|                        i2_mv_y = ps_mv_nmb->i2_mv[u1_tmp_lx + 1];
 1099|       |
 1100|  79.5k|                        i2_mv_x += s_mvPred.i2_mv[u1_tmp_lx];
 1101|  79.5k|                        i2_mv_y += s_mvPred.i2_mv[u1_tmp_lx + 1];
 1102|  79.5k|                        s_mvPred.i2_mv[u1_tmp_lx] = i2_mv_x;
 1103|  79.5k|                        s_mvPred.i2_mv[u1_tmp_lx + 1] = i2_mv_y;
 1104|       |
 1105|       |                        /********************************************************/
 1106|       |                        /* Transfer setup call                                  */
 1107|       |                        /* convert RefIdx if it is MbAff                        */
 1108|       |                        /* Pass Weight Offset and refFrame                      */
 1109|       |                        /********************************************************/
 1110|  79.5k|                        i1_ref_idx1 = i1_ref_idx >> u1_scale_ref;
 1111|  79.5k|                        if(u1_scale_ref && ((i1_ref_idx & 0x01) != u4_bot_mb))
  ------------------
  |  Branch (1111:28): [True: 0, False: 79.5k]
  |  Branch (1111:44): [True: 0, False: 0]
  ------------------
 1112|      0|                            i1_ref_idx1 += MAX_REF_BUFS;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
 1113|  79.5k|                        ps_ref_frame =
 1114|  79.5k|                                        ps_dec->ps_ref_pic_buf_lx[u1_lx][i1_ref_idx1];
 1115|       |
 1116|       |                        /* Storing Colocated-Zero u4_flag */
 1117|  79.5k|                        if(u1_lx == u1_lx_start)
  ------------------
  |  Branch (1117:28): [True: 73.4k, False: 6.02k]
  ------------------
 1118|  73.4k|                        {
 1119|       |                            /* Fill colocated info in MvPred structure */
 1120|  73.4k|                            s_mvPred.u1_col_ref_pic_idx =
 1121|  73.4k|                                            ps_ref_frame->u1_mv_buf_id;
 1122|  73.4k|                            s_mvPred.u1_pic_type = ps_ref_frame->u1_pic_type;
 1123|       |
 1124|       |                            /* Calculating colocated zero information */
 1125|  73.4k|                            u1_colz =
 1126|  73.4k|                                            (u1_field << 1)
 1127|  73.4k|                                                            | ((i1_ref_idx == 0)
  ------------------
  |  Branch (1127:64): [True: 69.2k, False: 4.24k]
  ------------------
 1128|  69.2k|                                                                            && (ABS(i2_mv_x)
  ------------------
  |  |  100|  69.2k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 7.38k, False: 61.8k]
  |  |  ------------------
  ------------------
  |  Branch (1128:80): [True: 12.8k, False: 56.4k]
  ------------------
 1129|  69.2k|                                                                                            <= 1)
 1130|  12.8k|                                                                            && (ABS(i2_mv_y)
  ------------------
  |  |  100|  12.8k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 4.21k, False: 8.59k]
  |  |  ------------------
  ------------------
  |  Branch (1130:80): [True: 9.71k, False: 3.09k]
  ------------------
 1131|  12.8k|                                                                                            <= 1));
 1132|  73.4k|                            u1_colz |= ps_mb_part_info->u1_col_info[u1_blk_no];
 1133|  73.4k|                        }
 1134|       |
 1135|  79.5k|                        pu4_wt_offst = ppu4_wt_ofst[u1_blk_no];
 1136|  79.5k|                        {
 1137|  79.5k|                            pred_info_pkd_t *ps_pred_pkd;
 1138|  79.5k|                           WORD16 i2_mv[2];
 1139|       |
 1140|  79.5k|                           i2_mv[0] = i2_mv_x;
 1141|  79.5k|                           i2_mv[1] = i2_mv_y;
 1142|       |
 1143|  79.5k|                           ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
 1144|  79.5k|                        ih264d_fill_pred_info(i2_mv,u1_wd,u1_ht,u1_sub_mb_num,u1_pred_mode,
 1145|  79.5k|                                        ps_pred_pkd,ps_ref_frame->u1_pic_buf_id,i1_ref_idx,pu4_wt_offst,
 1146|  79.5k|                                        ps_ref_frame->u1_pic_type);
 1147|  79.5k|                        ps_dec->u4_pred_info_pkd_idx++;
 1148|  79.5k|                        ps_cur_mb_info->u1_num_pred_parts++;
 1149|       |
 1150|       |
 1151|  79.5k|                        }
 1152|       |
 1153|  79.5k|                    }
 1154|  73.4k|                    ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb,
 1155|  73.4k|                                       u1_sub_mb_num, u1_colz, u1_ht,
 1156|  73.4k|                                       u1_wd);
 1157|  73.4k|                }
 1158|  94.1k|            }
 1159|       |
 1160|  42.4k|        }
 1161|    396|        else
 1162|    396|        {
 1163|       |            /* Set zero values in case of Intra Mbs */
 1164|    396|            mv_pred_t s_mvPred =
 1165|    396|                {
 1166|    396|                    { 0, 0, 0, 0 },
 1167|    396|                      { -1, -1 }, 0, 0};
 1168|       |            /* Storing colocated zero information */
 1169|    396|            ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb_start, 0,
 1170|    396|                               (UWORD8)(u1_field << 1), 4, 4);
 1171|    396|        }
 1172|       |
 1173|       |        /*if num _cores is set to 3 ,compute bs will be done in another thread*/
 1174|  42.8k|        if(ps_dec->u4_num_cores < 3)
  ------------------
  |  Branch (1174:12): [True: 42.8k, False: 0]
  ------------------
 1175|  42.8k|        {
 1176|  42.8k|            if(ps_dec->u4_app_disable_deblk_frm == 0)
  ------------------
  |  Branch (1176:16): [True: 42.8k, False: 0]
  ------------------
 1177|  42.8k|                ps_dec->pf_compute_bs(ps_dec, ps_cur_mb_info,
 1178|  42.8k|                                     (UWORD16)(i >> u1_mbaff));
 1179|  42.8k|        }
 1180|  42.8k|    }
 1181|  7.84k|    return OK;
  ------------------
  |  |  114|  7.84k|#define OK        0
  ------------------
 1182|  7.84k|}
ih264d_get_implicit_weights:
 1196|    387|{
 1197|    387|    UWORD32 *pu4_iwt_ofst;
 1198|    387|    UWORD8 i, j;
 1199|    387|    struct pic_buffer_t *ps_pic_buff0, *ps_pic_buff1;
 1200|    387|    WORD16 i2_dist_scale_factor;
 1201|    387|    WORD16 i2_tb, i2_td, i2_tx;
 1202|    387|    WORD64 i8_tb, i8_td;
 1203|    387|    WORD32 i4_poc0, i4_poc1;
 1204|    387|    UWORD32 ui_temp0, ui_temp1;
 1205|    387|    UWORD8 uc_num_ref_idx_l0_active, uc_num_ref_idx_l1_active;
 1206|       |
 1207|    387|    pu4_iwt_ofst = ps_dec->pu4_wts_ofsts_mat;
 1208|    387|    uc_num_ref_idx_l0_active =
 1209|    387|                    ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0];
 1210|    387|    uc_num_ref_idx_l1_active =
 1211|    387|                    ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1];
 1212|       |
 1213|  1.12k|    for(i = 0; i < uc_num_ref_idx_l0_active; i++)
  ------------------
  |  Branch (1213:16): [True: 733, False: 387]
  ------------------
 1214|    733|    {
 1215|    733|        ps_pic_buff0 = ps_dec->ps_ref_pic_buf_lx[0][i];
 1216|    733|        i4_poc0 = ps_pic_buff0->i4_avg_poc;
 1217|  1.70k|        for(j = 0; j < uc_num_ref_idx_l1_active; j++)
  ------------------
  |  Branch (1217:20): [True: 970, False: 733]
  ------------------
 1218|    970|        {
 1219|    970|            ps_pic_buff1 = ps_dec->ps_ref_pic_buf_lx[1][j];
 1220|    970|            i4_poc1 = ps_pic_buff1->i4_avg_poc;
 1221|       |
 1222|    970|            if(i4_poc1 != i4_poc0)
  ------------------
  |  Branch (1222:16): [True: 28, False: 942]
  ------------------
 1223|     28|            {
 1224|     28|                i8_tb = (WORD64)ps_dec->ps_cur_pic->i4_poc - i4_poc0;
 1225|     28|                i2_tb = CLIP_S8(i8_tb);
  ------------------
  |  |   59|     28|#define CLIP_S8(x) CLIP3(INT8_MIN, INT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|     28|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 9, False: 19]
  |  |  |  |  |  Branch (77:54): [True: 12, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1226|     28|                i8_td = (WORD64)i4_poc1 - i4_poc0;
 1227|     28|                i2_td = CLIP_S8(i8_td);
  ------------------
  |  |   59|     28|#define CLIP_S8(x) CLIP3(INT8_MIN, INT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|     28|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 8, False: 20]
  |  |  |  |  |  Branch (77:54): [True: 19, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1228|     28|                i2_tx = (16384 + ABS(SIGN_POW2_DIV(i2_td, 1))) / i2_td;
  ------------------
  |  |  100|     56|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 8, False: 20]
  |  |  |  Branch (100:27): [True: 8, False: 20]
  |  |  |  Branch (100:39): [True: 8, False: 0]
  |  |  |  Branch (100:46): [True: 0, False: 20]
  |  |  ------------------
  ------------------
 1229|     28|                i2_dist_scale_factor = CLIP_S11(
  ------------------
  |  |   65|     28|#define CLIP_S11(x) CLIP3(-1024, 1023, (x))
  |  |  ------------------
  |  |  |  |   77|     28|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 28]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 28]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1230|     28|                                            (((i2_tb * i2_tx) + 32) >> 6));
 1231|       |
 1232|     28|                if(/*((u4_poc1 - u4_poc0) == 0) ||*/
 1233|     28|                (!(ps_pic_buff1->u1_is_short && ps_pic_buff0->u1_is_short))
  ------------------
  |  Branch (1233:20): [True: 24, False: 4]
  |  Branch (1233:49): [True: 24, False: 0]
  ------------------
 1234|     24|                                || ((i2_dist_scale_factor >> 2) < -64)
  ------------------
  |  Branch (1234:36): [True: 0, False: 24]
  ------------------
 1235|     24|                                || ((i2_dist_scale_factor >> 2) > 128))
  ------------------
  |  Branch (1235:36): [True: 0, False: 24]
  ------------------
 1236|      4|                {
 1237|       |                    /* same for forward and backward, wt=32 and Offset = 0 */
 1238|      4|                    ui_temp0 = 0x00000020;
 1239|      4|                    ui_temp1 = 0x00000020;
 1240|      4|                }
 1241|     24|                else
 1242|     24|                {
 1243|     24|                    ui_temp0 = 64 - (i2_dist_scale_factor >> 2);
 1244|     24|                    ui_temp1 = (i2_dist_scale_factor >> 2);
 1245|     24|                }
 1246|     28|            }
 1247|    942|            else
 1248|    942|            {
 1249|    942|                ui_temp0 = 0x00000020;
 1250|    942|                ui_temp1 = 0x00000020;
 1251|    942|            }
 1252|    970|            pu4_iwt_ofst[0] = pu4_iwt_ofst[2] = pu4_iwt_ofst[4] = ui_temp0;
 1253|    970|            pu4_iwt_ofst[1] = pu4_iwt_ofst[3] = pu4_iwt_ofst[5] = ui_temp1;
 1254|    970|            pu4_iwt_ofst += 6;
 1255|    970|        }
 1256|    733|    }
 1257|    387|    if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (1257:8): [True: 0, False: 387]
  ------------------
 1258|      0|    {
 1259|      0|        UWORD8 k;
 1260|      0|        WORD32 i4_cur_poc = ps_dec->ps_cur_pic->i4_top_field_order_cnt;
 1261|      0|        UWORD32* pu4_wt_mat = ps_dec->pu4_mbaff_wt_mat;
 1262|       |        /* Form the Implicit Weighted prediction matrix for field MBs also */
 1263|      0|        for(k = 0; k < 2; k++)
  ------------------
  |  Branch (1263:20): [True: 0, False: 0]
  ------------------
 1264|      0|        {
 1265|      0|            for(i = 0; i < (uc_num_ref_idx_l0_active << 1); i++)
  ------------------
  |  Branch (1265:24): [True: 0, False: 0]
  ------------------
 1266|      0|            {
 1267|      0|                UWORD16 u2_l0_idx;
 1268|       |
 1269|       |                /*u2_l0_idx = (i >= uc_num_ref_idx_l0_active)
 1270|       |                 ?(MAX_REF_BUFS + i - uc_num_ref_idx_l0_active) : (i) ;*/
 1271|       |
 1272|      0|                u2_l0_idx = i >> 1;
 1273|      0|                if((i & 0x01) != k)
  ------------------
  |  Branch (1273:20): [True: 0, False: 0]
  ------------------
 1274|      0|                {
 1275|      0|                    u2_l0_idx += MAX_REF_BUFS;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
 1276|      0|                }
 1277|      0|                ps_pic_buff0 = ps_dec->ps_ref_pic_buf_lx[0][u2_l0_idx];
 1278|      0|                i4_poc0 = ps_pic_buff0->i4_poc;
 1279|      0|                for(j = 0; j < (uc_num_ref_idx_l1_active << 1); j++)
  ------------------
  |  Branch (1279:28): [True: 0, False: 0]
  ------------------
 1280|      0|                {
 1281|      0|                    UWORD16 u2_l1_idx;
 1282|       |                    /*u2_l1_idx = (j >= uc_num_ref_idx_l1_active)
 1283|       |                     ? (MAX_REF_BUFS + j - uc_num_ref_idx_l1_active ) : (j) ;*/
 1284|       |
 1285|      0|                    u2_l1_idx = j >> 1;
 1286|      0|                    if((j & 0x01) != k)
  ------------------
  |  Branch (1286:24): [True: 0, False: 0]
  ------------------
 1287|      0|                    {
 1288|      0|                        u2_l1_idx += MAX_REF_BUFS;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
 1289|      0|                    }
 1290|      0|                    ps_pic_buff1 = ps_dec->ps_ref_pic_buf_lx[1][u2_l1_idx];
 1291|      0|                    i4_poc1 = ps_pic_buff1->i4_poc;
 1292|      0|                    if(i4_poc1 != i4_poc0)
  ------------------
  |  Branch (1292:24): [True: 0, False: 0]
  ------------------
 1293|      0|                    {
 1294|      0|                        i8_tb = (WORD64)i4_cur_poc - i4_poc0;
 1295|      0|                        i2_tb = CLIP_S8(i8_tb);
  ------------------
  |  |   59|      0|#define CLIP_S8(x) CLIP3(INT8_MIN, INT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|      0|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1296|      0|                        i8_td = (WORD64)i4_poc1 - i4_poc0;
 1297|      0|                        i2_td = CLIP_S8(i8_td);
  ------------------
  |  |   59|      0|#define CLIP_S8(x) CLIP3(INT8_MIN, INT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|      0|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1298|      0|                        i2_tx = (16384 + ABS(SIGN_POW2_DIV(i2_td, 1)))
  ------------------
  |  |  100|      0|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 0, False: 0]
  |  |  |  Branch (100:27): [True: 0, False: 0]
  |  |  |  Branch (100:39): [True: 0, False: 0]
  |  |  |  Branch (100:46): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1299|      0|                                        / i2_td;
 1300|      0|                        i2_dist_scale_factor = CLIP_S11(
  ------------------
  |  |   65|      0|#define CLIP_S11(x) CLIP3(-1024, 1023, (x))
  |  |  ------------------
  |  |  |  |   77|      0|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1301|      0|                                                    (((i2_tb * i2_tx) + 32) >> 6));
 1302|       |
 1303|      0|                        if(/*((u4_poc1 - u4_poc0) == 0) ||*/
 1304|      0|                        (!(ps_pic_buff1->u1_is_short && ps_pic_buff0->u1_is_short))
  ------------------
  |  Branch (1304:28): [True: 0, False: 0]
  |  Branch (1304:57): [True: 0, False: 0]
  ------------------
 1305|      0|                                        || ((i2_dist_scale_factor >> 2) < -64)
  ------------------
  |  Branch (1305:44): [True: 0, False: 0]
  ------------------
 1306|      0|                                        || ((i2_dist_scale_factor >> 2) > 128))
  ------------------
  |  Branch (1306:44): [True: 0, False: 0]
  ------------------
 1307|      0|                        {
 1308|       |                            /* same for forward and backward, wt=32 and Offset = 0 */
 1309|      0|                            ui_temp0 = 0x00000020;
 1310|      0|                            ui_temp1 = 0x00000020;
 1311|      0|                        }
 1312|      0|                        else
 1313|      0|                        {
 1314|      0|                            ui_temp0 = 64 - (i2_dist_scale_factor >> 2);
 1315|      0|                            ui_temp1 = (i2_dist_scale_factor >> 2);
 1316|      0|                        }
 1317|      0|                    }
 1318|      0|                    else
 1319|      0|                    {
 1320|      0|                        ui_temp0 = 0x00000020;
 1321|      0|                        ui_temp1 = 0x00000020;
 1322|      0|                    }
 1323|       |                    /* Store in the weight matrix */
 1324|      0|                    *pu4_wt_mat++ = ui_temp0;
 1325|      0|                    *pu4_wt_mat++ = ui_temp1;
 1326|      0|                    *pu4_wt_mat++ = ui_temp0;
 1327|      0|                    *pu4_wt_mat++ = ui_temp1;
 1328|      0|                    *pu4_wt_mat++ = ui_temp0;
 1329|      0|                    *pu4_wt_mat++ = ui_temp1;
 1330|       |
 1331|      0|                }
 1332|      0|            }
 1333|      0|            i4_cur_poc = ps_dec->ps_cur_pic->i4_bottom_field_order_cnt;
 1334|      0|        }
 1335|      0|    }
 1336|    387|}

ih264d_read_coeff4x4_cabac:
   69|   337k|{
   70|       |
   71|   337k|    decoding_envirnoment_t *ps_cab_env = &ps_dec->s_cab_dec_env;
   72|   337k|    UWORD32 u4_coded_flag;
   73|   337k|    UWORD32 u4_offset, *pu4_buffer;
   74|   337k|    UWORD32 u4_code_int_range, u4_code_int_val_ofst;
   75|   337k|    tu_sblk4x4_coeff_data_t *ps_tu_4x4;
   76|   337k|    WORD16 *pi2_coeff_data;
   77|   337k|    WORD32 num_sig_coeffs = 0;
   78|       |
   79|       |    /*loading from strcuctures*/
   80|       |
   81|   337k|    ps_tu_4x4 = (tu_sblk4x4_coeff_data_t *)ps_dec->pv_parse_tu_coeff_data;
   82|   337k|    ps_tu_4x4->u2_sig_coeff_map = 0;
   83|   337k|    pi2_coeff_data = &ps_tu_4x4->ai2_level[0];
   84|       |
   85|   337k|    u4_offset = ps_bitstrm->u4_ofst;
   86|   337k|    pu4_buffer = ps_bitstrm->pu4_buffer;
   87|       |
   88|   337k|    u4_code_int_range = ps_cab_env->u4_code_int_range;
   89|   337k|    u4_code_int_val_ofst = ps_cab_env->u4_code_int_val_ofst;
   90|       |
   91|   337k|    {
   92|       |
   93|       |        /*inilined DecodeDecision_onebin begins*/
   94|       |
   95|   337k|        {
   96|       |
   97|   337k|            UWORD32 u4_qnt_int_range, u4_int_range_lps;
   98|   337k|            UWORD32 u4_symbol, u1_mps_state;
   99|       |
  100|   337k|            UWORD32 table_lookup;
  101|   337k|            const UWORD32 *pu4_table = (const UWORD32 *)ps_cab_env->cabac_table;
  102|   337k|            UWORD32 u4_clz;
  103|       |
  104|   337k|            u1_mps_state = (ps_ctxt_coded->u1_mps_state);
  105|   337k|            u4_clz = CLZ(u4_code_int_range);
  106|   337k|            u4_qnt_int_range = u4_code_int_range << u4_clz;
  107|   337k|            u4_qnt_int_range = (u4_qnt_int_range >> 29) & 0x3;
  108|   337k|            table_lookup =
  109|   337k|                            pu4_table[(u1_mps_state << 2) + u4_qnt_int_range];
  110|   337k|            u4_int_range_lps = table_lookup & 0xff;
  111|   337k|            u4_int_range_lps = u4_int_range_lps << (23 - u4_clz);
  112|   337k|            u4_code_int_range = u4_code_int_range - u4_int_range_lps;
  113|   337k|            u4_symbol = ((u1_mps_state >> 6) & 0x1);
  114|   337k|            u1_mps_state = (table_lookup >> 8) & 0x7F;
  115|       |
  116|   337k|            CHECK_IF_LPS(u4_code_int_range, u4_code_int_val_ofst, u4_symbol,
  ------------------
  |  |  184|   337k|                    u4_codeIntRangeLPS_m,u1_mps_state_m,table_lookup_m)                     \
  |  |  185|   337k|{                                                                                         \
  |  |  186|   337k|  if(u4_codeIntValOffset_m >= u4_codeIntRange_m)                                            \
  |  |  ------------------
  |  |  |  Branch (186:6): [True: 49.6k, False: 288k]
  |  |  ------------------
  |  |  187|   337k|  {                                                                                         \
  |  |  188|  49.6k|      u4_symbol_m = 1 - u4_symbol_m;                                                        \
  |  |  189|  49.6k|      u4_codeIntValOffset_m -= u4_codeIntRange_m;                                           \
  |  |  190|  49.6k|      u4_codeIntRange_m = u4_codeIntRangeLPS_m;                                             \
  |  |  191|  49.6k|      u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                       \
  |  |  192|  49.6k|  }                                                                                         \
  |  |  193|   337k|}
  ------------------
  117|   337k|                         u4_int_range_lps, u1_mps_state, table_lookup)
  118|       |
  119|   337k|            if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_8)
  ------------------
  |  |  113|   337k|#define ONE_RIGHT_SHIFTED_BY_8 1<<8
  ------------------
  |  Branch (119:16): [True: 3.47k, False: 334k]
  ------------------
  120|  3.47k|            {
  121|       |
  122|  3.47k|                RENORM_RANGE_OFFSET(u4_code_int_range, u4_code_int_val_ofst,
  ------------------
  |  |  170|  3.47k|  {                                                                                         \
  |  |  171|  3.47k|    UWORD32 read_bits_m,u4_clz_m  ;                                                         \
  |  |  172|  3.47k|    u4_clz_m = CLZ(u4_codeIntRange_m);                                                  \
  |  |  173|  3.47k|    NEXTBITS(read_bits_m,(u4_offset_m+23),pu4_buffer_m,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|  3.47k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|  3.47k|{                                                                           \
  |  |  |  |  139|  3.47k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|  3.47k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|  3.47k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|  3.47k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|  3.47k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 3.40k, False: 77]
  |  |  |  |  ------------------
  |  |  |  |  144|  3.47k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  3.40k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|  3.47k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  3.47k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|  3.47k|}
  |  |  ------------------
  |  |  174|  3.47k|    FLUSHBITS(u4_offset_m,(u4_clz_m))                                                       \
  |  |  ------------------
  |  |  |  |  193|  3.47k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|  3.47k|{                                                                           \
  |  |  |  |  195|  3.47k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|  3.47k|}
  |  |  ------------------
  |  |  175|  3.47k|    u4_codeIntRange_m = u4_codeIntRange_m << u4_clz_m;                                      \
  |  |  176|  3.47k|    u4_codeIntValOffset_m = (u4_codeIntValOffset_m << u4_clz_m) | read_bits_m;              \
  |  |  177|  3.47k|  }
  ------------------
  123|  3.47k|                                    u4_offset, pu4_buffer)
  124|  3.47k|            }
  125|       |
  126|   337k|            ps_ctxt_coded->u1_mps_state = u1_mps_state;
  127|   337k|            u4_coded_flag = u4_symbol;
  128|       |
  129|       |            /*inilined DecodeDecision_onebin ends*/
  130|       |
  131|   337k|        }
  132|       |
  133|   337k|    }
  134|       |
  135|   337k|    if(u4_coded_flag)
  ------------------
  |  Branch (135:8): [True: 209k, False: 128k]
  ------------------
  136|   209k|    {
  137|       |
  138|   209k|        {
  139|   209k|            bin_ctxt_model_t *p_binCtxt_last, *p_binCtxt_last_org;
  140|   209k|            UWORD32 uc_last_coeff_idx;
  141|   209k|            UWORD32 uc_bin;
  142|   209k|            UWORD32 i;
  143|   209k|            WORD32 first_coeff_offset = 0;
  144|       |
  145|   209k|            if((u4_ctxcat == CHROMA_AC_CTXCAT) || (u4_ctxcat == LUMA_AC_CTXCAT))
  ------------------
  |  |   75|   209k|#define CHROMA_AC_CTXCAT  4
  ------------------
                          if((u4_ctxcat == CHROMA_AC_CTXCAT) || (u4_ctxcat == LUMA_AC_CTXCAT))
  ------------------
  |  |   72|   178k|#define LUMA_AC_CTXCAT    1
  ------------------
  |  Branch (145:16): [True: 31.1k, False: 178k]
  |  Branch (145:51): [True: 7.20k, False: 171k]
  ------------------
  146|  38.3k|            {
  147|  38.3k|                first_coeff_offset = 1;
  148|  38.3k|            }
  149|       |
  150|   209k|            i = 0;
  151|   209k|            if(u4_ctxcat == CHROMA_DC_CTXCAT)
  ------------------
  |  |   74|   209k|#define CHROMA_DC_CTXCAT  3
  ------------------
  |  Branch (151:16): [True: 37.4k, False: 172k]
  ------------------
  152|  37.4k|            {
  153|  37.4k|                uc_last_coeff_idx = 3;
  154|  37.4k|            }
  155|   172k|            else
  156|   172k|            {
  157|   172k|                UWORD32 u4_start;
  158|   172k|                u4_start = (u4_ctxcat & 1) + (u4_ctxcat >> 2);
  159|   172k|                uc_last_coeff_idx = 15 - u4_start;
  160|   172k|            }
  161|   209k|            p_binCtxt_last_org = ps_ctxt_sig_coeff
  162|   209k|                            + LAST_COEFF_CTXT_MINUS_SIG_COEFF_CTXT;
  ------------------
  |  |   84|   209k|#define LAST_COEFF_CTXT_MINUS_SIG_COEFF_CTXT 61
  ------------------
  163|       |
  164|   209k|            do
  165|  1.76M|            {
  166|       |
  167|       |                /*inilined DecodeDecision_onebin begins*/
  168|  1.76M|                {
  169|       |
  170|  1.76M|                    UWORD32 u4_qnt_int_range, u4_int_range_lps;
  171|  1.76M|                    UWORD32 u4_symbol, u1_mps_state;
  172|  1.76M|                    UWORD32 table_lookup;
  173|  1.76M|                    const UWORD32 *pu4_table =
  174|  1.76M|                                    (const UWORD32 *)ps_cab_env->cabac_table;
  175|  1.76M|                    UWORD32 u4_clz;
  176|       |
  177|  1.76M|                    u1_mps_state = (ps_ctxt_sig_coeff->u1_mps_state);
  178|       |
  179|  1.76M|                    u4_clz = CLZ(u4_code_int_range);
  180|       |
  181|  1.76M|                    u4_qnt_int_range = u4_code_int_range << u4_clz;
  182|  1.76M|                    u4_qnt_int_range = (u4_qnt_int_range >> 29) & 0x3;
  183|       |
  184|  1.76M|                    table_lookup = pu4_table[(u1_mps_state << 2)
  185|  1.76M|                                    + u4_qnt_int_range];
  186|       |
  187|  1.76M|                    u4_int_range_lps = table_lookup & 0xff;
  188|       |
  189|  1.76M|                    u4_int_range_lps = u4_int_range_lps << (23 - u4_clz);
  190|  1.76M|                    u4_code_int_range = u4_code_int_range - u4_int_range_lps;
  191|  1.76M|                    u4_symbol = ((u1_mps_state >> 6) & 0x1);
  192|  1.76M|                    u1_mps_state = (table_lookup >> 8) & 0x7F;
  193|       |
  194|  1.76M|                    CHECK_IF_LPS(u4_code_int_range, u4_code_int_val_ofst,
  ------------------
  |  |  184|  1.76M|                    u4_codeIntRangeLPS_m,u1_mps_state_m,table_lookup_m)                     \
  |  |  185|  1.76M|{                                                                                         \
  |  |  186|  1.76M|  if(u4_codeIntValOffset_m >= u4_codeIntRange_m)                                            \
  |  |  ------------------
  |  |  |  Branch (186:6): [True: 203k, False: 1.55M]
  |  |  ------------------
  |  |  187|  1.76M|  {                                                                                         \
  |  |  188|   203k|      u4_symbol_m = 1 - u4_symbol_m;                                                        \
  |  |  189|   203k|      u4_codeIntValOffset_m -= u4_codeIntRange_m;                                           \
  |  |  190|   203k|      u4_codeIntRange_m = u4_codeIntRangeLPS_m;                                             \
  |  |  191|   203k|      u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                       \
  |  |  192|   203k|  }                                                                                         \
  |  |  193|  1.76M|}
  ------------------
  195|  1.76M|                                 u4_symbol, u4_int_range_lps, u1_mps_state,
  196|  1.76M|                                 table_lookup)
  197|       |
  198|  1.76M|                    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_14)
  ------------------
  |  |  115|  1.76M|#define ONE_RIGHT_SHIFTED_BY_14 1<<14
  ------------------
  |  Branch (198:24): [True: 80.2k, False: 1.68M]
  ------------------
  199|  80.2k|                    {
  200|       |
  201|  80.2k|                        UWORD32 read_bits, u4_clz;
  202|  80.2k|                        u4_clz = CLZ(u4_code_int_range);
  203|  80.2k|                        NEXTBITS(read_bits, (u4_offset + 23), pu4_buffer,
  ------------------
  |  |  137|  80.2k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|  80.2k|{                                                                           \
  |  |  139|  80.2k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|  80.2k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|  80.2k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|  80.2k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|  80.2k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 77.7k, False: 2.49k]
  |  |  ------------------
  |  |  144|  80.2k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  77.7k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|  80.2k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  80.2k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|  80.2k|}
  ------------------
  204|  80.2k|                                 u4_clz)
  205|  80.2k|                        FLUSHBITS(u4_offset, (u4_clz))
  ------------------
  |  |  193|  80.2k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|  80.2k|{                                                                           \
  |  |  195|  80.2k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|  80.2k|}
  ------------------
  206|  80.2k|                        u4_code_int_range = u4_code_int_range << u4_clz;
  207|  80.2k|                        u4_code_int_val_ofst = (u4_code_int_val_ofst << u4_clz)
  208|  80.2k|                                        | read_bits;
  209|  80.2k|                    }
  210|       |
  211|  1.76M|                    INC_BIN_COUNT(
  212|  1.76M|                                    ps_cab_env)
  213|       |
  214|  1.76M|                    ps_ctxt_sig_coeff->u1_mps_state = u1_mps_state;
  215|  1.76M|                    uc_bin = u4_symbol;
  216|       |
  217|  1.76M|                }
  218|       |                /*incrementing pointer to point to the context of the next bin*/
  219|  1.76M|                ps_ctxt_sig_coeff++;
  220|       |
  221|       |                /*inilined DecodeDecision_onebin ends*/
  222|       |
  223|  1.76M|                if(uc_bin)
  ------------------
  |  Branch (223:20): [True: 801k, False: 958k]
  ------------------
  224|   801k|                {
  225|   801k|                    num_sig_coeffs++;
  226|   801k|                    SET_BIT(ps_tu_4x4->u2_sig_coeff_map, (i + first_coeff_offset));
  ------------------
  |  |  106|   801k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
  227|       |
  228|   801k|                    p_binCtxt_last = p_binCtxt_last_org + i;
  229|       |
  230|       |                    /*inilined DecodeDecision_onebin begins*/
  231|       |
  232|   801k|                    {
  233|       |
  234|   801k|                        UWORD32 u4_qnt_int_range, u4_int_range_lps;
  235|   801k|                        UWORD32 u4_symbol, u1_mps_state;
  236|   801k|                        UWORD32 table_lookup;
  237|   801k|                        const UWORD32 *pu4_table =
  238|   801k|                                        (const UWORD32 *)ps_cab_env->cabac_table;
  239|   801k|                        UWORD32 u4_clz;
  240|       |
  241|   801k|                        u1_mps_state = (p_binCtxt_last->u1_mps_state);
  242|       |
  243|   801k|                        u4_clz = CLZ(u4_code_int_range);
  244|   801k|                        u4_qnt_int_range = u4_code_int_range << u4_clz;
  245|   801k|                        u4_qnt_int_range = (u4_qnt_int_range >> 29)
  246|   801k|                                        & 0x3;
  247|       |
  248|   801k|                        table_lookup = pu4_table[(u1_mps_state << 2)
  249|   801k|                                        + u4_qnt_int_range];
  250|   801k|                        u4_int_range_lps = table_lookup & 0xff;
  251|       |
  252|   801k|                        u4_int_range_lps = u4_int_range_lps
  253|   801k|                                        << (23 - u4_clz);
  254|       |
  255|   801k|                        u4_code_int_range = u4_code_int_range
  256|   801k|                                        - u4_int_range_lps;
  257|   801k|                        u4_symbol = ((u1_mps_state >> 6) & 0x1);
  258|   801k|                        u1_mps_state = (table_lookup >> 8) & 0x7F;
  259|       |
  260|   801k|                        CHECK_IF_LPS(u4_code_int_range, u4_code_int_val_ofst,
  ------------------
  |  |  184|   801k|                    u4_codeIntRangeLPS_m,u1_mps_state_m,table_lookup_m)                     \
  |  |  185|   801k|{                                                                                         \
  |  |  186|   801k|  if(u4_codeIntValOffset_m >= u4_codeIntRange_m)                                            \
  |  |  ------------------
  |  |  |  Branch (186:6): [True: 69.6k, False: 732k]
  |  |  ------------------
  |  |  187|   801k|  {                                                                                         \
  |  |  188|  69.6k|      u4_symbol_m = 1 - u4_symbol_m;                                                        \
  |  |  189|  69.6k|      u4_codeIntValOffset_m -= u4_codeIntRange_m;                                           \
  |  |  190|  69.6k|      u4_codeIntRange_m = u4_codeIntRangeLPS_m;                                             \
  |  |  191|  69.6k|      u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                       \
  |  |  192|  69.6k|  }                                                                                         \
  |  |  193|   801k|}
  ------------------
  261|   801k|                                     u4_symbol, u4_int_range_lps,
  262|   801k|                                     u1_mps_state, table_lookup)
  263|       |
  264|   801k|                        INC_BIN_COUNT(ps_cab_env)
  265|       |
  266|   801k|                        p_binCtxt_last->u1_mps_state = u1_mps_state;
  267|   801k|                        uc_bin = u4_symbol;
  268|       |
  269|   801k|                    }
  270|       |
  271|       |                    /*inilined DecodeDecision_onebin ends*/
  272|   801k|                    if(uc_bin == 1)
  ------------------
  |  Branch (272:24): [True: 202k, False: 599k]
  ------------------
  273|   202k|                        goto label_read_levels;
  274|       |
  275|   801k|                }
  276|       |
  277|  1.55M|                i = i + 1;
  278|       |
  279|  1.55M|            }
  280|  1.55M|            while(i < uc_last_coeff_idx);
  ------------------
  |  Branch (280:19): [True: 1.55M, False: 7.21k]
  ------------------
  281|       |
  282|  7.21k|            num_sig_coeffs++;
  283|  7.21k|            SET_BIT(ps_tu_4x4->u2_sig_coeff_map, (i + first_coeff_offset));
  ------------------
  |  |  106|  7.21k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
  284|       |
  285|   209k|            label_read_levels: ;
  286|       |
  287|   209k|        }
  288|       |
  289|       |        /// VALUE of No of Coeff in BLOCK = i + 1 for second case else i;
  290|       |
  291|       |        /* Decode coeff_abs_level_minus1 and coeff_sign_flag */
  292|      0|        {
  293|       |
  294|   209k|            WORD32 i2_abs_lvl;
  295|   209k|            UWORD32 u1_abs_level_equal1 = 1, u1_abs_level_gt1 = 0;
  296|       |
  297|   209k|            UWORD32 u4_ctx_inc;
  298|   209k|            UWORD32 ui_prefix;
  299|   209k|        bin_ctxt_model_t *p_ctxt_abs_level;
  300|       |
  301|       |
  302|   209k|        p_ctxt_abs_level = ps_dec->p_coeff_abs_level_minus1_t[u4_ctxcat];
  303|   209k|        u4_ctx_inc = ((0x51));
  304|       |
  305|       |        /*****************************************************/
  306|       |        /* Main Loop runs for no. of Significant coefficient */
  307|       |        /*****************************************************/
  308|       |
  309|       |
  310|   209k|        do
  311|   808k|            {
  312|       |
  313|   808k|                {
  314|   808k|                    INC_SYM_COUNT(&(ps_dec.s_cab_dec_env));
  315|       |
  316|       |                    /*****************************************************/
  317|       |                    /* inilining a modified ih264d_decode_bins_unary     */
  318|       |                    /*****************************************************/
  319|       |
  320|   808k|                    {
  321|   808k|                        UWORD32 u4_value;
  322|   808k|                        UWORD32 u4_symbol;
  323|   808k|                        bin_ctxt_model_t *ps_bin_ctxt;
  324|   808k|                        UWORD32 u4_ctx_Inc;
  325|       |
  326|   808k|                        u4_value = 0;
  327|       |
  328|   808k|                        u4_ctx_Inc = u4_ctx_inc & 0xf;
  329|   808k|                        ps_bin_ctxt = p_ctxt_abs_level + u4_ctx_Inc;
  330|       |
  331|   808k|                        do
  332|  1.04M|                        {
  333|       |
  334|  1.04M|                            {
  335|       |
  336|  1.04M|                                UWORD32 u4_qnt_int_range,
  337|  1.04M|                                                u4_int_range_lps;
  338|  1.04M|                                UWORD32 u1_mps_state;
  339|  1.04M|                                UWORD32 table_lookup;
  340|  1.04M|                                const UWORD32 *pu4_table =
  341|  1.04M|                                                (const UWORD32 *)ps_cab_env->cabac_table;
  342|  1.04M|                                UWORD32 u4_clz;
  343|       |
  344|  1.04M|                                u1_mps_state = (ps_bin_ctxt->u1_mps_state);
  345|  1.04M|                                u4_clz = CLZ(u4_code_int_range);
  346|  1.04M|                                u4_qnt_int_range = u4_code_int_range
  347|  1.04M|                                                << u4_clz;
  348|  1.04M|                                u4_qnt_int_range = (u4_qnt_int_range
  349|  1.04M|                                                >> 29) & 0x3;
  350|  1.04M|                                table_lookup = pu4_table[(u1_mps_state << 2)
  351|  1.04M|                                                + u4_qnt_int_range];
  352|  1.04M|                                u4_int_range_lps = table_lookup & 0xff;
  353|       |
  354|  1.04M|                                u4_int_range_lps = u4_int_range_lps
  355|  1.04M|                                                << (23 - u4_clz);
  356|  1.04M|                                u4_code_int_range = u4_code_int_range
  357|  1.04M|                                                - u4_int_range_lps;
  358|  1.04M|                                u4_symbol = ((u1_mps_state >> 6) & 0x1);
  359|  1.04M|                                u1_mps_state = (table_lookup >> 8) & 0x7F;
  360|       |
  361|  1.04M|                                CHECK_IF_LPS(u4_code_int_range,
  ------------------
  |  |  184|  1.04M|                    u4_codeIntRangeLPS_m,u1_mps_state_m,table_lookup_m)                     \
  |  |  185|  1.04M|{                                                                                         \
  |  |  186|  1.04M|  if(u4_codeIntValOffset_m >= u4_codeIntRange_m)                                            \
  |  |  ------------------
  |  |  |  Branch (186:6): [True: 122k, False: 921k]
  |  |  ------------------
  |  |  187|  1.04M|  {                                                                                         \
  |  |  188|   122k|      u4_symbol_m = 1 - u4_symbol_m;                                                        \
  |  |  189|   122k|      u4_codeIntValOffset_m -= u4_codeIntRange_m;                                           \
  |  |  190|   122k|      u4_codeIntRange_m = u4_codeIntRangeLPS_m;                                             \
  |  |  191|   122k|      u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                       \
  |  |  192|   122k|  }                                                                                         \
  |  |  193|  1.04M|}
  ------------------
  362|  1.04M|                                             u4_code_int_val_ofst, u4_symbol,
  363|  1.04M|                                             u4_int_range_lps, u1_mps_state,
  364|  1.04M|                                             table_lookup)
  365|       |
  366|  1.04M|                                if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_9)
  ------------------
  |  |  114|  1.04M|#define ONE_RIGHT_SHIFTED_BY_9    1<<9
  ------------------
  |  Branch (366:36): [True: 23.7k, False: 1.02M]
  ------------------
  367|  23.7k|                                {
  368|       |
  369|  23.7k|                                    RENORM_RANGE_OFFSET(u4_code_int_range,
  ------------------
  |  |  170|  23.7k|  {                                                                                         \
  |  |  171|  23.7k|    UWORD32 read_bits_m,u4_clz_m  ;                                                         \
  |  |  172|  23.7k|    u4_clz_m = CLZ(u4_codeIntRange_m);                                                  \
  |  |  173|  23.7k|    NEXTBITS(read_bits_m,(u4_offset_m+23),pu4_buffer_m,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|  23.7k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|  23.7k|{                                                                           \
  |  |  |  |  139|  23.7k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|  23.7k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|  23.7k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|  23.7k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|  23.7k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 22.9k, False: 753]
  |  |  |  |  ------------------
  |  |  |  |  144|  23.7k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  22.9k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|  23.7k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  23.7k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|  23.7k|}
  |  |  ------------------
  |  |  174|  23.7k|    FLUSHBITS(u4_offset_m,(u4_clz_m))                                                       \
  |  |  ------------------
  |  |  |  |  193|  23.7k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|  23.7k|{                                                                           \
  |  |  |  |  195|  23.7k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|  23.7k|}
  |  |  ------------------
  |  |  175|  23.7k|    u4_codeIntRange_m = u4_codeIntRange_m << u4_clz_m;                                      \
  |  |  176|  23.7k|    u4_codeIntValOffset_m = (u4_codeIntValOffset_m << u4_clz_m) | read_bits_m;              \
  |  |  177|  23.7k|  }
  ------------------
  370|  23.7k|                                                        u4_code_int_val_ofst,
  371|  23.7k|                                                        u4_offset, pu4_buffer)
  372|  23.7k|                                }
  373|       |
  374|  1.04M|                                INC_BIN_COUNT(ps_cab_env);
  375|       |
  376|  1.04M|                                ps_bin_ctxt->u1_mps_state = u1_mps_state;
  377|  1.04M|                            }
  378|       |
  379|  1.04M|                            INC_BIN_COUNT(ps_cab_env);INC_DECISION_BINS(ps_cab_env);
  380|       |
  381|  1.04M|                            u4_value++;
  382|  1.04M|                            ps_bin_ctxt = p_ctxt_abs_level + (u4_ctx_inc >> 4);
  383|       |
  384|  1.04M|                        }
  385|  1.04M|                        while(u4_symbol && (u4_value < UCOFF_LEVEL));
  ------------------
  |  |   41|   240k|#define UCOFF_LEVEL  14
  ------------------
  |  Branch (385:31): [True: 240k, False: 803k]
  |  Branch (385:44): [True: 235k, False: 5.39k]
  ------------------
  386|       |
  387|   808k|                        ui_prefix = u4_value - 1 + u4_symbol;
  388|       |
  389|   808k|                    }
  390|       |
  391|   808k|                    if(ui_prefix == UCOFF_LEVEL)
  ------------------
  |  |   41|   808k|#define UCOFF_LEVEL  14
  ------------------
  |  Branch (391:24): [True: 5.39k, False: 803k]
  ------------------
  392|  5.39k|                    {
  393|  5.39k|                        UWORD32 ui16_sufS = 0;
  394|  5.39k|                        UWORD32 u1_max_bins;
  395|  5.39k|                        UWORD32 u4_value;
  396|       |
  397|  5.39k|                        i2_abs_lvl = UCOFF_LEVEL;
  ------------------
  |  |   41|  5.39k|#define UCOFF_LEVEL  14
  ------------------
  398|       |                        /*inlining ih264d_decode_bypass_bins_unary begins*/
  399|       |
  400|  5.39k|                        {
  401|  5.39k|                            UWORD32 uc_bin;
  402|  5.39k|                            UWORD32 bits_to_flush;
  403|       |
  404|       |
  405|  5.39k|                            bits_to_flush = 0;
  406|       |                            /*renormalize to ensure there 23 bits more in the u4_code_int_val_ofst*/
  407|  5.39k|                            {
  408|  5.39k|                                UWORD32 u4_clz, read_bits;
  409|       |
  410|  5.39k|                                u4_clz = CLZ(u4_code_int_range);
  411|  5.39k|                                FLUSHBITS(u4_offset, u4_clz)
  ------------------
  |  |  193|  5.39k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|  5.39k|{                                                                           \
  |  |  195|  5.39k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|  5.39k|}
  ------------------
  412|  5.39k|                                NEXTBITS(read_bits, u4_offset, pu4_buffer, CABAC_BITS_TO_READ)
  ------------------
  |  |  137|  5.39k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|  5.39k|{                                                                           \
  |  |  139|  5.39k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|  5.39k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|  5.39k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|  5.39k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|  5.39k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 5.22k, False: 164]
  |  |  ------------------
  |  |  144|  5.39k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  5.22k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|  5.39k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  5.39k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|  5.39k|}
  ------------------
  413|  5.39k|                                u4_code_int_range = u4_code_int_range << u4_clz;
  414|  5.39k|                                u4_code_int_val_ofst = (u4_code_int_val_ofst
  415|  5.39k|                                                << u4_clz) | read_bits;
  416|       |
  417|  5.39k|                            }
  418|       |
  419|  5.39k|                            do
  420|  10.4k|                            {
  421|  10.4k|                                bits_to_flush++;
  422|       |
  423|  10.4k|                                u4_code_int_range = u4_code_int_range >> 1;
  424|       |
  425|  10.4k|                                if(u4_code_int_val_ofst >= u4_code_int_range)
  ------------------
  |  Branch (425:36): [True: 5.06k, False: 5.39k]
  ------------------
  426|  5.06k|                                {
  427|       |                                    /* S=1 */
  428|  5.06k|                                    uc_bin = 1;
  429|  5.06k|                                    u4_code_int_val_ofst -= u4_code_int_range;
  430|  5.06k|                                }
  431|  5.39k|                                else
  432|  5.39k|                                {
  433|       |                                    /* S=0 */
  434|  5.39k|                                    uc_bin = 0;
  435|  5.39k|                                }
  436|       |
  437|  10.4k|                                INC_BIN_COUNT(
  438|  10.4k|                                                ps_cab_env);INC_BYPASS_BINS(ps_cab_env);
  439|       |
  440|  10.4k|                            }
  441|  10.4k|                            while(uc_bin && (bits_to_flush < CABAC_BITS_TO_READ));
  ------------------
  |  |  618|  5.06k|#define CABAC_BITS_TO_READ 23
  ------------------
  |  Branch (441:35): [True: 5.06k, False: 5.39k]
  |  Branch (441:45): [True: 5.05k, False: 1]
  ------------------
  442|       |
  443|  5.39k|                            u4_value = (bits_to_flush - 1);
  444|       |
  445|  5.39k|                        }
  446|       |                        /*inlining ih264d_decode_bypass_bins_unary ends*/
  447|       |
  448|  5.39k|                        ui16_sufS = (1 << u4_value);
  449|  5.39k|                        u1_max_bins = u4_value;
  450|       |
  451|  5.39k|                        if(u4_value > 0)
  ------------------
  |  Branch (451:28): [True: 2.73k, False: 2.65k]
  ------------------
  452|  2.73k|                        {
  453|       |
  454|       |                            /*inline bypassbins_flc begins*/
  455|       |
  456|  2.73k|                            if(u4_value > 10)
  ------------------
  |  Branch (456:32): [True: 7, False: 2.73k]
  ------------------
  457|      7|                            {
  458|      7|                                UWORD32 u4_clz, read_bits;
  459|       |
  460|      7|                                u4_clz = CLZ(u4_code_int_range);
  461|      7|                                FLUSHBITS(u4_offset, u4_clz)
  ------------------
  |  |  193|      7|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|      7|{                                                                           \
  |  |  195|      7|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|      7|}
  ------------------
  462|      7|                                NEXTBITS(read_bits, u4_offset, pu4_buffer, CABAC_BITS_TO_READ)
  ------------------
  |  |  137|      7|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|      7|{                                                                           \
  |  |  139|      7|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|      7|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|      7|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|      7|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|      7|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 7, False: 0]
  |  |  ------------------
  |  |  144|      7|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|      7|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|      7|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|      7|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|      7|}
  ------------------
  463|      7|                                u4_code_int_range = u4_code_int_range << u4_clz;
  464|      7|                                u4_code_int_val_ofst = (u4_code_int_val_ofst
  465|      7|                                                << u4_clz) | read_bits;
  466|      7|                            }
  467|       |
  468|  2.73k|                            {
  469|  2.73k|                                UWORD32 ui_bins;
  470|  2.73k|                                UWORD32 uc_bin;
  471|  2.73k|                                UWORD32 bits_to_flush;
  472|       |
  473|  2.73k|                                ui_bins = 0;
  474|  2.73k|                                bits_to_flush = 0;
  475|       |
  476|  2.73k|                                do
  477|  5.05k|                                {
  478|  5.05k|                                    bits_to_flush++;
  479|       |
  480|  5.05k|                                    u4_code_int_range = u4_code_int_range >> 1;
  481|       |
  482|  5.05k|                                    if(u4_code_int_val_ofst
  ------------------
  |  Branch (482:40): [True: 2.67k, False: 2.38k]
  ------------------
  483|  5.05k|                                                    >= u4_code_int_range)
  484|  2.67k|                                    {
  485|       |                                        /* S=1 */
  486|  2.67k|                                        uc_bin = 1;
  487|  2.67k|                                        u4_code_int_val_ofst -=
  488|  2.67k|                                                        u4_code_int_range;
  489|  2.67k|                                    }
  490|  2.38k|                                    else
  491|  2.38k|                                    {
  492|       |                                        /* S=0 */
  493|  2.38k|                                        uc_bin = 0;
  494|  2.38k|                                    }
  495|       |
  496|  5.05k|                                    INC_BIN_COUNT(
  497|  5.05k|                                                    ps_cab_env);INC_BYPASS_BINS(ps_cab_env);
  498|       |
  499|  5.05k|                                    ui_bins = ((ui_bins << 1) | uc_bin);
  500|       |
  501|  5.05k|                                }
  502|  5.05k|                                while(bits_to_flush < u1_max_bins);
  ------------------
  |  Branch (502:39): [True: 2.32k, False: 2.73k]
  ------------------
  503|       |
  504|  2.73k|                                u4_value = ui_bins;
  505|  2.73k|                            }
  506|       |
  507|       |                            /*inline bypassbins_flc ends*/
  508|       |
  509|  2.73k|                        }
  510|       |
  511|       |                        //Value of K
  512|  5.39k|                        ui16_sufS += u4_value;
  513|  5.39k|                        i2_abs_lvl += ui16_sufS;
  514|       |
  515|  5.39k|                    }
  516|   803k|                    else
  517|   803k|                        i2_abs_lvl = 1 + ui_prefix;
  518|       |
  519|   808k|                    if(i2_abs_lvl > 1)
  ------------------
  |  Branch (519:24): [True: 88.0k, False: 720k]
  ------------------
  520|  88.0k|                    {
  521|  88.0k|                        u1_abs_level_gt1++;
  522|  88.0k|                    }
  523|   808k|                    if(!u1_abs_level_gt1)
  ------------------
  |  Branch (523:24): [True: 689k, False: 119k]
  ------------------
  524|   689k|                    {
  525|   689k|                        u1_abs_level_equal1++;
  526|   689k|                        u4_ctx_inc = (5 << 4) + MIN(u1_abs_level_equal1, 4);
  ------------------
  |  |   61|   689k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 320k, False: 369k]
  |  |  ------------------
  ------------------
  527|   689k|                    }
  528|   119k|                    else
  529|   119k|                        u4_ctx_inc = (5 + MIN(u1_abs_level_gt1, 4)) << 4;
  ------------------
  |  |   61|   119k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 108k, False: 10.5k]
  |  |  ------------------
  ------------------
  530|       |
  531|       |                    /*u4_ctx_inc = g_table_temp[u1_abs_level_gt1][u1_abs_level_equal1];*/
  532|       |
  533|       |                    /* encode coeff_sign_flag[i] */
  534|       |
  535|   808k|                    {
  536|   808k|                        u4_code_int_range = u4_code_int_range >> 1;
  537|       |
  538|   808k|                        if(u4_code_int_val_ofst >= (u4_code_int_range))
  ------------------
  |  Branch (538:28): [True: 189k, False: 619k]
  ------------------
  539|   189k|                        {
  540|       |                            /* S=1 */
  541|   189k|                            u4_code_int_val_ofst -= u4_code_int_range;
  542|   189k|                            i2_abs_lvl = (-i2_abs_lvl);
  543|   189k|                        }
  544|       |
  545|   808k|                    }
  546|   808k|                    num_sig_coeffs--;
  547|   808k|                    *pi2_coeff_data++ = i2_abs_lvl;
  548|   808k|                }
  549|   808k|            }
  550|   808k|            while(num_sig_coeffs > 0);
  ------------------
  |  Branch (550:19): [True: 599k, False: 209k]
  ------------------
  551|   209k|        }
  552|   209k|    }
  553|       |
  554|   337k|    if(u4_coded_flag)
  ------------------
  |  Branch (554:8): [True: 209k, False: 128k]
  ------------------
  555|   209k|    {
  556|   209k|        WORD32 offset;
  557|   209k|        offset = (UWORD8 *)pi2_coeff_data - (UWORD8 *)ps_tu_4x4;
  558|   209k|        offset = ALIGN4(offset);
  ------------------
  |  |   52|   209k|#define ALIGN4(x)   ((((x) + 3) >> 2) << 2)
  ------------------
  559|   209k|        ps_dec->pv_parse_tu_coeff_data = (void *)((UWORD8 *)ps_dec->pv_parse_tu_coeff_data + offset);
  560|   209k|    }
  561|       |
  562|       |
  563|       |    /*updating structures*/
  564|   337k|    ps_cab_env->u4_code_int_val_ofst = u4_code_int_val_ofst;
  565|   337k|    ps_cab_env->u4_code_int_range = u4_code_int_range;
  566|   337k|    ps_bitstrm->u4_ofst = u4_offset;
  567|   337k|    return (u4_coded_flag);
  568|   337k|}
ih264d_read_coeff8x8_cabac:
  585|  90.5k|{
  586|  90.5k|    decoding_envirnoment_t *ps_cab_env = &ps_dec->s_cab_dec_env;
  587|  90.5k|    UWORD32 u4_offset, *pu4_buffer;
  588|  90.5k|    UWORD32 u4_code_int_range, u4_code_int_val_ofst;
  589|       |
  590|       |    /* High profile related declarations */
  591|  90.5k|    UWORD8 u1_field_coding_flag = ps_cur_mb_info->ps_curmb->u1_mb_fld;
  592|  90.5k|    const UWORD8 *pu1_lastcoeff_context_inc =
  593|  90.5k|                    (UWORD8 *)gau1_ih264d_lastcoeff_context_inc;
  594|  90.5k|    const UWORD8 *pu1_sigcoeff_context_inc;
  595|  90.5k|    bin_ctxt_model_t *ps_ctxt_sig_coeff;
  596|  90.5k|    WORD32 num_sig_coeffs = 0;
  597|  90.5k|    tu_blk8x8_coeff_data_t *ps_tu_8x8;
  598|  90.5k|    WORD16 *pi2_coeff_data;
  599|       |
  600|       |    /*loading from strcuctures*/
  601|       |
  602|  90.5k|    ps_tu_8x8 = (tu_blk8x8_coeff_data_t *)ps_dec->pv_parse_tu_coeff_data;
  603|  90.5k|    ps_tu_8x8->au4_sig_coeff_map[0] = 0;
  604|  90.5k|    ps_tu_8x8->au4_sig_coeff_map[1] = 0;
  605|  90.5k|    pi2_coeff_data = &ps_tu_8x8->ai2_level[0];
  606|       |
  607|       |
  608|  90.5k|    if(!u1_field_coding_flag)
  ------------------
  |  Branch (608:8): [True: 90.5k, False: 0]
  ------------------
  609|  90.5k|    {
  610|  90.5k|        pu1_sigcoeff_context_inc =
  611|  90.5k|                        (UWORD8 *)gau1_ih264d_sigcoeff_context_inc_frame;
  612|       |
  613|       |        /*******************************************************************/
  614|       |        /* last coefficient context is derived from significant coeff u4_flag */
  615|       |        /* only significant coefficient matrix need to be initialized      */
  616|       |        /*******************************************************************/
  617|  90.5k|        ps_ctxt_sig_coeff = ps_dec->s_high_profile.ps_sigcoeff_8x8_frame;
  618|  90.5k|    }
  619|      0|    else
  620|      0|    {
  621|      0|        pu1_sigcoeff_context_inc =
  622|      0|                        (UWORD8 *)gau1_ih264d_sigcoeff_context_inc_field;
  623|       |
  624|       |        /*******************************************************************/
  625|       |        /* last coefficient context is derived from significant coeff u4_flag */
  626|       |        /* only significant coefficient matrix need to be initialized      */
  627|       |        /*******************************************************************/
  628|      0|        ps_ctxt_sig_coeff = ps_dec->s_high_profile.ps_sigcoeff_8x8_field;
  629|      0|    }
  630|       |
  631|       |    /*loading from strcuctures*/
  632|       |
  633|  90.5k|    u4_offset = ps_bitstrm->u4_ofst;
  634|  90.5k|    pu4_buffer = ps_bitstrm->pu4_buffer;
  635|       |
  636|  90.5k|    u4_code_int_range = ps_cab_env->u4_code_int_range;
  637|  90.5k|    u4_code_int_val_ofst = ps_cab_env->u4_code_int_val_ofst;
  638|       |
  639|  90.5k|    {
  640|  90.5k|        {
  641|  90.5k|            bin_ctxt_model_t *p_binCtxt_last, *p_binCtxt_last_org,
  642|  90.5k|                            *p_ctxt_sig_coeff_org;
  643|  90.5k|            UWORD32 uc_last_coeff_idx;
  644|  90.5k|            UWORD32 uc_bin;
  645|  90.5k|            UWORD32 i;
  646|       |
  647|  90.5k|            i = 0;
  648|       |
  649|  90.5k|            uc_last_coeff_idx = 63;
  650|       |
  651|  90.5k|            p_binCtxt_last_org = ps_ctxt_sig_coeff
  652|  90.5k|                            + LAST_COEFF_CTXT_MINUS_SIG_COEFF_CTXT_8X8;
  ------------------
  |  |   85|  90.5k|#define LAST_COEFF_CTXT_MINUS_SIG_COEFF_CTXT_8X8 15
  ------------------
  653|       |
  654|  90.5k|            p_ctxt_sig_coeff_org = ps_ctxt_sig_coeff;
  655|       |
  656|  90.5k|            do
  657|  4.12M|            {
  658|       |                /*inilined DecodeDecision_onebin begins*/
  659|  4.12M|                {
  660|  4.12M|                    UWORD32 u4_qnt_int_range, u4_int_range_lps;
  661|  4.12M|                    UWORD32 u4_symbol, u1_mps_state;
  662|  4.12M|                    UWORD32 table_lookup;
  663|  4.12M|                    const UWORD32 *pu4_table =
  664|  4.12M|                                    (const UWORD32 *)ps_cab_env->cabac_table;
  665|  4.12M|                    UWORD32 u4_clz;
  666|       |
  667|  4.12M|                    u1_mps_state = (ps_ctxt_sig_coeff->u1_mps_state);
  668|       |
  669|  4.12M|                    u4_clz = CLZ(u4_code_int_range);
  670|       |
  671|  4.12M|                    u4_qnt_int_range = u4_code_int_range << u4_clz;
  672|  4.12M|                    u4_qnt_int_range = (u4_qnt_int_range >> 29) & 0x3;
  673|       |
  674|  4.12M|                    table_lookup = pu4_table[(u1_mps_state << 2)
  675|  4.12M|                                    + u4_qnt_int_range];
  676|       |
  677|  4.12M|                    u4_int_range_lps = table_lookup & 0xff;
  678|       |
  679|  4.12M|                    u4_int_range_lps = u4_int_range_lps << (23 - u4_clz);
  680|  4.12M|                    u4_code_int_range = u4_code_int_range - u4_int_range_lps;
  681|  4.12M|                    u4_symbol = ((u1_mps_state >> 6) & 0x1);
  682|  4.12M|                    u1_mps_state = (table_lookup >> 8) & 0x7F;
  683|       |
  684|  4.12M|                    CHECK_IF_LPS(u4_code_int_range, u4_code_int_val_ofst,
  ------------------
  |  |  184|  4.12M|                    u4_codeIntRangeLPS_m,u1_mps_state_m,table_lookup_m)                     \
  |  |  185|  4.12M|{                                                                                         \
  |  |  186|  4.12M|  if(u4_codeIntValOffset_m >= u4_codeIntRange_m)                                            \
  |  |  ------------------
  |  |  |  Branch (186:6): [True: 125k, False: 4.00M]
  |  |  ------------------
  |  |  187|  4.12M|  {                                                                                         \
  |  |  188|   125k|      u4_symbol_m = 1 - u4_symbol_m;                                                        \
  |  |  189|   125k|      u4_codeIntValOffset_m -= u4_codeIntRange_m;                                           \
  |  |  190|   125k|      u4_codeIntRange_m = u4_codeIntRangeLPS_m;                                             \
  |  |  191|   125k|      u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                       \
  |  |  192|   125k|  }                                                                                         \
  |  |  193|  4.12M|}
  ------------------
  685|  4.12M|                                 u4_symbol, u4_int_range_lps, u1_mps_state,
  686|  4.12M|                                 table_lookup)
  687|       |
  688|  4.12M|                    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_14)
  ------------------
  |  |  115|  4.12M|#define ONE_RIGHT_SHIFTED_BY_14 1<<14
  ------------------
  |  Branch (688:24): [True: 35.1k, False: 4.09M]
  ------------------
  689|  35.1k|                    {
  690|  35.1k|                        UWORD32 read_bits, u4_clz;
  691|  35.1k|                        u4_clz = CLZ(u4_code_int_range);
  692|  35.1k|                        NEXTBITS(read_bits, (u4_offset + 23), pu4_buffer,
  ------------------
  |  |  137|  35.1k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|  35.1k|{                                                                           \
  |  |  139|  35.1k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|  35.1k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|  35.1k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|  35.1k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|  35.1k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 34.0k, False: 1.10k]
  |  |  ------------------
  |  |  144|  35.1k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  34.0k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|  35.1k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  35.1k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|  35.1k|}
  ------------------
  693|  35.1k|                                 u4_clz)
  694|  35.1k|                        FLUSHBITS(u4_offset, (u4_clz))
  ------------------
  |  |  193|  35.1k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|  35.1k|{                                                                           \
  |  |  195|  35.1k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|  35.1k|}
  ------------------
  695|  35.1k|                        u4_code_int_range = u4_code_int_range << u4_clz;
  696|  35.1k|                        u4_code_int_val_ofst = (u4_code_int_val_ofst << u4_clz)
  697|  35.1k|                                        | read_bits;
  698|  35.1k|                    }
  699|       |
  700|  4.12M|                    ps_ctxt_sig_coeff->u1_mps_state = u1_mps_state;
  701|  4.12M|                    uc_bin = u4_symbol;
  702|  4.12M|                }
  703|       |                /*incrementing pointer to point to the context of the next bin*/
  704|  4.12M|                ps_ctxt_sig_coeff = p_ctxt_sig_coeff_org
  705|  4.12M|                                + pu1_sigcoeff_context_inc[i + 1];
  706|       |
  707|       |                /*inilined DecodeDecision_onebin ends*/
  708|  4.12M|                if(uc_bin)
  ------------------
  |  Branch (708:20): [True: 294k, False: 3.83M]
  ------------------
  709|   294k|                {
  710|   294k|                    num_sig_coeffs++;
  711|   294k|                    SET_BIT(ps_tu_8x8->au4_sig_coeff_map[i>31], (i > 31 ? i - 32:i));
  ------------------
  |  |  106|   589k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  |  |  ------------------
  |  |  |  Branch (106:43): [True: 27.0k, False: 267k]
  |  |  ------------------
  ------------------
  712|       |
  713|   294k|                    p_binCtxt_last = p_binCtxt_last_org
  714|   294k|                                    + pu1_lastcoeff_context_inc[i];
  715|       |
  716|       |                    /*inilined DecodeDecision_onebin begins*/
  717|       |
  718|   294k|                    {
  719|   294k|                        UWORD32 u4_qnt_int_range, u4_int_range_lps;
  720|   294k|                        UWORD32 u4_symbol, u1_mps_state;
  721|   294k|                        UWORD32 table_lookup;
  722|   294k|                        const UWORD32 *pu4_table =
  723|   294k|                                        (const UWORD32 *)ps_cab_env->cabac_table;
  724|   294k|                        UWORD32 u4_clz;
  725|       |
  726|   294k|                        u1_mps_state = (p_binCtxt_last->u1_mps_state);
  727|       |
  728|   294k|                        u4_clz = CLZ(u4_code_int_range);
  729|   294k|                        u4_qnt_int_range = u4_code_int_range << u4_clz;
  730|   294k|                        u4_qnt_int_range = (u4_qnt_int_range >> 29)
  731|   294k|                                        & 0x3;
  732|       |
  733|   294k|                        table_lookup = pu4_table[(u1_mps_state << 2)
  734|   294k|                                        + u4_qnt_int_range];
  735|   294k|                        u4_int_range_lps = table_lookup & 0xff;
  736|       |
  737|   294k|                        u4_int_range_lps = u4_int_range_lps
  738|   294k|                                        << (23 - u4_clz);
  739|       |
  740|   294k|                        u4_code_int_range = u4_code_int_range
  741|   294k|                                        - u4_int_range_lps;
  742|   294k|                        u4_symbol = ((u1_mps_state >> 6) & 0x1);
  743|   294k|                        u1_mps_state = (table_lookup >> 8) & 0x7F;
  744|       |
  745|   294k|                        CHECK_IF_LPS(u4_code_int_range, u4_code_int_val_ofst,
  ------------------
  |  |  184|   294k|                    u4_codeIntRangeLPS_m,u1_mps_state_m,table_lookup_m)                     \
  |  |  185|   294k|{                                                                                         \
  |  |  186|   294k|  if(u4_codeIntValOffset_m >= u4_codeIntRange_m)                                            \
  |  |  ------------------
  |  |  |  Branch (186:6): [True: 30.2k, False: 264k]
  |  |  ------------------
  |  |  187|   294k|  {                                                                                         \
  |  |  188|  30.2k|      u4_symbol_m = 1 - u4_symbol_m;                                                        \
  |  |  189|  30.2k|      u4_codeIntValOffset_m -= u4_codeIntRange_m;                                           \
  |  |  190|  30.2k|      u4_codeIntRange_m = u4_codeIntRangeLPS_m;                                             \
  |  |  191|  30.2k|      u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                       \
  |  |  192|  30.2k|  }                                                                                         \
  |  |  193|   294k|}
  ------------------
  746|   294k|                                     u4_symbol, u4_int_range_lps,
  747|   294k|                                     u1_mps_state, table_lookup)
  748|       |
  749|   294k|                        p_binCtxt_last->u1_mps_state = u1_mps_state;
  750|   294k|                        uc_bin = u4_symbol;
  751|   294k|                    }
  752|       |
  753|       |                    /*inilined DecodeDecision_onebin ends*/
  754|   294k|                    if(uc_bin == 1)
  ------------------
  |  Branch (754:24): [True: 37.8k, False: 256k]
  ------------------
  755|  37.8k|                        goto label_read_levels;
  756|       |
  757|   294k|                }
  758|       |
  759|  4.08M|                i = i + 1;
  760|       |
  761|  4.08M|            }
  762|  4.08M|            while(i < uc_last_coeff_idx);
  ------------------
  |  Branch (762:19): [True: 4.03M, False: 52.7k]
  ------------------
  763|       |
  764|  52.7k|            num_sig_coeffs++;
  765|  52.7k|            SET_BIT(ps_tu_8x8->au4_sig_coeff_map[i>31], (i > 31 ? i - 32:i));
  ------------------
  |  |  106|   105k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  |  |  ------------------
  |  |  |  Branch (106:43): [True: 52.7k, False: 0]
  |  |  ------------------
  ------------------
  766|       |
  767|  90.5k|            label_read_levels: ;
  768|  90.5k|        }
  769|       |
  770|       |        /// VALUE of No of Coeff in BLOCK = i + 1 for second case else i;
  771|       |
  772|       |        /* Decode coeff_abs_level_minus1 and coeff_sign_flag */
  773|      0|        {
  774|  90.5k|            WORD32 i2_abs_lvl;
  775|  90.5k|            UWORD32 u1_abs_level_equal1 = 1, u1_abs_level_gt1 = 0;
  776|       |
  777|  90.5k|            UWORD32 u4_ctx_inc;
  778|  90.5k|            UWORD32 ui_prefix;
  779|  90.5k|            bin_ctxt_model_t *p_ctxt_abs_level;
  780|       |
  781|  90.5k|            p_ctxt_abs_level =
  782|  90.5k|                            ps_dec->p_coeff_abs_level_minus1_t[LUMA_8X8_CTXCAT];
  ------------------
  |  |   76|  90.5k|#define LUMA_8X8_CTXCAT   5
  ------------------
  783|  90.5k|            u4_ctx_inc = ((0x51));
  784|       |
  785|       |            /*****************************************************/
  786|       |            /* Main Loop runs for no. of Significant coefficient */
  787|       |            /*****************************************************/
  788|  90.5k|            do
  789|   347k|            {
  790|   347k|                {
  791|       |
  792|       |                    /*****************************************************/
  793|       |                    /* inilining a modified ih264d_decode_bins_unary     */
  794|       |                    /*****************************************************/
  795|       |
  796|   347k|                    {
  797|   347k|                        UWORD32 u4_value;
  798|   347k|                        UWORD32 u4_symbol;
  799|   347k|                        bin_ctxt_model_t *ps_bin_ctxt;
  800|   347k|                        UWORD32 u4_ctx_Inc;
  801|   347k|                        u4_value = 0;
  802|       |
  803|   347k|                        u4_ctx_Inc = u4_ctx_inc & 0xf;
  804|   347k|                        ps_bin_ctxt = p_ctxt_abs_level + u4_ctx_Inc;
  805|       |
  806|   347k|                        do
  807|   581k|                        {
  808|   581k|                            {
  809|   581k|                                UWORD32 u4_qnt_int_range,
  810|   581k|                                                u4_int_range_lps;
  811|   581k|                                UWORD32 u1_mps_state;
  812|   581k|                                UWORD32 table_lookup;
  813|   581k|                                const UWORD32 *pu4_table =
  814|   581k|                                                (const UWORD32 *)ps_cab_env->cabac_table;
  815|   581k|                                UWORD32 u4_clz;
  816|       |
  817|   581k|                                u1_mps_state = (ps_bin_ctxt->u1_mps_state);
  818|   581k|                                u4_clz = CLZ(u4_code_int_range);
  819|   581k|                                u4_qnt_int_range = u4_code_int_range
  820|   581k|                                                << u4_clz;
  821|   581k|                                u4_qnt_int_range = (u4_qnt_int_range
  822|   581k|                                                >> 29) & 0x3;
  823|   581k|                                table_lookup = pu4_table[(u1_mps_state << 2)
  824|   581k|                                                + u4_qnt_int_range];
  825|   581k|                                u4_int_range_lps = table_lookup & 0xff;
  826|       |
  827|   581k|                                u4_int_range_lps = u4_int_range_lps
  828|   581k|                                                << (23 - u4_clz);
  829|   581k|                                u4_code_int_range = u4_code_int_range
  830|   581k|                                                - u4_int_range_lps;
  831|   581k|                                u4_symbol = ((u1_mps_state >> 6) & 0x1);
  832|   581k|                                u1_mps_state = (table_lookup >> 8) & 0x7F;
  833|       |
  834|   581k|                                CHECK_IF_LPS(u4_code_int_range,
  ------------------
  |  |  184|   581k|                    u4_codeIntRangeLPS_m,u1_mps_state_m,table_lookup_m)                     \
  |  |  185|   581k|{                                                                                         \
  |  |  186|   581k|  if(u4_codeIntValOffset_m >= u4_codeIntRange_m)                                            \
  |  |  ------------------
  |  |  |  Branch (186:6): [True: 65.9k, False: 515k]
  |  |  ------------------
  |  |  187|   581k|  {                                                                                         \
  |  |  188|  65.9k|      u4_symbol_m = 1 - u4_symbol_m;                                                        \
  |  |  189|  65.9k|      u4_codeIntValOffset_m -= u4_codeIntRange_m;                                           \
  |  |  190|  65.9k|      u4_codeIntRange_m = u4_codeIntRangeLPS_m;                                             \
  |  |  191|  65.9k|      u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                       \
  |  |  192|  65.9k|  }                                                                                         \
  |  |  193|   581k|}
  ------------------
  835|   581k|                                             u4_code_int_val_ofst, u4_symbol,
  836|   581k|                                             u4_int_range_lps, u1_mps_state,
  837|   581k|                                             table_lookup)
  838|       |
  839|   581k|                                if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_9)
  ------------------
  |  |  114|   581k|#define ONE_RIGHT_SHIFTED_BY_9    1<<9
  ------------------
  |  Branch (839:36): [True: 14.2k, False: 567k]
  ------------------
  840|  14.2k|                                {
  841|       |
  842|  14.2k|                                    RENORM_RANGE_OFFSET(u4_code_int_range,
  ------------------
  |  |  170|  14.2k|  {                                                                                         \
  |  |  171|  14.2k|    UWORD32 read_bits_m,u4_clz_m  ;                                                         \
  |  |  172|  14.2k|    u4_clz_m = CLZ(u4_codeIntRange_m);                                                  \
  |  |  173|  14.2k|    NEXTBITS(read_bits_m,(u4_offset_m+23),pu4_buffer_m,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|  14.2k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|  14.2k|{                                                                           \
  |  |  |  |  139|  14.2k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|  14.2k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|  14.2k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|  14.2k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|  14.2k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 13.7k, False: 440]
  |  |  |  |  ------------------
  |  |  |  |  144|  14.2k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  13.7k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|  14.2k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  14.2k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|  14.2k|}
  |  |  ------------------
  |  |  174|  14.2k|    FLUSHBITS(u4_offset_m,(u4_clz_m))                                                       \
  |  |  ------------------
  |  |  |  |  193|  14.2k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|  14.2k|{                                                                           \
  |  |  |  |  195|  14.2k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|  14.2k|}
  |  |  ------------------
  |  |  175|  14.2k|    u4_codeIntRange_m = u4_codeIntRange_m << u4_clz_m;                                      \
  |  |  176|  14.2k|    u4_codeIntValOffset_m = (u4_codeIntValOffset_m << u4_clz_m) | read_bits_m;              \
  |  |  177|  14.2k|  }
  ------------------
  843|  14.2k|                                                        u4_code_int_val_ofst,
  844|  14.2k|                                                        u4_offset, pu4_buffer)
  845|  14.2k|                                }
  846|       |
  847|   581k|                                ps_bin_ctxt->u1_mps_state = u1_mps_state;
  848|   581k|                            }
  849|       |
  850|   581k|                            u4_value++;
  851|   581k|                            ps_bin_ctxt = p_ctxt_abs_level + (u4_ctx_inc >> 4);
  852|       |
  853|   581k|                        }
  854|   581k|                        while(u4_symbol && (u4_value < UCOFF_LEVEL));
  ------------------
  |  |   41|   244k|#define UCOFF_LEVEL  14
  ------------------
  |  Branch (854:31): [True: 244k, False: 337k]
  |  Branch (854:44): [True: 234k, False: 9.65k]
  ------------------
  855|       |
  856|   347k|                        ui_prefix = u4_value - 1 + u4_symbol;
  857|   347k|                    }
  858|       |
  859|   347k|                    if(ui_prefix == UCOFF_LEVEL)
  ------------------
  |  |   41|   347k|#define UCOFF_LEVEL  14
  ------------------
  |  Branch (859:24): [True: 9.65k, False: 337k]
  ------------------
  860|  9.65k|                    {
  861|  9.65k|                        UWORD32 ui16_sufS = 0;
  862|  9.65k|                        UWORD32 u1_max_bins;
  863|  9.65k|                        UWORD32 u4_value;
  864|       |
  865|  9.65k|                        i2_abs_lvl = UCOFF_LEVEL;
  ------------------
  |  |   41|  9.65k|#define UCOFF_LEVEL  14
  ------------------
  866|       |                        /*inlining ih264d_decode_bypass_bins_unary begins*/
  867|       |
  868|  9.65k|                        {
  869|  9.65k|                            UWORD32 uc_bin;
  870|  9.65k|                            UWORD32 bits_to_flush;
  871|       |
  872|       |
  873|  9.65k|                            bits_to_flush = 0;
  874|       |                            /*renormalize to ensure there 23 bits more in the u4_code_int_val_ofst*/
  875|  9.65k|                            {
  876|  9.65k|                                UWORD32 u4_clz, read_bits;
  877|       |
  878|  9.65k|                                u4_clz = CLZ(u4_code_int_range);
  879|  9.65k|                                FLUSHBITS(u4_offset, u4_clz)
  ------------------
  |  |  193|  9.65k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|  9.65k|{                                                                           \
  |  |  195|  9.65k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|  9.65k|}
  ------------------
  880|  9.65k|                                NEXTBITS(read_bits, u4_offset, pu4_buffer, CABAC_BITS_TO_READ)
  ------------------
  |  |  137|  9.65k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|  9.65k|{                                                                           \
  |  |  139|  9.65k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|  9.65k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|  9.65k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|  9.65k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|  9.65k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 9.32k, False: 337]
  |  |  ------------------
  |  |  144|  9.65k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  9.32k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|  9.65k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  9.65k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|  9.65k|}
  ------------------
  881|  9.65k|                                u4_code_int_range = u4_code_int_range << u4_clz;
  882|  9.65k|                                u4_code_int_val_ofst = (u4_code_int_val_ofst
  883|  9.65k|                                                << u4_clz) | read_bits;
  884|  9.65k|                            }
  885|       |
  886|  9.65k|                            do
  887|  12.7k|                            {
  888|  12.7k|                                bits_to_flush++;
  889|       |
  890|  12.7k|                                u4_code_int_range = u4_code_int_range >> 1;
  891|       |
  892|  12.7k|                                if(u4_code_int_val_ofst >= u4_code_int_range)
  ------------------
  |  Branch (892:36): [True: 3.07k, False: 9.65k]
  ------------------
  893|  3.07k|                                {
  894|       |                                    /* S=1 */
  895|  3.07k|                                    uc_bin = 1;
  896|  3.07k|                                    u4_code_int_val_ofst -= u4_code_int_range;
  897|  3.07k|                                }
  898|  9.65k|                                else
  899|  9.65k|                                {
  900|       |                                    /* S=0 */
  901|  9.65k|                                    uc_bin = 0;
  902|  9.65k|                                }
  903|       |
  904|  12.7k|                            }
  905|  12.7k|                            while(uc_bin && (bits_to_flush < CABAC_BITS_TO_READ));
  ------------------
  |  |  618|  3.07k|#define CABAC_BITS_TO_READ 23
  ------------------
  |  Branch (905:35): [True: 3.07k, False: 9.65k]
  |  Branch (905:45): [True: 3.07k, False: 0]
  ------------------
  906|       |
  907|  9.65k|                            u4_value = (bits_to_flush - 1);
  908|  9.65k|                        }
  909|       |                        /*inlining ih264d_decode_bypass_bins_unary ends*/
  910|       |
  911|  9.65k|                        ui16_sufS = (1 << u4_value);
  912|  9.65k|                        u1_max_bins = u4_value;
  913|       |
  914|  9.65k|                        if(u4_value > 0)
  ------------------
  |  Branch (914:28): [True: 1.51k, False: 8.14k]
  ------------------
  915|  1.51k|                        {
  916|       |                            /*inline bypassbins_flc begins*/
  917|       |
  918|  1.51k|                            if(u4_value > 10)
  ------------------
  |  Branch (918:32): [True: 2, False: 1.50k]
  ------------------
  919|      2|                            {
  920|      2|                                UWORD32 u4_clz, read_bits;
  921|       |
  922|      2|                                u4_clz = CLZ(u4_code_int_range);
  923|      2|                                FLUSHBITS(u4_offset, u4_clz)
  ------------------
  |  |  193|      2|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|      2|{                                                                           \
  |  |  195|      2|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|      2|}
  ------------------
  924|      2|                                NEXTBITS(read_bits, u4_offset, pu4_buffer, CABAC_BITS_TO_READ)
  ------------------
  |  |  137|      2|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|      2|{                                                                           \
  |  |  139|      2|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|      2|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|      2|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|      2|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|      2|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 2, False: 0]
  |  |  ------------------
  |  |  144|      2|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|      2|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|      2|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|      2|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|      2|}
  ------------------
  925|      2|                                u4_code_int_range = u4_code_int_range << u4_clz;
  926|      2|                                u4_code_int_val_ofst = (u4_code_int_val_ofst
  927|      2|                                                << u4_clz) | read_bits;
  928|      2|                            }
  929|       |
  930|  1.51k|                            {
  931|  1.51k|                                UWORD32 ui_bins;
  932|  1.51k|                                UWORD32 uc_bin;
  933|  1.51k|                                UWORD32 bits_to_flush;
  934|       |
  935|  1.51k|                                ui_bins = 0;
  936|  1.51k|                                bits_to_flush = 0;
  937|       |
  938|  1.51k|                                do
  939|  3.07k|                                {
  940|  3.07k|                                    bits_to_flush++;
  941|       |
  942|  3.07k|                                    u4_code_int_range = u4_code_int_range >> 1;
  943|       |
  944|  3.07k|                                    if(u4_code_int_val_ofst
  ------------------
  |  Branch (944:40): [True: 1.49k, False: 1.58k]
  ------------------
  945|  3.07k|                                                    >= u4_code_int_range)
  946|  1.49k|                                    {
  947|       |                                        /* S=1 */
  948|  1.49k|                                        uc_bin = 1;
  949|  1.49k|                                        u4_code_int_val_ofst -=
  950|  1.49k|                                                        u4_code_int_range;
  951|  1.49k|                                    }
  952|  1.58k|                                    else
  953|  1.58k|                                    {
  954|       |                                        /* S=0 */
  955|  1.58k|                                        uc_bin = 0;
  956|  1.58k|                                    }
  957|       |
  958|  3.07k|                                    ui_bins = ((ui_bins << 1) | uc_bin);
  959|       |
  960|  3.07k|                                }
  961|  3.07k|                                while(bits_to_flush < u1_max_bins);
  ------------------
  |  Branch (961:39): [True: 1.56k, False: 1.51k]
  ------------------
  962|       |
  963|  1.51k|                                u4_value = ui_bins;
  964|  1.51k|                            }
  965|       |                            /*inline bypassbins_flc ends*/
  966|  1.51k|                        }
  967|       |
  968|       |                        //Value of K
  969|  9.65k|                        ui16_sufS += u4_value;
  970|  9.65k|                        i2_abs_lvl += (WORD32)ui16_sufS;
  971|  9.65k|                    }
  972|   337k|                    else
  973|   337k|                    {
  974|   337k|                        i2_abs_lvl = 1 + ui_prefix;
  975|   337k|                    }
  976|       |
  977|   347k|                    if(i2_abs_lvl > 1)
  ------------------
  |  Branch (977:24): [True: 68.7k, False: 278k]
  ------------------
  978|  68.7k|                    {
  979|  68.7k|                        u1_abs_level_gt1++;
  980|  68.7k|                    }
  981|   347k|                    if(!u1_abs_level_gt1)
  ------------------
  |  Branch (981:24): [True: 241k, False: 105k]
  ------------------
  982|   241k|                    {
  983|   241k|                        u1_abs_level_equal1++;
  984|   241k|                        u4_ctx_inc = (5 << 4) + MIN(u1_abs_level_equal1, 4);
  ------------------
  |  |   61|   241k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 166k, False: 74.5k]
  |  |  ------------------
  ------------------
  985|   241k|                    }
  986|   105k|                    else
  987|   105k|                    {
  988|   105k|                        u4_ctx_inc = (5 + MIN(u1_abs_level_gt1, 4)) << 4;
  ------------------
  |  |   61|   105k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 70.3k, False: 35.5k]
  |  |  ------------------
  ------------------
  989|   105k|                    }
  990|       |
  991|       |                    /*u4_ctx_inc = g_table_temp[u1_abs_level_gt1][u1_abs_level_equal1];*/
  992|       |
  993|       |                    /* encode coeff_sign_flag[i] */
  994|       |
  995|   347k|                    {
  996|   347k|                        u4_code_int_range = u4_code_int_range >> 1;
  997|       |
  998|   347k|                        if(u4_code_int_val_ofst >= (u4_code_int_range))
  ------------------
  |  Branch (998:28): [True: 115k, False: 232k]
  ------------------
  999|   115k|                        {
 1000|       |                            /* S=1 */
 1001|   115k|                            u4_code_int_val_ofst -= u4_code_int_range;
 1002|   115k|                            i2_abs_lvl = (-i2_abs_lvl);
 1003|   115k|                        }
 1004|   347k|                    }
 1005|       |
 1006|   347k|                    *pi2_coeff_data++ = i2_abs_lvl;
 1007|   347k|                    num_sig_coeffs--;
 1008|   347k|                }
 1009|   347k|            }
 1010|   347k|            while(num_sig_coeffs > 0);
  ------------------
  |  Branch (1010:19): [True: 256k, False: 90.5k]
  ------------------
 1011|  90.5k|        }
 1012|  90.5k|    }
 1013|       |
 1014|      0|    {
 1015|  90.5k|        WORD32 offset;
 1016|  90.5k|        offset = (UWORD8 *)pi2_coeff_data - (UWORD8 *)ps_tu_8x8;
 1017|  90.5k|        offset = ALIGN4(offset);
  ------------------
  |  |   52|  90.5k|#define ALIGN4(x)   ((((x) + 3) >> 2) << 2)
  ------------------
 1018|  90.5k|        ps_dec->pv_parse_tu_coeff_data = (void *)((UWORD8 *)ps_dec->pv_parse_tu_coeff_data + offset);
 1019|  90.5k|    }
 1020|       |
 1021|       |    /*updating structures*/
 1022|  90.5k|    ps_cab_env->u4_code_int_val_ofst = u4_code_int_val_ofst;
 1023|  90.5k|    ps_cab_env->u4_code_int_range = u4_code_int_range;
 1024|  90.5k|    ps_bitstrm->u4_ofst = u4_offset;
 1025|  90.5k|}
ih264d_cabac_parse_8x8block:
 1072|  72.5k|{
 1073|  72.5k|    UWORD32 u4_ctxinc, u4_subblock_coded;
 1074|  72.5k|    UWORD32 u4_top0, u4_top1;
 1075|  72.5k|    UWORD32 u4_csbp = 0;
 1076|  72.5k|    UWORD32 u4_idx = 0;
 1077|  72.5k|    dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
 1078|  72.5k|    bin_ctxt_model_t * const ps_cbf = ps_dec->p_cbf_t[u4_ctx_cat];
 1079|  72.5k|    bin_ctxt_model_t *ps_src_bin_ctxt;
 1080|  72.5k|    bin_ctxt_model_t * const ps_sig_coeff_flag =
 1081|  72.5k|                    ps_dec->p_significant_coeff_flag_t[u4_ctx_cat];
 1082|       |
 1083|  72.5k|    UWORD8 *pu1_inv_scan = ps_dec->pu1_inv_scan;
 1084|       |
 1085|       |    /*------------------------------------------------------*/
 1086|       |    /* Residual 4x4 decoding: SubBlock 0                    */
 1087|       |    /*------------------------------------------------------*/
 1088|  72.5k|    u4_ctxinc = ((!!pu1_top_nnz[0]) << 1) + (!!pu1_left_nnz[0]);
 1089|       |
 1090|  72.5k|    ps_src_bin_ctxt = ps_cbf + u4_ctxinc;
 1091|       |
 1092|  72.5k|    u4_top0 = ih264d_read_coeff4x4_cabac( ps_bitstrm,
 1093|  72.5k|                                         u4_ctx_cat, ps_sig_coeff_flag, ps_dec,
 1094|  72.5k|                                         ps_src_bin_ctxt);
 1095|       |
 1096|  72.5k|    INSERT_BIT(u4_csbp, u4_idx, u4_top0);
  ------------------
  |  |  109|  72.5k|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|  72.5k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 1097|       |
 1098|       |    /*------------------------------------------------------*/
 1099|       |    /* Residual 4x4 decoding: SubBlock 1                    */
 1100|       |    /*------------------------------------------------------*/
 1101|  72.5k|    u4_idx++;
 1102|  72.5k|    pi2_coeff_block += NUM_COEFFS_IN_4x4BLK;
  ------------------
  |  |  617|  72.5k|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 1103|  72.5k|    u4_ctxinc = ((!!pu1_top_nnz[1]) << 1) + u4_top0;
 1104|       |
 1105|  72.5k|    ps_src_bin_ctxt = ps_cbf + u4_ctxinc;
 1106|       |
 1107|  72.5k|    u4_top1 = ih264d_read_coeff4x4_cabac(ps_bitstrm,
 1108|  72.5k|                                         u4_ctx_cat, ps_sig_coeff_flag, ps_dec,
 1109|  72.5k|                                         ps_src_bin_ctxt);
 1110|       |
 1111|  72.5k|    INSERT_BIT(u4_csbp, u4_idx, u4_top1);
  ------------------
  |  |  109|  72.5k|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|  72.5k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 1112|  72.5k|    pu1_left_nnz[0] = u4_top1;
 1113|       |
 1114|       |    /*------------------------------------------------------*/
 1115|       |    /* Residual 4x4 decoding: SubBlock 2                    */
 1116|       |    /*------------------------------------------------------*/
 1117|  72.5k|    u4_idx += (u4_sub_block_strd - 1);
 1118|  72.5k|    pi2_coeff_block += ((u4_sub_block_strd - 1) * NUM_COEFFS_IN_4x4BLK);
  ------------------
  |  |  617|  72.5k|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 1119|  72.5k|    u4_ctxinc = (u4_top0 << 1) + (!!pu1_left_nnz[1]);
 1120|       |
 1121|  72.5k|    ps_src_bin_ctxt = ps_cbf + u4_ctxinc;
 1122|       |
 1123|  72.5k|    u4_subblock_coded = ih264d_read_coeff4x4_cabac(ps_bitstrm, u4_ctx_cat,
 1124|  72.5k|                                                   ps_sig_coeff_flag, ps_dec,
 1125|  72.5k|                                                   ps_src_bin_ctxt);
 1126|       |
 1127|  72.5k|    INSERT_BIT(u4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|  72.5k|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|  72.5k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 1128|  72.5k|    pu1_top_nnz[0] = u4_subblock_coded;
 1129|       |
 1130|       |    /*------------------------------------------------------*/
 1131|       |    /* Residual 4x4 decoding: SubBlock 3                    */
 1132|       |    /*------------------------------------------------------*/
 1133|  72.5k|    u4_idx++;
 1134|  72.5k|    pi2_coeff_block += NUM_COEFFS_IN_4x4BLK;
  ------------------
  |  |  617|  72.5k|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 1135|  72.5k|    u4_ctxinc = (u4_top1 << 1) + u4_subblock_coded;
 1136|       |
 1137|  72.5k|    ps_src_bin_ctxt = ps_cbf + u4_ctxinc;
 1138|       |
 1139|  72.5k|    u4_subblock_coded = ih264d_read_coeff4x4_cabac(ps_bitstrm, u4_ctx_cat,
 1140|  72.5k|                                                   ps_sig_coeff_flag, ps_dec,
 1141|  72.5k|                                                   ps_src_bin_ctxt);
 1142|       |
 1143|  72.5k|    INSERT_BIT(u4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|  72.5k|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|  72.5k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 1144|  72.5k|    pu1_top_nnz[1] = pu1_left_nnz[1] = u4_subblock_coded;
 1145|       |
 1146|  72.5k|    return (u4_csbp);
 1147|  72.5k|}
ih264d_parse_residual4x4_cabac:
 1164|  67.0k|{
 1165|  67.0k|    UWORD8 u1_cbp = ps_cur_mb_info->u1_cbp;
 1166|  67.0k|    UWORD16 ui16_csbp = 0;
 1167|  67.0k|    WORD16 *pi2_residual_buf;
 1168|  67.0k|    UWORD8 uc_ctx_cat;
 1169|  67.0k|    UWORD8 *pu1_top_nnz = ps_cur_mb_info->ps_curmb->pu1_nnz_y;
 1170|  67.0k|    UWORD8 *pu1_left_nnz = ps_dec->pu1_left_nnz_y;
 1171|  67.0k|    UWORD8 *pu1_top_nnz_uv = ps_cur_mb_info->ps_curmb->pu1_nnz_uv;
 1172|  67.0k|    ctxt_inc_mb_info_t *p_curr_ctxt = ps_dec->ps_curr_ctxt_mb_info;
 1173|  67.0k|    ctxt_inc_mb_info_t *ps_top_ctxt = ps_dec->p_top_ctxt_mb_info;
 1174|  67.0k|    dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
 1175|  67.0k|    UWORD32 u4_nbr_avail = ps_dec->u1_mb_ngbr_availablity;
 1176|  67.0k|    WORD16 *pi2_coeff_block = NULL;
 1177|  67.0k|    bin_ctxt_model_t *ps_src_bin_ctxt;
 1178|       |
 1179|  67.0k|    UWORD8 u1_top_dc_csbp = (ps_top_ctxt->u1_yuv_dc_csbp) >> 1;
 1180|  67.0k|    UWORD8 u1_left_dc_csbp = (ps_dec->pu1_left_yuv_dc_csbp[0]) >> 1;
 1181|       |
 1182|       |
 1183|  67.0k|    if(!(u4_nbr_avail & TOP_MB_AVAILABLE_MASK))
  ------------------
  |  |   55|  67.0k|#define TOP_MB_AVAILABLE_MASK       0x04
  ------------------
  |  Branch (1183:8): [True: 10.0k, False: 57.0k]
  ------------------
 1184|  10.0k|    {
 1185|  10.0k|        if(p_curr_ctxt->u1_mb_type & CAB_INTRA_MASK)
  ------------------
  |  |  406|  10.0k|#define CAB_INTRA_MASK    0x04 /* 0000 0100 */
  ------------------
  |  Branch (1185:12): [True: 8.91k, False: 1.15k]
  ------------------
 1186|  8.91k|        {
 1187|  8.91k|            *(UWORD32 *)pu1_top_nnz = 0;
 1188|  8.91k|            u1_top_dc_csbp = 0;
 1189|  8.91k|            *(UWORD32 *)pu1_top_nnz_uv = 0;
 1190|  8.91k|        }
 1191|  1.15k|        else
 1192|  1.15k|        {
 1193|  1.15k|            *(UWORD32 *)pu1_top_nnz = 0x01010101;
 1194|  1.15k|            u1_top_dc_csbp = 0x3;
 1195|  1.15k|            *(UWORD32 *)pu1_top_nnz_uv = 0x01010101;
 1196|  1.15k|        }
 1197|  10.0k|    }
 1198|  57.0k|    else
 1199|  57.0k|    {
 1200|  57.0k|        UWORD32 *pu4_buf;
 1201|  57.0k|        UWORD8 *pu1_buf;
 1202|  57.0k|        pu1_buf = ps_cur_mb_info->ps_top_mb->pu1_nnz_y;
 1203|  57.0k|        pu4_buf = (UWORD32 *)pu1_buf;
 1204|  57.0k|        *(UWORD32 *)(pu1_top_nnz) = *pu4_buf;
 1205|       |
 1206|  57.0k|        pu1_buf = ps_cur_mb_info->ps_top_mb->pu1_nnz_uv;
 1207|  57.0k|        pu4_buf = (UWORD32 *)pu1_buf;
 1208|  57.0k|        *(UWORD32 *)(pu1_top_nnz_uv) = *pu4_buf;
 1209|       |
 1210|  57.0k|    }
 1211|       |
 1212|  67.0k|    if(!(u4_nbr_avail & LEFT_MB_AVAILABLE_MASK))
  ------------------
  |  |   53|  67.0k|#define LEFT_MB_AVAILABLE_MASK      0x01
  ------------------
  |  Branch (1212:8): [True: 16.9k, False: 50.1k]
  ------------------
 1213|  16.9k|    {
 1214|  16.9k|        if(p_curr_ctxt->u1_mb_type & CAB_INTRA_MASK)
  ------------------
  |  |  406|  16.9k|#define CAB_INTRA_MASK    0x04 /* 0000 0100 */
  ------------------
  |  Branch (1214:12): [True: 12.6k, False: 4.31k]
  ------------------
 1215|  12.6k|        {
 1216|  12.6k|            UWORD32 *pu4_buf;
 1217|  12.6k|            UWORD8 *pu1_buf;
 1218|  12.6k|            *(UWORD32 *)pu1_left_nnz = 0;
 1219|  12.6k|            u1_left_dc_csbp = 0;
 1220|  12.6k|            pu1_buf = ps_dec->pu1_left_nnz_uv;
 1221|  12.6k|            pu4_buf = (UWORD32 *)pu1_buf;
 1222|  12.6k|            *pu4_buf = 0;
 1223|  12.6k|        }
 1224|  4.31k|        else
 1225|  4.31k|        {
 1226|  4.31k|            UWORD32 *pu4_buf;
 1227|  4.31k|            UWORD8 *pu1_buf;
 1228|  4.31k|            *(UWORD32 *)pu1_left_nnz = 0x01010101;
 1229|  4.31k|            u1_left_dc_csbp = 0x3;
 1230|  4.31k|            pu1_buf = ps_dec->pu1_left_nnz_uv;
 1231|  4.31k|            pu4_buf = (UWORD32 *)pu1_buf;
 1232|  4.31k|            *pu4_buf = 0x01010101;
 1233|  4.31k|        }
 1234|  16.9k|    }
 1235|       |
 1236|  67.0k|    uc_ctx_cat = u1_offset ? LUMA_AC_CTXCAT : LUMA_4X4_CTXCAT;
  ------------------
  |  |   72|  1.27k|#define LUMA_AC_CTXCAT    1
  ------------------
                  uc_ctx_cat = u1_offset ? LUMA_AC_CTXCAT : LUMA_4X4_CTXCAT;
  ------------------
  |  |   73|   132k|#define LUMA_4X4_CTXCAT   2
  ------------------
  |  Branch (1236:18): [True: 1.27k, False: 65.8k]
  ------------------
 1237|       |
 1238|  67.0k|    ps_cur_mb_info->u1_qp_div6 = ps_dec->u1_qp_y_div6;
 1239|  67.0k|    ps_cur_mb_info->u1_qpc_div6 = ps_dec->u1_qp_u_div6;
 1240|  67.0k|    ps_cur_mb_info->u1_qp_rem6 = ps_dec->u1_qp_y_rem6;
 1241|  67.0k|    ps_cur_mb_info->u1_qpc_rem6 = ps_dec->u1_qp_u_rem6;
 1242|       |    // CHECK_THIS
 1243|  67.0k|    ps_cur_mb_info->u1_qpcr_div6 = ps_dec->u1_qp_v_div6;
 1244|  67.0k|    ps_cur_mb_info->u1_qpcr_rem6 = ps_dec->u1_qp_v_rem6;
 1245|       |
 1246|  67.0k|    if(u1_cbp & 0x0f)
  ------------------
  |  Branch (1246:8): [True: 43.5k, False: 23.5k]
  ------------------
 1247|  43.5k|    {
 1248|  43.5k|        if(ps_cur_mb_info->u1_tran_form8x8 == 0)
  ------------------
  |  Branch (1248:12): [True: 16.9k, False: 26.6k]
  ------------------
 1249|  16.9k|        {
 1250|       |            /*******************************************************************/
 1251|       |            /* Block 0 residual decoding, check cbp and proceed (subblock = 0) */
 1252|       |            /*******************************************************************/
 1253|  16.9k|            if(!(u1_cbp & 0x1))
  ------------------
  |  Branch (1253:16): [True: 4.65k, False: 12.2k]
  ------------------
 1254|  4.65k|            {
 1255|  4.65k|                *(UWORD16 *)(pu1_top_nnz) = 0;
 1256|  4.65k|                *(UWORD16 *)(pu1_left_nnz) = 0;
 1257|  4.65k|            }
 1258|  12.2k|            else
 1259|  12.2k|            {
 1260|  12.2k|                ui16_csbp = ih264d_cabac_parse_8x8block(pi2_coeff_block, 4,
 1261|  12.2k|                                                        uc_ctx_cat, ps_dec,
 1262|  12.2k|                                                        pu1_top_nnz,
 1263|  12.2k|                                                        pu1_left_nnz);
 1264|  12.2k|            }
 1265|       |
 1266|       |            /*******************************************************************/
 1267|       |            /* Block 1 residual decoding, check cbp and proceed (subblock = 2) */
 1268|       |            /*******************************************************************/
 1269|  16.9k|            pi2_coeff_block += (2 * NUM_COEFFS_IN_4x4BLK);
  ------------------
  |  |  617|  16.9k|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 1270|  16.9k|            if(!(u1_cbp & 0x2))
  ------------------
  |  Branch (1270:16): [True: 5.95k, False: 10.9k]
  ------------------
 1271|  5.95k|            {
 1272|  5.95k|                *(UWORD16 *)(pu1_top_nnz + 2) = 0;
 1273|  5.95k|                *(UWORD16 *)(pu1_left_nnz) = 0;
 1274|  5.95k|            }
 1275|  10.9k|            else
 1276|  10.9k|            {
 1277|  10.9k|                UWORD32 u4_temp = ih264d_cabac_parse_8x8block(pi2_coeff_block,
 1278|  10.9k|                                                              4, uc_ctx_cat,
 1279|  10.9k|                                                              ps_dec,
 1280|  10.9k|                                                              (pu1_top_nnz + 2),
 1281|  10.9k|                                                              pu1_left_nnz);
 1282|  10.9k|                ui16_csbp |= (u4_temp << 2);
 1283|  10.9k|            }
 1284|       |
 1285|       |            /*******************************************************************/
 1286|       |            /* Block 2 residual decoding, check cbp and proceed (subblock = 8) */
 1287|       |            /*******************************************************************/
 1288|  16.9k|            pi2_coeff_block += (6 * NUM_COEFFS_IN_4x4BLK);
  ------------------
  |  |  617|  16.9k|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 1289|  16.9k|            if(!(u1_cbp & 0x4))
  ------------------
  |  Branch (1289:16): [True: 5.31k, False: 11.6k]
  ------------------
 1290|  5.31k|            {
 1291|  5.31k|                *(UWORD16 *)(pu1_top_nnz) = 0;
 1292|  5.31k|                *(UWORD16 *)(pu1_left_nnz + 2) = 0;
 1293|  5.31k|            }
 1294|  11.6k|            else
 1295|  11.6k|            {
 1296|  11.6k|                UWORD32 u4_temp = ih264d_cabac_parse_8x8block(
 1297|  11.6k|                                pi2_coeff_block, 4, uc_ctx_cat, ps_dec,
 1298|  11.6k|                                pu1_top_nnz, (pu1_left_nnz + 2));
 1299|  11.6k|                ui16_csbp |= (u4_temp << 8);
 1300|  11.6k|            }
 1301|       |
 1302|       |            /*******************************************************************/
 1303|       |            /* Block 3 residual decoding, check cbp and proceed (subblock = 10)*/
 1304|       |            /*******************************************************************/
 1305|  16.9k|            pi2_coeff_block += (2 * NUM_COEFFS_IN_4x4BLK);
  ------------------
  |  |  617|  16.9k|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 1306|  16.9k|            if(!(u1_cbp & 0x8))
  ------------------
  |  Branch (1306:16): [True: 5.45k, False: 11.4k]
  ------------------
 1307|  5.45k|            {
 1308|  5.45k|                *(UWORD16 *)(pu1_top_nnz + 2) = 0;
 1309|  5.45k|                *(UWORD16 *)(pu1_left_nnz + 2) = 0;
 1310|  5.45k|            }
 1311|  11.4k|            else
 1312|  11.4k|            {
 1313|  11.4k|                UWORD32 u4_temp = ih264d_cabac_parse_8x8block(
 1314|  11.4k|                                pi2_coeff_block, 4, uc_ctx_cat, ps_dec,
 1315|  11.4k|                                (pu1_top_nnz + 2), (pu1_left_nnz + 2));
 1316|  11.4k|                ui16_csbp |= (u4_temp << 10);
 1317|  11.4k|            }
 1318|       |
 1319|  16.9k|        }
 1320|  26.6k|        else
 1321|  26.6k|        {
 1322|  26.6k|            ui16_csbp = 0;
 1323|       |
 1324|       |            /*******************************************************************/
 1325|       |            /* Block 0 residual decoding, check cbp and proceed (subblock = 0) */
 1326|       |            /*******************************************************************/
 1327|  26.6k|            if(!(u1_cbp & 0x1))
  ------------------
  |  Branch (1327:16): [True: 3.37k, False: 23.2k]
  ------------------
 1328|  3.37k|            {
 1329|  3.37k|                *(UWORD16 *)(pu1_top_nnz) = 0;
 1330|  3.37k|                *(UWORD16 *)(pu1_left_nnz) = 0;
 1331|  3.37k|            }
 1332|  23.2k|            else
 1333|  23.2k|            {
 1334|       |
 1335|  23.2k|                dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
 1336|       |
 1337|  23.2k|                ih264d_read_coeff8x8_cabac( ps_bitstrm,
 1338|  23.2k|                                           ps_dec, ps_cur_mb_info);
 1339|       |
 1340|  23.2k|                pu1_left_nnz[0] = 1;
 1341|  23.2k|                pu1_left_nnz[1] = 1;
 1342|       |
 1343|  23.2k|                pu1_top_nnz[0] = 1;
 1344|  23.2k|                pu1_top_nnz[1] = 1;
 1345|       |
 1346|       |                /* added to be used by BS computation module */
 1347|  23.2k|                ui16_csbp |= 0x0033;
 1348|  23.2k|            }
 1349|       |
 1350|       |            /*******************************************************************/
 1351|       |            /* Block 1 residual decoding, check cbp and proceed (subblock = 2) */
 1352|       |            /*******************************************************************/
 1353|  26.6k|            pi2_coeff_block += 64;
 1354|       |
 1355|  26.6k|            if(!(u1_cbp & 0x2))
  ------------------
  |  Branch (1355:16): [True: 3.87k, False: 22.7k]
  ------------------
 1356|  3.87k|            {
 1357|  3.87k|                *(UWORD16 *)(pu1_top_nnz + 2) = 0;
 1358|  3.87k|                *(UWORD16 *)(pu1_left_nnz) = 0;
 1359|  3.87k|            }
 1360|  22.7k|            else
 1361|  22.7k|            {
 1362|       |
 1363|       |
 1364|  22.7k|                dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
 1365|       |
 1366|  22.7k|                ih264d_read_coeff8x8_cabac(ps_bitstrm,
 1367|  22.7k|                                           ps_dec, ps_cur_mb_info);
 1368|       |
 1369|  22.7k|                pu1_left_nnz[0] = 1;
 1370|  22.7k|                pu1_left_nnz[1] = 1;
 1371|       |
 1372|  22.7k|                pu1_top_nnz[2] = 1;
 1373|  22.7k|                pu1_top_nnz[3] = 1;
 1374|       |
 1375|       |                /* added to be used by BS computation module */
 1376|  22.7k|                ui16_csbp |= 0x00CC;
 1377|       |
 1378|  22.7k|            }
 1379|       |
 1380|       |            /*******************************************************************/
 1381|       |            /* Block 2 residual decoding, check cbp and proceed (subblock = 8) */
 1382|       |            /*******************************************************************/
 1383|  26.6k|            pi2_coeff_block += 64;
 1384|  26.6k|            if(!(u1_cbp & 0x4))
  ------------------
  |  Branch (1384:16): [True: 4.25k, False: 22.3k]
  ------------------
 1385|  4.25k|            {
 1386|  4.25k|                *(UWORD16 *)(pu1_top_nnz) = 0;
 1387|  4.25k|                *(UWORD16 *)(pu1_left_nnz + 2) = 0;
 1388|  4.25k|            }
 1389|  22.3k|            else
 1390|  22.3k|            {
 1391|       |
 1392|  22.3k|                dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
 1393|       |
 1394|  22.3k|                ih264d_read_coeff8x8_cabac(ps_bitstrm,
 1395|  22.3k|                                           ps_dec, ps_cur_mb_info);
 1396|       |
 1397|  22.3k|                pu1_left_nnz[2] = 1;
 1398|  22.3k|                pu1_left_nnz[3] = 1;
 1399|       |
 1400|  22.3k|                pu1_top_nnz[0] = 1;
 1401|  22.3k|                pu1_top_nnz[1] = 1;
 1402|       |
 1403|       |                /* added to be used by BS computation module */
 1404|  22.3k|                ui16_csbp |= 0x3300;
 1405|  22.3k|            }
 1406|       |
 1407|       |            /*******************************************************************/
 1408|       |            /* Block 3 residual decoding, check cbp and proceed (subblock = 10)*/
 1409|       |            /*******************************************************************/
 1410|  26.6k|            pi2_coeff_block += 64;
 1411|       |
 1412|  26.6k|            if(!(u1_cbp & 0x8))
  ------------------
  |  Branch (1412:16): [True: 4.45k, False: 22.1k]
  ------------------
 1413|  4.45k|            {
 1414|  4.45k|                *(UWORD16 *)(pu1_top_nnz + 2) = 0;
 1415|  4.45k|                *(UWORD16 *)(pu1_left_nnz + 2) = 0;
 1416|  4.45k|            }
 1417|  22.1k|            else
 1418|  22.1k|            {
 1419|       |
 1420|  22.1k|                dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
 1421|       |
 1422|  22.1k|                ih264d_read_coeff8x8_cabac(ps_bitstrm,
 1423|  22.1k|                                           ps_dec, ps_cur_mb_info);
 1424|       |
 1425|  22.1k|                pu1_left_nnz[2] = 1;
 1426|  22.1k|                pu1_left_nnz[3] = 1;
 1427|       |
 1428|  22.1k|                pu1_top_nnz[2] = 1;
 1429|  22.1k|                pu1_top_nnz[3] = 1;
 1430|       |
 1431|       |                /* added to be used by BS computation module */
 1432|  22.1k|                ui16_csbp |= 0xCC00;
 1433|  22.1k|            }
 1434|  26.6k|        }
 1435|  43.5k|    }
 1436|  23.5k|    else
 1437|  23.5k|    {
 1438|  23.5k|        *(UWORD32 *)(pu1_top_nnz) = 0;
 1439|  23.5k|        *(UWORD32 *)(pu1_left_nnz) = 0;
 1440|  23.5k|    }
 1441|       |    /*--------------------------------------------------------------------*/
 1442|       |    /* Store the last row of N values to top row                          */
 1443|       |    /*--------------------------------------------------------------------*/
 1444|  67.0k|    ps_cur_mb_info->u2_luma_csbp = ui16_csbp;
 1445|  67.0k|    ps_cur_mb_info->ps_curmb->u2_luma_csbp = ui16_csbp;
 1446|  67.0k|    {
 1447|  67.0k|        WORD8 i;
 1448|  67.0k|        UWORD16 u2_chroma_csbp = 0;
 1449|  67.0k|        ps_cur_mb_info->u2_chroma_csbp = 0;
 1450|       |
 1451|  67.0k|        u1_cbp >>= 4;
 1452|  67.0k|        pu1_top_nnz = pu1_top_nnz_uv;
 1453|  67.0k|        pu1_left_nnz = ps_dec->pu1_left_nnz_uv;
 1454|       |        /*--------------------------------------------------------------------*/
 1455|       |        /* if Chroma Component not present OR no ac values present            */
 1456|       |        /* Set the values of N to zero                                        */
 1457|       |        /*--------------------------------------------------------------------*/
 1458|  67.0k|        if(u1_cbp == CBPC_ALLZERO)
  ------------------
  |  |  507|  67.0k|#define CBPC_ALLZERO    0
  ------------------
  |  Branch (1458:12): [True: 43.8k, False: 23.1k]
  ------------------
 1459|  43.8k|        {
 1460|  43.8k|            ps_dec->pu1_left_yuv_dc_csbp[0] &= 0x1;
 1461|  43.8k|            *(UWORD32 *)(pu1_top_nnz) = 0;
 1462|  43.8k|            *(UWORD32 *)(pu1_left_nnz) = 0;
 1463|  43.8k|            p_curr_ctxt->u1_yuv_dc_csbp &= 0x1;
 1464|  43.8k|            return (0);
 1465|  43.8k|        }
 1466|       |
 1467|       |        /*--------------------------------------------------------------------*/
 1468|       |        /* Decode Chroma DC values                                            */
 1469|       |        /*--------------------------------------------------------------------*/
 1470|  69.5k|        for(i = 0; i < 2; i++)
  ------------------
  |  Branch (1470:20): [True: 46.3k, False: 23.1k]
  ------------------
 1471|  46.3k|        {
 1472|  46.3k|            UWORD8 uc_a = 1, uc_b = 1;
 1473|  46.3k|            UWORD32 u4_ctx_inc;
 1474|  46.3k|            UWORD8 uc_codedBlockFlag;
 1475|  46.3k|            UWORD8 pu1_inv_scan[4] =
 1476|  46.3k|                { 0, 1, 2, 3 };
 1477|  46.3k|            WORD32 u4_scale;
 1478|  46.3k|            WORD32 i4_mb_inter_inc;
 1479|  46.3k|            tu_sblk4x4_coeff_data_t *ps_tu_4x4 =
 1480|  46.3k|                            (tu_sblk4x4_coeff_data_t *)ps_dec->pv_parse_tu_coeff_data;
 1481|  46.3k|            WORD16 *pi2_coeff_data =
 1482|  46.3k|                            (WORD16 *)ps_dec->pv_parse_tu_coeff_data;
 1483|  46.3k|            WORD16 ai2_dc_coef[4];
 1484|       |
 1485|  46.3k|            INC_SYM_COUNT(&(ps_dec->s_cab_dec_env));
 1486|  46.3k|            u4_scale = (i) ?
  ------------------
  |  Branch (1486:24): [True: 23.1k, False: 23.1k]
  ------------------
 1487|  23.1k|                            (ps_dec->pu2_quant_scale_v[0]
 1488|  23.1k|                                            << ps_dec->u1_qp_v_div6) :
 1489|  46.3k|                            (ps_dec->pu2_quant_scale_u[0]
 1490|  23.1k|                                            << ps_dec->u1_qp_u_div6);
 1491|       |
 1492|       |            /*--------------------------------------------------------------------*/
 1493|       |            /* Decode Bitstream to get the DC coeff                               */
 1494|       |            /*--------------------------------------------------------------------*/
 1495|  46.3k|            uc_a = (u1_left_dc_csbp >> i) & 0x01;
 1496|  46.3k|            uc_b = (u1_top_dc_csbp >> i) & 0x01;
 1497|  46.3k|            u4_ctx_inc = (uc_a + (uc_b << 1));
 1498|       |
 1499|  46.3k|            ps_src_bin_ctxt = (ps_dec->p_cbf_t[CHROMA_DC_CTXCAT]) + u4_ctx_inc;
  ------------------
  |  |   74|  46.3k|#define CHROMA_DC_CTXCAT  3
  ------------------
 1500|       |
 1501|  46.3k|            uc_codedBlockFlag =
 1502|  46.3k|                            ih264d_read_coeff4x4_cabac(ps_bitstrm,
 1503|  46.3k|                                            CHROMA_DC_CTXCAT,
  ------------------
  |  |   74|  46.3k|#define CHROMA_DC_CTXCAT  3
  ------------------
 1504|  46.3k|                                            ps_dec->p_significant_coeff_flag_t[CHROMA_DC_CTXCAT],
  ------------------
  |  |   74|  46.3k|#define CHROMA_DC_CTXCAT  3
  ------------------
 1505|  46.3k|                                            ps_dec, ps_src_bin_ctxt);
 1506|       |
 1507|  46.3k|            i4_mb_inter_inc = (!((ps_cur_mb_info->ps_curmb->u1_mb_type == I_4x4_MB)
  ------------------
  |  |  417|  46.3k|#define I_4x4_MB    0
  ------------------
  |  Branch (1507:34): [True: 9.97k, False: 36.3k]
  ------------------
 1508|  36.3k|                            || (ps_cur_mb_info->ps_curmb->u1_mb_type == I_16x16_MB)))
  ------------------
  |  |  418|  36.3k|#define I_16x16_MB  1
  ------------------
  |  Branch (1508:32): [True: 1.25k, False: 35.1k]
  ------------------
 1509|  46.3k|                            * 3;
 1510|       |
 1511|  46.3k|            if(ps_dec->s_high_profile.u1_scaling_present)
  ------------------
  |  Branch (1511:16): [True: 37.8k, False: 8.51k]
  ------------------
 1512|  37.8k|            {
 1513|  37.8k|                u4_scale *=
 1514|  37.8k|                                ps_dec->s_high_profile.i2_scalinglist4x4[i4_mb_inter_inc
 1515|  37.8k|                                                + 1 + i][0];
 1516|       |
 1517|  37.8k|            }
 1518|  8.51k|            else
 1519|  8.51k|            {
 1520|  8.51k|                u4_scale <<= 4;
 1521|  8.51k|            }
 1522|       |
 1523|  46.3k|            if(uc_codedBlockFlag)
  ------------------
  |  Branch (1523:16): [True: 37.4k, False: 8.92k]
  ------------------
 1524|  37.4k|            {
 1525|  37.4k|                WORD32 i_z0, i_z1, i_z2, i_z3;
 1526|  37.4k|                WORD32 *pi4_scale;
 1527|       |
 1528|  37.4k|                SET_BIT(u1_top_dc_csbp, i);
  ------------------
  |  |  106|  37.4k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
 1529|  37.4k|                SET_BIT(u1_left_dc_csbp, i);
  ------------------
  |  |  106|  37.4k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
 1530|       |
 1531|  37.4k|                ai2_dc_coef[0] = 0;
 1532|  37.4k|                ai2_dc_coef[1] = 0;
 1533|  37.4k|                ai2_dc_coef[2] = 0;
 1534|  37.4k|                ai2_dc_coef[3] = 0;
 1535|       |
 1536|  37.4k|                ih264d_unpack_coeff4x4_dc_4x4blk(ps_tu_4x4,
 1537|  37.4k|                                                 ai2_dc_coef,
 1538|  37.4k|                                                 pu1_inv_scan);
 1539|  37.4k|                i_z0 = (ai2_dc_coef[0] + ai2_dc_coef[2]);
 1540|  37.4k|                i_z1 = (ai2_dc_coef[0] - ai2_dc_coef[2]);
 1541|  37.4k|                i_z2 = (ai2_dc_coef[1] - ai2_dc_coef[3]);
 1542|  37.4k|                i_z3 = (ai2_dc_coef[1] + ai2_dc_coef[3]);
 1543|       |
 1544|       |                /*-----------------------------------------------------------*/
 1545|       |                /* Scaling and storing the values back                       */
 1546|       |                /*-----------------------------------------------------------*/
 1547|  37.4k|                *pi2_coeff_data++ = ((i_z0 + i_z3) * u4_scale) >> 5;
 1548|  37.4k|                *pi2_coeff_data++ = ((i_z0 - i_z3) * u4_scale) >> 5;
 1549|  37.4k|                *pi2_coeff_data++ = ((i_z1 + i_z2) * u4_scale) >> 5;
 1550|  37.4k|                *pi2_coeff_data++ = ((i_z1 - i_z2) * u4_scale) >> 5;
 1551|       |
 1552|  37.4k|                ps_dec->pv_parse_tu_coeff_data = (void *)pi2_coeff_data;
 1553|       |
 1554|  37.4k|                SET_BIT(ps_cur_mb_info->u1_yuv_dc_block_flag,(i+1));
  ------------------
  |  |  106|  37.4k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
 1555|  37.4k|            }
 1556|  8.92k|            else
 1557|  8.92k|            {
 1558|  8.92k|                CLEARBIT(u1_top_dc_csbp, i);
  ------------------
  |  |   55|  8.92k|#define CLEARBIT(a,i) ((a) &= ~(1 << i))
  ------------------
 1559|  8.92k|                CLEARBIT(u1_left_dc_csbp, i);
  ------------------
  |  |   55|  8.92k|#define CLEARBIT(a,i) ((a) &= ~(1 << i))
  ------------------
 1560|  8.92k|            }
 1561|  46.3k|        }
 1562|       |
 1563|       |        /*********************************************************************/
 1564|       |        /*                   Update the DC csbp                              */
 1565|       |        /*********************************************************************/
 1566|  23.1k|        ps_dec->pu1_left_yuv_dc_csbp[0] &= 0x1;
 1567|  23.1k|        p_curr_ctxt->u1_yuv_dc_csbp &= 0x1;
 1568|  23.1k|        ps_dec->pu1_left_yuv_dc_csbp[0] |= (u1_left_dc_csbp << 1);
 1569|  23.1k|        p_curr_ctxt->u1_yuv_dc_csbp |= (u1_top_dc_csbp << 1);
 1570|  23.1k|        if(u1_cbp == CBPC_ACZERO)
  ------------------
  |  |  508|  23.1k|#define CBPC_ACZERO     1
  ------------------
  |  Branch (1570:12): [True: 10.0k, False: 13.0k]
  ------------------
 1571|  10.0k|        {
 1572|  10.0k|            *(UWORD32 *)(pu1_top_nnz) = 0;
 1573|  10.0k|            *(UWORD32 *)(pu1_left_nnz) = 0;
 1574|  10.0k|            return (0);
 1575|  10.0k|        }
 1576|       |        /*--------------------------------------------------------------------*/
 1577|       |        /* Decode Chroma AC values                                            */
 1578|       |        /*--------------------------------------------------------------------*/
 1579|  13.0k|        {
 1580|  13.0k|            UWORD32 u4_temp;
 1581|       |            /*****************************************************************/
 1582|       |            /* U Block  residual decoding, check cbp and proceed (subblock=0)*/
 1583|       |            /*****************************************************************/
 1584|  13.0k|            u2_chroma_csbp = ih264d_cabac_parse_8x8block(pi2_coeff_block, 2,
 1585|  13.0k|            CHROMA_AC_CTXCAT,
  ------------------
  |  |   75|  13.0k|#define CHROMA_AC_CTXCAT  4
  ------------------
 1586|  13.0k|                                                         ps_dec, pu1_top_nnz,
 1587|  13.0k|                                                         pu1_left_nnz);
 1588|       |
 1589|  13.0k|            pi2_coeff_block += MB_CHROM_SIZE;
  ------------------
  |  |  564|  13.0k|#define MB_CHROM_SIZE                 64
  ------------------
 1590|       |            /*****************************************************************/
 1591|       |            /* V Block  residual decoding, check cbp and proceed (subblock=1)*/
 1592|       |            /*****************************************************************/
 1593|  13.0k|            u4_temp = ih264d_cabac_parse_8x8block(pi2_coeff_block, 2,
 1594|  13.0k|            CHROMA_AC_CTXCAT,
  ------------------
  |  |   75|  13.0k|#define CHROMA_AC_CTXCAT  4
  ------------------
 1595|  13.0k|                                                  ps_dec, (pu1_top_nnz + 2),
 1596|  13.0k|                                                  (pu1_left_nnz + 2));
 1597|  13.0k|            u2_chroma_csbp |= (u4_temp << 4);
 1598|  13.0k|        }
 1599|       |        /*********************************************************************/
 1600|       |        /*                   Update the AC csbp                              */
 1601|       |        /*********************************************************************/
 1602|  13.0k|        ps_cur_mb_info->u2_chroma_csbp = u2_chroma_csbp;
 1603|  13.0k|    }
 1604|       |
 1605|      0|    return (0);
 1606|  23.1k|}

ih264d_uev:
   78|   234k|{
   79|   234k|    UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
   80|   234k|    UWORD32 u4_word, u4_ldz;
   81|       |
   82|       |    /***************************************************************/
   83|       |    /* Find leading zeros in next 32 bits                          */
   84|       |    /***************************************************************/
   85|   234k|    NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|   234k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|   234k|{                                                                           \
  |  |  152|   234k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|   234k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|   234k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|   234k|                                                                            \
  |  |  156|   234k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|   234k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 192k, False: 42.3k]
  |  |  ------------------
  |  |  158|   234k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|   192k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|   234k|}
  ------------------
   86|   234k|    u4_ldz = CLZ(u4_word);
   87|       |    /* Flush the ps_bitstrm */
   88|   234k|    u4_bitstream_offset += (u4_ldz + 1);
   89|       |    /* Read the suffix from the ps_bitstrm */
   90|   234k|    u4_word = 0;
   91|   234k|    if(u4_ldz)
  ------------------
  |  Branch (91:8): [True: 103k, False: 130k]
  ------------------
   92|   103k|        GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|   103k|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|   103k|{                                                                           \
  |  |  122|   103k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|   103k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|   103k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|   103k|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|   103k|                                                                            \
  |  |  127|   103k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 101k, False: 1.89k]
  |  |  ------------------
  |  |  128|   103k|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|   101k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|   103k|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|   103k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|   103k|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|   103k|}                                                                           \
  ------------------
   93|   234k|    *pu4_bitstrm_ofst = u4_bitstream_offset;
   94|   234k|    return ((1 << u4_ldz) + u4_word - 1);
   95|   234k|}
ih264d_sev:
  123|  96.0k|{
  124|  96.0k|    UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  125|  96.0k|    UWORD32 u4_word, u4_ldz, u4_abs_val;
  126|       |
  127|       |    /***************************************************************/
  128|       |    /* Find leading zeros in next 32 bits                          */
  129|       |    /***************************************************************/
  130|  96.0k|    NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|  96.0k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|  96.0k|{                                                                           \
  |  |  152|  96.0k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|  96.0k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|  96.0k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|  96.0k|                                                                            \
  |  |  156|  96.0k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|  96.0k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 92.2k, False: 3.87k]
  |  |  ------------------
  |  |  158|  96.0k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|  92.2k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|  96.0k|}
  ------------------
  131|  96.0k|    u4_ldz = CLZ(u4_word);
  132|       |
  133|       |    /* Flush the ps_bitstrm */
  134|  96.0k|    u4_bitstream_offset += (u4_ldz + 1);
  135|       |
  136|       |    /* Read the suffix from the ps_bitstrm */
  137|  96.0k|    u4_word = 0;
  138|  96.0k|    if(u4_ldz)
  ------------------
  |  Branch (138:8): [True: 54.6k, False: 41.3k]
  ------------------
  139|  54.6k|        GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|  54.6k|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|  54.6k|{                                                                           \
  |  |  122|  54.6k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|  54.6k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|  54.6k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|  54.6k|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|  54.6k|                                                                            \
  |  |  127|  54.6k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 53.4k, False: 1.24k]
  |  |  ------------------
  |  |  128|  54.6k|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  53.4k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|  54.6k|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  54.6k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|  54.6k|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|  54.6k|}                                                                           \
  ------------------
  140|       |
  141|  96.0k|    *pu4_bitstrm_ofst = u4_bitstream_offset;
  142|  96.0k|    u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1;
  143|       |
  144|  96.0k|    if(u4_word & 0x1)
  ------------------
  |  Branch (144:8): [True: 39.1k, False: 56.9k]
  ------------------
  145|  39.1k|        return (-(WORD32)u4_abs_val);
  146|  56.9k|    else
  147|  56.9k|        return (u4_abs_val);
  148|  96.0k|}
ih264d_tev_range1:
  176|  4.29k|{
  177|  4.29k|    UWORD32 u4_code;
  178|  4.29k|    GETBIT(u4_code, *pu4_bitstrm_ofst, pu4_bitstrm_buf);
  ------------------
  |  |  105|  4.29k|#define   GETBIT(u4_code, u4_offset, pu4_bitstream)                         \
  |  |  106|  4.29k|{                                                                           \
  |  |  107|  4.29k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  108|  4.29k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  109|  4.29k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  110|  4.29k|    u4_code = pu4_buf[u4_word_off] << u4_bit_off;                           \
  |  |  111|  4.29k|    (u4_offset)++;                                                          \
  |  |  112|  4.29k|    u4_code = (u4_code >> 31);                                              \
  |  |  113|  4.29k|}
  ------------------
  179|  4.29k|    return (!u4_code);
  180|  4.29k|}
ih264d_cavlc_4x4res_block_totalcoeff_1:
  305|  3.57k|{
  306|       |
  307|  3.57k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  308|  3.57k|    UWORD32 u4_bitstream_offset = ps_bitstrm->u4_ofst;
  309|  3.57k|    UWORD32 u4_trailing_ones = u4_total_coeff_trail_one & 0xFFFF;
  310|  3.57k|    WORD32 i2_level;
  311|  3.57k|    UWORD32 u4_tot_zero, u4_ldz, u4_scan_pos;
  312|       |
  313|  3.57k|    tu_sblk4x4_coeff_data_t *ps_tu_4x4;
  314|  3.57k|    WORD16 *pi2_coeff_data;
  315|  3.57k|    dec_struct_t *ps_dec = (dec_struct_t *)ps_bitstrm->pv_codec_handle;
  316|       |
  317|  3.57k|    ps_tu_4x4 = (tu_sblk4x4_coeff_data_t *)ps_dec->pv_parse_tu_coeff_data;
  318|  3.57k|    ps_tu_4x4->u2_sig_coeff_map = 0;
  319|  3.57k|    pi2_coeff_data = &ps_tu_4x4->ai2_level[0];
  320|       |
  321|       |
  322|  3.57k|    if(u4_trailing_ones)
  ------------------
  |  Branch (322:8): [True: 3.49k, False: 71]
  ------------------
  323|  3.49k|    {
  324|  3.49k|        UWORD32 u4_sign;
  325|       |        /****************************************************************/
  326|       |        /* Decode Trailing One as in section 9.2.2                      */
  327|       |        /****************************************************************/
  328|  3.49k|        GETBIT(u4_sign, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  105|  3.49k|#define   GETBIT(u4_code, u4_offset, pu4_bitstream)                         \
  |  |  106|  3.49k|{                                                                           \
  |  |  107|  3.49k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  108|  3.49k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  109|  3.49k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  110|  3.49k|    u4_code = pu4_buf[u4_word_off] << u4_bit_off;                           \
  |  |  111|  3.49k|    (u4_offset)++;                                                          \
  |  |  112|  3.49k|    u4_code = (u4_code >> 31);                                              \
  |  |  113|  3.49k|}
  ------------------
  329|  3.49k|        i2_level = u4_sign ? -1 : 1;
  ------------------
  |  Branch (329:20): [True: 2.82k, False: 676]
  ------------------
  330|  3.49k|    }
  331|     71|    else
  332|     71|    {
  333|       |        /****************************************************************/
  334|       |        /* Decoding Level based on prefix and suffix  as in 9.2.2       */
  335|       |        /****************************************************************/
  336|     71|        UWORD32 u4_lev_suffix, u4_lev_suffix_size;
  337|     71|        WORD32 u2_lev_code, u2_abs_value;
  338|     71|        UWORD32 u4_lev_prefix;
  339|       |        /***************************************************************/
  340|       |        /* Find leading zeros in next 32 bits                          */
  341|       |        /***************************************************************/
  342|     71|        FIND_ONE_IN_STREAM_32(u4_lev_prefix, u4_bitstream_offset,
  ------------------
  |  |  165|     71|#define   FIND_ONE_IN_STREAM_32(u4_ldz, u4_offset, pu4_bitstream)           \
  |  |  166|     71|{                                                                           \
  |  |  167|     71|    UWORD32 u4_word;                                                        \
  |  |  168|     71|    NEXTBITS_32(u4_word, u4_offset, pu4_bitstream);                         \
  |  |  ------------------
  |  |  |  |  150|     71|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  |  |  151|     71|{                                                                           \
  |  |  |  |  152|     71|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  153|     71|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  154|     71|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  155|     71|                                                                            \
  |  |  |  |  156|     71|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  157|     71|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (157:8): [True: 71, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  158|     71|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|     71|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  159|     71|}
  |  |  ------------------
  |  |  169|     71|    u4_ldz = CLZ(u4_word);                                     \
  |  |  170|     71|    (u4_offset) += (u4_ldz + 1);                                            \
  |  |  171|     71|}
  ------------------
  343|     71|                              pu4_bitstrm_buf);
  344|     71|        u2_lev_code = (2 + MIN(u4_lev_prefix, 15));
  ------------------
  |  |   61|     71|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 11, False: 60]
  |  |  ------------------
  ------------------
  345|       |
  346|     71|        if(14 == u4_lev_prefix)
  ------------------
  |  Branch (346:12): [True: 0, False: 71]
  ------------------
  347|      0|            u4_lev_suffix_size = 4;
  348|     71|        else if(15 <= u4_lev_prefix)
  ------------------
  |  Branch (348:17): [True: 60, False: 11]
  ------------------
  349|     60|        {
  350|     60|            u2_lev_code += 15;
  351|     60|            u4_lev_suffix_size = u4_lev_prefix - 3;
  352|     60|        }
  353|     11|        else
  354|     11|            u4_lev_suffix_size = 0;
  355|       |
  356|       |        //HP_LEVEL_PREFIX
  357|     71|        if(16 <= u4_lev_prefix)
  ------------------
  |  Branch (357:12): [True: 60, False: 11]
  ------------------
  358|     60|        {
  359|     60|            u2_lev_code += ((1 << (u4_lev_prefix - 3)) - 4096);
  360|     60|        }
  361|     71|        if(u4_lev_suffix_size)
  ------------------
  |  Branch (361:12): [True: 60, False: 11]
  ------------------
  362|     60|        {
  363|     60|            GETBITS(u4_lev_suffix, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|     60|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|     60|{                                                                           \
  |  |  122|     60|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|     60|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|     60|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|     60|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|     60|                                                                            \
  |  |  127|     60|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 60, False: 0]
  |  |  ------------------
  |  |  128|     60|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|     60|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|     60|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|     60|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|     60|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|     60|}                                                                           \
  ------------------
  364|     60|                    u4_lev_suffix_size);
  365|     60|            u2_lev_code += u4_lev_suffix;
  366|     60|        }
  367|       |
  368|     71|        u2_abs_value = (u2_lev_code + 2) >> 1;
  369|       |        /*********************************************************/
  370|       |        /* If Level code is odd, level is negative else positive */
  371|       |        /*********************************************************/
  372|     71|        i2_level = (u2_lev_code & 1) ? -u2_abs_value : u2_abs_value;
  ------------------
  |  Branch (372:20): [True: 2, False: 69]
  ------------------
  373|       |
  374|     71|    }
  375|       |
  376|       |    /****************************************************************/
  377|       |    /* Decoding total zeros as in section 9.2.3, table 9.7          */
  378|       |    /****************************************************************/
  379|  3.57k|    FIND_ONE_IN_STREAM_LEN(u4_ldz, u4_bitstream_offset, pu4_bitstrm_buf, 8);
  ------------------
  |  |  176|  3.57k|#define   FIND_ONE_IN_STREAM_LEN(u4_ldz, u4_offset, pu4_bitstream, u4_len)  \
  |  |  177|  3.57k|{                                                                           \
  |  |  178|  3.57k|    UWORD32 u4_word;                                                        \
  |  |  179|  3.57k|    NEXTBITS_32(u4_word, u4_offset, pu4_bitstream);                         \
  |  |  ------------------
  |  |  |  |  150|  3.57k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  |  |  151|  3.57k|{                                                                           \
  |  |  |  |  152|  3.57k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  153|  3.57k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  154|  3.57k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  155|  3.57k|                                                                            \
  |  |  |  |  156|  3.57k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  157|  3.57k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (157:8): [True: 3.51k, False: 58]
  |  |  |  |  ------------------
  |  |  |  |  158|  3.57k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  3.51k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  159|  3.57k|}
  |  |  ------------------
  |  |  180|  3.57k|    u4_ldz = CLZ(u4_word);                                     \
  |  |  181|  3.57k|    if(u4_ldz < u4_len)                                                     \
  |  |  ------------------
  |  |  |  Branch (181:8): [True: 3.49k, False: 72]
  |  |  ------------------
  |  |  182|  3.57k|    (u4_offset) += (u4_ldz + 1);                                            \
  |  |  183|  3.57k|    else                                                                    \
  |  |  184|  3.57k|    {                                                                       \
  |  |  185|     72|        u4_ldz = u4_len;                                                    \
  |  |  186|     72|        (u4_offset) += u4_ldz;                                              \
  |  |  187|     72|    }                                                                       \
  |  |  188|  3.57k|}
  ------------------
  380|       |
  381|  3.57k|    if(u4_ldz)
  ------------------
  |  Branch (381:8): [True: 2.99k, False: 578]
  ------------------
  382|  2.99k|    {
  383|  2.99k|        GETBIT(u4_tot_zero, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  105|  2.99k|#define   GETBIT(u4_code, u4_offset, pu4_bitstream)                         \
  |  |  106|  2.99k|{                                                                           \
  |  |  107|  2.99k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  108|  2.99k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  109|  2.99k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  110|  2.99k|    u4_code = pu4_buf[u4_word_off] << u4_bit_off;                           \
  |  |  111|  2.99k|    (u4_offset)++;                                                          \
  |  |  112|  2.99k|    u4_code = (u4_code >> 31);                                              \
  |  |  113|  2.99k|}
  ------------------
  384|  2.99k|        u4_tot_zero = (u4_ldz << 1) - u4_tot_zero;
  385|  2.99k|    }
  386|    578|    else
  387|    578|        u4_tot_zero = 0;
  388|       |
  389|       |    /***********************************************************************/
  390|       |    /* Inverse scan and store  residual coeff. Update the bitstream u4_ofst */
  391|       |    /***********************************************************************/
  392|  3.57k|    u4_scan_pos = u4_tot_zero + u4_isdc;
  393|  3.57k|    if(u4_scan_pos > 15)
  ------------------
  |  Branch (393:8): [True: 72, False: 3.49k]
  ------------------
  394|     72|        return -1;
  395|       |
  396|  3.49k|    SET_BIT(ps_tu_4x4->u2_sig_coeff_map, u4_scan_pos);
  ------------------
  |  |  106|  3.49k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
  397|  3.49k|    *pi2_coeff_data++ = i2_level;
  398|       |
  399|       |
  400|  3.49k|    {
  401|  3.49k|        WORD32 offset;
  402|  3.49k|        offset = (UWORD8 *)pi2_coeff_data - (UWORD8 *)ps_tu_4x4;
  403|  3.49k|        offset = ALIGN4(offset);
  ------------------
  |  |   52|  3.49k|#define ALIGN4(x)   ((((x) + 3) >> 2) << 2)
  ------------------
  404|  3.49k|        ps_dec->pv_parse_tu_coeff_data = (void *)((UWORD8 *)ps_dec->pv_parse_tu_coeff_data + offset);
  405|  3.49k|    }
  406|       |
  407|  3.49k|    ps_bitstrm->u4_ofst = u4_bitstream_offset;
  408|  3.49k|    return 0;
  409|  3.57k|}
ih264d_cavlc_4x4res_block_totalcoeff_2to10:
  439|  2.82k|{
  440|  2.82k|    UWORD32 u4_total_zeroes;
  441|  2.82k|    WORD32 i;
  442|  2.82k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  443|  2.82k|    UWORD32 u4_bitstream_offset = ps_bitstrm->u4_ofst;
  444|  2.82k|    UWORD32 u4_trailing_ones = u4_total_coeff_trail_one & 0xFFFF;
  445|  2.82k|    UWORD32 u4_total_coeff = u4_total_coeff_trail_one >> 16;
  446|       |    // To avoid error check at 4x4 level, allocating for 3 extra levels(16+3)
  447|       |    // since u4_trailing_ones can at the max be 3. This will be required when
  448|       |    // u4_total_coeff is less than u4_trailing_ones
  449|  2.82k|    WORD16 ai2_level_arr[19];
  450|  2.82k|    WORD16 *i2_level_arr = &ai2_level_arr[3];
  451|       |
  452|  2.82k|    tu_sblk4x4_coeff_data_t *ps_tu_4x4;
  453|  2.82k|    WORD16 *pi2_coeff_data;
  454|  2.82k|    dec_struct_t *ps_dec = (dec_struct_t *)ps_bitstrm->pv_codec_handle;
  455|       |
  456|  2.82k|    ps_tu_4x4 = (tu_sblk4x4_coeff_data_t *)ps_dec->pv_parse_tu_coeff_data;
  457|  2.82k|    ps_tu_4x4->u2_sig_coeff_map = 0;
  458|  2.82k|    pi2_coeff_data = &ps_tu_4x4->ai2_level[0];
  459|       |
  460|  2.82k|    i = u4_total_coeff - 1;
  461|       |
  462|  2.82k|    if(u4_trailing_ones)
  ------------------
  |  Branch (462:8): [True: 2.76k, False: 60]
  ------------------
  463|  2.76k|    {
  464|       |        /*********************************************************************/
  465|       |        /* Decode Trailing Ones                                              */
  466|       |        /* read the sign of T1's and put them in level array                 */
  467|       |        /*********************************************************************/
  468|  2.76k|        UWORD32 u4_signs, u4_cnt = u4_trailing_ones;
  469|  2.76k|        WORD16 (*ppi2_trlone_lkup)[3] =
  470|  2.76k|                        (WORD16 (*)[3])gai2_ih264d_trailing_one_level;
  471|  2.76k|        WORD16 *pi2_trlone_lkup;
  472|       |
  473|  2.76k|        GETBITS(u4_signs, u4_bitstream_offset, pu4_bitstrm_buf, u4_cnt);
  ------------------
  |  |  120|  2.76k|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|  2.76k|{                                                                           \
  |  |  122|  2.76k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|  2.76k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|  2.76k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|  2.76k|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|  2.76k|                                                                            \
  |  |  127|  2.76k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 2.59k, False: 168]
  |  |  ------------------
  |  |  128|  2.76k|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  2.59k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|  2.76k|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  2.76k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|  2.76k|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|  2.76k|}                                                                           \
  ------------------
  474|       |
  475|  2.76k|        pi2_trlone_lkup = ppi2_trlone_lkup[(1 << u4_cnt) - 2 + u4_signs];
  476|       |
  477|  8.68k|        while(u4_cnt)
  ------------------
  |  Branch (477:15): [True: 5.92k, False: 2.76k]
  ------------------
  478|  5.92k|        {
  479|  5.92k|            i2_level_arr[i--] = *pi2_trlone_lkup++;
  480|  5.92k|            u4_cnt--;
  481|  5.92k|        }
  482|  2.76k|    }
  483|       |
  484|       |    /****************************************************************/
  485|       |    /* Decoding Levels Begins                                       */
  486|       |    /****************************************************************/
  487|  2.82k|    if(i >= 0)
  ------------------
  |  Branch (487:8): [True: 406, False: 2.41k]
  ------------------
  488|    406|    {
  489|       |        /****************************************************************/
  490|       |        /* First level is decoded outside the loop as it has lot of     */
  491|       |        /* special cases.                                               */
  492|       |        /****************************************************************/
  493|    406|        UWORD32 u4_lev_suffix, u4_suffix_len, u4_lev_suffix_size;
  494|    406|        WORD32 u2_lev_code, u2_abs_value;
  495|    406|        UWORD32 u4_lev_prefix;
  496|       |
  497|       |        /***************************************************************/
  498|       |        /* u4_suffix_len = 0,  Find leading zeros in next 32 bits      */
  499|       |        /***************************************************************/
  500|    406|        FIND_ONE_IN_STREAM_32(u4_lev_prefix, u4_bitstream_offset,
  ------------------
  |  |  165|    406|#define   FIND_ONE_IN_STREAM_32(u4_ldz, u4_offset, pu4_bitstream)           \
  |  |  166|    406|{                                                                           \
  |  |  167|    406|    UWORD32 u4_word;                                                        \
  |  |  168|    406|    NEXTBITS_32(u4_word, u4_offset, pu4_bitstream);                         \
  |  |  ------------------
  |  |  |  |  150|    406|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  |  |  151|    406|{                                                                           \
  |  |  |  |  152|    406|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  153|    406|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  154|    406|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  155|    406|                                                                            \
  |  |  |  |  156|    406|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  157|    406|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (157:8): [True: 401, False: 5]
  |  |  |  |  ------------------
  |  |  |  |  158|    406|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|    401|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  159|    406|}
  |  |  ------------------
  |  |  169|    406|    u4_ldz = CLZ(u4_word);                                     \
  |  |  170|    406|    (u4_offset) += (u4_ldz + 1);                                            \
  |  |  171|    406|}
  ------------------
  501|    406|                              pu4_bitstrm_buf);
  502|       |
  503|       |        /*********************************************************/
  504|       |        /* Special decoding case when trailing ones are 3        */
  505|       |        /*********************************************************/
  506|    406|        u2_lev_code = MIN(15, u4_lev_prefix);
  ------------------
  |  |   61|    406|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 64, False: 342]
  |  |  ------------------
  ------------------
  507|       |
  508|    406|        u2_lev_code += (3 == u4_trailing_ones) ? 0 : 2;
  ------------------
  |  Branch (508:24): [True: 212, False: 194]
  ------------------
  509|       |
  510|    406|        if(14 == u4_lev_prefix)
  ------------------
  |  Branch (510:12): [True: 0, False: 406]
  ------------------
  511|      0|            u4_lev_suffix_size = 4;
  512|    406|        else if(15 <= u4_lev_prefix)
  ------------------
  |  Branch (512:17): [True: 64, False: 342]
  ------------------
  513|     64|        {
  514|     64|            u2_lev_code += 15;
  515|     64|            u4_lev_suffix_size = u4_lev_prefix - 3;
  516|     64|        }
  517|    342|        else
  518|    342|            u4_lev_suffix_size = 0;
  519|       |
  520|       |        //HP_LEVEL_PREFIX
  521|    406|        if(16 <= u4_lev_prefix)
  ------------------
  |  Branch (521:12): [True: 64, False: 342]
  ------------------
  522|     64|        {
  523|     64|            u2_lev_code += ((1 << (u4_lev_prefix - 3)) - 4096);
  524|     64|        }
  525|    406|        if(u4_lev_suffix_size)
  ------------------
  |  Branch (525:12): [True: 64, False: 342]
  ------------------
  526|     64|        {
  527|     64|            GETBITS(u4_lev_suffix, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|     64|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|     64|{                                                                           \
  |  |  122|     64|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|     64|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|     64|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|     64|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|     64|                                                                            \
  |  |  127|     64|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 64, False: 0]
  |  |  ------------------
  |  |  128|     64|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|     64|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|     64|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|     64|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|     64|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|     64|}                                                                           \
  ------------------
  528|     64|                    u4_lev_suffix_size);
  529|     64|            u2_lev_code += u4_lev_suffix;
  530|     64|        }
  531|       |
  532|    406|        u2_abs_value = (u2_lev_code + 2) >> 1;
  533|       |        /*********************************************************/
  534|       |        /* If Level code is odd, level is negative else positive */
  535|       |        /*********************************************************/
  536|    406|        i2_level_arr[i--] = (u2_lev_code & 1) ? -u2_abs_value : u2_abs_value;
  ------------------
  |  Branch (536:29): [True: 115, False: 291]
  ------------------
  537|       |
  538|    406|        u4_suffix_len = (u2_abs_value > 3) ? 2 : 1;
  ------------------
  |  Branch (538:25): [True: 77, False: 329]
  ------------------
  539|       |
  540|       |        /*********************************************************/
  541|       |        /* Now loop over the remaining levels                    */
  542|       |        /*********************************************************/
  543|  1.16k|        while(i >= 0)
  ------------------
  |  Branch (543:15): [True: 754, False: 406]
  ------------------
  544|    754|        {
  545|       |
  546|       |            /***************************************************************/
  547|       |            /* Find leading zeros in next 32 bits                          */
  548|       |            /***************************************************************/
  549|    754|            FIND_ONE_IN_STREAM_32(u4_lev_prefix, u4_bitstream_offset,
  ------------------
  |  |  165|    754|#define   FIND_ONE_IN_STREAM_32(u4_ldz, u4_offset, pu4_bitstream)           \
  |  |  166|    754|{                                                                           \
  |  |  167|    754|    UWORD32 u4_word;                                                        \
  |  |  168|    754|    NEXTBITS_32(u4_word, u4_offset, pu4_bitstream);                         \
  |  |  ------------------
  |  |  |  |  150|    754|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  |  |  151|    754|{                                                                           \
  |  |  |  |  152|    754|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  153|    754|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  154|    754|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  155|    754|                                                                            \
  |  |  |  |  156|    754|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  157|    754|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (157:8): [True: 744, False: 10]
  |  |  |  |  ------------------
  |  |  |  |  158|    754|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|    744|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  159|    754|}
  |  |  ------------------
  |  |  169|    754|    u4_ldz = CLZ(u4_word);                                     \
  |  |  170|    754|    (u4_offset) += (u4_ldz + 1);                                            \
  |  |  171|    754|}
  ------------------
  550|    754|                                  pu4_bitstrm_buf);
  551|       |
  552|    754|            u4_lev_suffix_size =
  553|    754|                            (15 <= u4_lev_prefix) ?
  ------------------
  |  Branch (553:29): [True: 154, False: 600]
  ------------------
  554|    600|                                            (u4_lev_prefix - 3) : u4_suffix_len;
  555|       |
  556|       |            /*********************************************************/
  557|       |            /* Compute level code using prefix and suffix            */
  558|       |            /*********************************************************/
  559|    754|            GETBITS(u4_lev_suffix, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|    754|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    754|{                                                                           \
  |  |  122|    754|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    754|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    754|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    754|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    754|                                                                            \
  |  |  127|    754|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 732, False: 22]
  |  |  ------------------
  |  |  128|    754|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    732|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    754|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    754|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    754|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    754|}                                                                           \
  ------------------
  560|    754|                    u4_lev_suffix_size);
  561|    754|            u2_lev_code = (MIN(15,u4_lev_prefix) << u4_suffix_len)
  ------------------
  |  |   61|    754|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 153, False: 601]
  |  |  ------------------
  ------------------
  562|    754|                            + u4_lev_suffix;
  563|       |
  564|       |            //HP_LEVEL_PREFIX
  565|    754|            if(16 <= u4_lev_prefix)
  ------------------
  |  Branch (565:16): [True: 153, False: 601]
  ------------------
  566|    153|            {
  567|    153|                u2_lev_code += ((1 << (u4_lev_prefix - 3)) - 4096);
  568|    153|            }
  569|    754|            u2_abs_value = (u2_lev_code + 2) >> 1;
  570|       |
  571|       |            /*********************************************************/
  572|       |            /* If Level code is odd, level is negative else positive */
  573|       |            /*********************************************************/
  574|    754|            i2_level_arr[i--] =
  575|    754|                            (u2_lev_code & 1) ? -u2_abs_value : u2_abs_value;
  ------------------
  |  Branch (575:29): [True: 273, False: 481]
  ------------------
  576|       |
  577|       |            /*********************************************************/
  578|       |            /* Increment suffix length if required                   */
  579|       |            /*********************************************************/
  580|    754|            u4_suffix_len +=
  581|    754|                            (u4_suffix_len < 6) ?
  ------------------
  |  Branch (581:29): [True: 692, False: 62]
  ------------------
  582|    692|                                            (u2_abs_value
  583|    692|                                                            > (3
  584|    692|                                                                            << (u4_suffix_len
  585|    692|                                                                                            - 1))) :
  586|    754|                                            0;
  587|    754|        }
  588|       |
  589|       |        /****************************************************************/
  590|       |        /* Decoding Levels Ends                                         */
  591|       |        /****************************************************************/
  592|    406|    }
  593|       |
  594|       |    /****************************************************************/
  595|       |    /* Decoding total zeros as in section 9.2.3, table 9.7          */
  596|       |    /****************************************************************/
  597|  2.82k|    {
  598|  2.82k|        UWORD32 u4_index;
  599|  2.82k|        const UWORD8 (*ppu1_total_zero_lkup)[64] =
  600|  2.82k|                        (const UWORD8 (*)[64])gau1_ih264d_table_total_zero_2to10;
  601|       |
  602|  2.82k|        NEXTBITS(u4_index, u4_bitstream_offset, pu4_bitstrm_buf, 6);
  ------------------
  |  |  137|  2.82k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|  2.82k|{                                                                           \
  |  |  139|  2.82k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|  2.82k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|  2.82k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|  2.82k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|  2.82k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 2.79k, False: 31]
  |  |  ------------------
  |  |  144|  2.82k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  2.79k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|  2.82k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  2.82k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|  2.82k|}
  ------------------
  603|  2.82k|        u4_total_zeroes = ppu1_total_zero_lkup[u4_total_coeff - 2][u4_index];
  604|       |
  605|  2.82k|        FLUSHBITS(u4_bitstream_offset, (u4_total_zeroes >> 4));
  ------------------
  |  |  193|  2.82k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|  2.82k|{                                                                           \
  |  |  195|  2.82k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|  2.82k|}
  ------------------
  606|  2.82k|        u4_total_zeroes &= 0xf;
  607|  2.82k|    }
  608|       |
  609|       |    /**************************************************************/
  610|       |    /* Decode the runs and form the coefficient buffer            */
  611|       |    /**************************************************************/
  612|  2.82k|    {
  613|  2.82k|        const UWORD8 *pu1_table_runbefore;
  614|  2.82k|        UWORD32 u4_run;
  615|  2.82k|        WORD32 k;
  616|  2.82k|        WORD32 u4_scan_pos = u4_total_coeff + u4_total_zeroes - 1 + u4_isdc;
  617|  2.82k|        WORD32 u4_zeroes_left = u4_total_zeroes;
  618|  2.82k|        k = u4_total_coeff - 1;
  619|       |
  620|       |        /**************************************************************/
  621|       |        /* Decoding Runs Begin for zeros left > 6                     */
  622|       |        /**************************************************************/
  623|  3.22k|        while((u4_zeroes_left > 6) && k)
  ------------------
  |  Branch (623:15): [True: 465, False: 2.75k]
  |  Branch (623:39): [True: 401, False: 64]
  ------------------
  624|    401|        {
  625|    401|            UWORD32 u4_code;
  626|       |
  627|    401|            NEXTBITS(u4_code, u4_bitstream_offset, pu4_bitstrm_buf, 3);
  ------------------
  |  |  137|    401|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|    401|{                                                                           \
  |  |  139|    401|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|    401|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|    401|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|    401|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|    401|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 370, False: 31]
  |  |  ------------------
  |  |  144|    401|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    370|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|    401|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    401|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|    401|}
  ------------------
  628|       |
  629|    401|            if(u4_code != 0)
  ------------------
  |  Branch (629:16): [True: 288, False: 113]
  ------------------
  630|    288|            {
  631|    288|                FLUSHBITS(u4_bitstream_offset, 3);
  ------------------
  |  |  193|    288|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|    288|{                                                                           \
  |  |  195|    288|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|    288|}
  ------------------
  632|    288|                u4_run = (7 - u4_code);
  633|    288|            }
  634|    113|            else
  635|    113|            {
  636|       |
  637|    113|                FIND_ONE_IN_STREAM_LEN(u4_code, u4_bitstream_offset,
  ------------------
  |  |  176|    113|#define   FIND_ONE_IN_STREAM_LEN(u4_ldz, u4_offset, pu4_bitstream, u4_len)  \
  |  |  177|    113|{                                                                           \
  |  |  178|    113|    UWORD32 u4_word;                                                        \
  |  |  179|    113|    NEXTBITS_32(u4_word, u4_offset, pu4_bitstream);                         \
  |  |  ------------------
  |  |  |  |  150|    113|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  |  |  151|    113|{                                                                           \
  |  |  |  |  152|    113|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  153|    113|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  154|    113|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  155|    113|                                                                            \
  |  |  |  |  156|    113|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  157|    113|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (157:8): [True: 111, False: 2]
  |  |  |  |  ------------------
  |  |  |  |  158|    113|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|    111|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  159|    113|}
  |  |  ------------------
  |  |  180|    113|    u4_ldz = CLZ(u4_word);                                     \
  |  |  181|    113|    if(u4_ldz < u4_len)                                                     \
  |  |  ------------------
  |  |  |  Branch (181:8): [True: 104, False: 9]
  |  |  ------------------
  |  |  182|    113|    (u4_offset) += (u4_ldz + 1);                                            \
  |  |  183|    113|    else                                                                    \
  |  |  184|    113|    {                                                                       \
  |  |  185|      9|        u4_ldz = u4_len;                                                    \
  |  |  186|      9|        (u4_offset) += u4_ldz;                                              \
  |  |  187|      9|    }                                                                       \
  |  |  188|    113|}
  ------------------
  638|    113|                                       pu4_bitstrm_buf, 11);
  639|    113|                u4_run = (4 + u4_code);
  640|    113|            }
  641|       |
  642|    401|            SET_BIT(ps_tu_4x4->u2_sig_coeff_map, u4_scan_pos);
  ------------------
  |  |  106|    401|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
  643|    401|            *pi2_coeff_data++ = i2_level_arr[k--];
  644|    401|            u4_zeroes_left -= (WORD32)u4_run;
  645|    401|            u4_scan_pos -= (WORD32)(u4_run + 1);
  646|    401|        }
  647|       |
  648|  2.82k|        if (u4_zeroes_left < 0 || u4_scan_pos < 0)
  ------------------
  |  Branch (648:13): [True: 11, False: 2.81k]
  |  Branch (648:35): [True: 0, False: 2.81k]
  ------------------
  649|     11|            return -1;
  650|       |
  651|       |        /**************************************************************/
  652|       |        /* Decoding Runs for 0 < zeros left <=6                       */
  653|       |        /**************************************************************/
  654|  2.81k|        pu1_table_runbefore = (UWORD8 *)gau1_ih264d_table_run_before;
  655|  5.98k|        while((u4_zeroes_left > 0) && k)
  ------------------
  |  Branch (655:15): [True: 4.37k, False: 1.61k]
  |  Branch (655:39): [True: 3.17k, False: 1.20k]
  ------------------
  656|  3.17k|        {
  657|  3.17k|            UWORD32 u4_code;
  658|  3.17k|            NEXTBITS(u4_code, u4_bitstream_offset, pu4_bitstrm_buf, 3);
  ------------------
  |  |  137|  3.17k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|  3.17k|{                                                                           \
  |  |  139|  3.17k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|  3.17k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|  3.17k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|  3.17k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|  3.17k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 3.13k, False: 43]
  |  |  ------------------
  |  |  144|  3.17k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  3.13k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|  3.17k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  3.17k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|  3.17k|}
  ------------------
  659|       |
  660|  3.17k|            u4_code = pu1_table_runbefore[u4_code + (u4_zeroes_left << 3)];
  661|  3.17k|            u4_run = u4_code >> 2;
  662|       |
  663|  3.17k|            FLUSHBITS(u4_bitstream_offset, (u4_code & 0x03));
  ------------------
  |  |  193|  3.17k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|  3.17k|{                                                                           \
  |  |  195|  3.17k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|  3.17k|}
  ------------------
  664|       |
  665|  3.17k|            SET_BIT(ps_tu_4x4->u2_sig_coeff_map, u4_scan_pos);
  ------------------
  |  |  106|  3.17k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
  666|  3.17k|            *pi2_coeff_data++ = i2_level_arr[k--];
  667|  3.17k|            u4_zeroes_left -= (WORD32)u4_run;
  668|  3.17k|            u4_scan_pos -= (WORD32)(u4_run + 1);
  669|  3.17k|        }
  670|  2.81k|        if (u4_zeroes_left < 0 || u4_scan_pos < 0)
  ------------------
  |  Branch (670:13): [True: 0, False: 2.81k]
  |  Branch (670:35): [True: 0, False: 2.81k]
  ------------------
  671|      0|            return -1;
  672|       |        /**************************************************************/
  673|       |        /* Decoding Runs End                                          */
  674|       |        /**************************************************************/
  675|       |
  676|       |        /**************************************************************/
  677|       |        /* Copy the remaining coefficients                            */
  678|       |        /**************************************************************/
  679|  6.27k|        while(k >= 0)
  ------------------
  |  Branch (679:15): [True: 3.46k, False: 2.81k]
  ------------------
  680|  3.46k|        {
  681|       |
  682|  3.46k|            SET_BIT(ps_tu_4x4->u2_sig_coeff_map, u4_scan_pos);
  ------------------
  |  |  106|  3.46k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
  683|  3.46k|            *pi2_coeff_data++ = i2_level_arr[k--];
  684|  3.46k|            u4_scan_pos--;
  685|  3.46k|        }
  686|  2.81k|    }
  687|       |
  688|      0|    {
  689|  2.81k|        WORD32 offset;
  690|  2.81k|        offset = (UWORD8 *)pi2_coeff_data - (UWORD8 *)ps_tu_4x4;
  691|  2.81k|        offset = ALIGN4(offset);
  ------------------
  |  |   52|  2.81k|#define ALIGN4(x)   ((((x) + 3) >> 2) << 2)
  ------------------
  692|  2.81k|        ps_dec->pv_parse_tu_coeff_data = (void *)((UWORD8 *)ps_dec->pv_parse_tu_coeff_data + offset);
  693|  2.81k|    }
  694|       |
  695|  2.81k|    ps_bitstrm->u4_ofst = u4_bitstream_offset;
  696|  2.81k|    return 0;
  697|  2.81k|}
ih264d_cavlc_4x4res_block_totalcoeff_11to16:
  727|    261|{
  728|    261|    UWORD32 u4_total_zeroes;
  729|    261|    WORD32 i;
  730|    261|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  731|    261|    UWORD32 u4_bitstream_offset = ps_bitstrm->u4_ofst;
  732|    261|    UWORD32 u4_trailing_ones = u4_total_coeff_trail_one & 0xFFFF;
  733|    261|    UWORD32 u4_total_coeff = u4_total_coeff_trail_one >> 16;
  734|       |    // To avoid error check at 4x4 level, allocating for 3 extra levels(16+3)
  735|       |    // since u4_trailing_ones can at the max be 3. This will be required when
  736|       |    // u4_total_coeff is less than u4_trailing_ones
  737|    261|    WORD16 ai2_level_arr[19];//
  738|    261|    WORD16 *i2_level_arr = &ai2_level_arr[3];
  739|       |
  740|    261|    tu_sblk4x4_coeff_data_t *ps_tu_4x4;
  741|    261|    WORD16 *pi2_coeff_data;
  742|    261|    dec_struct_t *ps_dec = (dec_struct_t *)ps_bitstrm->pv_codec_handle;
  743|       |
  744|    261|    ps_tu_4x4 = (tu_sblk4x4_coeff_data_t *)ps_dec->pv_parse_tu_coeff_data;
  745|    261|    ps_tu_4x4->u2_sig_coeff_map = 0;
  746|    261|    pi2_coeff_data = &ps_tu_4x4->ai2_level[0];
  747|       |
  748|    261|    i = u4_total_coeff - 1;
  749|    261|    if(u4_trailing_ones)
  ------------------
  |  Branch (749:8): [True: 194, False: 67]
  ------------------
  750|    194|    {
  751|       |        /*********************************************************************/
  752|       |        /* Decode Trailing Ones                                              */
  753|       |        /* read the sign of T1's and put them in level array                 */
  754|       |        /*********************************************************************/
  755|    194|        UWORD32 u4_signs, u4_cnt = u4_trailing_ones;
  756|    194|        WORD16 (*ppi2_trlone_lkup)[3] =
  757|    194|                        (WORD16 (*)[3])gai2_ih264d_trailing_one_level;
  758|    194|        WORD16 *pi2_trlone_lkup;
  759|       |
  760|    194|        GETBITS(u4_signs, u4_bitstream_offset, pu4_bitstrm_buf, u4_cnt);
  ------------------
  |  |  120|    194|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    194|{                                                                           \
  |  |  122|    194|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    194|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    194|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    194|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    194|                                                                            \
  |  |  127|    194|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 194, False: 0]
  |  |  ------------------
  |  |  128|    194|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    194|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    194|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    194|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    194|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    194|}                                                                           \
  ------------------
  761|       |
  762|    194|        pi2_trlone_lkup = ppi2_trlone_lkup[(1 << u4_cnt) - 2 + u4_signs];
  763|       |
  764|    693|        while(u4_cnt)
  ------------------
  |  Branch (764:15): [True: 499, False: 194]
  ------------------
  765|    499|        {
  766|    499|            i2_level_arr[i--] = *pi2_trlone_lkup++;
  767|    499|            u4_cnt--;
  768|    499|        }
  769|    194|    }
  770|       |
  771|       |    /****************************************************************/
  772|       |    /* Decoding Levels Begins                                       */
  773|       |    /****************************************************************/
  774|    261|    if(i >= 0)
  ------------------
  |  Branch (774:8): [True: 261, False: 0]
  ------------------
  775|    261|    {
  776|       |        /****************************************************************/
  777|       |        /* First level is decoded outside the loop as it has lot of     */
  778|       |        /* special cases.                                               */
  779|       |        /****************************************************************/
  780|    261|        UWORD32 u4_lev_suffix, u4_suffix_len, u4_lev_suffix_size;
  781|    261|        UWORD16 u2_lev_code, u2_abs_value;
  782|    261|        UWORD32 u4_lev_prefix;
  783|       |
  784|    261|        if(u4_trailing_ones < 3)
  ------------------
  |  Branch (784:12): [True: 141, False: 120]
  ------------------
  785|    141|        {
  786|       |            /*********************************************************/
  787|       |            /* u4_suffix_len = 1                                     */
  788|       |            /*********************************************************/
  789|       |            /***************************************************************/
  790|       |            /* Find leading zeros in next 32 bits                          */
  791|       |            /***************************************************************/
  792|    141|            FIND_ONE_IN_STREAM_32(u4_lev_prefix, u4_bitstream_offset,
  ------------------
  |  |  165|    141|#define   FIND_ONE_IN_STREAM_32(u4_ldz, u4_offset, pu4_bitstream)           \
  |  |  166|    141|{                                                                           \
  |  |  167|    141|    UWORD32 u4_word;                                                        \
  |  |  168|    141|    NEXTBITS_32(u4_word, u4_offset, pu4_bitstream);                         \
  |  |  ------------------
  |  |  |  |  150|    141|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  |  |  151|    141|{                                                                           \
  |  |  |  |  152|    141|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  153|    141|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  154|    141|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  155|    141|                                                                            \
  |  |  |  |  156|    141|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  157|    141|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (157:8): [True: 81, False: 60]
  |  |  |  |  ------------------
  |  |  |  |  158|    141|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|     81|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  159|    141|}
  |  |  ------------------
  |  |  169|    141|    u4_ldz = CLZ(u4_word);                                     \
  |  |  170|    141|    (u4_offset) += (u4_ldz + 1);                                            \
  |  |  171|    141|}
  ------------------
  793|    141|                                  pu4_bitstrm_buf);
  794|       |
  795|    141|            u4_lev_suffix_size =
  796|    141|                            (15 <= u4_lev_prefix) ? (u4_lev_prefix - 3) : 1;
  ------------------
  |  Branch (796:29): [True: 60, False: 81]
  ------------------
  797|       |
  798|    141|            GETBITS(u4_lev_suffix, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|    141|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    141|{                                                                           \
  |  |  122|    141|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    141|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    141|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    141|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    141|                                                                            \
  |  |  127|    141|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 141, False: 0]
  |  |  ------------------
  |  |  128|    141|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    141|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    141|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    141|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    141|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    141|}                                                                           \
  ------------------
  799|    141|                    u4_lev_suffix_size);
  800|    141|            u2_lev_code = 2 + (MIN(u4_lev_prefix,15) << 1) + u4_lev_suffix;
  ------------------
  |  |   61|    141|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 81, False: 60]
  |  |  ------------------
  ------------------
  801|       |
  802|       |            //HP_LEVEL_PREFIX
  803|    141|            if(16 <= u4_lev_prefix)
  ------------------
  |  Branch (803:16): [True: 60, False: 81]
  ------------------
  804|     60|            {
  805|     60|                u2_lev_code += ((1 << (u4_lev_prefix - 3)) - 4096);
  806|     60|            }
  807|    141|        }
  808|    120|        else
  809|    120|        {
  810|       |            /*********************************************************/
  811|       |            /*u4_suffix_len = 0                                      */
  812|       |            /*********************************************************/
  813|       |            /***************************************************************/
  814|       |            /* Find leading zeros in next 32 bits                          */
  815|       |            /***************************************************************/
  816|    120|            FIND_ONE_IN_STREAM_32(u4_lev_prefix, u4_bitstream_offset,
  ------------------
  |  |  165|    120|#define   FIND_ONE_IN_STREAM_32(u4_ldz, u4_offset, pu4_bitstream)           \
  |  |  166|    120|{                                                                           \
  |  |  167|    120|    UWORD32 u4_word;                                                        \
  |  |  168|    120|    NEXTBITS_32(u4_word, u4_offset, pu4_bitstream);                         \
  |  |  ------------------
  |  |  |  |  150|    120|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  |  |  151|    120|{                                                                           \
  |  |  |  |  152|    120|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  153|    120|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  154|    120|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  155|    120|                                                                            \
  |  |  |  |  156|    120|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  157|    120|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (157:8): [True: 120, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  158|    120|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|    120|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  159|    120|}
  |  |  ------------------
  |  |  169|    120|    u4_ldz = CLZ(u4_word);                                     \
  |  |  170|    120|    (u4_offset) += (u4_ldz + 1);                                            \
  |  |  171|    120|}
  ------------------
  817|    120|                                  pu4_bitstrm_buf);
  818|       |
  819|       |            /*********************************************************/
  820|       |            /* Special decoding case when trailing ones are 3        */
  821|       |            /*********************************************************/
  822|    120|            u2_lev_code = MIN(15, u4_lev_prefix);
  ------------------
  |  |   61|    120|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 60, False: 60]
  |  |  ------------------
  ------------------
  823|       |
  824|    120|            u2_lev_code += (3 == u4_trailing_ones) ? 0 : (2);
  ------------------
  |  Branch (824:28): [True: 120, False: 0]
  ------------------
  825|       |
  826|    120|            if(14 == u4_lev_prefix)
  ------------------
  |  Branch (826:16): [True: 0, False: 120]
  ------------------
  827|      0|                u4_lev_suffix_size = 4;
  828|    120|            else if(15 <= u4_lev_prefix)
  ------------------
  |  Branch (828:21): [True: 120, False: 0]
  ------------------
  829|    120|            {
  830|    120|                u2_lev_code += 15;
  831|    120|                u4_lev_suffix_size = (u4_lev_prefix - 3);
  832|    120|            }
  833|      0|            else
  834|      0|                u4_lev_suffix_size = 0;
  835|       |
  836|       |            //HP_LEVEL_PREFIX
  837|    120|            if(16 <= u4_lev_prefix)
  ------------------
  |  Branch (837:16): [True: 60, False: 60]
  ------------------
  838|     60|            {
  839|     60|                u2_lev_code += ((1 << (u4_lev_prefix - 3)) - 4096);
  840|     60|            }
  841|    120|            if(u4_lev_suffix_size)
  ------------------
  |  Branch (841:16): [True: 120, False: 0]
  ------------------
  842|    120|            {
  843|    120|                GETBITS(u4_lev_suffix, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|    120|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    120|{                                                                           \
  |  |  122|    120|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    120|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    120|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    120|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    120|                                                                            \
  |  |  127|    120|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 120, False: 0]
  |  |  ------------------
  |  |  128|    120|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    120|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    120|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    120|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    120|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    120|}                                                                           \
  ------------------
  844|    120|                        u4_lev_suffix_size);
  845|    120|                u2_lev_code += u4_lev_suffix;
  846|    120|            }
  847|    120|        }
  848|       |
  849|    261|        u2_abs_value = (u2_lev_code + 2) >> 1;
  850|       |        /*********************************************************/
  851|       |        /* If Level code is odd, level is negative else positive */
  852|       |        /*********************************************************/
  853|    261|        i2_level_arr[i--] = (u2_lev_code & 1) ? -u2_abs_value : u2_abs_value;
  ------------------
  |  Branch (853:29): [True: 132, False: 129]
  ------------------
  854|       |
  855|    261|        u4_suffix_len = (u2_abs_value > 3) ? 2 : 1;
  ------------------
  |  Branch (855:25): [True: 181, False: 80]
  ------------------
  856|       |
  857|       |        /*********************************************************/
  858|       |        /* Now loop over the remaining levels                    */
  859|       |        /*********************************************************/
  860|  3.16k|        while(i >= 0)
  ------------------
  |  Branch (860:15): [True: 2.90k, False: 261]
  ------------------
  861|  2.90k|        {
  862|       |
  863|       |            /***************************************************************/
  864|       |            /* Find leading zeros in next 32 bits                          */
  865|       |            /***************************************************************/
  866|  2.90k|            FIND_ONE_IN_STREAM_32(u4_lev_prefix, u4_bitstream_offset,
  ------------------
  |  |  165|  2.90k|#define   FIND_ONE_IN_STREAM_32(u4_ldz, u4_offset, pu4_bitstream)           \
  |  |  166|  2.90k|{                                                                           \
  |  |  167|  2.90k|    UWORD32 u4_word;                                                        \
  |  |  168|  2.90k|    NEXTBITS_32(u4_word, u4_offset, pu4_bitstream);                         \
  |  |  ------------------
  |  |  |  |  150|  2.90k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  |  |  151|  2.90k|{                                                                           \
  |  |  |  |  152|  2.90k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  153|  2.90k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  154|  2.90k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  155|  2.90k|                                                                            \
  |  |  |  |  156|  2.90k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  157|  2.90k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (157:8): [True: 2.83k, False: 64]
  |  |  |  |  ------------------
  |  |  |  |  158|  2.90k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  2.83k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  159|  2.90k|}
  |  |  ------------------
  |  |  169|  2.90k|    u4_ldz = CLZ(u4_word);                                     \
  |  |  170|  2.90k|    (u4_offset) += (u4_ldz + 1);                                            \
  |  |  171|  2.90k|}
  ------------------
  867|  2.90k|                                  pu4_bitstrm_buf);
  868|       |
  869|  2.90k|            u4_lev_suffix_size =
  870|  2.90k|                            (15 <= u4_lev_prefix) ?
  ------------------
  |  Branch (870:29): [True: 502, False: 2.40k]
  ------------------
  871|  2.40k|                                            (u4_lev_prefix - 3) : u4_suffix_len;
  872|       |
  873|       |            /*********************************************************/
  874|       |            /* Compute level code using prefix and suffix            */
  875|       |            /*********************************************************/
  876|  2.90k|            GETBITS(u4_lev_suffix, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|  2.90k|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|  2.90k|{                                                                           \
  |  |  122|  2.90k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|  2.90k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|  2.90k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|  2.90k|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|  2.90k|                                                                            \
  |  |  127|  2.90k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 2.72k, False: 180]
  |  |  ------------------
  |  |  128|  2.90k|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  2.72k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|  2.90k|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  2.90k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|  2.90k|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|  2.90k|}                                                                           \
  ------------------
  877|  2.90k|                    u4_lev_suffix_size);
  878|  2.90k|            u2_lev_code = (MIN(15,u4_lev_prefix) << u4_suffix_len)
  ------------------
  |  |   61|  2.90k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 502, False: 2.40k]
  |  |  ------------------
  ------------------
  879|  2.90k|                            + u4_lev_suffix;
  880|       |
  881|       |            //HP_LEVEL_PREFIX
  882|  2.90k|            if(16 <= u4_lev_prefix)
  ------------------
  |  Branch (882:16): [True: 502, False: 2.40k]
  ------------------
  883|    502|            {
  884|    502|                u2_lev_code += ((1 << (u4_lev_prefix - 3)) - 4096);
  885|    502|            }
  886|  2.90k|            u2_abs_value = (u2_lev_code + 2) >> 1;
  887|       |
  888|       |            /*********************************************************/
  889|       |            /* If Level code is odd, level is negative else positive */
  890|       |            /*********************************************************/
  891|  2.90k|            i2_level_arr[i--] =
  892|  2.90k|                            (u2_lev_code & 1) ? -u2_abs_value : u2_abs_value;
  ------------------
  |  Branch (892:29): [True: 1.55k, False: 1.34k]
  ------------------
  893|       |
  894|       |            /*********************************************************/
  895|       |            /* Increment suffix length if required                   */
  896|       |            /*********************************************************/
  897|  2.90k|            u4_suffix_len +=
  898|  2.90k|                            (u4_suffix_len < 6) ?
  ------------------
  |  Branch (898:29): [True: 2.12k, False: 781]
  ------------------
  899|  2.12k|                                            (u2_abs_value
  900|  2.12k|                                                            > (3
  901|  2.12k|                                                                            << (u4_suffix_len
  902|  2.12k|                                                                                            - 1))) :
  903|  2.90k|                                            0;
  904|  2.90k|        }
  905|       |
  906|       |        /****************************************************************/
  907|       |        /* Decoding Levels Ends                                         */
  908|       |        /****************************************************************/
  909|    261|    }
  910|       |
  911|    261|    if(u4_total_coeff < (16 - u4_isdc))
  ------------------
  |  Branch (911:8): [True: 133, False: 128]
  ------------------
  912|    133|    {
  913|    133|        UWORD32 u4_index;
  914|    133|        const UWORD8 (*ppu1_total_zero_lkup)[16] =
  915|    133|                        (const UWORD8 (*)[16])gau1_ih264d_table_total_zero_11to15;
  916|       |
  917|    133|        NEXTBITS(u4_index, u4_bitstream_offset, pu4_bitstrm_buf, 4);
  ------------------
  |  |  137|    133|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|    133|{                                                                           \
  |  |  139|    133|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|    133|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|    133|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|    133|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|    133|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 133, False: 0]
  |  |  ------------------
  |  |  144|    133|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    133|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|    133|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    133|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|    133|}
  ------------------
  918|    133|        u4_total_zeroes = ppu1_total_zero_lkup[u4_total_coeff - 11][u4_index];
  919|       |
  920|    133|        FLUSHBITS(u4_bitstream_offset, (u4_total_zeroes >> 4));
  ------------------
  |  |  193|    133|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|    133|{                                                                           \
  |  |  195|    133|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|    133|}
  ------------------
  921|    133|        u4_total_zeroes &= 0xf;
  922|    133|    }
  923|    128|    else
  924|    128|        u4_total_zeroes = 0;
  925|       |
  926|       |    /**************************************************************/
  927|       |    /* Decode the runs and form the coefficient buffer            */
  928|       |    /**************************************************************/
  929|    261|    {
  930|    261|        const UWORD8 *pu1_table_runbefore;
  931|    261|        UWORD32 u4_run;
  932|    261|        WORD32 k;
  933|    261|        WORD32 u4_scan_pos = u4_total_coeff + u4_total_zeroes - 1 + u4_isdc;
  934|    261|        WORD32 u4_zeroes_left = u4_total_zeroes;
  935|    261|        k = u4_total_coeff - 1;
  936|       |
  937|       |        /**************************************************************/
  938|       |        /* Decoding Runs for 0 < zeros left <=6                       */
  939|       |        /**************************************************************/
  940|    261|        pu1_table_runbefore = (UWORD8 *)gau1_ih264d_table_run_before;
  941|    987|        while((u4_zeroes_left > 0) && k)
  ------------------
  |  Branch (941:15): [True: 786, False: 201]
  |  Branch (941:39): [True: 726, False: 60]
  ------------------
  942|    726|        {
  943|    726|            UWORD32 u4_code;
  944|    726|            NEXTBITS(u4_code, u4_bitstream_offset, pu4_bitstrm_buf, 3);
  ------------------
  |  |  137|    726|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|    726|{                                                                           \
  |  |  139|    726|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|    726|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|    726|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|    726|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|    726|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 666, False: 60]
  |  |  ------------------
  |  |  144|    726|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    666|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|    726|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    726|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|    726|}
  ------------------
  945|       |
  946|    726|            u4_code = pu1_table_runbefore[u4_code + (u4_zeroes_left << 3)];
  947|    726|            u4_run = u4_code >> 2;
  948|       |
  949|    726|            FLUSHBITS(u4_bitstream_offset, (u4_code & 0x03));
  ------------------
  |  |  193|    726|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|    726|{                                                                           \
  |  |  195|    726|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|    726|}
  ------------------
  950|    726|            SET_BIT(ps_tu_4x4->u2_sig_coeff_map, u4_scan_pos);
  ------------------
  |  |  106|    726|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
  951|    726|            *pi2_coeff_data++ = i2_level_arr[k--];
  952|    726|            u4_zeroes_left -= (WORD32)u4_run;
  953|    726|            u4_scan_pos -= (WORD32)(u4_run + 1);
  954|    726|        }
  955|    261|        if (u4_zeroes_left < 0 || u4_scan_pos < 0)
  ------------------
  |  Branch (955:13): [True: 0, False: 261]
  |  Branch (955:35): [True: 0, False: 261]
  ------------------
  956|      0|          return -1;
  957|       |
  958|       |        /**************************************************************/
  959|       |        /* Decoding Runs End                                          */
  960|       |        /**************************************************************/
  961|       |
  962|       |        /**************************************************************/
  963|       |        /* Copy the remaining coefficients                            */
  964|       |        /**************************************************************/
  965|  3.19k|        while(k >= 0)
  ------------------
  |  Branch (965:15): [True: 2.93k, False: 261]
  ------------------
  966|  2.93k|        {
  967|  2.93k|            SET_BIT(ps_tu_4x4->u2_sig_coeff_map, u4_scan_pos);
  ------------------
  |  |  106|  2.93k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
  968|  2.93k|            *pi2_coeff_data++ = i2_level_arr[k--];
  969|  2.93k|            u4_scan_pos--;
  970|  2.93k|        }
  971|    261|    }
  972|       |
  973|      0|    {
  974|    261|        WORD32 offset;
  975|    261|        offset = (UWORD8 *)pi2_coeff_data - (UWORD8 *)ps_tu_4x4;
  976|    261|        offset = ALIGN4(offset);
  ------------------
  |  |   52|    261|#define ALIGN4(x)   ((((x) + 3) >> 2) << 2)
  ------------------
  977|    261|        ps_dec->pv_parse_tu_coeff_data = (void *)((UWORD8 *)ps_dec->pv_parse_tu_coeff_data + offset);
  978|    261|    }
  979|       |
  980|    261|    ps_bitstrm->u4_ofst = u4_bitstream_offset;
  981|    261|    return 0;
  982|    261|}
ih264d_rest_of_residual_cav_chroma_dc_block:
 1007|  2.99k|{
 1008|  2.99k|    UWORD32 u4_total_zeroes;
 1009|  2.99k|    WORD16 i;
 1010|  2.99k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 1011|  2.99k|    UWORD32 u4_bitstream_offset = ps_bitstrm->u4_ofst;
 1012|  2.99k|    UWORD32 u4_trailing_ones = u4_total_coeff_trail_one & 0xFFFF;
 1013|  2.99k|    UWORD32 u4_total_coeff = u4_total_coeff_trail_one >> 16;
 1014|       |    // To avoid error check at 4x4 level, allocating for 3 extra levels(4+3)
 1015|       |    // since u4_trailing_ones can at the max be 3. This will be required when
 1016|       |    // u4_total_coeff is less than u4_trailing_ones
 1017|  2.99k|    WORD16 ai2_level_arr[7];//
 1018|  2.99k|    WORD16 *i2_level_arr = &ai2_level_arr[3];
 1019|       |
 1020|  2.99k|    tu_sblk4x4_coeff_data_t *ps_tu_4x4;
 1021|  2.99k|    WORD16 *pi2_coeff_data;
 1022|  2.99k|    dec_struct_t *ps_dec = (dec_struct_t *)ps_bitstrm->pv_codec_handle;
 1023|       |
 1024|  2.99k|    ps_tu_4x4 = (tu_sblk4x4_coeff_data_t *)ps_dec->pv_parse_tu_coeff_data;
 1025|  2.99k|    ps_tu_4x4->u2_sig_coeff_map = 0;
 1026|  2.99k|    pi2_coeff_data = &ps_tu_4x4->ai2_level[0];
 1027|       |
 1028|  2.99k|    i = u4_total_coeff - 1;
 1029|  2.99k|    if(u4_trailing_ones)
  ------------------
  |  Branch (1029:8): [True: 2.83k, False: 160]
  ------------------
 1030|  2.83k|    {
 1031|       |        /*********************************************************************/
 1032|       |        /* Decode Trailing Ones                                              */
 1033|       |        /* read the sign of T1's and put them in level array                 */
 1034|       |        /*********************************************************************/
 1035|  2.83k|        UWORD32 u4_signs, u4_cnt = u4_trailing_ones;
 1036|  2.83k|        WORD16 (*ppi2_trlone_lkup)[3] =
 1037|  2.83k|                        (WORD16 (*)[3])gai2_ih264d_trailing_one_level;
 1038|  2.83k|        WORD16 *pi2_trlone_lkup;
 1039|       |
 1040|  2.83k|        GETBITS(u4_signs, u4_bitstream_offset, pu4_bitstrm_buf, u4_cnt);
  ------------------
  |  |  120|  2.83k|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|  2.83k|{                                                                           \
  |  |  122|  2.83k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|  2.83k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|  2.83k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|  2.83k|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|  2.83k|                                                                            \
  |  |  127|  2.83k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 2.80k, False: 31]
  |  |  ------------------
  |  |  128|  2.83k|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  2.80k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|  2.83k|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  2.83k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|  2.83k|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|  2.83k|}                                                                           \
  ------------------
 1041|       |
 1042|  2.83k|        pi2_trlone_lkup = ppi2_trlone_lkup[(1 << u4_cnt) - 2 + u4_signs];
 1043|       |
 1044|  7.02k|        while(u4_cnt)
  ------------------
  |  Branch (1044:15): [True: 4.18k, False: 2.83k]
  ------------------
 1045|  4.18k|        {
 1046|  4.18k|            i2_level_arr[i--] = *pi2_trlone_lkup++;
 1047|  4.18k|            u4_cnt--;
 1048|  4.18k|        }
 1049|  2.83k|    }
 1050|       |
 1051|       |    /****************************************************************/
 1052|       |    /* Decoding Levels Begins                                       */
 1053|       |    /****************************************************************/
 1054|  2.99k|    if(i >= 0)
  ------------------
  |  Branch (1054:8): [True: 330, False: 2.66k]
  ------------------
 1055|    330|    {
 1056|       |        /****************************************************************/
 1057|       |        /* First level is decoded outside the loop as it has lot of     */
 1058|       |        /* special cases.                                               */
 1059|       |        /****************************************************************/
 1060|    330|        UWORD32 u4_lev_suffix, u4_suffix_len, u4_lev_suffix_size;
 1061|    330|        UWORD16 u2_lev_code, u2_abs_value;
 1062|    330|        UWORD32 u4_lev_prefix;
 1063|       |
 1064|       |        /***************************************************************/
 1065|       |        /* u4_suffix_len = 0,  Find leading zeros in next 32 bits      */
 1066|       |        /***************************************************************/
 1067|    330|        FIND_ONE_IN_STREAM_32(u4_lev_prefix, u4_bitstream_offset,
  ------------------
  |  |  165|    330|#define   FIND_ONE_IN_STREAM_32(u4_ldz, u4_offset, pu4_bitstream)           \
  |  |  166|    330|{                                                                           \
  |  |  167|    330|    UWORD32 u4_word;                                                        \
  |  |  168|    330|    NEXTBITS_32(u4_word, u4_offset, pu4_bitstream);                         \
  |  |  ------------------
  |  |  |  |  150|    330|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  |  |  151|    330|{                                                                           \
  |  |  |  |  152|    330|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  153|    330|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  154|    330|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  155|    330|                                                                            \
  |  |  |  |  156|    330|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  157|    330|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (157:8): [True: 330, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  158|    330|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|    330|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  159|    330|}
  |  |  ------------------
  |  |  169|    330|    u4_ldz = CLZ(u4_word);                                     \
  |  |  170|    330|    (u4_offset) += (u4_ldz + 1);                                            \
  |  |  171|    330|}
  ------------------
 1068|    330|                              pu4_bitstrm_buf);
 1069|       |
 1070|       |        /*********************************************************/
 1071|       |        /* Special decoding case when trailing ones are 3        */
 1072|       |        /*********************************************************/
 1073|    330|        u2_lev_code = MIN(15, u4_lev_prefix);
  ------------------
  |  |   61|    330|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 0, False: 330]
  |  |  ------------------
  ------------------
 1074|       |
 1075|    330|        u2_lev_code += (3 == u4_trailing_ones) ? 0 : (2);
  ------------------
  |  Branch (1075:24): [True: 45, False: 285]
  ------------------
 1076|       |
 1077|    330|        if(14 == u4_lev_prefix)
  ------------------
  |  Branch (1077:12): [True: 0, False: 330]
  ------------------
 1078|      0|            u4_lev_suffix_size = 4;
 1079|    330|        else if(15 <= u4_lev_prefix)
  ------------------
  |  Branch (1079:17): [True: 0, False: 330]
  ------------------
 1080|      0|        {
 1081|      0|            u2_lev_code += 15;
 1082|      0|            u4_lev_suffix_size = u4_lev_prefix - 3;
 1083|      0|        }
 1084|    330|        else
 1085|    330|            u4_lev_suffix_size = 0;
 1086|       |
 1087|       |        //HP_LEVEL_PREFIX
 1088|    330|        if(16 <= u4_lev_prefix)
  ------------------
  |  Branch (1088:12): [True: 0, False: 330]
  ------------------
 1089|      0|        {
 1090|      0|            u2_lev_code += ((1 << (u4_lev_prefix - 3)) - 4096);
 1091|      0|        }
 1092|    330|        if(u4_lev_suffix_size)
  ------------------
  |  Branch (1092:12): [True: 0, False: 330]
  ------------------
 1093|      0|        {
 1094|      0|            GETBITS(u4_lev_suffix, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|      0|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|      0|{                                                                           \
  |  |  122|      0|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|      0|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|      0|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|      0|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|      0|                                                                            \
  |  |  127|      0|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  128|      0|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|      0|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|      0|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|      0|}                                                                           \
  ------------------
 1095|      0|                    u4_lev_suffix_size);
 1096|      0|            u2_lev_code += u4_lev_suffix;
 1097|      0|        }
 1098|       |
 1099|    330|        u2_abs_value = (u2_lev_code + 2) >> 1;
 1100|       |        /*********************************************************/
 1101|       |        /* If Level code is odd, level is negative else positive */
 1102|       |        /*********************************************************/
 1103|    330|        i2_level_arr[i--] = (u2_lev_code & 1) ? -u2_abs_value : u2_abs_value;
  ------------------
  |  Branch (1103:29): [True: 28, False: 302]
  ------------------
 1104|       |
 1105|    330|        u4_suffix_len = (u2_abs_value > 3) ? 2 : 1;
  ------------------
  |  Branch (1105:25): [True: 50, False: 280]
  ------------------
 1106|       |
 1107|       |        /*********************************************************/
 1108|       |        /* Now loop over the remaining levels                    */
 1109|       |        /*********************************************************/
 1110|    485|        while(i >= 0)
  ------------------
  |  Branch (1110:15): [True: 155, False: 330]
  ------------------
 1111|    155|        {
 1112|       |
 1113|       |            /***************************************************************/
 1114|       |            /* Find leading zeros in next 32 bits                          */
 1115|       |            /***************************************************************/
 1116|    155|            FIND_ONE_IN_STREAM_32(u4_lev_prefix, u4_bitstream_offset,
  ------------------
  |  |  165|    155|#define   FIND_ONE_IN_STREAM_32(u4_ldz, u4_offset, pu4_bitstream)           \
  |  |  166|    155|{                                                                           \
  |  |  167|    155|    UWORD32 u4_word;                                                        \
  |  |  168|    155|    NEXTBITS_32(u4_word, u4_offset, pu4_bitstream);                         \
  |  |  ------------------
  |  |  |  |  150|    155|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  |  |  151|    155|{                                                                           \
  |  |  |  |  152|    155|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  153|    155|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  154|    155|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  155|    155|                                                                            \
  |  |  |  |  156|    155|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  157|    155|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (157:8): [True: 155, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  158|    155|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|    155|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  159|    155|}
  |  |  ------------------
  |  |  169|    155|    u4_ldz = CLZ(u4_word);                                     \
  |  |  170|    155|    (u4_offset) += (u4_ldz + 1);                                            \
  |  |  171|    155|}
  ------------------
 1117|    155|                                  pu4_bitstrm_buf);
 1118|       |
 1119|    155|            u4_lev_suffix_size =
 1120|    155|                            (15 <= u4_lev_prefix) ?
  ------------------
  |  Branch (1120:29): [True: 0, False: 155]
  ------------------
 1121|    155|                                            (u4_lev_prefix - 3) : u4_suffix_len;
 1122|       |
 1123|       |            /*********************************************************/
 1124|       |            /* Compute level code using prefix and suffix            */
 1125|       |            /*********************************************************/
 1126|    155|            GETBITS(u4_lev_suffix, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|    155|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    155|{                                                                           \
  |  |  122|    155|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    155|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    155|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    155|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    155|                                                                            \
  |  |  127|    155|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 50, False: 105]
  |  |  ------------------
  |  |  128|    155|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|     50|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    155|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    155|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    155|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    155|}                                                                           \
  ------------------
 1127|    155|                    u4_lev_suffix_size);
 1128|    155|            u2_lev_code = (MIN(u4_lev_prefix,15) << u4_suffix_len)
  ------------------
  |  |   61|    155|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 155, False: 0]
  |  |  ------------------
  ------------------
 1129|    155|                            + u4_lev_suffix;
 1130|       |
 1131|       |            //HP_LEVEL_PREFIX
 1132|    155|            if(16 <= u4_lev_prefix)
  ------------------
  |  Branch (1132:16): [True: 0, False: 155]
  ------------------
 1133|      0|            {
 1134|      0|                u2_lev_code += ((1 << (u4_lev_prefix - 3)) - 4096);
 1135|      0|            }
 1136|    155|            u2_abs_value = (u2_lev_code + 2) >> 1;
 1137|       |
 1138|       |            /*********************************************************/
 1139|       |            /* If Level code is odd, level is negative else positive */
 1140|       |            /*********************************************************/
 1141|    155|            i2_level_arr[i--] =
 1142|    155|                            (u2_lev_code & 1) ? -u2_abs_value : u2_abs_value;
  ------------------
  |  Branch (1142:29): [True: 17, False: 138]
  ------------------
 1143|       |
 1144|       |            /*********************************************************/
 1145|       |            /* Increment suffix length if required                   */
 1146|       |            /*********************************************************/
 1147|    155|            u4_suffix_len += (u2_abs_value > (3 << (u4_suffix_len - 1)));
 1148|    155|        }
 1149|       |
 1150|       |        /****************************************************************/
 1151|       |        /* Decoding Levels Ends                                         */
 1152|       |        /****************************************************************/
 1153|    330|    }
 1154|       |
 1155|  2.99k|    if(u4_total_coeff < 4)
  ------------------
  |  Branch (1155:8): [True: 2.95k, False: 46]
  ------------------
 1156|  2.95k|    {
 1157|  2.95k|        UWORD32 u4_max_ldz = (4 - u4_total_coeff);
 1158|  2.95k|        FIND_ONE_IN_STREAM_LEN(u4_total_zeroes, u4_bitstream_offset,
  ------------------
  |  |  176|  2.95k|#define   FIND_ONE_IN_STREAM_LEN(u4_ldz, u4_offset, pu4_bitstream, u4_len)  \
  |  |  177|  2.95k|{                                                                           \
  |  |  178|  2.95k|    UWORD32 u4_word;                                                        \
  |  |  179|  2.95k|    NEXTBITS_32(u4_word, u4_offset, pu4_bitstream);                         \
  |  |  ------------------
  |  |  |  |  150|  2.95k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  |  |  151|  2.95k|{                                                                           \
  |  |  |  |  152|  2.95k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  153|  2.95k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  154|  2.95k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  155|  2.95k|                                                                            \
  |  |  |  |  156|  2.95k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  157|  2.95k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (157:8): [True: 2.89k, False: 54]
  |  |  |  |  ------------------
  |  |  |  |  158|  2.95k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  2.89k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  159|  2.95k|}
  |  |  ------------------
  |  |  180|  2.95k|    u4_ldz = CLZ(u4_word);                                     \
  |  |  181|  2.95k|    if(u4_ldz < u4_len)                                                     \
  |  |  ------------------
  |  |  |  Branch (181:8): [True: 2.47k, False: 476]
  |  |  ------------------
  |  |  182|  2.95k|    (u4_offset) += (u4_ldz + 1);                                            \
  |  |  183|  2.95k|    else                                                                    \
  |  |  184|  2.95k|    {                                                                       \
  |  |  185|    476|        u4_ldz = u4_len;                                                    \
  |  |  186|    476|        (u4_offset) += u4_ldz;                                              \
  |  |  187|    476|    }                                                                       \
  |  |  188|  2.95k|}
  ------------------
 1159|  2.95k|                               pu4_bitstrm_buf, u4_max_ldz);
 1160|  2.95k|    }
 1161|     46|    else
 1162|     46|        u4_total_zeroes = 0;
 1163|       |
 1164|       |    /**************************************************************/
 1165|       |    /* Decode the runs and form the coefficient buffer            */
 1166|       |    /**************************************************************/
 1167|  2.99k|    {
 1168|  2.99k|        const UWORD8 *pu1_table_runbefore;
 1169|  2.99k|        UWORD32 u4_run;
 1170|  2.99k|        WORD32 u4_scan_pos = (u4_total_coeff + u4_total_zeroes - 1);
 1171|  2.99k|        UWORD32 u4_zeroes_left = u4_total_zeroes;
 1172|  2.99k|        i = u4_total_coeff - 1;
 1173|       |
 1174|       |        /**************************************************************/
 1175|       |        /* Decoding Runs for 0 < zeros left <=6                       */
 1176|       |        /**************************************************************/
 1177|  2.99k|        pu1_table_runbefore = (UWORD8 *)gau1_ih264d_table_run_before;
 1178|  3.75k|        while(u4_zeroes_left && i)
  ------------------
  |  Branch (1178:15): [True: 2.14k, False: 1.60k]
  |  Branch (1178:33): [True: 752, False: 1.39k]
  ------------------
 1179|    752|        {
 1180|    752|            UWORD32 u4_code;
 1181|    752|            NEXTBITS(u4_code, u4_bitstream_offset, pu4_bitstrm_buf, 3);
  ------------------
  |  |  137|    752|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|    752|{                                                                           \
  |  |  139|    752|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|    752|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|    752|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|    752|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|    752|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 752, False: 0]
  |  |  ------------------
  |  |  144|    752|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    752|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|    752|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    752|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|    752|}
  ------------------
 1182|       |
 1183|    752|            u4_code = pu1_table_runbefore[u4_code + (u4_zeroes_left << 3)];
 1184|    752|            u4_run = u4_code >> 2;
 1185|       |
 1186|    752|            FLUSHBITS(u4_bitstream_offset, (u4_code & 0x03));
  ------------------
  |  |  193|    752|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|    752|{                                                                           \
  |  |  195|    752|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|    752|}
  ------------------
 1187|    752|            SET_BIT(ps_tu_4x4->u2_sig_coeff_map, u4_scan_pos);
  ------------------
  |  |  106|    752|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
 1188|    752|            *pi2_coeff_data++ = i2_level_arr[i--];
 1189|    752|            u4_zeroes_left -= (WORD32)u4_run;
 1190|    752|            u4_scan_pos -= (WORD32)(u4_run + 1);
 1191|    752|        }
 1192|       |        /**************************************************************/
 1193|       |        /* Decoding Runs End                                          */
 1194|       |        /**************************************************************/
 1195|       |
 1196|       |        /**************************************************************/
 1197|       |        /* Copy the remaining coefficients                            */
 1198|       |        /**************************************************************/
 1199|  6.91k|        while(i >= 0)
  ------------------
  |  Branch (1199:15): [True: 3.91k, False: 2.99k]
  ------------------
 1200|  3.91k|        {
 1201|  3.91k|            SET_BIT(ps_tu_4x4->u2_sig_coeff_map, u4_scan_pos);
  ------------------
  |  |  106|  3.91k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
 1202|  3.91k|            *pi2_coeff_data++ = i2_level_arr[i--];
 1203|  3.91k|            u4_scan_pos--;
 1204|  3.91k|        }
 1205|  2.99k|    }
 1206|       |
 1207|  2.99k|    {
 1208|  2.99k|        WORD32 offset;
 1209|  2.99k|        offset = (UWORD8 *)pi2_coeff_data - (UWORD8 *)ps_tu_4x4;
 1210|  2.99k|        offset = ALIGN4(offset);
  ------------------
  |  |   52|  2.99k|#define ALIGN4(x)   ((((x) + 3) >> 2) << 2)
  ------------------
 1211|  2.99k|        ps_dec->pv_parse_tu_coeff_data = (void *)((UWORD8 *)ps_dec->pv_parse_tu_coeff_data + offset);
 1212|  2.99k|    }
 1213|       |
 1214|  2.99k|    ps_bitstrm->u4_ofst = u4_bitstream_offset;
 1215|  2.99k|}
ih264d_cavlc_parse4x4coeff_n0to7:
 1238|  12.6k|{
 1239|  12.6k|    dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm;
 1240|  12.6k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 1241|  12.6k|    UWORD32 u4_bitstream_offset = ps_bitstrm->u4_ofst;
 1242|  12.6k|    UWORD32 u4_code, u4_index, u4_ldz;
 1243|  12.6k|    const UWORD16 *pu2_code = (const UWORD16*)gau2_ih264d_code_gx;
 1244|  12.6k|    const UWORD16 *pu2_offset_num_vlc =
 1245|  12.6k|                    (const UWORD16 *)gau2_ih264d_offset_num_vlc_tab;
 1246|  12.6k|    UWORD32 u4_offset_num_vlc = pu2_offset_num_vlc[u4_n];
 1247|       |
 1248|       |
 1249|  12.6k|    UNUSED(pi2_coeff_block);
  ------------------
  |  |   45|  12.6k|#define UNUSED(x) ((void)(x))
  ------------------
 1250|  12.6k|    *pu4_total_coeff = 0;
 1251|  12.6k|    FIND_ONE_IN_STREAM_32(u4_ldz, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  165|  12.6k|#define   FIND_ONE_IN_STREAM_32(u4_ldz, u4_offset, pu4_bitstream)           \
  |  |  166|  12.6k|{                                                                           \
  |  |  167|  12.6k|    UWORD32 u4_word;                                                        \
  |  |  168|  12.6k|    NEXTBITS_32(u4_word, u4_offset, pu4_bitstream);                         \
  |  |  ------------------
  |  |  |  |  150|  12.6k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  |  |  151|  12.6k|{                                                                           \
  |  |  |  |  152|  12.6k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  153|  12.6k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  154|  12.6k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  155|  12.6k|                                                                            \
  |  |  |  |  156|  12.6k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  157|  12.6k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (157:8): [True: 12.3k, False: 212]
  |  |  |  |  ------------------
  |  |  |  |  158|  12.6k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  12.3k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  159|  12.6k|}
  |  |  ------------------
  |  |  169|  12.6k|    u4_ldz = CLZ(u4_word);                                     \
  |  |  170|  12.6k|    (u4_offset) += (u4_ldz + 1);                                            \
  |  |  171|  12.6k|}
  ------------------
 1252|  12.6k|    NEXTBITS(u4_index, u4_bitstream_offset, pu4_bitstrm_buf, 3);
  ------------------
  |  |  137|  12.6k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|  12.6k|{                                                                           \
  |  |  139|  12.6k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|  12.6k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|  12.6k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|  12.6k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|  12.6k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 11.4k, False: 1.19k]
  |  |  ------------------
  |  |  144|  12.6k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  11.4k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|  12.6k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  12.6k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|  12.6k|}
  ------------------
 1253|  12.6k|    u4_index += (u4_ldz << 3);
 1254|  12.6k|    u4_index += u4_offset_num_vlc;
 1255|       |
 1256|  12.6k|    u4_index = MIN(u4_index, 303);
  ------------------
  |  |   61|  12.6k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 12.5k, False: 67]
  |  |  ------------------
  ------------------
 1257|  12.6k|    u4_code = pu2_code[u4_index];
 1258|       |
 1259|  12.6k|    FLUSHBITS(u4_bitstream_offset, (u4_code & 0x03));
  ------------------
  |  |  193|  12.6k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|  12.6k|{                                                                           \
  |  |  195|  12.6k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|  12.6k|}
  ------------------
 1260|  12.6k|    ps_bitstrm->u4_ofst = u4_bitstream_offset;
 1261|  12.6k|    *pu4_total_coeff = (u4_code >> 4);
 1262|       |
 1263|  12.6k|    if(*pu4_total_coeff)
  ------------------
  |  Branch (1263:8): [True: 6.46k, False: 6.13k]
  ------------------
 1264|  6.46k|    {
 1265|  6.46k|        UWORD32 u4_trailing_ones, u4_offset, u4_total_coeff_tone;
 1266|  6.46k|        const UWORD8 *pu1_offset =
 1267|  6.46k|                        (UWORD8 *)gau1_ih264d_total_coeff_fn_ptr_offset;
 1268|  6.46k|        WORD32 ret;
 1269|  6.46k|        u4_trailing_ones = ((u4_code >> 2) & 0x03);
 1270|  6.46k|        u4_offset = pu1_offset[*pu4_total_coeff - 1];
 1271|  6.46k|        u4_total_coeff_tone = (*pu4_total_coeff << 16) | u4_trailing_ones;
 1272|       |
 1273|  6.46k|        ret = ps_dec->pf_cavlc_4x4res_block[u4_offset](u4_isdc,
 1274|  6.46k|                                                       u4_total_coeff_tone,
 1275|  6.46k|                                                       ps_bitstrm);
 1276|  6.46k|        if(ret != 0)
  ------------------
  |  Branch (1276:12): [True: 83, False: 6.38k]
  ------------------
 1277|     83|            return ERROR_CAVLC_NUM_COEFF_T;
 1278|  6.46k|    }
 1279|       |
 1280|  12.5k|    return OK;
  ------------------
  |  |  114|  12.5k|#define OK        0
  ------------------
 1281|  12.6k|}
ih264d_cavlc_parse4x4coeff_n8:
 1288|    189|{
 1289|       |
 1290|    189|    dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm;
 1291|    189|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 1292|    189|    UWORD32 u4_bitstream_offset = ps_bitstrm->u4_ofst;
 1293|    189|    UWORD32 u4_code;
 1294|    189|    UNUSED(u4_n);
  ------------------
  |  |   45|    189|#define UNUSED(x) ((void)(x))
  ------------------
 1295|    189|    UNUSED(pi2_coeff_block);
  ------------------
  |  |   45|    189|#define UNUSED(x) ((void)(x))
  ------------------
 1296|    189|    GETBITS(u4_code, u4_bitstream_offset, pu4_bitstrm_buf, 6);
  ------------------
  |  |  120|    189|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    189|{                                                                           \
  |  |  122|    189|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    189|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    189|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    189|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    189|                                                                            \
  |  |  127|    189|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 189, False: 0]
  |  |  ------------------
  |  |  128|    189|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    189|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    189|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    189|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    189|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    189|}                                                                           \
  ------------------
 1297|    189|    ps_bitstrm->u4_ofst = u4_bitstream_offset;
 1298|    189|    *pu4_total_coeff = 0;
 1299|       |
 1300|    189|    if(u4_code != 3)
  ------------------
  |  Branch (1300:8): [True: 189, False: 0]
  ------------------
 1301|    189|    {
 1302|    189|        UWORD8 *pu1_offset = (UWORD8 *)gau1_ih264d_total_coeff_fn_ptr_offset;
 1303|    189|        UWORD32 u4_trailing_ones, u4_offset, u4_total_coeff_tone;
 1304|       |
 1305|    189|        *pu4_total_coeff = (u4_code >> 2) + 1;
 1306|    189|        u4_trailing_ones = u4_code & 0x03;
 1307|    189|        u4_offset = pu1_offset[*pu4_total_coeff - 1];
 1308|    189|        u4_total_coeff_tone = (*pu4_total_coeff << 16) | u4_trailing_ones;
 1309|       |
 1310|    189|        ps_dec->pf_cavlc_4x4res_block[u4_offset](u4_isdc,
 1311|    189|                                                 u4_total_coeff_tone,
 1312|    189|                                                 ps_bitstrm);
 1313|    189|    }
 1314|       |
 1315|    189|    return OK;
  ------------------
  |  |  114|    189|#define OK        0
  ------------------
 1316|    189|}
ih264d_cavlc_parse_chroma_dc:
 1339|  2.15k|{
 1340|  2.15k|    UWORD32 u4_total_coeff, u4_trailing_ones, u4_total_coeff_tone, u4_code;
 1341|  2.15k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 1342|  2.15k|    UWORD32 u4_bitstream_offset = ps_bitstrm->u4_ofst;
 1343|  2.15k|    const UWORD8 *pu1_cav_chromdc = (const UWORD8*)gau1_ih264d_cav_chromdc_vld;
 1344|  2.15k|    UNUSED(i4_mb_inter_inc);
  ------------------
  |  |   45|  2.15k|#define UNUSED(x) ((void)(x))
  ------------------
 1345|       |    /******************************************************************/
 1346|       |    /*  Chroma DC Block for U component                               */
 1347|       |    /******************************************************************/
 1348|  2.15k|    NEXTBITS(u4_code, u4_bitstream_offset, pu4_bitstrm_buf, 8);
  ------------------
  |  |  137|  2.15k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|  2.15k|{                                                                           \
  |  |  139|  2.15k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|  2.15k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|  2.15k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|  2.15k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|  2.15k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 1.95k, False: 198]
  |  |  ------------------
  |  |  144|  2.15k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  1.95k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|  2.15k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  2.15k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|  2.15k|}
  ------------------
 1349|       |
 1350|  2.15k|    u4_code = pu1_cav_chromdc[u4_code];
 1351|       |
 1352|  2.15k|    FLUSHBITS(u4_bitstream_offset, ((u4_code & 0x7) + 1));
  ------------------
  |  |  193|  2.15k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|  2.15k|{                                                                           \
  |  |  195|  2.15k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|  2.15k|}
  ------------------
 1353|  2.15k|    ps_bitstrm->u4_ofst = u4_bitstream_offset;
 1354|       |
 1355|  2.15k|    u4_total_coeff = (u4_code >> 5);
 1356|       |
 1357|  2.15k|    if(u4_total_coeff)
  ------------------
  |  Branch (1357:8): [True: 1.77k, False: 374]
  ------------------
 1358|  1.77k|    {
 1359|  1.77k|        WORD32 i_z0, i_z1, i_z2, i_z3;
 1360|  1.77k|        tu_sblk4x4_coeff_data_t *ps_tu_4x4;
 1361|  1.77k|        dec_struct_t *ps_dec = (dec_struct_t *)ps_bitstrm->pv_codec_handle;
 1362|  1.77k|        WORD16 ai2_dc_coef[4];
 1363|  1.77k|        UWORD8 pu1_inv_scan[4] =
 1364|  1.77k|                        { 0, 1, 2, 3 };
 1365|  1.77k|        WORD16 *pi2_coeff_data =
 1366|  1.77k|                                    (WORD16 *)ps_dec->pv_parse_tu_coeff_data;
 1367|       |
 1368|  1.77k|        ps_tu_4x4 = (tu_sblk4x4_coeff_data_t *)ps_dec->pv_parse_tu_coeff_data;
 1369|       |
 1370|  1.77k|        u4_trailing_ones = ((u4_code >> 3) & 0x3);
 1371|  1.77k|        u4_total_coeff_tone = (u4_total_coeff << 16) | u4_trailing_ones;
 1372|  1.77k|        ih264d_rest_of_residual_cav_chroma_dc_block(u4_total_coeff_tone,
 1373|  1.77k|                                                    ps_bitstrm);
 1374|       |
 1375|  1.77k|        ai2_dc_coef[0] = 0;
 1376|  1.77k|        ai2_dc_coef[1] = 0;
 1377|  1.77k|        ai2_dc_coef[2] = 0;
 1378|  1.77k|        ai2_dc_coef[3] = 0;
 1379|       |
 1380|  1.77k|        ih264d_unpack_coeff4x4_dc_4x4blk(ps_tu_4x4,
 1381|  1.77k|                                         ai2_dc_coef,
 1382|  1.77k|                                         pu1_inv_scan);
 1383|       |        /*-------------------------------------------------------------------*/
 1384|       |        /* Inverse 2x2 transform and scaling  of chroma DC                   */
 1385|       |        /*-------------------------------------------------------------------*/
 1386|  1.77k|        i_z0 = (ai2_dc_coef[0] + ai2_dc_coef[2]);
 1387|  1.77k|        i_z1 = (ai2_dc_coef[0] - ai2_dc_coef[2]);
 1388|  1.77k|        i_z2 = (ai2_dc_coef[1] - ai2_dc_coef[3]);
 1389|  1.77k|        i_z3 = (ai2_dc_coef[1] + ai2_dc_coef[3]);
 1390|       |
 1391|       |        /*-----------------------------------------------------------*/
 1392|       |        /* Scaling and storing the values back                       */
 1393|       |        /*-----------------------------------------------------------*/
 1394|  1.77k|        *pi2_coeff_data++ = (WORD16)(((i_z0 + i_z3) * (WORD32)u4_scale_u) >> 5);
 1395|  1.77k|        *pi2_coeff_data++ = (WORD16)(((i_z0 - i_z3) * (WORD32)u4_scale_u) >> 5);
 1396|  1.77k|        *pi2_coeff_data++ = (WORD16)(((i_z1 + i_z2) * (WORD32)u4_scale_u) >> 5);
 1397|  1.77k|        *pi2_coeff_data++ = (WORD16)(((i_z1 - i_z2) * (WORD32)u4_scale_u) >> 5);
 1398|       |
 1399|  1.77k|        ps_dec->pv_parse_tu_coeff_data = (void *)pi2_coeff_data;
 1400|       |
 1401|  1.77k|        SET_BIT(ps_cur_mb_info->u1_yuv_dc_block_flag,1);
  ------------------
  |  |  106|  1.77k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
 1402|  1.77k|    }
 1403|       |
 1404|       |    /******************************************************************/
 1405|       |    /*  Chroma DC Block for V component                               */
 1406|       |    /******************************************************************/
 1407|  2.15k|    pi2_coeff_block += 64;
 1408|  2.15k|    u4_bitstream_offset = ps_bitstrm->u4_ofst;
 1409|       |
 1410|  2.15k|    NEXTBITS(u4_code, u4_bitstream_offset, pu4_bitstrm_buf, 8);
  ------------------
  |  |  137|  2.15k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|  2.15k|{                                                                           \
  |  |  139|  2.15k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|  2.15k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|  2.15k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|  2.15k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|  2.15k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 1.92k, False: 226]
  |  |  ------------------
  |  |  144|  2.15k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  1.92k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|  2.15k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  2.15k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|  2.15k|}
  ------------------
 1411|       |
 1412|  2.15k|    u4_code = pu1_cav_chromdc[u4_code];
 1413|       |
 1414|  2.15k|    FLUSHBITS(u4_bitstream_offset, ((u4_code & 0x7) + 1));
  ------------------
  |  |  193|  2.15k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|  2.15k|{                                                                           \
  |  |  195|  2.15k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|  2.15k|}
  ------------------
 1415|  2.15k|    ps_bitstrm->u4_ofst = u4_bitstream_offset;
 1416|       |
 1417|  2.15k|    u4_total_coeff = (u4_code >> 5);
 1418|       |
 1419|  2.15k|    if(u4_total_coeff)
  ------------------
  |  Branch (1419:8): [True: 1.22k, False: 929]
  ------------------
 1420|  1.22k|    {
 1421|  1.22k|        WORD32 i_z0, i_z1, i_z2, i_z3;
 1422|  1.22k|        tu_sblk4x4_coeff_data_t *ps_tu_4x4;
 1423|  1.22k|        dec_struct_t *ps_dec = (dec_struct_t *)ps_bitstrm->pv_codec_handle;
 1424|  1.22k|        WORD16 ai2_dc_coef[4];
 1425|  1.22k|        UWORD8 pu1_inv_scan[4] =
 1426|  1.22k|                        { 0, 1, 2, 3 };
 1427|  1.22k|        WORD16 *pi2_coeff_data =
 1428|  1.22k|                                    (WORD16 *)ps_dec->pv_parse_tu_coeff_data;
 1429|       |
 1430|  1.22k|        ps_tu_4x4 = (tu_sblk4x4_coeff_data_t *)ps_dec->pv_parse_tu_coeff_data;
 1431|       |
 1432|  1.22k|        u4_trailing_ones = ((u4_code >> 3) & 0x3);
 1433|  1.22k|        u4_total_coeff_tone = (u4_total_coeff << 16) | u4_trailing_ones;
 1434|  1.22k|        ih264d_rest_of_residual_cav_chroma_dc_block(u4_total_coeff_tone,
 1435|  1.22k|                                                    ps_bitstrm);
 1436|       |
 1437|  1.22k|        ai2_dc_coef[0] = 0;
 1438|  1.22k|        ai2_dc_coef[1] = 0;
 1439|  1.22k|        ai2_dc_coef[2] = 0;
 1440|  1.22k|        ai2_dc_coef[3] = 0;
 1441|       |
 1442|  1.22k|        ih264d_unpack_coeff4x4_dc_4x4blk(ps_tu_4x4,
 1443|  1.22k|                                         ai2_dc_coef,
 1444|  1.22k|                                         pu1_inv_scan);
 1445|       |
 1446|       |        /*-------------------------------------------------------------------*/
 1447|       |        /* Inverse 2x2 transform and scaling  of chroma DC                   */
 1448|       |        /*-------------------------------------------------------------------*/
 1449|  1.22k|        i_z0 = (ai2_dc_coef[0] + ai2_dc_coef[2]);
 1450|  1.22k|        i_z1 = (ai2_dc_coef[0] - ai2_dc_coef[2]);
 1451|  1.22k|        i_z2 = (ai2_dc_coef[1] - ai2_dc_coef[3]);
 1452|  1.22k|        i_z3 = (ai2_dc_coef[1] + ai2_dc_coef[3]);
 1453|       |
 1454|       |        /*-----------------------------------------------------------*/
 1455|       |        /* Scaling and storing the values back                       */
 1456|       |        /*-----------------------------------------------------------*/
 1457|  1.22k|        *pi2_coeff_data++ = (WORD16)(((i_z0 + i_z3) * (WORD32)u4_scale_v) >> 5);
 1458|  1.22k|        *pi2_coeff_data++ = (WORD16)(((i_z0 - i_z3) * (WORD32)u4_scale_v) >> 5);
 1459|  1.22k|        *pi2_coeff_data++ = (WORD16)(((i_z1 + i_z2) * (WORD32)u4_scale_v) >> 5);
 1460|  1.22k|        *pi2_coeff_data++ = (WORD16)(((i_z1 - i_z2) * (WORD32)u4_scale_v) >> 5);
 1461|       |
 1462|  1.22k|        ps_dec->pv_parse_tu_coeff_data = (void *)pi2_coeff_data;
 1463|       |
 1464|  1.22k|        SET_BIT(ps_cur_mb_info->u1_yuv_dc_block_flag,2);
  ------------------
  |  |  106|  1.22k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
 1465|  1.22k|    }
 1466|  2.15k|}
ih264d_parse_pmb_ref_index_cavlc_range1:
 1496|  1.96k|{
 1497|  1.96k|    UWORD32 u4_i;
 1498|  1.96k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 1499|  1.96k|    UWORD32 *pu4_bitstream_off = &ps_bitstrm->u4_ofst;
 1500|  1.96k|    UNUSED(u4_num_ref_idx_active_minus1);
  ------------------
  |  |   45|  1.96k|#define UNUSED(x) ((void)(x))
  ------------------
 1501|  5.79k|    for(u4_i = 0; u4_i < u4_num_part; u4_i++)
  ------------------
  |  Branch (1501:19): [True: 3.82k, False: 1.96k]
  ------------------
 1502|  3.82k|    {
 1503|  3.82k|        UWORD32 u4_ref_idx;
 1504|  3.82k|        u4_ref_idx = ih264d_tev_range1(pu4_bitstream_off, pu4_bitstrm_buf);
 1505|       |
 1506|       |        /* Storing Reference Idx Information */
 1507|  3.82k|        pi1_ref_idx[u4_i] = (WORD8)u4_ref_idx;
 1508|  3.82k|    }
 1509|  1.96k|}
ih264d_parse_pmb_ref_index_cavlc:
 1540|     88|{
 1541|     88|    UWORD32 u4_i;
 1542|     88|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 1543|     88|    UWORD32 *pu4_bitstream_off = &ps_bitstrm->u4_ofst;
 1544|       |
 1545|    240|    for(u4_i = 0; u4_i < u4_num_part; u4_i++)
  ------------------
  |  Branch (1545:19): [True: 154, False: 86]
  ------------------
 1546|    154|    {
 1547|    154|        UWORD32 u4_ref_idx;
 1548|       |//Inlined ih264d_uev
 1549|    154|        UWORD32 u4_bitstream_offset = *pu4_bitstream_off;
 1550|    154|        UWORD32 u4_word, u4_ldz;
 1551|       |
 1552|       |        /***************************************************************/
 1553|       |        /* Find leading zeros in next 32 bits                          */
 1554|       |        /***************************************************************/
 1555|    154|        NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|    154|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|    154|{                                                                           \
  |  |  152|    154|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|    154|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|    154|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|    154|                                                                            \
  |  |  156|    154|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|    154|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 137, False: 17]
  |  |  ------------------
  |  |  158|    154|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|    137|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|    154|}
  ------------------
 1556|    154|        u4_ldz = CLZ(u4_word);
 1557|       |        /* Flush the ps_bitstrm */
 1558|    154|        u4_bitstream_offset += (u4_ldz + 1);
 1559|       |        /* Read the suffix from the ps_bitstrm */
 1560|    154|        u4_word = 0;
 1561|    154|        if(u4_ldz)
  ------------------
  |  Branch (1561:12): [True: 81, False: 73]
  ------------------
 1562|     81|            GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|     81|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|     81|{                                                                           \
  |  |  122|     81|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|     81|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|     81|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|     81|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|     81|                                                                            \
  |  |  127|     81|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 80, False: 1]
  |  |  ------------------
  |  |  128|     81|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|     80|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|     81|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|     81|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|     81|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|     81|}                                                                           \
  ------------------
 1563|    154|        *pu4_bitstream_off = u4_bitstream_offset;
 1564|    154|        u4_ref_idx = ((1 << u4_ldz) + u4_word - 1);
 1565|       |//Inlined ih264d_uev
 1566|       |
 1567|    154|        if(u4_ref_idx > u4_num_ref_idx_active_minus1)
  ------------------
  |  Branch (1567:12): [True: 2, False: 152]
  ------------------
 1568|      2|            return ERROR_REF_IDX;
 1569|       |
 1570|       |        /* Storing Reference Idx Information */
 1571|    152|        pi1_ref_idx[u4_i] = (WORD8)u4_ref_idx;
 1572|    152|    }
 1573|     86|    return OK;
  ------------------
  |  |  114|     86|#define OK        0
  ------------------
 1574|     88|}
ih264d_parse_bmb_ref_index_cavlc_range1:
 1604|      5|{
 1605|      5|    UWORD32 u4_i;
 1606|      5|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 1607|      5|    UWORD32 *pu4_bitstream_off = &ps_bitstrm->u4_ofst;
 1608|      5|    UNUSED(u4_num_ref_idx_active_minus1);
  ------------------
  |  |   45|      5|#define UNUSED(x) ((void)(x))
  ------------------
 1609|     13|    for(u4_i = 0; u4_i < u4_num_part; u4_i++)
  ------------------
  |  Branch (1609:19): [True: 8, False: 5]
  ------------------
 1610|      8|    {
 1611|      8|        if(pi1_ref_idx[u4_i] > -1)
  ------------------
  |  Branch (1611:12): [True: 0, False: 8]
  ------------------
 1612|      0|        {
 1613|      0|            UWORD32 u4_ref_idx;
 1614|       |
 1615|      0|            u4_ref_idx = ih264d_tev_range1(pu4_bitstream_off, pu4_bitstrm_buf);
 1616|       |
 1617|       |            /* Storing Reference Idx Information */
 1618|      0|            pi1_ref_idx[u4_i] = (WORD8)u4_ref_idx;
 1619|      0|        }
 1620|      8|    }
 1621|      5|}
ih264d_parse_bmb_ref_index_cavlc:
 1651|     78|{
 1652|     78|    UWORD32 u4_i;
 1653|     78|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 1654|     78|    UWORD32 *pu4_bitstream_off = &ps_bitstrm->u4_ofst;
 1655|       |
 1656|    142|    for(u4_i = 0; u4_i < u4_num_part; u4_i++)
  ------------------
  |  Branch (1656:19): [True: 79, False: 63]
  ------------------
 1657|     79|    {
 1658|     79|        if(pi1_ref_idx[u4_i] > -1)
  ------------------
  |  Branch (1658:12): [True: 73, False: 6]
  ------------------
 1659|     73|        {
 1660|     73|            UWORD32 u4_ref_idx;
 1661|       |//inlining ih264d_uev
 1662|     73|            UWORD32 u4_bitstream_offset = *pu4_bitstream_off;
 1663|     73|            UWORD32 u4_word, u4_ldz;
 1664|       |
 1665|       |            /***************************************************************/
 1666|       |            /* Find leading zeros in next 32 bits                          */
 1667|       |            /***************************************************************/
 1668|     73|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|     73|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|     73|{                                                                           \
  |  |  152|     73|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|     73|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|     73|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|     73|                                                                            \
  |  |  156|     73|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|     73|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 73, False: 0]
  |  |  ------------------
  |  |  158|     73|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|     73|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|     73|}
  ------------------
 1669|     73|            u4_ldz = CLZ(u4_word);
 1670|       |            /* Flush the ps_bitstrm */
 1671|     73|            u4_bitstream_offset += (u4_ldz + 1);
 1672|       |            /* Read the suffix from the ps_bitstrm */
 1673|     73|            u4_word = 0;
 1674|     73|            if(u4_ldz)
  ------------------
  |  Branch (1674:16): [True: 27, False: 46]
  ------------------
 1675|     27|                GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|     27|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|     27|{                                                                           \
  |  |  122|     27|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|     27|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|     27|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|     27|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|     27|                                                                            \
  |  |  127|     27|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 27, False: 0]
  |  |  ------------------
  |  |  128|     27|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|     27|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|     27|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|     27|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|     27|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|     27|}                                                                           \
  ------------------
 1676|     73|            *pu4_bitstream_off = u4_bitstream_offset;
 1677|     73|            u4_ref_idx = ((1 << u4_ldz) + u4_word - 1);
 1678|       |//inlining ih264d_uev
 1679|     73|            if(u4_ref_idx > u4_num_ref_idx_active_minus1)
  ------------------
  |  Branch (1679:16): [True: 15, False: 58]
  ------------------
 1680|     15|                return ERROR_REF_IDX;
 1681|       |
 1682|       |            /* Storing Reference Idx Information */
 1683|     58|            pi1_ref_idx[u4_i] = (WORD8)u4_ref_idx;
 1684|     58|        }
 1685|     79|    }
 1686|     63|    return OK;
  ------------------
  |  |  114|     63|#define OK        0
  ------------------
 1687|     78|}
ih264d_cavlc_parse_8x8block_both_available:
 1736|  1.79k|{
 1737|  1.79k|    UWORD32 u4_num_coeff, u4_n, u4_subblock_coded;
 1738|  1.79k|    UWORD32 u4_top0, u4_top1;
 1739|  1.79k|    UWORD32 *pu4_dummy;
 1740|  1.79k|    WORD32 (**pf_cavlc_parse4x4coeff)(WORD16 *pi2_coeff_block,
 1741|  1.79k|                                      UWORD32 u4_isdc,
 1742|  1.79k|                                      WORD32 u4_n,
 1743|  1.79k|                                      struct _DecStruct *ps_dec,
 1744|  1.79k|                                      UWORD32 *pu4_dummy) =
 1745|  1.79k|                                      ps_dec->pf_cavlc_parse4x4coeff;
 1746|  1.79k|    UWORD32 u4_idx = 0;
 1747|  1.79k|    UWORD8 *puc_temp;
 1748|  1.79k|    WORD32 ret;
 1749|       |
 1750|  1.79k|    *pu4_csbp = 0;
 1751|       |    /* need to change the inverse scan matrices here */
 1752|  1.79k|    puc_temp = ps_dec->pu1_inv_scan;
 1753|       |
 1754|       |    /*------------------------------------------------------*/
 1755|       |    /* Residual 4x4 decoding: SubBlock 0                    */
 1756|       |    /*------------------------------------------------------*/
 1757|  1.79k|    if(u1_tran_form8x8)
  ------------------
  |  Branch (1757:8): [True: 1.26k, False: 533]
  ------------------
 1758|  1.26k|    {
 1759|  1.26k|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (1759:12): [True: 1.26k, False: 0]
  ------------------
 1760|  1.26k|        {
 1761|  1.26k|            ps_dec->pu1_inv_scan =
 1762|  1.26k|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[0];
 1763|  1.26k|        }
 1764|      0|        else
 1765|      0|        {
 1766|      0|            ps_dec->pu1_inv_scan =
 1767|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[0];
 1768|      0|        }
 1769|  1.26k|    }
 1770|  1.79k|    u4_n = (pu1_top_nnz[0] + pu1_left_nnz[0] + 1) >> 1;
 1771|  1.79k|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 1772|  1.79k|                                             u4_n, ps_dec, &u4_num_coeff);
 1773|  1.79k|    if(ret != OK)
  ------------------
  |  |  114|  1.79k|#define OK        0
  ------------------
  |  Branch (1773:8): [True: 7, False: 1.78k]
  ------------------
 1774|      7|        return ret;
 1775|       |
 1776|  1.78k|    u4_top0 = u4_num_coeff;
 1777|  1.78k|    u4_subblock_coded = (u4_num_coeff != 0);
 1778|  1.78k|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|  1.78k|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|  1.78k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 1779|       |
 1780|       |    /*------------------------------------------------------*/
 1781|       |    /* Residual 4x4 decoding: SubBlock 1                    */
 1782|       |    /*------------------------------------------------------*/
 1783|  1.78k|    u4_idx++;
 1784|  1.78k|    if(u1_tran_form8x8)
  ------------------
  |  Branch (1784:8): [True: 1.25k, False: 530]
  ------------------
 1785|  1.25k|    {
 1786|  1.25k|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (1786:12): [True: 1.25k, False: 0]
  ------------------
 1787|  1.25k|        {
 1788|  1.25k|            ps_dec->pu1_inv_scan =
 1789|  1.25k|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[1];
 1790|  1.25k|        }
 1791|      0|        else
 1792|      0|        {
 1793|      0|            ps_dec->pu1_inv_scan =
 1794|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[1];
 1795|      0|        }
 1796|  1.25k|    }
 1797|    530|    else
 1798|    530|    {
 1799|    530|        pi2_coeff_block += NUM_COEFFS_IN_4x4BLK;
  ------------------
  |  |  617|    530|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 1800|    530|    }
 1801|  1.78k|    u4_n = (pu1_top_nnz[1] + u4_num_coeff + 1) >> 1;
 1802|  1.78k|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 1803|  1.78k|                                             u4_n, ps_dec, &u4_num_coeff);
 1804|  1.78k|    if(ret != OK)
  ------------------
  |  |  114|  1.78k|#define OK        0
  ------------------
  |  Branch (1804:8): [True: 1, False: 1.78k]
  ------------------
 1805|      1|        return ret;
 1806|       |
 1807|  1.78k|    u4_top1 = pu1_left_nnz[0] = u4_num_coeff;
 1808|  1.78k|    u4_subblock_coded = (u4_num_coeff != 0);
 1809|  1.78k|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|  1.78k|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|  1.78k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 1810|       |
 1811|       |    /*------------------------------------------------------*/
 1812|       |    /* Residual 4x4 decoding: SubBlock 2                    */
 1813|       |    /*------------------------------------------------------*/
 1814|  1.78k|    u4_idx += (u4_sub_block_strd - 1);
 1815|  1.78k|    if(u1_tran_form8x8)
  ------------------
  |  Branch (1815:8): [True: 1.25k, False: 530]
  ------------------
 1816|  1.25k|    {
 1817|  1.25k|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (1817:12): [True: 1.25k, False: 0]
  ------------------
 1818|  1.25k|        {
 1819|  1.25k|            ps_dec->pu1_inv_scan =
 1820|  1.25k|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[2];
 1821|  1.25k|        }
 1822|      0|        else
 1823|      0|        {
 1824|      0|            ps_dec->pu1_inv_scan =
 1825|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[2];
 1826|      0|        }
 1827|  1.25k|    }
 1828|    530|    else
 1829|    530|    {
 1830|    530|        pi2_coeff_block += ((u4_sub_block_strd - 1) * NUM_COEFFS_IN_4x4BLK);
  ------------------
  |  |  617|    530|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 1831|    530|    }
 1832|  1.78k|    u4_n = (u4_top0 + pu1_left_nnz[1] + 1) >> 1;
 1833|  1.78k|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 1834|  1.78k|                                             u4_n, ps_dec, &u4_num_coeff);
 1835|  1.78k|    if(ret != OK)
  ------------------
  |  |  114|  1.78k|#define OK        0
  ------------------
  |  Branch (1835:8): [True: 8, False: 1.78k]
  ------------------
 1836|      8|        return ret;
 1837|       |
 1838|  1.78k|    pu1_top_nnz[0] = u4_num_coeff;
 1839|  1.78k|    u4_subblock_coded = (u4_num_coeff != 0);
 1840|  1.78k|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|  1.78k|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|  1.78k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 1841|       |
 1842|       |    /*------------------------------------------------------*/
 1843|       |    /* Residual 4x4 decoding: SubBlock 3                    */
 1844|       |    /*------------------------------------------------------*/
 1845|  1.78k|    u4_idx++;
 1846|  1.78k|    if(u1_tran_form8x8)
  ------------------
  |  Branch (1846:8): [True: 1.25k, False: 524]
  ------------------
 1847|  1.25k|    {
 1848|  1.25k|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (1848:12): [True: 1.25k, False: 0]
  ------------------
 1849|  1.25k|        {
 1850|  1.25k|            ps_dec->pu1_inv_scan =
 1851|  1.25k|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[3];
 1852|  1.25k|        }
 1853|      0|        else
 1854|      0|        {
 1855|      0|            ps_dec->pu1_inv_scan =
 1856|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[3];
 1857|      0|        }
 1858|  1.25k|    }
 1859|    524|    else
 1860|    524|    {
 1861|    524|        pi2_coeff_block += NUM_COEFFS_IN_4x4BLK;
  ------------------
  |  |  617|    524|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 1862|    524|    }
 1863|  1.78k|    u4_n = (u4_top1 + u4_num_coeff + 1) >> 1;
 1864|  1.78k|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 1865|  1.78k|                                             u4_n, ps_dec, &u4_num_coeff);
 1866|  1.78k|    if(ret != OK)
  ------------------
  |  |  114|  1.78k|#define OK        0
  ------------------
  |  Branch (1866:8): [True: 0, False: 1.78k]
  ------------------
 1867|      0|        return ret;
 1868|       |
 1869|  1.78k|    pu1_top_nnz[1] = pu1_left_nnz[1] = u4_num_coeff;
 1870|  1.78k|    u4_subblock_coded = (u4_num_coeff != 0);
 1871|  1.78k|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|  1.78k|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|  1.78k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 1872|       |
 1873|  1.78k|    ps_dec->pu1_inv_scan = puc_temp;
 1874|       |
 1875|  1.78k|    return OK;
  ------------------
  |  |  114|  1.78k|#define OK        0
  ------------------
 1876|  1.78k|}
ih264d_cavlc_parse_8x8block_left_available:
 1926|    506|{
 1927|    506|    UWORD32 u4_num_coeff, u4_n, u4_subblock_coded;
 1928|    506|    UWORD32 u4_top0, u4_top1;
 1929|    506|    UWORD32 *pu4_dummy;
 1930|    506|    WORD32 (**pf_cavlc_parse4x4coeff)(WORD16 *pi2_coeff_block,
 1931|    506|                                      UWORD32 u4_isdc,
 1932|    506|                                      WORD32 u4_n,
 1933|    506|                                      struct _DecStruct *ps_dec,
 1934|    506|                                      UWORD32 *pu4_dummy) =
 1935|    506|                                      ps_dec->pf_cavlc_parse4x4coeff;
 1936|    506|    UWORD32 u4_idx = 0;
 1937|    506|    UWORD8 *puc_temp;
 1938|    506|    WORD32 ret;
 1939|       |
 1940|    506|    *pu4_csbp = 0;
 1941|    506|    puc_temp = ps_dec->pu1_inv_scan;
 1942|       |
 1943|       |    /*------------------------------------------------------*/
 1944|       |    /* Residual 4x4 decoding: SubBlock 0                    */
 1945|       |    /*------------------------------------------------------*/
 1946|    506|    if(u1_tran_form8x8)
  ------------------
  |  Branch (1946:8): [True: 260, False: 246]
  ------------------
 1947|    260|    {
 1948|    260|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (1948:12): [True: 260, False: 0]
  ------------------
 1949|    260|        {
 1950|    260|            ps_dec->pu1_inv_scan =
 1951|    260|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[0];
 1952|    260|        }
 1953|      0|        else
 1954|      0|        {
 1955|      0|            ps_dec->pu1_inv_scan =
 1956|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[0];
 1957|      0|        }
 1958|    260|    }
 1959|    506|    u4_n = pu1_left_nnz[0];
 1960|    506|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 1961|    506|                                             u4_n, ps_dec, &u4_num_coeff);
 1962|    506|    if(ret != OK)
  ------------------
  |  |  114|    506|#define OK        0
  ------------------
  |  Branch (1962:8): [True: 3, False: 503]
  ------------------
 1963|      3|        return ret;
 1964|       |
 1965|    503|    u4_top0 = u4_num_coeff;
 1966|    503|    u4_subblock_coded = (u4_num_coeff != 0);
 1967|    503|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|    503|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    503|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 1968|       |
 1969|       |    /*------------------------------------------------------*/
 1970|       |    /* Residual 4x4 decoding: SubBlock 1                    */
 1971|       |    /*------------------------------------------------------*/
 1972|    503|    u4_idx++;
 1973|    503|    if(u1_tran_form8x8)
  ------------------
  |  Branch (1973:8): [True: 260, False: 243]
  ------------------
 1974|    260|    {
 1975|    260|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (1975:12): [True: 260, False: 0]
  ------------------
 1976|    260|        {
 1977|    260|            ps_dec->pu1_inv_scan =
 1978|    260|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[1];
 1979|    260|        }
 1980|      0|        else
 1981|      0|        {
 1982|      0|            ps_dec->pu1_inv_scan =
 1983|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[1];
 1984|      0|        }
 1985|    260|    }
 1986|    243|    else
 1987|    243|    {
 1988|    243|        pi2_coeff_block += NUM_COEFFS_IN_4x4BLK;
  ------------------
  |  |  617|    243|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 1989|    243|    }
 1990|    503|    u4_n = u4_num_coeff;
 1991|    503|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 1992|    503|                                             u4_n, ps_dec, &u4_num_coeff);
 1993|    503|    if(ret != OK)
  ------------------
  |  |  114|    503|#define OK        0
  ------------------
  |  Branch (1993:8): [True: 1, False: 502]
  ------------------
 1994|      1|        return ret;
 1995|       |
 1996|    502|    u4_top1 = pu1_left_nnz[0] = u4_num_coeff;
 1997|    502|    u4_subblock_coded = (u4_num_coeff != 0);
 1998|    502|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|    502|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    502|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 1999|       |
 2000|       |    /*------------------------------------------------------*/
 2001|       |    /* Residual 4x4 decoding: SubBlock 2                    */
 2002|       |    /*------------------------------------------------------*/
 2003|    502|    u4_idx += (u4_sub_block_strd - 1);
 2004|    502|    if(u1_tran_form8x8)
  ------------------
  |  Branch (2004:8): [True: 259, False: 243]
  ------------------
 2005|    259|    {
 2006|    259|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (2006:12): [True: 259, False: 0]
  ------------------
 2007|    259|        {
 2008|    259|            ps_dec->pu1_inv_scan =
 2009|    259|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[2];
 2010|    259|        }
 2011|      0|        else
 2012|      0|        {
 2013|      0|            ps_dec->pu1_inv_scan =
 2014|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[2];
 2015|      0|        }
 2016|    259|    }
 2017|    243|    else
 2018|    243|    {
 2019|    243|        pi2_coeff_block += ((u4_sub_block_strd - 1) * NUM_COEFFS_IN_4x4BLK);
  ------------------
  |  |  617|    243|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 2020|    243|    }
 2021|    502|    u4_n = (u4_top0 + pu1_left_nnz[1] + 1) >> 1;
 2022|    502|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 2023|    502|                                             u4_n, ps_dec, &u4_num_coeff);
 2024|    502|    if(ret != OK)
  ------------------
  |  |  114|    502|#define OK        0
  ------------------
  |  Branch (2024:8): [True: 62, False: 440]
  ------------------
 2025|     62|        return ret;
 2026|       |
 2027|    440|    pu1_top_nnz[0] = u4_num_coeff;
 2028|    440|    u4_subblock_coded = (u4_num_coeff != 0);
 2029|    440|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|    440|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    440|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 2030|       |
 2031|       |    /*------------------------------------------------------*/
 2032|       |    /* Residual 4x4 decoding: SubBlock 3                    */
 2033|       |    /*------------------------------------------------------*/
 2034|    440|    u4_idx++;
 2035|    440|    if(u1_tran_form8x8)
  ------------------
  |  Branch (2035:8): [True: 259, False: 181]
  ------------------
 2036|    259|    {
 2037|    259|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (2037:12): [True: 259, False: 0]
  ------------------
 2038|    259|        {
 2039|    259|            ps_dec->pu1_inv_scan =
 2040|    259|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[3];
 2041|    259|        }
 2042|      0|        else
 2043|      0|        {
 2044|      0|            ps_dec->pu1_inv_scan =
 2045|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[3];
 2046|      0|        }
 2047|    259|    }
 2048|    181|    else
 2049|    181|    {
 2050|    181|        pi2_coeff_block += NUM_COEFFS_IN_4x4BLK;
  ------------------
  |  |  617|    181|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 2051|    181|    }
 2052|    440|    u4_n = (u4_top1 + u4_num_coeff + 1) >> 1;
 2053|    440|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 2054|    440|                                             u4_n, ps_dec, &u4_num_coeff);
 2055|    440|    if(ret != OK)
  ------------------
  |  |  114|    440|#define OK        0
  ------------------
  |  Branch (2055:8): [True: 0, False: 440]
  ------------------
 2056|      0|        return ret;
 2057|       |
 2058|    440|    pu1_top_nnz[1] = pu1_left_nnz[1] = u4_num_coeff;
 2059|    440|    u4_subblock_coded = (u4_num_coeff != 0);
 2060|    440|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|    440|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    440|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 2061|       |
 2062|    440|    ps_dec->pu1_inv_scan = puc_temp;
 2063|       |
 2064|    440|    return OK;
  ------------------
  |  |  114|    440|#define OK        0
  ------------------
 2065|    440|}
ih264d_cavlc_parse_8x8block_top_available:
 2115|    335|{
 2116|    335|    UWORD32 u4_num_coeff, u4_n, u4_subblock_coded;
 2117|    335|    UWORD32 u4_top0, u4_top1;
 2118|    335|    UWORD32 *pu4_dummy;
 2119|    335|    WORD32 (**pf_cavlc_parse4x4coeff)(WORD16 *pi2_coeff_block,
 2120|    335|                                      UWORD32 u4_isdc,
 2121|    335|                                      WORD32 u4_n,
 2122|    335|                                      struct _DecStruct *ps_dec,
 2123|    335|                                      UWORD32 *pu4_dummy) =
 2124|    335|                                      ps_dec->pf_cavlc_parse4x4coeff;
 2125|    335|    UWORD32 u4_idx = 0;
 2126|    335|    UWORD8 *puc_temp;
 2127|    335|    WORD32 ret;
 2128|       |
 2129|    335|    *pu4_csbp = 0;
 2130|    335|    puc_temp = ps_dec->pu1_inv_scan;
 2131|       |
 2132|       |    /*------------------------------------------------------*/
 2133|       |    /* Residual 4x4 decoding: SubBlock 0                    */
 2134|       |    /*------------------------------------------------------*/
 2135|    335|    if(u1_tran_form8x8)
  ------------------
  |  Branch (2135:8): [True: 3, False: 332]
  ------------------
 2136|      3|    {
 2137|      3|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (2137:12): [True: 3, False: 0]
  ------------------
 2138|      3|        {
 2139|      3|            ps_dec->pu1_inv_scan =
 2140|      3|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[0];
 2141|      3|        }
 2142|      0|        else
 2143|      0|        {
 2144|      0|            ps_dec->pu1_inv_scan =
 2145|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[0];
 2146|      0|        }
 2147|      3|    }
 2148|    335|    u4_n = pu1_top_nnz[0];
 2149|    335|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 2150|    335|                                             u4_n, ps_dec, &u4_num_coeff);
 2151|    335|    if(ret != OK)
  ------------------
  |  |  114|    335|#define OK        0
  ------------------
  |  Branch (2151:8): [True: 0, False: 335]
  ------------------
 2152|      0|        return ret;
 2153|       |
 2154|    335|    u4_top0 = u4_num_coeff;
 2155|    335|    u4_subblock_coded = (u4_num_coeff != 0);
 2156|    335|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|    335|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    335|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 2157|       |
 2158|       |    /*------------------------------------------------------*/
 2159|       |    /* Residual 4x4 decoding: SubBlock 1                    */
 2160|       |    /*------------------------------------------------------*/
 2161|    335|    u4_idx++;
 2162|    335|    if(u1_tran_form8x8)
  ------------------
  |  Branch (2162:8): [True: 3, False: 332]
  ------------------
 2163|      3|    {
 2164|      3|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (2164:12): [True: 3, False: 0]
  ------------------
 2165|      3|        {
 2166|      3|            ps_dec->pu1_inv_scan =
 2167|      3|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[1];
 2168|      3|        }
 2169|      0|        else
 2170|      0|        {
 2171|      0|            ps_dec->pu1_inv_scan =
 2172|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[1];
 2173|      0|        }
 2174|      3|    }
 2175|    332|    else
 2176|    332|    {
 2177|    332|        pi2_coeff_block += NUM_COEFFS_IN_4x4BLK;
  ------------------
  |  |  617|    332|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 2178|    332|    }
 2179|    335|    u4_n = (pu1_top_nnz[1] + u4_num_coeff + 1) >> 1;
 2180|    335|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 2181|    335|                                             u4_n, ps_dec, &u4_num_coeff);
 2182|    335|    if(ret != OK)
  ------------------
  |  |  114|    335|#define OK        0
  ------------------
  |  Branch (2182:8): [True: 0, False: 335]
  ------------------
 2183|      0|        return ret;
 2184|       |
 2185|    335|    u4_top1 = pu1_left_nnz[0] = u4_num_coeff;
 2186|    335|    u4_subblock_coded = (u4_num_coeff != 0);
 2187|    335|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|    335|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    335|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 2188|       |
 2189|       |    /*------------------------------------------------------*/
 2190|       |    /* Residual 4x4 decoding: SubBlock 2                    */
 2191|       |    /*------------------------------------------------------*/
 2192|    335|    u4_idx += (u4_sub_block_strd - 1);
 2193|    335|    if(u1_tran_form8x8)
  ------------------
  |  Branch (2193:8): [True: 3, False: 332]
  ------------------
 2194|      3|    {
 2195|      3|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (2195:12): [True: 3, False: 0]
  ------------------
 2196|      3|        {
 2197|      3|            ps_dec->pu1_inv_scan =
 2198|      3|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[2];
 2199|      3|        }
 2200|      0|        else
 2201|      0|        {
 2202|      0|            ps_dec->pu1_inv_scan =
 2203|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[2];
 2204|      0|        }
 2205|      3|    }
 2206|    332|    else
 2207|    332|    {
 2208|    332|        pi2_coeff_block += ((u4_sub_block_strd - 1) * NUM_COEFFS_IN_4x4BLK);
  ------------------
  |  |  617|    332|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 2209|    332|    }
 2210|    335|    u4_n = u4_top0;
 2211|    335|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 2212|    335|                                             u4_n, ps_dec, &u4_num_coeff);
 2213|    335|    if(ret != OK)
  ------------------
  |  |  114|    335|#define OK        0
  ------------------
  |  Branch (2213:8): [True: 1, False: 334]
  ------------------
 2214|      1|        return ret;
 2215|       |
 2216|    334|    pu1_top_nnz[0] = u4_num_coeff;
 2217|    334|    u4_subblock_coded = (u4_num_coeff != 0);
 2218|    334|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|    334|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    334|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 2219|       |
 2220|       |    /*------------------------------------------------------*/
 2221|       |    /* Residual 4x4 decoding: SubBlock 3                    */
 2222|       |    /*------------------------------------------------------*/
 2223|    334|    u4_idx++;
 2224|    334|    if(u1_tran_form8x8)
  ------------------
  |  Branch (2224:8): [True: 3, False: 331]
  ------------------
 2225|      3|    {
 2226|      3|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (2226:12): [True: 3, False: 0]
  ------------------
 2227|      3|        {
 2228|      3|            ps_dec->pu1_inv_scan =
 2229|      3|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[3];
 2230|      3|        }
 2231|      0|        else
 2232|      0|        {
 2233|      0|            ps_dec->pu1_inv_scan =
 2234|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[3];
 2235|      0|        }
 2236|      3|    }
 2237|    331|    else
 2238|    331|    {
 2239|    331|        pi2_coeff_block += NUM_COEFFS_IN_4x4BLK;
  ------------------
  |  |  617|    331|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 2240|    331|    }
 2241|    334|    u4_n = (u4_top1 + u4_num_coeff + 1) >> 1;
 2242|    334|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 2243|    334|                                             u4_n, ps_dec, &u4_num_coeff);
 2244|    334|    if(ret != OK)
  ------------------
  |  |  114|    334|#define OK        0
  ------------------
  |  Branch (2244:8): [True: 0, False: 334]
  ------------------
 2245|      0|        return ret;
 2246|       |
 2247|    334|    pu1_top_nnz[1] = pu1_left_nnz[1] = u4_num_coeff;
 2248|    334|    u4_subblock_coded = (u4_num_coeff != 0);
 2249|    334|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|    334|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    334|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 2250|       |
 2251|    334|    ps_dec->pu1_inv_scan = puc_temp;
 2252|       |
 2253|    334|    return OK;
  ------------------
  |  |  114|    334|#define OK        0
  ------------------
 2254|    334|}
ih264d_cavlc_parse_8x8block_none_available:
 2304|    116|{
 2305|    116|    UWORD32 u4_num_coeff, u4_n, u4_subblock_coded;
 2306|    116|    UWORD32 u4_top0, u4_top1;
 2307|    116|    UWORD32 *pu4_dummy;
 2308|    116|    WORD32 (**pf_cavlc_parse4x4coeff)(WORD16 *pi2_coeff_block,
 2309|    116|                                      UWORD32 u4_isdc,
 2310|    116|                                      WORD32 u4_n,
 2311|    116|                                      struct _DecStruct *ps_dec,
 2312|    116|                                      UWORD32 *pu4_dummy) =
 2313|    116|                                      ps_dec->pf_cavlc_parse4x4coeff;
 2314|    116|    UWORD32 u4_idx = 0;
 2315|    116|    UWORD8 *puc_temp;
 2316|    116|    WORD32 ret;
 2317|       |
 2318|    116|    *pu4_csbp = 0;
 2319|    116|    puc_temp = ps_dec->pu1_inv_scan;
 2320|       |
 2321|       |    /*------------------------------------------------------*/
 2322|       |    /* Residual 4x4 decoding: SubBlock 0                    */
 2323|       |    /*------------------------------------------------------*/
 2324|    116|    if(u1_tran_form8x8)
  ------------------
  |  Branch (2324:8): [True: 0, False: 116]
  ------------------
 2325|      0|    {
 2326|      0|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (2326:12): [True: 0, False: 0]
  ------------------
 2327|      0|        {
 2328|      0|            ps_dec->pu1_inv_scan =
 2329|      0|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[0];
 2330|      0|        }
 2331|      0|        else
 2332|      0|        {
 2333|      0|            ps_dec->pu1_inv_scan =
 2334|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[0];
 2335|      0|        }
 2336|      0|    }
 2337|    116|    ret = pf_cavlc_parse4x4coeff[0](pi2_coeff_block, u4_isdc, 0,
 2338|    116|                                    ps_dec, &u4_num_coeff);
 2339|    116|    if(ret != OK)
  ------------------
  |  |  114|    116|#define OK        0
  ------------------
  |  Branch (2339:8): [True: 0, False: 116]
  ------------------
 2340|      0|        return ret;
 2341|       |
 2342|    116|    u4_top0 = u4_num_coeff;
 2343|    116|    u4_subblock_coded = (u4_num_coeff != 0);
 2344|    116|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|    116|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    116|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 2345|       |
 2346|       |    /*------------------------------------------------------*/
 2347|       |    /* Residual 4x4 decoding: SubBlock 1                    */
 2348|       |    /*------------------------------------------------------*/
 2349|    116|    u4_idx++;
 2350|    116|    if(u1_tran_form8x8)
  ------------------
  |  Branch (2350:8): [True: 0, False: 116]
  ------------------
 2351|      0|    {
 2352|      0|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (2352:12): [True: 0, False: 0]
  ------------------
 2353|      0|        {
 2354|      0|            ps_dec->pu1_inv_scan =
 2355|      0|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[1];
 2356|      0|        }
 2357|      0|        else
 2358|      0|        {
 2359|      0|            ps_dec->pu1_inv_scan =
 2360|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[1];
 2361|      0|        }
 2362|      0|    }
 2363|    116|    else
 2364|    116|    {
 2365|    116|        pi2_coeff_block += NUM_COEFFS_IN_4x4BLK;
  ------------------
  |  |  617|    116|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 2366|    116|    }
 2367|    116|    u4_n = u4_num_coeff;
 2368|    116|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 2369|    116|                                             u4_n, ps_dec, &u4_num_coeff);
 2370|    116|    if(ret != OK)
  ------------------
  |  |  114|    116|#define OK        0
  ------------------
  |  Branch (2370:8): [True: 0, False: 116]
  ------------------
 2371|      0|        return ret;
 2372|       |
 2373|    116|    u4_top1 = pu1_left_nnz[0] = u4_num_coeff;
 2374|    116|    u4_subblock_coded = (u4_num_coeff != 0);
 2375|    116|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|    116|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    116|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 2376|       |
 2377|       |    /*------------------------------------------------------*/
 2378|       |    /* Residual 4x4 decoding: SubBlock 2                    */
 2379|       |    /*------------------------------------------------------*/
 2380|    116|    u4_idx += (u4_sub_block_strd - 1);
 2381|    116|    if(u1_tran_form8x8)
  ------------------
  |  Branch (2381:8): [True: 0, False: 116]
  ------------------
 2382|      0|    {
 2383|      0|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (2383:12): [True: 0, False: 0]
  ------------------
 2384|      0|        {
 2385|      0|            ps_dec->pu1_inv_scan =
 2386|      0|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[2];
 2387|      0|        }
 2388|      0|        else
 2389|      0|        {
 2390|      0|            ps_dec->pu1_inv_scan =
 2391|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[2];
 2392|      0|        }
 2393|      0|    }
 2394|    116|    else
 2395|    116|    {
 2396|    116|        pi2_coeff_block += ((u4_sub_block_strd - 1) * NUM_COEFFS_IN_4x4BLK);
  ------------------
  |  |  617|    116|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 2397|    116|    }
 2398|    116|    u4_n = u4_top0;
 2399|    116|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 2400|    116|                                             u4_n, ps_dec, &u4_num_coeff);
 2401|    116|    if(ret != OK)
  ------------------
  |  |  114|    116|#define OK        0
  ------------------
  |  Branch (2401:8): [True: 0, False: 116]
  ------------------
 2402|      0|        return ret;
 2403|       |
 2404|    116|    pu1_top_nnz[0] = u4_num_coeff;
 2405|    116|    u4_subblock_coded = (u4_num_coeff != 0);
 2406|    116|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|    116|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    116|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 2407|       |
 2408|       |    /*------------------------------------------------------*/
 2409|       |    /* Residual 4x4 decoding: SubBlock 3                    */
 2410|       |    /*------------------------------------------------------*/
 2411|    116|    u4_idx++;
 2412|    116|    if(u1_tran_form8x8)
  ------------------
  |  Branch (2412:8): [True: 0, False: 116]
  ------------------
 2413|      0|    {
 2414|      0|        if(!u1_mb_field_decodingflag)
  ------------------
  |  Branch (2414:12): [True: 0, False: 0]
  ------------------
 2415|      0|        {
 2416|      0|            ps_dec->pu1_inv_scan =
 2417|      0|                            (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[3];
 2418|      0|        }
 2419|      0|        else
 2420|      0|        {
 2421|      0|            ps_dec->pu1_inv_scan =
 2422|      0|                            (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[3];
 2423|      0|        }
 2424|      0|    }
 2425|    116|    else
 2426|    116|    {
 2427|    116|        pi2_coeff_block += NUM_COEFFS_IN_4x4BLK;
  ------------------
  |  |  617|    116|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 2428|    116|    }
 2429|    116|    u4_n = (u4_top1 + u4_num_coeff + 1) >> 1;
 2430|    116|    ret = pf_cavlc_parse4x4coeff[(u4_n > 7)](pi2_coeff_block, u4_isdc,
 2431|    116|                                             u4_n, ps_dec, &u4_num_coeff);
 2432|    116|    if(ret != OK)
  ------------------
  |  |  114|    116|#define OK        0
  ------------------
  |  Branch (2432:8): [True: 0, False: 116]
  ------------------
 2433|      0|        return ret;
 2434|       |
 2435|    116|    pu1_top_nnz[1] = pu1_left_nnz[1] = u4_num_coeff;
 2436|    116|    u4_subblock_coded = (u4_num_coeff != 0);
 2437|    116|    INSERT_BIT(*pu4_csbp, u4_idx, u4_subblock_coded);
  ------------------
  |  |  109|    116|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    116|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
 2438|       |
 2439|    116|    ps_dec->pu1_inv_scan = puc_temp;
 2440|       |
 2441|    116|    return OK;
  ------------------
  |  |  114|    116|#define OK        0
  ------------------
 2442|    116|}
ih264d_parse_residual4x4_cavlc:
 2459|  3.54k|{
 2460|  3.54k|    UWORD8 u1_cbp = ps_cur_mb_info->u1_cbp;
 2461|  3.54k|    UWORD16 ui16_csbp = 0;
 2462|  3.54k|    UWORD32 u4_nbr_avl;
 2463|  3.54k|    WORD16 *pi2_residual_buf;
 2464|       |
 2465|  3.54k|    UWORD8 u1_is_top_mb_avail;
 2466|  3.54k|    UWORD8 u1_is_left_mb_avail;
 2467|       |
 2468|  3.54k|    UWORD8 *pu1_top_nnz = ps_cur_mb_info->ps_curmb->pu1_nnz_y;
 2469|  3.54k|    UWORD8 *pu1_left_nnz = ps_dec->pu1_left_nnz_y;
 2470|  3.54k|    WORD16 *pi2_coeff_block = NULL;
 2471|  3.54k|    UWORD32 *pu4_dummy;
 2472|  3.54k|    WORD32 ret;
 2473|       |
 2474|  3.54k|    WORD32 (**pf_cavlc_parse_8x8block)(WORD16 *pi2_coeff_block,
 2475|  3.54k|                                       UWORD32 u4_sub_block_strd,
 2476|  3.54k|                                       UWORD32 u4_isdc,
 2477|  3.54k|                                       struct _DecStruct *ps_dec,
 2478|  3.54k|                                       UWORD8 *pu1_top_nnz,
 2479|  3.54k|                                       UWORD8 *pu1_left_nnz,
 2480|  3.54k|                                       UWORD8 u1_tran_form8x8,
 2481|  3.54k|                                       UWORD8 u1_mb_field_decodingflag,
 2482|  3.54k|                                       UWORD32 *pu4_dummy) = ps_dec->pf_cavlc_parse_8x8block;
 2483|       |
 2484|       |
 2485|  3.54k|    {
 2486|  3.54k|        UWORD8 uc_temp = ps_dec->u1_mb_ngbr_availablity;
 2487|  3.54k|        u1_is_top_mb_avail = BOOLEAN(uc_temp & TOP_MB_AVAILABLE_MASK);
  ------------------
  |  |   61|  3.54k|#define BOOLEAN(x) (!!(x))
  ------------------
 2488|  3.54k|        u1_is_left_mb_avail = BOOLEAN(uc_temp & LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   61|  3.54k|#define BOOLEAN(x) (!!(x))
  ------------------
 2489|  3.54k|        u4_nbr_avl = (u1_is_top_mb_avail << 1) | u1_is_left_mb_avail;
 2490|  3.54k|    }
 2491|       |
 2492|  3.54k|    ps_cur_mb_info->u1_qp_div6 = ps_dec->u1_qp_y_div6;
 2493|  3.54k|    ps_cur_mb_info->u1_qp_rem6 = ps_dec->u1_qp_y_rem6;
 2494|  3.54k|    ps_cur_mb_info->u1_qpc_div6 = ps_dec->u1_qp_u_div6;
 2495|  3.54k|    ps_cur_mb_info->u1_qpc_rem6 = ps_dec->u1_qp_u_rem6;
 2496|  3.54k|    ps_cur_mb_info->u1_qpcr_div6 = ps_dec->u1_qp_v_div6;
 2497|  3.54k|    ps_cur_mb_info->u1_qpcr_rem6 = ps_dec->u1_qp_v_rem6;
 2498|       |
 2499|  3.54k|    if(u1_cbp & 0xf)
  ------------------
  |  Branch (2499:8): [True: 1.66k, False: 1.88k]
  ------------------
 2500|  1.66k|    {
 2501|  1.66k|        pu1_top_nnz[0] = ps_cur_mb_info->ps_top_mb->pu1_nnz_y[0];
 2502|  1.66k|        pu1_top_nnz[1] = ps_cur_mb_info->ps_top_mb->pu1_nnz_y[1];
 2503|  1.66k|        pu1_top_nnz[2] = ps_cur_mb_info->ps_top_mb->pu1_nnz_y[2];
 2504|  1.66k|        pu1_top_nnz[3] = ps_cur_mb_info->ps_top_mb->pu1_nnz_y[3];
 2505|       |
 2506|       |        /*******************************************************************/
 2507|       |        /* Block 0 residual decoding, check cbp and proceed (subblock = 0) */
 2508|       |        /*******************************************************************/
 2509|  1.66k|        if(!(u1_cbp & 0x1))
  ------------------
  |  Branch (2509:12): [True: 1.05k, False: 611]
  ------------------
 2510|  1.05k|        {
 2511|  1.05k|            *(UWORD16 *)(pu1_top_nnz) = 0;
 2512|  1.05k|            *(UWORD16 *)(pu1_left_nnz) = 0;
 2513|       |
 2514|  1.05k|        }
 2515|    611|        else
 2516|    611|        {
 2517|    611|            UWORD32 u4_temp;
 2518|    611|            ret = pf_cavlc_parse_8x8block[u4_nbr_avl](
 2519|    611|                        pi2_coeff_block, 4, u1_offset, ps_dec, pu1_top_nnz,
 2520|    611|                        pu1_left_nnz, ps_cur_mb_info->u1_tran_form8x8,
 2521|    611|                        ps_cur_mb_info->u1_mb_field_decodingflag, &u4_temp);
 2522|    611|            if(ret != OK)
  ------------------
  |  |  114|    611|#define OK        0
  ------------------
  |  Branch (2522:16): [True: 9, False: 602]
  ------------------
 2523|      9|                return ret;
 2524|    602|            ui16_csbp = u4_temp;
 2525|    602|        }
 2526|       |
 2527|       |        /*******************************************************************/
 2528|       |        /* Block 1 residual decoding, check cbp and proceed (subblock = 2) */
 2529|       |        /*******************************************************************/
 2530|  1.65k|        if(ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (2530:12): [True: 1.10k, False: 544]
  ------------------
 2531|  1.10k|        {
 2532|  1.10k|            pi2_coeff_block += 64;
 2533|  1.10k|        }
 2534|    544|        else
 2535|    544|        {
 2536|    544|            pi2_coeff_block += (2 * NUM_COEFFS_IN_4x4BLK);
  ------------------
  |  |  617|    544|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 2537|    544|        }
 2538|       |
 2539|  1.65k|        if(!(u1_cbp & 0x2))
  ------------------
  |  Branch (2539:12): [True: 1.49k, False: 162]
  ------------------
 2540|  1.49k|        {
 2541|  1.49k|            *(UWORD16 *)(pu1_top_nnz + 2) = 0;
 2542|  1.49k|            *(UWORD16 *)(pu1_left_nnz) = 0;
 2543|  1.49k|        }
 2544|    162|        else
 2545|    162|        {
 2546|    162|            UWORD32 u4_temp = (u4_nbr_avl | 0x1);
 2547|    162|            ret = pf_cavlc_parse_8x8block[u4_temp](
 2548|    162|                        pi2_coeff_block, 4, u1_offset, ps_dec,
 2549|    162|                        (pu1_top_nnz + 2), pu1_left_nnz,
 2550|    162|                        ps_cur_mb_info->u1_tran_form8x8,
 2551|    162|                        ps_cur_mb_info->u1_mb_field_decodingflag, &u4_temp);
 2552|    162|            if(ret != OK)
  ------------------
  |  |  114|    162|#define OK        0
  ------------------
  |  Branch (2552:16): [True: 61, False: 101]
  ------------------
 2553|     61|                return ret;
 2554|    101|            ui16_csbp |= (u4_temp << 2);
 2555|    101|        }
 2556|       |
 2557|       |        /*******************************************************************/
 2558|       |        /* Block 2 residual decoding, check cbp and proceed (subblock = 8) */
 2559|       |        /*******************************************************************/
 2560|  1.59k|        if(ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (2560:12): [True: 1.10k, False: 484]
  ------------------
 2561|  1.10k|        {
 2562|  1.10k|            pi2_coeff_block += 64;
 2563|  1.10k|        }
 2564|    484|        else
 2565|    484|        {
 2566|    484|            pi2_coeff_block += (6 * NUM_COEFFS_IN_4x4BLK);
  ------------------
  |  |  617|    484|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 2567|    484|        }
 2568|       |
 2569|  1.59k|        if(!(u1_cbp & 0x4))
  ------------------
  |  Branch (2569:12): [True: 1.30k, False: 283]
  ------------------
 2570|  1.30k|        {
 2571|  1.30k|            *(UWORD16 *)(pu1_top_nnz) = 0;
 2572|  1.30k|            *(UWORD16 *)(pu1_left_nnz + 2) = 0;
 2573|  1.30k|        }
 2574|    283|        else
 2575|    283|        {
 2576|    283|            UWORD32 u4_temp = (u4_nbr_avl | 0x2);
 2577|    283|            ret = pf_cavlc_parse_8x8block[u4_temp](
 2578|    283|                        pi2_coeff_block, 4, u1_offset, ps_dec, pu1_top_nnz,
 2579|    283|                        (pu1_left_nnz + 2), ps_cur_mb_info->u1_tran_form8x8,
 2580|    283|                        ps_cur_mb_info->u1_mb_field_decodingflag, &u4_temp);
 2581|    283|            if(ret != OK)
  ------------------
  |  |  114|    283|#define OK        0
  ------------------
  |  Branch (2581:16): [True: 0, False: 283]
  ------------------
 2582|      0|                return ret;
 2583|    283|            ui16_csbp |= (u4_temp << 8);
 2584|    283|        }
 2585|       |
 2586|       |        /*******************************************************************/
 2587|       |        /* Block 3 residual decoding, check cbp and proceed (subblock = 10)*/
 2588|       |        /*******************************************************************/
 2589|  1.59k|        if(ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (2589:12): [True: 1.10k, False: 484]
  ------------------
 2590|  1.10k|        {
 2591|  1.10k|            pi2_coeff_block += 64;
 2592|  1.10k|        }
 2593|    484|        else
 2594|    484|        {
 2595|    484|            pi2_coeff_block += (2 * NUM_COEFFS_IN_4x4BLK);
  ------------------
  |  |  617|    484|#define NUM_COEFFS_IN_4x4BLK 16
  ------------------
 2596|    484|        }
 2597|       |
 2598|  1.59k|        if(!(u1_cbp & 0x8))
  ------------------
  |  Branch (2598:12): [True: 278, False: 1.31k]
  ------------------
 2599|    278|        {
 2600|    278|            *(UWORD16 *)(pu1_top_nnz + 2) = 0;
 2601|    278|            *(UWORD16 *)(pu1_left_nnz + 2) = 0;
 2602|    278|        }
 2603|  1.31k|        else
 2604|  1.31k|        {
 2605|  1.31k|            UWORD32 u4_temp;
 2606|  1.31k|            ret = pf_cavlc_parse_8x8block[0x3](
 2607|  1.31k|                        pi2_coeff_block, 4, u1_offset, ps_dec,
 2608|  1.31k|                        (pu1_top_nnz + 2), (pu1_left_nnz + 2),
 2609|  1.31k|                        ps_cur_mb_info->u1_tran_form8x8,
 2610|  1.31k|                        ps_cur_mb_info->u1_mb_field_decodingflag, &u4_temp);
 2611|  1.31k|            if(ret != OK)
  ------------------
  |  |  114|  1.31k|#define OK        0
  ------------------
  |  Branch (2611:16): [True: 8, False: 1.30k]
  ------------------
 2612|      8|                return ret;
 2613|  1.30k|            ui16_csbp |= (u4_temp << 10);
 2614|  1.30k|        }
 2615|  1.59k|    }
 2616|  1.88k|    else
 2617|  1.88k|    {
 2618|  1.88k|        *(UWORD32 *)(pu1_top_nnz) = 0;
 2619|  1.88k|        *(UWORD32 *)(pu1_left_nnz) = 0;
 2620|  1.88k|    }
 2621|       |
 2622|  3.46k|    ps_cur_mb_info->u2_luma_csbp = ui16_csbp;
 2623|  3.46k|    ps_cur_mb_info->ps_curmb->u2_luma_csbp = ui16_csbp;
 2624|       |
 2625|  3.46k|    {
 2626|  3.46k|        UWORD16 u2_chroma_csbp = 0;
 2627|  3.46k|        ps_cur_mb_info->u2_chroma_csbp = 0;
 2628|  3.46k|        pu1_top_nnz = ps_cur_mb_info->ps_curmb->pu1_nnz_uv;
 2629|  3.46k|        pu1_left_nnz = ps_dec->pu1_left_nnz_uv;
 2630|       |
 2631|  3.46k|        u1_cbp >>= 4;
 2632|       |        /*--------------------------------------------------------------------*/
 2633|       |        /* if Chroma Component not present OR no ac values present            */
 2634|       |        /* Set the values of N to zero                                        */
 2635|       |        /*--------------------------------------------------------------------*/
 2636|  3.46k|        if(u1_cbp == CBPC_ALLZERO || u1_cbp == CBPC_ACZERO)
  ------------------
  |  |  507|  6.93k|#define CBPC_ALLZERO    0
  ------------------
                      if(u1_cbp == CBPC_ALLZERO || u1_cbp == CBPC_ACZERO)
  ------------------
  |  |  508|  2.15k|#define CBPC_ACZERO     1
  ------------------
  |  Branch (2636:12): [True: 1.31k, False: 2.15k]
  |  Branch (2636:38): [True: 1.95k, False: 193]
  ------------------
 2637|  3.27k|        {
 2638|  3.27k|            *(UWORD32 *)(pu1_top_nnz) = 0;
 2639|  3.27k|            *(UWORD32 *)(pu1_left_nnz) = 0;
 2640|  3.27k|        }
 2641|       |
 2642|  3.46k|        if(u1_cbp == CBPC_ALLZERO)
  ------------------
  |  |  507|  3.46k|#define CBPC_ALLZERO    0
  ------------------
  |  Branch (2642:12): [True: 1.31k, False: 2.15k]
  ------------------
 2643|  1.31k|        {
 2644|  1.31k|            return (0);
 2645|  1.31k|        }
 2646|       |        /*--------------------------------------------------------------------*/
 2647|       |        /* Decode Chroma DC values                                            */
 2648|       |        /*--------------------------------------------------------------------*/
 2649|  2.15k|        {
 2650|  2.15k|            WORD32 u4_scale_u;
 2651|  2.15k|            WORD32 u4_scale_v;
 2652|  2.15k|            WORD32 i4_mb_inter_inc;
 2653|  2.15k|            u4_scale_u = ps_dec->pu2_quant_scale_u[0] << ps_dec->u1_qp_u_div6;
 2654|  2.15k|            u4_scale_v = ps_dec->pu2_quant_scale_v[0] << ps_dec->u1_qp_v_div6;
 2655|  2.15k|            i4_mb_inter_inc = (!((ps_cur_mb_info->ps_curmb->u1_mb_type == I_4x4_MB)
  ------------------
  |  |  417|  2.15k|#define I_4x4_MB    0
  ------------------
  |  Branch (2655:34): [True: 247, False: 1.90k]
  ------------------
 2656|  1.90k|                            || (ps_cur_mb_info->ps_curmb->u1_mb_type == I_16x16_MB)))
  ------------------
  |  |  418|  1.90k|#define I_16x16_MB  1
  ------------------
  |  Branch (2656:32): [True: 828, False: 1.07k]
  ------------------
 2657|  2.15k|                            * 3;
 2658|       |
 2659|  2.15k|            if(ps_dec->s_high_profile.u1_scaling_present)
  ------------------
  |  Branch (2659:16): [True: 544, False: 1.60k]
  ------------------
 2660|    544|            {
 2661|    544|                u4_scale_u *=
 2662|    544|                                ps_dec->s_high_profile.i2_scalinglist4x4[i4_mb_inter_inc
 2663|    544|                                                + 1][0];
 2664|    544|                u4_scale_v *=
 2665|    544|                                ps_dec->s_high_profile.i2_scalinglist4x4[i4_mb_inter_inc
 2666|    544|                                                + 2][0];
 2667|       |
 2668|    544|            }
 2669|  1.60k|            else
 2670|  1.60k|            {
 2671|  1.60k|                u4_scale_u <<= 4;
 2672|  1.60k|                u4_scale_v <<= 4;
 2673|  1.60k|            }
 2674|       |
 2675|  2.15k|            ih264d_cavlc_parse_chroma_dc(ps_cur_mb_info,pi2_coeff_block, ps_dec->ps_bitstrm,
 2676|  2.15k|                                         u4_scale_u, u4_scale_v,
 2677|  2.15k|                                         i4_mb_inter_inc);
 2678|  2.15k|        }
 2679|       |
 2680|  2.15k|        if(u1_cbp == CBPC_ACZERO)
  ------------------
  |  |  508|  2.15k|#define CBPC_ACZERO     1
  ------------------
  |  Branch (2680:12): [True: 1.95k, False: 193]
  ------------------
 2681|  1.95k|            return (0);
 2682|       |
 2683|    193|        pu1_top_nnz[0] = ps_cur_mb_info->ps_top_mb->pu1_nnz_uv[0];
 2684|    193|        pu1_top_nnz[1] = ps_cur_mb_info->ps_top_mb->pu1_nnz_uv[1];
 2685|    193|        pu1_top_nnz[2] = ps_cur_mb_info->ps_top_mb->pu1_nnz_uv[2];
 2686|    193|        pu1_top_nnz[3] = ps_cur_mb_info->ps_top_mb->pu1_nnz_uv[3];
 2687|       |        /*--------------------------------------------------------------------*/
 2688|       |        /* Decode Chroma AC values                                            */
 2689|       |        /*--------------------------------------------------------------------*/
 2690|    193|        {
 2691|    193|            UWORD32 u4_temp;
 2692|       |            /*****************************************************************/
 2693|       |            /* U Block  residual decoding, check cbp and proceed (subblock=0)*/
 2694|       |            /*****************************************************************/
 2695|    193|            ret = pf_cavlc_parse_8x8block[u4_nbr_avl](
 2696|    193|                        pi2_coeff_block, 2, 1, ps_dec, pu1_top_nnz,
 2697|    193|                        pu1_left_nnz, 0, 0, &u4_temp);
 2698|    193|            if(ret != OK)
  ------------------
  |  |  114|    193|#define OK        0
  ------------------
  |  Branch (2698:16): [True: 2, False: 191]
  ------------------
 2699|      2|                return ret;
 2700|    191|            u2_chroma_csbp = u4_temp;
 2701|       |
 2702|    191|            pi2_coeff_block += MB_CHROM_SIZE;
  ------------------
  |  |  564|    191|#define MB_CHROM_SIZE                 64
  ------------------
 2703|       |            /*****************************************************************/
 2704|       |            /* V Block  residual decoding, check cbp and proceed (subblock=1)*/
 2705|       |            /*****************************************************************/
 2706|    191|            ret = pf_cavlc_parse_8x8block[u4_nbr_avl](pi2_coeff_block, 2, 1,
 2707|    191|                                                      ps_dec,
 2708|    191|                                                      (pu1_top_nnz + 2),
 2709|    191|                                                      (pu1_left_nnz + 2), 0,
 2710|    191|                                                      0, &u4_temp);
 2711|    191|            if(ret != OK)
  ------------------
  |  |  114|    191|#define OK        0
  ------------------
  |  Branch (2711:16): [True: 3, False: 188]
  ------------------
 2712|      3|                return ret;
 2713|    188|            u2_chroma_csbp |= (u4_temp << 4);
 2714|    188|        }
 2715|       |
 2716|      0|        ps_cur_mb_info->u2_chroma_csbp = u2_chroma_csbp;
 2717|    188|    }
 2718|    188|    return OK;
  ------------------
  |  |  114|    188|#define OK        0
  ------------------
 2719|    191|}

ih264d_get_pre_sei_params:
   86|  5.87k|{
   87|  5.87k|    if((NULL != ps_dec->ps_sei) &&
  ------------------
  |  Branch (87:8): [True: 5.87k, False: 0]
  ------------------
   88|  5.87k|        ((0 == ps_dec->ps_sei->s_sei_ccv_params.u1_ccv_cancel_flag) &&
  ------------------
  |  Branch (88:10): [True: 5.84k, False: 31]
  ------------------
   89|  5.84k|        (0 == ps_dec->ps_sei->s_sei_ccv_params.u1_ccv_persistence_flag)))
  ------------------
  |  Branch (89:9): [True: 5.84k, False: 0]
  ------------------
   90|  5.84k|    {
   91|  5.84k|        ps_dec->ps_sei->u1_sei_ccv_params_present_flag = 0;
   92|  5.84k|        memset(&ps_dec->ps_sei->s_sei_ccv_params, 0, sizeof(sei_ccv_params_t));
   93|  5.84k|    }
   94|       |
   95|  5.87k|    if((NULL != ps_dec->ps_cur_sps) &&
  ------------------
  |  Branch (95:8): [True: 5.63k, False: 236]
  ------------------
   96|  5.63k|        ((1 == ps_dec->ps_cur_sps->u1_vui_parameters_present_flag) &&
  ------------------
  |  Branch (96:10): [True: 1.87k, False: 3.76k]
  ------------------
   97|  1.87k|        ((2 != ps_dec->ps_cur_sps->s_vui.u1_colour_primaries) &&
  ------------------
  |  Branch (97:10): [True: 162, False: 1.71k]
  ------------------
   98|    162|        (2 != ps_dec->ps_cur_sps->s_vui.u1_matrix_coeffs) &&
  ------------------
  |  Branch (98:9): [True: 162, False: 0]
  ------------------
   99|    162|        (2 != ps_dec->ps_cur_sps->s_vui.u1_tfr_chars) &&
  ------------------
  |  Branch (99:9): [True: 162, False: 0]
  ------------------
  100|    162|        (4 != ps_dec->ps_cur_sps->s_vui.u1_tfr_chars) &&
  ------------------
  |  Branch (100:9): [True: 162, False: 0]
  ------------------
  101|    162|        (5 != ps_dec->ps_cur_sps->s_vui.u1_tfr_chars))))
  ------------------
  |  Branch (101:9): [True: 162, False: 0]
  ------------------
  102|    162|    {
  103|    162|        if((1 == ps_dec->ps_sei_parse->u1_sei_ccv_params_present_flag) ||
  ------------------
  |  Branch (103:12): [True: 3, False: 159]
  ------------------
  104|    159|            (IDR_SLICE_NAL == u1_nal_unit_type))
  ------------------
  |  |  328|    159|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (104:13): [True: 131, False: 28]
  ------------------
  105|    134|        {
  106|    134|            ps_dec->ps_sei->u1_sei_ccv_params_present_flag =
  107|    134|                        ps_dec->ps_sei_parse->u1_sei_ccv_params_present_flag;
  108|    134|            ps_dec->ps_sei->s_sei_ccv_params = ps_dec->ps_sei_parse->s_sei_ccv_params;
  109|    134|        }
  110|    162|    }
  111|  5.71k|    else
  112|  5.71k|    {
  113|  5.71k|        ps_dec->ps_sei->u1_sei_ccv_params_present_flag = 0;
  114|  5.71k|        memset(&ps_dec->ps_sei->s_sei_ccv_params, 0, sizeof(sei_ccv_params_t));
  115|  5.71k|    }
  116|       |
  117|  5.87k|    if(IDR_SLICE_NAL == u1_nal_unit_type)
  ------------------
  |  |  328|  5.87k|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (117:8): [True: 3.61k, False: 2.25k]
  ------------------
  118|  3.61k|    {
  119|  3.61k|        ps_dec->ps_sei->u1_sei_mdcv_params_present_flag =
  120|  3.61k|                        ps_dec->ps_sei_parse->u1_sei_mdcv_params_present_flag;
  121|  3.61k|        ps_dec->ps_sei->s_sei_mdcv_params = ps_dec->ps_sei_parse->s_sei_mdcv_params;
  122|  3.61k|        ps_dec->ps_sei->u1_sei_cll_params_present_flag =
  123|  3.61k|                        ps_dec->ps_sei_parse->u1_sei_cll_params_present_flag;
  124|  3.61k|        ps_dec->ps_sei->s_sei_cll_params = ps_dec->ps_sei_parse->s_sei_cll_params;
  125|  3.61k|        ps_dec->ps_sei->u1_sei_ave_params_present_flag =
  126|  3.61k|                        ps_dec->ps_sei_parse->u1_sei_ave_params_present_flag;
  127|  3.61k|        ps_dec->ps_sei->s_sei_ave_params = ps_dec->ps_sei_parse->s_sei_ave_params;
  128|  3.61k|        ps_dec->ps_sei->u1_sei_sii_params_present_flag =
  129|  3.61k|            ps_dec->ps_sei_parse->u1_sei_sii_params_present_flag;
  130|  3.61k|        ps_dec->ps_sei->s_sei_sii_params = ps_dec->ps_sei_parse->s_sei_sii_params;
  131|  3.61k|    }
  132|       |
  133|  5.87k|    if(NULL != ps_dec->ps_sei)
  ------------------
  |  Branch (133:8): [True: 5.87k, False: 0]
  ------------------
  134|  5.87k|    {
  135|  5.87k|        ps_dec->ps_sei->u1_sei_fgc_params_present_flag =
  136|  5.87k|            ps_dec->ps_sei_parse->u1_sei_fgc_params_present_flag;
  137|  5.87k|        ps_dec->ps_sei->s_sei_fgc_params = ps_dec->ps_sei_parse->s_sei_fgc_params;
  138|  5.87k|    }
  139|       |
  140|  5.87k|    ps_dec->ps_sei_parse->u1_sei_mdcv_params_present_flag = 0;
  141|  5.87k|    memset(&ps_dec->ps_sei_parse->s_sei_mdcv_params, 0, sizeof(sei_mdcv_params_t));
  142|  5.87k|    ps_dec->ps_sei_parse->u1_sei_cll_params_present_flag = 0;
  143|  5.87k|    memset(&ps_dec->ps_sei_parse->s_sei_cll_params, 0, sizeof(sei_cll_params_t));
  144|  5.87k|    ps_dec->ps_sei_parse->u1_sei_ave_params_present_flag = 0;
  145|  5.87k|    memset(&ps_dec->ps_sei_parse->s_sei_ave_params, 0, sizeof(sei_ave_params_t));
  146|  5.87k|    ps_dec->ps_sei_parse->u1_sei_ccv_params_present_flag = 0;
  147|  5.87k|    memset(&ps_dec->ps_sei_parse->s_sei_ccv_params, 0, sizeof(sei_ccv_params_t));
  148|  5.87k|    ps_dec->ps_sei_parse->u1_sei_sii_params_present_flag = 0;
  149|  5.87k|    memset(&ps_dec->ps_sei_parse->s_sei_sii_params, 0, sizeof(sei_sii_params_t));
  150|  5.87k|}
ih264d_correct_level_idc:
  500|  7.78k|{
  501|  7.78k|    UWORD32 u4_max_mbs_allowed;
  502|       |
  503|  7.78k|    switch(u4_level_idc)
  504|  7.78k|    {
  505|      5|        case H264_LEVEL_1_0:
  ------------------
  |  |  291|      5|#define H264_LEVEL_1_0     10
  ------------------
  |  Branch (505:9): [True: 5, False: 7.77k]
  ------------------
  506|      5|            u4_max_mbs_allowed = MAX_MBS_LEVEL_10;
  ------------------
  |  |  321|      5|#define MAX_MBS_LEVEL_10 99
  ------------------
  507|      5|            break;
  508|  1.48k|        case H264_LEVEL_1_1:
  ------------------
  |  |  292|  1.48k|#define H264_LEVEL_1_1     11
  ------------------
  |  Branch (508:9): [True: 1.48k, False: 6.29k]
  ------------------
  509|  1.48k|            u4_max_mbs_allowed = MAX_MBS_LEVEL_11;
  ------------------
  |  |  320|  1.48k|#define MAX_MBS_LEVEL_11 396
  ------------------
  510|  1.48k|            break;
  511|     13|        case H264_LEVEL_1_2:
  ------------------
  |  |  293|     13|#define H264_LEVEL_1_2     12
  ------------------
  |  Branch (511:9): [True: 13, False: 7.77k]
  ------------------
  512|     13|            u4_max_mbs_allowed = MAX_MBS_LEVEL_12;
  ------------------
  |  |  319|     13|#define MAX_MBS_LEVEL_12 396
  ------------------
  513|     13|            break;
  514|      0|        case H264_LEVEL_1_3:
  ------------------
  |  |  294|      0|#define H264_LEVEL_1_3     13
  ------------------
  |  Branch (514:9): [True: 0, False: 7.78k]
  ------------------
  515|      0|            u4_max_mbs_allowed = MAX_MBS_LEVEL_13;
  ------------------
  |  |  318|      0|#define MAX_MBS_LEVEL_13 396
  ------------------
  516|      0|            break;
  517|  1.32k|        case H264_LEVEL_2_0:
  ------------------
  |  |  295|  1.32k|#define H264_LEVEL_2_0     20
  ------------------
  |  Branch (517:9): [True: 1.32k, False: 6.45k]
  ------------------
  518|  1.32k|            u4_max_mbs_allowed = MAX_MBS_LEVEL_20;
  ------------------
  |  |  317|  1.32k|#define MAX_MBS_LEVEL_20 396
  ------------------
  519|  1.32k|            break;
  520|     25|        case H264_LEVEL_2_1:
  ------------------
  |  |  296|     25|#define H264_LEVEL_2_1     21
  ------------------
  |  Branch (520:9): [True: 25, False: 7.75k]
  ------------------
  521|     25|            u4_max_mbs_allowed = MAX_MBS_LEVEL_21;
  ------------------
  |  |  316|     25|#define MAX_MBS_LEVEL_21 792
  ------------------
  522|     25|            break;
  523|      0|        case H264_LEVEL_2_2:
  ------------------
  |  |  297|      0|#define H264_LEVEL_2_2     22
  ------------------
  |  Branch (523:9): [True: 0, False: 7.78k]
  ------------------
  524|      0|            u4_max_mbs_allowed = MAX_MBS_LEVEL_22;
  ------------------
  |  |  315|      0|#define MAX_MBS_LEVEL_22 1620
  ------------------
  525|      0|            break;
  526|      2|        case H264_LEVEL_3_0:
  ------------------
  |  |  298|      2|#define H264_LEVEL_3_0     30
  ------------------
  |  Branch (526:9): [True: 2, False: 7.78k]
  ------------------
  527|      2|            u4_max_mbs_allowed = MAX_MBS_LEVEL_30;
  ------------------
  |  |  314|      2|#define MAX_MBS_LEVEL_30 1620
  ------------------
  528|      2|            break;
  529|     16|        case H264_LEVEL_3_1:
  ------------------
  |  |  299|     16|#define H264_LEVEL_3_1     31
  ------------------
  |  Branch (529:9): [True: 16, False: 7.76k]
  ------------------
  530|     16|            u4_max_mbs_allowed = MAX_MBS_LEVEL_31;
  ------------------
  |  |  313|     16|#define MAX_MBS_LEVEL_31 3600
  ------------------
  531|     16|            break;
  532|     68|        case H264_LEVEL_3_2:
  ------------------
  |  |  300|     68|#define H264_LEVEL_3_2     32
  ------------------
  |  Branch (532:9): [True: 68, False: 7.71k]
  ------------------
  533|     68|            u4_max_mbs_allowed = MAX_MBS_LEVEL_32;
  ------------------
  |  |  312|     68|#define MAX_MBS_LEVEL_32 5120
  ------------------
  534|     68|            break;
  535|     19|        case H264_LEVEL_4_0:
  ------------------
  |  |  301|     19|#define H264_LEVEL_4_0     40
  ------------------
  |  Branch (535:9): [True: 19, False: 7.76k]
  ------------------
  536|     19|            u4_max_mbs_allowed = MAX_MBS_LEVEL_40;
  ------------------
  |  |  311|     19|#define MAX_MBS_LEVEL_40 8192
  ------------------
  537|     19|            break;
  538|  4.69k|        case H264_LEVEL_4_1:
  ------------------
  |  |  302|  4.69k|#define H264_LEVEL_4_1     41
  ------------------
  |  Branch (538:9): [True: 4.69k, False: 3.08k]
  ------------------
  539|  4.69k|            u4_max_mbs_allowed = MAX_MBS_LEVEL_41;
  ------------------
  |  |  310|  4.69k|#define MAX_MBS_LEVEL_41 8192
  ------------------
  540|  4.69k|            break;
  541|      0|        case H264_LEVEL_4_2:
  ------------------
  |  |  303|      0|#define H264_LEVEL_4_2     42
  ------------------
  |  Branch (541:9): [True: 0, False: 7.78k]
  ------------------
  542|      0|            u4_max_mbs_allowed = MAX_MBS_LEVEL_42;
  ------------------
  |  |  309|      0|#define MAX_MBS_LEVEL_42 8704
  ------------------
  543|      0|            break;
  544|      0|        case H264_LEVEL_5_0:
  ------------------
  |  |  304|      0|#define H264_LEVEL_5_0     50
  ------------------
  |  Branch (544:9): [True: 0, False: 7.78k]
  ------------------
  545|      0|            u4_max_mbs_allowed = MAX_MBS_LEVEL_50;
  ------------------
  |  |  308|      0|#define MAX_MBS_LEVEL_50 22080
  ------------------
  546|      0|            break;
  547|      0|        case H264_LEVEL_5_1:
  ------------------
  |  |  305|      0|#define H264_LEVEL_5_1     51
  ------------------
  |  Branch (547:9): [True: 0, False: 7.78k]
  ------------------
  548|    124|        default:
  ------------------
  |  Branch (548:9): [True: 124, False: 7.65k]
  ------------------
  549|    124|            u4_max_mbs_allowed = MAX_MBS_LEVEL_51;
  ------------------
  |  |  307|    124|#define MAX_MBS_LEVEL_51 36864
  ------------------
  550|    124|            break;
  551|       |
  552|  7.78k|    }
  553|       |
  554|       |    /*correct of the level is incorrect*/
  555|  7.78k|    if(u4_total_mbs > u4_max_mbs_allowed)
  ------------------
  |  Branch (555:8): [True: 56, False: 7.72k]
  ------------------
  556|     56|    {
  557|     56|        if(u4_total_mbs > MAX_MBS_LEVEL_50)
  ------------------
  |  |  308|     56|#define MAX_MBS_LEVEL_50 22080
  ------------------
  |  Branch (557:12): [True: 7, False: 49]
  ------------------
  558|      7|            u4_level_idc = H264_LEVEL_5_1;
  ------------------
  |  |  305|      7|#define H264_LEVEL_5_1     51
  ------------------
  559|     49|        else if(u4_total_mbs > MAX_MBS_LEVEL_42)
  ------------------
  |  |  309|     49|#define MAX_MBS_LEVEL_42 8704
  ------------------
  |  Branch (559:17): [True: 4, False: 45]
  ------------------
  560|      4|            u4_level_idc = H264_LEVEL_5_0;
  ------------------
  |  |  304|      4|#define H264_LEVEL_5_0     50
  ------------------
  561|     45|        else if(u4_total_mbs > MAX_MBS_LEVEL_41)
  ------------------
  |  |  310|     45|#define MAX_MBS_LEVEL_41 8192
  ------------------
  |  Branch (561:17): [True: 0, False: 45]
  ------------------
  562|      0|            u4_level_idc = H264_LEVEL_4_2;
  ------------------
  |  |  303|      0|#define H264_LEVEL_4_2     42
  ------------------
  563|     45|        else if(u4_total_mbs > MAX_MBS_LEVEL_40)
  ------------------
  |  |  311|     45|#define MAX_MBS_LEVEL_40 8192
  ------------------
  |  Branch (563:17): [True: 0, False: 45]
  ------------------
  564|      0|            u4_level_idc = H264_LEVEL_4_1;
  ------------------
  |  |  302|      0|#define H264_LEVEL_4_1     41
  ------------------
  565|     45|        else if(u4_total_mbs > MAX_MBS_LEVEL_32)
  ------------------
  |  |  312|     45|#define MAX_MBS_LEVEL_32 5120
  ------------------
  |  Branch (565:17): [True: 0, False: 45]
  ------------------
  566|      0|            u4_level_idc = H264_LEVEL_4_0;
  ------------------
  |  |  301|      0|#define H264_LEVEL_4_0     40
  ------------------
  567|     45|        else if(u4_total_mbs > MAX_MBS_LEVEL_31)
  ------------------
  |  |  313|     45|#define MAX_MBS_LEVEL_31 3600
  ------------------
  |  Branch (567:17): [True: 5, False: 40]
  ------------------
  568|      5|            u4_level_idc = H264_LEVEL_3_2;
  ------------------
  |  |  300|      5|#define H264_LEVEL_3_2     32
  ------------------
  569|     40|        else if(u4_total_mbs > MAX_MBS_LEVEL_30)
  ------------------
  |  |  314|     40|#define MAX_MBS_LEVEL_30 1620
  ------------------
  |  Branch (569:17): [True: 0, False: 40]
  ------------------
  570|      0|            u4_level_idc = H264_LEVEL_3_1;
  ------------------
  |  |  299|      0|#define H264_LEVEL_3_1     31
  ------------------
  571|     40|        else if(u4_total_mbs > MAX_MBS_LEVEL_21)
  ------------------
  |  |  316|     40|#define MAX_MBS_LEVEL_21 792
  ------------------
  |  Branch (571:17): [True: 0, False: 40]
  ------------------
  572|      0|            u4_level_idc = H264_LEVEL_3_0;
  ------------------
  |  |  298|      0|#define H264_LEVEL_3_0     30
  ------------------
  573|     40|        else if(u4_total_mbs > MAX_MBS_LEVEL_20)
  ------------------
  |  |  317|     40|#define MAX_MBS_LEVEL_20 396
  ------------------
  |  Branch (573:17): [True: 35, False: 5]
  ------------------
  574|     35|            u4_level_idc = H264_LEVEL_2_1;
  ------------------
  |  |  296|     35|#define H264_LEVEL_2_1     21
  ------------------
  575|      5|        else if(u4_total_mbs > MAX_MBS_LEVEL_10)
  ------------------
  |  |  321|      5|#define MAX_MBS_LEVEL_10 99
  ------------------
  |  Branch (575:17): [True: 5, False: 0]
  ------------------
  576|      5|            u4_level_idc = H264_LEVEL_2_0;
  ------------------
  |  |  295|      5|#define H264_LEVEL_2_0     20
  ------------------
  577|     56|    }
  578|       |
  579|  7.78k|    return (u4_level_idc);
  580|       |
  581|  7.78k|}

ih264d_parse_imb_cavlc:
   92|  2.21k|{
   93|  2.21k|    WORD32 i4_delta_qp;
   94|  2.21k|    UWORD32 u4_temp;
   95|  2.21k|    UWORD32 ui_is_top_mb_available;
   96|  2.21k|    UWORD32 ui_is_left_mb_available;
   97|  2.21k|    UWORD32 u4_cbp;
   98|  2.21k|    UWORD32 u4_offset;
   99|  2.21k|    UWORD32 *pu4_bitstrm_buf;
  100|  2.21k|    WORD32 ret;
  101|       |
  102|  2.21k|    dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
  103|  2.21k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  104|  2.21k|    UNUSED(u4_mb_num);
  ------------------
  |  |   45|  2.21k|#define UNUSED(x) ((void)(x))
  ------------------
  105|  2.21k|    ps_cur_mb_info->u1_tran_form8x8 = 0;
  106|  2.21k|    ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
  107|       |
  108|  2.21k|    ps_cur_mb_info->u1_yuv_dc_block_flag = 0;
  109|       |
  110|  2.21k|    u4_temp = ps_dec->u1_mb_ngbr_availablity;
  111|  2.21k|    ui_is_top_mb_available = BOOLEAN(u4_temp & TOP_MB_AVAILABLE_MASK);
  ------------------
  |  |   61|  2.21k|#define BOOLEAN(x) (!!(x))
  ------------------
  112|  2.21k|    ui_is_left_mb_available = BOOLEAN(u4_temp & LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   61|  2.21k|#define BOOLEAN(x) (!!(x))
  ------------------
  113|       |
  114|  2.21k|    pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  115|       |
  116|  2.21k|    if(u1_mb_type == I_4x4_MB)
  ------------------
  |  |  417|  2.21k|#define I_4x4_MB    0
  ------------------
  |  Branch (116:8): [True: 329, False: 1.88k]
  ------------------
  117|    329|    {
  118|    329|        ps_cur_mb_info->ps_curmb->u1_mb_type = I_4x4_MB;
  ------------------
  |  |  417|    329|#define I_4x4_MB    0
  ------------------
  119|    329|        u4_offset = 0;
  120|       |
  121|       |        /*--------------------------------------------------------------------*/
  122|       |        /* Read transform_size_8x8_flag if present                            */
  123|       |        /*--------------------------------------------------------------------*/
  124|    329|        if(ps_dec->s_high_profile.u1_transform8x8_present)
  ------------------
  |  Branch (124:12): [True: 225, False: 104]
  ------------------
  125|    225|        {
  126|    225|            ps_cur_mb_info->u1_tran_form8x8 = ih264d_get_bit_h264(ps_bitstrm);
  127|    225|            COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8);
  128|    225|            ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8;
  129|    225|        }
  130|       |
  131|       |        /*--------------------------------------------------------------------*/
  132|       |        /* Read the IntraPrediction modes for LUMA                            */
  133|       |        /*--------------------------------------------------------------------*/
  134|    329|        if (!ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (134:13): [True: 135, False: 194]
  ------------------
  135|    135|        {
  136|    135|            UWORD8 *pu1_temp;
  137|    135|            ih264d_read_intra_pred_modes(ps_dec,
  138|    135|                                          ((UWORD8 *)ps_dec->pv_parse_tu_coeff_data),
  139|    135|                                          ((UWORD8 *)ps_dec->pv_parse_tu_coeff_data+16),
  140|    135|                                          ps_cur_mb_info->u1_tran_form8x8);
  141|    135|            pu1_temp = (UWORD8 *)ps_dec->pv_parse_tu_coeff_data;
  142|    135|            pu1_temp += 32;
  143|    135|            ps_dec->pv_parse_tu_coeff_data = (void *)pu1_temp;
  144|    135|        }
  145|    194|        else
  146|    194|        {
  147|    194|            UWORD8 *pu1_temp;
  148|    194|            ih264d_read_intra_pred_modes(ps_dec,
  149|    194|                                          ((UWORD8 *)ps_dec->pv_parse_tu_coeff_data),
  150|    194|                                          ((UWORD8 *)ps_dec->pv_parse_tu_coeff_data+4),
  151|    194|                                          ps_cur_mb_info->u1_tran_form8x8);
  152|    194|            pu1_temp = (UWORD8 *)ps_dec->pv_parse_tu_coeff_data;
  153|    194|            pu1_temp += 8;
  154|    194|            ps_dec->pv_parse_tu_coeff_data = (void *)pu1_temp;
  155|    194|        }
  156|       |        /*--------------------------------------------------------------------*/
  157|       |        /* Read the IntraPrediction mode for CHROMA                           */
  158|       |        /*--------------------------------------------------------------------*/
  159|       |//Inlined ih264d_uev
  160|    329|        {
  161|    329|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  162|    329|            UWORD32 u4_word, u4_ldz, u4_temp;
  163|       |
  164|       |            /***************************************************************/
  165|       |            /* Find leading zeros in next 32 bits                          */
  166|       |            /***************************************************************/
  167|    329|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|    329|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|    329|{                                                                           \
  |  |  152|    329|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|    329|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|    329|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|    329|                                                                            \
  |  |  156|    329|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|    329|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 329, False: 0]
  |  |  ------------------
  |  |  158|    329|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|    329|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|    329|}
  ------------------
  168|    329|            u4_ldz = CLZ(u4_word);
  169|       |            /* Flush the ps_bitstrm */
  170|    329|            u4_bitstream_offset += (u4_ldz + 1);
  171|       |            /* Read the suffix from the ps_bitstrm */
  172|    329|            u4_word = 0;
  173|    329|            if(u4_ldz)
  ------------------
  |  Branch (173:16): [True: 231, False: 98]
  ------------------
  174|    231|            {
  175|    231|                GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|    231|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    231|{                                                                           \
  |  |  122|    231|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    231|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    231|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    231|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    231|                                                                            \
  |  |  127|    231|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 231, False: 0]
  |  |  ------------------
  |  |  128|    231|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    231|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    231|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    231|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    231|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    231|}                                                                           \
  ------------------
  176|    231|                        u4_ldz);
  177|    231|            }
  178|    329|            *pu4_bitstrm_ofst = u4_bitstream_offset;
  179|    329|            u4_temp = ((1 << u4_ldz) + u4_word - 1);
  180|    329|            if(u4_temp > 3)
  ------------------
  |  Branch (180:16): [True: 12, False: 317]
  ------------------
  181|     12|            {
  182|     12|                return ERROR_CHROMA_PRED_MODE;
  183|     12|            }
  184|    317|            ps_cur_mb_info->u1_chroma_pred_mode = u4_temp;
  185|    317|            COPYTHECONTEXT("intra_chroma_pred_mode", ps_cur_mb_info->u1_chroma_pred_mode);
  186|    317|        }
  187|       |        /*--------------------------------------------------------------------*/
  188|       |        /* Read the Coded block pattern                                       */
  189|       |        /*--------------------------------------------------------------------*/
  190|      0|        {
  191|    317|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  192|    317|            UWORD32 u4_word, u4_ldz;
  193|       |
  194|       |            /***************************************************************/
  195|       |            /* Find leading zeros in next 32 bits                          */
  196|       |            /***************************************************************/
  197|    317|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|    317|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|    317|{                                                                           \
  |  |  152|    317|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|    317|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|    317|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|    317|                                                                            \
  |  |  156|    317|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|    317|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 317, False: 0]
  |  |  ------------------
  |  |  158|    317|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|    317|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|    317|}
  ------------------
  198|    317|            u4_ldz = CLZ(u4_word);
  199|       |            /* Flush the ps_bitstrm */
  200|    317|            u4_bitstream_offset += (u4_ldz + 1);
  201|       |            /* Read the suffix from the ps_bitstrm */
  202|    317|            u4_word = 0;
  203|    317|            if(u4_ldz)
  ------------------
  |  Branch (203:16): [True: 208, False: 109]
  ------------------
  204|    208|            {
  205|    208|                GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|    208|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    208|{                                                                           \
  |  |  122|    208|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    208|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    208|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    208|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    208|                                                                            \
  |  |  127|    208|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 208, False: 0]
  |  |  ------------------
  |  |  128|    208|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    208|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    208|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    208|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    208|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    208|}                                                                           \
  ------------------
  206|    208|                        u4_ldz);
  207|    208|            }
  208|    317|            *pu4_bitstrm_ofst = u4_bitstream_offset;
  209|    317|            u4_cbp = ((1 << u4_ldz) + u4_word - 1);
  210|    317|        }
  211|    317|        if(u4_cbp > 47)
  ------------------
  |  Branch (211:12): [True: 0, False: 317]
  ------------------
  212|      0|        {
  213|      0|            return ERROR_CBP;
  214|      0|        }
  215|       |
  216|    317|        u4_cbp = gau1_ih264d_cbp_table[u4_cbp][0];
  217|    317|        COPYTHECONTEXT("coded_block_pattern", u1_cbp);
  218|    317|        ps_cur_mb_info->u1_cbp = u4_cbp;
  219|       |
  220|       |        /*--------------------------------------------------------------------*/
  221|       |        /* Read mb_qp_delta                                                   */
  222|       |        /*--------------------------------------------------------------------*/
  223|    317|        if(ps_cur_mb_info->u1_cbp)
  ------------------
  |  Branch (223:12): [True: 316, False: 1]
  ------------------
  224|    316|        {
  225|    316|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  226|    316|            UWORD32 u4_word, u4_ldz, u4_abs_val;
  227|       |
  228|       |            /***************************************************************/
  229|       |            /* Find leading zeros in next 32 bits                          */
  230|       |            /***************************************************************/
  231|    316|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|    316|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|    316|{                                                                           \
  |  |  152|    316|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|    316|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|    316|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|    316|                                                                            \
  |  |  156|    316|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|    316|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 316, False: 0]
  |  |  ------------------
  |  |  158|    316|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|    316|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|    316|}
  ------------------
  232|    316|            u4_ldz = CLZ(u4_word);
  233|       |
  234|       |            /* Flush the ps_bitstrm */
  235|    316|            u4_bitstream_offset += (u4_ldz + 1);
  236|       |
  237|       |            /* Read the suffix from the ps_bitstrm */
  238|    316|            u4_word = 0;
  239|    316|            if(u4_ldz)
  ------------------
  |  Branch (239:16): [True: 225, False: 91]
  ------------------
  240|    225|            {
  241|    225|                GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|    225|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    225|{                                                                           \
  |  |  122|    225|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    225|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    225|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    225|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    225|                                                                            \
  |  |  127|    225|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 225, False: 0]
  |  |  ------------------
  |  |  128|    225|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    225|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    225|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    225|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    225|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    225|}                                                                           \
  ------------------
  242|    225|                        u4_ldz);
  243|    225|            }
  244|       |
  245|    316|            *pu4_bitstrm_ofst = u4_bitstream_offset;
  246|    316|            u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1;
  247|       |
  248|    316|            if(u4_word & 0x1)
  ------------------
  |  Branch (248:16): [True: 198, False: 118]
  ------------------
  249|    198|            {
  250|    198|                i4_delta_qp = (-(WORD32)u4_abs_val);
  251|    198|            }
  252|    118|            else
  253|    118|            {
  254|    118|                i4_delta_qp = (u4_abs_val);
  255|    118|            }
  256|       |
  257|    316|            if((i4_delta_qp < -26) || (i4_delta_qp > 25))
  ------------------
  |  Branch (257:16): [True: 0, False: 316]
  |  Branch (257:39): [True: 0, False: 316]
  ------------------
  258|      0|            {
  259|      0|                return ERROR_INV_RANGE_QP_T;
  260|      0|            }
  261|       |
  262|    316|            COPYTHECONTEXT("mb_qp_delta", i1_delta_qp);
  263|    316|            if(i4_delta_qp != 0)
  ------------------
  |  Branch (263:16): [True: 225, False: 91]
  ------------------
  264|    225|            {
  265|    225|                ret = ih264d_update_qp(ps_dec, (WORD8)i4_delta_qp);
  266|    225|                if(ret != OK)
  ------------------
  |  |  114|    225|#define OK        0
  ------------------
  |  Branch (266:20): [True: 0, False: 225]
  ------------------
  267|      0|                    return ret;
  268|    225|            }
  269|    316|        }
  270|       |
  271|    317|    }
  272|  1.88k|    else
  273|  1.88k|    {
  274|  1.88k|        u4_offset = 1;
  275|  1.88k|        ps_cur_mb_info->ps_curmb->u1_mb_type = I_16x16_MB;
  ------------------
  |  |  418|  1.88k|#define I_16x16_MB  1
  ------------------
  276|       |        /*-------------------------------------------------------------------*/
  277|       |        /* Read the IntraPrediction mode for CHROMA                          */
  278|       |        /*-------------------------------------------------------------------*/
  279|  1.88k|        {
  280|  1.88k|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  281|  1.88k|            UWORD32 u4_word, u4_ldz;
  282|       |
  283|       |            /***************************************************************/
  284|       |            /* Find leading zeros in next 32 bits                          */
  285|       |            /***************************************************************/
  286|  1.88k|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|  1.88k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|  1.88k|{                                                                           \
  |  |  152|  1.88k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|  1.88k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|  1.88k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|  1.88k|                                                                            \
  |  |  156|  1.88k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|  1.88k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 1.88k, False: 0]
  |  |  ------------------
  |  |  158|  1.88k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|  1.88k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|  1.88k|}
  ------------------
  287|  1.88k|            u4_ldz = CLZ(u4_word);
  288|       |            /* Flush the ps_bitstrm */
  289|  1.88k|            u4_bitstream_offset += (u4_ldz + 1);
  290|       |            /* Read the suffix from the ps_bitstrm */
  291|  1.88k|            u4_word = 0;
  292|  1.88k|            if(u4_ldz)
  ------------------
  |  Branch (292:16): [True: 684, False: 1.19k]
  ------------------
  293|    684|            {
  294|    684|                GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|    684|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    684|{                                                                           \
  |  |  122|    684|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    684|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    684|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    684|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    684|                                                                            \
  |  |  127|    684|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 627, False: 57]
  |  |  ------------------
  |  |  128|    684|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    627|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    684|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    684|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    684|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    684|}                                                                           \
  ------------------
  295|    684|                        u4_ldz);
  296|    684|            }
  297|  1.88k|            *pu4_bitstrm_ofst = u4_bitstream_offset;
  298|  1.88k|            u4_temp = ((1 << u4_ldz) + u4_word - 1);
  299|       |
  300|       |//Inlined ih264d_uev
  301|       |
  302|  1.88k|            if(u4_temp > 3)
  ------------------
  |  Branch (302:16): [True: 3, False: 1.87k]
  ------------------
  303|      3|            {
  304|      3|                return ERROR_CHROMA_PRED_MODE;
  305|      3|            }
  306|  1.87k|            ps_cur_mb_info->u1_chroma_pred_mode = u4_temp;
  307|  1.87k|            COPYTHECONTEXT("intra_chroma_pred_mode", ps_cur_mb_info->u1_chroma_pred_mode);
  308|  1.87k|        }
  309|       |        /*-------------------------------------------------------------------*/
  310|       |        /* Read the Coded block pattern                                      */
  311|       |        /*-------------------------------------------------------------------*/
  312|      0|        u4_cbp = gau1_ih264d_cbp_tab[(u1_mb_type - 1) >> 2];
  313|  1.87k|        ps_cur_mb_info->u1_cbp = u4_cbp;
  314|       |
  315|       |        /*-------------------------------------------------------------------*/
  316|       |        /* Read mb_qp_delta                                                  */
  317|       |        /*-------------------------------------------------------------------*/
  318|  1.87k|        {
  319|  1.87k|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  320|  1.87k|            UWORD32 u4_word, u4_ldz, u4_abs_val;
  321|       |
  322|       |            /***************************************************************/
  323|       |            /* Find leading zeros in next 32 bits                          */
  324|       |            /***************************************************************/
  325|  1.87k|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|  1.87k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|  1.87k|{                                                                           \
  |  |  152|  1.87k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|  1.87k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|  1.87k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|  1.87k|                                                                            \
  |  |  156|  1.87k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|  1.87k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 1.87k, False: 1]
  |  |  ------------------
  |  |  158|  1.87k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|  1.87k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|  1.87k|}
  ------------------
  326|  1.87k|            u4_ldz = CLZ(u4_word);
  327|       |
  328|       |            /* Flush the ps_bitstrm */
  329|  1.87k|            u4_bitstream_offset += (u4_ldz + 1);
  330|       |
  331|       |            /* Read the suffix from the ps_bitstrm */
  332|  1.87k|            u4_word = 0;
  333|  1.87k|            if(u4_ldz)
  ------------------
  |  Branch (333:16): [True: 1.20k, False: 671]
  ------------------
  334|  1.20k|                GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|  1.20k|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|  1.20k|{                                                                           \
  |  |  122|  1.20k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|  1.20k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|  1.20k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|  1.20k|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|  1.20k|                                                                            \
  |  |  127|  1.20k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 1.20k, False: 0]
  |  |  ------------------
  |  |  128|  1.20k|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  1.20k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|  1.20k|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  1.20k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|  1.20k|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|  1.20k|}                                                                           \
  ------------------
  335|  1.87k|                        u4_ldz);
  336|       |
  337|  1.87k|            *pu4_bitstrm_ofst = u4_bitstream_offset;
  338|  1.87k|            u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1;
  339|       |
  340|  1.87k|            if(u4_word & 0x1)
  ------------------
  |  Branch (340:16): [True: 169, False: 1.70k]
  ------------------
  341|    169|                i4_delta_qp = (-(WORD32)u4_abs_val);
  342|  1.70k|            else
  343|  1.70k|                i4_delta_qp = (u4_abs_val);
  344|       |
  345|  1.87k|            if((i4_delta_qp < -26) || (i4_delta_qp > 25))
  ------------------
  |  Branch (345:16): [True: 1, False: 1.87k]
  |  Branch (345:39): [True: 3, False: 1.87k]
  ------------------
  346|      4|                return ERROR_INV_RANGE_QP_T;
  347|       |
  348|  1.87k|        }
  349|       |//inlinined ih264d_sev
  350|  1.87k|        COPYTHECONTEXT("Delta quant", i1_delta_qp);
  351|       |
  352|  1.87k|        if(i4_delta_qp != 0)
  ------------------
  |  Branch (352:12): [True: 1.20k, False: 671]
  ------------------
  353|  1.20k|        {
  354|  1.20k|            ret = ih264d_update_qp(ps_dec, (WORD8)i4_delta_qp);
  355|  1.20k|            if(ret != OK)
  ------------------
  |  |  114|  1.20k|#define OK        0
  ------------------
  |  Branch (355:16): [True: 0, False: 1.20k]
  ------------------
  356|      0|                return ret;
  357|  1.20k|        }
  358|       |
  359|  1.87k|        {
  360|  1.87k|            WORD16 i_scaleFactor;
  361|  1.87k|            UWORD32 ui_N = 0;
  362|  1.87k|            WORD16 *pi2_scale_matrix_ptr;
  363|       |            /*******************************************************************/
  364|       |            /* for luma DC coefficients the scaling is done during the parsing */
  365|       |            /* to preserve the precision                                       */
  366|       |            /*******************************************************************/
  367|  1.87k|            if(ps_dec->s_high_profile.u1_scaling_present)
  ------------------
  |  Branch (367:16): [True: 855, False: 1.01k]
  ------------------
  368|    855|            {
  369|    855|                pi2_scale_matrix_ptr =
  370|    855|                                ps_dec->s_high_profile.i2_scalinglist4x4[0];
  371|    855|            }
  372|  1.01k|            else
  373|  1.01k|            {
  374|  1.01k|                i_scaleFactor = 16;
  375|  1.01k|                pi2_scale_matrix_ptr = &i_scaleFactor;
  376|  1.01k|            }
  377|       |
  378|       |            /*---------------------------------------------------------------*/
  379|       |            /* Decode DC coefficients                                        */
  380|       |            /*---------------------------------------------------------------*/
  381|       |            /*---------------------------------------------------------------*/
  382|       |            /* Calculation of N                                              */
  383|       |            /*---------------------------------------------------------------*/
  384|  1.87k|            if(ui_is_left_mb_available)
  ------------------
  |  Branch (384:16): [True: 1.41k, False: 461]
  ------------------
  385|  1.41k|            {
  386|       |
  387|  1.41k|                if(ui_is_top_mb_available)
  ------------------
  |  Branch (387:20): [True: 535, False: 878]
  ------------------
  388|    535|                {
  389|    535|                    ui_N = ((ps_cur_mb_info->ps_top_mb->pu1_nnz_y[0]
  390|    535|                                    + ps_dec->pu1_left_nnz_y[0] + 1) >> 1);
  391|    535|                }
  392|    878|                else
  393|    878|                {
  394|    878|                    ui_N = ps_dec->pu1_left_nnz_y[0];
  395|    878|                }
  396|  1.41k|            }
  397|    461|            else if(ui_is_top_mb_available)
  ------------------
  |  Branch (397:21): [True: 313, False: 148]
  ------------------
  398|    313|            {
  399|    313|                ui_N = ps_cur_mb_info->ps_top_mb->pu1_nnz_y[0];
  400|    313|            }
  401|       |
  402|  1.87k|            {
  403|  1.87k|                WORD16 pi2_dc_coef[16];
  404|  1.87k|                WORD32 pi4_tmp[16];
  405|  1.87k|                tu_sblk4x4_coeff_data_t *ps_tu_4x4 =
  406|  1.87k|                                (tu_sblk4x4_coeff_data_t *)ps_dec->pv_parse_tu_coeff_data;
  407|  1.87k|                WORD16 *pi2_coeff_block =
  408|  1.87k|                                (WORD16 *)ps_dec->pv_parse_tu_coeff_data;
  409|  1.87k|                UWORD32 u4_num_coeff;
  410|  1.87k|                ps_tu_4x4->u2_sig_coeff_map = 0;
  411|       |
  412|  1.87k|                ret = ps_dec->pf_cavlc_parse4x4coeff[(ui_N > 7)](pi2_dc_coef, 0, ui_N,
  413|  1.87k|                                                                 ps_dec, &u4_num_coeff);
  414|  1.87k|                if(ret != OK)
  ------------------
  |  |  114|  1.87k|#define OK        0
  ------------------
  |  Branch (414:20): [True: 0, False: 1.87k]
  ------------------
  415|      0|                    return ret;
  416|       |
  417|  1.87k|                if(EXCEED_OFFSET(ps_bitstrm))
  ------------------
  |  |   93|  1.87k|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 30, False: 1.84k]
  |  |  ------------------
  ------------------
  418|     30|                    return ERROR_EOB_TERMINATE_T;
  419|  1.84k|                if(ps_tu_4x4->u2_sig_coeff_map)
  ------------------
  |  Branch (419:20): [True: 656, False: 1.18k]
  ------------------
  420|    656|                {
  421|    656|                    memset(pi2_dc_coef,0,sizeof(pi2_dc_coef));
  422|    656|                    ih264d_unpack_coeff4x4_dc_4x4blk(ps_tu_4x4,
  423|    656|                                                     pi2_dc_coef,
  424|    656|                                                     ps_dec->pu1_inv_scan);
  425|       |
  426|    656|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|    656|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
  427|    656|                    ps_dec->pf_ihadamard_scaling_4x4(pi2_dc_coef,
  428|    656|                                                     pi2_coeff_block,
  429|    656|                                                     ps_dec->pu2_quant_scale_y,
  430|    656|                                                     (UWORD16 *)pi2_scale_matrix_ptr,
  431|    656|                                                     ps_dec->u1_qp_y_div6,
  432|    656|                                                     pi4_tmp);
  433|    656|                    pi2_coeff_block += 16;
  434|    656|                    ps_dec->pv_parse_tu_coeff_data = (void *)pi2_coeff_block;
  435|    656|                    SET_BIT(ps_cur_mb_info->u1_yuv_dc_block_flag,0);
  ------------------
  |  |  106|    656|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
  436|    656|                }
  437|       |
  438|  1.84k|            }
  439|  1.84k|        }
  440|  1.84k|    }
  441|       |
  442|       |
  443|  2.16k|    if(u4_cbp)
  ------------------
  |  Branch (443:8): [True: 1.13k, False: 1.02k]
  ------------------
  444|  1.13k|    {
  445|       |
  446|  1.13k|        ret = ih264d_parse_residual4x4_cavlc(ps_dec, ps_cur_mb_info,
  447|  1.13k|                                       (UWORD8)u4_offset);
  448|  1.13k|        if(ret != OK)
  ------------------
  |  |  114|  1.13k|#define OK        0
  ------------------
  |  Branch (448:12): [True: 63, False: 1.07k]
  ------------------
  449|     63|            return ret;
  450|  1.07k|        if(EXCEED_OFFSET(ps_bitstrm))
  ------------------
  |  |   93|  1.07k|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 49, False: 1.02k]
  |  |  ------------------
  ------------------
  451|     49|            return ERROR_EOB_TERMINATE_T;
  452|       |
  453|       |        /* Store Left Mb NNZ and TOP chroma NNZ */
  454|  1.07k|    }
  455|  1.02k|    else
  456|  1.02k|    {
  457|  1.02k|        ps_cur_mb_info->u1_qp_div6 = ps_dec->u1_qp_y_div6;
  458|  1.02k|        ps_cur_mb_info->u1_qpc_div6 = ps_dec->u1_qp_u_div6;
  459|  1.02k|        ps_cur_mb_info->u1_qpcr_div6 = ps_dec->u1_qp_v_div6;
  460|  1.02k|        ps_cur_mb_info->u1_qp_rem6 = ps_dec->u1_qp_y_rem6;
  461|  1.02k|        ps_cur_mb_info->u1_qpc_rem6 = ps_dec->u1_qp_u_rem6;
  462|  1.02k|        ps_cur_mb_info->u1_qpcr_rem6 = ps_dec->u1_qp_v_rem6;
  463|  1.02k|        ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CAVLC);
  ------------------
  |  |  338|  1.02k|#define CAVLC  0
  ------------------
  464|  1.02k|    }
  465|       |
  466|  2.04k|    return OK;
  ------------------
  |  |  114|  2.04k|#define OK        0
  ------------------
  467|  2.16k|}
ih264d_parse_imb_cabac:
  485|  9.28k|{
  486|  9.28k|    WORD8 i1_delta_qp;
  487|  9.28k|    UWORD8 u1_cbp;
  488|  9.28k|    UWORD8 u1_offset;
  489|       |    /* Variables for handling Cabac contexts */
  490|  9.28k|    ctxt_inc_mb_info_t *p_curr_ctxt = ps_dec->ps_curr_ctxt_mb_info;
  491|  9.28k|    ctxt_inc_mb_info_t *ps_left_ctxt = ps_dec->p_left_ctxt_mb_info;
  492|  9.28k|    dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
  493|  9.28k|    bin_ctxt_model_t *p_bin_ctxt;
  494|       |
  495|  9.28k|    UWORD8 u1_intra_chrom_pred_mode;
  496|  9.28k|    UWORD8 u1_dc_block_flag = 0;
  497|  9.28k|    WORD32 ret;
  498|       |
  499|  9.28k|    ps_cur_mb_info->u1_yuv_dc_block_flag = 0;
  500|       |
  501|  9.28k|    if(ps_left_ctxt == ps_dec->ps_def_ctxt_mb_info)
  ------------------
  |  Branch (501:8): [True: 3.88k, False: 5.40k]
  ------------------
  502|  3.88k|    {
  503|  3.88k|        ps_dec->pu1_left_yuv_dc_csbp[0] = 0xf;
  504|  3.88k|    }
  505|       |
  506|  9.28k|    if(ps_dec->ps_cur_slice->u1_slice_type != I_SLICE)
  ------------------
  |  |  370|  9.28k|#define I_SLICE  2
  ------------------
  |  Branch (506:8): [True: 2.87k, False: 6.40k]
  ------------------
  507|  2.87k|    {
  508|  2.87k|        WORD32 *pi4_buf;
  509|  2.87k|        WORD8 *pi1_buf;
  510|  2.87k|        MEMSET_16BYTES(&ps_dec->pu1_left_mv_ctxt_inc[0][0], 0);
  ------------------
  |  |  652|  2.87k|#define MEMSET_16BYTES(pu4_start,value)                         \
  |  |  653|  2.87k|{                                                               \
  |  |  654|  2.87k|    memset(pu4_start,value,16);                                 \
  |  |  655|  2.87k|}
  ------------------
  511|  2.87k|        *((UWORD32 *)ps_dec->pi1_left_ref_idx_ctxt_inc) = 0;
  512|  2.87k|        MEMSET_16BYTES(p_curr_ctxt->u1_mv, 0);
  ------------------
  |  |  652|  2.87k|#define MEMSET_16BYTES(pu4_start,value)                         \
  |  |  653|  2.87k|{                                                               \
  |  |  654|  2.87k|    memset(pu4_start,value,16);                                 \
  |  |  655|  2.87k|}
  ------------------
  513|  2.87k|        memset(p_curr_ctxt->i1_ref_idx, 0, 4);
  514|  2.87k|    }
  515|       |
  516|  9.28k|    if(u1_mb_type == I_4x4_MB)
  ------------------
  |  |  417|  9.28k|#define I_4x4_MB    0
  ------------------
  |  Branch (516:8): [True: 8.06k, False: 1.21k]
  ------------------
  517|  8.06k|    {
  518|  8.06k|        ps_cur_mb_info->ps_curmb->u1_mb_type = I_4x4_MB;
  ------------------
  |  |  417|  8.06k|#define I_4x4_MB    0
  ------------------
  519|  8.06k|        p_curr_ctxt->u1_mb_type = CAB_I4x4;
  ------------------
  |  |  394|  8.06k|#define CAB_I4x4          0x00 /* 0000 00x0 */
  ------------------
  520|  8.06k|        u1_offset = 0;
  521|       |
  522|  8.06k|        ps_cur_mb_info->u1_tran_form8x8 = 0;
  523|  8.06k|        ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
  524|       |
  525|       |        /*--------------------------------------------------------------------*/
  526|       |        /* Read transform_size_8x8_flag if present                            */
  527|       |        /*--------------------------------------------------------------------*/
  528|  8.06k|        if(ps_dec->s_high_profile.u1_transform8x8_present)
  ------------------
  |  Branch (528:12): [True: 5.58k, False: 2.48k]
  ------------------
  529|  5.58k|        {
  530|  5.58k|            ps_cur_mb_info->u1_tran_form8x8 = ih264d_parse_transform8x8flag_cabac(
  531|  5.58k|                            ps_dec, ps_cur_mb_info);
  532|  5.58k|            COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8);
  533|  5.58k|            p_curr_ctxt->u1_transform8x8_ctxt = ps_cur_mb_info->u1_tran_form8x8;
  534|  5.58k|            ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8;
  535|  5.58k|        }
  536|  2.48k|        else
  537|  2.48k|        {
  538|  2.48k|            p_curr_ctxt->u1_transform8x8_ctxt = 0;
  539|  2.48k|        }
  540|       |
  541|       |        /*--------------------------------------------------------------------*/
  542|       |        /* Read the IntraPrediction modes for LUMA                            */
  543|       |        /*--------------------------------------------------------------------*/
  544|  8.06k|        if (!ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (544:13): [True: 3.41k, False: 4.65k]
  ------------------
  545|  3.41k|        {
  546|  3.41k|            UWORD8 *pu1_temp;
  547|  3.41k|            ih264d_read_intra_pred_modes_cabac(
  548|  3.41k|                            ps_dec,
  549|  3.41k|                            ((UWORD8 *)ps_dec->pv_parse_tu_coeff_data),
  550|  3.41k|                            ((UWORD8 *)ps_dec->pv_parse_tu_coeff_data+16),
  551|  3.41k|                            ps_cur_mb_info->u1_tran_form8x8);
  552|  3.41k|            pu1_temp = (UWORD8 *)ps_dec->pv_parse_tu_coeff_data;
  553|  3.41k|            pu1_temp += 32;
  554|  3.41k|            ps_dec->pv_parse_tu_coeff_data = (void *)pu1_temp;
  555|  3.41k|        }
  556|  4.65k|        else
  557|  4.65k|        {
  558|  4.65k|            UWORD8 *pu1_temp;
  559|  4.65k|            ih264d_read_intra_pred_modes_cabac(
  560|  4.65k|                            ps_dec,
  561|  4.65k|                            ((UWORD8 *)ps_dec->pv_parse_tu_coeff_data),
  562|  4.65k|                            ((UWORD8 *)ps_dec->pv_parse_tu_coeff_data+4),
  563|  4.65k|                            ps_cur_mb_info->u1_tran_form8x8);
  564|  4.65k|            pu1_temp = (UWORD8 *)ps_dec->pv_parse_tu_coeff_data;
  565|  4.65k|            pu1_temp += 8;
  566|  4.65k|            ps_dec->pv_parse_tu_coeff_data = (void *)pu1_temp;
  567|  4.65k|        }
  568|       |        /*--------------------------------------------------------------------*/
  569|       |        /* Read the IntraPrediction mode for CHROMA                           */
  570|       |        /*--------------------------------------------------------------------*/
  571|  8.06k|        u1_intra_chrom_pred_mode = ih264d_parse_chroma_pred_mode_cabac(ps_dec);
  572|  8.06k|        COPYTHECONTEXT("intra_chroma_pred_mode", u1_intra_chrom_pred_mode);
  573|  8.06k|        p_curr_ctxt->u1_intra_chroma_pred_mode = ps_cur_mb_info->u1_chroma_pred_mode =
  574|  8.06k|                        u1_intra_chrom_pred_mode;
  575|       |
  576|       |        /*--------------------------------------------------------------------*/
  577|       |        /* Read the Coded block pattern                                       */
  578|       |        /*--------------------------------------------------------------------*/
  579|  8.06k|        u1_cbp = ih264d_parse_ctx_cbp_cabac(ps_dec);
  580|  8.06k|        COPYTHECONTEXT("coded_block_pattern", u1_cbp);
  581|  8.06k|        ps_cur_mb_info->u1_cbp = u1_cbp;
  582|  8.06k|        p_curr_ctxt->u1_cbp = u1_cbp;
  583|       |
  584|       |        /*--------------------------------------------------------------------*/
  585|       |        /* Read mb_qp_delta                                                   */
  586|       |        /*--------------------------------------------------------------------*/
  587|  8.06k|        if(ps_cur_mb_info->u1_cbp)
  ------------------
  |  Branch (587:12): [True: 7.81k, False: 254]
  ------------------
  588|  7.81k|        {
  589|  7.81k|            ret = ih264d_parse_mb_qp_delta_cabac(ps_dec, &i1_delta_qp);
  590|  7.81k|            if(ret != OK)
  ------------------
  |  |  114|  7.81k|#define OK        0
  ------------------
  |  Branch (590:16): [True: 1, False: 7.81k]
  ------------------
  591|      1|                return ret;
  592|  7.81k|            COPYTHECONTEXT("mb_qp_delta", i1_delta_qp);
  593|  7.81k|            if(i1_delta_qp != 0)
  ------------------
  |  Branch (593:16): [True: 1.11k, False: 6.70k]
  ------------------
  594|  1.11k|            {
  595|  1.11k|                ret = ih264d_update_qp(ps_dec, i1_delta_qp);
  596|  1.11k|                if(ret != OK)
  ------------------
  |  |  114|  1.11k|#define OK        0
  ------------------
  |  Branch (596:20): [True: 0, False: 1.11k]
  ------------------
  597|      0|                    return ret;
  598|  1.11k|            }
  599|  7.81k|        }
  600|    254|        else
  601|    254|            ps_dec->i1_prev_mb_qp_delta = 0;
  602|  8.06k|        p_curr_ctxt->u1_yuv_dc_csbp &= 0xFE;
  603|  8.06k|    }
  604|  1.21k|    else
  605|  1.21k|    {
  606|  1.21k|        u1_offset = 1;
  607|  1.21k|        ps_cur_mb_info->ps_curmb->u1_mb_type = I_16x16_MB;
  ------------------
  |  |  418|  1.21k|#define I_16x16_MB  1
  ------------------
  608|  1.21k|        p_curr_ctxt->u1_mb_type = CAB_I16x16;
  ------------------
  |  |  395|  1.21k|#define CAB_I16x16        0x01 /* 0000 00x1 */
  ------------------
  609|  1.21k|        ps_cur_mb_info->u1_tran_form8x8 = 0;
  610|  1.21k|        p_curr_ctxt->u1_transform8x8_ctxt = 0;
  611|  1.21k|        ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
  612|       |        /*--------------------------------------------------------------------*/
  613|       |        /* Read the IntraPrediction mode for CHROMA                           */
  614|       |        /*--------------------------------------------------------------------*/
  615|  1.21k|        u1_intra_chrom_pred_mode = ih264d_parse_chroma_pred_mode_cabac(ps_dec);
  616|  1.21k|        if(u1_intra_chrom_pred_mode > 3)
  ------------------
  |  Branch (616:12): [True: 0, False: 1.21k]
  ------------------
  617|      0|            return ERROR_CHROMA_PRED_MODE;
  618|       |
  619|  1.21k|        COPYTHECONTEXT("Chroma intra_chroma_pred_mode pred mode", u1_intra_chrom_pred_mode);
  620|  1.21k|        p_curr_ctxt->u1_intra_chroma_pred_mode = ps_cur_mb_info->u1_chroma_pred_mode =
  621|  1.21k|                        u1_intra_chrom_pred_mode;
  622|       |
  623|       |        /*--------------------------------------------------------------------*/
  624|       |        /* Read the Coded block pattern                                       */
  625|       |        /*--------------------------------------------------------------------*/
  626|  1.21k|        u1_cbp = gau1_ih264d_cbp_tab[(u1_mb_type - 1) >> 2];
  627|  1.21k|        ps_cur_mb_info->u1_cbp = u1_cbp;
  628|  1.21k|        p_curr_ctxt->u1_cbp = u1_cbp;
  629|       |
  630|       |        /*--------------------------------------------------------------------*/
  631|       |        /* Read mb_qp_delta                                                   */
  632|       |        /*--------------------------------------------------------------------*/
  633|  1.21k|        ret = ih264d_parse_mb_qp_delta_cabac(ps_dec, &i1_delta_qp);
  634|  1.21k|        if(ret != OK)
  ------------------
  |  |  114|  1.21k|#define OK        0
  ------------------
  |  Branch (634:12): [True: 0, False: 1.21k]
  ------------------
  635|      0|            return ret;
  636|  1.21k|        COPYTHECONTEXT("mb_qp_delta", i1_delta_qp);
  637|  1.21k|        if(i1_delta_qp != 0)
  ------------------
  |  Branch (637:12): [True: 233, False: 983]
  ------------------
  638|    233|        {
  639|    233|            ret = ih264d_update_qp(ps_dec, i1_delta_qp);
  640|    233|            if(ret != OK)
  ------------------
  |  |  114|    233|#define OK        0
  ------------------
  |  Branch (640:16): [True: 0, False: 233]
  ------------------
  641|      0|                return ret;
  642|    233|        }
  643|       |
  644|  1.21k|        {
  645|  1.21k|            WORD16 i_scaleFactor;
  646|  1.21k|            WORD16* pi2_scale_matrix_ptr;
  647|       |            /*******************************************************************/
  648|       |            /* for luma DC coefficients the scaling is done during the parsing */
  649|       |            /* to preserve the precision                                       */
  650|       |            /*******************************************************************/
  651|  1.21k|            if(ps_dec->s_high_profile.u1_scaling_present)
  ------------------
  |  Branch (651:16): [True: 1.07k, False: 143]
  ------------------
  652|  1.07k|            {
  653|  1.07k|                pi2_scale_matrix_ptr =
  654|  1.07k|                                ps_dec->s_high_profile.i2_scalinglist4x4[0];
  655|       |
  656|  1.07k|            }
  657|    143|            else
  658|    143|            {
  659|    143|                i_scaleFactor = 16;
  660|    143|                pi2_scale_matrix_ptr = &i_scaleFactor;
  661|    143|            }
  662|  1.21k|            {
  663|  1.21k|                ctxt_inc_mb_info_t *ps_top_ctxt = ps_dec->p_top_ctxt_mb_info;
  664|  1.21k|                UWORD8 uc_a, uc_b;
  665|  1.21k|                UWORD32 u4_ctx_inc;
  666|       |
  667|  1.21k|                INC_SYM_COUNT(&(ps_dec->s_cab_dec_env));
  668|       |
  669|       |                /* if MbAddrN not available then CondTermN = 1 */
  670|  1.21k|                uc_b = ((ps_top_ctxt->u1_yuv_dc_csbp) & 0x01);
  671|       |
  672|       |                /* if MbAddrN not available then CondTermN = 1 */
  673|  1.21k|                uc_a = ((ps_dec->pu1_left_yuv_dc_csbp[0]) & 0x01);
  674|       |
  675|  1.21k|                u4_ctx_inc = (uc_a + (uc_b << 1));
  676|       |
  677|  1.21k|                {
  678|  1.21k|                    WORD16 pi2_dc_coef[16];
  679|  1.21k|                    tu_sblk4x4_coeff_data_t *ps_tu_4x4 =
  680|  1.21k|                                    (tu_sblk4x4_coeff_data_t *)ps_dec->pv_parse_tu_coeff_data;
  681|  1.21k|                    WORD16 *pi2_coeff_block =
  682|  1.21k|                                    (WORD16 *)ps_dec->pv_parse_tu_coeff_data;
  683|       |
  684|  1.21k|                    p_bin_ctxt = (ps_dec->p_cbf_t[LUMA_DC_CTXCAT]) + u4_ctx_inc;
  ------------------
  |  |   71|  1.21k|#define LUMA_DC_CTXCAT    0
  ------------------
  685|       |
  686|  1.21k|                    u1_dc_block_flag =
  687|  1.21k|                                    ih264d_read_coeff4x4_cabac(ps_bitstrm,
  688|  1.21k|                                                    LUMA_DC_CTXCAT,
  ------------------
  |  |   71|  1.21k|#define LUMA_DC_CTXCAT    0
  ------------------
  689|  1.21k|                                                    ps_dec->p_significant_coeff_flag_t[LUMA_DC_CTXCAT],
  ------------------
  |  |   71|  1.21k|#define LUMA_DC_CTXCAT    0
  ------------------
  690|  1.21k|                                                    ps_dec, p_bin_ctxt);
  691|       |
  692|       |                    /* Store coded_block_flag */
  693|  1.21k|                    p_curr_ctxt->u1_yuv_dc_csbp &= 0xFE;
  694|  1.21k|                    p_curr_ctxt->u1_yuv_dc_csbp |= u1_dc_block_flag;
  695|  1.21k|                    if(u1_dc_block_flag)
  ------------------
  |  Branch (695:24): [True: 1.04k, False: 168]
  ------------------
  696|  1.04k|                    {
  697|  1.04k|                        WORD32 pi4_tmp[16];
  698|  1.04k|                        memset(pi2_dc_coef,0,sizeof(pi2_dc_coef));
  699|  1.04k|                        ih264d_unpack_coeff4x4_dc_4x4blk(ps_tu_4x4,
  700|  1.04k|                                                         pi2_dc_coef,
  701|  1.04k|                                                         ps_dec->pu1_inv_scan);
  702|       |
  703|  1.04k|                        PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  1.04k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
  704|  1.04k|                        ps_dec->pf_ihadamard_scaling_4x4(pi2_dc_coef,
  705|  1.04k|                                                         pi2_coeff_block,
  706|  1.04k|                                                         ps_dec->pu2_quant_scale_y,
  707|  1.04k|                                                         (UWORD16 *)pi2_scale_matrix_ptr,
  708|  1.04k|                                                         ps_dec->u1_qp_y_div6,
  709|  1.04k|                                                         pi4_tmp);
  710|  1.04k|                        pi2_coeff_block += 16;
  711|  1.04k|                        ps_dec->pv_parse_tu_coeff_data = (void *)pi2_coeff_block;
  712|  1.04k|                        SET_BIT(ps_cur_mb_info->u1_yuv_dc_block_flag,0);
  ------------------
  |  |  106|  1.04k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
  713|  1.04k|                    }
  714|       |
  715|  1.21k|                }
  716|       |
  717|  1.21k|            }
  718|  1.21k|        }
  719|  1.21k|    }
  720|       |
  721|  9.28k|    ps_dec->pu1_left_yuv_dc_csbp[0] &= 0x6;
  722|  9.28k|    ps_dec->pu1_left_yuv_dc_csbp[0] |= u1_dc_block_flag;
  723|       |
  724|  9.28k|    ih264d_parse_residual4x4_cabac(ps_dec, ps_cur_mb_info, u1_offset);
  725|  9.28k|    if(EXCEED_OFFSET(ps_bitstrm))
  ------------------
  |  |   93|  9.28k|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 471, False: 8.81k]
  |  |  ------------------
  ------------------
  726|    471|        return ERROR_EOB_TERMINATE_T;
  727|  8.81k|    return OK;
  ------------------
  |  |  114|  8.81k|#define OK        0
  ------------------
  728|  9.28k|}
ih264d_parse_ipcm_mb:
 1215|    605|{
 1216|    605|    dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
 1217|    605|    UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
 1218|    605|    UWORD8 *pu1_y, *pu1_u, *pu1_v;
 1219|    605|    WORD32 ret;
 1220|       |
 1221|    605|    UWORD32 u4_rec_width_y, u4_rec_width_uv;
 1222|    605|    UWORD32 u1_num_mb_pair;
 1223|    605|    UWORD8 u1_x, u1_y;
 1224|       |    /* CHANGED CODE */
 1225|    605|    tfr_ctxt_t *ps_frame_buf;
 1226|    605|    UWORD8 u1_mb_field_decoding_flag;
 1227|    605|    UWORD32 *pu4_buf;
 1228|    605|    UWORD8 *pu1_buf;
 1229|       |    /* CHANGED CODE */
 1230|       |
 1231|    605|    if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (1231:8): [True: 274, False: 331]
  ------------------
 1232|    274|    {
 1233|    274|        ps_frame_buf = &ps_dec->s_tran_addrecon_parse;
 1234|    274|    }
 1235|    331|    else
 1236|    331|    {
 1237|    331|        ps_frame_buf = &ps_dec->s_tran_addrecon;
 1238|    331|    }
 1239|       |    /* align bistream to byte boundary. */
 1240|       |    /* pcm_alignment_zero_bit discarded */
 1241|       |    /* For XX GotoByteBoundary */
 1242|    605|    if(ps_bitstrm->u4_ofst & 0x07)
  ------------------
  |  Branch (1242:8): [True: 598, False: 7]
  ------------------
 1243|    598|    {
 1244|    598|        ps_bitstrm->u4_ofst += 8;
 1245|    598|        ps_bitstrm->u4_ofst &= 0xFFFFFFF8;
 1246|    598|    }
 1247|       |
 1248|       |    /*  Store left Nnz as 16 for each 4x4 blk */
 1249|       |
 1250|    605|    pu1_buf = ps_dec->pu1_left_nnz_y;
 1251|    605|    pu4_buf = (UWORD32 *)pu1_buf;
 1252|    605|    *pu4_buf = 0x10101010;
 1253|    605|    pu1_buf = ps_cur_mb_info->ps_curmb->pu1_nnz_y;
 1254|    605|    pu4_buf = (UWORD32 *)pu1_buf;
 1255|    605|    *pu4_buf = 0x10101010;
 1256|    605|    pu1_buf = ps_cur_mb_info->ps_curmb->pu1_nnz_uv;
 1257|    605|    pu4_buf = (UWORD32 *)pu1_buf;
 1258|    605|    *pu4_buf = 0x10101010;
 1259|    605|    pu1_buf = ps_dec->pu1_left_nnz_uv;
 1260|    605|    pu4_buf = (UWORD32 *)pu1_buf;
 1261|    605|    *pu4_buf = 0x10101010;
 1262|    605|    ps_cur_mb_info->u1_cbp = 0xff;
 1263|       |
 1264|    605|    ps_dec->i1_prev_mb_qp_delta = 0;
 1265|       |    /* Get neighbour MB's */
 1266|    605|    u1_num_mb_pair = (u4_mbNum >> u1_mbaff);
 1267|       |
 1268|       |    /*****************************************************************************/
 1269|       |    /* calculate the RECON buffer YUV pointers for the PCM data                  */
 1270|       |    /*****************************************************************************/
 1271|       |    /* CHANGED CODE  */
 1272|    605|    u1_mb_field_decoding_flag = ps_cur_mb_info->u1_mb_field_decodingflag;
 1273|    605|    pu1_y = ps_frame_buf->pu1_dest_y + (u1_num_mb_pair << 4);
 1274|    605|    pu1_u = ps_frame_buf->pu1_dest_u + (u1_num_mb_pair << 4);
 1275|    605|    pu1_v = pu1_u + 1;
 1276|       |
 1277|    605|    u4_rec_width_y = ps_dec->u2_frm_wd_y << u1_mb_field_decoding_flag;
 1278|    605|    u4_rec_width_uv = ps_dec->u2_frm_wd_uv << u1_mb_field_decoding_flag;
 1279|       |    /* CHANGED CODE  */
 1280|       |
 1281|    605|    if(u1_mbaff)
  ------------------
  |  Branch (1281:8): [True: 0, False: 605]
  ------------------
 1282|      0|    {
 1283|      0|        UWORD8 u1_top_mb;
 1284|       |
 1285|      0|        u1_top_mb = ps_cur_mb_info->u1_topmb;
 1286|       |
 1287|      0|        if(u1_top_mb == 0)
  ------------------
  |  Branch (1287:12): [True: 0, False: 0]
  ------------------
 1288|      0|        {
 1289|      0|            pu1_y += (u1_mb_field_decoding_flag ?
  ------------------
  |  Branch (1289:23): [True: 0, False: 0]
  ------------------
 1290|      0|                            (u4_rec_width_y >> 1) : (u4_rec_width_y << 4));
 1291|      0|            pu1_u += (u1_mb_field_decoding_flag ?
  ------------------
  |  Branch (1291:23): [True: 0, False: 0]
  ------------------
 1292|      0|                            (u4_rec_width_uv) : (u4_rec_width_uv << 4));
 1293|      0|            pu1_v = pu1_u + 1;
 1294|      0|        }
 1295|      0|    }
 1296|       |
 1297|       |    /* Read Luma samples */
 1298|  10.2k|    for(u1_y = 0; u1_y < 16; u1_y++)
  ------------------
  |  Branch (1298:19): [True: 9.68k, False: 605]
  ------------------
 1299|  9.68k|    {
 1300|   164k|        for(u1_x = 0; u1_x < 16; u1_x++)
  ------------------
  |  Branch (1300:23): [True: 154k, False: 9.68k]
  ------------------
 1301|   154k|            pu1_y[u1_x] = ih264d_get_bits_h264(ps_bitstrm, 8);
 1302|       |
 1303|  9.68k|        pu1_y += u4_rec_width_y;
 1304|  9.68k|    }
 1305|       |
 1306|       |    /* Read Chroma samples */
 1307|  5.44k|    for(u1_y = 0; u1_y < 8; u1_y++)
  ------------------
  |  Branch (1307:19): [True: 4.84k, False: 605]
  ------------------
 1308|  4.84k|    {
 1309|  43.5k|        for(u1_x = 0; u1_x < 8; u1_x++)
  ------------------
  |  Branch (1309:23): [True: 38.7k, False: 4.84k]
  ------------------
 1310|  38.7k|            pu1_u[u1_x * YUV420SP_FACTOR] = ih264d_get_bits_h264(ps_bitstrm, 8);
  ------------------
  |  |  119|  38.7k|#define YUV420SP_FACTOR 2
  ------------------
 1311|       |
 1312|  4.84k|        pu1_u += u4_rec_width_uv;
 1313|  4.84k|    }
 1314|       |
 1315|  5.44k|    for(u1_y = 0; u1_y < 8; u1_y++)
  ------------------
  |  Branch (1315:19): [True: 4.84k, False: 605]
  ------------------
 1316|  4.84k|    {
 1317|  43.5k|        for(u1_x = 0; u1_x < 8; u1_x++)
  ------------------
  |  Branch (1317:23): [True: 38.7k, False: 4.84k]
  ------------------
 1318|  38.7k|            pu1_v[u1_x * YUV420SP_FACTOR] = ih264d_get_bits_h264(ps_bitstrm, 8);
  ------------------
  |  |  119|  38.7k|#define YUV420SP_FACTOR 2
  ------------------
 1319|       |
 1320|  4.84k|        pu1_v += u4_rec_width_uv;
 1321|  4.84k|    }
 1322|       |
 1323|    605|    if(CABAC == ps_dec->ps_cur_pps->u1_entropy_coding_mode)
  ------------------
  |  |  339|    605|#define CABAC  1
  ------------------
  |  Branch (1323:8): [True: 603, False: 2]
  ------------------
 1324|    603|    {
 1325|    603|        UWORD32 *pu4_buf;
 1326|    603|        UWORD8 *pu1_buf;
 1327|    603|        ctxt_inc_mb_info_t *p_curr_ctxt = ps_dec->ps_curr_ctxt_mb_info;
 1328|       |        /* Re-initialize the cabac decoding engine. */
 1329|    603|        ret = ih264d_init_cabac_dec_envirnoment(&(ps_dec->s_cab_dec_env), ps_bitstrm);
 1330|    603|        if(ret != OK)
  ------------------
  |  |  114|    603|#define OK        0
  ------------------
  |  Branch (1330:12): [True: 228, False: 375]
  ------------------
 1331|    228|            return ret;
 1332|       |        /* update the cabac contetxs */
 1333|    375|        p_curr_ctxt->u1_mb_type = CAB_I_PCM;
  ------------------
  |  |  407|    375|#define CAB_I_PCM         0x20 /* 001x xxxx */
  ------------------
 1334|    375|        p_curr_ctxt->u1_cbp = 47;
 1335|    375|        p_curr_ctxt->u1_intra_chroma_pred_mode = 0;
 1336|    375|        p_curr_ctxt->u1_transform8x8_ctxt = 0;
 1337|    375|        ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
 1338|       |
 1339|    375|        pu1_buf = ps_dec->pu1_left_nnz_y;
 1340|    375|        pu4_buf = (UWORD32 *)pu1_buf;
 1341|    375|        *pu4_buf = 0x01010101;
 1342|       |
 1343|    375|        pu1_buf = ps_cur_mb_info->ps_curmb->pu1_nnz_y;
 1344|    375|        pu4_buf = (UWORD32 *)pu1_buf;
 1345|    375|        *pu4_buf = 0x01010101;
 1346|       |
 1347|    375|        pu1_buf = ps_cur_mb_info->ps_curmb->pu1_nnz_uv;
 1348|    375|        pu4_buf = (UWORD32 *)pu1_buf;
 1349|    375|        *pu4_buf = 0x01010101;
 1350|       |
 1351|    375|        pu1_buf = ps_dec->pu1_left_nnz_uv;
 1352|    375|        pu4_buf = (UWORD32 *)pu1_buf;
 1353|    375|        *pu4_buf = 0x01010101;
 1354|       |
 1355|    375|        p_curr_ctxt->u1_yuv_dc_csbp = 0x7;
 1356|    375|        ps_dec->pu1_left_yuv_dc_csbp[0] = 0x7;
 1357|    375|        if(ps_dec->ps_cur_slice->u1_slice_type != I_SLICE)
  ------------------
  |  |  370|    375|#define I_SLICE  2
  ------------------
  |  Branch (1357:12): [True: 36, False: 339]
  ------------------
 1358|     36|        {
 1359|       |
 1360|     36|            MEMSET_16BYTES(&ps_dec->pu1_left_mv_ctxt_inc[0][0], 0);
  ------------------
  |  |  652|     36|#define MEMSET_16BYTES(pu4_start,value)                         \
  |  |  653|     36|{                                                               \
  |  |  654|     36|    memset(pu4_start,value,16);                                 \
  |  |  655|     36|}
  ------------------
 1361|     36|            memset(ps_dec->pi1_left_ref_idx_ctxt_inc, 0, 4);
 1362|     36|            MEMSET_16BYTES(p_curr_ctxt->u1_mv, 0);
  ------------------
  |  |  652|     36|#define MEMSET_16BYTES(pu4_start,value)                         \
  |  |  653|     36|{                                                               \
  |  |  654|     36|    memset(pu4_start,value,16);                                 \
  |  |  655|     36|}
  ------------------
 1363|     36|            memset(p_curr_ctxt->i1_ref_idx, 0, 4);
 1364|       |
 1365|     36|        }
 1366|    375|    }
 1367|    377|    return OK;
  ------------------
  |  |  114|    377|#define OK        0
  ------------------
 1368|    605|}

ih264d_parse_mb_type_intra_cabac:
   70|  10.4k|{
   71|  10.4k|    decoding_envirnoment_t * ps_cab_env = &ps_dec->s_cab_dec_env;
   72|  10.4k|    dec_bit_stream_t * ps_bitstrm = ps_dec->ps_bitstrm;
   73|  10.4k|    ctxt_inc_mb_info_t * ps_left_ctxt = ps_dec->p_left_ctxt_mb_info;
   74|  10.4k|    ctxt_inc_mb_info_t * ps_top_ctxt = ps_dec->p_top_ctxt_mb_info;
   75|  10.4k|    bin_ctxt_model_t *ps_mb_bin_ctxt = ps_dec->p_mb_type_t;
   76|  10.4k|    WORD8 u1_mb_type, u1_bin;
   77|  10.4k|    UWORD32 u4_cxt_inc;
   78|       |
   79|  10.4k|    u4_cxt_inc = 0;
   80|  10.4k|    if(!u1_inter)
  ------------------
  |  Branch (80:8): [True: 6.96k, False: 3.46k]
  ------------------
   81|  6.96k|    {
   82|  6.96k|        if(ps_left_ctxt != ps_dec->ps_def_ctxt_mb_info)
  ------------------
  |  Branch (82:12): [True: 4.10k, False: 2.85k]
  ------------------
   83|  4.10k|            u4_cxt_inc += ((ps_left_ctxt->u1_mb_type != CAB_I4x4) ? 1 : 0);
  ------------------
  |  |  394|  4.10k|#define CAB_I4x4          0x00 /* 0000 00x0 */
  ------------------
  |  Branch (83:28): [True: 403, False: 3.70k]
  ------------------
   84|  6.96k|        if(ps_top_ctxt != ps_dec->ps_def_ctxt_mb_info)
  ------------------
  |  Branch (84:12): [True: 5.78k, False: 1.17k]
  ------------------
   85|  5.78k|            u4_cxt_inc += ((ps_top_ctxt->u1_mb_type != CAB_I4x4) ? 1 : 0);
  ------------------
  |  |  394|  5.78k|#define CAB_I4x4          0x00 /* 0000 00x0 */
  ------------------
  |  Branch (85:28): [True: 322, False: 5.46k]
  ------------------
   86|  6.96k|    }
   87|  3.46k|    else
   88|  3.46k|    {
   89|  3.46k|        ps_mb_bin_ctxt = ps_mb_bin_ctxt + 3 + (ps_dec->u1_B << 1);
   90|  3.46k|    }
   91|       |
   92|       |    /* b0 */
   93|  10.4k|    u1_mb_type = (UWORD8)ih264d_decode_bin(u4_cxt_inc, ps_mb_bin_ctxt, ps_bitstrm,
   94|  10.4k|                                          ps_cab_env);
   95|  10.4k|    if(u1_mb_type)
  ------------------
  |  Branch (95:8): [True: 1.87k, False: 8.55k]
  ------------------
   96|  1.87k|    {
   97|       |        /* I16x16 or I_PCM mode */
   98|       |        /* b1 */
   99|  1.87k|        u1_bin = ih264d_decode_terminate(ps_cab_env, ps_bitstrm);
  100|  1.87k|        if(u1_bin == 0)
  ------------------
  |  Branch (100:12): [True: 1.27k, False: 603]
  ------------------
  101|  1.27k|        {
  102|       |            /* I16x16 mode */
  103|       |            /* Read b2 and b3 */
  104|  1.27k|            u4_cxt_inc = (u1_inter) ? 0x021 : 0x043;
  ------------------
  |  Branch (104:26): [True: 1.01k, False: 259]
  ------------------
  105|       |
  106|  1.27k|            u1_bin = ih264d_decode_bins(2, u4_cxt_inc, ps_mb_bin_ctxt, ps_bitstrm,
  107|  1.27k|                                        ps_cab_env);
  108|       |
  109|  1.27k|            if(u1_bin & 0x01)
  ------------------
  |  Branch (109:16): [True: 628, False: 645]
  ------------------
  110|    628|                u1_mb_type += 4;
  111|       |
  112|  1.27k|            if(u1_bin & 0x02)
  ------------------
  |  Branch (112:16): [True: 940, False: 333]
  ------------------
  113|    940|                u1_mb_type += 12;
  114|       |
  115|  1.27k|            if(u1_bin & 0x01)
  ------------------
  |  Branch (115:16): [True: 628, False: 645]
  ------------------
  116|    628|            {
  117|       |                /* since b3=1, Read three bins */
  118|    628|                u4_cxt_inc = (u1_inter) ? 0x0332 : 0x0765;
  ------------------
  |  Branch (118:30): [True: 509, False: 119]
  ------------------
  119|    628|                u1_bin = (UWORD8)ih264d_decode_bins(3, u4_cxt_inc, ps_mb_bin_ctxt,
  120|    628|                                                    ps_bitstrm, ps_cab_env);
  121|       |
  122|    628|            }
  123|    645|            else
  124|    645|            {
  125|       |                /* Read two bins */
  126|    645|                u4_cxt_inc = (u1_inter) ? 0x033 : 0x076;
  ------------------
  |  Branch (126:30): [True: 505, False: 140]
  ------------------
  127|    645|                u1_bin = (UWORD8)ih264d_decode_bins(2, u4_cxt_inc, ps_mb_bin_ctxt,
  128|    645|                                                    ps_bitstrm, ps_cab_env);
  129|    645|            }
  130|  1.27k|            u1_mb_type += u1_bin;
  131|  1.27k|        }
  132|    603|        else
  133|    603|        {
  134|       |            /* I_PCM mode */
  135|       |            /* b1=1 */
  136|    603|            u1_mb_type = 25;
  137|    603|        }
  138|  1.87k|    }
  139|  10.4k|    return (u1_mb_type);
  140|  10.4k|}
ih264d_parse_mb_type_cabac:
  155|  57.3k|{
  156|  57.3k|    const UWORD8 uc_slice_type = ps_dec->ps_cur_slice->u1_slice_type;
  157|  57.3k|    decoding_envirnoment_t *ps_cab_env = &ps_dec->s_cab_dec_env;
  158|  57.3k|    dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm;
  159|  57.3k|    ctxt_inc_mb_info_t *ps_left_ctxt = ps_dec->p_left_ctxt_mb_info;
  160|  57.3k|    ctxt_inc_mb_info_t *ps_top_ctxt = ps_dec->p_top_ctxt_mb_info;
  161|  57.3k|    WORD8 c_ctxt_inc;
  162|  57.3k|    bin_ctxt_model_t *ps_mb_bin_ctxt = ps_dec->p_mb_type_t;
  163|  57.3k|    WORD8 u1_mb_type = 0, u1_bin;
  164|  57.3k|    UWORD32 u4_cxt_inc;
  165|       |
  166|  57.3k|    INC_SYM_COUNT(ps_cab_env);
  167|       |
  168|  57.3k|    c_ctxt_inc = 0;
  169|       |
  170|  57.3k|    if(uc_slice_type == SI_SLICE)
  ------------------
  |  |  372|  57.3k|#define SI_SLICE 4
  ------------------
  |  Branch (170:8): [True: 0, False: 57.3k]
  ------------------
  171|      0|    {
  172|       |        /* b0 */
  173|      0|        if(ps_left_ctxt != ps_dec->ps_def_ctxt_mb_info)
  ------------------
  |  Branch (173:12): [True: 0, False: 0]
  ------------------
  174|      0|            c_ctxt_inc += ((ps_left_ctxt->u1_mb_type != CAB_SI4x4) ? 1 : 0);
  ------------------
  |  |  399|      0|#define CAB_SI4x4         0x08 /* 0000 10x0 */
  ------------------
  |  Branch (174:28): [True: 0, False: 0]
  ------------------
  175|      0|        if(ps_top_ctxt != ps_dec->ps_def_ctxt_mb_info)
  ------------------
  |  Branch (175:12): [True: 0, False: 0]
  ------------------
  176|      0|            c_ctxt_inc += ((ps_top_ctxt->u1_mb_type != CAB_SI4x4) ? 1 : 0);
  ------------------
  |  |  399|      0|#define CAB_SI4x4         0x08 /* 0000 10x0 */
  ------------------
  |  Branch (176:28): [True: 0, False: 0]
  ------------------
  177|       |
  178|      0|        u4_cxt_inc = c_ctxt_inc;
  179|      0|        u1_bin = (UWORD8)ih264d_decode_bin(u4_cxt_inc, ps_mb_bin_ctxt, ps_bitstrm,
  180|      0|                                           ps_cab_env);
  181|      0|        if(u1_bin == 0)
  ------------------
  |  Branch (181:12): [True: 0, False: 0]
  ------------------
  182|      0|        {
  183|       |            /* SI MB */
  184|      0|            u1_mb_type = 0;
  185|      0|        }
  186|      0|        else
  187|      0|        {
  188|      0|            u1_mb_type = 1 + ih264d_parse_mb_type_intra_cabac(0, ps_dec);
  189|      0|        }
  190|      0|    }
  191|  57.3k|    else if(uc_slice_type == P_SLICE)
  ------------------
  |  |  368|  57.3k|#define P_SLICE  0
  ------------------
  |  Branch (191:13): [True: 29.5k, False: 27.8k]
  ------------------
  192|  29.5k|    {
  193|       |        /* P Slice */
  194|       |        /* b0 */
  195|  29.5k|        u4_cxt_inc = 0;
  196|  29.5k|        u1_bin = (UWORD8)ih264d_decode_bin(u4_cxt_inc, ps_mb_bin_ctxt, ps_bitstrm,
  197|  29.5k|                                           ps_cab_env);
  198|  29.5k|        if(!u1_bin)
  ------------------
  |  Branch (198:12): [True: 26.4k, False: 3.00k]
  ------------------
  199|  26.4k|        {
  200|       |            /* Inter MB types */
  201|       |            /* b1 */
  202|  26.4k|            u4_cxt_inc = 0x01;
  203|  26.4k|            u1_bin = (UWORD8)ih264d_decode_bin(u4_cxt_inc, ps_mb_bin_ctxt,
  204|  26.4k|                                               ps_bitstrm, ps_cab_env);
  205|       |            /* b2 */
  206|  26.4k|            u4_cxt_inc = u1_bin + 2;
  207|  26.4k|            u1_mb_type = (UWORD8)ih264d_decode_bin(u4_cxt_inc, ps_mb_bin_ctxt,
  208|  26.4k|                                                  ps_bitstrm, ps_cab_env);
  209|  26.4k|            u1_mb_type = (u1_bin << 1) + u1_mb_type;
  210|  26.4k|            if(u1_mb_type)
  ------------------
  |  Branch (210:16): [True: 9.28k, False: 17.2k]
  ------------------
  211|  9.28k|                u1_mb_type = 4 - u1_mb_type;
  212|  26.4k|        }
  213|  3.00k|        else
  214|  3.00k|        {
  215|       |            /* Intra Prefix 1 found */
  216|       |            /* Intra MB type */
  217|  3.00k|            u1_mb_type = 5 + ih264d_parse_mb_type_intra_cabac(1, ps_dec);
  218|  3.00k|        }
  219|  29.5k|    }
  220|  27.8k|    else if(uc_slice_type == B_SLICE)
  ------------------
  |  |  369|  27.8k|#define B_SLICE  1
  ------------------
  |  Branch (220:13): [True: 27.8k, False: 0]
  ------------------
  221|  27.8k|    {
  222|  27.8k|        WORD8 a, b;
  223|       |        /* B Slice */
  224|       |        /* b0 */
  225|       |        /* a = b = 0, if B slice and MB is a SKIP or B_DIRECT16x16 */
  226|  27.8k|        a = 0;
  227|  27.8k|        b = 0;
  228|  27.8k|        u1_mb_type = 0;
  229|  27.8k|        if(ps_left_ctxt != ps_dec->ps_def_ctxt_mb_info)
  ------------------
  |  Branch (229:12): [True: 24.4k, False: 3.36k]
  ------------------
  230|  24.4k|            a = ((ps_left_ctxt->u1_mb_type & CAB_BD16x16_MASK) != CAB_BD16x16);
  ------------------
  |  |  405|  24.4k|#define CAB_BD16x16_MASK  0x07 /* 0000 0111 */
  ------------------
                          a = ((ps_left_ctxt->u1_mb_type & CAB_BD16x16_MASK) != CAB_BD16x16);
  ------------------
  |  |  396|  24.4k|#define CAB_BD16x16       0x04 /* 0000 0100 */
  ------------------
  231|  27.8k|        if(ps_top_ctxt != ps_dec->ps_def_ctxt_mb_info)
  ------------------
  |  Branch (231:12): [True: 20.8k, False: 6.95k]
  ------------------
  232|  20.8k|            b = ((ps_top_ctxt->u1_mb_type & CAB_BD16x16_MASK) != CAB_BD16x16);
  ------------------
  |  |  405|  20.8k|#define CAB_BD16x16_MASK  0x07 /* 0000 0111 */
  ------------------
                          b = ((ps_top_ctxt->u1_mb_type & CAB_BD16x16_MASK) != CAB_BD16x16);
  ------------------
  |  |  396|  20.8k|#define CAB_BD16x16       0x04 /* 0000 0100 */
  ------------------
  233|       |
  234|  27.8k|        u4_cxt_inc = a + b;
  235|       |
  236|  27.8k|        u1_bin = (UWORD8)ih264d_decode_bin(u4_cxt_inc, ps_mb_bin_ctxt, ps_bitstrm,
  237|  27.8k|                                           ps_cab_env);
  238|       |
  239|  27.8k|        if(u1_bin)
  ------------------
  |  Branch (239:12): [True: 26.1k, False: 1.66k]
  ------------------
  240|  26.1k|        {
  241|       |
  242|       |            /* b1 */
  243|  26.1k|            u4_cxt_inc = 0x03;
  244|  26.1k|            u1_bin = (UWORD8)ih264d_decode_bin(u4_cxt_inc, ps_mb_bin_ctxt,
  245|  26.1k|                                               ps_bitstrm, ps_cab_env);
  246|       |
  247|  26.1k|            if(!u1_bin)
  ------------------
  |  Branch (247:16): [True: 3.47k, False: 22.6k]
  ------------------
  248|  3.47k|            {
  249|       |                /* b2 */
  250|  3.47k|                u4_cxt_inc = 0x05;
  251|  3.47k|                u1_bin = (UWORD8)ih264d_decode_bin(u4_cxt_inc, ps_mb_bin_ctxt,
  252|  3.47k|                                                   ps_bitstrm, ps_cab_env);
  253|       |
  254|  3.47k|                u1_mb_type = u1_bin + 1;
  255|  3.47k|            }
  256|  22.6k|            else
  257|  22.6k|            {
  258|  22.6k|                u1_mb_type = 3;
  259|       |                /* b2 */
  260|  22.6k|                u4_cxt_inc = 0x04;
  261|  22.6k|                u1_bin = (UWORD8)ih264d_decode_bin(u4_cxt_inc, ps_mb_bin_ctxt,
  262|  22.6k|                                                   ps_bitstrm, ps_cab_env);
  263|       |
  264|  22.6k|                if(u1_bin)
  ------------------
  |  Branch (264:20): [True: 17.9k, False: 4.79k]
  ------------------
  265|  17.9k|                {
  266|  17.9k|                    u1_mb_type += 8;
  267|       |                    /* b3 */
  268|  17.9k|                    u4_cxt_inc = 0x05;
  269|  17.9k|                    u1_bin = (UWORD8)ih264d_decode_bin(u4_cxt_inc, ps_mb_bin_ctxt,
  270|  17.9k|                                                       ps_bitstrm, ps_cab_env);
  271|       |
  272|  17.9k|                    if(!u1_bin)
  ------------------
  |  Branch (272:24): [True: 2.28k, False: 15.6k]
  ------------------
  273|  2.28k|                    {
  274|  2.28k|                        u1_mb_type++;
  275|       |                        /* b4, b5, b6 */
  276|  2.28k|                        u4_cxt_inc = 0x0555;
  277|  2.28k|                        u1_bin = (UWORD8)ih264d_decode_bins(3, u4_cxt_inc,
  278|  2.28k|                                                            ps_mb_bin_ctxt,
  279|  2.28k|                                                            ps_bitstrm,
  280|  2.28k|                                                            ps_cab_env);
  281|       |
  282|       |
  283|       |
  284|  2.28k|                        u1_mb_type += u1_bin;
  285|  2.28k|                    }
  286|  15.6k|                    else
  287|  15.6k|                    {
  288|       |                        /* b4 */
  289|  15.6k|                        u4_cxt_inc = 0x05;
  290|  15.6k|                        u1_bin = (UWORD8)ih264d_decode_bin(u4_cxt_inc,
  291|  15.6k|                                                           ps_mb_bin_ctxt,
  292|  15.6k|                                                           ps_bitstrm,
  293|  15.6k|                                                           ps_cab_env);
  294|       |
  295|  15.6k|                        if(u1_bin)
  ------------------
  |  Branch (295:28): [True: 14.5k, False: 1.11k]
  ------------------
  296|  14.5k|                        {
  297|       |                            /* b5 */
  298|  14.5k|                            u1_bin = (UWORD8)ih264d_decode_bin(u4_cxt_inc,
  299|  14.5k|                                                               ps_mb_bin_ctxt,
  300|  14.5k|                                                               ps_bitstrm,
  301|  14.5k|                                                               ps_cab_env);
  302|       |
  303|  14.5k|                            u1_mb_type += (u1_bin ? 11 : 0);
  ------------------
  |  Branch (303:44): [True: 13.9k, False: 522]
  ------------------
  304|  14.5k|                        }
  305|  1.11k|                        else
  306|  1.11k|                        {
  307|  1.11k|                            u1_mb_type = 20;
  308|       |                            /* b5 */
  309|  1.11k|                            u1_bin = (UWORD8)ih264d_decode_bin(u4_cxt_inc,
  310|  1.11k|                                                               ps_mb_bin_ctxt,
  311|  1.11k|                                                               ps_bitstrm,
  312|  1.11k|                                                               ps_cab_env);
  313|       |
  314|  1.11k|                            if(!u1_bin)
  ------------------
  |  Branch (314:32): [True: 655, False: 461]
  ------------------
  315|    655|                            {
  316|       |                                /* b6 */
  317|    655|                                u1_bin = (UWORD8)ih264d_decode_bin(u4_cxt_inc,
  318|    655|                                                                   ps_mb_bin_ctxt,
  319|    655|                                                                   ps_bitstrm,
  320|    655|                                                                   ps_cab_env);
  321|       |
  322|    655|                                u1_mb_type += u1_bin;
  323|    655|                            }
  324|    461|                            else
  325|    461|                            {
  326|       |                                /* Intra Prefix 111101 found */
  327|       |                                /* Intra MB type */
  328|    461|                                u1_mb_type =
  329|    461|                                                23
  330|    461|                                                                + ih264d_parse_mb_type_intra_cabac(
  331|    461|                                                                                1,
  332|    461|                                                                                ps_dec);
  333|    461|                            }
  334|  1.11k|                        }
  335|  15.6k|                    }
  336|  17.9k|                }
  337|  4.79k|                else
  338|  4.79k|                {
  339|       |                    /* b3, b4, b5 */
  340|  4.79k|                    u4_cxt_inc = 0x0555;
  341|  4.79k|                    u1_bin = (UWORD8)ih264d_decode_bins(3, u4_cxt_inc,
  342|  4.79k|                                                        ps_mb_bin_ctxt, ps_bitstrm,
  343|  4.79k|                                                        ps_cab_env);
  344|       |
  345|       |
  346|       |
  347|       |
  348|  4.79k|                    u1_mb_type += u1_bin;
  349|  4.79k|                }
  350|  22.6k|            }
  351|  26.1k|        }
  352|  27.8k|    }
  353|  57.3k|    return ((UWORD32)u1_mb_type);
  354|  57.3k|}
ih264d_parse_submb_type_cabac:
  372|  73.4k|{
  373|  73.4k|    WORD8 u1_sub_mb_type, u1_bin;
  374|       |
  375|  73.4k|    INC_SYM_COUNT(ps_cab_env);
  376|       |
  377|  73.4k|    u1_sub_mb_type = 0;
  378|  73.4k|    u1_bin = (UWORD8)ih264d_decode_bin(0, ps_sub_mb_cxt, ps_bitstrm,
  379|  73.4k|                                       ps_cab_env);
  380|       |
  381|  73.4k|    if(u1_slc_type_b ^ u1_bin)
  ------------------
  |  Branch (381:8): [True: 11.1k, False: 62.3k]
  ------------------
  382|  11.1k|        return 0;
  383|       |
  384|  62.3k|    if(!u1_slc_type_b)
  ------------------
  |  Branch (384:8): [True: 10.3k, False: 52.0k]
  ------------------
  385|  10.3k|    {
  386|       |        /* P Slice */
  387|  10.3k|        u1_sub_mb_type = 1;
  388|  10.3k|        u1_bin = (UWORD8)ih264d_decode_bin(1, ps_sub_mb_cxt, ps_bitstrm,
  389|  10.3k|                                           ps_cab_env);
  390|  10.3k|        if(u1_bin == 1)
  ------------------
  |  Branch (390:12): [True: 6.43k, False: 3.92k]
  ------------------
  391|  6.43k|        {
  392|  6.43k|            u1_bin = (UWORD8)ih264d_decode_bin(2, ps_sub_mb_cxt, ps_bitstrm,
  393|  6.43k|                                               ps_cab_env);
  394|  6.43k|            u1_sub_mb_type = (2 + (!u1_bin));
  395|  6.43k|        }
  396|       |
  397|  10.3k|        return u1_sub_mb_type;
  398|  10.3k|    }
  399|  52.0k|    else
  400|  52.0k|    {
  401|       |        /* B Slice */
  402|       |
  403|       |        /* b1 */
  404|  52.0k|        u1_bin = (UWORD8)ih264d_decode_bin(1, ps_sub_mb_cxt, ps_bitstrm,
  405|  52.0k|                                           ps_cab_env);
  406|  52.0k|        if(u1_bin)
  ------------------
  |  Branch (406:12): [True: 3.83k, False: 48.1k]
  ------------------
  407|  3.83k|        {
  408|       |            /* b2 */
  409|  3.83k|            u1_bin = (UWORD8)ih264d_decode_bin(2, ps_sub_mb_cxt, ps_bitstrm,
  410|  3.83k|                                               ps_cab_env);
  411|  3.83k|            if(u1_bin)
  ------------------
  |  Branch (411:16): [True: 650, False: 3.18k]
  ------------------
  412|    650|            {
  413|       |                /* b3 */
  414|    650|                u1_sub_mb_type = 7;
  415|    650|                u1_bin = (UWORD8)ih264d_decode_bin(3, ps_sub_mb_cxt, ps_bitstrm,
  416|    650|                                                   ps_cab_env);
  417|    650|                u1_sub_mb_type += u1_bin << 2;
  418|    650|                u1_bin = !u1_bin;
  419|       |                /* b4 */
  420|    650|                if(u1_bin == 0)
  ------------------
  |  Branch (420:20): [True: 274, False: 376]
  ------------------
  421|    274|                {
  422|    274|                    u1_bin = ih264d_decode_bin(3, ps_sub_mb_cxt, ps_bitstrm,
  423|    274|                                               ps_cab_env);
  424|    274|                }
  425|    376|                else
  426|    376|                {
  427|    376|                    u1_bin = (UWORD8)ih264d_decode_bins(2, 0x33, ps_sub_mb_cxt,
  428|    376|                                                        ps_bitstrm, ps_cab_env);
  429|    376|                }
  430|       |
  431|    650|                return (u1_sub_mb_type + u1_bin);
  432|    650|            }
  433|  3.18k|            else
  434|  3.18k|            {
  435|       |                /* b3 */
  436|  3.18k|                u1_bin = (UWORD8)ih264d_decode_bins(2, 0x33, ps_sub_mb_cxt,
  437|  3.18k|                                                    ps_bitstrm, ps_cab_env);
  438|  3.18k|                return (3 + u1_bin);
  439|  3.18k|            }
  440|  3.83k|        }
  441|  48.1k|        else
  442|  48.1k|        {
  443|       |            /* b2 */
  444|  48.1k|            u1_bin = (UWORD8)ih264d_decode_bin(3, ps_sub_mb_cxt, ps_bitstrm,
  445|  48.1k|                                               ps_cab_env);
  446|  48.1k|            return (1 + u1_bin);
  447|  48.1k|        }
  448|  52.0k|    }
  449|  62.3k|}
ih264d_parse_ref_idx_cabac:
  473|  52.2k|{
  474|  52.2k|    UWORD8 u1_a, u1_b;
  475|  52.2k|    UWORD32 u4_cxt_inc;
  476|  52.2k|    UWORD8 u1_blk_no, u1_i, u1_idx_lft, u1_idx_top;
  477|  52.2k|    WORD8 i1_ref_idx;
  478|       |
  479|   203k|    for(u1_blk_no = 0, u1_i = 0; u1_i < u1_num_part; u1_i++, pi1_ref_idx++)
  ------------------
  |  Branch (479:34): [True: 151k, False: 52.1k]
  ------------------
  480|   151k|    {
  481|   151k|        u1_idx_lft = ((u1_blk_no & 0x02) >> 1) + u1_b2;
  482|   151k|        u1_idx_top = (u1_blk_no & 0x01) + u1_b2;
  483|   151k|        i1_ref_idx = *pi1_ref_idx;
  484|       |
  485|   151k|        if(i1_ref_idx > 0)
  ------------------
  |  Branch (485:12): [True: 28.0k, False: 123k]
  ------------------
  486|  28.0k|        {
  487|  28.0k|            u1_a = pi1_lft_cxt[u1_idx_lft] > 0;
  488|  28.0k|            u1_b = pi1_top_cxt[u1_idx_top] > 0;
  489|       |
  490|  28.0k|            u4_cxt_inc = u1_a + (u1_b << 1);
  491|  28.0k|            u4_cxt_inc = (u4_cxt_inc | 0x55540);
  492|       |
  493|  28.0k|            i1_ref_idx = (WORD8)ih264d_decode_bins_unary(32, u4_cxt_inc,
  494|  28.0k|                                                         ps_ref_cxt, ps_bitstrm,
  495|  28.0k|                                                         ps_cab_env);
  496|       |
  497|  28.0k|            if((i1_ref_idx > u1_max_ref_minus1) || (i1_ref_idx < 0))
  ------------------
  |  Branch (497:16): [True: 111, False: 27.9k]
  |  Branch (497:52): [True: 0, False: 27.9k]
  ------------------
  498|    111|            {
  499|    111|                return ERROR_REF_IDX;
  500|    111|            }
  501|       |
  502|  27.9k|            *pi1_ref_idx = i1_ref_idx;
  503|       |
  504|  27.9k|            INC_SYM_COUNT(ps_cab_env);
  505|       |
  506|  27.9k|        }
  507|       |
  508|       |        /* Storing Reference Idx Information */
  509|   151k|        pi1_lft_cxt[u1_idx_lft] = i1_ref_idx;
  510|   151k|        pi1_top_cxt[u1_idx_top] = i1_ref_idx;
  511|   151k|        u1_blk_no = u1_blk_no + 1 + (u1_mb_mode & 0x01);
  512|   151k|    }
  513|       |    /* if(!u1_sub_mb) */
  514|  52.1k|    if(u1_num_part != 4)
  ------------------
  |  Branch (514:8): [True: 23.7k, False: 28.3k]
  ------------------
  515|  23.7k|    {
  516|  23.7k|        pi1_lft_cxt[(!(u1_mb_mode & 0x1)) + u1_b2] = pi1_lft_cxt[u1_b2];
  517|  23.7k|        pi1_top_cxt[(!(u1_mb_mode & 0x2)) + u1_b2] = pi1_top_cxt[u1_b2];
  518|  23.7k|    }
  519|  52.1k|    return OK;
  ------------------
  |  |  114|  52.1k|#define OK        0
  ------------------
  520|  52.2k|}
ih264d_parse_mb_qp_delta_cabac:
  536|  45.8k|{
  537|  45.8k|    decoding_envirnoment_t * ps_cab_env = &ps_dec->s_cab_dec_env;
  538|  45.8k|    dec_bit_stream_t * ps_bitstrm = ps_dec->ps_bitstrm;
  539|       |
  540|  45.8k|    UWORD8 u1_code_num;
  541|  45.8k|    bin_ctxt_model_t *ps_mb_qp_delta_ctxt = ps_dec->p_mb_qp_delta_t;
  542|  45.8k|    UWORD32 u4_cxt_inc;
  543|       |
  544|  45.8k|    INC_SYM_COUNT(ps_cab_env);
  545|       |
  546|  45.8k|    u4_cxt_inc = (!(!(ps_dec->i1_prev_mb_qp_delta)));
  547|       |
  548|  45.8k|    u1_code_num = 0;
  549|  45.8k|    u4_cxt_inc = (u4_cxt_inc | 0x33320);
  550|       |    /* max number of bins = 53,
  551|       |     since Range for MbQpDelta= -26 to +25 inclusive, UNARY code */
  552|  45.8k|    u1_code_num = ih264d_decode_bins_unary(32, u4_cxt_inc, ps_mb_qp_delta_ctxt,
  553|  45.8k|                                          ps_bitstrm, ps_cab_env);
  554|  45.8k|    if(u1_code_num == 32)
  ------------------
  |  Branch (554:8): [True: 12, False: 45.8k]
  ------------------
  555|     12|    {
  556|       |        /* Read remaining 21 bins */
  557|     12|        UWORD8 uc_codeNumX;
  558|     12|        u4_cxt_inc = 0x33333;
  559|     12|        uc_codeNumX = ih264d_decode_bins_unary(21, u4_cxt_inc, ps_mb_qp_delta_ctxt,
  560|     12|                                               ps_bitstrm, ps_cab_env);
  561|     12|        u1_code_num = u1_code_num + uc_codeNumX;
  562|     12|    }
  563|       |
  564|  45.8k|    *pi1_mb_qp_delta = (u1_code_num + 1) >> 1;
  565|       |    /* Table 9.3: If code_num is even Syntax Element has -ve value */
  566|  45.8k|    if(!(u1_code_num & 0x01))
  ------------------
  |  Branch (566:8): [True: 34.7k, False: 11.0k]
  ------------------
  567|  34.7k|        *pi1_mb_qp_delta = -(*pi1_mb_qp_delta);
  568|       |
  569|       |    /* Range of MbQpDelta= -26 to +25 inclusive */
  570|  45.8k|    if((*pi1_mb_qp_delta < -26) || (*pi1_mb_qp_delta > 25))
  ------------------
  |  Branch (570:8): [True: 0, False: 45.8k]
  |  Branch (570:36): [True: 7, False: 45.8k]
  ------------------
  571|      7|        return ERROR_INV_RANGE_QP_T;
  572|  45.8k|    ps_dec->i1_prev_mb_qp_delta = *pi1_mb_qp_delta;
  573|  45.8k|    return OK;
  ------------------
  |  |  114|  45.8k|#define OK        0
  ------------------
  574|  45.8k|}
ih264d_parse_chroma_pred_mode_cabac:
  588|  9.82k|{
  589|  9.82k|    decoding_envirnoment_t * ps_cab_env = &ps_dec->s_cab_dec_env;
  590|  9.82k|    dec_bit_stream_t * ps_bitstrm = ps_dec->ps_bitstrm;
  591|  9.82k|    ctxt_inc_mb_info_t * ps_left_ctxt = ps_dec->p_left_ctxt_mb_info;
  592|  9.82k|    ctxt_inc_mb_info_t * ps_top_ctxt = ps_dec->p_top_ctxt_mb_info;
  593|  9.82k|    WORD8 i1_chroma_pred_mode, a, b;
  594|  9.82k|    UWORD32 u4_cxt_inc;
  595|       |
  596|  9.82k|    INC_SYM_COUNT(ps_cab_env);
  597|       |
  598|       |    /* Binarization is TU and Cmax=3 */
  599|  9.82k|    i1_chroma_pred_mode = 0;
  600|  9.82k|    a = 0;
  601|  9.82k|    b = 0;
  602|       |
  603|  9.82k|    a = ((ps_left_ctxt->u1_intra_chroma_pred_mode != 0) ? 1 : 0);
  ------------------
  |  Branch (603:10): [True: 3.86k, False: 5.96k]
  ------------------
  604|       |
  605|  9.82k|    b = ((ps_top_ctxt->u1_intra_chroma_pred_mode != 0) ? 1 : 0);
  ------------------
  |  Branch (605:10): [True: 5.85k, False: 3.96k]
  ------------------
  606|  9.82k|    u4_cxt_inc = a + b;
  607|       |
  608|  9.82k|    u4_cxt_inc = (u4_cxt_inc | 0x330);
  609|       |
  610|  9.82k|    i1_chroma_pred_mode = ih264d_decode_bins_tunary(
  611|  9.82k|                    3, u4_cxt_inc, ps_dec->p_intra_chroma_pred_mode_t,
  612|  9.82k|                    ps_bitstrm, ps_cab_env);
  613|       |
  614|  9.82k|    return (i1_chroma_pred_mode);
  615|  9.82k|}
ih264d_parse_transform8x8flag_cabac:
  635|  31.6k|{
  636|  31.6k|    decoding_envirnoment_t * ps_cab_env = &ps_dec->s_cab_dec_env;
  637|  31.6k|    dec_bit_stream_t * ps_bitstrm = ps_dec->ps_bitstrm;
  638|  31.6k|    ctxt_inc_mb_info_t * ps_left_ctxt = ps_dec->p_left_ctxt_mb_info;
  639|  31.6k|    ctxt_inc_mb_info_t * ps_top_ctxt = ps_dec->p_top_ctxt_mb_info;
  640|  31.6k|    UWORD8 u1_transform_8x8flag;
  641|  31.6k|    UWORD8 u1_mb_ngbr_avail = ps_cur_mb_info->u1_mb_ngbr_availablity;
  642|       |
  643|  31.6k|    WORD8 a, b;
  644|  31.6k|    UWORD32 u4_cxt_inc;
  645|       |
  646|       |    /* for calculating the context increment for transform8x8 u4_flag */
  647|       |    /* it reads transform8x8 u4_flag of the neighbors through */
  648|       |
  649|       |    /* Binarization is FLC */
  650|  31.6k|    a = 0;
  651|  31.6k|    b = 0;
  652|       |
  653|  31.6k|    if(u1_mb_ngbr_avail & LEFT_MB_AVAILABLE_MASK)
  ------------------
  |  |   53|  31.6k|#define LEFT_MB_AVAILABLE_MASK      0x01
  ------------------
  |  Branch (653:8): [True: 19.9k, False: 11.7k]
  ------------------
  654|  19.9k|    {
  655|  19.9k|        a = ps_left_ctxt->u1_transform8x8_ctxt;
  656|  19.9k|    }
  657|  31.6k|    if(u1_mb_ngbr_avail & TOP_MB_AVAILABLE_MASK)
  ------------------
  |  |   55|  31.6k|#define TOP_MB_AVAILABLE_MASK       0x04
  ------------------
  |  Branch (657:8): [True: 29.7k, False: 1.96k]
  ------------------
  658|  29.7k|    {
  659|  29.7k|        b = ps_top_ctxt->u1_transform8x8_ctxt;
  660|       |
  661|  29.7k|    }
  662|       |
  663|  31.6k|    u4_cxt_inc = a + b;
  664|       |
  665|  31.6k|    u1_transform_8x8flag = ih264d_decode_bin(
  666|  31.6k|                    u4_cxt_inc, ps_dec->s_high_profile.ps_transform8x8_flag,
  667|  31.6k|                    ps_bitstrm, ps_cab_env);
  668|       |
  669|  31.6k|    return (u1_transform_8x8flag);
  670|  31.6k|}
ih264d_read_intra_pred_modes_cabac:
  695|  8.55k|{
  696|  8.55k|    WORD32 i4x4_luma_blk_idx = 0;
  697|  8.55k|    dec_bit_stream_t * ps_bitstrm = ps_dec->ps_bitstrm;
  698|  8.55k|    decoding_envirnoment_t * ps_cab_env = &ps_dec->s_cab_dec_env;
  699|  8.55k|    bin_ctxt_model_t *ps_ctxt_ipred_luma_mpm, *ps_ctx_ipred_luma_rm;
  700|  8.55k|    WORD32 i4_rem_intra4x4_pred_mode;
  701|  8.55k|    UWORD32 u4_prev_intra4x4_pred_mode_flag;
  702|  8.55k|    UWORD32 u4_code_int_range, u4_code_int_val_ofst;
  703|  8.55k|    const UWORD32 *pu4_table = (const UWORD32 *)ps_cab_env->cabac_table;
  704|       |
  705|  8.55k|    ps_ctxt_ipred_luma_mpm = ps_dec->p_prev_intra4x4_pred_mode_flag_t;
  706|  8.55k|    ps_ctx_ipred_luma_rm = ps_dec->p_rem_intra4x4_pred_mode_t;
  707|  8.55k|    SWITCHOFFTRACE;
  708|       |
  709|  8.55k|    i4x4_luma_blk_idx = (0 == u1_tran_form8x8) ? 16 : 4;
  ------------------
  |  Branch (709:25): [True: 3.84k, False: 4.71k]
  ------------------
  710|       |
  711|  8.55k|    u4_code_int_range = ps_cab_env->u4_code_int_range;
  712|  8.55k|    u4_code_int_val_ofst = ps_cab_env->u4_code_int_val_ofst;
  713|       |
  714|  8.55k|    do
  715|  80.3k|    {
  716|       |
  717|  80.3k|        DECODE_ONE_BIN_MACRO(ps_ctxt_ipred_luma_mpm, u4_code_int_range,
  ------------------
  |  |  217|  80.3k|                     p_DecBitStream_arg,u4_symbol)                                           \
  |  |  218|  80.3k|{                                                                                       \
  |  |  219|  80.3k|    bin_ctxt_model_t *p_binCtxt_m = (bin_ctxt_model_t *) p_binCtxt_arg;                           \
  |  |  220|  80.3k|    dec_bit_stream_t *p_DecBitStream_m = (dec_bit_stream_t *) p_DecBitStream_arg;                 \
  |  |  221|  80.3k|    const UWORD32 *pu4_table_m = (const UWORD32 *) pu4_table_arg;                         \
  |  |  222|  80.3k|                                                                                        \
  |  |  223|  80.3k|    UWORD32 u4_quantCodeIntRange_m,u4_codeIntRangeLPS_m;                                    \
  |  |  224|  80.3k|    UWORD32 u1_mps_state_m;                                                               \
  |  |  225|  80.3k|    UWORD32 table_lookup_m;                                                               \
  |  |  226|  80.3k|    UWORD32 u4_clz_m;                                                                     \
  |  |  227|  80.3k|                                                                                        \
  |  |  228|  80.3k|    u1_mps_state_m = (p_binCtxt_m->u1_mps_state);                                           \
  |  |  229|  80.3k|    u4_clz_m = CLZ(u4_code_int_range);                                                  \
  |  |  230|  80.3k|    u4_quantCodeIntRange_m = u4_code_int_range << u4_clz_m;                                   \
  |  |  231|  80.3k|    u4_quantCodeIntRange_m = (u4_quantCodeIntRange_m >> 29) & 0x3;                          \
  |  |  232|  80.3k|    table_lookup_m = pu4_table_m[(u1_mps_state_m << 2)+u4_quantCodeIntRange_m];                 \
  |  |  233|  80.3k|    u4_codeIntRangeLPS_m = table_lookup_m & 0xff;                                           \
  |  |  234|  80.3k|                                                                                        \
  |  |  235|  80.3k|    u4_codeIntRangeLPS_m = u4_codeIntRangeLPS_m << (23 - u4_clz_m);                           \
  |  |  236|  80.3k|    u4_code_int_range = u4_code_int_range - u4_codeIntRangeLPS_m;                             \
  |  |  237|  80.3k|    u4_symbol = ((u1_mps_state_m>> 6) & 0x1);                                             \
  |  |  238|  80.3k|    /*if mps*/                                                                          \
  |  |  239|  80.3k|    u1_mps_state_m = (table_lookup_m >> 8) & 0x7F;                                          \
  |  |  240|  80.3k|    if(u4_code_int_val_ofst >= u4_code_int_range)                                          \
  |  |  ------------------
  |  |  |  Branch (240:8): [True: 14.9k, False: 65.3k]
  |  |  ------------------
  |  |  241|  80.3k|  {                                                                                     \
  |  |  242|  14.9k|                                                                                        \
  |  |  243|  14.9k|    u4_symbol = 1 - u4_symbol;                                                          \
  |  |  244|  14.9k|    u4_code_int_val_ofst -= u4_code_int_range;                                             \
  |  |  245|  14.9k|    u4_code_int_range = u4_codeIntRangeLPS_m;                                               \
  |  |  246|  14.9k|    u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                         \
  |  |  247|  14.9k|  }                                                                                     \
  |  |  248|  80.3k|    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_8)                                        \
  |  |  ------------------
  |  |  |  |  113|   160k|#define ONE_RIGHT_SHIFTED_BY_8 1<<8
  |  |  ------------------
  |  |  |  Branch (248:8): [True: 1.16k, False: 79.1k]
  |  |  ------------------
  |  |  249|  80.3k|    {                                                                                   \
  |  |  250|  1.16k|        UWORD32 *pu4_buffer,u4_offset;                                                  \
  |  |  251|  1.16k|        UWORD32 read_bits,u4_clz_m  ;                                                     \
  |  |  252|  1.16k|                                                                                        \
  |  |  253|  1.16k|        pu4_buffer = p_DecBitStream_m->pu4_buffer;                                         \
  |  |  254|  1.16k|        u4_offset = p_DecBitStream_m->u4_ofst;                                          \
  |  |  255|  1.16k|        u4_clz_m = CLZ(u4_code_int_range);                                              \
  |  |  256|  1.16k|        NEXTBITS(read_bits,(u4_offset+23),pu4_buffer,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|  1.16k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|  1.16k|{                                                                           \
  |  |  |  |  139|  1.16k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|  1.16k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|  1.16k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|  1.16k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|  1.16k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 1.09k, False: 68]
  |  |  |  |  ------------------
  |  |  |  |  144|  1.16k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  1.09k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|  1.16k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  1.16k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|  1.16k|}
  |  |  ------------------
  |  |  257|  1.16k|        FLUSHBITS(u4_offset,(u4_clz_m))                                                   \
  |  |  ------------------
  |  |  |  |  193|  1.16k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|  1.16k|{                                                                           \
  |  |  |  |  195|  1.16k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|  1.16k|}
  |  |  ------------------
  |  |  258|  1.16k|        u4_code_int_range = u4_code_int_range << u4_clz_m;                                    \
  |  |  259|  1.16k|        u4_code_int_val_ofst= (u4_code_int_val_ofst << u4_clz_m) | read_bits;               \
  |  |  260|  1.16k|                                                                                        \
  |  |  261|  1.16k|                                                                                        \
  |  |  262|  1.16k|        p_DecBitStream_m->u4_ofst = u4_offset;                                          \
  |  |  263|  1.16k|    }                                                                                   \
  |  |  264|  80.3k|    p_binCtxt_m->u1_mps_state = u1_mps_state_m;                                             \
  |  |  265|  80.3k|}
  ------------------
  718|  80.3k|                             u4_code_int_val_ofst, pu4_table, ps_bitstrm,
  719|  80.3k|                             u4_prev_intra4x4_pred_mode_flag)
  720|  80.3k|        *pu1_prev_intra4x4_pred_mode_flag = u4_prev_intra4x4_pred_mode_flag;
  721|       |
  722|  80.3k|        i4_rem_intra4x4_pred_mode = -1;
  723|  80.3k|        if(!u4_prev_intra4x4_pred_mode_flag)
  ------------------
  |  Branch (723:12): [True: 49.7k, False: 30.5k]
  ------------------
  724|  49.7k|        {
  725|       |
  726|       |            /*inlining DecodeDecisionBins_FLC*/
  727|       |
  728|  49.7k|            {
  729|       |
  730|  49.7k|                UWORD8 u1_max_bins = 3;
  731|  49.7k|                UWORD32 u4_value;
  732|  49.7k|                UWORD32 u4_symbol, i;
  733|       |
  734|  49.7k|                i = 0;
  735|  49.7k|                u4_value = 0;
  736|       |
  737|  49.7k|                do
  738|   149k|                {
  739|       |
  740|   149k|                    DECODE_ONE_BIN_MACRO(ps_ctx_ipred_luma_rm, u4_code_int_range,
  ------------------
  |  |  217|   149k|                     p_DecBitStream_arg,u4_symbol)                                           \
  |  |  218|   149k|{                                                                                       \
  |  |  219|   149k|    bin_ctxt_model_t *p_binCtxt_m = (bin_ctxt_model_t *) p_binCtxt_arg;                           \
  |  |  220|   149k|    dec_bit_stream_t *p_DecBitStream_m = (dec_bit_stream_t *) p_DecBitStream_arg;                 \
  |  |  221|   149k|    const UWORD32 *pu4_table_m = (const UWORD32 *) pu4_table_arg;                         \
  |  |  222|   149k|                                                                                        \
  |  |  223|   149k|    UWORD32 u4_quantCodeIntRange_m,u4_codeIntRangeLPS_m;                                    \
  |  |  224|   149k|    UWORD32 u1_mps_state_m;                                                               \
  |  |  225|   149k|    UWORD32 table_lookup_m;                                                               \
  |  |  226|   149k|    UWORD32 u4_clz_m;                                                                     \
  |  |  227|   149k|                                                                                        \
  |  |  228|   149k|    u1_mps_state_m = (p_binCtxt_m->u1_mps_state);                                           \
  |  |  229|   149k|    u4_clz_m = CLZ(u4_code_int_range);                                                  \
  |  |  230|   149k|    u4_quantCodeIntRange_m = u4_code_int_range << u4_clz_m;                                   \
  |  |  231|   149k|    u4_quantCodeIntRange_m = (u4_quantCodeIntRange_m >> 29) & 0x3;                          \
  |  |  232|   149k|    table_lookup_m = pu4_table_m[(u1_mps_state_m << 2)+u4_quantCodeIntRange_m];                 \
  |  |  233|   149k|    u4_codeIntRangeLPS_m = table_lookup_m & 0xff;                                           \
  |  |  234|   149k|                                                                                        \
  |  |  235|   149k|    u4_codeIntRangeLPS_m = u4_codeIntRangeLPS_m << (23 - u4_clz_m);                           \
  |  |  236|   149k|    u4_code_int_range = u4_code_int_range - u4_codeIntRangeLPS_m;                             \
  |  |  237|   149k|    u4_symbol = ((u1_mps_state_m>> 6) & 0x1);                                             \
  |  |  238|   149k|    /*if mps*/                                                                          \
  |  |  239|   149k|    u1_mps_state_m = (table_lookup_m >> 8) & 0x7F;                                          \
  |  |  240|   149k|    if(u4_code_int_val_ofst >= u4_code_int_range)                                          \
  |  |  ------------------
  |  |  |  Branch (240:8): [True: 16.5k, False: 132k]
  |  |  ------------------
  |  |  241|   149k|  {                                                                                     \
  |  |  242|  16.5k|                                                                                        \
  |  |  243|  16.5k|    u4_symbol = 1 - u4_symbol;                                                          \
  |  |  244|  16.5k|    u4_code_int_val_ofst -= u4_code_int_range;                                             \
  |  |  245|  16.5k|    u4_code_int_range = u4_codeIntRangeLPS_m;                                               \
  |  |  246|  16.5k|    u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                         \
  |  |  247|  16.5k|  }                                                                                     \
  |  |  248|   149k|    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_8)                                        \
  |  |  ------------------
  |  |  |  |  113|   298k|#define ONE_RIGHT_SHIFTED_BY_8 1<<8
  |  |  ------------------
  |  |  |  Branch (248:8): [True: 2.66k, False: 146k]
  |  |  ------------------
  |  |  249|   149k|    {                                                                                   \
  |  |  250|  2.66k|        UWORD32 *pu4_buffer,u4_offset;                                                  \
  |  |  251|  2.66k|        UWORD32 read_bits,u4_clz_m  ;                                                     \
  |  |  252|  2.66k|                                                                                        \
  |  |  253|  2.66k|        pu4_buffer = p_DecBitStream_m->pu4_buffer;                                         \
  |  |  254|  2.66k|        u4_offset = p_DecBitStream_m->u4_ofst;                                          \
  |  |  255|  2.66k|        u4_clz_m = CLZ(u4_code_int_range);                                              \
  |  |  256|  2.66k|        NEXTBITS(read_bits,(u4_offset+23),pu4_buffer,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|  2.66k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|  2.66k|{                                                                           \
  |  |  |  |  139|  2.66k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|  2.66k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|  2.66k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|  2.66k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|  2.66k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 2.59k, False: 74]
  |  |  |  |  ------------------
  |  |  |  |  144|  2.66k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  2.59k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|  2.66k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  2.66k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|  2.66k|}
  |  |  ------------------
  |  |  257|  2.66k|        FLUSHBITS(u4_offset,(u4_clz_m))                                                   \
  |  |  ------------------
  |  |  |  |  193|  2.66k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|  2.66k|{                                                                           \
  |  |  |  |  195|  2.66k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|  2.66k|}
  |  |  ------------------
  |  |  258|  2.66k|        u4_code_int_range = u4_code_int_range << u4_clz_m;                                    \
  |  |  259|  2.66k|        u4_code_int_val_ofst= (u4_code_int_val_ofst << u4_clz_m) | read_bits;               \
  |  |  260|  2.66k|                                                                                        \
  |  |  261|  2.66k|                                                                                        \
  |  |  262|  2.66k|        p_DecBitStream_m->u4_ofst = u4_offset;                                          \
  |  |  263|  2.66k|    }                                                                                   \
  |  |  264|   149k|    p_binCtxt_m->u1_mps_state = u1_mps_state_m;                                             \
  |  |  265|   149k|}
  ------------------
  741|   149k|                                         u4_code_int_val_ofst, pu4_table,
  742|   149k|                                         ps_bitstrm, u4_symbol)
  743|       |
  744|   149k|                    INC_BIN_COUNT(ps_cab_env);INC_DECISION_BINS(ps_cab_env);
  745|       |
  746|   149k|                    u4_value = u4_value | (u4_symbol << i);
  747|       |
  748|   149k|                    i++;
  749|   149k|                }
  750|   149k|                while(i < u1_max_bins);
  ------------------
  |  Branch (750:23): [True: 99.5k, False: 49.7k]
  ------------------
  751|       |
  752|  49.7k|                i4_rem_intra4x4_pred_mode = (u4_value);
  753|       |
  754|  49.7k|            }
  755|       |
  756|  49.7k|        }
  757|       |
  758|  80.3k|        (*pu1_rem_intra4x4_pred_mode) = i4_rem_intra4x4_pred_mode;
  759|       |
  760|  80.3k|        COPYTHECONTEXT("intra4x4_pred_mode", i4_rem_intra4x4_pred_mode);
  761|       |
  762|  80.3k|        pu1_prev_intra4x4_pred_mode_flag++;
  763|  80.3k|        pu1_rem_intra4x4_pred_mode++;
  764|       |
  765|  80.3k|        i4x4_luma_blk_idx--;
  766|  80.3k|    }
  767|  80.3k|    while(i4x4_luma_blk_idx);
  ------------------
  |  Branch (767:11): [True: 71.7k, False: 8.55k]
  ------------------
  768|       |
  769|  8.55k|    ps_cab_env->u4_code_int_range = u4_code_int_range;
  770|  8.55k|    ps_cab_env->u4_code_int_val_ofst = u4_code_int_val_ofst;
  771|       |
  772|  8.55k|    return (0);
  773|       |
  774|  8.55k|}
ih264d_parse_ctx_cbp_cabac:
  790|  65.8k|{
  791|       |
  792|  65.8k|    UWORD32 u4_cxt_inc;
  793|  65.8k|    decoding_envirnoment_t * ps_cab_env = &ps_dec->s_cab_dec_env;
  794|  65.8k|    dec_bit_stream_t * ps_bitstrm = ps_dec->ps_bitstrm;
  795|  65.8k|    ctxt_inc_mb_info_t * ps_left_ctxt = ps_dec->p_left_ctxt_mb_info;
  796|  65.8k|    ctxt_inc_mb_info_t * ps_top_ctxt = ps_dec->p_top_ctxt_mb_info;
  797|  65.8k|    bin_ctxt_model_t *ps_ctxt_cbp_luma = ps_dec->p_cbp_luma_t, *ps_bin_ctxt;
  798|  65.8k|    WORD8 c_Cbp; //,i,j;
  799|  65.8k|    UWORD32 u4_code_int_range, u4_code_int_val_ofst;
  800|  65.8k|    UWORD32 u4_offset, *pu4_buffer;
  801|  65.8k|    const UWORD32 *pu4_table = (const UWORD32 *)ps_cab_env->cabac_table;
  802|       |
  803|  65.8k|    INC_SYM_COUNT(ps_cab_env);
  804|       |
  805|       |
  806|       |
  807|       |    /* CBP Luma, FL, Cmax = 15, L = 4 */
  808|  65.8k|    u4_cxt_inc = (!((ps_top_ctxt->u1_cbp >> 2) & 0x01)) << 1;
  809|  65.8k|    u4_cxt_inc += !((ps_left_ctxt->u1_cbp >> 1) & 0x01);
  810|       |
  811|  65.8k|    u4_offset = ps_bitstrm->u4_ofst;
  812|  65.8k|    pu4_buffer = ps_bitstrm->pu4_buffer;
  813|       |
  814|  65.8k|    u4_code_int_range = ps_cab_env->u4_code_int_range;
  815|  65.8k|    u4_code_int_val_ofst = ps_cab_env->u4_code_int_val_ofst;
  816|       |    /*renormalize to ensure there 23 bits more in the u4_code_int_val_ofst*/
  817|  65.8k|    {
  818|  65.8k|        UWORD32 u4_clz, read_bits;
  819|       |
  820|  65.8k|        u4_clz = CLZ(u4_code_int_range);
  821|  65.8k|        FLUSHBITS(u4_offset, u4_clz)
  ------------------
  |  |  193|  65.8k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  194|  65.8k|{                                                                           \
  |  |  195|  65.8k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  196|  65.8k|}
  ------------------
  822|  65.8k|        NEXTBITS(read_bits, u4_offset, pu4_buffer, 23)
  ------------------
  |  |  137|  65.8k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  138|  65.8k|{                                                                           \
  |  |  139|  65.8k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  140|  65.8k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  141|  65.8k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  142|  65.8k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  143|  65.8k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (143:8): [True: 64.0k, False: 1.79k]
  |  |  ------------------
  |  |  144|  65.8k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  64.0k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  145|  65.8k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  65.8k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  146|  65.8k|}
  ------------------
  823|  65.8k|        u4_code_int_range = u4_code_int_range << u4_clz;
  824|  65.8k|        u4_code_int_val_ofst = (u4_code_int_val_ofst << u4_clz) | read_bits;
  825|  65.8k|    }
  826|       |
  827|  65.8k|    ps_bin_ctxt = ps_ctxt_cbp_luma + u4_cxt_inc;
  828|       |
  829|       |    /*inlining DecodeDecision_onebin without renorm*/
  830|  65.8k|    {
  831|       |
  832|  65.8k|        UWORD32 u4_qnt_int_range, u4_int_range_lps;
  833|  65.8k|        UWORD32 u4_symbol, u1_mps_state;
  834|  65.8k|        UWORD32 table_lookup;
  835|  65.8k|        UWORD32 u4_clz;
  836|       |
  837|  65.8k|        u1_mps_state = (ps_bin_ctxt->u1_mps_state);
  838|       |
  839|  65.8k|        u4_clz = CLZ(u4_code_int_range);
  840|  65.8k|        u4_qnt_int_range = u4_code_int_range << u4_clz;
  841|  65.8k|        u4_qnt_int_range = (u4_qnt_int_range >> 29) & 0x3;
  842|       |
  843|  65.8k|        table_lookup = pu4_table[(u1_mps_state << 2) + u4_qnt_int_range];
  844|  65.8k|        u4_int_range_lps = table_lookup & 0xff;
  845|       |
  846|  65.8k|        u4_int_range_lps = u4_int_range_lps << (23 - u4_clz);
  847|  65.8k|        u4_code_int_range = u4_code_int_range - u4_int_range_lps;
  848|       |
  849|  65.8k|        u4_symbol = ((u1_mps_state >> 6) & 0x1);
  850|       |
  851|       |        /*if mps*/
  852|  65.8k|        u1_mps_state = (table_lookup >> 8) & 0x7F;
  853|       |
  854|  65.8k|        CHECK_IF_LPS(u4_code_int_range, u4_code_int_val_ofst, u4_symbol,
  ------------------
  |  |  184|  65.8k|                    u4_codeIntRangeLPS_m,u1_mps_state_m,table_lookup_m)                     \
  |  |  185|  65.8k|{                                                                                         \
  |  |  186|  65.8k|  if(u4_codeIntValOffset_m >= u4_codeIntRange_m)                                            \
  |  |  ------------------
  |  |  |  Branch (186:6): [True: 7.27k, False: 58.5k]
  |  |  ------------------
  |  |  187|  65.8k|  {                                                                                         \
  |  |  188|  7.27k|      u4_symbol_m = 1 - u4_symbol_m;                                                        \
  |  |  189|  7.27k|      u4_codeIntValOffset_m -= u4_codeIntRange_m;                                           \
  |  |  190|  7.27k|      u4_codeIntRange_m = u4_codeIntRangeLPS_m;                                             \
  |  |  191|  7.27k|      u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                       \
  |  |  192|  7.27k|  }                                                                                         \
  |  |  193|  65.8k|}
  ------------------
  855|  65.8k|                     u4_int_range_lps, u1_mps_state, table_lookup)
  856|       |
  857|  65.8k|        INC_BIN_COUNT(ps_cab_env);
  858|       |
  859|  65.8k|        ps_bin_ctxt->u1_mps_state = u1_mps_state;
  860|       |
  861|  65.8k|        c_Cbp = u4_symbol;
  862|       |
  863|  65.8k|    }
  864|       |
  865|  65.8k|    u4_cxt_inc = (!((ps_top_ctxt->u1_cbp >> 3) & 0x01)) << 1;
  866|  65.8k|    u4_cxt_inc += !(c_Cbp & 0x01);
  867|  65.8k|    ps_bin_ctxt = ps_ctxt_cbp_luma + u4_cxt_inc;
  868|       |    /*inlining DecodeDecision_onebin without renorm*/
  869|       |
  870|  65.8k|    {
  871|       |
  872|  65.8k|        UWORD32 u4_qnt_int_range, u4_int_range_lps;
  873|  65.8k|        UWORD32 u4_symbol, u1_mps_state;
  874|  65.8k|        UWORD32 table_lookup;
  875|  65.8k|        UWORD32 u4_clz;
  876|       |
  877|  65.8k|        u1_mps_state = (ps_bin_ctxt->u1_mps_state);
  878|       |
  879|  65.8k|        u4_clz = CLZ(u4_code_int_range);
  880|  65.8k|        u4_qnt_int_range = u4_code_int_range << u4_clz;
  881|  65.8k|        u4_qnt_int_range = (u4_qnt_int_range >> 29) & 0x3;
  882|       |
  883|  65.8k|        table_lookup = pu4_table[(u1_mps_state << 2) + u4_qnt_int_range];
  884|  65.8k|        u4_int_range_lps = table_lookup & 0xff;
  885|       |
  886|  65.8k|        u4_int_range_lps = u4_int_range_lps << (23 - u4_clz);
  887|  65.8k|        u4_code_int_range = u4_code_int_range - u4_int_range_lps;
  888|       |
  889|  65.8k|        u4_symbol = ((u1_mps_state >> 6) & 0x1);
  890|       |
  891|       |        /*if mps*/
  892|  65.8k|        u1_mps_state = (table_lookup >> 8) & 0x7F;
  893|       |
  894|  65.8k|        CHECK_IF_LPS(u4_code_int_range, u4_code_int_val_ofst, u4_symbol,
  ------------------
  |  |  184|  65.8k|                    u4_codeIntRangeLPS_m,u1_mps_state_m,table_lookup_m)                     \
  |  |  185|  65.8k|{                                                                                         \
  |  |  186|  65.8k|  if(u4_codeIntValOffset_m >= u4_codeIntRange_m)                                            \
  |  |  ------------------
  |  |  |  Branch (186:6): [True: 7.14k, False: 58.6k]
  |  |  ------------------
  |  |  187|  65.8k|  {                                                                                         \
  |  |  188|  7.14k|      u4_symbol_m = 1 - u4_symbol_m;                                                        \
  |  |  189|  7.14k|      u4_codeIntValOffset_m -= u4_codeIntRange_m;                                           \
  |  |  190|  7.14k|      u4_codeIntRange_m = u4_codeIntRangeLPS_m;                                             \
  |  |  191|  7.14k|      u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                       \
  |  |  192|  7.14k|  }                                                                                         \
  |  |  193|  65.8k|}
  ------------------
  895|  65.8k|                     u4_int_range_lps, u1_mps_state, table_lookup)
  896|       |
  897|  65.8k|        INC_BIN_COUNT(ps_cab_env);
  898|       |
  899|  65.8k|        ps_bin_ctxt->u1_mps_state = u1_mps_state;
  900|       |
  901|  65.8k|        c_Cbp |= u4_symbol << 1;
  902|       |
  903|  65.8k|    }
  904|       |
  905|  65.8k|    u4_cxt_inc = (!(c_Cbp & 0x01)) << 1;
  906|  65.8k|    u4_cxt_inc += !((ps_left_ctxt->u1_cbp >> 3) & 0x01);
  907|  65.8k|    ps_bin_ctxt = ps_ctxt_cbp_luma + u4_cxt_inc;
  908|       |    /*inlining DecodeDecision_onebin without renorm*/
  909|       |
  910|  65.8k|    {
  911|       |
  912|  65.8k|        UWORD32 u4_qnt_int_range, u4_int_range_lps;
  913|  65.8k|        UWORD32 u4_symbol, u1_mps_state;
  914|  65.8k|        UWORD32 table_lookup;
  915|  65.8k|        UWORD32 u4_clz;
  916|       |
  917|  65.8k|        u1_mps_state = (ps_bin_ctxt->u1_mps_state);
  918|       |
  919|  65.8k|        u4_clz = CLZ(u4_code_int_range);
  920|  65.8k|        u4_qnt_int_range = u4_code_int_range << u4_clz;
  921|  65.8k|        u4_qnt_int_range = (u4_qnt_int_range >> 29) & 0x3;
  922|       |
  923|  65.8k|        table_lookup = pu4_table[(u1_mps_state << 2) + u4_qnt_int_range];
  924|  65.8k|        u4_int_range_lps = table_lookup & 0xff;
  925|       |
  926|  65.8k|        u4_int_range_lps = u4_int_range_lps << (23 - u4_clz);
  927|  65.8k|        u4_code_int_range = u4_code_int_range - u4_int_range_lps;
  928|       |
  929|  65.8k|        u4_symbol = ((u1_mps_state >> 6) & 0x1);
  930|       |
  931|       |        /*if mps*/
  932|  65.8k|        u1_mps_state = (table_lookup >> 8) & 0x7F;
  933|       |
  934|  65.8k|        CHECK_IF_LPS(u4_code_int_range, u4_code_int_val_ofst, u4_symbol,
  ------------------
  |  |  184|  65.8k|                    u4_codeIntRangeLPS_m,u1_mps_state_m,table_lookup_m)                     \
  |  |  185|  65.8k|{                                                                                         \
  |  |  186|  65.8k|  if(u4_codeIntValOffset_m >= u4_codeIntRange_m)                                            \
  |  |  ------------------
  |  |  |  Branch (186:6): [True: 8.10k, False: 57.7k]
  |  |  ------------------
  |  |  187|  65.8k|  {                                                                                         \
  |  |  188|  8.10k|      u4_symbol_m = 1 - u4_symbol_m;                                                        \
  |  |  189|  8.10k|      u4_codeIntValOffset_m -= u4_codeIntRange_m;                                           \
  |  |  190|  8.10k|      u4_codeIntRange_m = u4_codeIntRangeLPS_m;                                             \
  |  |  191|  8.10k|      u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                       \
  |  |  192|  8.10k|  }                                                                                         \
  |  |  193|  65.8k|}
  ------------------
  935|  65.8k|                     u4_int_range_lps, u1_mps_state, table_lookup)
  936|       |
  937|  65.8k|        INC_BIN_COUNT(ps_cab_env);
  938|       |
  939|  65.8k|        ps_bin_ctxt->u1_mps_state = u1_mps_state;
  940|       |
  941|  65.8k|        c_Cbp |= u4_symbol << 2;
  942|       |
  943|  65.8k|    }
  944|       |
  945|  65.8k|    u4_cxt_inc = (!((c_Cbp >> 1) & 0x01)) << 1;
  946|  65.8k|    u4_cxt_inc += !((c_Cbp >> 2) & 0x01);
  947|  65.8k|    ps_bin_ctxt = ps_ctxt_cbp_luma + u4_cxt_inc;
  948|       |    /*inlining DecodeDecision_onebin without renorm*/
  949|       |
  950|  65.8k|    {
  951|       |
  952|  65.8k|        UWORD32 u4_qnt_int_range, u4_int_range_lps;
  953|  65.8k|        UWORD32 u4_symbol, u1_mps_state;
  954|  65.8k|        UWORD32 table_lookup;
  955|  65.8k|        UWORD32 u4_clz;
  956|       |
  957|  65.8k|        u1_mps_state = (ps_bin_ctxt->u1_mps_state);
  958|       |
  959|  65.8k|        u4_clz = CLZ(u4_code_int_range);
  960|  65.8k|        u4_qnt_int_range = u4_code_int_range << u4_clz;
  961|  65.8k|        u4_qnt_int_range = (u4_qnt_int_range >> 29) & 0x3;
  962|       |
  963|  65.8k|        table_lookup = pu4_table[(u1_mps_state << 2) + u4_qnt_int_range];
  964|  65.8k|        u4_int_range_lps = table_lookup & 0xff;
  965|       |
  966|  65.8k|        u4_int_range_lps = u4_int_range_lps << (23 - u4_clz);
  967|  65.8k|        u4_code_int_range = u4_code_int_range - u4_int_range_lps;
  968|       |
  969|  65.8k|        u4_symbol = ((u1_mps_state >> 6) & 0x1);
  970|       |
  971|       |        /*if mps*/
  972|  65.8k|        u1_mps_state = (table_lookup >> 8) & 0x7F;
  973|       |
  974|  65.8k|        CHECK_IF_LPS(u4_code_int_range, u4_code_int_val_ofst, u4_symbol,
  ------------------
  |  |  184|  65.8k|                    u4_codeIntRangeLPS_m,u1_mps_state_m,table_lookup_m)                     \
  |  |  185|  65.8k|{                                                                                         \
  |  |  186|  65.8k|  if(u4_codeIntValOffset_m >= u4_codeIntRange_m)                                            \
  |  |  ------------------
  |  |  |  Branch (186:6): [True: 7.35k, False: 58.4k]
  |  |  ------------------
  |  |  187|  65.8k|  {                                                                                         \
  |  |  188|  7.35k|      u4_symbol_m = 1 - u4_symbol_m;                                                        \
  |  |  189|  7.35k|      u4_codeIntValOffset_m -= u4_codeIntRange_m;                                           \
  |  |  190|  7.35k|      u4_codeIntRange_m = u4_codeIntRangeLPS_m;                                             \
  |  |  191|  7.35k|      u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                       \
  |  |  192|  7.35k|  }                                                                                         \
  |  |  193|  65.8k|}
  ------------------
  975|  65.8k|                     u4_int_range_lps, u1_mps_state, table_lookup)
  976|       |
  977|  65.8k|        INC_BIN_COUNT(ps_cab_env);
  978|       |
  979|  65.8k|        ps_bin_ctxt->u1_mps_state = u1_mps_state;
  980|       |
  981|  65.8k|        c_Cbp |= u4_symbol << 3;
  982|       |
  983|  65.8k|    }
  984|       |
  985|  65.8k|    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_8)
  ------------------
  |  |  113|  65.8k|#define ONE_RIGHT_SHIFTED_BY_8 1<<8
  ------------------
  |  Branch (985:8): [True: 0, False: 65.8k]
  ------------------
  986|      0|    {
  987|       |
  988|      0|        RENORM_RANGE_OFFSET(u4_code_int_range, u4_code_int_val_ofst, u4_offset,
  ------------------
  |  |  170|      0|  {                                                                                         \
  |  |  171|      0|    UWORD32 read_bits_m,u4_clz_m  ;                                                         \
  |  |  172|      0|    u4_clz_m = CLZ(u4_codeIntRange_m);                                                  \
  |  |  173|      0|    NEXTBITS(read_bits_m,(u4_offset_m+23),pu4_buffer_m,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|      0|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|      0|{                                                                           \
  |  |  |  |  139|      0|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|      0|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|      0|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|      0|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|      0|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  144|      0|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|      0|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|      0|}
  |  |  ------------------
  |  |  174|      0|    FLUSHBITS(u4_offset_m,(u4_clz_m))                                                       \
  |  |  ------------------
  |  |  |  |  193|      0|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|      0|{                                                                           \
  |  |  |  |  195|      0|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|      0|}
  |  |  ------------------
  |  |  175|      0|    u4_codeIntRange_m = u4_codeIntRange_m << u4_clz_m;                                      \
  |  |  176|      0|    u4_codeIntValOffset_m = (u4_codeIntValOffset_m << u4_clz_m) | read_bits_m;              \
  |  |  177|      0|  }
  ------------------
  989|      0|                            pu4_buffer)
  990|       |
  991|      0|    }
  992|       |
  993|  65.8k|    {
  994|  65.8k|        UWORD32 u4_cxt_inc;
  995|  65.8k|        WORD8 a, b, c, d;
  996|  65.8k|        bin_ctxt_model_t *p_CtxtCbpChroma = ps_dec->p_cbp_chroma_t;
  997|       |
  998|       |        /* CBP Chroma, TU, Cmax = 2 */
  999|  65.8k|        a = 0;
 1000|  65.8k|        b = 0;
 1001|  65.8k|        c = 0;
 1002|  65.8k|        d = 0;
 1003|       |
 1004|  65.8k|        {
 1005|  65.8k|            a = (ps_top_ctxt->u1_cbp > 15) ? 2 : 0;
  ------------------
  |  Branch (1005:17): [True: 19.0k, False: 46.7k]
  ------------------
 1006|  65.8k|            c = (ps_top_ctxt->u1_cbp > 31) ? 2 : 0;
  ------------------
  |  Branch (1006:17): [True: 11.2k, False: 54.6k]
  ------------------
 1007|  65.8k|        }
 1008|       |
 1009|  65.8k|        {
 1010|  65.8k|            b = (ps_left_ctxt->u1_cbp > 15) ? 1 : 0;
  ------------------
  |  Branch (1010:17): [True: 13.5k, False: 52.2k]
  ------------------
 1011|  65.8k|            d = (ps_left_ctxt->u1_cbp > 31) ? 1 : 0;
  ------------------
  |  Branch (1011:17): [True: 7.89k, False: 57.9k]
  ------------------
 1012|  65.8k|        }
 1013|  65.8k|        u4_cxt_inc = a + b;
 1014|  65.8k|        u4_cxt_inc = (u4_cxt_inc | ((4 + c + d) << 4));
 1015|       |
 1016|       |        /*inlining ih264d_decode_bins_tunary */
 1017|       |
 1018|  65.8k|        {
 1019|       |
 1020|  65.8k|            UWORD8 u1_max_bins = 2;
 1021|  65.8k|            UWORD32 u4_ctx_inc = u4_cxt_inc;
 1022|       |
 1023|  65.8k|            UWORD32 u4_value;
 1024|  65.8k|            UWORD32 u4_symbol;
 1025|  65.8k|            UWORD8 u4_ctx_Inc;
 1026|  65.8k|            bin_ctxt_model_t *ps_bin_ctxt;
 1027|  65.8k|            u4_value = 0;
 1028|       |
 1029|  65.8k|            do
 1030|  88.3k|            {
 1031|  88.3k|                u4_ctx_Inc = u4_ctx_inc & 0xF;
 1032|  88.3k|                u4_ctx_inc = u4_ctx_inc >> 4;
 1033|       |
 1034|  88.3k|                ps_bin_ctxt = p_CtxtCbpChroma + u4_ctx_Inc;
 1035|       |                /*inlining DecodeDecision_onebin*/
 1036|  88.3k|                {
 1037|       |
 1038|  88.3k|                    UWORD32 u4_qnt_int_range, u4_int_range_lps;
 1039|       |
 1040|  88.3k|                    UWORD32 u1_mps_state;
 1041|  88.3k|                    UWORD32 table_lookup;
 1042|  88.3k|                    UWORD32 u4_clz;
 1043|       |
 1044|  88.3k|                    u1_mps_state = (ps_bin_ctxt->u1_mps_state);
 1045|       |
 1046|  88.3k|                    u4_clz = CLZ(u4_code_int_range);
 1047|  88.3k|                    u4_qnt_int_range = u4_code_int_range << u4_clz;
 1048|  88.3k|                    u4_qnt_int_range = (u4_qnt_int_range >> 29) & 0x3;
 1049|       |
 1050|  88.3k|                    table_lookup = pu4_table[(u1_mps_state << 2)
 1051|  88.3k|                                    + u4_qnt_int_range];
 1052|  88.3k|                    u4_int_range_lps = table_lookup & 0xff;
 1053|       |
 1054|  88.3k|                    u4_int_range_lps = u4_int_range_lps << (23 - u4_clz);
 1055|  88.3k|                    u4_code_int_range = u4_code_int_range - u4_int_range_lps;
 1056|       |
 1057|  88.3k|                    u4_symbol = ((u1_mps_state >> 6) & 0x1);
 1058|       |
 1059|       |                    /*if mps*/
 1060|  88.3k|                    u1_mps_state = (table_lookup >> 8) & 0x7F;
 1061|       |
 1062|  88.3k|                    CHECK_IF_LPS(u4_code_int_range, u4_code_int_val_ofst,
  ------------------
  |  |  184|  88.3k|                    u4_codeIntRangeLPS_m,u1_mps_state_m,table_lookup_m)                     \
  |  |  185|  88.3k|{                                                                                         \
  |  |  186|  88.3k|  if(u4_codeIntValOffset_m >= u4_codeIntRange_m)                                            \
  |  |  ------------------
  |  |  |  Branch (186:6): [True: 11.9k, False: 76.4k]
  |  |  ------------------
  |  |  187|  88.3k|  {                                                                                         \
  |  |  188|  11.9k|      u4_symbol_m = 1 - u4_symbol_m;                                                        \
  |  |  189|  11.9k|      u4_codeIntValOffset_m -= u4_codeIntRange_m;                                           \
  |  |  190|  11.9k|      u4_codeIntRange_m = u4_codeIntRangeLPS_m;                                             \
  |  |  191|  11.9k|      u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                       \
  |  |  192|  11.9k|  }                                                                                         \
  |  |  193|  88.3k|}
  ------------------
 1063|  88.3k|                                 u4_symbol, u4_int_range_lps, u1_mps_state,
 1064|  88.3k|                                 table_lookup)
 1065|       |
 1066|  88.3k|                    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_8)
  ------------------
  |  |  113|  88.3k|#define ONE_RIGHT_SHIFTED_BY_8 1<<8
  ------------------
  |  Branch (1066:24): [True: 0, False: 88.3k]
  ------------------
 1067|      0|                    {
 1068|      0|                        RENORM_RANGE_OFFSET(u4_code_int_range,
  ------------------
  |  |  170|      0|  {                                                                                         \
  |  |  171|      0|    UWORD32 read_bits_m,u4_clz_m  ;                                                         \
  |  |  172|      0|    u4_clz_m = CLZ(u4_codeIntRange_m);                                                  \
  |  |  173|      0|    NEXTBITS(read_bits_m,(u4_offset_m+23),pu4_buffer_m,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|      0|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|      0|{                                                                           \
  |  |  |  |  139|      0|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|      0|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|      0|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|      0|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|      0|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  144|      0|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|      0|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|      0|}
  |  |  ------------------
  |  |  174|      0|    FLUSHBITS(u4_offset_m,(u4_clz_m))                                                       \
  |  |  ------------------
  |  |  |  |  193|      0|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|      0|{                                                                           \
  |  |  |  |  195|      0|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|      0|}
  |  |  ------------------
  |  |  175|      0|    u4_codeIntRange_m = u4_codeIntRange_m << u4_clz_m;                                      \
  |  |  176|      0|    u4_codeIntValOffset_m = (u4_codeIntValOffset_m << u4_clz_m) | read_bits_m;              \
  |  |  177|      0|  }
  ------------------
 1069|      0|                                            u4_code_int_val_ofst, u4_offset,
 1070|      0|                                            pu4_buffer)
 1071|      0|                    }
 1072|  88.3k|                    ps_bin_ctxt->u1_mps_state = u1_mps_state;
 1073|  88.3k|                }
 1074|       |
 1075|  88.3k|                INC_BIN_COUNT(ps_cab_env);INC_DECISION_BINS(
 1076|  88.3k|                                ps_cab_env);
 1077|       |
 1078|  88.3k|                u4_value++;
 1079|  88.3k|            }
 1080|  88.3k|            while((u4_value < u1_max_bins) & (u4_symbol));
  ------------------
  |  Branch (1080:19): [True: 22.5k, False: 65.8k]
  ------------------
 1081|       |
 1082|  65.8k|            u4_value = u4_value - 1 + u4_symbol;
 1083|       |
 1084|  65.8k|            a = (u4_value);
 1085|       |
 1086|  65.8k|        }
 1087|       |
 1088|  65.8k|c_Cbp = (c_Cbp | (a << 4));
 1089|  65.8k|}
 1090|       |
 1091|  65.8k|ps_bitstrm->u4_ofst = u4_offset;
 1092|       |
 1093|  65.8k|ps_cab_env->u4_code_int_range = u4_code_int_range;
 1094|  65.8k|ps_cab_env->u4_code_int_val_ofst = u4_code_int_val_ofst;
 1095|       |
 1096|  65.8k|return (c_Cbp);
 1097|  65.8k|}
ih264d_get_mvd_cabac:
 1119|   217k|{
 1120|   217k|    UWORD8 u1_abs_mvd_x = 0, u1_abs_mvd_y = 0;
 1121|   217k|    UWORD8 u1_sub_mb_x, u1_sub_mb_y;
 1122|   217k|    UWORD8 *pu1_top_mv_ctxt, *pu1_lft_mv_ctxt;
 1123|   217k|    WORD16 *pi2_mv;
 1124|       |
 1125|   217k|    u1_sub_mb_x = (UWORD8)(u1_sub_mb & 0x03);
 1126|   217k|    u1_sub_mb_y = (UWORD8)(u1_sub_mb >> 2);
 1127|   217k|    pu1_top_mv_ctxt = &ps_dec->ps_curr_ctxt_mb_info->u1_mv[u1_sub_mb_x][u1_b2];
 1128|   217k|    pu1_lft_mv_ctxt = &ps_dec->pu1_left_mv_ctxt_inc[u1_sub_mb_y][u1_b2];
 1129|   217k|    pi2_mv = &ps_mv->i2_mv[u1_b2];
 1130|       |
 1131|   217k|    if(u1_dec_mvd)
  ------------------
  |  Branch (1131:8): [True: 141k, False: 75.9k]
  ------------------
 1132|   141k|    {
 1133|   141k|        WORD16 i2_mv_x, i2_mv_y;
 1134|   141k|        WORD32 i2_temp;
 1135|   141k|        {
 1136|   141k|            decoding_envirnoment_t * ps_cab_env = &ps_dec->s_cab_dec_env;
 1137|   141k|            dec_bit_stream_t * ps_bitstrm = ps_dec->ps_bitstrm;
 1138|   141k|            UWORD16 u2_abs_mvd_x_a, u2_abs_mvd_x_b, u2_abs_mvd_y_a,
 1139|   141k|                            u2_abs_mvd_y_b;
 1140|       |
 1141|   141k|            u2_abs_mvd_x_b = (UWORD16)pu1_top_mv_ctxt[0];
 1142|   141k|            u2_abs_mvd_y_b = (UWORD16)pu1_top_mv_ctxt[1];
 1143|   141k|            u2_abs_mvd_x_a = (UWORD16)pu1_lft_mv_ctxt[0];
 1144|   141k|            u2_abs_mvd_y_a = (UWORD16)pu1_lft_mv_ctxt[1];
 1145|       |
 1146|   141k|            i2_temp = u2_abs_mvd_x_a + u2_abs_mvd_x_b;
 1147|       |
 1148|   141k|            i2_mv_x = ih264d_parse_mvd_cabac(ps_bitstrm, ps_cab_env,
 1149|   141k|                                             ps_dec->p_mvd_x_t, i2_temp);
 1150|       |
 1151|   141k|            i2_temp = u2_abs_mvd_y_a + u2_abs_mvd_y_b;
 1152|       |
 1153|   141k|            i2_mv_y = ih264d_parse_mvd_cabac(ps_bitstrm, ps_cab_env,
 1154|   141k|                                             ps_dec->p_mvd_y_t, i2_temp);
 1155|   141k|        }
 1156|       |
 1157|       |        /***********************************************************************/
 1158|       |        /* Store the abs_mvd_values in cabac contexts                          */
 1159|       |        /* The follownig code can be easily optimzed if mvX, mvY clip values   */
 1160|       |        /* are packed in 16 bits follwed by memcpy                             */
 1161|       |        /***********************************************************************/
 1162|   141k|        u1_abs_mvd_x = CLIP3(0, 127, ABS(i2_mv_x));
  ------------------
  |  |   77|   282k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 0, False: 141k]
  |  |  |  Branch (77:33): [True: 28.1k, False: 113k]
  |  |  |  Branch (77:54): [True: 1.13k, False: 140k]
  |  |  |  Branch (77:56): [True: 28.1k, False: 113k]
  |  |  |  Branch (77:77): [True: 27.4k, False: 112k]
  |  |  ------------------
  ------------------
 1163|   141k|        u1_abs_mvd_y = CLIP3(0, 127, ABS(i2_mv_y));
  ------------------
  |  |   77|   282k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 0, False: 141k]
  |  |  |  Branch (77:33): [True: 22.4k, False: 118k]
  |  |  |  Branch (77:54): [True: 560, False: 140k]
  |  |  |  Branch (77:56): [True: 22.4k, False: 118k]
  |  |  |  Branch (77:77): [True: 22.1k, False: 118k]
  |  |  ------------------
  ------------------
 1164|       |
 1165|   141k|        COPYTHECONTEXT("MVD", i2_mv_x);COPYTHECONTEXT("MVD", i2_mv_y);
 1166|       |
 1167|       |        /* Storing Mv residuals */
 1168|   141k|        pi2_mv[0] = i2_mv_x;
 1169|   141k|        pi2_mv[1] = i2_mv_y;
 1170|   141k|    }
 1171|       |
 1172|       |    /***************************************************************/
 1173|       |    /* Store abs_mvd_values cabac contexts                         */
 1174|       |    /***************************************************************/
 1175|   217k|    {
 1176|   217k|        UWORD8 u1_i;
 1177|   710k|        for(u1_i = 0; u1_i < u1_part_wd; u1_i++, pu1_top_mv_ctxt += 4)
  ------------------
  |  Branch (1177:23): [True: 493k, False: 217k]
  ------------------
 1178|   493k|        {
 1179|   493k|            pu1_top_mv_ctxt[0] = u1_abs_mvd_x;
 1180|   493k|            pu1_top_mv_ctxt[1] = u1_abs_mvd_y;
 1181|   493k|        }
 1182|       |
 1183|   720k|        for(u1_i = 0; u1_i < u1_part_ht; u1_i++, pu1_lft_mv_ctxt += 4)
  ------------------
  |  Branch (1183:23): [True: 502k, False: 217k]
  ------------------
 1184|   502k|        {
 1185|   502k|            pu1_lft_mv_ctxt[0] = u1_abs_mvd_x;
 1186|   502k|            pu1_lft_mv_ctxt[1] = u1_abs_mvd_y;
 1187|   502k|        }
 1188|   217k|    }
 1189|   217k|}
ih264d_parse_mvd_cabac:
 1222|   282k|{
 1223|   282k|    WORD8 k;
 1224|   282k|    WORD16 i2_suf;
 1225|   282k|    WORD16 i2_mvd;
 1226|   282k|    UWORD16 u2_abs_mvd;
 1227|   282k|    UWORD32 u4_ctx_inc;
 1228|   282k|    UWORD32 u4_prefix;
 1229|   282k|    const UWORD32 *pu4_table = (const UWORD32 *)ps_cab_env->cabac_table;
 1230|   282k|    UWORD32 u4_code_int_range, u4_code_int_val_ofst;
 1231|       |
 1232|       |    /*  if mvd < 9                                                  */
 1233|       |    /*  mvd =  Prefix                                                   */
 1234|       |    /*  else                                                            */
 1235|       |    /*  mvd = Prefix + Suffix                                           */
 1236|       |    /*  decode sign bit                                                 */
 1237|       |    /*  Prefix TU decoding Cmax =Ucoff and Suffix 3rd order Exp-Golomb  */
 1238|       |
 1239|   282k|    u2_abs_mvd = (UWORD16)i4_temp;
 1240|   282k|    u4_ctx_inc = 1;
 1241|       |
 1242|   282k|    if(u2_abs_mvd < 3)
  ------------------
  |  Branch (1242:8): [True: 118k, False: 164k]
  ------------------
 1243|   118k|        u4_ctx_inc = 0;
 1244|   164k|    else if(u2_abs_mvd > 32)
  ------------------
  |  Branch (1244:13): [True: 11.9k, False: 152k]
  ------------------
 1245|  11.9k|        u4_ctx_inc = 2;
 1246|       |
 1247|   282k|    u4_ctx_inc = (u4_ctx_inc | 0x65430);
 1248|       |
 1249|       |    /*inlining modified version of ih264d_decode_bins_unary*/
 1250|       |
 1251|   282k|    {
 1252|   282k|        UWORD8 u1_max_bins = 9;
 1253|   282k|        UWORD32 u4_value;
 1254|   282k|        UWORD32 u4_symbol;
 1255|   282k|        bin_ctxt_model_t *ps_bin_ctxt;
 1256|   282k|        UWORD32 u4_ctx_Inc;
 1257|       |
 1258|   282k|        u4_value = 0;
 1259|   282k|        u4_code_int_range = ps_cab_env->u4_code_int_range;
 1260|   282k|        u4_code_int_val_ofst = ps_cab_env->u4_code_int_val_ofst;
 1261|       |
 1262|   282k|        do
 1263|   974k|        {
 1264|   974k|            u4_ctx_Inc = u4_ctx_inc & 0xf;
 1265|   974k|            u4_ctx_inc = u4_ctx_inc >> 4;
 1266|       |
 1267|   974k|            ps_bin_ctxt = p_ctxt_mvd + u4_ctx_Inc;
 1268|       |
 1269|   974k|            DECODE_ONE_BIN_MACRO(ps_bin_ctxt, u4_code_int_range,
  ------------------
  |  |  217|   974k|                     p_DecBitStream_arg,u4_symbol)                                           \
  |  |  218|   974k|{                                                                                       \
  |  |  219|   974k|    bin_ctxt_model_t *p_binCtxt_m = (bin_ctxt_model_t *) p_binCtxt_arg;                           \
  |  |  220|   974k|    dec_bit_stream_t *p_DecBitStream_m = (dec_bit_stream_t *) p_DecBitStream_arg;                 \
  |  |  221|   974k|    const UWORD32 *pu4_table_m = (const UWORD32 *) pu4_table_arg;                         \
  |  |  222|   974k|                                                                                        \
  |  |  223|   974k|    UWORD32 u4_quantCodeIntRange_m,u4_codeIntRangeLPS_m;                                    \
  |  |  224|   974k|    UWORD32 u1_mps_state_m;                                                               \
  |  |  225|   974k|    UWORD32 table_lookup_m;                                                               \
  |  |  226|   974k|    UWORD32 u4_clz_m;                                                                     \
  |  |  227|   974k|                                                                                        \
  |  |  228|   974k|    u1_mps_state_m = (p_binCtxt_m->u1_mps_state);                                           \
  |  |  229|   974k|    u4_clz_m = CLZ(u4_code_int_range);                                                  \
  |  |  230|   974k|    u4_quantCodeIntRange_m = u4_code_int_range << u4_clz_m;                                   \
  |  |  231|   974k|    u4_quantCodeIntRange_m = (u4_quantCodeIntRange_m >> 29) & 0x3;                          \
  |  |  232|   974k|    table_lookup_m = pu4_table_m[(u1_mps_state_m << 2)+u4_quantCodeIntRange_m];                 \
  |  |  233|   974k|    u4_codeIntRangeLPS_m = table_lookup_m & 0xff;                                           \
  |  |  234|   974k|                                                                                        \
  |  |  235|   974k|    u4_codeIntRangeLPS_m = u4_codeIntRangeLPS_m << (23 - u4_clz_m);                           \
  |  |  236|   974k|    u4_code_int_range = u4_code_int_range - u4_codeIntRangeLPS_m;                             \
  |  |  237|   974k|    u4_symbol = ((u1_mps_state_m>> 6) & 0x1);                                             \
  |  |  238|   974k|    /*if mps*/                                                                          \
  |  |  239|   974k|    u1_mps_state_m = (table_lookup_m >> 8) & 0x7F;                                          \
  |  |  240|   974k|    if(u4_code_int_val_ofst >= u4_code_int_range)                                          \
  |  |  ------------------
  |  |  |  Branch (240:8): [True: 102k, False: 872k]
  |  |  ------------------
  |  |  241|   974k|  {                                                                                     \
  |  |  242|   102k|                                                                                        \
  |  |  243|   102k|    u4_symbol = 1 - u4_symbol;                                                          \
  |  |  244|   102k|    u4_code_int_val_ofst -= u4_code_int_range;                                             \
  |  |  245|   102k|    u4_code_int_range = u4_codeIntRangeLPS_m;                                               \
  |  |  246|   102k|    u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                         \
  |  |  247|   102k|  }                                                                                     \
  |  |  248|   974k|    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_8)                                        \
  |  |  ------------------
  |  |  |  |  113|  1.94M|#define ONE_RIGHT_SHIFTED_BY_8 1<<8
  |  |  ------------------
  |  |  |  Branch (248:8): [True: 12.5k, False: 962k]
  |  |  ------------------
  |  |  249|   974k|    {                                                                                   \
  |  |  250|  12.5k|        UWORD32 *pu4_buffer,u4_offset;                                                  \
  |  |  251|  12.5k|        UWORD32 read_bits,u4_clz_m  ;                                                     \
  |  |  252|  12.5k|                                                                                        \
  |  |  253|  12.5k|        pu4_buffer = p_DecBitStream_m->pu4_buffer;                                         \
  |  |  254|  12.5k|        u4_offset = p_DecBitStream_m->u4_ofst;                                          \
  |  |  255|  12.5k|        u4_clz_m = CLZ(u4_code_int_range);                                              \
  |  |  256|  12.5k|        NEXTBITS(read_bits,(u4_offset+23),pu4_buffer,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|  12.5k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|  12.5k|{                                                                           \
  |  |  |  |  139|  12.5k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|  12.5k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|  12.5k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|  12.5k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|  12.5k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 12.0k, False: 458]
  |  |  |  |  ------------------
  |  |  |  |  144|  12.5k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  12.0k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|  12.5k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  12.5k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|  12.5k|}
  |  |  ------------------
  |  |  257|  12.5k|        FLUSHBITS(u4_offset,(u4_clz_m))                                                   \
  |  |  ------------------
  |  |  |  |  193|  12.5k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|  12.5k|{                                                                           \
  |  |  |  |  195|  12.5k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|  12.5k|}
  |  |  ------------------
  |  |  258|  12.5k|        u4_code_int_range = u4_code_int_range << u4_clz_m;                                    \
  |  |  259|  12.5k|        u4_code_int_val_ofst= (u4_code_int_val_ofst << u4_clz_m) | read_bits;               \
  |  |  260|  12.5k|                                                                                        \
  |  |  261|  12.5k|                                                                                        \
  |  |  262|  12.5k|        p_DecBitStream_m->u4_ofst = u4_offset;                                          \
  |  |  263|  12.5k|    }                                                                                   \
  |  |  264|   974k|    p_binCtxt_m->u1_mps_state = u1_mps_state_m;                                             \
  |  |  265|   974k|}
  ------------------
 1270|   974k|                                 u4_code_int_val_ofst, pu4_table, ps_bitstrm,
 1271|   974k|                                 u4_symbol)
 1272|       |
 1273|   974k|            INC_BIN_COUNT(ps_cab_env);INC_DECISION_BINS(ps_cab_env);
 1274|       |
 1275|   974k|            u4_value++;
 1276|       |
 1277|   974k|        }
 1278|   974k|        while(u4_symbol && u4_value < 5);
  ------------------
  |  Branch (1278:15): [True: 820k, False: 154k]
  |  Branch (1278:28): [True: 692k, False: 128k]
  ------------------
 1279|       |
 1280|   282k|        ps_bin_ctxt = p_ctxt_mvd + 6;
 1281|       |
 1282|   282k|        if(u4_symbol && (u4_value < u1_max_bins))
  ------------------
  |  Branch (1282:12): [True: 128k, False: 154k]
  |  Branch (1282:25): [True: 128k, False: 0]
  ------------------
 1283|   128k|        {
 1284|       |
 1285|   128k|            do
 1286|   496k|            {
 1287|       |
 1288|   496k|                DECODE_ONE_BIN_MACRO(ps_bin_ctxt, u4_code_int_range,
  ------------------
  |  |  217|   496k|                     p_DecBitStream_arg,u4_symbol)                                           \
  |  |  218|   496k|{                                                                                       \
  |  |  219|   496k|    bin_ctxt_model_t *p_binCtxt_m = (bin_ctxt_model_t *) p_binCtxt_arg;                           \
  |  |  220|   496k|    dec_bit_stream_t *p_DecBitStream_m = (dec_bit_stream_t *) p_DecBitStream_arg;                 \
  |  |  221|   496k|    const UWORD32 *pu4_table_m = (const UWORD32 *) pu4_table_arg;                         \
  |  |  222|   496k|                                                                                        \
  |  |  223|   496k|    UWORD32 u4_quantCodeIntRange_m,u4_codeIntRangeLPS_m;                                    \
  |  |  224|   496k|    UWORD32 u1_mps_state_m;                                                               \
  |  |  225|   496k|    UWORD32 table_lookup_m;                                                               \
  |  |  226|   496k|    UWORD32 u4_clz_m;                                                                     \
  |  |  227|   496k|                                                                                        \
  |  |  228|   496k|    u1_mps_state_m = (p_binCtxt_m->u1_mps_state);                                           \
  |  |  229|   496k|    u4_clz_m = CLZ(u4_code_int_range);                                                  \
  |  |  230|   496k|    u4_quantCodeIntRange_m = u4_code_int_range << u4_clz_m;                                   \
  |  |  231|   496k|    u4_quantCodeIntRange_m = (u4_quantCodeIntRange_m >> 29) & 0x3;                          \
  |  |  232|   496k|    table_lookup_m = pu4_table_m[(u1_mps_state_m << 2)+u4_quantCodeIntRange_m];                 \
  |  |  233|   496k|    u4_codeIntRangeLPS_m = table_lookup_m & 0xff;                                           \
  |  |  234|   496k|                                                                                        \
  |  |  235|   496k|    u4_codeIntRangeLPS_m = u4_codeIntRangeLPS_m << (23 - u4_clz_m);                           \
  |  |  236|   496k|    u4_code_int_range = u4_code_int_range - u4_codeIntRangeLPS_m;                             \
  |  |  237|   496k|    u4_symbol = ((u1_mps_state_m>> 6) & 0x1);                                             \
  |  |  238|   496k|    /*if mps*/                                                                          \
  |  |  239|   496k|    u1_mps_state_m = (table_lookup_m >> 8) & 0x7F;                                          \
  |  |  240|   496k|    if(u4_code_int_val_ofst >= u4_code_int_range)                                          \
  |  |  ------------------
  |  |  |  Branch (240:8): [True: 9.57k, False: 487k]
  |  |  ------------------
  |  |  241|   496k|  {                                                                                     \
  |  |  242|  9.57k|                                                                                        \
  |  |  243|  9.57k|    u4_symbol = 1 - u4_symbol;                                                          \
  |  |  244|  9.57k|    u4_code_int_val_ofst -= u4_code_int_range;                                             \
  |  |  245|  9.57k|    u4_code_int_range = u4_codeIntRangeLPS_m;                                               \
  |  |  246|  9.57k|    u1_mps_state_m = (table_lookup_m >> 15) & 0x7F;                                         \
  |  |  247|  9.57k|  }                                                                                     \
  |  |  248|   496k|    if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_8)                                        \
  |  |  ------------------
  |  |  |  |  113|   993k|#define ONE_RIGHT_SHIFTED_BY_8 1<<8
  |  |  ------------------
  |  |  |  Branch (248:8): [True: 2.24k, False: 494k]
  |  |  ------------------
  |  |  249|   496k|    {                                                                                   \
  |  |  250|  2.24k|        UWORD32 *pu4_buffer,u4_offset;                                                  \
  |  |  251|  2.24k|        UWORD32 read_bits,u4_clz_m  ;                                                     \
  |  |  252|  2.24k|                                                                                        \
  |  |  253|  2.24k|        pu4_buffer = p_DecBitStream_m->pu4_buffer;                                         \
  |  |  254|  2.24k|        u4_offset = p_DecBitStream_m->u4_ofst;                                          \
  |  |  255|  2.24k|        u4_clz_m = CLZ(u4_code_int_range);                                              \
  |  |  256|  2.24k|        NEXTBITS(read_bits,(u4_offset+23),pu4_buffer,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|  2.24k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|  2.24k|{                                                                           \
  |  |  |  |  139|  2.24k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|  2.24k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|  2.24k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|  2.24k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|  2.24k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 2.21k, False: 32]
  |  |  |  |  ------------------
  |  |  |  |  144|  2.24k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  2.21k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|  2.24k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  2.24k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|  2.24k|}
  |  |  ------------------
  |  |  257|  2.24k|        FLUSHBITS(u4_offset,(u4_clz_m))                                                   \
  |  |  ------------------
  |  |  |  |  193|  2.24k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|  2.24k|{                                                                           \
  |  |  |  |  195|  2.24k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|  2.24k|}
  |  |  ------------------
  |  |  258|  2.24k|        u4_code_int_range = u4_code_int_range << u4_clz_m;                                    \
  |  |  259|  2.24k|        u4_code_int_val_ofst= (u4_code_int_val_ofst << u4_clz_m) | read_bits;               \
  |  |  260|  2.24k|                                                                                        \
  |  |  261|  2.24k|                                                                                        \
  |  |  262|  2.24k|        p_DecBitStream_m->u4_ofst = u4_offset;                                          \
  |  |  263|  2.24k|    }                                                                                   \
  |  |  264|   496k|    p_binCtxt_m->u1_mps_state = u1_mps_state_m;                                             \
  |  |  265|   496k|}
  ------------------
 1289|   496k|                                     u4_code_int_val_ofst, pu4_table,
 1290|   496k|                                     ps_bitstrm, u4_symbol)
 1291|       |
 1292|   496k|                INC_BIN_COUNT(ps_cab_env);INC_DECISION_BINS(ps_cab_env);
 1293|   496k|                u4_value++;
 1294|   496k|            }
 1295|   496k|            while(u4_symbol && (u4_value < u1_max_bins));
  ------------------
  |  Branch (1295:19): [True: 487k, False: 9.60k]
  |  Branch (1295:32): [True: 368k, False: 118k]
  ------------------
 1296|       |
 1297|   128k|        }
 1298|       |
 1299|   282k|        ps_cab_env->u4_code_int_range = u4_code_int_range;
 1300|   282k|        ps_cab_env->u4_code_int_val_ofst = u4_code_int_val_ofst;
 1301|   282k|        u4_value = u4_value - 1 + u4_symbol;
 1302|   282k|        u4_prefix = (u4_value);
 1303|   282k|    }
 1304|       |
 1305|   282k|    i2_mvd = u4_prefix;
 1306|       |
 1307|   282k|    if(i2_mvd == 9)
  ------------------
  |  Branch (1307:8): [True: 118k, False: 163k]
  ------------------
 1308|   118k|    {
 1309|       |        /* Read Suffix */
 1310|   118k|        k = ih264d_decode_bypass_bins_unary(ps_cab_env, ps_bitstrm);
 1311|   118k|        i2_suf = (k > 15) ? INT16_MAX : ((1 << k) - 1);
  ------------------
  |  Branch (1311:18): [True: 2, False: 118k]
  ------------------
 1312|   118k|        k = k + 3;
 1313|   118k|        i2_suf = (i2_suf << 3);
 1314|   118k|        i2_mvd += i2_suf;
 1315|   118k|        i2_suf = ih264d_decode_bypass_bins(ps_cab_env, k, ps_bitstrm);
 1316|   118k|        i2_mvd += i2_suf;
 1317|   118k|    }
 1318|       |    /* Read Sign bit */
 1319|   282k|    if(!i2_mvd)
  ------------------
  |  Branch (1319:8): [True: 66.7k, False: 215k]
  ------------------
 1320|  66.7k|        return (i2_mvd);
 1321|       |
 1322|   215k|    else
 1323|   215k|    {
 1324|   215k|        UWORD32 u4_code_int_val_ofst, u4_code_int_range;
 1325|       |
 1326|   215k|        u4_code_int_val_ofst = ps_cab_env->u4_code_int_val_ofst;
 1327|   215k|        u4_code_int_range = ps_cab_env->u4_code_int_range;
 1328|       |
 1329|   215k|        if(u4_code_int_range < ONE_RIGHT_SHIFTED_BY_9)
  ------------------
  |  |  114|   215k|#define ONE_RIGHT_SHIFTED_BY_9    1<<9
  ------------------
  |  Branch (1329:12): [True: 2.87k, False: 212k]
  ------------------
 1330|  2.87k|        {
 1331|  2.87k|            UWORD32 *pu4_buffer, u4_offset;
 1332|       |
 1333|  2.87k|            pu4_buffer = ps_bitstrm->pu4_buffer;
 1334|  2.87k|            u4_offset = ps_bitstrm->u4_ofst;
 1335|       |
 1336|  2.87k|            RENORM_RANGE_OFFSET(u4_code_int_range, u4_code_int_val_ofst,
  ------------------
  |  |  170|  2.87k|  {                                                                                         \
  |  |  171|  2.87k|    UWORD32 read_bits_m,u4_clz_m  ;                                                         \
  |  |  172|  2.87k|    u4_clz_m = CLZ(u4_codeIntRange_m);                                                  \
  |  |  173|  2.87k|    NEXTBITS(read_bits_m,(u4_offset_m+23),pu4_buffer_m,u4_clz_m)                            \
  |  |  ------------------
  |  |  |  |  137|  2.87k|#define     NEXTBITS(u4_word, u4_offset, pu4_bitstream, u4_no_bits)         \
  |  |  |  |  138|  2.87k|{                                                                           \
  |  |  |  |  139|  2.87k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  |  |  140|  2.87k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  |  |  141|  2.87k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  |  |  142|  2.87k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  |  |  143|  2.87k|    if(u4_bit_off)                                                          \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (143:8): [True: 2.78k, False: 90]
  |  |  |  |  ------------------
  |  |  |  |  144|  2.87k|        u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  2.78k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  145|  2.87k|    u4_word = u4_word >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  2.87k|#define INT_IN_BITS         32
  |  |  |  |  ------------------
  |  |  |  |  146|  2.87k|}
  |  |  ------------------
  |  |  174|  2.87k|    FLUSHBITS(u4_offset_m,(u4_clz_m))                                                       \
  |  |  ------------------
  |  |  |  |  193|  2.87k|#define   FLUSHBITS(u4_offset, u4_no_bits)                                  \
  |  |  |  |  194|  2.87k|{                                                                           \
  |  |  |  |  195|  2.87k|        (u4_offset) += (u4_no_bits);                                        \
  |  |  |  |  196|  2.87k|}
  |  |  ------------------
  |  |  175|  2.87k|    u4_codeIntRange_m = u4_codeIntRange_m << u4_clz_m;                                      \
  |  |  176|  2.87k|    u4_codeIntValOffset_m = (u4_codeIntValOffset_m << u4_clz_m) | read_bits_m;              \
  |  |  177|  2.87k|  }
  ------------------
 1337|  2.87k|                                u4_offset, pu4_buffer)
 1338|  2.87k|            ps_bitstrm->u4_ofst = u4_offset;
 1339|  2.87k|        }
 1340|       |
 1341|   215k|        u4_code_int_range = u4_code_int_range >> 1;
 1342|       |
 1343|   215k|        if(u4_code_int_val_ofst >= u4_code_int_range)
  ------------------
  |  Branch (1343:12): [True: 50.5k, False: 165k]
  ------------------
 1344|  50.5k|        {
 1345|       |            /* S=1 */
 1346|  50.5k|            u4_code_int_val_ofst -= u4_code_int_range;
 1347|  50.5k|            i2_mvd = (-i2_mvd);
 1348|  50.5k|        }
 1349|       |
 1350|   215k|        ps_cab_env->u4_code_int_val_ofst = u4_code_int_val_ofst;
 1351|   215k|        ps_cab_env->u4_code_int_range = u4_code_int_range;
 1352|       |
 1353|   215k|        return (i2_mvd);
 1354|       |
 1355|   215k|    }
 1356|   282k|}

ih264d_parse_pmb_cavlc:
   87|  3.29k|{
   88|  3.29k|    UWORD32 u1_num_mb_part;
   89|  3.29k|    UWORD32 uc_sub_mb;
   90|  3.29k|    dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm;
   91|  3.29k|    UWORD32 * const pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
   92|  3.29k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
   93|       |
   94|  3.29k|    parse_pmbarams_t * ps_parse_mb_data = ps_dec->ps_parse_mb_data
   95|  3.29k|                    + u4_num_mbsNby2;
   96|  3.29k|    WORD8 * pi1_ref_idx = ps_parse_mb_data->i1_ref_idx[0];
   97|  3.29k|    const UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
   98|  3.29k|    const UWORD8 * pu1_num_mb_part = (const UWORD8 *)gau1_ih264d_num_mb_part;
   99|  3.29k|    UWORD8 * pu1_col_info = ps_parse_mb_data->u1_col_info;
  100|       |
  101|  3.29k|    UWORD32 u1_mb_type = ps_cur_mb_info->u1_mb_type;
  102|  3.29k|    UWORD32 u4_sum_mb_mode_pack = 0;
  103|  3.29k|    WORD32 ret;
  104|       |
  105|  3.29k|    UWORD8 u1_no_submb_part_size_lt8x8_flag = 1;
  106|  3.29k|    ps_cur_mb_info->u1_tran_form8x8 = 0;
  107|  3.29k|    ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
  108|       |
  109|  3.29k|    ps_cur_mb_info->u1_yuv_dc_block_flag = 0;
  110|       |
  111|  3.29k|    ps_cur_mb_info->u1_mb_mc_mode = u1_mb_type;
  112|  3.29k|    uc_sub_mb = ((u1_mb_type == PRED_8x8) | (u1_mb_type == PRED_8x8R0));
  ------------------
  |  |  453|  3.29k|#define PRED_8x8    3
  ------------------
                  uc_sub_mb = ((u1_mb_type == PRED_8x8) | (u1_mb_type == PRED_8x8R0));
  ------------------
  |  |  454|  3.29k|#define PRED_8x8R0  4
  ------------------
  113|       |
  114|       |    /* Reading the subMB type */
  115|  3.29k|    if(uc_sub_mb)
  ------------------
  |  Branch (115:8): [True: 40, False: 3.25k]
  ------------------
  116|     40|    {
  117|     40|        WORD32 i;
  118|     40|        UWORD8 u1_colz = (PRED_8x8 << 6);
  ------------------
  |  |  453|     40|#define PRED_8x8    3
  ------------------
  119|       |
  120|    192|        for(i = 0; i < 4; i++)
  ------------------
  |  Branch (120:20): [True: 154, False: 38]
  ------------------
  121|    154|        {
  122|    154|            UWORD32 ui_sub_mb_mode;
  123|       |
  124|       |            //Inlined ih264d_uev
  125|    154|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  126|    154|            UWORD32 u4_word, u4_ldz;
  127|       |
  128|       |            /***************************************************************/
  129|       |            /* Find leading zeros in next 32 bits                          */
  130|       |            /***************************************************************/
  131|    154|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|    154|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|    154|{                                                                           \
  |  |  152|    154|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|    154|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|    154|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|    154|                                                                            \
  |  |  156|    154|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|    154|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 154, False: 0]
  |  |  ------------------
  |  |  158|    154|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|    154|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|    154|}
  ------------------
  132|    154|            u4_ldz = CLZ(u4_word);
  133|       |            /* Flush the ps_bitstrm */
  134|    154|            u4_bitstream_offset += (u4_ldz + 1);
  135|       |            /* Read the suffix from the ps_bitstrm */
  136|    154|            u4_word = 0;
  137|    154|            if(u4_ldz)
  ------------------
  |  Branch (137:16): [True: 124, False: 30]
  ------------------
  138|    124|                GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|    124|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    124|{                                                                           \
  |  |  122|    124|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    124|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    124|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    124|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    124|                                                                            \
  |  |  127|    124|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 124, False: 0]
  |  |  ------------------
  |  |  128|    124|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    124|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    124|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    124|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    124|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    124|}                                                                           \
  ------------------
  139|    154|                        u4_ldz);
  140|    154|            *pu4_bitstrm_ofst = u4_bitstream_offset;
  141|    154|            ui_sub_mb_mode = ((1 << u4_ldz) + u4_word - 1);
  142|       |            //Inlined ih264d_uev
  143|       |
  144|    154|            if(ui_sub_mb_mode > 3)
  ------------------
  |  Branch (144:16): [True: 2, False: 152]
  ------------------
  145|      2|            {
  146|      2|                return ERROR_SUB_MB_TYPE;
  147|      2|            }
  148|    152|            else
  149|    152|            {
  150|    152|                u4_sum_mb_mode_pack = (u4_sum_mb_mode_pack << 8) | ui_sub_mb_mode;
  151|       |                /* Storing collocated information */
  152|    152|                *pu1_col_info++ = u1_colz | (UWORD8)(ui_sub_mb_mode << 4);
  153|       |
  154|    152|                COPYTHECONTEXT("sub_mb_type", ui_sub_mb_mode);
  155|    152|            }
  156|       |
  157|       |            /* check if Motion compensation is done below 8x8 */
  158|    152|            if(ui_sub_mb_mode != P_L0_8x8)
  ------------------
  |  |  459|    152|#define P_L0_8x8    0
  ------------------
  |  Branch (158:16): [True: 122, False: 30]
  ------------------
  159|    122|            {
  160|    122|                u1_no_submb_part_size_lt8x8_flag = 0;
  161|    122|            }
  162|    152|        }
  163|       |
  164|       |        //
  165|     38|        u1_num_mb_part = 4;
  166|     38|    }
  167|  3.25k|    else
  168|  3.25k|    {
  169|  3.25k|        *pu1_col_info++ = (u1_mb_type << 6);
  170|  3.25k|        if(u1_mb_type)
  ------------------
  |  Branch (170:12): [True: 1.93k, False: 1.31k]
  ------------------
  171|  1.93k|            *pu1_col_info++ = (u1_mb_type << 6);
  172|  3.25k|        u1_num_mb_part = pu1_num_mb_part[u1_mb_type];
  173|       |
  174|  3.25k|    }
  175|       |
  176|       |    /* Decoding reference index 0: For simple profile the following   */
  177|       |    /* conditions are always true (mb_field_decoding_flag == 0);      */
  178|       |    /* (MbPartPredMode != PredL1)                                     */
  179|       |
  180|  3.28k|    {
  181|       |
  182|  3.28k|        UWORD8 uc_field = ps_cur_mb_info->u1_mb_field_decodingflag;
  183|  3.28k|        UWORD8 uc_num_ref_idx_l0_active_minus1 =
  184|  3.28k|                        (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0]
  185|  3.28k|                                        << (u1_mbaff & uc_field)) - 1;
  186|       |
  187|  3.28k|        if((uc_num_ref_idx_l0_active_minus1 > 0) & (u1_mb_type != PRED_8x8R0))
  ------------------
  |  |  454|  3.28k|#define PRED_8x8R0  4
  ------------------
  |  Branch (187:12): [True: 2.05k, False: 1.23k]
  ------------------
  188|  2.05k|        {
  189|  2.05k|            if(1 == uc_num_ref_idx_l0_active_minus1)
  ------------------
  |  Branch (189:16): [True: 1.96k, False: 88]
  ------------------
  190|  1.96k|                ih264d_parse_pmb_ref_index_cavlc_range1(
  191|  1.96k|                                u1_num_mb_part, ps_bitstrm, pi1_ref_idx,
  192|  1.96k|                                uc_num_ref_idx_l0_active_minus1);
  193|     88|            else
  194|     88|            {
  195|     88|                ret = ih264d_parse_pmb_ref_index_cavlc(
  196|     88|                                u1_num_mb_part, ps_bitstrm, pi1_ref_idx,
  197|     88|                                uc_num_ref_idx_l0_active_minus1);
  198|     88|                if(ret != OK)
  ------------------
  |  |  114|     88|#define OK        0
  ------------------
  |  Branch (198:20): [True: 2, False: 86]
  ------------------
  199|      2|                    return ret;
  200|     88|            }
  201|  2.05k|        }
  202|  1.23k|        else
  203|  1.23k|        {
  204|       |            /* When there exists only a single frame to predict from */
  205|  1.23k|            UWORD32 uc_i;
  206|  2.59k|            for(uc_i = 0; uc_i < u1_num_mb_part; uc_i++)
  ------------------
  |  Branch (206:27): [True: 1.35k, False: 1.23k]
  ------------------
  207|       |                /* Storing Reference Idx Information */
  208|  1.35k|                pi1_ref_idx[uc_i] = 0;
  209|  1.23k|        }
  210|  3.28k|    }
  211|       |
  212|  3.28k|    {
  213|  3.28k|        UWORD8 u1_p_idx;
  214|  3.28k|        UWORD32 uc_i;
  215|  3.28k|        parse_part_params_t * ps_part = ps_dec->ps_part;
  216|  3.28k|        UWORD8 u1_sub_mb_mode, u1_num_subpart, u1_mb_part_width, u1_mb_part_height;
  217|  3.28k|        UWORD32 u4_sub_mb_num;
  218|  3.28k|        const UWORD8 * pu1_top_left_sub_mb_indx;
  219|  3.28k|        mv_pred_t * ps_mv, *ps_mv_start = ps_dec->ps_mv_cur + (u4_mb_num << 4);
  220|       |        /* Loading the table pointers */
  221|  3.28k|        const UWORD8 * pu1_mb_partw = (const UWORD8 *)gau1_ih264d_mb_partw;
  222|  3.28k|        const UWORD8 * pu1_mb_parth = (const UWORD8 *)gau1_ih264d_mb_parth;
  223|  3.28k|        const UWORD8 * pu1_sub_mb_indx_mod =
  224|  3.28k|                        (const UWORD8 *)(gau1_ih264d_submb_indx_mod)
  225|  3.28k|                                        + (uc_sub_mb * 6);
  226|  3.28k|        const UWORD8 * pu1_sub_mb_partw = (const UWORD8 *)gau1_ih264d_submb_partw;
  227|  3.28k|        const UWORD8 * pu1_sub_mb_parth = (const UWORD8 *)gau1_ih264d_submb_parth;
  228|  3.28k|        const UWORD8 * pu1_num_sub_mb_part =
  229|  3.28k|                        (const UWORD8 *)gau1_ih264d_num_submb_part;
  230|       |
  231|  3.28k|        UWORD16 u2_sub_mb_num = 0x028A;
  232|       |
  233|       |        /*********************************************************/
  234|       |        /* default initialisations for condition (uc_sub_mb == 0) */
  235|       |        /* i.e. all are subpartitions of 8x8                     */
  236|       |        /*********************************************************/
  237|  3.28k|        u1_sub_mb_mode = 0;
  238|  3.28k|        u1_num_subpart = 1;
  239|  3.28k|        u1_mb_part_width = pu1_mb_partw[u1_mb_type];
  240|  3.28k|        u1_mb_part_height = pu1_mb_parth[u1_mb_type];
  241|  3.28k|        pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_mb_type << 1);
  242|  3.28k|        u4_sub_mb_num = 0;
  243|       |
  244|       |        /* Loop on number of partitions */
  245|  8.62k|        for(uc_i = 0, u1_p_idx = 0; uc_i < u1_num_mb_part; uc_i++)
  ------------------
  |  Branch (245:37): [True: 5.33k, False: 3.28k]
  ------------------
  246|  5.33k|        {
  247|  5.33k|            UWORD8 uc_j;
  248|  5.33k|            if(uc_sub_mb)
  ------------------
  |  Branch (248:16): [True: 152, False: 5.18k]
  ------------------
  249|    152|            {
  250|    152|                u1_sub_mb_mode = u4_sum_mb_mode_pack >> 24;
  251|    152|                u1_num_subpart = pu1_num_sub_mb_part[u1_sub_mb_mode];
  252|    152|                u1_mb_part_width = pu1_sub_mb_partw[u1_sub_mb_mode];
  253|    152|                u1_mb_part_height = pu1_sub_mb_parth[u1_sub_mb_mode];
  254|    152|                pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_sub_mb_mode << 1);
  255|    152|                u4_sub_mb_num = u2_sub_mb_num >> 12;
  256|    152|                u4_sum_mb_mode_pack <<= 8;
  257|    152|                u2_sub_mb_num <<= 4;
  258|    152|            }
  259|       |
  260|       |            /* Loop on Number of sub-partitions */
  261|  10.8k|            for(uc_j = 0; uc_j < u1_num_subpart; uc_j++, pu1_top_left_sub_mb_indx++)
  ------------------
  |  Branch (261:27): [True: 5.49k, False: 5.33k]
  ------------------
  262|  5.49k|            {
  263|  5.49k|                WORD16 i2_mvx, i2_mvy;
  264|  5.49k|                u4_sub_mb_num += *pu1_top_left_sub_mb_indx;
  265|  5.49k|                ps_mv = ps_mv_start + u4_sub_mb_num;
  266|       |
  267|       |                /* Reading the differential Mv from the bitstream */
  268|       |                //i2_mvx = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  269|       |                //inlining ih264d_sev
  270|  5.49k|                {
  271|  5.49k|                    UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  272|  5.49k|                    UWORD32 u4_word, u4_ldz, u4_abs_val;
  273|       |
  274|       |                    /***************************************************************/
  275|       |                    /* Find leading zeros in next 32 bits                          */
  276|       |                    /***************************************************************/
  277|  5.49k|                    NEXTBITS_32(u4_word, u4_bitstream_offset,
  ------------------
  |  |  150|  5.49k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|  5.49k|{                                                                           \
  |  |  152|  5.49k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|  5.49k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|  5.49k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|  5.49k|                                                                            \
  |  |  156|  5.49k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|  5.49k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 5.45k, False: 37]
  |  |  ------------------
  |  |  158|  5.49k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|  5.45k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|  5.49k|}
  ------------------
  278|  5.49k|                                pu4_bitstrm_buf);
  279|  5.49k|                    u4_ldz = CLZ(u4_word);
  280|       |
  281|       |                    /* Flush the ps_bitstrm */
  282|  5.49k|                    u4_bitstream_offset += (u4_ldz + 1);
  283|       |
  284|       |                    /* Read the suffix from the ps_bitstrm */
  285|  5.49k|                    u4_word = 0;
  286|  5.49k|                    if(u4_ldz)
  ------------------
  |  Branch (286:24): [True: 3.98k, False: 1.51k]
  ------------------
  287|  3.98k|                        GETBITS(u4_word, u4_bitstream_offset,
  ------------------
  |  |  120|  3.98k|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|  3.98k|{                                                                           \
  |  |  122|  3.98k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|  3.98k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|  3.98k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|  3.98k|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|  3.98k|                                                                            \
  |  |  127|  3.98k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 3.61k, False: 364]
  |  |  ------------------
  |  |  128|  3.98k|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  3.61k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|  3.98k|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  3.98k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|  3.98k|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|  3.98k|}                                                                           \
  ------------------
  288|  5.49k|                                pu4_bitstrm_buf, u4_ldz);
  289|       |
  290|  5.49k|                    *pu4_bitstrm_ofst = u4_bitstream_offset;
  291|  5.49k|                    u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1;
  292|       |
  293|  5.49k|                    if(u4_word & 0x1)
  ------------------
  |  Branch (293:24): [True: 1.05k, False: 4.43k]
  ------------------
  294|  1.05k|                        i2_mvx = (-(WORD32)u4_abs_val);
  295|  4.43k|                    else
  296|  4.43k|                        i2_mvx = (u4_abs_val);
  297|  5.49k|                }
  298|       |                //inlinined ih264d_sev
  299|  5.49k|                COPYTHECONTEXT("MVD", i2_mvx);
  300|  5.49k|                i2_mvy = ih264d_sev(pu4_bitstrm_ofst,
  301|  5.49k|                                     pu4_bitstrm_buf);
  302|  5.49k|                COPYTHECONTEXT("MVD", i2_mvy);
  303|       |
  304|       |                /* Storing Info for partitions */
  305|  5.49k|                ps_part->u1_is_direct = PART_NOT_DIRECT;
  ------------------
  |  |  569|  5.49k|#define PART_NOT_DIRECT                0
  ------------------
  306|  5.49k|                ps_part->u1_sub_mb_num = u4_sub_mb_num;
  307|  5.49k|                ps_part->u1_partheight = u1_mb_part_height;
  308|  5.49k|                ps_part->u1_partwidth = u1_mb_part_width;
  309|       |
  310|       |                /* Storing Mv residuals */
  311|  5.49k|                ps_mv->i2_mv[0] = i2_mvx;
  312|  5.49k|                ps_mv->i2_mv[1] = i2_mvy;
  313|       |
  314|       |                /* Increment partition Index */
  315|  5.49k|                u1_p_idx++;
  316|  5.49k|                ps_part++;
  317|  5.49k|            }
  318|  5.33k|        }
  319|  3.28k|        ps_parse_mb_data->u1_num_part = u1_p_idx;
  320|  3.28k|        ps_dec->ps_part = ps_part;
  321|  3.28k|    }
  322|       |
  323|  3.28k|    {
  324|  3.28k|        UWORD32 u4_cbp;
  325|       |
  326|       |        /* Read the Coded block pattern */
  327|  3.28k|        UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  328|  3.28k|        UWORD32 u4_word, u4_ldz;
  329|       |
  330|       |        /***************************************************************/
  331|       |        /* Find leading zeros in next 32 bits                          */
  332|       |        /***************************************************************/
  333|  3.28k|        NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|  3.28k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|  3.28k|{                                                                           \
  |  |  152|  3.28k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|  3.28k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|  3.28k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|  3.28k|                                                                            \
  |  |  156|  3.28k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|  3.28k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 3.26k, False: 21]
  |  |  ------------------
  |  |  158|  3.28k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|  3.26k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|  3.28k|}
  ------------------
  334|  3.28k|        u4_ldz = CLZ(u4_word);
  335|       |        /* Flush the ps_bitstrm */
  336|  3.28k|        u4_bitstream_offset += (u4_ldz + 1);
  337|       |        /* Read the suffix from the ps_bitstrm */
  338|  3.28k|        u4_word = 0;
  339|  3.28k|        if(u4_ldz)
  ------------------
  |  Branch (339:12): [True: 1.88k, False: 1.40k]
  ------------------
  340|  1.88k|            GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|  1.88k|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|  1.88k|{                                                                           \
  |  |  122|  1.88k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|  1.88k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|  1.88k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|  1.88k|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|  1.88k|                                                                            \
  |  |  127|  1.88k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 1.78k, False: 101]
  |  |  ------------------
  |  |  128|  1.88k|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  1.78k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|  1.88k|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  1.88k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|  1.88k|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|  1.88k|}                                                                           \
  ------------------
  341|  3.28k|        *pu4_bitstrm_ofst = u4_bitstream_offset;
  342|  3.28k|        u4_cbp = ((1 << u4_ldz) + u4_word - 1);
  343|       |
  344|  3.28k|        if(u4_cbp > 47)
  ------------------
  |  Branch (344:12): [True: 105, False: 3.18k]
  ------------------
  345|    105|            return ERROR_CBP;
  346|       |
  347|  3.18k|        u4_cbp = *((UWORD8*)gau1_ih264d_cbp_inter + u4_cbp);
  348|  3.18k|        COPYTHECONTEXT("coded_block_pattern", u4_cbp);
  349|  3.18k|        ps_cur_mb_info->u1_cbp = u4_cbp;
  350|       |
  351|       |        /* Read the transform8x8 u4_flag if present */
  352|  3.18k|        if((ps_dec->s_high_profile.u1_transform8x8_present) && (u4_cbp & 0xf)
  ------------------
  |  Branch (352:12): [True: 2.00k, False: 1.18k]
  |  Branch (352:64): [True: 915, False: 1.08k]
  ------------------
  353|    915|                        && u1_no_submb_part_size_lt8x8_flag)
  ------------------
  |  Branch (353:28): [True: 915, False: 0]
  ------------------
  354|    915|        {
  355|    915|            ps_cur_mb_info->u1_tran_form8x8 = ih264d_get_bit_h264(ps_bitstrm);
  356|    915|            COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8);
  357|    915|            ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8;
  358|    915|        }
  359|       |
  360|       |        /* Read mb_qp_delta */
  361|  3.18k|        if(u4_cbp)
  ------------------
  |  Branch (361:12): [True: 1.77k, False: 1.40k]
  ------------------
  362|  1.77k|        {
  363|  1.77k|            WORD32 i_temp;
  364|       |
  365|  1.77k|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  366|  1.77k|            UWORD32 u4_word, u4_ldz, u4_abs_val;
  367|       |
  368|       |            /***************************************************************/
  369|       |            /* Find leading zeros in next 32 bits                          */
  370|       |            /***************************************************************/
  371|  1.77k|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|  1.77k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|  1.77k|{                                                                           \
  |  |  152|  1.77k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|  1.77k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|  1.77k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|  1.77k|                                                                            \
  |  |  156|  1.77k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|  1.77k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 1.77k, False: 1]
  |  |  ------------------
  |  |  158|  1.77k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|  1.77k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|  1.77k|}
  ------------------
  372|  1.77k|            u4_ldz = CLZ(u4_word);
  373|       |
  374|       |            /* Flush the ps_bitstrm */
  375|  1.77k|            u4_bitstream_offset += (u4_ldz + 1);
  376|       |
  377|       |            /* Read the suffix from the ps_bitstrm */
  378|  1.77k|            u4_word = 0;
  379|  1.77k|            if(u4_ldz)
  ------------------
  |  Branch (379:16): [True: 941, False: 838]
  ------------------
  380|    941|                GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf,
  ------------------
  |  |  120|    941|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    941|{                                                                           \
  |  |  122|    941|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    941|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    941|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    941|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    941|                                                                            \
  |  |  127|    941|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 941, False: 0]
  |  |  ------------------
  |  |  128|    941|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    941|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    941|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    941|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    941|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    941|}                                                                           \
  ------------------
  381|  1.77k|                        u4_ldz);
  382|       |
  383|  1.77k|            *pu4_bitstrm_ofst = u4_bitstream_offset;
  384|  1.77k|            u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1;
  385|       |
  386|  1.77k|            if(u4_word & 0x1)
  ------------------
  |  Branch (386:16): [True: 51, False: 1.72k]
  ------------------
  387|     51|                i_temp = (-(WORD32)u4_abs_val);
  388|  1.72k|            else
  389|  1.72k|                i_temp = (u4_abs_val);
  390|       |
  391|  1.77k|            if((i_temp < -26) || (i_temp > 25))
  ------------------
  |  Branch (391:16): [True: 2, False: 1.77k]
  |  Branch (391:34): [True: 4, False: 1.77k]
  ------------------
  392|      6|                return ERROR_INV_RANGE_QP_T;
  393|       |            //inlinined ih264d_sev
  394|       |
  395|  1.77k|            COPYTHECONTEXT("mb_qp_delta", i_temp);
  396|  1.77k|            if(i_temp)
  ------------------
  |  Branch (396:16): [True: 935, False: 838]
  ------------------
  397|    935|            {
  398|    935|                ret = ih264d_update_qp(ps_dec, (WORD8)i_temp);
  399|    935|                if(ret != OK)
  ------------------
  |  |  114|    935|#define OK        0
  ------------------
  |  Branch (399:20): [True: 0, False: 935]
  ------------------
  400|      0|                    return ret;
  401|    935|            }
  402|       |
  403|  1.77k|            ret = ih264d_parse_residual4x4_cavlc(ps_dec, ps_cur_mb_info, 0);
  404|  1.77k|            if(ret != OK)
  ------------------
  |  |  114|  1.77k|#define OK        0
  ------------------
  |  Branch (404:16): [True: 8, False: 1.76k]
  ------------------
  405|      8|                return ret;
  406|  1.76k|            if(EXCEED_OFFSET(ps_bitstrm))
  ------------------
  |  |   93|  1.76k|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 3, False: 1.76k]
  |  |  ------------------
  ------------------
  407|      3|                return ERROR_EOB_TERMINATE_T;
  408|  1.76k|        }
  409|  1.40k|        else
  410|  1.40k|        {
  411|  1.40k|            ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CAVLC);
  ------------------
  |  |  338|  1.40k|#define CAVLC  0
  ------------------
  412|  1.40k|        }
  413|       |
  414|       |
  415|       |
  416|  3.18k|    }
  417|       |
  418|  3.16k|    return OK;
  ------------------
  |  |  114|  3.16k|#define OK        0
  ------------------
  419|  3.18k|}
ih264d_parse_pmb_cabac:
  436|  10.6k|{
  437|  10.6k|    UWORD32 u1_num_mb_part;
  438|  10.6k|    UWORD32 uc_sub_mb;
  439|  10.6k|    parse_pmbarams_t * ps_parse_mb_data = ps_dec->ps_parse_mb_data
  440|  10.6k|                    + u4_num_mbsNby2;
  441|  10.6k|    WORD8 * pi1_ref_idx = ps_parse_mb_data->i1_ref_idx[0];
  442|  10.6k|    const UWORD8 * pu1_num_mb_part = (const UWORD8 *)gau1_ih264d_num_mb_part;
  443|  10.6k|    const UWORD32 u1_mb_type = ps_cur_mb_info->u1_mb_type;
  444|  10.6k|    UWORD8 * pu1_col_info = ps_parse_mb_data->u1_col_info;
  445|  10.6k|    UWORD32 u1_mb_mc_mode = u1_mb_type;
  446|  10.6k|    ctxt_inc_mb_info_t * p_curr_ctxt = ps_dec->ps_curr_ctxt_mb_info;
  447|  10.6k|    decoding_envirnoment_t * ps_cab_env = &ps_dec->s_cab_dec_env;
  448|  10.6k|    dec_bit_stream_t * ps_bitstrm = ps_dec->ps_bitstrm;
  449|  10.6k|    UWORD32 u4_sub_mb_pack = 0;
  450|  10.6k|    WORD32 ret;
  451|       |
  452|  10.6k|    UWORD8 u1_no_submb_part_size_lt8x8_flag = 1;
  453|  10.6k|    ps_cur_mb_info->u1_tran_form8x8 = 0;
  454|  10.6k|    ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
  455|       |
  456|  10.6k|    ps_cur_mb_info->u1_yuv_dc_block_flag = 0;
  457|       |
  458|  10.6k|    p_curr_ctxt->u1_mb_type = CAB_P;
  ------------------
  |  |  398|  10.6k|#define CAB_P             0x07 /* 0000 0111 */
  ------------------
  459|  10.6k|    ps_cur_mb_info->u1_mb_mc_mode = u1_mb_type;
  460|  10.6k|    uc_sub_mb = ((u1_mb_type == PRED_8x8) | (u1_mb_type == PRED_8x8R0));
  ------------------
  |  |  453|  10.6k|#define PRED_8x8    3
  ------------------
                  uc_sub_mb = ((u1_mb_type == PRED_8x8) | (u1_mb_type == PRED_8x8R0));
  ------------------
  |  |  454|  10.6k|#define PRED_8x8R0  4
  ------------------
  461|       |
  462|       |    /* Reading the subMB type */
  463|  10.6k|    if(uc_sub_mb)
  ------------------
  |  Branch (463:8): [True: 2.39k, False: 8.25k]
  ------------------
  464|  2.39k|    {
  465|       |
  466|  2.39k|        UWORD8 u1_colz = (PRED_8x8 << 6);
  ------------------
  |  |  453|  2.39k|#define PRED_8x8    3
  ------------------
  467|  2.39k|        u1_mb_mc_mode = 0;
  468|       |
  469|  2.39k|        {
  470|  2.39k|            UWORD8 u1_sub_mb_mode;
  471|  2.39k|            u1_sub_mb_mode = ih264d_parse_submb_type_cabac(
  472|  2.39k|                            0, ps_cab_env, ps_bitstrm,
  473|  2.39k|                            ps_dec->p_sub_mb_type_t);
  474|  2.39k|            if(u1_sub_mb_mode > 3)
  ------------------
  |  Branch (474:16): [True: 0, False: 2.39k]
  ------------------
  475|      0|                return ERROR_SUB_MB_TYPE;
  476|       |
  477|  2.39k|            u4_sub_mb_pack = (u4_sub_mb_pack << 8) | u1_sub_mb_mode;
  478|       |            /* Storing collocated information */
  479|  2.39k|            *pu1_col_info++ = u1_colz | ((UWORD8)(u1_sub_mb_mode << 4));
  480|  2.39k|            COPYTHECONTEXT("sub_mb_type", u1_sub_mb_mode);
  481|       |            /* check if Motion compensation is done below 8x8 */
  482|  2.39k|            if(u1_sub_mb_mode != P_L0_8x8)
  ------------------
  |  |  459|  2.39k|#define P_L0_8x8    0
  ------------------
  |  Branch (482:16): [True: 1.12k, False: 1.27k]
  ------------------
  483|  1.12k|            {
  484|  1.12k|                u1_no_submb_part_size_lt8x8_flag = 0;
  485|  1.12k|            }
  486|  2.39k|        }
  487|      0|        {
  488|  2.39k|            UWORD8 u1_sub_mb_mode;
  489|  2.39k|            u1_sub_mb_mode = ih264d_parse_submb_type_cabac(
  490|  2.39k|                            0, ps_cab_env, ps_bitstrm,
  491|  2.39k|                            ps_dec->p_sub_mb_type_t);
  492|  2.39k|            if(u1_sub_mb_mode > 3)
  ------------------
  |  Branch (492:16): [True: 0, False: 2.39k]
  ------------------
  493|      0|                return ERROR_SUB_MB_TYPE;
  494|       |
  495|  2.39k|            u4_sub_mb_pack = (u4_sub_mb_pack << 8) | u1_sub_mb_mode;
  496|       |            /* Storing collocated information */
  497|  2.39k|            *pu1_col_info++ = u1_colz | ((UWORD8)(u1_sub_mb_mode << 4));
  498|  2.39k|            COPYTHECONTEXT("sub_mb_type", u1_sub_mb_mode);
  499|       |            /* check if Motion compensation is done below 8x8 */
  500|  2.39k|            if(u1_sub_mb_mode != P_L0_8x8)
  ------------------
  |  |  459|  2.39k|#define P_L0_8x8    0
  ------------------
  |  Branch (500:16): [True: 1.13k, False: 1.26k]
  ------------------
  501|  1.13k|            {
  502|  1.13k|                u1_no_submb_part_size_lt8x8_flag = 0;
  503|  1.13k|            }
  504|  2.39k|        }
  505|      0|        {
  506|  2.39k|            UWORD8 u1_sub_mb_mode;
  507|  2.39k|            u1_sub_mb_mode = ih264d_parse_submb_type_cabac(
  508|  2.39k|                            0, ps_cab_env, ps_bitstrm,
  509|  2.39k|                            ps_dec->p_sub_mb_type_t);
  510|  2.39k|            if(u1_sub_mb_mode > 3)
  ------------------
  |  Branch (510:16): [True: 0, False: 2.39k]
  ------------------
  511|      0|                return ERROR_SUB_MB_TYPE;
  512|       |
  513|  2.39k|            u4_sub_mb_pack = (u4_sub_mb_pack << 8) | u1_sub_mb_mode;
  514|       |            /* Storing collocated information */
  515|  2.39k|            *pu1_col_info++ = u1_colz | ((UWORD8)(u1_sub_mb_mode << 4));
  516|  2.39k|            COPYTHECONTEXT("sub_mb_type", u1_sub_mb_mode);
  517|       |            /* check if Motion compensation is done below 8x8 */
  518|  2.39k|            if(u1_sub_mb_mode != P_L0_8x8)
  ------------------
  |  |  459|  2.39k|#define P_L0_8x8    0
  ------------------
  |  Branch (518:16): [True: 1.19k, False: 1.20k]
  ------------------
  519|  1.19k|            {
  520|  1.19k|                u1_no_submb_part_size_lt8x8_flag = 0;
  521|  1.19k|            }
  522|  2.39k|        }
  523|      0|        {
  524|  2.39k|            UWORD8 u1_sub_mb_mode;
  525|  2.39k|            u1_sub_mb_mode = ih264d_parse_submb_type_cabac(
  526|  2.39k|                            0, ps_cab_env, ps_bitstrm,
  527|  2.39k|                            ps_dec->p_sub_mb_type_t);
  528|  2.39k|            if(u1_sub_mb_mode > 3)
  ------------------
  |  Branch (528:16): [True: 0, False: 2.39k]
  ------------------
  529|      0|                return ERROR_SUB_MB_TYPE;
  530|       |
  531|  2.39k|            u4_sub_mb_pack = (u4_sub_mb_pack << 8) | u1_sub_mb_mode;
  532|       |            /* Storing collocated information */
  533|  2.39k|            *pu1_col_info++ = u1_colz | ((UWORD8)(u1_sub_mb_mode << 4));
  534|  2.39k|            COPYTHECONTEXT("sub_mb_type", u1_sub_mb_mode);
  535|       |            /* check if Motion compensation is done below 8x8 */
  536|  2.39k|            if(u1_sub_mb_mode != P_L0_8x8)
  ------------------
  |  |  459|  2.39k|#define P_L0_8x8    0
  ------------------
  |  Branch (536:16): [True: 1.02k, False: 1.37k]
  ------------------
  537|  1.02k|            {
  538|  1.02k|                u1_no_submb_part_size_lt8x8_flag = 0;
  539|  1.02k|            }
  540|  2.39k|        }
  541|      0|        u1_num_mb_part = 4;
  542|  2.39k|    }
  543|  8.25k|    else
  544|  8.25k|    {
  545|  8.25k|        u1_num_mb_part = pu1_num_mb_part[u1_mb_type];
  546|       |        /* Storing collocated Mb and SubMb mode information */
  547|  8.25k|        *pu1_col_info++ = (u1_mb_type << 6);
  548|  8.25k|        if(u1_mb_type)
  ------------------
  |  Branch (548:12): [True: 4.19k, False: 4.06k]
  ------------------
  549|  4.19k|            *pu1_col_info++ = (u1_mb_type << 6);
  550|  8.25k|    }
  551|       |    /* Decoding reference index 0: For simple profile the following   */
  552|       |    /* conditions are always true (mb_field_decoding_flag == 0);      */
  553|       |    /* (MbPartPredMode != PredL1)                                     */
  554|  10.6k|    {
  555|  10.6k|        WORD8 * pi1_top_ref_idx_ctx_inc_arr = p_curr_ctxt->i1_ref_idx;
  556|  10.6k|        WORD8 * pi1_left_ref_idx_ctxt_inc = ps_dec->pi1_left_ref_idx_ctxt_inc;
  557|  10.6k|        UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  558|  10.6k|        UWORD8 uc_field = ps_cur_mb_info->u1_mb_field_decodingflag;
  559|  10.6k|        UWORD8 uc_num_ref_idx_l0_active_minus1 =
  560|  10.6k|                        (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0]
  561|  10.6k|                                        << (u1_mbaff & uc_field)) - 1;
  562|       |
  563|  10.6k|        if((uc_num_ref_idx_l0_active_minus1 > 0) & (u1_mb_type != PRED_8x8R0))
  ------------------
  |  |  454|  10.6k|#define PRED_8x8R0  4
  ------------------
  |  Branch (563:12): [True: 858, False: 9.80k]
  ------------------
  564|    858|        {
  565|       |            /* force the routine to decode ref idx for each partition */
  566|    858|            *((UWORD32 *)pi1_ref_idx) = 0x01010101;
  567|    858|            ret = ih264d_parse_ref_idx_cabac(u1_num_mb_part, 0,
  568|    858|                                             uc_num_ref_idx_l0_active_minus1,
  569|    858|                                             u1_mb_mc_mode, pi1_ref_idx,
  570|    858|                                             pi1_left_ref_idx_ctxt_inc,
  571|    858|                                             pi1_top_ref_idx_ctx_inc_arr, ps_cab_env,
  572|    858|                                             ps_bitstrm, ps_dec->p_ref_idx_t);
  573|    858|            if(ret != OK)
  ------------------
  |  |  114|    858|#define OK        0
  ------------------
  |  Branch (573:16): [True: 3, False: 855]
  ------------------
  574|      3|                return ret;
  575|    858|        }
  576|  9.80k|        else
  577|  9.80k|        {
  578|       |            /* When there exists only a single frame to predict from */
  579|  9.80k|            pi1_left_ref_idx_ctxt_inc[0] = 0;
  580|  9.80k|            pi1_left_ref_idx_ctxt_inc[1] = 0;
  581|  9.80k|            pi1_top_ref_idx_ctx_inc_arr[0] = 0;
  582|  9.80k|            pi1_top_ref_idx_ctx_inc_arr[1] = 0;
  583|  9.80k|            *((UWORD32 *)pi1_ref_idx) = 0;
  584|  9.80k|        }
  585|  10.6k|    }
  586|       |
  587|  10.6k|    {
  588|  10.6k|        UWORD8 u1_p_idx;
  589|  10.6k|        UWORD32 uc_i;
  590|  10.6k|        parse_part_params_t * ps_part = ps_dec->ps_part;
  591|  10.6k|        UWORD8 u1_sub_mb_mode, u1_num_subpart, u1_mb_part_width, u1_mb_part_height;
  592|  10.6k|        UWORD32 u4_sub_mb_num;
  593|  10.6k|        const UWORD8 * pu1_top_left_sub_mb_indx;
  594|  10.6k|        mv_pred_t *ps_mv_start = ps_dec->ps_mv_cur + (u4_mb_num << 4);
  595|  10.6k|        UWORD16 u2_sub_mb_num_pack = 0x028A;
  596|       |
  597|       |        /* Loading the table pointers */
  598|  10.6k|        const UWORD8 * pu1_mb_partw = (const UWORD8 *)gau1_ih264d_mb_partw;
  599|  10.6k|        const UWORD8 * pu1_mb_parth = (const UWORD8 *)gau1_ih264d_mb_parth;
  600|  10.6k|        const UWORD8 * pu1_sub_mb_indx_mod =
  601|  10.6k|                        (const UWORD8 *)(gau1_ih264d_submb_indx_mod)
  602|  10.6k|                                        + (uc_sub_mb * 6);
  603|  10.6k|        const UWORD8 * pu1_sub_mb_partw = (const UWORD8 *)gau1_ih264d_submb_partw;
  604|  10.6k|        const UWORD8 * pu1_sub_mb_parth = (const UWORD8 *)gau1_ih264d_submb_parth;
  605|  10.6k|        const UWORD8 * pu1_num_sub_mb_part =
  606|  10.6k|                        (const UWORD8 *)gau1_ih264d_num_submb_part;
  607|       |
  608|       |        /*********************************************************/
  609|       |        /* default initialisations for condition (uc_sub_mb == 0) */
  610|       |        /* i.e. all are subpartitions of 8x8                     */
  611|       |        /*********************************************************/
  612|  10.6k|        u1_sub_mb_mode = 0;
  613|  10.6k|        u1_num_subpart = 1;
  614|  10.6k|        u1_mb_part_width = pu1_mb_partw[u1_mb_type];
  615|  10.6k|        u1_mb_part_height = pu1_mb_parth[u1_mb_type];
  616|  10.6k|        pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_mb_type << 1);
  617|  10.6k|        u4_sub_mb_num = 0;
  618|       |
  619|       |        /* Loop on number of partitions */
  620|  32.6k|        for(uc_i = 0, u1_p_idx = 0; uc_i < u1_num_mb_part; uc_i++)
  ------------------
  |  Branch (620:37): [True: 22.0k, False: 10.6k]
  ------------------
  621|  22.0k|        {
  622|  22.0k|            UWORD8 uc_j;
  623|  22.0k|            if(uc_sub_mb)
  ------------------
  |  Branch (623:16): [True: 9.58k, False: 12.4k]
  ------------------
  624|  9.58k|            {
  625|  9.58k|                u1_sub_mb_mode = u4_sub_mb_pack >> 24;
  626|  9.58k|                u1_num_subpart = pu1_num_sub_mb_part[u1_sub_mb_mode];
  627|  9.58k|                u1_mb_part_width = pu1_sub_mb_partw[u1_sub_mb_mode];
  628|  9.58k|                u1_mb_part_height = pu1_sub_mb_parth[u1_sub_mb_mode];
  629|  9.58k|                pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_sub_mb_mode << 1);
  630|  9.58k|                u4_sub_mb_num = u2_sub_mb_num_pack >> 12;
  631|  9.58k|                u4_sub_mb_pack <<= 8;
  632|  9.58k|                u2_sub_mb_num_pack <<= 4;
  633|  9.58k|            }
  634|       |            /* Loop on Number of sub-partitions */
  635|  50.7k|            for(uc_j = 0; uc_j < u1_num_subpart; uc_j++, pu1_top_left_sub_mb_indx++)
  ------------------
  |  Branch (635:27): [True: 28.7k, False: 22.0k]
  ------------------
  636|  28.7k|            {
  637|  28.7k|                mv_pred_t * ps_mv;
  638|       |
  639|  28.7k|                u4_sub_mb_num += *pu1_top_left_sub_mb_indx;
  640|  28.7k|                ps_mv = ps_mv_start + u4_sub_mb_num;
  641|       |
  642|       |                /* Storing Info for partitions */
  643|  28.7k|                ps_part->u1_is_direct = PART_NOT_DIRECT;
  ------------------
  |  |  569|  28.7k|#define PART_NOT_DIRECT                0
  ------------------
  644|  28.7k|                ps_part->u1_sub_mb_num = u4_sub_mb_num;
  645|  28.7k|                ps_part->u1_partheight = u1_mb_part_height;
  646|  28.7k|                ps_part->u1_partwidth = u1_mb_part_width;
  647|       |
  648|       |                /* Increment partition Index */
  649|  28.7k|                u1_p_idx++;
  650|  28.7k|                ps_part++;
  651|       |
  652|  28.7k|                ih264d_get_mvd_cabac(u4_sub_mb_num, 0, u1_mb_part_width,
  653|  28.7k|                                     u1_mb_part_height, 1, ps_dec, ps_mv);
  654|  28.7k|            }
  655|  22.0k|        }
  656|  10.6k|        ps_parse_mb_data->u1_num_part = u1_p_idx;
  657|  10.6k|        ps_dec->ps_part = ps_part;
  658|  10.6k|    }
  659|  10.6k|    {
  660|  10.6k|        UWORD8 u1_cbp;
  661|       |
  662|       |        /* Read the Coded block pattern */
  663|  10.6k|        u1_cbp = (WORD8)ih264d_parse_ctx_cbp_cabac(ps_dec);
  664|  10.6k|        COPYTHECONTEXT("coded_block_pattern", u1_cbp);
  665|  10.6k|        ps_cur_mb_info->u1_cbp = u1_cbp;
  666|  10.6k|        p_curr_ctxt->u1_cbp = u1_cbp;
  667|  10.6k|        p_curr_ctxt->u1_intra_chroma_pred_mode = 0;
  668|  10.6k|        p_curr_ctxt->u1_yuv_dc_csbp &= 0xFE;
  669|  10.6k|        ps_dec->pu1_left_yuv_dc_csbp[0] &= 0x6;
  670|       |
  671|  10.6k|        if(u1_cbp > 47)
  ------------------
  |  Branch (671:12): [True: 0, False: 10.6k]
  ------------------
  672|      0|            return ERROR_CBP;
  673|       |
  674|  10.6k|        ps_cur_mb_info->u1_tran_form8x8 = 0;
  675|  10.6k|        ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
  676|       |
  677|       |        /* Read the transform8x8 u4_flag if present */
  678|  10.6k|        if((ps_dec->s_high_profile.u1_transform8x8_present) && (u1_cbp & 0xf)
  ------------------
  |  Branch (678:12): [True: 9.41k, False: 1.23k]
  |  Branch (678:64): [True: 8.25k, False: 1.16k]
  ------------------
  679|  8.25k|                        && u1_no_submb_part_size_lt8x8_flag)
  ------------------
  |  Branch (679:28): [True: 6.97k, False: 1.27k]
  ------------------
  680|  6.97k|        {
  681|  6.97k|            ps_cur_mb_info->u1_tran_form8x8 = ih264d_parse_transform8x8flag_cabac(
  682|  6.97k|                            ps_dec, ps_cur_mb_info);
  683|  6.97k|            COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8);
  684|  6.97k|            p_curr_ctxt->u1_transform8x8_ctxt = ps_cur_mb_info->u1_tran_form8x8;
  685|  6.97k|            ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8;
  686|       |
  687|  6.97k|        }
  688|  3.67k|        else
  689|  3.67k|        {
  690|  3.67k|            p_curr_ctxt->u1_transform8x8_ctxt = 0;
  691|  3.67k|        }
  692|       |
  693|       |        /* Read mb_qp_delta */
  694|  10.6k|        if(u1_cbp)
  ------------------
  |  Branch (694:12): [True: 9.48k, False: 1.17k]
  ------------------
  695|  9.48k|        {
  696|  9.48k|            WORD8 c_temp;
  697|  9.48k|            ret = ih264d_parse_mb_qp_delta_cabac(ps_dec, &c_temp);
  698|  9.48k|            if(ret != OK)
  ------------------
  |  |  114|  9.48k|#define OK        0
  ------------------
  |  Branch (698:16): [True: 0, False: 9.48k]
  ------------------
  699|      0|                return ret;
  700|  9.48k|            COPYTHECONTEXT("mb_qp_delta", c_temp);
  701|  9.48k|            if(c_temp != 0)
  ------------------
  |  Branch (701:16): [True: 2.18k, False: 7.29k]
  ------------------
  702|  2.18k|            {
  703|  2.18k|                ret = ih264d_update_qp(ps_dec, c_temp);
  704|  2.18k|                if(ret != OK)
  ------------------
  |  |  114|  2.18k|#define OK        0
  ------------------
  |  Branch (704:20): [True: 0, False: 2.18k]
  ------------------
  705|      0|                    return ret;
  706|  2.18k|            }
  707|  9.48k|        }
  708|  1.17k|        else
  709|  1.17k|            ps_dec->i1_prev_mb_qp_delta = 0;
  710|       |
  711|       |
  712|       |
  713|  10.6k|        ih264d_parse_residual4x4_cabac(ps_dec, ps_cur_mb_info, 0);
  714|  10.6k|        if(EXCEED_OFFSET(ps_dec->ps_bitstrm))
  ------------------
  |  |   93|  10.6k|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 125, False: 10.5k]
  |  |  ------------------
  ------------------
  715|    125|            return ERROR_EOB_TERMINATE_T;
  716|  10.6k|    }
  717|  10.5k|    return OK;
  ------------------
  |  |  114|  10.5k|#define OK        0
  ------------------
  718|  10.6k|}
ih264d_update_nnz_for_skipmb:
  755|   558k|{
  756|   558k|    UWORD32 *pu4_buf;
  757|   558k|    UWORD8 *pu1_buf;
  758|   558k|    UNUSED(u1_entrpy);
  ------------------
  |  |   45|   558k|#define UNUSED(x) ((void)(x))
  ------------------
  759|   558k|    pu1_buf = ps_dec->pu1_left_nnz_y;
  760|   558k|    pu4_buf = (UWORD32 *)pu1_buf;
  761|   558k|    *pu4_buf = 0;
  762|   558k|    pu1_buf = ps_dec->pu1_left_nnz_uv;
  763|   558k|    pu4_buf = (UWORD32 *)pu1_buf;
  764|   558k|    *pu4_buf = 0;
  765|   558k|    pu1_buf = ps_cur_mb_info->ps_curmb->pu1_nnz_y;
  766|   558k|    pu4_buf = (UWORD32 *)pu1_buf;
  767|   558k|    *pu4_buf = 0;
  768|   558k|    pu1_buf = ps_cur_mb_info->ps_curmb->pu1_nnz_uv;
  769|   558k|    pu4_buf = (UWORD32 *)pu1_buf;
  770|   558k|    *pu4_buf = 0;
  771|   558k|    ps_cur_mb_info->ps_curmb->u2_luma_csbp = 0;
  772|   558k|    ps_cur_mb_info->u2_luma_csbp = 0;
  773|   558k|    ps_cur_mb_info->u2_chroma_csbp = 0;
  774|   558k|}

ih264d_form_pred_weight_matrix:
   90|  1.37k|{
   91|  1.37k|    dec_slice_params_t *ps_cur_slice;
   92|  1.37k|    UWORD8 uc_num_ref_idx_l0_active, uc_num_ref_idx_l1_active;
   93|  1.37k|    UWORD8 i, j;
   94|  1.37k|    UWORD32 *pu4_mat_iwt_ofst;
   95|  1.37k|    UWORD16 i2_idx;
   96|  1.37k|    UWORD32 *pui32_weight_offset_l0, *pui32_weight_offset_l1;
   97|  1.37k|    UWORD32 u4_temp;
   98|       |
   99|  1.37k|    ps_cur_slice = ps_dec->ps_cur_slice;
  100|  1.37k|    uc_num_ref_idx_l0_active = ps_cur_slice->u1_num_ref_idx_lx_active[0];
  101|  1.37k|    uc_num_ref_idx_l1_active = ps_cur_slice->u1_num_ref_idx_lx_active[1];
  102|       |
  103|  1.37k|    pu4_mat_iwt_ofst = ps_dec->pu4_wts_ofsts_mat;
  104|       |
  105|  1.37k|    if(ps_cur_slice->u1_slice_type == B_SLICE)
  ------------------
  |  |  369|  1.37k|#define B_SLICE  1
  ------------------
  |  Branch (105:8): [True: 6, False: 1.36k]
  ------------------
  106|      6|    {
  107|     12|        for(i = 0; i < uc_num_ref_idx_l0_active; i++)
  ------------------
  |  Branch (107:20): [True: 6, False: 6]
  ------------------
  108|      6|        {
  109|      6|            pui32_weight_offset_l0 = ps_cur_slice->u4_wt_ofst_lx[0][i];
  110|     18|            for(j = 0; j < uc_num_ref_idx_l1_active; j++)
  ------------------
  |  Branch (110:24): [True: 12, False: 6]
  ------------------
  111|     12|            {
  112|     12|                pui32_weight_offset_l1 = ps_cur_slice->u4_wt_ofst_lx[1][j];
  113|     12|                i2_idx = i * uc_num_ref_idx_l0_active + j;
  114|     12|                i2_idx = X3(i2_idx);
  ------------------
  |  |   92|     12|#define X3(a)   (((a) << 1) + (a))
  ------------------
  115|       |                /*        u4_temp = (pui32_weight_offset_l0[0] | (pui32_weight_offset_l1[0] << 16));
  116|       |                 pu4_mat_iwt_ofst[0] = u4_temp;
  117|       |                 u4_temp = (pui32_weight_offset_l0[1] | (pui32_weight_offset_l1[1] << 16));
  118|       |                 pu4_mat_iwt_ofst[1] = u4_temp;
  119|       |                 u4_temp = (pui32_weight_offset_l0[2] | (pui32_weight_offset_l1[2] << 16));
  120|       |                 pu4_mat_iwt_ofst[2] = u4_temp;
  121|       |                 pu4_mat_iwt_ofst += 3;*/
  122|     12|                pu4_mat_iwt_ofst[0] = pui32_weight_offset_l0[0];
  123|     12|                pu4_mat_iwt_ofst[1] = pui32_weight_offset_l1[0];
  124|     12|                pu4_mat_iwt_ofst[2] = pui32_weight_offset_l0[1];
  125|     12|                pu4_mat_iwt_ofst[3] = pui32_weight_offset_l1[1];
  126|     12|                pu4_mat_iwt_ofst[4] = pui32_weight_offset_l0[2];
  127|     12|                pu4_mat_iwt_ofst[5] = pui32_weight_offset_l1[2];
  128|     12|                pu4_mat_iwt_ofst += 6;
  129|     12|            }
  130|      6|        }
  131|      6|    }
  132|  1.36k|    else
  133|  1.36k|    {
  134|  3.14k|        for(i = 0; i < uc_num_ref_idx_l0_active; i++)
  ------------------
  |  Branch (134:20): [True: 1.77k, False: 1.36k]
  ------------------
  135|  1.77k|        {
  136|  1.77k|            pui32_weight_offset_l0 = ps_cur_slice->u4_wt_ofst_lx[0][i];
  137|  1.77k|            i2_idx = X3(i);
  ------------------
  |  |   92|  1.77k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  138|  1.77k|            u4_temp = (UWORD32)pui32_weight_offset_l0[0];
  139|  1.77k|            pu4_mat_iwt_ofst[0] = u4_temp;
  140|  1.77k|            u4_temp = (UWORD32)pui32_weight_offset_l0[1];
  141|  1.77k|            pu4_mat_iwt_ofst[2] = u4_temp;
  142|  1.77k|            u4_temp = (UWORD32)pui32_weight_offset_l0[2];
  143|  1.77k|            pu4_mat_iwt_ofst[4] = u4_temp;
  144|  1.77k|            pu4_mat_iwt_ofst += 6;
  145|  1.77k|        }
  146|  1.36k|    }
  147|  1.37k|}
ih264d_end_of_pic_dispbuf_mgr:
  750|  3.42k|{
  751|  3.42k|    dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice;
  752|  3.42k|    UWORD8 u1_num_of_users = 0;
  753|  3.42k|    WORD32 ret;
  754|       |
  755|  3.42k|    H264_MUTEX_LOCK(&ps_dec->process_disp_mutex);
  756|  3.42k|    if(1)
  ------------------
  |  Branch (756:8): [True: 3.42k, Folded]
  ------------------
  757|  3.42k|    {
  758|       |
  759|  3.42k|        {
  760|  3.42k|            ih264d_delete_nonref_nondisplay_pics(ps_dec->ps_dpb_mgr);
  761|  3.42k|            if(ps_cur_slice->u1_mmco_equalto5
  ------------------
  |  Branch (761:16): [True: 1, False: 3.42k]
  ------------------
  762|  3.42k|                            || (ps_cur_slice->u1_nal_unit_type == IDR_SLICE_NAL))
  ------------------
  |  |  328|  3.42k|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (762:32): [True: 2.87k, False: 542]
  ------------------
  763|  2.87k|            {
  764|  2.87k|                ps_dec->ps_cur_pic->i4_poc = 0;
  765|  2.87k|                if(ps_dec->u4_total_mbs_coded
  ------------------
  |  Branch (765:20): [True: 2.87k, False: 0]
  ------------------
  766|  2.87k|                                == (ps_dec->ps_cur_sps->u4_max_mb_addr + 1))
  767|  2.87k|                    ih264d_reset_ref_bufs(ps_dec->ps_dpb_mgr);
  768|  2.87k|                ih264d_release_display_bufs(ps_dec);
  769|  2.87k|            }
  770|  3.42k|            if(IVD_DECODE_FRAME_OUT != ps_dec->e_frm_out_mode)
  ------------------
  |  Branch (770:16): [True: 3.42k, False: 0]
  ------------------
  771|  3.42k|            {
  772|  3.42k|                ret = ih264d_assign_display_seq(ps_dec);
  773|  3.42k|                if(ret != OK)
  ------------------
  |  |  114|  3.42k|#define OK        0
  ------------------
  |  Branch (773:20): [True: 0, False: 3.42k]
  ------------------
  774|      0|                    return ret;
  775|  3.42k|            }
  776|  3.42k|        }
  777|       |
  778|  3.42k|        if(ps_cur_slice->u1_nal_ref_idc)
  ------------------
  |  Branch (778:12): [True: 2.89k, False: 530]
  ------------------
  779|  2.89k|        {
  780|       |            /* Mark pic buf as needed for reference */
  781|  2.89k|            ih264_buf_mgr_set_status((buf_mgr_t *)ps_dec->pv_pic_buf_mgr,
  782|  2.89k|                                     ps_dec->u1_pic_buf_id,
  783|  2.89k|                                     BUF_MGR_REF);
  ------------------
  |  |   50|  2.89k|#define BUF_MGR_REF          (1 << 2)
  ------------------
  784|       |            /* Mark mv buf as needed for reference */
  785|  2.89k|            ih264_buf_mgr_set_status((buf_mgr_t *)ps_dec->pv_mv_buf_mgr,
  786|  2.89k|                                     ps_dec->as_buf_id_info_map[ps_dec->u1_pic_buf_id].mv_buf_id,
  787|  2.89k|                                     BUF_MGR_REF);
  ------------------
  |  |   50|  2.89k|#define BUF_MGR_REF          (1 << 2)
  ------------------
  788|  2.89k|            ps_dec->au1_pic_buf_ref_flag[ps_dec->u1_pic_buf_id] = 1;
  789|  2.89k|        }
  790|       |
  791|       |        /* 420 consumer */
  792|       |        /* Increment the number of users by 1 for display based upon */
  793|       |        /*the SEEK KEY FRAME control sent to decoder                 */
  794|  3.42k|        if(((0 == ps_dec->u1_last_pic_not_decoded)
  ------------------
  |  Branch (794:13): [True: 3.42k, False: 0]
  ------------------
  795|  3.42k|                        && (0
  ------------------
  |  Branch (795:28): [True: 3.42k, False: 0]
  ------------------
  796|  3.42k|                                        == (ps_dec->ps_cur_pic->u4_pack_slc_typ
  797|  3.42k|                                                        & ps_dec->u4_skip_frm_mask)))
  798|      0|                        || (ps_cur_slice->u1_nal_unit_type == IDR_SLICE_NAL))
  ------------------
  |  |  328|      0|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (798:28): [True: 0, False: 0]
  ------------------
  799|  3.42k|        {
  800|       |            /* Mark pic buf as needed for display */
  801|  3.42k|            ih264_buf_mgr_set_status((buf_mgr_t *)ps_dec->pv_pic_buf_mgr,
  802|  3.42k|                                     ps_dec->u1_pic_buf_id,
  803|  3.42k|                                     BUF_MGR_IO);
  ------------------
  |  |   53|  3.42k|#define BUF_MGR_IO           (1 << 3)
  ------------------
  804|       |
  805|  3.42k|        }
  806|       |
  807|  3.42k|        if(!ps_cur_slice->u1_field_pic_flag
  ------------------
  |  Branch (807:12): [True: 3.42k, False: 0]
  ------------------
  808|      0|                        || ((TOP_FIELD_ONLY | BOT_FIELD_ONLY)
  ------------------
  |  |   64|      0|#define TOP_FIELD_ONLY      0x02
  ------------------
                                      || ((TOP_FIELD_ONLY | BOT_FIELD_ONLY)
  ------------------
  |  |   65|      0|#define BOT_FIELD_ONLY      0x01
  ------------------
  |  Branch (808:28): [True: 0, False: 0]
  ------------------
  809|      0|                                        != ps_dec->u1_top_bottom_decoded))
  810|  3.42k|        {
  811|  3.42k|            pic_buffer_t *ps_cur_pic = ps_dec->ps_cur_pic;
  812|  3.42k|            ps_cur_pic->u2_disp_width = ps_dec->u2_disp_width;
  813|  3.42k|            ps_cur_pic->u2_disp_height = ps_dec->u2_disp_height >> 1;
  814|       |
  815|  3.42k|            ps_cur_pic->u2_crop_offset_y = ps_dec->u2_crop_offset_y;
  816|  3.42k|            ps_cur_pic->u2_crop_offset_uv = ps_dec->u2_crop_offset_uv;
  817|  3.42k|            ps_cur_pic->u1_pic_type = 0;
  818|  3.42k|            {
  819|  3.42k|                WORD64 i8_display_poc;
  820|  3.42k|                i8_display_poc = (WORD64)ps_dec->i4_prev_max_display_seq +
  821|  3.42k|                            ps_dec->ps_cur_pic->i4_poc;
  822|  3.42k|                if(IS_OUT_OF_RANGE_S32(i8_display_poc))
  ------------------
  |  |   58|  3.42k|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 3.42k]
  |  |  |  Branch (58:54): [True: 4, False: 3.41k]
  |  |  ------------------
  ------------------
  823|      4|                {
  824|      4|                    ps_dec->i4_prev_max_display_seq = 0;
  825|      4|                }
  826|  3.42k|            }
  827|  3.42k|            ret = ih264d_insert_pic_in_display_list(
  828|  3.42k|                            ps_dec->ps_dpb_mgr,
  829|  3.42k|                            ps_dec->u1_pic_buf_id,
  830|  3.42k|                            ps_dec->i4_prev_max_display_seq
  831|  3.42k|                                            + ps_dec->ps_cur_pic->i4_poc,
  832|  3.42k|                            ps_dec->ps_cur_pic->i4_frame_num);
  833|  3.42k|            if(ret != OK)
  ------------------
  |  |  114|  3.42k|#define OK        0
  ------------------
  |  Branch (833:16): [True: 0, False: 3.42k]
  ------------------
  834|      0|                return ret;
  835|       |
  836|  3.42k|            {
  837|  3.42k|                ivd_video_decode_op_t * ps_dec_output =
  838|  3.42k|                                (ivd_video_decode_op_t *)ps_dec->pv_dec_out;
  839|       |
  840|  3.42k|                ps_dec_output->u4_frame_decoded_flag = 1;
  841|  3.42k|            }
  842|  3.42k|            if(ps_dec->au1_pic_buf_ref_flag[ps_dec->u1_pic_buf_id] == 0)
  ------------------
  |  Branch (842:16): [True: 530, False: 2.89k]
  ------------------
  843|    530|            {
  844|    530|                ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_mv_buf_mgr,
  845|    530|                                      ps_dec->as_buf_id_info_map[ps_dec->u1_pic_buf_id].mv_buf_id,
  846|    530|                                      BUF_MGR_REF);
  ------------------
  |  |   50|    530|#define BUF_MGR_REF          (1 << 2)
  ------------------
  847|    530|                ps_dec->au1_pic_buf_ref_flag[ps_dec->u1_pic_buf_id] = 0;
  848|       |
  849|    530|            }
  850|  3.42k|        }
  851|      0|        else
  852|      0|        {
  853|      0|            H264_DEC_DEBUG_PRINT("pic not inserted display %d %d\n",
  ------------------
  |  |   39|      0|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
  854|      0|                                 ps_cur_slice->u1_field_pic_flag,
  855|      0|                                 ps_dec->u1_second_field);
  856|      0|        }
  857|       |
  858|  3.42k|        if(!ps_cur_slice->u1_field_pic_flag
  ------------------
  |  Branch (858:12): [True: 3.42k, False: 0]
  ------------------
  859|      0|                        || ((TOP_FIELD_ONLY | BOT_FIELD_ONLY)
  ------------------
  |  |   64|      0|#define TOP_FIELD_ONLY      0x02
  ------------------
                                      || ((TOP_FIELD_ONLY | BOT_FIELD_ONLY)
  ------------------
  |  |   65|      0|#define BOT_FIELD_ONLY      0x01
  ------------------
  |  Branch (859:28): [True: 0, False: 0]
  ------------------
  860|      0|                                        == ps_dec->u1_top_bottom_decoded))
  861|  3.42k|        {
  862|  3.42k|            if(IVD_DECODE_FRAME_OUT == ps_dec->e_frm_out_mode)
  ------------------
  |  Branch (862:16): [True: 0, False: 3.42k]
  ------------------
  863|      0|            {
  864|      0|                ret = ih264d_assign_display_seq(ps_dec);
  865|      0|                if(ret != OK)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (865:20): [True: 0, False: 0]
  ------------------
  866|      0|                    return ret;
  867|      0|            }
  868|  3.42k|        }
  869|  3.42k|    }
  870|       |
  871|  3.42k|    H264_MUTEX_UNLOCK(&ps_dec->process_disp_mutex);
  872|       |
  873|  3.42k|    return OK;
  ------------------
  |  |  114|  3.42k|#define OK        0
  ------------------
  874|  3.42k|}
ih264d_deblock_picture:
  894|  3.42k|{
  895|  3.42k|    dec_struct_t *ps_dec = (dec_struct_t *)ptr;
  896|       |
  897|  3.42k|    {
  898|       |        /*Deblock picture only if all the mb's in the frame have been decoded*/
  899|  3.42k|        if(ps_dec->u1_pic_decode_done == 1)
  ------------------
  |  Branch (899:12): [True: 3.42k, False: 0]
  ------------------
  900|  3.42k|        {
  901|  3.42k|            if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag
  ------------------
  |  Branch (901:16): [True: 0, False: 3.42k]
  ------------------
  902|  3.42k|                            || ps_dec->ps_cur_slice->u1_field_pic_flag)
  ------------------
  |  Branch (902:32): [True: 0, False: 3.42k]
  ------------------
  903|      0|            {
  904|      0|                ps_dec->p_DeblockPicture[ps_dec->ps_cur_slice->u1_mbaff_frame_flag](
  905|      0|                                ps_dec);
  906|      0|            }
  907|  3.42k|            else
  908|       |
  909|  3.42k|            {
  910|       |
  911|  3.42k|                ih264d_deblock_picture_progressive(ps_dec);
  912|  3.42k|            }
  913|       |
  914|  3.42k|        }
  915|  3.42k|    }
  916|       |
  917|  3.42k|}
ih264d_deblock_display:
  930|  3.42k|{
  931|  3.42k|    WORD32 ret;
  932|       |    /* Call deblocking */
  933|  3.42k|    ih264d_deblock_picture(ps_dec);
  934|       |
  935|  3.42k|    ret = ih264d_end_of_pic_dispbuf_mgr(ps_dec);
  936|  3.42k|    if(ret != OK)
  ------------------
  |  |  114|  3.42k|#define OK        0
  ------------------
  |  Branch (936:8): [True: 0, False: 3.42k]
  ------------------
  937|      0|        return ret;
  938|       |
  939|  3.42k|    return OK;
  ------------------
  |  |  114|  3.42k|#define OK        0
  ------------------
  940|  3.42k|}
ih264d_end_of_pic:
  956|  3.42k|{
  957|  3.42k|    dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice;
  958|  3.42k|    WORD32 ret;
  959|       |
  960|  3.42k|    {
  961|  3.42k|        dec_err_status_t * ps_err = ps_dec->ps_dec_err_status;
  962|  3.42k|        if(ps_err->u1_err_flag & REJECT_CUR_PIC)
  ------------------
  |  |  601|  3.42k|#define REJECT_CUR_PIC    (0x01)
  ------------------
  |  Branch (962:12): [True: 0, False: 3.42k]
  ------------------
  963|      0|        {
  964|      0|            ih264d_err_pic_dispbuf_mgr(ps_dec);
  965|      0|            return ERROR_NEW_FRAME_EXPECTED;
  966|      0|        }
  967|  3.42k|    }
  968|       |
  969|  3.42k|    H264_MUTEX_LOCK(&ps_dec->process_disp_mutex);
  970|  3.42k|    ret = ih264d_end_of_pic_processing(ps_dec);
  971|  3.42k|    if(ret != OK)
  ------------------
  |  |  114|  3.42k|#define OK        0
  ------------------
  |  Branch (971:8): [True: 0, False: 3.42k]
  ------------------
  972|      0|        return ret;
  973|       |    /*--------------------------------------------------------------------*/
  974|       |    /* ih264d_decode_pic_order_cnt - calculate the Pic Order Cnt                    */
  975|       |    /* Needed to detect end of picture                                    */
  976|       |    /*--------------------------------------------------------------------*/
  977|       |
  978|  3.42k|    H264_MUTEX_UNLOCK(&ps_dec->process_disp_mutex);
  979|       |
  980|  3.42k|    return OK;
  ------------------
  |  |  114|  3.42k|#define OK        0
  ------------------
  981|  3.42k|}
ih264d_fix_error_in_dpb:
  997|  4.62k|{
  998|       |    /*--------------------------------------------------------------------*/
  999|       |    /* If there is common node in lt_list and st_list then delete it from */
 1000|       |    /* st_list                                                            */
 1001|       |    /*--------------------------------------------------------------------*/
 1002|  4.62k|    UWORD8 no_of_nodes_deleted = 0;
 1003|  4.62k|    UWORD8 lt_ref_num = ps_dec->ps_dpb_mgr->u1_num_lt_ref_bufs;
 1004|  4.62k|    struct dpb_info_t *ps_lt_curr_dpb = ps_dec->ps_dpb_mgr->ps_dpb_ht_head;
 1005|  5.69k|    while(lt_ref_num && ps_lt_curr_dpb)
  ------------------
  |  Branch (1005:11): [True: 1.07k, False: 4.62k]
  |  Branch (1005:25): [True: 1.07k, False: 0]
  ------------------
 1006|  1.07k|    {
 1007|  1.07k|        if(ps_dec->ps_dpb_mgr->ps_dpb_st_head
  ------------------
  |  Branch (1007:12): [True: 0, False: 1.07k]
  ------------------
 1008|      0|                && ((ps_lt_curr_dpb->s_bot_field.u1_reference_info
  ------------------
  |  Branch (1008:20): [True: 0, False: 0]
  ------------------
 1009|      0|                        | ps_lt_curr_dpb->s_top_field.u1_reference_info)
 1010|      0|                        == (IS_SHORT_TERM | IS_LONG_TERM)))
  ------------------
  |  |  596|      0|#define IS_SHORT_TERM  1
  ------------------
                                      == (IS_SHORT_TERM | IS_LONG_TERM)))
  ------------------
  |  |  597|      0|#define IS_LONG_TERM   2
  ------------------
 1011|      0|        {
 1012|      0|            struct dpb_info_t *ps_st_next_dpb = ps_dec->ps_dpb_mgr->ps_dpb_st_head;
 1013|      0|            struct dpb_info_t *ps_st_curr_dpb = ps_dec->ps_dpb_mgr->ps_dpb_st_head;
 1014|      0|            UWORD8 st_ref_num = ps_dec->ps_dpb_mgr->u1_num_st_ref_bufs;
 1015|      0|            while(st_ref_num && ps_st_curr_dpb)
  ------------------
  |  Branch (1015:19): [True: 0, False: 0]
  |  Branch (1015:33): [True: 0, False: 0]
  ------------------
 1016|      0|            {
 1017|      0|                if(ps_st_curr_dpb == ps_lt_curr_dpb)
  ------------------
  |  Branch (1017:20): [True: 0, False: 0]
  ------------------
 1018|      0|                {
 1019|      0|                    if(st_ref_num == ps_dec->ps_dpb_mgr->u1_num_st_ref_bufs)
  ------------------
  |  Branch (1019:24): [True: 0, False: 0]
  ------------------
 1020|      0|                    {
 1021|      0|                        ps_dec->ps_dpb_mgr->ps_dpb_st_head =
 1022|      0|                                ps_dec->ps_dpb_mgr->ps_dpb_st_head->ps_prev_short;
 1023|      0|                        ps_st_curr_dpb = ps_dec->ps_dpb_mgr->ps_dpb_st_head;
 1024|      0|                    }
 1025|      0|                    else
 1026|      0|                    {
 1027|      0|                        ps_st_next_dpb->ps_prev_short = ps_st_curr_dpb->ps_prev_short;
 1028|      0|                    }
 1029|      0|                    ps_dec->ps_dpb_mgr->u1_num_st_ref_bufs--;
 1030|      0|                    no_of_nodes_deleted++;
 1031|      0|                    break;
 1032|      0|                }
 1033|      0|                ps_st_next_dpb = ps_st_curr_dpb;
 1034|      0|                ps_st_curr_dpb = ps_st_curr_dpb->ps_prev_short;
 1035|      0|                st_ref_num--;
 1036|      0|            }
 1037|      0|        }
 1038|  1.07k|        ps_lt_curr_dpb = ps_lt_curr_dpb->ps_prev_long;
 1039|  1.07k|        lt_ref_num--;
 1040|  1.07k|    }
 1041|  4.62k|    return no_of_nodes_deleted;
 1042|  4.62k|}

ih264d_decode_spatial_direct:
   75|  6.39k|{
   76|  6.39k|    mv_pred_t s_mv_pred, *ps_mv;
   77|  6.39k|    UWORD32 u4_sub_mb_num;
   78|  6.39k|    UWORD8 u1_col_zero_flag, u1_direct_zero_pred_flag = 0;
   79|  6.39k|    UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
   80|  6.39k|    mv_pred_t *ps_mv_ntop_start;
   81|  6.39k|    mv_pred_t *ps_mv_nmb_start = ps_dec->ps_mv_cur + (u4_mb_num << 4);
   82|  6.39k|    UWORD8 partition_size, sub_partition, u1_mb_partw, u1_mb_parth;
   83|  6.39k|    UWORD8 i;
   84|  6.39k|    WORD8 i1_pred, i1_ref_frame0, i1_ref_frame1;
   85|  6.39k|    struct pic_buffer_t *ps_ref_frame = NULL, *ps_col_pic, *ps_pic_buff0 = NULL,
   86|  6.39k|                    *ps_pic_buff1 = NULL;
   87|       |
   88|  6.39k|    UWORD8 u1_zero_pred_cond_f, u1_zero_pred_cond_b;
   89|  6.39k|    WORD16 i2_def_mv[2], i2_spat_pred_mv[4], *pi2_final_mv0, *pi2_final_mv1;
   90|  6.39k|    UWORD16 ui2_mask_fwd = 0, ui2_mask_bwd = 0, u2_mask = 0;
   91|  6.39k|    UWORD32 *pui32_weight_ofsts = NULL;
   92|  6.39k|    directmv_t s_mvdirect;
   93|  6.39k|    UWORD8 u1_colz;
   94|  6.39k|    UWORD8 u1_final_ref_idx = 0;
   95|  6.39k|    const UWORD8 *pu1_mb_parth = (const UWORD8 *)gau1_ih264d_mb_parth;
   96|  6.39k|    const UWORD8 *pu1_mb_partw = (const UWORD8 *)gau1_ih264d_mb_partw;
   97|  6.39k|    const UWORD16 sub_mask_table[] =
   98|  6.39k|        { 0x33, 0x3, 0x11, 0x1 };
   99|  6.39k|    const UWORD16 mask_table[] =
  100|  6.39k|        { 0xffff, /*16x16 NA */
  101|  6.39k|          0xff, /* 16x8*/
  102|  6.39k|          0x3333, /* 8x16*/
  103|  6.39k|          0x33 };/* 8x8*/
  104|  6.39k|    mv_pred_t s_temp_mv_pred;
  105|  6.39k|    WORD32 ret = 0;
  106|       |
  107|       |    /* CHANGED CODE */
  108|  6.39k|    ps_mv_ntop_start = ps_dec->ps_mv_cur + (u4_mb_num << 4)
  109|  6.39k|                    - (ps_dec->u2_frm_wd_in_mbs << (4 + u1_mbaff)) + 12;
  110|       |
  111|       |    /* assign default values for MotionVector as zero */
  112|  6.39k|    i2_def_mv[0] = 0;
  113|  6.39k|    i2_def_mv[1] = 0;
  114|       |
  115|  6.39k|    u1_direct_zero_pred_flag = ps_dec->pf_mvpred(ps_dec, ps_cur_mb_info, ps_mv_nmb_start,
  116|  6.39k|                                              ps_mv_ntop_start, &s_mv_pred, 0, 4,
  117|  6.39k|                                              0, 1, B_DIRECT_SPATIAL);
  ------------------
  |  |  489|  6.39k|#define B_DIRECT_SPATIAL  26
  ------------------
  118|       |
  119|  6.39k|    i2_spat_pred_mv[0] = s_mv_pred.i2_mv[0];
  120|  6.39k|    i2_spat_pred_mv[1] = s_mv_pred.i2_mv[1];
  121|  6.39k|    i2_spat_pred_mv[2] = s_mv_pred.i2_mv[2];
  122|  6.39k|    i2_spat_pred_mv[3] = s_mv_pred.i2_mv[3];
  123|       |
  124|  6.39k|    i1_ref_frame0 = s_mv_pred.i1_ref_frame[0];
  125|  6.39k|    i1_ref_frame1 = s_mv_pred.i1_ref_frame[1];
  126|       |
  127|  6.39k|    i1_ref_frame0 = (i1_ref_frame0 < 0) ? -1 : i1_ref_frame0;
  ------------------
  |  Branch (127:21): [True: 209, False: 6.19k]
  ------------------
  128|  6.39k|    i1_ref_frame1 = (i1_ref_frame1 < 0) ? -1 : i1_ref_frame1;
  ------------------
  |  Branch (128:21): [True: 148, False: 6.25k]
  ------------------
  129|       |
  130|  6.39k|    i1_pred = 0;
  131|       |
  132|  6.39k|    {
  133|  6.39k|        WORD8 u1_ref_idx, u1_ref_idx1;
  134|  6.39k|        UWORD32 uc_Idx, uc_Idx1;
  135|  6.39k|        UWORD8 u1_scale_ref = (ps_dec->ps_cur_slice->u1_mbaff_frame_flag
  ------------------
  |  Branch (135:32): [True: 0, False: 6.39k]
  ------------------
  136|      0|                        && ps_cur_mb_info->u1_mb_field_decodingflag);
  ------------------
  |  Branch (136:28): [True: 0, False: 0]
  ------------------
  137|  6.39k|        u1_final_ref_idx = i1_ref_frame0;
  138|  6.39k|        if(i1_ref_frame0 >= 0)
  ------------------
  |  Branch (138:12): [True: 6.19k, False: 209]
  ------------------
  139|  6.19k|        {
  140|       |            /* convert RefIdx if it is MbAff */
  141|  6.19k|            u1_ref_idx = i1_ref_frame0;
  142|  6.19k|            u1_ref_idx1 = i1_ref_frame0;
  143|  6.19k|            if(u1_scale_ref)
  ------------------
  |  Branch (143:16): [True: 0, False: 6.19k]
  ------------------
  144|      0|            {
  145|      0|                u1_ref_idx1 = u1_ref_idx >> 1;
  146|      0|                if((u1_ref_idx & 0x01) != (1 - ps_cur_mb_info->u1_topmb))
  ------------------
  |  Branch (146:20): [True: 0, False: 0]
  ------------------
  147|      0|                    u1_ref_idx1 += MAX_REF_BUFS;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  148|      0|            }
  149|       |            /* If i1_ref_frame0 < 0 then refIdxCol is obtained from ps_pic_buff1 */
  150|  6.19k|            ps_pic_buff0 = ps_dec->ps_ref_pic_buf_lx[0][u1_ref_idx1];
  151|  6.19k|            ps_ref_frame = ps_pic_buff0;
  152|  6.19k|            i1_pred = PRED_L0;
  ------------------
  |  |  483|  6.19k|#define PRED_L0   1
  ------------------
  153|  6.19k|        }
  154|       |
  155|  6.39k|        if(i1_ref_frame1 >= 0)
  ------------------
  |  Branch (155:12): [True: 6.25k, False: 148]
  ------------------
  156|  6.25k|        {
  157|       |            /* convert RefIdx if it is MbAff */
  158|  6.25k|            u1_ref_idx = i1_ref_frame1;
  159|  6.25k|            u1_ref_idx1 = i1_ref_frame1;
  160|  6.25k|            if(u1_scale_ref)
  ------------------
  |  Branch (160:16): [True: 0, False: 6.25k]
  ------------------
  161|      0|            {
  162|      0|                u1_ref_idx1 = u1_ref_idx >> 1;
  163|      0|                if((u1_ref_idx & 0x01) != (1 - ps_cur_mb_info->u1_topmb))
  ------------------
  |  Branch (163:20): [True: 0, False: 0]
  ------------------
  164|      0|                    u1_ref_idx1 += MAX_REF_BUFS;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  165|      0|            }
  166|  6.25k|            ps_pic_buff1 = ps_dec->ps_ref_pic_buf_lx[1][u1_ref_idx1];
  167|  6.25k|            i1_pred = i1_pred | PRED_L1;
  ------------------
  |  |  484|  6.25k|#define PRED_L1   2
  ------------------
  168|  6.25k|        }
  169|  6.39k|        if(i1_ref_frame0 < 0)
  ------------------
  |  Branch (169:12): [True: 209, False: 6.19k]
  ------------------
  170|    209|        {
  171|    209|            ps_ref_frame = ps_pic_buff1;
  172|    209|            u1_final_ref_idx = i1_ref_frame1;
  173|    209|        }
  174|       |
  175|  6.39k|        u1_zero_pred_cond_f = (u1_direct_zero_pred_flag) || (i1_ref_frame0 < 0);
  ------------------
  |  Branch (175:31): [True: 340, False: 6.05k]
  |  Branch (175:61): [True: 209, False: 5.85k]
  ------------------
  176|  6.39k|        u1_zero_pred_cond_b = (u1_direct_zero_pred_flag) || (i1_ref_frame1 < 0);
  ------------------
  |  Branch (176:31): [True: 340, False: 6.05k]
  |  Branch (176:61): [True: 148, False: 5.91k]
  ------------------
  177|       |
  178|  6.39k|        if(ps_dec->ps_cur_pps->u1_wted_bipred_idc)
  ------------------
  |  Branch (178:12): [True: 2.49k, False: 3.90k]
  ------------------
  179|  2.49k|        {
  180|  2.49k|            uc_Idx = ((i1_ref_frame0 < 1) ? 0 : i1_ref_frame0)
  ------------------
  |  Branch (180:23): [True: 2.49k, False: 0]
  ------------------
  181|  2.49k|                            * ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1];
  182|  2.49k|            if(u1_scale_ref)
  ------------------
  |  Branch (182:16): [True: 0, False: 2.49k]
  ------------------
  183|      0|                uc_Idx >>= 1;
  184|  2.49k|            uc_Idx1 = (i1_ref_frame1 < 0) ? 0 : i1_ref_frame1;
  ------------------
  |  Branch (184:23): [True: 0, False: 2.49k]
  ------------------
  185|  2.49k|            uc_Idx += (u1_scale_ref) ? (uc_Idx1 >> 1) : uc_Idx1;
  ------------------
  |  Branch (185:23): [True: 0, False: 2.49k]
  ------------------
  186|  2.49k|            pui32_weight_ofsts =
  187|  2.49k|                            (UWORD32*)&ps_dec->pu4_wt_ofsts[2 * X3(uc_Idx)];
  ------------------
  |  |   92|  2.49k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  188|       |
  189|  2.49k|            if(i1_ref_frame0 < 0)
  ------------------
  |  Branch (189:16): [True: 6, False: 2.48k]
  ------------------
  190|      6|                pui32_weight_ofsts += 1;
  191|       |
  192|  2.49k|            if(u1_scale_ref && (ps_dec->ps_cur_pps->u1_wted_bipred_idc == 2))
  ------------------
  |  Branch (192:16): [True: 0, False: 2.49k]
  |  Branch (192:32): [True: 0, False: 0]
  ------------------
  193|      0|            {
  194|      0|                WORD16 i2_ref_idx;
  195|      0|                i2_ref_idx = MAX(i1_ref_frame0, 0);
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  196|      0|                i2_ref_idx *= (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1]
  197|      0|                                << 1);
  198|      0|                i2_ref_idx += MAX(i1_ref_frame1, 0);
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  199|      0|                if(!ps_cur_mb_info->u1_topmb)
  ------------------
  |  Branch (199:20): [True: 0, False: 0]
  ------------------
  200|      0|                    i2_ref_idx +=
  201|      0|                                    (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0]
  202|      0|                                                    << 1)
  203|      0|                                                    * (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1]
  204|      0|                                                                    << 1);
  205|      0|                pui32_weight_ofsts = (UWORD32*)&ps_dec->pu4_mbaff_wt_mat[2
  206|      0|                                * X3(i2_ref_idx)];
  ------------------
  |  |   92|      0|#define X3(a)   (((a) << 1) + (a))
  ------------------
  207|      0|            }
  208|  2.49k|        }
  209|  6.39k|    }
  210|       |
  211|  6.39k|    s_temp_mv_pred.i1_ref_frame[0] = i1_ref_frame0;
  212|  6.39k|    s_temp_mv_pred.i1_ref_frame[1] = i1_ref_frame1;
  213|  6.39k|    s_temp_mv_pred.u1_col_ref_pic_idx = ps_ref_frame->u1_mv_buf_id;
  214|  6.39k|    s_temp_mv_pred.u1_pic_type = ps_ref_frame->u1_pic_type;
  215|       |
  216|       |    /**********************************************************************/
  217|       |    /* Call the function which gets the number of partitions and          */
  218|       |    /* partition info of colocated Mb                                     */
  219|       |    /**********************************************************************/
  220|       |
  221|  6.39k|    ps_dec->pf_parse_mvdirect(ps_dec, ps_dec->ps_col_pic, &s_mvdirect, u1_wd_x,
  222|  6.39k|                           ps_dec->i4_submb_ofst, ps_cur_mb_info);
  223|  6.39k|    ps_col_pic = ps_dec->ps_col_pic;
  224|  6.39k|    if((s_mvdirect.u1_col_zeroflag_change == 0) || u1_direct_zero_pred_flag)
  ------------------
  |  Branch (224:8): [True: 6.24k, False: 152]
  |  Branch (224:52): [True: 1, False: 151]
  ------------------
  225|  6.24k|    {
  226|  6.24k|        WORD16 i2_mv_x, i2_mv_y, i2_mvX1, i2_mvY1;
  227|       |        /* Most probable case */
  228|  6.24k|        u1_col_zero_flag = *(ps_col_pic->pu1_col_zero_flag
  229|  6.24k|                        + s_mvdirect.i4_mv_indices[0]);
  230|  6.24k|        u1_col_zero_flag = u1_col_zero_flag & 0x01;
  231|       |
  232|  6.24k|        if(u1_zero_pred_cond_f || ((i1_ref_frame0 == 0) && (u1_col_zero_flag == 1)))
  ------------------
  |  Branch (232:12): [True: 535, False: 5.71k]
  |  Branch (232:36): [True: 5.71k, False: 0]
  |  Branch (232:60): [True: 3.30k, False: 2.40k]
  ------------------
  233|  3.84k|        {
  234|  3.84k|            i2_mv_x = 0;
  235|  3.84k|            i2_mv_y = 0;
  236|  3.84k|        }
  237|  2.40k|        else
  238|  2.40k|        {
  239|  2.40k|            i2_mv_x = i2_spat_pred_mv[0];
  240|  2.40k|            i2_mv_y = i2_spat_pred_mv[1];
  241|       |
  242|  2.40k|        }
  243|       |
  244|  6.24k|        if(u1_zero_pred_cond_b || ((i1_ref_frame1 == 0) && (u1_col_zero_flag == 1)))
  ------------------
  |  Branch (244:12): [True: 482, False: 5.76k]
  |  Branch (244:36): [True: 5.76k, False: 0]
  |  Branch (244:60): [True: 3.31k, False: 2.45k]
  ------------------
  245|  3.79k|        {
  246|  3.79k|            i2_mvX1 = 0;
  247|  3.79k|            i2_mvY1 = 0;
  248|  3.79k|        }
  249|  2.45k|        else
  250|  2.45k|        {
  251|  2.45k|            i2_mvX1 = i2_spat_pred_mv[2];
  252|  2.45k|            i2_mvY1 = i2_spat_pred_mv[3];
  253|  2.45k|        }
  254|       |
  255|  6.24k|        u4_sub_mb_num = ps_dec->u1_sub_mb_num;
  256|  6.24k|        u1_mb_partw = (u1_wd_x >> 2);
  257|       |
  258|       |
  259|  6.24k|        if(i1_ref_frame0 >= 0)
  ------------------
  |  Branch (259:12): [True: 6.05k, False: 195]
  ------------------
  260|  6.05k|        {
  261|  6.05k|            {
  262|  6.05k|               pred_info_pkd_t *ps_pred_pkd;
  263|  6.05k|               WORD16 i2_mv[2];
  264|  6.05k|               WORD8 i1_ref_idx= 0;
  265|       |
  266|  6.05k|               i2_mv[0] = i2_mv_x;
  267|  6.05k|               i2_mv[1] = i2_mv_y;
  268|       |
  269|  6.05k|               ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  270|  6.05k|            ih264d_fill_pred_info(i2_mv,u1_mb_partw,u1_mb_partw,u4_sub_mb_num,i1_pred,
  271|  6.05k|                            ps_pred_pkd,ps_pic_buff0->u1_pic_buf_id,i1_ref_idx,pui32_weight_ofsts,
  272|  6.05k|                            ps_pic_buff0->u1_pic_type);
  273|  6.05k|            ps_dec->u4_pred_info_pkd_idx++;
  274|  6.05k|            ps_cur_mb_info->u1_num_pred_parts++;
  275|       |
  276|       |
  277|  6.05k|            }
  278|       |
  279|  6.05k|        }
  280|       |
  281|  6.24k|        if(i1_ref_frame1 >= 0)
  ------------------
  |  Branch (281:12): [True: 6.10k, False: 142]
  ------------------
  282|  6.10k|        {
  283|  6.10k|            {
  284|  6.10k|                pred_info_pkd_t *ps_pred_pkd;
  285|  6.10k|               WORD16 i2_mv[2];
  286|  6.10k|               WORD8 i1_ref_idx= 0;
  287|       |
  288|  6.10k|               i2_mv[0] = i2_mvX1;
  289|  6.10k|               i2_mv[1] = i2_mvY1;
  290|       |
  291|  6.10k|               ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  292|  6.10k|            ih264d_fill_pred_info(i2_mv,u1_mb_partw,u1_mb_partw,u4_sub_mb_num,i1_pred,
  293|  6.10k|                            ps_pred_pkd,ps_pic_buff1->u1_pic_buf_id,i1_ref_idx,pui32_weight_ofsts,
  294|  6.10k|                            ps_pic_buff1->u1_pic_type);
  295|  6.10k|            ps_dec->u4_pred_info_pkd_idx++;
  296|  6.10k|            ps_cur_mb_info->u1_num_pred_parts++;
  297|       |
  298|       |
  299|  6.10k|            }
  300|  6.10k|        }
  301|       |
  302|       |
  303|       |        /* Replication optimisation */
  304|  6.24k|        s_temp_mv_pred.i2_mv[0] = i2_mv_x;
  305|  6.24k|        s_temp_mv_pred.i2_mv[1] = i2_mv_y;
  306|  6.24k|        s_temp_mv_pred.i2_mv[2] = i2_mvX1;
  307|  6.24k|        s_temp_mv_pred.i2_mv[3] = i2_mvY1;
  308|       |
  309|       |        /* Calculating colocated zero information */
  310|  6.24k|        {
  311|       |            /*************************************/
  312|       |            /* If(bit2 and bit3 set)             */
  313|       |            /* then                              */
  314|       |            /*  (bit0 and bit1) => submmbmode    */
  315|       |            /*  (bit2 and bit3) => mbmode        */
  316|       |            /* else                              */
  317|       |            /*  (bit0 and bit1) => mbmode        */
  318|       |            /*************************************/
  319|       |            /*UWORD8 u1_packed_mb_sub_mb_mode = sub_partition ?
  320|       |             (s_mvdirect.i1_partitionsize[0]) : ((s_mvdirect.i1_partitionsize[0]) << 2);*/
  321|  6.24k|            UWORD8 u1_packed_mb_sub_mb_mode = (u1_mb_partw == 2) ? 0x03 : 0;
  ------------------
  |  Branch (321:47): [True: 465, False: 5.78k]
  ------------------
  322|       |
  323|  6.24k|            if(i1_ref_frame0 < 0)
  ------------------
  |  Branch (323:16): [True: 195, False: 6.05k]
  ------------------
  324|    195|            {
  325|    195|                i2_mv_x = i2_mvX1;
  326|    195|                i2_mv_y = i2_mvY1;
  327|    195|            }
  328|       |
  329|       |            /* Change from left shift 4 to 6 - Varun */
  330|  6.24k|            u1_colz = (ps_cur_mb_info->u1_mb_field_decodingflag << 1)
  331|  6.24k|                            | ((u1_final_ref_idx == 0) && (ABS(i2_mv_x) <= 1)
  ------------------
  |  |  100|  6.24k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 368, False: 5.88k]
  |  |  ------------------
  ------------------
  |  Branch (331:32): [True: 6.24k, False: 0]
  |  Branch (331:59): [True: 5.78k, False: 463]
  ------------------
  332|  5.78k|                                            && (ABS(i2_mv_y) <= 1));
  ------------------
  |  |  100|  5.78k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 198, False: 5.58k]
  |  |  ------------------
  ------------------
  |  Branch (332:48): [True: 5.56k, False: 216]
  ------------------
  333|  6.24k|            u1_colz |= (u1_packed_mb_sub_mb_mode << 6);
  334|  6.24k|        }
  335|  6.24k|        ps_mv = ps_mv_nmb_start + u4_sub_mb_num;
  336|  6.24k|        ih264d_rep_mv_colz(ps_dec, &s_temp_mv_pred, ps_mv, u4_sub_mb_num, u1_colz,
  337|  6.24k|                           u1_mb_partw, u1_mb_partw);
  338|  6.24k|        if(u1_wd_x == MB_SIZE)
  ------------------
  |  |  554|  6.24k|#define MB_SIZE             16
  ------------------
  |  Branch (338:12): [True: 5.78k, False: 465]
  ------------------
  339|  5.78k|            ps_dec->u1_currB_type = 0;
  340|       |
  341|       |
  342|       |
  343|  6.24k|        return OK;
  ------------------
  |  |  114|  6.24k|#define OK        0
  ------------------
  344|  6.24k|    }
  345|       |    /***************************************************************************/
  346|       |    /* If present MB is 16x16 and the partition of colocated Mb is >= PRED_8x8 */
  347|       |    /* i.e 8x8 or less than 8x8 partitions then set up DMA for (0,0) and       */
  348|       |    /* spatially predicted motion vector and do the multiplexing after         */
  349|       |    /* motion compensation                                                     */
  350|       |    /***************************************************************************/
  351|       |
  352|       |
  353|    151|    if((u1_wd_x == MB_SIZE) && (s_mvdirect.i1_num_partitions > 2))
  ------------------
  |  |  554|    151|#define MB_SIZE             16
  ------------------
  |  Branch (353:8): [True: 150, False: 1]
  |  Branch (353:32): [True: 60, False: 90]
  ------------------
  354|     60|    {
  355|     60|        ps_cur_mb_info->u1_Mux = 1;
  356|     60|        if(i1_ref_frame0 >= 0)
  ------------------
  |  Branch (356:12): [True: 58, False: 2]
  ------------------
  357|     58|        {
  358|       |
  359|     58|            {
  360|     58|                pred_info_pkd_t *ps_pred_pkd;
  361|     58|               WORD8 i1_ref_idx= 0;
  362|       |
  363|     58|               ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  364|     58|            ih264d_fill_pred_info(&(i2_spat_pred_mv[0]),4,4,0,i1_pred,
  365|     58|                            ps_pred_pkd,ps_pic_buff0->u1_pic_buf_id,i1_ref_idx,pui32_weight_ofsts,
  366|     58|                            ps_pic_buff0->u1_pic_type);
  367|     58|            ps_dec->u4_pred_info_pkd_idx++;
  368|     58|            ps_cur_mb_info->u1_num_pred_parts++;
  369|       |
  370|       |
  371|     58|            }
  372|       |
  373|       |            /******    (0,0) Motion vectors DMA     *****/
  374|     58|            {
  375|     58|                pred_info_pkd_t *ps_pred_pkd;
  376|     58|               WORD16 i2_mv[2];
  377|     58|               WORD8 i1_ref_idx= 0;
  378|       |
  379|     58|               i2_mv[0] = 0;
  380|     58|               i2_mv[1] = 0;
  381|       |
  382|     58|               ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  383|     58|            ih264d_fill_pred_info(i2_mv,4,4,0,i1_pred,
  384|     58|                            ps_pred_pkd,ps_pic_buff0->u1_pic_buf_id,i1_ref_idx,pui32_weight_ofsts,
  385|     58|                            ps_pic_buff0->u1_pic_type);
  386|     58|            ps_dec->u4_pred_info_pkd_idx++;
  387|     58|            ps_cur_mb_info->u1_num_pred_parts++;
  388|       |
  389|       |
  390|     58|            }
  391|     58|        }
  392|     60|        if(i1_ref_frame1 >= 0)
  ------------------
  |  Branch (392:12): [True: 57, False: 3]
  ------------------
  393|     57|        {
  394|     57|            {
  395|     57|                pred_info_pkd_t *ps_pred_pkd;
  396|     57|               WORD16 i2_mv[2];
  397|     57|               WORD8 i1_ref_idx= 0;
  398|       |
  399|     57|               ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  400|     57|            ih264d_fill_pred_info(&(i2_spat_pred_mv[2]),4,4,0,i1_pred,
  401|     57|                            ps_pred_pkd,ps_pic_buff1->u1_pic_buf_id,i1_ref_idx,pui32_weight_ofsts,
  402|     57|                            ps_pic_buff1->u1_pic_type);
  403|     57|            ps_dec->u4_pred_info_pkd_idx++;
  404|     57|            ps_cur_mb_info->u1_num_pred_parts++;
  405|       |
  406|       |
  407|     57|            }
  408|       |
  409|       |            /******    (0,0) Motion vectors DMA     *****/
  410|       |
  411|     57|            {
  412|     57|                pred_info_pkd_t *ps_pred_pkd;
  413|     57|               WORD16 i2_mv[2];
  414|     57|               WORD8 i1_ref_idx= 0;
  415|       |
  416|     57|               i2_mv[0] = 0;
  417|     57|               i2_mv[1] = 0;
  418|       |
  419|     57|               ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  420|     57|            ih264d_fill_pred_info(i2_mv,4,4,0,i1_pred,
  421|     57|                            ps_pred_pkd,ps_pic_buff1->u1_pic_buf_id,i1_ref_idx,pui32_weight_ofsts,
  422|     57|                            ps_pic_buff1->u1_pic_type);
  423|     57|            ps_dec->u4_pred_info_pkd_idx++;
  424|     57|            ps_cur_mb_info->u1_num_pred_parts++;
  425|       |
  426|       |
  427|     57|            }
  428|     57|        }
  429|     60|    }
  430|       |
  431|       |    /*u1_col = *(ps_col_pic->pu1_col_zero_flag + s_mvdirect.i4_mv_indices[0]);
  432|       |     u1_col &= 1;
  433|       |     u1_init = 0;*/
  434|       |
  435|    575|    for(i = 0; i < s_mvdirect.i1_num_partitions; i++)
  ------------------
  |  Branch (435:16): [True: 424, False: 151]
  ------------------
  436|    424|    {
  437|    424|        partition_size = s_mvdirect.i1_partitionsize[i];
  438|    424|        u4_sub_mb_num = s_mvdirect.i1_submb_num[i];
  439|       |
  440|    424|        sub_partition = partition_size >> 2;
  441|    424|        partition_size &= 0x3;
  442|    424|        u1_mb_partw = pu1_mb_partw[partition_size];
  443|    424|        u1_mb_parth = pu1_mb_parth[partition_size];
  444|    424|        u2_mask = mask_table[partition_size];
  445|    424|        if(sub_partition != 0)
  ------------------
  |  Branch (445:12): [True: 11, False: 413]
  ------------------
  446|     11|        {
  447|     11|            u1_mb_partw >>= 1;
  448|     11|            u1_mb_parth >>= 1;
  449|     11|            u2_mask = sub_mask_table[partition_size];
  450|     11|        }
  451|       |
  452|    424|        u1_col_zero_flag = *(ps_col_pic->pu1_col_zero_flag
  453|    424|                        + s_mvdirect.i4_mv_indices[i]);
  454|    424|        u1_col_zero_flag = u1_col_zero_flag & 0x01;
  455|       |
  456|       |        /*if(u1_col != u1_col_zero_flag)
  457|       |         u1_init = 1;*/
  458|       |
  459|    424|        if(u1_zero_pred_cond_f || ((i1_ref_frame0 == 0) && (u1_col_zero_flag == 1)))
  ------------------
  |  Branch (459:12): [True: 32, False: 392]
  |  Branch (459:36): [True: 392, False: 0]
  |  Branch (459:60): [True: 171, False: 221]
  ------------------
  460|    203|        {
  461|    203|            pi2_final_mv0 = &i2_def_mv[0];
  462|    203|            ui2_mask_fwd |= (u2_mask << u4_sub_mb_num);
  463|    203|        }
  464|    221|        else
  465|    221|            pi2_final_mv0 = &i2_spat_pred_mv[0];
  466|       |
  467|    424|        if(u1_zero_pred_cond_b || ((i1_ref_frame1 == 0) && (u1_col_zero_flag == 1)))
  ------------------
  |  Branch (467:12): [True: 18, False: 406]
  |  Branch (467:36): [True: 406, False: 0]
  |  Branch (467:60): [True: 179, False: 227]
  ------------------
  468|    197|        {
  469|    197|            pi2_final_mv1 = &i2_def_mv[0];
  470|    197|            ui2_mask_bwd |= (u2_mask << u4_sub_mb_num);
  471|    197|        }
  472|    227|        else
  473|    227|            pi2_final_mv1 = &i2_spat_pred_mv[2];
  474|       |
  475|    424|        if(ps_cur_mb_info->u1_Mux != 1)
  ------------------
  |  Branch (475:12): [True: 181, False: 243]
  ------------------
  476|    181|        {
  477|       |            /*u1_sub_mb_x = u4_sub_mb_num & 0x03;
  478|       |             uc_sub_mb_y = (u4_sub_mb_num >> 2);*/
  479|    181|            if(i1_ref_frame0 >= 0)
  ------------------
  |  Branch (479:16): [True: 157, False: 24]
  ------------------
  480|    157|            {
  481|       |
  482|    157|                {
  483|    157|                    pred_info_pkd_t *ps_pred_pkd;
  484|    157|                   WORD8 i1_ref_idx= 0;
  485|       |
  486|    157|                   ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  487|    157|                ih264d_fill_pred_info(pi2_final_mv0,u1_mb_partw,u1_mb_parth,u4_sub_mb_num,i1_pred,
  488|    157|                                ps_pred_pkd,ps_pic_buff0->u1_pic_buf_id,i1_ref_idx,pui32_weight_ofsts,
  489|    157|                                ps_pic_buff0->u1_pic_type);
  490|    157|                ps_dec->u4_pred_info_pkd_idx++;
  491|    157|                ps_cur_mb_info->u1_num_pred_parts++;
  492|       |
  493|       |
  494|    157|                }
  495|       |
  496|    157|            }
  497|       |
  498|    181|            if(i1_ref_frame1 >= 0)
  ------------------
  |  Branch (498:16): [True: 175, False: 6]
  ------------------
  499|    175|            {
  500|    175|                {
  501|    175|                    pred_info_pkd_t *ps_pred_pkd;
  502|    175|                   WORD8 i1_ref_idx= 0;
  503|       |
  504|    175|                   ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  505|    175|                ih264d_fill_pred_info(pi2_final_mv1,u1_mb_partw,u1_mb_parth,u4_sub_mb_num,i1_pred,
  506|    175|                                ps_pred_pkd,ps_pic_buff1->u1_pic_buf_id,i1_ref_idx,pui32_weight_ofsts,
  507|    175|                                ps_pic_buff1->u1_pic_type);
  508|    175|                ps_dec->u4_pred_info_pkd_idx++;
  509|    175|                ps_cur_mb_info->u1_num_pred_parts++;
  510|       |
  511|       |
  512|    175|                }
  513|    175|            }
  514|    181|        }
  515|       |
  516|       |        /* Replication optimisation */
  517|    424|        s_temp_mv_pred.i2_mv[0] = pi2_final_mv0[0];
  518|    424|        s_temp_mv_pred.i2_mv[1] = pi2_final_mv0[1];
  519|    424|        s_temp_mv_pred.i2_mv[2] = pi2_final_mv1[0];
  520|    424|        s_temp_mv_pred.i2_mv[3] = pi2_final_mv1[1];
  521|       |
  522|       |        /* Calculating colocated zero information */
  523|    424|        {
  524|    424|            WORD16 i2_mv_x = 0, i2_mv_y = 0;
  525|       |            /*************************************/
  526|       |            /* If(bit2 and bit3 set)             */
  527|       |            /* then                              */
  528|       |            /*  (bit0 and bit1) => submmbmode    */
  529|       |            /*  (bit2 and bit3) => mbmode        */
  530|       |            /* else                              */
  531|       |            /*  (bit0 and bit1) => mbmode        */
  532|       |            /*************************************/
  533|    424|            UWORD8 u1_packed_mb_sub_mb_mode =
  534|    424|                            sub_partition ? (s_mvdirect.i1_partitionsize[i]) : ((s_mvdirect.i1_partitionsize[i])
  ------------------
  |  Branch (534:29): [True: 11, False: 413]
  ------------------
  535|    413|                                                            << 2);
  536|       |
  537|    424|            if(i1_ref_frame0 >= 0)
  ------------------
  |  Branch (537:16): [True: 392, False: 32]
  ------------------
  538|    392|            {
  539|    392|                i2_mv_x = pi2_final_mv0[0];
  540|    392|                i2_mv_y = pi2_final_mv0[1];
  541|    392|            }
  542|     32|            else
  543|     32|            {
  544|     32|                i2_mv_x = pi2_final_mv1[0];
  545|     32|                i2_mv_y = pi2_final_mv1[1];
  546|     32|            }
  547|       |
  548|    424|            u1_colz = (ps_cur_mb_info->u1_mb_field_decodingflag << 1)
  549|    424|                            | ((u1_final_ref_idx == 0) && (ABS(i2_mv_x) <= 1)
  ------------------
  |  |  100|    424|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 20, False: 404]
  |  |  ------------------
  ------------------
  |  Branch (549:32): [True: 424, False: 0]
  |  Branch (549:59): [True: 382, False: 42]
  ------------------
  550|    382|                                            && (ABS(i2_mv_y) <= 1));
  ------------------
  |  |  100|    382|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 8, False: 374]
  |  |  ------------------
  ------------------
  |  Branch (550:48): [True: 371, False: 11]
  ------------------
  551|    424|            u1_colz |= (u1_packed_mb_sub_mb_mode << 4);
  552|    424|        }
  553|    424|        ps_mv = ps_mv_nmb_start + u4_sub_mb_num;
  554|    424|        ih264d_rep_mv_colz(ps_dec, &s_temp_mv_pred, ps_mv, u4_sub_mb_num, u1_colz,
  555|    424|                           u1_mb_parth, u1_mb_partw);
  556|    424|    }
  557|    151|    i = 0;
  558|    151|    if(i1_ref_frame0 >= 0)
  ------------------
  |  Branch (558:8): [True: 137, False: 14]
  ------------------
  559|    137|        ps_cur_mb_info->u2_mask[i++] = ui2_mask_fwd;
  560|    151|    if(i1_ref_frame1 >= 0)
  ------------------
  |  Branch (560:8): [True: 145, False: 6]
  ------------------
  561|    145|        ps_cur_mb_info->u2_mask[i] = ui2_mask_bwd;
  562|       |
  563|       |    /*if(u1_init)
  564|       |     H264_DEC_DEBUG_PRINT("hit\n");
  565|       |     else
  566|       |     H264_DEC_DEBUG_PRINT("miss\n");*/
  567|       |
  568|    151|    return OK;
  ------------------
  |  |  114|    151|#define OK        0
  ------------------
  569|  6.39k|}
ih264d_decode_temporal_direct:
  587|  14.3k|{
  588|  14.3k|    struct pic_buffer_t *ps_pic_buff0, *ps_pic_buff1, *ps_col_pic;
  589|  14.3k|    mv_pred_t *ps_mv, s_temp_mv_pred;
  590|  14.3k|    UWORD32 u4_sub_mb_num;
  591|  14.3k|    UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  592|  14.3k|    WORD16 i2_mv_x0, i2_mv_y0, i2_mv_x1, i2_mv_y1;
  593|  14.3k|    UWORD8 u1_mb_partw, u1_mb_parth;
  594|  14.3k|    UWORD8 i, partition_size, sub_partition;
  595|  14.3k|    UWORD32 *pui32_weight_ofsts = NULL;
  596|  14.3k|    directmv_t s_mvdirect;
  597|  14.3k|    const UWORD8 *pu1_mb_parth = (const UWORD8 *)gau1_ih264d_mb_parth;
  598|  14.3k|    const UWORD8 *pu1_mb_partw = (const UWORD8 *)gau1_ih264d_mb_partw;
  599|  14.3k|    WORD8 c_refFrm0, c_refFrm1;
  600|  14.3k|    UWORD8 u1_ref_idx0, u1_is_cur_mb_fld;
  601|  14.3k|    WORD32 pic0_poc, pic1_poc, cur_poc;
  602|  14.3k|    WORD32 ret = 0;
  603|       |
  604|  14.3k|    u1_is_cur_mb_fld = ps_cur_mb_info->u1_mb_field_decodingflag;
  605|  14.3k|    ps_pic_buff1 = ps_dec->ps_ref_pic_buf_lx[1][0];
  606|       |
  607|       |    /**********************************************************************/
  608|       |    /* Call the function which gets the number of partitions and          */
  609|       |    /* partition info of colocated Mb                                     */
  610|       |    /**********************************************************************/
  611|  14.3k|    ps_dec->pf_parse_mvdirect(ps_dec, ps_dec->ps_col_pic, &s_mvdirect, u1_wd_x,
  612|  14.3k|                           ps_dec->i4_submb_ofst, ps_cur_mb_info);
  613|  14.3k|    ps_col_pic = ps_dec->ps_col_pic;
  614|       |
  615|  29.7k|    for(i = 0; i < s_mvdirect.i1_num_partitions; i++)
  ------------------
  |  Branch (615:16): [True: 15.4k, False: 14.3k]
  ------------------
  616|  15.4k|    {
  617|  15.4k|        UWORD8 u1_colz;
  618|  15.4k|        partition_size = s_mvdirect.i1_partitionsize[i];
  619|  15.4k|        u4_sub_mb_num = s_mvdirect.i1_submb_num[i];
  620|  15.4k|        ps_mv = ps_col_pic->ps_mv + s_mvdirect.i4_mv_indices[i];
  621|       |
  622|       |        /* This should be removed to catch unitialized memory read */
  623|  15.4k|        u1_ref_idx0 = 0;
  624|       |
  625|  15.4k|        sub_partition = partition_size >> 2;
  626|  15.4k|        partition_size &= 0x3;
  627|  15.4k|        u1_mb_partw = pu1_mb_partw[partition_size];
  628|  15.4k|        u1_mb_parth = pu1_mb_parth[partition_size];
  629|  15.4k|        if(sub_partition != 0)
  ------------------
  |  Branch (629:12): [True: 4.11k, False: 11.2k]
  ------------------
  630|  4.11k|        {
  631|  4.11k|            u1_mb_partw >>= 1;
  632|  4.11k|            u1_mb_parth >>= 1;
  633|  4.11k|        }
  634|  15.4k|        c_refFrm0 = ps_mv->i1_ref_frame[0];
  635|  15.4k|        c_refFrm1 = ps_mv->i1_ref_frame[1];
  636|       |
  637|  15.4k|        if((c_refFrm0 == -1) && (c_refFrm1 == -1))
  ------------------
  |  Branch (637:12): [True: 673, False: 14.7k]
  |  Branch (637:33): [True: 20, False: 653]
  ------------------
  638|     20|        {
  639|     20|            u1_ref_idx0 = 0;
  640|     20|            ps_pic_buff0 = ps_dec->ps_ref_pic_buf_lx[0][0];
  641|     20|            if(u1_mbaff && u1_is_cur_mb_fld)
  ------------------
  |  Branch (641:16): [True: 0, False: 20]
  |  Branch (641:28): [True: 0, False: 0]
  ------------------
  642|      0|            {
  643|      0|                if(ps_cur_mb_info->u1_topmb)
  ------------------
  |  Branch (643:20): [True: 0, False: 0]
  ------------------
  644|      0|                {
  645|      0|                    pic0_poc = ps_pic_buff0->i4_top_field_order_cnt;
  646|      0|                    pic1_poc = ps_pic_buff1->i4_top_field_order_cnt;
  647|      0|                    cur_poc = ps_dec->ps_cur_pic->i4_top_field_order_cnt;
  648|      0|                }
  649|      0|                else
  650|      0|                {
  651|      0|                    pic1_poc = ps_pic_buff1->i4_bottom_field_order_cnt;
  652|      0|                    cur_poc = ps_dec->ps_cur_pic->i4_bottom_field_order_cnt;
  653|      0|                    ps_pic_buff1 = ps_dec->ps_ref_pic_buf_lx[1][MAX_REF_BUFS];
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  654|      0|                    pic0_poc = ps_pic_buff0->i4_bottom_field_order_cnt;
  655|      0|                    ps_pic_buff0 = ps_dec->ps_ref_pic_buf_lx[0][MAX_REF_BUFS];
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  656|      0|                }
  657|      0|            }
  658|     20|            else
  659|     20|            {
  660|     20|                pic0_poc = ps_pic_buff0->i4_avg_poc;
  661|     20|                pic1_poc = ps_pic_buff1->i4_avg_poc;
  662|     20|                cur_poc = ps_dec->ps_cur_pic->i4_poc;
  663|     20|            }
  664|     20|        }
  665|  15.3k|        else
  666|  15.3k|        {
  667|  15.3k|            UWORD8 uc_i, u1_num_frw_ref_pics;
  668|  15.3k|            UWORD8 buf_id, u1_pic_type;
  669|  15.3k|            buf_id = ps_mv->u1_col_ref_pic_idx;
  670|  15.3k|            u1_pic_type = ps_mv->u1_pic_type;
  671|  15.3k|            if(ps_dec->ps_cur_slice->u1_field_pic_flag)
  ------------------
  |  Branch (671:16): [True: 0, False: 15.3k]
  ------------------
  672|      0|            {
  673|      0|                if(s_mvdirect.u1_vert_mv_scale == FRM_TO_FLD)
  ------------------
  |  |   48|      0|#define FRM_TO_FLD    1
  ------------------
  |  Branch (673:20): [True: 0, False: 0]
  ------------------
  674|      0|                {
  675|      0|                    u1_pic_type = TOP_FLD;
  ------------------
  |  |  353|      0|#define TOP_FLD         0x01
  ------------------
  676|      0|                    if(ps_dec->ps_cur_slice->u1_bottom_field_flag)
  ------------------
  |  Branch (676:24): [True: 0, False: 0]
  ------------------
  677|      0|                        u1_pic_type = BOT_FLD;
  ------------------
  |  |  354|      0|#define BOT_FLD         0x02
  ------------------
  678|      0|                }
  679|      0|            }
  680|  15.3k|            u1_num_frw_ref_pics =
  681|  15.3k|                            ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0];
  682|       |
  683|  16.0k|            for(uc_i = 0; uc_i < u1_num_frw_ref_pics; uc_i++)
  ------------------
  |  Branch (683:27): [True: 15.4k, False: 582]
  ------------------
  684|  15.4k|            {
  685|  15.4k|                if(ps_dec->ps_cur_slice->u1_field_pic_flag)
  ------------------
  |  Branch (685:20): [True: 0, False: 15.4k]
  ------------------
  686|      0|                {
  687|      0|                    if(ps_dec->ps_ref_pic_buf_lx[0][uc_i]->u1_mv_buf_id == buf_id)
  ------------------
  |  Branch (687:24): [True: 0, False: 0]
  ------------------
  688|      0|                    {
  689|      0|                        if(ps_dec->ps_ref_pic_buf_lx[0][uc_i]->u1_pic_type
  ------------------
  |  Branch (689:28): [True: 0, False: 0]
  ------------------
  690|      0|                                        == u1_pic_type)
  691|      0|                        {
  692|      0|                            u1_ref_idx0 = uc_i;
  693|      0|                            break;
  694|      0|                        }
  695|      0|                    }
  696|      0|                }
  697|  15.4k|                else
  698|  15.4k|                {
  699|  15.4k|                    if(ps_dec->ps_ref_pic_buf_lx[0][uc_i]->u1_mv_buf_id == buf_id)
  ------------------
  |  Branch (699:24): [True: 14.8k, False: 628]
  ------------------
  700|  14.8k|                    {
  701|  14.8k|                        u1_ref_idx0 = uc_i;
  702|  14.8k|                        break;
  703|  14.8k|                    }
  704|  15.4k|                }
  705|  15.4k|            }
  706|       |
  707|  15.3k|            ps_pic_buff0 = ps_dec->ps_ref_pic_buf_lx[0][u1_ref_idx0];
  708|  15.3k|            ps_pic_buff1 = ps_dec->ps_ref_pic_buf_lx[1][0];
  709|       |
  710|  15.3k|            if(u1_mbaff && u1_is_cur_mb_fld)
  ------------------
  |  Branch (710:16): [True: 0, False: 15.3k]
  |  Branch (710:28): [True: 0, False: 0]
  ------------------
  711|      0|            {
  712|      0|                pic0_poc = ps_pic_buff0->i4_top_field_order_cnt;
  713|      0|                u1_ref_idx0 <<= 1;
  714|      0|                if(s_mvdirect.u1_vert_mv_scale == ONE_TO_ONE)
  ------------------
  |  |   47|      0|#define ONE_TO_ONE    0
  ------------------
  |  Branch (714:20): [True: 0, False: 0]
  ------------------
  715|      0|                {
  716|      0|                    if(u1_pic_type == BOT_FLD)
  ------------------
  |  |  354|      0|#define BOT_FLD         0x02
  ------------------
  |  Branch (716:24): [True: 0, False: 0]
  ------------------
  717|      0|                    {
  718|      0|                        pic0_poc = ps_pic_buff0->i4_bottom_field_order_cnt;
  719|      0|                        ps_pic_buff0 = ps_dec->ps_ref_pic_buf_lx[0][(u1_ref_idx0
  720|      0|                                        >> 1) + MAX_REF_BUFS];
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  721|      0|                        if(ps_cur_mb_info->u1_topmb)
  ------------------
  |  Branch (721:28): [True: 0, False: 0]
  ------------------
  722|      0|                            u1_ref_idx0++;
  723|      0|                    }
  724|      0|                    else
  725|      0|                    {
  726|      0|                        if(1 - ps_cur_mb_info->u1_topmb)
  ------------------
  |  Branch (726:28): [True: 0, False: 0]
  ------------------
  727|      0|                            u1_ref_idx0++;
  728|      0|                    }
  729|      0|                }
  730|      0|                if(s_mvdirect.u1_vert_mv_scale == FRM_TO_FLD)
  ------------------
  |  |   48|      0|#define FRM_TO_FLD    1
  ------------------
  |  Branch (730:20): [True: 0, False: 0]
  ------------------
  731|      0|                {
  732|      0|                    if(1 - ps_cur_mb_info->u1_topmb)
  ------------------
  |  Branch (732:24): [True: 0, False: 0]
  ------------------
  733|      0|                    {
  734|      0|                        pic0_poc = ps_pic_buff0->i4_bottom_field_order_cnt;
  735|      0|                        ps_pic_buff0 = ps_dec->ps_ref_pic_buf_lx[0][(u1_ref_idx0
  736|      0|                                        >> 1) + MAX_REF_BUFS];
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  737|      0|                    }
  738|      0|                }
  739|      0|                if(ps_cur_mb_info->u1_topmb)
  ------------------
  |  Branch (739:20): [True: 0, False: 0]
  ------------------
  740|      0|                {
  741|      0|                    pic1_poc = ps_pic_buff1->i4_top_field_order_cnt;
  742|      0|                    cur_poc = ps_dec->ps_cur_pic->i4_top_field_order_cnt;
  743|      0|                }
  744|      0|                else
  745|      0|                {
  746|      0|                    pic1_poc = ps_pic_buff1->i4_bottom_field_order_cnt;
  747|      0|                    cur_poc = ps_dec->ps_cur_pic->i4_bottom_field_order_cnt;
  748|      0|                    ps_pic_buff1 = ps_dec->ps_ref_pic_buf_lx[1][MAX_REF_BUFS];
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  749|      0|                }
  750|      0|            }
  751|  15.3k|            else
  752|  15.3k|            {
  753|  15.3k|                pic0_poc = ps_pic_buff0->i4_avg_poc;
  754|  15.3k|                pic1_poc = ps_pic_buff1->i4_avg_poc;
  755|  15.3k|                cur_poc = ps_dec->ps_cur_pic->i4_poc;
  756|  15.3k|            }
  757|  15.3k|        }
  758|  15.4k|        {
  759|  15.4k|            WORD16 i16_td;
  760|  15.4k|            WORD64 diff;
  761|  15.4k|            if(c_refFrm0 >= 0)
  ------------------
  |  Branch (761:16): [True: 14.7k, False: 673]
  ------------------
  762|  14.7k|            {
  763|  14.7k|                i2_mv_x0 = ps_mv->i2_mv[0];
  764|  14.7k|                i2_mv_y0 = ps_mv->i2_mv[1];
  765|  14.7k|            }
  766|    673|            else if(c_refFrm1 >= 0)
  ------------------
  |  Branch (766:21): [True: 653, False: 20]
  ------------------
  767|    653|            {
  768|    653|                i2_mv_x0 = ps_mv->i2_mv[2];
  769|    653|                i2_mv_y0 = ps_mv->i2_mv[3];
  770|    653|            }
  771|     20|            else
  772|     20|            {
  773|     20|                i2_mv_x0 = 0;
  774|     20|                i2_mv_y0 = 0;
  775|     20|            }
  776|       |            /* If FRM_TO_FLD or FLD_TO_FRM scale the "y" component of the colocated Mv*/
  777|  15.4k|            if(s_mvdirect.u1_vert_mv_scale == FRM_TO_FLD)
  ------------------
  |  |   48|  15.4k|#define FRM_TO_FLD    1
  ------------------
  |  Branch (777:16): [True: 0, False: 15.4k]
  ------------------
  778|      0|            {
  779|      0|                i2_mv_y0 /= 2;
  780|      0|            }
  781|  15.4k|            else if(s_mvdirect.u1_vert_mv_scale == FLD_TO_FRM)
  ------------------
  |  |   49|  15.4k|#define FLD_TO_FRM    2
  ------------------
  |  Branch (781:21): [True: 0, False: 15.4k]
  ------------------
  782|      0|            {
  783|      0|                i2_mv_y0 *= 2;
  784|      0|            }
  785|       |
  786|  15.4k|            diff = (WORD64)pic1_poc - pic0_poc;
  787|  15.4k|            i16_td = CLIP_S8(diff);
  ------------------
  |  |   59|  15.4k|#define CLIP_S8(x) CLIP3(INT8_MIN, INT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  15.4k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 14, False: 15.3k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 15.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  788|  15.4k|            if((ps_pic_buff0->u1_is_short == 0) || (i16_td == 0))
  ------------------
  |  Branch (788:16): [True: 4.23k, False: 11.1k]
  |  Branch (788:52): [True: 11.1k, False: 14]
  ------------------
  789|  15.3k|            {
  790|  15.3k|                i2_mv_x1 = 0;
  791|  15.3k|                i2_mv_y1 = 0;
  792|  15.3k|            }
  793|     14|            else
  794|     14|            {
  795|     14|                WORD16 i2_tb, i2_tx, i2_dist_scale_factor, i2_temp;
  796|       |
  797|     14|                diff = (WORD64)cur_poc - pic0_poc;
  798|     14|                i2_tb = CLIP_S8(diff);
  ------------------
  |  |   59|     14|#define CLIP_S8(x) CLIP3(INT8_MIN, INT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|     14|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 2, False: 12]
  |  |  |  |  |  Branch (77:54): [True: 12, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  799|       |
  800|     14|                i2_tx = (16384 + ABS(SIGN_POW2_DIV(i16_td, 1))) / i16_td;
  ------------------
  |  |  100|     28|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 14, False: 0]
  |  |  |  Branch (100:27): [True: 14, False: 0]
  |  |  |  Branch (100:39): [True: 14, False: 0]
  |  |  |  Branch (100:46): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  801|     14|                i2_dist_scale_factor = CLIP_S11(
  ------------------
  |  |   65|     14|#define CLIP_S11(x) CLIP3(-1024, 1023, (x))
  |  |  ------------------
  |  |  |  |   77|     14|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 14]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 14]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  802|     14|                                            (((i2_tb * i2_tx) + 32) >> 6));
  803|     14|                i2_temp = (i2_mv_x0 * i2_dist_scale_factor + 128) >> 8;
  804|     14|                i2_mv_x1 = i2_temp - i2_mv_x0;
  805|     14|                i2_mv_x0 = i2_temp;
  806|       |
  807|     14|                i2_temp = (i2_mv_y0 * i2_dist_scale_factor + 128) >> 8;
  808|     14|                i2_mv_y1 = i2_temp - i2_mv_y0;
  809|     14|                i2_mv_y0 = i2_temp;
  810|     14|            }
  811|  15.4k|            {
  812|  15.4k|                mv_pred_t *ps_mv;
  813|       |
  814|       |                /*u1_sub_mb_x = u4_sub_mb_num & 0x03;
  815|       |                 uc_sub_mb_y = u4_sub_mb_num >> 2;*/
  816|  15.4k|                if(ps_dec->ps_cur_pps->u1_wted_bipred_idc)
  ------------------
  |  Branch (816:20): [True: 1.29k, False: 14.1k]
  ------------------
  817|  1.29k|                {
  818|  1.29k|                    UWORD8 u1_idx =
  819|  1.29k|                                    u1_ref_idx0
  820|  1.29k|                                                    * ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1];
  821|  1.29k|                    UWORD8 u1_scale_ref = u1_mbaff && u1_is_cur_mb_fld;
  ------------------
  |  Branch (821:43): [True: 0, False: 1.29k]
  |  Branch (821:55): [True: 0, False: 0]
  ------------------
  822|  1.29k|                    if(u1_scale_ref)
  ------------------
  |  Branch (822:24): [True: 0, False: 1.29k]
  ------------------
  823|      0|                        u1_idx >>= 1;
  824|  1.29k|                    pui32_weight_ofsts = (UWORD32*)&ps_dec->pu4_wt_ofsts[2
  825|  1.29k|                                    * X3(u1_idx)];
  ------------------
  |  |   92|  1.29k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  826|  1.29k|                    if(u1_scale_ref
  ------------------
  |  Branch (826:24): [True: 0, False: 1.29k]
  ------------------
  827|      0|                                    && (ps_dec->ps_cur_pps->u1_wted_bipred_idc
  ------------------
  |  Branch (827:40): [True: 0, False: 0]
  ------------------
  828|      0|                                                    == 2))
  829|      0|                    {
  830|      0|                        WORD16 i2_ref_idx;
  831|      0|                        i2_ref_idx = u1_ref_idx0;
  832|      0|                        i2_ref_idx *=
  833|      0|                                        (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1]
  834|      0|                                                        << 1);
  835|      0|                        if(!ps_cur_mb_info->u1_topmb)
  ------------------
  |  Branch (835:28): [True: 0, False: 0]
  ------------------
  836|      0|                            i2_ref_idx +=
  837|      0|                                            (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0]
  838|      0|                                                            << 1)
  839|      0|                                                            * (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1]
  840|      0|                                                                            << 1);
  841|      0|                        pui32_weight_ofsts =
  842|      0|                                        (UWORD32*)&ps_dec->pu4_mbaff_wt_mat[2
  843|      0|                                                        * X3(i2_ref_idx)];
  ------------------
  |  |   92|      0|#define X3(a)   (((a) << 1) + (a))
  ------------------
  844|      0|                    }
  845|  1.29k|                }
  846|  15.4k|                {
  847|  15.4k|                    pred_info_pkd_t *ps_pred_pkd;
  848|  15.4k|                   WORD16 i2_mv[2];
  849|  15.4k|                   WORD8 i1_ref_idx= 0;
  850|       |
  851|  15.4k|                   i2_mv[0] = i2_mv_x0;
  852|  15.4k|                   i2_mv[1] = i2_mv_y0;
  853|       |
  854|  15.4k|                   ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  855|  15.4k|                ih264d_fill_pred_info(i2_mv,u1_mb_partw,u1_mb_parth,u4_sub_mb_num,PRED_L0 | PRED_L1,
  ------------------
  |  |  483|  15.4k|#define PRED_L0   1
  ------------------
                              ih264d_fill_pred_info(i2_mv,u1_mb_partw,u1_mb_parth,u4_sub_mb_num,PRED_L0 | PRED_L1,
  ------------------
  |  |  484|  15.4k|#define PRED_L1   2
  ------------------
  856|  15.4k|                                ps_pred_pkd,ps_pic_buff0->u1_pic_buf_id,i1_ref_idx,pui32_weight_ofsts,
  857|  15.4k|                                ps_pic_buff0->u1_pic_type);
  858|  15.4k|                ps_dec->u4_pred_info_pkd_idx++;
  859|  15.4k|                ps_cur_mb_info->u1_num_pred_parts++;
  860|       |
  861|       |
  862|  15.4k|                }
  863|  15.4k|                {
  864|  15.4k|                   pred_info_pkd_t *ps_pred_pkd;
  865|  15.4k|                   WORD16 i2_mv[2];
  866|  15.4k|                   WORD8 i1_ref_idx= 0;
  867|       |
  868|  15.4k|                   i2_mv[0] = i2_mv_x1;
  869|  15.4k|                   i2_mv[1] = i2_mv_y1;
  870|       |
  871|  15.4k|                   ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  872|  15.4k|                ih264d_fill_pred_info(i2_mv,u1_mb_partw,u1_mb_parth,u4_sub_mb_num,PRED_L0 | PRED_L1,
  ------------------
  |  |  483|  15.4k|#define PRED_L0   1
  ------------------
                              ih264d_fill_pred_info(i2_mv,u1_mb_partw,u1_mb_parth,u4_sub_mb_num,PRED_L0 | PRED_L1,
  ------------------
  |  |  484|  15.4k|#define PRED_L1   2
  ------------------
  873|  15.4k|                                ps_pred_pkd,ps_pic_buff1->u1_pic_buf_id,i1_ref_idx,pui32_weight_ofsts,
  874|  15.4k|                                ps_pic_buff1->u1_pic_type);
  875|  15.4k|                ps_dec->u4_pred_info_pkd_idx++;
  876|  15.4k|                ps_cur_mb_info->u1_num_pred_parts++;
  877|       |
  878|       |
  879|  15.4k|                }
  880|       |
  881|       |                /* Replication optimisation */
  882|  15.4k|                s_temp_mv_pred.i2_mv[0] = i2_mv_x0;
  883|  15.4k|                s_temp_mv_pred.i2_mv[1] = i2_mv_y0;
  884|  15.4k|                s_temp_mv_pred.i2_mv[2] = i2_mv_x1;
  885|  15.4k|                s_temp_mv_pred.i2_mv[3] = i2_mv_y1;
  886|  15.4k|                s_temp_mv_pred.i1_ref_frame[0] = u1_ref_idx0;
  887|  15.4k|                s_temp_mv_pred.i1_ref_frame[1] = 0;
  888|  15.4k|                s_temp_mv_pred.u1_col_ref_pic_idx = ps_pic_buff0->u1_mv_buf_id;
  889|  15.4k|                s_temp_mv_pred.u1_pic_type = ps_pic_buff0->u1_pic_type;
  890|  15.4k|                ps_mv = ps_dec->ps_mv_cur + (u4_mb_num << 4) + u4_sub_mb_num;
  891|       |
  892|  15.4k|                {
  893|  15.4k|                    WORD16 i2_mv_x = 0, i2_mv_y = 0;
  894|  15.4k|                    UWORD8 u1_packed_mb_sub_mb_mode =
  895|  15.4k|                                    sub_partition ? (s_mvdirect.i1_partitionsize[i]) : ((s_mvdirect.i1_partitionsize[i])
  ------------------
  |  Branch (895:37): [True: 4.11k, False: 11.2k]
  ------------------
  896|  11.2k|                                                                    << 2);
  897|       |
  898|  15.4k|                    if(c_refFrm0 >= 0)
  ------------------
  |  Branch (898:24): [True: 14.7k, False: 673]
  ------------------
  899|  14.7k|                    {
  900|  14.7k|                        i2_mv_x = i2_mv_x0;
  901|  14.7k|                        i2_mv_y = i2_mv_y0;
  902|  14.7k|                    }
  903|    673|                    else
  904|    673|                    {
  905|    673|                        i2_mv_x = i2_mv_x1;
  906|    673|                        i2_mv_y = i2_mv_y1;
  907|    673|                    }
  908|       |
  909|  15.4k|                    u1_colz =
  910|  15.4k|                                    (ps_cur_mb_info->u1_mb_field_decodingflag << 1)
  911|  15.4k|                                                    | ((u1_ref_idx0 == 0)
  ------------------
  |  Branch (911:56): [True: 15.4k, False: 2]
  ------------------
  912|  15.4k|                                                                    && (ABS(i2_mv_x)
  ------------------
  |  |  100|  15.4k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 376, False: 15.0k]
  |  |  ------------------
  ------------------
  |  Branch (912:72): [True: 14.4k, False: 964]
  ------------------
  913|  15.4k|                                                                                    <= 1)
  914|  14.4k|                                                                    && (ABS(i2_mv_y)
  ------------------
  |  |  100|  14.4k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 382, False: 14.0k]
  |  |  ------------------
  ------------------
  |  Branch (914:72): [True: 14.0k, False: 396]
  ------------------
  915|  14.4k|                                                                                    <= 1));
  916|  15.4k|                    u1_colz |= (u1_packed_mb_sub_mb_mode << 4);
  917|  15.4k|                }
  918|  15.4k|                ih264d_rep_mv_colz(ps_dec, &s_temp_mv_pred, ps_mv, u4_sub_mb_num,
  919|  15.4k|                                   u1_colz, u1_mb_parth, u1_mb_partw);
  920|  15.4k|            }
  921|  15.4k|        }
  922|  15.4k|    }
  923|       |    /* return value set to UWORD8 to make it homogeneous  */
  924|       |    /* with decodespatialdirect                           */
  925|  14.3k|    return OK;
  ------------------
  |  |  114|  14.3k|#define OK        0
  ------------------
  926|  14.3k|}
ih264d_init_ref_idx_lx_b:
 1227|  1.46k|{
 1228|  1.46k|    struct pic_buffer_t *ps_ref_pic_buf_lx;
 1229|  1.46k|    dpb_manager_t *ps_dpb_mgr;
 1230|  1.46k|    struct dpb_info_t *ps_next_dpb;
 1231|  1.46k|    WORD32 i_cur_poc, i_max_st_poc, i_min_st_poc, i_ref_poc, i_temp_poc;
 1232|  1.46k|    WORD8 i, j;
 1233|  1.46k|    UWORD8 u1_max_lt_index, u1_min_lt_index;
 1234|  1.46k|    UWORD32 u4_lt_index;
 1235|  1.46k|    WORD32 i_cur_idx;
 1236|  1.46k|    UWORD8 u1_field_pic_flag;
 1237|  1.46k|    dec_slice_params_t *ps_cur_slice;
 1238|  1.46k|    UWORD8 u1_L0, u1_L1;
 1239|  1.46k|    UWORD8 u1_num_short_term_bufs;
 1240|  1.46k|    UWORD8 u1_max_ref_idx_l0, u1_max_ref_idx_l1;
 1241|  1.46k|    struct pic_buffer_t *aps_st_pic_bufs[2 * MAX_REF_BUFS] = {NULL};
 1242|  1.46k|    ps_cur_slice = ps_dec->ps_cur_slice;
 1243|  1.46k|    u1_field_pic_flag = ps_cur_slice->u1_field_pic_flag;
 1244|  1.46k|    u1_max_ref_idx_l0 = ps_cur_slice->u1_num_ref_idx_lx_active[0]
 1245|  1.46k|                    << u1_field_pic_flag;
 1246|  1.46k|    u1_max_ref_idx_l1 = ps_cur_slice->u1_num_ref_idx_lx_active[1]
 1247|  1.46k|                    << u1_field_pic_flag;
 1248|       |
 1249|  1.46k|    ps_dpb_mgr = ps_dec->ps_dpb_mgr;
 1250|       |    /* Get the current POC */
 1251|  1.46k|    i_cur_poc = ps_dec->ps_cur_pic->i4_poc;
 1252|       |
 1253|       |    /* Get MaxStPOC,MinStPOC,MaxLt,MinLt */
 1254|  1.46k|    i_max_st_poc = i_cur_poc;
 1255|  1.46k|    i_min_st_poc = i_cur_poc;
 1256|  1.46k|    u1_max_lt_index = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|  1.46k|#define MAX_REF_BUFS    32
  ------------------
 1257|  1.46k|    u1_min_lt_index = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|  1.46k|#define MAX_REF_BUFS    32
  ------------------
 1258|       |    /* Start from ST head */
 1259|  1.46k|    ps_next_dpb = ps_dpb_mgr->ps_dpb_st_head;
 1260|  2.65k|    for(i = 0; i < ps_dpb_mgr->u1_num_st_ref_bufs; i++)
  ------------------
  |  Branch (1260:16): [True: 1.18k, False: 1.46k]
  ------------------
 1261|  1.18k|    {
 1262|  1.18k|        i_ref_poc = ps_next_dpb->ps_pic_buf->i4_poc;
 1263|  1.18k|        if(i_ref_poc < i_cur_poc)
  ------------------
  |  Branch (1263:12): [True: 719, False: 470]
  ------------------
 1264|    719|        {
 1265|       |            /* RefPic Buf POC is before Current POC in display order */
 1266|    719|            i_min_st_poc = MIN(i_min_st_poc, i_ref_poc);
  ------------------
  |  |   61|    719|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 0, False: 719]
  |  |  ------------------
  ------------------
 1267|    719|        }
 1268|    470|        else
 1269|    470|        {
 1270|       |            /* RefPic Buf POC is after Current POC in display order */
 1271|    470|            i_max_st_poc = MAX(i_max_st_poc, i_ref_poc);
  ------------------
  |  |   60|    470|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 11, False: 459]
  |  |  ------------------
  ------------------
 1272|    470|        }
 1273|       |
 1274|       |        /* Chase the next link */
 1275|  1.18k|        ps_next_dpb = ps_next_dpb->ps_prev_short;
 1276|  1.18k|    }
 1277|       |
 1278|       |    /* Sort ST ref pocs in ascending order */
 1279|  1.46k|    ps_next_dpb = ps_dpb_mgr->ps_dpb_st_head;
 1280|  2.65k|    for (j = 0; j < ps_dpb_mgr->u1_num_st_ref_bufs; j++)
  ------------------
  |  Branch (1280:17): [True: 1.18k, False: 1.46k]
  ------------------
 1281|  1.18k|    {
 1282|  1.18k|        aps_st_pic_bufs[j] = ps_next_dpb->ps_pic_buf;
 1283|  1.18k|        ps_next_dpb = ps_next_dpb->ps_prev_short;
 1284|  1.18k|    }
 1285|  1.46k|    qsort(aps_st_pic_bufs, ps_dpb_mgr->u1_num_st_ref_bufs,
 1286|  1.46k|        sizeof(aps_st_pic_bufs[0]), poc_compare);
 1287|       |
 1288|       |    /* Start from LT head */
 1289|  1.46k|    ps_next_dpb = ps_dpb_mgr->ps_dpb_ht_head;
 1290|  1.46k|    if(ps_next_dpb)
  ------------------
  |  Branch (1290:8): [True: 23, False: 1.43k]
  ------------------
 1291|     23|    {
 1292|     23|        u1_max_lt_index = ps_next_dpb->u1_lt_idx;
 1293|     23|        u1_min_lt_index = ps_next_dpb->u1_lt_idx;
 1294|     23|    }
 1295|  1.48k|    for(i = 0; i < ps_dpb_mgr->u1_num_lt_ref_bufs; i++)
  ------------------
  |  Branch (1295:16): [True: 25, False: 1.46k]
  ------------------
 1296|     25|    {
 1297|     25|        u4_lt_index = ps_next_dpb->u1_lt_idx;
 1298|     25|        u1_max_lt_index = (UWORD8)(MAX(u1_max_lt_index, u4_lt_index));
  ------------------
  |  |   60|     25|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 25]
  |  |  ------------------
  ------------------
 1299|     25|        u1_min_lt_index = (UWORD8)(MIN(u1_min_lt_index, u4_lt_index));
  ------------------
  |  |   61|     25|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 2, False: 23]
  |  |  ------------------
  ------------------
 1300|       |
 1301|       |        /* Chase the next link */
 1302|     25|        ps_next_dpb = ps_next_dpb->ps_prev_long;
 1303|     25|    }
 1304|       |
 1305|       |    /* 1. Initialize refIdxL0 */
 1306|  1.46k|    u1_L0 = 0;
 1307|  1.46k|    i_temp_poc = i_cur_poc;
 1308|  1.46k|    if(u1_field_pic_flag)
  ------------------
  |  Branch (1308:8): [True: 0, False: 1.46k]
  ------------------
 1309|      0|    {
 1310|      0|        ps_ref_pic_buf_lx = ps_dpb_mgr->ps_init_dpb[0][0];
 1311|      0|        ps_ref_pic_buf_lx += MAX_REF_BUFS;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
 1312|      0|    }
 1313|  1.46k|    else
 1314|  1.46k|    {
 1315|  1.46k|        ps_ref_pic_buf_lx = ps_dpb_mgr->ps_init_dpb[0][0];
 1316|       |        /* Avoid integer overflow while decrementing by one */
 1317|  1.46k|        if (i_temp_poc > INT32_MIN)
  ------------------
  |  Branch (1317:13): [True: 1.46k, False: 0]
  ------------------
 1318|  1.46k|            i_temp_poc--;
 1319|  1.46k|    }
 1320|       |
 1321|  1.46k|    i_cur_idx = -1;
 1322|  2.65k|    for(j = 0; j < ps_dpb_mgr->u1_num_st_ref_bufs; j++)
  ------------------
  |  Branch (1322:16): [True: 1.18k, False: 1.46k]
  ------------------
 1323|  1.18k|    {
 1324|  1.18k|        if (NULL == aps_st_pic_bufs[j])
  ------------------
  |  Branch (1324:13): [True: 0, False: 1.18k]
  ------------------
 1325|      0|        {
 1326|      0|            break;
 1327|      0|        }
 1328|  1.18k|        if (aps_st_pic_bufs[j]->i4_poc <= i_temp_poc)
  ------------------
  |  Branch (1328:13): [True: 719, False: 470]
  ------------------
 1329|    719|        {
 1330|    719|            i_cur_idx = j;
 1331|    719|        }
 1332|  1.18k|    }
 1333|       |    /* Arrange all short term buffers in output order as given by POC */
 1334|       |    /* 1.1 Arrange POC's less than CurrPOC in the descending POC order starting
 1335|       |     from (CurrPOC - 1)*/
 1336|  2.18k|    for(j = i_cur_idx; j >= 0; j--)
  ------------------
  |  Branch (1336:24): [True: 719, False: 1.46k]
  ------------------
 1337|    719|    {
 1338|    719|        if(aps_st_pic_bufs[j])
  ------------------
  |  Branch (1338:12): [True: 719, False: 0]
  ------------------
 1339|    719|        {
 1340|       |            /* Copy info in pic buffer */
 1341|    719|            ih264d_insert_pic_in_ref_pic_listx(ps_ref_pic_buf_lx,
 1342|    719|                                               aps_st_pic_bufs[j]);
 1343|    719|            ps_ref_pic_buf_lx++;
 1344|    719|            u1_L0++;
 1345|    719|        }
 1346|    719|    }
 1347|       |
 1348|       |    /* 1.2. Arrange POC's more than CurrPOC in the ascending POC order starting
 1349|       |     from (CurrPOC + 1)*/
 1350|  1.93k|    for(j = i_cur_idx + 1; j < ps_dpb_mgr->u1_num_st_ref_bufs; j++)
  ------------------
  |  Branch (1350:28): [True: 470, False: 1.46k]
  ------------------
 1351|    470|    {
 1352|    470|        if(aps_st_pic_bufs[j])
  ------------------
  |  Branch (1352:12): [True: 470, False: 0]
  ------------------
 1353|    470|        {
 1354|    470|            ih264d_insert_pic_in_ref_pic_listx(ps_ref_pic_buf_lx,
 1355|    470|                                               aps_st_pic_bufs[j]);
 1356|    470|            ps_ref_pic_buf_lx++;
 1357|    470|            u1_L0++;
 1358|    470|        }
 1359|    470|    }
 1360|       |
 1361|       |    /* 1.3 Arrange all Long term buffers in ascending order, in LongtermIndex */
 1362|       |    /* Start from ST head */
 1363|       |
 1364|  1.46k|    u1_num_short_term_bufs = u1_L0;
 1365|  2.93k|    for(u4_lt_index = u1_min_lt_index; u4_lt_index <= u1_max_lt_index; u4_lt_index++)
  ------------------
  |  Branch (1365:40): [True: 1.47k, False: 1.46k]
  ------------------
 1366|  1.47k|    {
 1367|  1.47k|        ps_next_dpb = ps_dpb_mgr->ps_dpb_ht_head;
 1368|  1.49k|        for(i = 0; i < ps_dpb_mgr->u1_num_lt_ref_bufs; i++)
  ------------------
  |  Branch (1368:20): [True: 52, False: 1.44k]
  ------------------
 1369|     52|        {
 1370|     52|            if(ps_next_dpb->u1_lt_idx == u4_lt_index)
  ------------------
  |  Branch (1370:16): [True: 25, False: 27]
  ------------------
 1371|     25|            {
 1372|     25|                ih264d_insert_pic_in_ref_pic_listx(ps_ref_pic_buf_lx,
 1373|     25|                                                   ps_next_dpb->ps_pic_buf);
 1374|     25|                ps_ref_pic_buf_lx->u1_long_term_pic_num =
 1375|     25|                                ps_ref_pic_buf_lx->u1_long_term_frm_idx;
 1376|       |
 1377|     25|                ps_ref_pic_buf_lx++;
 1378|     25|                u1_L0++;
 1379|     25|                break;
 1380|     25|            }
 1381|     27|            ps_next_dpb = ps_next_dpb->ps_prev_long;
 1382|     27|        }
 1383|  1.47k|    }
 1384|       |
 1385|  1.46k|    if(u1_field_pic_flag)
  ------------------
  |  Branch (1385:8): [True: 0, False: 1.46k]
  ------------------
 1386|      0|    {
 1387|       |        /* Initialize the rest of the entries in the */
 1388|       |        /* reference list to handle of errors        */
 1389|      0|        {
 1390|      0|            UWORD8 u1_i;
 1391|      0|            pic_buffer_t ref_pic;
 1392|       |
 1393|      0|            ref_pic = *(ps_dpb_mgr->ps_init_dpb[0][0] + MAX_REF_BUFS);
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
 1394|       |
 1395|      0|            if(NULL == ref_pic.pu1_buf1)
  ------------------
  |  Branch (1395:16): [True: 0, False: 0]
  ------------------
 1396|      0|            {
 1397|      0|                ref_pic = *ps_dec->ps_cur_pic;
 1398|      0|            }
 1399|      0|            for(u1_i = u1_L0; u1_i < u1_max_ref_idx_l0; u1_i++)
  ------------------
  |  Branch (1399:31): [True: 0, False: 0]
  ------------------
 1400|      0|            {
 1401|      0|                *ps_ref_pic_buf_lx = ref_pic;
 1402|      0|                ps_ref_pic_buf_lx++;
 1403|      0|            }
 1404|      0|        }
 1405|      0|        ih264d_convert_frm_to_fld_list(
 1406|      0|                        ps_dpb_mgr->ps_init_dpb[0][0] + MAX_REF_BUFS, &u1_L0,
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
 1407|      0|                        ps_dec, u1_num_short_term_bufs);
 1408|       |
 1409|      0|        ps_ref_pic_buf_lx = ps_dpb_mgr->ps_init_dpb[0][0] + u1_L0;
 1410|      0|    }
 1411|       |
 1412|  1.46k|    ps_dec->ps_cur_slice->u1_initial_list_size[0] = u1_L0;
 1413|       |
 1414|       |    /* Initialize the rest of the entries in the */
 1415|       |    /* reference list to handle of errors        */
 1416|  1.46k|    {
 1417|  1.46k|        UWORD8 u1_i;
 1418|  1.46k|        pic_buffer_t ref_pic;
 1419|       |
 1420|  1.46k|        ref_pic = *(ps_dpb_mgr->ps_init_dpb[0][0]);
 1421|       |
 1422|  1.46k|        if(NULL == ref_pic.pu1_buf1)
  ------------------
  |  Branch (1422:12): [True: 0, False: 1.46k]
  ------------------
 1423|      0|        {
 1424|      0|            ref_pic = *ps_dec->ps_cur_pic;
 1425|      0|        }
 1426|  3.97k|        for(u1_i = u1_L0; u1_i < u1_max_ref_idx_l0; u1_i++)
  ------------------
  |  Branch (1426:27): [True: 2.51k, False: 1.46k]
  ------------------
 1427|  2.51k|        {
 1428|  2.51k|            *ps_ref_pic_buf_lx = ref_pic;
 1429|  2.51k|            ps_ref_pic_buf_lx++;
 1430|  2.51k|        }
 1431|  1.46k|    }
 1432|  1.46k|    {
 1433|       |        /* 2. Initialize refIdxL1 */
 1434|  1.46k|        u1_L1 = 0;
 1435|  1.46k|        if(u1_field_pic_flag)
  ------------------
  |  Branch (1435:12): [True: 0, False: 1.46k]
  ------------------
 1436|      0|        {
 1437|      0|            ps_ref_pic_buf_lx = ps_dpb_mgr->ps_init_dpb[1][0] + MAX_REF_BUFS;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
 1438|      0|        }
 1439|  1.46k|        else
 1440|  1.46k|        {
 1441|  1.46k|            ps_ref_pic_buf_lx = ps_dpb_mgr->ps_init_dpb[1][0];
 1442|  1.46k|        }
 1443|       |
 1444|       |        /* 2.1. Arrange POC's more than CurrPOC in the ascending POC order starting
 1445|       |         from (CurrPOC + 1)*/
 1446|  1.93k|        for(j = i_cur_idx + 1; j < ps_dpb_mgr->u1_num_st_ref_bufs; j++)
  ------------------
  |  Branch (1446:32): [True: 470, False: 1.46k]
  ------------------
 1447|    470|        {
 1448|    470|            if(aps_st_pic_bufs[j])
  ------------------
  |  Branch (1448:16): [True: 470, False: 0]
  ------------------
 1449|    470|            {
 1450|       |                /* Start from ST head */
 1451|    470|                ih264d_insert_pic_in_ref_pic_listx(ps_ref_pic_buf_lx,
 1452|    470|                                                   aps_st_pic_bufs[j]);
 1453|    470|                ps_ref_pic_buf_lx++;
 1454|    470|                u1_L1++;
 1455|    470|            }
 1456|    470|        }
 1457|       |
 1458|       |        /* Arrange all short term buffers in output order as given by POC */
 1459|       |        /* 2.2 Arrange POC's less than CurrPOC in the descending POC order starting
 1460|       |         from (CurrPOC - 1)*/
 1461|  2.18k|        for(j = i_cur_idx; j >= 0; j--)
  ------------------
  |  Branch (1461:28): [True: 719, False: 1.46k]
  ------------------
 1462|    719|        {
 1463|    719|            if(aps_st_pic_bufs[j])
  ------------------
  |  Branch (1463:16): [True: 719, False: 0]
  ------------------
 1464|    719|            {
 1465|    719|                ih264d_insert_pic_in_ref_pic_listx(ps_ref_pic_buf_lx,
 1466|    719|                                                   aps_st_pic_bufs[j]);
 1467|    719|                ps_ref_pic_buf_lx++;
 1468|    719|                u1_L1++;
 1469|    719|            }
 1470|    719|        }
 1471|       |
 1472|       |        /* 2.3 Arrange all Long term buffers in ascending order, in LongtermIndex */
 1473|       |        /* Start from ST head */
 1474|  1.46k|        u1_num_short_term_bufs = u1_L1;
 1475|       |
 1476|  2.93k|        for(u4_lt_index = u1_min_lt_index; u4_lt_index <= u1_max_lt_index;
  ------------------
  |  Branch (1476:44): [True: 1.47k, False: 1.46k]
  ------------------
 1477|  1.47k|                        u4_lt_index++)
 1478|  1.47k|        {
 1479|  1.47k|            ps_next_dpb = ps_dpb_mgr->ps_dpb_ht_head;
 1480|  1.49k|            for(i = 0; i < ps_dpb_mgr->u1_num_lt_ref_bufs; i++)
  ------------------
  |  Branch (1480:24): [True: 52, False: 1.44k]
  ------------------
 1481|     52|            {
 1482|     52|                if(ps_next_dpb->u1_lt_idx == u4_lt_index)
  ------------------
  |  Branch (1482:20): [True: 25, False: 27]
  ------------------
 1483|     25|                {
 1484|     25|                    ih264d_insert_pic_in_ref_pic_listx(ps_ref_pic_buf_lx,
 1485|     25|                                                       ps_next_dpb->ps_pic_buf);
 1486|     25|                    ps_ref_pic_buf_lx->u1_long_term_pic_num =
 1487|     25|                                    ps_ref_pic_buf_lx->u1_long_term_frm_idx;
 1488|     25|                    ps_ref_pic_buf_lx++;
 1489|     25|                    u1_L1++;
 1490|     25|                    break;
 1491|     25|                }
 1492|     27|                ps_next_dpb = ps_next_dpb->ps_prev_long;
 1493|     27|            }
 1494|  1.47k|        }
 1495|       |
 1496|  1.46k|        if(u1_field_pic_flag)
  ------------------
  |  Branch (1496:12): [True: 0, False: 1.46k]
  ------------------
 1497|      0|        {
 1498|       |            /* Initialize the rest of the entries in the */
 1499|       |            /* reference list to handle of errors        */
 1500|      0|            {
 1501|      0|                UWORD8 u1_i;
 1502|      0|                pic_buffer_t ref_pic;
 1503|       |
 1504|      0|                ref_pic = *(ps_dpb_mgr->ps_init_dpb[0][0] + MAX_REF_BUFS);
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
 1505|       |
 1506|      0|                if(NULL == ref_pic.pu1_buf1)
  ------------------
  |  Branch (1506:20): [True: 0, False: 0]
  ------------------
 1507|      0|                {
 1508|      0|                    ref_pic = *ps_dec->ps_cur_pic;
 1509|      0|                }
 1510|      0|                for(u1_i = u1_L1; u1_i < u1_max_ref_idx_l1; u1_i++)
  ------------------
  |  Branch (1510:35): [True: 0, False: 0]
  ------------------
 1511|      0|                {
 1512|      0|                    *ps_ref_pic_buf_lx = ref_pic;
 1513|      0|                    ps_ref_pic_buf_lx++;
 1514|      0|                }
 1515|      0|            }
 1516|       |
 1517|      0|            ih264d_convert_frm_to_fld_list(
 1518|      0|                            ps_dpb_mgr->ps_init_dpb[1][0] + MAX_REF_BUFS,
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
 1519|      0|                            &u1_L1, ps_dec, u1_num_short_term_bufs);
 1520|      0|            ps_ref_pic_buf_lx = ps_dpb_mgr->ps_init_dpb[1][0] + u1_L1;
 1521|      0|        }
 1522|       |
 1523|  1.46k|        ps_dec->ps_cur_slice->u1_initial_list_size[1] = u1_L1;
 1524|       |
 1525|       |        /* Initialize the rest of the entries in the */
 1526|       |        /* reference list to handle of errors        */
 1527|  1.46k|        {
 1528|  1.46k|            UWORD8 u1_i;
 1529|  1.46k|            pic_buffer_t ref_pic;
 1530|       |
 1531|  1.46k|            ref_pic = *(ps_dpb_mgr->ps_init_dpb[0][0]);
 1532|       |
 1533|  1.46k|            if(NULL == ref_pic.pu1_buf1)
  ------------------
  |  Branch (1533:16): [True: 0, False: 1.46k]
  ------------------
 1534|      0|            {
 1535|      0|                ref_pic = *ps_dec->ps_cur_pic;
 1536|      0|            }
 1537|  2.79k|            for(u1_i = u1_L1; u1_i < u1_max_ref_idx_l1; u1_i++)
  ------------------
  |  Branch (1537:31): [True: 1.33k, False: 1.46k]
  ------------------
 1538|  1.33k|            {
 1539|  1.33k|                *ps_ref_pic_buf_lx = ref_pic;
 1540|  1.33k|                ps_ref_pic_buf_lx++;
 1541|  1.33k|            }
 1542|  1.46k|        }
 1543|       |
 1544|       |        /* If list0 and list 1 ebtries are same then swap the 0th and 1st entry */
 1545|       |        /* of list 1                                                            */
 1546|  1.46k|        {
 1547|  1.46k|            struct pic_buffer_t *ps_ref_pic1_buf_l0, *ps_ref_pic1_buf_l1;
 1548|  1.46k|            struct pic_buffer_t s_ref_pic1_buf_temp;
 1549|       |
 1550|  1.46k|            ps_ref_pic1_buf_l0 = ps_dpb_mgr->ps_init_dpb[0][0];
 1551|  1.46k|            ps_ref_pic1_buf_l1 = ps_dpb_mgr->ps_init_dpb[1][0];
 1552|       |
 1553|  1.46k|            if((u1_L0 == u1_L1) && (u1_L0 > 1))
  ------------------
  |  Branch (1553:16): [True: 1.46k, False: 0]
  |  Branch (1553:36): [True: 27, False: 1.43k]
  ------------------
 1554|     27|            {
 1555|     27|                WORD32 i_index, i_swap;
 1556|       |
 1557|     27|                i_swap = 1;
 1558|       |
 1559|     72|                for(i_index = 0; i_index < u1_L0; i_index++)
  ------------------
  |  Branch (1559:34): [True: 50, False: 22]
  ------------------
 1560|     50|                {
 1561|     50|                    if((ps_ref_pic1_buf_l0[i_index]).pu1_buf1
  ------------------
  |  Branch (1561:24): [True: 5, False: 45]
  ------------------
 1562|     50|                                    != (ps_ref_pic1_buf_l1[i_index]).pu1_buf1)
 1563|      5|                    {
 1564|      5|                        i_swap = 0;
 1565|      5|                        break;
 1566|      5|                    }
 1567|     50|                }
 1568|     27|                if(1 == i_swap)
  ------------------
  |  Branch (1568:20): [True: 22, False: 5]
  ------------------
 1569|     22|                {
 1570|     22|                    memcpy(&s_ref_pic1_buf_temp, &ps_ref_pic1_buf_l1[1],
 1571|     22|                           sizeof(struct pic_buffer_t));
 1572|     22|                    memcpy(&ps_ref_pic1_buf_l1[1], &ps_ref_pic1_buf_l1[0],
 1573|     22|                           sizeof(struct pic_buffer_t));
 1574|     22|                    memcpy(&ps_ref_pic1_buf_l1[0], &s_ref_pic1_buf_temp,
 1575|     22|                           sizeof(struct pic_buffer_t));
 1576|     22|                }
 1577|     27|            }
 1578|  1.46k|        }
 1579|  1.46k|    }
 1580|  1.46k|}
ih264d_one_to_one:
 1604|  20.7k|{
 1605|  20.7k|    UWORD8 *pu1_col_zero_flag_start, u1_col_mb_pred_mode, u1_num_blks, u1_sub_mb_num;
 1606|  20.7k|    UWORD8 u1_init_colzero_flag;
 1607|  20.7k|    UNUSED(ps_cur_mb_info);
  ------------------
  |  |   45|  20.7k|#define UNUSED(x) ((void)(x))
  ------------------
 1608|  20.7k|    pu1_col_zero_flag_start = ps_col_pic->pu1_col_zero_flag + u2_sub_mb_ofst;
 1609|  20.7k|    u1_col_mb_pred_mode = pu1_col_zero_flag_start[ps_dec->u1_sub_mb_num];
 1610|  20.7k|    u1_init_colzero_flag = u1_col_mb_pred_mode & 1;
 1611|  20.7k|    u1_col_mb_pred_mode >>= 6;
 1612|  20.7k|    ps_direct->u1_vert_mv_scale = ONE_TO_ONE;
  ------------------
  |  |   47|  20.7k|#define ONE_TO_ONE    0
  ------------------
 1613|  20.7k|    ps_direct->u1_col_zeroflag_change = 0;
 1614|       |
 1615|  20.7k|    if(u1_wd_x == MB_SIZE)
  ------------------
  |  |  554|  20.7k|#define MB_SIZE             16
  ------------------
  |  Branch (1615:8): [True: 16.9k, False: 3.73k]
  ------------------
 1616|  16.9k|    {
 1617|  16.9k|        ps_dec->u1_currB_type = (!!u1_col_mb_pred_mode);
 1618|  16.9k|        if(u1_col_mb_pred_mode == PRED_16x16)
  ------------------
  |  |  450|  16.9k|#define PRED_16x16  0
  ------------------
  |  Branch (1618:12): [True: 15.8k, False: 1.11k]
  ------------------
 1619|  15.8k|        {
 1620|  15.8k|            ps_direct->i1_num_partitions = 1;
 1621|  15.8k|            ps_direct->i4_mv_indices[0] = u2_sub_mb_ofst;
 1622|  15.8k|            ps_direct->i1_submb_num[0] = 0;
 1623|  15.8k|            ps_direct->i1_partitionsize[0] = PRED_16x16;
  ------------------
  |  |  450|  15.8k|#define PRED_16x16  0
  ------------------
 1624|       |
 1625|  15.8k|            return;
 1626|  15.8k|        }
 1627|  1.11k|        else if(u1_col_mb_pred_mode < PRED_8x8)
  ------------------
  |  |  453|  1.11k|#define PRED_8x8    3
  ------------------
  |  Branch (1627:17): [True: 822, False: 294]
  ------------------
 1628|    822|        {
 1629|    822|            ps_direct->i1_num_partitions = 2;
 1630|    822|            ps_direct->i4_mv_indices[0] = u2_sub_mb_ofst;
 1631|    822|            ps_direct->i1_submb_num[0] = 0;
 1632|    822|            ps_direct->i1_partitionsize[0] = u1_col_mb_pred_mode;
 1633|    822|            u1_sub_mb_num = (u1_col_mb_pred_mode == PRED_16x8) ? 8 : 2;
  ------------------
  |  |  451|    822|#define PRED_16x8   1
  ------------------
  |  Branch (1633:29): [True: 259, False: 563]
  ------------------
 1634|    822|            ps_direct->i1_submb_num[1] = u1_sub_mb_num;
 1635|    822|            ps_direct->i4_mv_indices[1] = u2_sub_mb_ofst
 1636|    822|                            + ps_direct->i1_submb_num[1];
 1637|    822|            ps_direct->i1_partitionsize[1] = u1_col_mb_pred_mode;
 1638|    822|            if((pu1_col_zero_flag_start[u1_sub_mb_num] & 1) != u1_init_colzero_flag)
  ------------------
  |  Branch (1638:16): [True: 172, False: 650]
  ------------------
 1639|    172|                ps_direct->u1_col_zeroflag_change = 1;
 1640|    822|            return;
 1641|    822|        }
 1642|    294|        else
 1643|    294|        {
 1644|    294|            u1_num_blks = 4;
 1645|    294|        }
 1646|  16.9k|    }
 1647|  3.73k|    else
 1648|  3.73k|    {
 1649|  3.73k|        u1_num_blks = 1;
 1650|  3.73k|    }
 1651|       |
 1652|  4.03k|    {
 1653|  4.03k|        const UWORD8 *pu1_top_lt_mb_part_idx;
 1654|  4.03k|        UWORD8 u1_col_sub_mb_pred_mode, uc_blk, u1_sub_blk, u1_submb_col = 0;
 1655|  4.03k|        UWORD8 u1_num_sub_blks, uc_direct8x8inf, *pu1_col_zero_flag, u1_sub_mb_num;
 1656|  4.03k|        const UWORD8 *pu1_num_sub_mb_part =
 1657|  4.03k|                        (const UWORD8 *)gau1_ih264d_num_submb_part;
 1658|  4.03k|        UWORD8 i1_num_partitions = 0, partition_size;
 1659|  4.03k|        WORD32 mv_index;
 1660|  4.03k|        const UWORD8 *pu1_top_lt_sub_mb_idx = gau1_ih264d_submb_indx_mod_sp_drct;
 1661|       |
 1662|  4.03k|        u1_sub_mb_num = ps_dec->u1_sub_mb_num;
 1663|  4.03k|        uc_direct8x8inf = ps_dec->ps_cur_slice->u1_direct_8x8_inference_flag;
 1664|  4.03k|        pu1_top_lt_mb_part_idx = gau1_ih264d_top_left_mb_part_indx_mod
 1665|  4.03k|                        + (PRED_8x8 << 1) + 1;
  ------------------
  |  |  453|  4.03k|#define PRED_8x8    3
  ------------------
 1666|       |
 1667|  8.94k|        for(uc_blk = 0; uc_blk < u1_num_blks; uc_blk++)
  ------------------
  |  Branch (1667:25): [True: 4.91k, False: 4.03k]
  ------------------
 1668|  4.91k|        {
 1669|  4.91k|            partition_size = PRED_8x8;
  ------------------
  |  |  453|  4.91k|#define PRED_8x8    3
  ------------------
 1670|  4.91k|            pu1_top_lt_sub_mb_idx = gau1_ih264d_submb_indx_mod_sp_drct;
 1671|  4.91k|            if(uc_direct8x8inf == 1)
  ------------------
  |  Branch (1671:16): [True: 1.07k, False: 3.83k]
  ------------------
 1672|  1.07k|            {
 1673|  1.07k|                u1_submb_col = u1_sub_mb_num | (u1_sub_mb_num >> 1);
 1674|  1.07k|                mv_index = u2_sub_mb_ofst + u1_submb_col;
 1675|  1.07k|                u1_num_sub_blks = 1;
 1676|  1.07k|            }
 1677|  3.83k|            else
 1678|  3.83k|            {
 1679|       |                /* colMbPart is either 8x8, 8x4, 4x8, 4x4 */
 1680|  3.83k|                pu1_col_zero_flag = pu1_col_zero_flag_start + u1_sub_mb_num;
 1681|  3.83k|                u1_col_sub_mb_pred_mode = *pu1_col_zero_flag;
 1682|  3.83k|                u1_col_sub_mb_pred_mode = (u1_col_sub_mb_pred_mode & 0x30) >> 4;
 1683|  3.83k|                partition_size = (UWORD8)((u1_col_sub_mb_pred_mode)
 1684|  3.83k|                                | (PRED_8x8 << 2));
  ------------------
  |  |  453|  3.83k|#define PRED_8x8    3
  ------------------
 1685|  3.83k|                mv_index = u2_sub_mb_ofst + u1_sub_mb_num;
 1686|  3.83k|                pu1_top_lt_sub_mb_idx += (u1_col_sub_mb_pred_mode << 1);
 1687|  3.83k|                u1_num_sub_blks = pu1_num_sub_mb_part[u1_col_sub_mb_pred_mode];
 1688|       |
 1689|  3.83k|            }
 1690|       |
 1691|  10.2k|            for(u1_sub_blk = 0; u1_sub_blk < u1_num_sub_blks;
  ------------------
  |  Branch (1691:33): [True: 5.30k, False: 4.91k]
  ------------------
 1692|  5.30k|                            u1_sub_blk++, pu1_top_lt_sub_mb_idx++)
 1693|  5.30k|            {
 1694|  5.30k|                u1_sub_mb_num += *pu1_top_lt_sub_mb_idx;
 1695|  5.30k|                mv_index += *pu1_top_lt_sub_mb_idx;
 1696|  5.30k|                ps_direct->i4_mv_indices[i1_num_partitions] = mv_index;
 1697|  5.30k|                ps_direct->i1_submb_num[i1_num_partitions] = u1_sub_mb_num;
 1698|  5.30k|                ps_direct->i1_partitionsize[i1_num_partitions] = partition_size;
 1699|  5.30k|                i1_num_partitions++;
 1700|  5.30k|                if(!uc_direct8x8inf)
  ------------------
  |  Branch (1700:20): [True: 4.23k, False: 1.07k]
  ------------------
 1701|  4.23k|                    u1_submb_col = u1_sub_mb_num;
 1702|  5.30k|                if((pu1_col_zero_flag_start[u1_submb_col] & 1)
  ------------------
  |  Branch (1702:20): [True: 250, False: 5.05k]
  ------------------
 1703|  5.30k|                                != u1_init_colzero_flag)
 1704|    250|                    ps_direct->u1_col_zeroflag_change = 1;
 1705|  5.30k|            }
 1706|  4.91k|            u1_sub_mb_num = *pu1_top_lt_mb_part_idx++;
 1707|  4.91k|        }
 1708|  4.03k|        ps_direct->i1_num_partitions = i1_num_partitions;
 1709|  4.03k|    }
 1710|  4.03k|}
ih264d_cal_col_pic:
 1939|  1.36k|{
 1940|  1.36k|    struct pic_buffer_t* ps_col_pic = ps_dec->ps_col_pic;
 1941|  1.36k|    UWORD8 uc_curpictype, uc_colpictype;
 1942|  1.36k|    ps_col_pic = ps_dec->ps_ref_pic_buf_lx[1][0];
 1943|  1.36k|    uc_curpictype = (ps_dec->ps_cur_pic->u1_picturetype & 0x7);
 1944|  1.36k|    uc_colpictype = (ps_col_pic->u1_picturetype & 0x7);
 1945|  1.36k|    if(uc_curpictype == FRM_PIC)
  ------------------
  |  |  352|  1.36k|#define FRM_PIC         0x00
  ------------------
  |  Branch (1945:8): [True: 1.36k, False: 0]
  ------------------
 1946|  1.36k|    {
 1947|  1.36k|        if(uc_colpictype == FRM_PIC)
  ------------------
  |  |  352|  1.36k|#define FRM_PIC         0x00
  ------------------
  |  Branch (1947:12): [True: 1.36k, False: 0]
  ------------------
 1948|  1.36k|            ps_dec->pf_parse_mvdirect = ih264d_one_to_one;
 1949|      0|        else if(uc_colpictype == COMP_FLD_PAIR)
  ------------------
  |  |  355|      0|#define COMP_FLD_PAIR   0x03 /* TOP_FLD | BOT_FLD */
  ------------------
  |  Branch (1949:17): [True: 0, False: 0]
  ------------------
 1950|      0|        {
 1951|      0|            ps_dec->pf_parse_mvdirect = ih264d_fld_to_frm;
 1952|      0|            if(ps_col_pic->i4_top_field_order_cnt
  ------------------
  |  Branch (1952:16): [True: 0, False: 0]
  ------------------
 1953|      0|                            >= ps_col_pic->i4_bottom_field_order_cnt)
 1954|      0|            {
 1955|      0|                struct pic_buffer_t* ps_tempPic = ps_col_pic;
 1956|      0|                UWORD32 ui_half_num_of_sub_mbs = ((ps_dec->u2_pic_ht
 1957|      0|                                * ps_dec->u2_pic_wd) >> 5);
 1958|      0|                ps_col_pic = ps_dec->ps_ref_pic_buf_lx[1][MAX_REF_BUFS];
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
 1959|       |                /* memcpy ps_tempPic to ps_col_pic */
 1960|      0|                *ps_col_pic = *ps_tempPic;
 1961|      0|                ps_col_pic->pu1_buf1 = ps_tempPic->pu1_buf1
 1962|      0|                                + ps_tempPic->u2_frm_wd_y;
 1963|      0|                ps_col_pic->pu1_buf2 = ps_tempPic->pu1_buf2
 1964|      0|                                + ps_tempPic->u2_frm_wd_uv;
 1965|      0|                ps_col_pic->pu1_buf3 = ps_tempPic->pu1_buf3
 1966|      0|                                + ps_tempPic->u2_frm_wd_uv;
 1967|      0|                ps_col_pic->pu1_col_zero_flag = ps_tempPic->pu1_col_zero_flag
 1968|      0|                                + ui_half_num_of_sub_mbs;
 1969|      0|                ps_col_pic->ps_mv = ps_tempPic->ps_mv + ui_half_num_of_sub_mbs;
 1970|       |
 1971|       |
 1972|      0|                ps_col_pic->u1_pic_type = 0;/*complementary reference field pair-refering as frame */
 1973|       |
 1974|       |
 1975|       |
 1976|      0|            }
 1977|      0|        }
 1978|      0|        else
 1979|      0|        {
 1980|      0|            UWORD32 i4_error_code;
 1981|      0|            i4_error_code = ERROR_DBP_MANAGER_T;
 1982|       |//          i4_error_code |= 1<<IVD_CORRUPTEDDATA;
 1983|      0|            return i4_error_code;
 1984|      0|        }
 1985|  1.36k|    }
 1986|      0|    else if(uc_curpictype == AFRM_PIC)
  ------------------
  |  |  356|      0|#define AFRM_PIC        0x04
  ------------------
  |  Branch (1986:13): [True: 0, False: 0]
  ------------------
 1987|      0|    {
 1988|      0|        ps_dec->pf_parse_mvdirect = ih264d_fld_to_mbaff;
 1989|      0|    }
 1990|      0|    else /* must be a field*/
 1991|      0|    {
 1992|      0|        if(uc_colpictype == FRM_PIC)
  ------------------
  |  |  352|      0|#define FRM_PIC         0x00
  ------------------
  |  Branch (1992:12): [True: 0, False: 0]
  ------------------
 1993|      0|            ps_dec->pf_parse_mvdirect = ih264d_frm_to_fld;
 1994|      0|        else if(uc_colpictype == AFRM_PIC)
  ------------------
  |  |  356|      0|#define AFRM_PIC        0x04
  ------------------
  |  Branch (1994:17): [True: 0, False: 0]
  ------------------
 1995|      0|            ps_dec->pf_parse_mvdirect = ih264d_mbaff_to_fld;
 1996|      0|        else
 1997|      0|            ps_dec->pf_parse_mvdirect = ih264d_one_to_one;
 1998|      0|    }
 1999|  1.36k|    ps_dec->ps_col_pic = ps_col_pic;
 2000|  1.36k|    return OK;
  ------------------
  |  |  114|  1.36k|#define OK        0
  ------------------
 2001|  1.36k|}
ih264d_process_bslice.c:poc_compare:
 1198|     31|{
 1199|     31|    struct pic_buffer_t *ps_pic1 = *(struct pic_buffer_t **) pv_pic1;
 1200|     31|    struct pic_buffer_t *ps_pic2 = *(struct pic_buffer_t **) pv_pic2;
 1201|     31|    if (ps_pic1->i4_poc < ps_pic2->i4_poc)
  ------------------
  |  Branch (1201:9): [True: 19, False: 12]
  ------------------
 1202|     19|    {
 1203|     19|        return -1;
 1204|     19|    }
 1205|     12|    else if (ps_pic1->i4_poc > ps_pic2->i4_poc)
  ------------------
  |  Branch (1205:14): [True: 11, False: 1]
  ------------------
 1206|     11|    {
 1207|     11|        return 1;
 1208|     11|    }
 1209|      1|    else
 1210|      1|    {
 1211|      1|        return 0;
 1212|      1|    }
 1213|     31|}

ih264d_read_intra_pred_modes:
  109|    329|{
  110|    329|    WORD32 i4x4_luma_blk_idx = 0, i8x8_luma_blk_idx = 0;
  111|       |
  112|    329|    dec_bit_stream_t * ps_bitstrm = ps_dec->ps_bitstrm;
  113|       |
  114|    329|    if(!u4_trans_form8x8)
  ------------------
  |  Branch (114:8): [True: 135, False: 194]
  ------------------
  115|    135|    {
  116|  2.29k|        for(i4x4_luma_blk_idx = 0; i4x4_luma_blk_idx < 16; ++i4x4_luma_blk_idx)
  ------------------
  |  Branch (116:36): [True: 2.16k, False: 135]
  ------------------
  117|  2.16k|        {
  118|  2.16k|            UWORD32 u4_temp;
  119|  2.16k|            SWITCHOFFTRACE;
  120|       |
  121|  2.16k|            GETBIT(u4_temp, ps_bitstrm->u4_ofst, ps_bitstrm->pu4_buffer);
  ------------------
  |  |  105|  2.16k|#define   GETBIT(u4_code, u4_offset, pu4_bitstream)                         \
  |  |  106|  2.16k|{                                                                           \
  |  |  107|  2.16k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  108|  2.16k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  109|  2.16k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  110|  2.16k|    u4_code = pu4_buf[u4_word_off] << u4_bit_off;                           \
  |  |  111|  2.16k|    (u4_offset)++;                                                          \
  |  |  112|  2.16k|    u4_code = (u4_code >> 31);                                              \
  |  |  113|  2.16k|}
  ------------------
  122|  2.16k|            *pu1_prev_intra4x4_pred_mode_flag = (UWORD8)u4_temp;
  123|  2.16k|            if(!(*pu1_prev_intra4x4_pred_mode_flag))
  ------------------
  |  Branch (123:16): [True: 1.69k, False: 464]
  ------------------
  124|  1.69k|            {
  125|  1.69k|                GETBITS(u4_temp, ps_bitstrm->u4_ofst, ps_bitstrm->pu4_buffer, 3);
  ------------------
  |  |  120|  1.69k|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|  1.69k|{                                                                           \
  |  |  122|  1.69k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|  1.69k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|  1.69k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|  1.69k|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|  1.69k|                                                                            \
  |  |  127|  1.69k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 1.65k, False: 46]
  |  |  ------------------
  |  |  128|  1.69k|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  1.65k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|  1.69k|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  1.69k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|  1.69k|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|  1.69k|}                                                                           \
  ------------------
  126|       |
  127|  1.69k|                *(pu1_rem_intra4x4_pred_mode) = (UWORD8)u4_temp;
  128|  1.69k|            }
  129|       |
  130|  2.16k|            pu1_prev_intra4x4_pred_mode_flag++;
  131|  2.16k|            pu1_rem_intra4x4_pred_mode++;
  132|  2.16k|        }
  133|    135|    }
  134|    194|    else
  135|    194|    {
  136|       |        /**********************************************************************/
  137|       |        /* prev_intra4x4_pred_modes to be interpreted as                      */
  138|       |        /* prev_intra8x8_pred_modes in case of transform 8x8                  */
  139|       |        /**********************************************************************/
  140|    970|        for(i8x8_luma_blk_idx = 0; i8x8_luma_blk_idx < 4; i8x8_luma_blk_idx++)
  ------------------
  |  Branch (140:36): [True: 776, False: 194]
  ------------------
  141|    776|        {
  142|    776|            UWORD32 u4_temp;
  143|    776|            GETBIT(u4_temp, ps_bitstrm->u4_ofst, ps_bitstrm->pu4_buffer);
  ------------------
  |  |  105|    776|#define   GETBIT(u4_code, u4_offset, pu4_bitstream)                         \
  |  |  106|    776|{                                                                           \
  |  |  107|    776|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  108|    776|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  109|    776|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  110|    776|    u4_code = pu4_buf[u4_word_off] << u4_bit_off;                           \
  |  |  111|    776|    (u4_offset)++;                                                          \
  |  |  112|    776|    u4_code = (u4_code >> 31);                                              \
  |  |  113|    776|}
  ------------------
  144|    776|            *pu1_prev_intra4x4_pred_mode_flag = (UWORD8)u4_temp;
  145|    776|            if(!(*pu1_prev_intra4x4_pred_mode_flag))
  ------------------
  |  Branch (145:16): [True: 757, False: 19]
  ------------------
  146|    757|            {
  147|    757|                GETBITS(u4_temp, ps_bitstrm->u4_ofst, ps_bitstrm->pu4_buffer, 3);
  ------------------
  |  |  120|    757|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    757|{                                                                           \
  |  |  122|    757|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    757|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    757|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    757|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    757|                                                                            \
  |  |  127|    757|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 673, False: 84]
  |  |  ------------------
  |  |  128|    757|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    673|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    757|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    757|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    757|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    757|}                                                                           \
  ------------------
  148|       |
  149|    757|                (*pu1_rem_intra4x4_pred_mode) = (UWORD8)u4_temp;
  150|    757|            }
  151|    776|            pu1_prev_intra4x4_pred_mode_flag++;
  152|    776|            pu1_rem_intra4x4_pred_mode++;
  153|    776|        }
  154|    194|    }
  155|    329|    return (0);
  156|    329|}
ih264d_unpack_coeff4x4_4x4blk:
  160|   154k|{
  161|   154k|    tu_sblk4x4_coeff_data_t *ps_tu_4x4 = (tu_sblk4x4_coeff_data_t *)ps_dec->pv_proc_tu_coeff_data;
  162|   154k|    UWORD16 u2_sig_coeff_map = ps_tu_4x4->u2_sig_coeff_map;
  163|   154k|    WORD32 idx = 0;
  164|   154k|    WORD16 *pi2_coeff_data = &ps_tu_4x4->ai2_level[0];
  165|   154k|    WORD32 dc_only_flag = 0;
  166|   154k|    WORD32 num_coeff = 0;
  167|       |
  168|   154k|    PROFILE_DISABLE_UNPACK_LUMA()
  ------------------
  |  |  112|   154k|#define PROFILE_DISABLE_UNPACK_LUMA() ;
  ------------------
  169|   823k|    while(u2_sig_coeff_map)
  ------------------
  |  Branch (169:11): [True: 668k, False: 154k]
  ------------------
  170|   668k|    {
  171|   668k|        idx = CLZ(u2_sig_coeff_map);
  172|       |
  173|   668k|        idx = 31 - idx;
  174|   668k|        RESET_BIT(u2_sig_coeff_map,idx);
  ------------------
  |  |  105|   668k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  ------------------
  175|       |
  176|   668k|        idx = pu1_inv_scan[idx];
  177|   668k|        pi2_out_coeff_data[idx] = *pi2_coeff_data++;
  178|   668k|        num_coeff++;
  179|   668k|    }
  180|       |
  181|   154k|    if((num_coeff == 1) && (idx == 0))
  ------------------
  |  Branch (181:8): [True: 32.5k, False: 121k]
  |  Branch (181:28): [True: 6.90k, False: 25.6k]
  ------------------
  182|  6.90k|    {
  183|  6.90k|        dc_only_flag = 1;
  184|  6.90k|    }
  185|       |
  186|   154k|    {
  187|   154k|        WORD32 offset;
  188|   154k|        offset = (UWORD8 *)pi2_coeff_data - (UWORD8 *)ps_tu_4x4;
  189|   154k|        offset = ALIGN4(offset);
  ------------------
  |  |   52|   154k|#define ALIGN4(x)   ((((x) + 3) >> 2) << 2)
  ------------------
  190|   154k|        ps_dec->pv_proc_tu_coeff_data = (void *)((UWORD8 *)ps_dec->pv_proc_tu_coeff_data + offset);
  191|   154k|    }
  192|       |
  193|   154k|    return dc_only_flag;
  194|   154k|}
ih264d_unpack_coeff4x4_8x8blk:
  200|  58.9k|{
  201|  58.9k|    UWORD8 *pu1_inv_scan;
  202|  58.9k|    UWORD8 u1_mb_field_decoding_flag = ps_cur_mb_info->u1_mb_field_decodingflag;
  203|  58.9k|    UWORD8 u1_field_coding_flag = ps_cur_mb_info->ps_curmb->u1_mb_fld;
  204|  58.9k|    UWORD32 u4_luma_dc_only_csbp = 0;
  205|  58.9k|    WORD32 dc_only_flag = 0;
  206|       |
  207|  58.9k|    PROFILE_DISABLE_UNPACK_LUMA()
  ------------------
  |  |  112|  58.9k|#define PROFILE_DISABLE_UNPACK_LUMA() ;
  ------------------
  208|  58.9k|    if(u1_field_coding_flag || u1_mb_field_decoding_flag)
  ------------------
  |  Branch (208:8): [True: 0, False: 58.9k]
  |  Branch (208:32): [True: 0, False: 58.9k]
  ------------------
  209|      0|    {
  210|      0|        pu1_inv_scan = (UWORD8 *)gau1_ih264d_inv_scan_fld;
  211|      0|    }
  212|  58.9k|    else
  213|  58.9k|    {
  214|  58.9k|        pu1_inv_scan = (UWORD8 *)gau1_ih264d_inv_scan;
  215|  58.9k|    }
  216|       |
  217|       |    // sub 0
  218|  58.9k|    if(ui2_luma_csbp & 0x1)
  ------------------
  |  Branch (218:8): [True: 31.1k, False: 27.7k]
  ------------------
  219|  31.1k|    {
  220|  31.1k|        memset(pi2_out_coeff_data,0,16*sizeof(WORD16));
  221|  31.1k|        dc_only_flag = ih264d_unpack_coeff4x4_4x4blk(ps_dec,
  222|  31.1k|                                      pi2_out_coeff_data,
  223|  31.1k|                                      pu1_inv_scan);
  224|       |
  225|  31.1k|        INSERT_BIT(u4_luma_dc_only_csbp, 0, dc_only_flag);
  ------------------
  |  |  109|  31.1k|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|  31.1k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
  226|  31.1k|    }
  227|       |
  228|  58.9k|    pi2_out_coeff_data += 16;
  229|       |    // sub 1
  230|  58.9k|    if(ui2_luma_csbp & 0x2)
  ------------------
  |  Branch (230:8): [True: 32.3k, False: 26.6k]
  ------------------
  231|  32.3k|    {
  232|  32.3k|        memset(pi2_out_coeff_data,0,16*sizeof(WORD16));
  233|  32.3k|        dc_only_flag = ih264d_unpack_coeff4x4_4x4blk(ps_dec,
  234|  32.3k|                                      pi2_out_coeff_data,
  235|  32.3k|                                      pu1_inv_scan);
  236|  32.3k|        INSERT_BIT(u4_luma_dc_only_csbp, 1, dc_only_flag);
  ------------------
  |  |  109|  32.3k|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|  32.3k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
  237|  32.3k|    }
  238|       |
  239|  58.9k|    pi2_out_coeff_data += 16 + 32;
  240|       |    // sub 2
  241|  58.9k|    if(ui2_luma_csbp & 0x10)
  ------------------
  |  Branch (241:8): [True: 29.7k, False: 29.1k]
  ------------------
  242|  29.7k|    {
  243|  29.7k|        memset(pi2_out_coeff_data,0,16*sizeof(WORD16));
  244|  29.7k|        dc_only_flag = ih264d_unpack_coeff4x4_4x4blk(ps_dec,
  245|  29.7k|                                      pi2_out_coeff_data,
  246|  29.7k|                                      pu1_inv_scan);
  247|  29.7k|        INSERT_BIT(u4_luma_dc_only_csbp, 4, dc_only_flag);
  ------------------
  |  |  109|  29.7k|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|  29.7k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
  248|  29.7k|    }
  249|       |
  250|  58.9k|    pi2_out_coeff_data += 16;
  251|       |    // sub 3
  252|  58.9k|    if(ui2_luma_csbp & 0x20)
  ------------------
  |  Branch (252:8): [True: 31.5k, False: 27.4k]
  ------------------
  253|  31.5k|    {
  254|  31.5k|        memset(pi2_out_coeff_data,0,16*sizeof(WORD16));
  255|  31.5k|        dc_only_flag = ih264d_unpack_coeff4x4_4x4blk(ps_dec,
  256|  31.5k|                                      pi2_out_coeff_data,
  257|  31.5k|                                      pu1_inv_scan);
  258|  31.5k|        INSERT_BIT(u4_luma_dc_only_csbp, 5, dc_only_flag);
  ------------------
  |  |  109|  31.5k|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|  31.5k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
  259|  31.5k|    }
  260|  58.9k|    return u4_luma_dc_only_csbp;
  261|  58.9k|}
ih264d_unpack_coeff8x8_8x8blk_cavlc:
  266|  2.44k|{
  267|  2.44k|    UWORD8 *pu1_inv_scan;
  268|  2.44k|    UWORD8 u1_mb_field_decoding_flag = ps_cur_mb_info->u1_mb_field_decodingflag;
  269|  2.44k|    UWORD8 u1_field_coding_flag = ps_cur_mb_info->ps_curmb->u1_mb_fld;
  270|  2.44k|    WORD32 dc_only_flag = 0;
  271|       |
  272|  2.44k|    PROFILE_DISABLE_UNPACK_LUMA()
  ------------------
  |  |  112|  2.44k|#define PROFILE_DISABLE_UNPACK_LUMA() ;
  ------------------
  273|  2.44k|    if(ui2_luma_csbp & 0x33)
  ------------------
  |  Branch (273:8): [True: 626, False: 1.81k]
  ------------------
  274|    626|    {
  275|    626|        memset(pi2_out_coeff_data,0,64*sizeof(WORD16));
  276|    626|    }
  277|       |
  278|  2.44k|    if(!u1_mb_field_decoding_flag)
  ------------------
  |  Branch (278:8): [True: 2.44k, False: 0]
  ------------------
  279|  2.44k|    {
  280|  2.44k|        pu1_inv_scan =
  281|  2.44k|                        (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[0];
  282|  2.44k|    }
  283|      0|    else
  284|      0|    {
  285|      0|        pu1_inv_scan =
  286|      0|                        (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[0];
  287|      0|    }
  288|       |    // sub 0
  289|  2.44k|    if(ui2_luma_csbp & 0x1)
  ------------------
  |  Branch (289:8): [True: 610, False: 1.83k]
  ------------------
  290|    610|    {
  291|    610|        dc_only_flag = ih264d_unpack_coeff4x4_4x4blk(ps_dec,
  292|    610|                                      pi2_out_coeff_data,
  293|    610|                                      pu1_inv_scan);
  294|    610|    }
  295|       |
  296|  2.44k|    if(!u1_mb_field_decoding_flag)
  ------------------
  |  Branch (296:8): [True: 2.44k, False: 0]
  ------------------
  297|  2.44k|    {
  298|  2.44k|        pu1_inv_scan =
  299|  2.44k|                        (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[1];
  300|  2.44k|    }
  301|      0|    else
  302|      0|    {
  303|      0|        pu1_inv_scan =
  304|      0|                        (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[1];
  305|      0|    }
  306|       |    // sub 1
  307|  2.44k|    if(ui2_luma_csbp & 0x2)
  ------------------
  |  Branch (307:8): [True: 35, False: 2.40k]
  ------------------
  308|     35|    {
  309|     35|        dc_only_flag = 0;
  310|     35|        ih264d_unpack_coeff4x4_4x4blk(ps_dec,
  311|     35|                                      pi2_out_coeff_data,
  312|     35|                                      pu1_inv_scan);
  313|     35|    }
  314|       |
  315|  2.44k|    if(!u1_mb_field_decoding_flag)
  ------------------
  |  Branch (315:8): [True: 2.44k, False: 0]
  ------------------
  316|  2.44k|    {
  317|  2.44k|        pu1_inv_scan =
  318|  2.44k|                        (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[2];
  319|  2.44k|    }
  320|      0|    else
  321|      0|    {
  322|      0|        pu1_inv_scan =
  323|      0|                        (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[2];
  324|      0|    }
  325|       |    // sub 2
  326|  2.44k|    if(ui2_luma_csbp & 0x10)
  ------------------
  |  Branch (326:8): [True: 605, False: 1.83k]
  ------------------
  327|    605|    {
  328|    605|        dc_only_flag = 0;
  329|    605|        ih264d_unpack_coeff4x4_4x4blk(ps_dec,
  330|    605|                                      pi2_out_coeff_data,
  331|    605|                                      pu1_inv_scan);
  332|    605|    }
  333|       |
  334|  2.44k|    if(!u1_mb_field_decoding_flag)
  ------------------
  |  Branch (334:8): [True: 2.44k, False: 0]
  ------------------
  335|  2.44k|    {
  336|  2.44k|        pu1_inv_scan =
  337|  2.44k|                        (UWORD8*)gau1_ih264d_inv_scan_prog8x8_cavlc[3];
  338|  2.44k|    }
  339|      0|    else
  340|      0|    {
  341|      0|        pu1_inv_scan =
  342|      0|                        (UWORD8*)gau1_ih264d_inv_scan_int8x8_cavlc[3];
  343|      0|    }
  344|       |    // sub 3
  345|  2.44k|    if(ui2_luma_csbp & 0x20)
  ------------------
  |  Branch (345:8): [True: 31, False: 2.41k]
  ------------------
  346|     31|    {
  347|     31|        dc_only_flag = 0;
  348|     31|        ih264d_unpack_coeff4x4_4x4blk(ps_dec,
  349|     31|                                      pi2_out_coeff_data,
  350|     31|                                      pu1_inv_scan);
  351|     31|    }
  352|  2.44k|    return dc_only_flag;
  353|  2.44k|}
ih264d_unpack_coeff4x4_8x8blk_chroma:
  358|  25.1k|{
  359|  25.1k|    UWORD8 *pu1_inv_scan;
  360|  25.1k|    UWORD8 u1_mb_field_decoding_flag = ps_cur_mb_info->u1_mb_field_decodingflag;
  361|  25.1k|    UWORD8 u1_field_coding_flag = ps_cur_mb_info->ps_curmb->u1_mb_fld;
  362|       |
  363|  25.1k|    PROFILE_DISABLE_UNPACK_CHROMA()
  ------------------
  |  |  113|  25.1k|#define PROFILE_DISABLE_UNPACK_CHROMA() ;
  ------------------
  364|  25.1k|    if(u1_field_coding_flag || u1_mb_field_decoding_flag)
  ------------------
  |  Branch (364:8): [True: 0, False: 25.1k]
  |  Branch (364:32): [True: 0, False: 25.1k]
  ------------------
  365|      0|    {
  366|      0|        pu1_inv_scan = (UWORD8 *)gau1_ih264d_inv_scan_fld;
  367|      0|    }
  368|  25.1k|    else
  369|  25.1k|    {
  370|  25.1k|        pu1_inv_scan = (UWORD8 *)gau1_ih264d_inv_scan;
  371|  25.1k|    }
  372|       |
  373|  25.1k|    if(ui2_chroma_csbp & 0x1)
  ------------------
  |  Branch (373:8): [True: 7.02k, False: 18.1k]
  ------------------
  374|  7.02k|    {
  375|  7.02k|        memset(pi2_out_coeff_data,0,16*sizeof(WORD16));
  376|  7.02k|        ih264d_unpack_coeff4x4_4x4blk(ps_dec,
  377|  7.02k|                                      pi2_out_coeff_data,
  378|  7.02k|                                      pu1_inv_scan);
  379|  7.02k|    }
  380|  25.1k|    pi2_out_coeff_data += 16;
  381|  25.1k|    if(ui2_chroma_csbp & 0x2)
  ------------------
  |  Branch (381:8): [True: 7.04k, False: 18.0k]
  ------------------
  382|  7.04k|    {
  383|  7.04k|        memset(pi2_out_coeff_data,0,16*sizeof(WORD16));
  384|  7.04k|        ih264d_unpack_coeff4x4_4x4blk(ps_dec,
  385|  7.04k|                                      pi2_out_coeff_data,
  386|  7.04k|                                      pu1_inv_scan);
  387|  7.04k|    }
  388|       |
  389|  25.1k|    pi2_out_coeff_data += 16;
  390|  25.1k|    if(ui2_chroma_csbp & 0x4)
  ------------------
  |  Branch (390:8): [True: 6.91k, False: 18.2k]
  ------------------
  391|  6.91k|    {
  392|  6.91k|        memset(pi2_out_coeff_data,0,16*sizeof(WORD16));
  393|  6.91k|        ih264d_unpack_coeff4x4_4x4blk(ps_dec,
  394|  6.91k|                                      pi2_out_coeff_data,
  395|  6.91k|                                      pu1_inv_scan);
  396|  6.91k|    }
  397|       |
  398|  25.1k|    pi2_out_coeff_data += 16;
  399|  25.1k|    if(ui2_chroma_csbp & 0x8)
  ------------------
  |  Branch (399:8): [True: 7.48k, False: 17.6k]
  ------------------
  400|  7.48k|    {
  401|  7.48k|        memset(pi2_out_coeff_data,0,16*sizeof(WORD16));
  402|  7.48k|        ih264d_unpack_coeff4x4_4x4blk(ps_dec,
  403|  7.48k|                                      pi2_out_coeff_data,
  404|  7.48k|                                      pu1_inv_scan);
  405|  7.48k|    }
  406|  25.1k|}
ih264d_unpack_luma_coeff4x4_mb:
  410|  32.0k|{
  411|  32.0k|    UWORD8 u1_mb_type = ps_cur_mb_info->u1_mb_type;
  412|  32.0k|    UWORD16 ui2_luma_csbp = ps_cur_mb_info->u2_luma_csbp;
  413|  32.0k|    UWORD8 *pu1_inv_scan = ps_dec->pu1_inv_scan;
  414|  32.0k|    WORD16 *pi2_coeff_data = ps_dec->pi2_coeff_data;
  415|       |
  416|  32.0k|    PROFILE_DISABLE_UNPACK_LUMA()
  ------------------
  |  |  112|  32.0k|#define PROFILE_DISABLE_UNPACK_LUMA() ;
  ------------------
  417|  32.0k|    if(!ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (417:8): [True: 31.4k, False: 612]
  ------------------
  418|  31.4k|    {
  419|  31.4k|        UWORD32 u4_luma_dc_only_csbp = 0;
  420|  31.4k|        UWORD32 u4_temp = 0;
  421|  31.4k|        WORD16* pi2_dc_val = NULL;
  422|       |        /*
  423|       |         * Reserve the pointer to dc vals. The dc vals will be copied
  424|       |         * after unpacking of ac vals since memset to 0 inside.
  425|       |         */
  426|  31.4k|        if(intra_flag && (u1_mb_type != I_4x4_MB))
  ------------------
  |  |  417|  5.51k|#define I_4x4_MB    0
  ------------------
  |  Branch (426:12): [True: 5.51k, False: 25.9k]
  |  Branch (426:26): [True: 2.19k, False: 3.32k]
  ------------------
  427|  2.19k|        {
  428|  2.19k|            if(CHECKBIT(ps_cur_mb_info->u1_yuv_dc_block_flag,0))
  ------------------
  |  |   54|  2.19k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 1.38k, False: 809]
  |  |  ------------------
  ------------------
  429|  1.38k|            {
  430|  1.38k|                pi2_dc_val = (WORD16 *)ps_dec->pv_proc_tu_coeff_data;
  431|       |
  432|  1.38k|                ps_dec->pv_proc_tu_coeff_data = (void *)(pi2_dc_val + 16);
  433|  1.38k|            }
  434|  2.19k|        }
  435|       |
  436|  31.4k|        if(ui2_luma_csbp)
  ------------------
  |  Branch (436:12): [True: 14.7k, False: 16.6k]
  ------------------
  437|  14.7k|        {
  438|  14.7k|            pi2_coeff_data = ps_dec->pi2_coeff_data;
  439|  14.7k|            u4_temp = ih264d_unpack_coeff4x4_8x8blk(ps_dec,
  440|  14.7k|                                          ps_cur_mb_info,
  441|  14.7k|                                          ui2_luma_csbp,
  442|  14.7k|                                          pi2_coeff_data);
  443|  14.7k|            u4_luma_dc_only_csbp = u4_temp;
  444|       |
  445|  14.7k|            pi2_coeff_data += 32;
  446|       |
  447|  14.7k|            ui2_luma_csbp = ui2_luma_csbp >> 2;
  448|  14.7k|            u4_temp = ih264d_unpack_coeff4x4_8x8blk(ps_dec,
  449|  14.7k|                                          ps_cur_mb_info,
  450|  14.7k|                                          ui2_luma_csbp,
  451|  14.7k|                                          pi2_coeff_data);
  452|       |
  453|  14.7k|            u4_luma_dc_only_csbp |= (u4_temp << 2);
  454|       |
  455|  14.7k|            pi2_coeff_data += 32 + 64;
  456|       |
  457|  14.7k|            ui2_luma_csbp = ui2_luma_csbp >> 6;
  458|  14.7k|            u4_temp = ih264d_unpack_coeff4x4_8x8blk(ps_dec,
  459|  14.7k|                                          ps_cur_mb_info,
  460|  14.7k|                                          ui2_luma_csbp,
  461|  14.7k|                                          pi2_coeff_data);
  462|       |
  463|  14.7k|            u4_luma_dc_only_csbp |= (u4_temp << 8);
  464|       |
  465|  14.7k|            pi2_coeff_data += 32;
  466|       |
  467|  14.7k|            ui2_luma_csbp = ui2_luma_csbp >> 2;
  468|  14.7k|            u4_temp = ih264d_unpack_coeff4x4_8x8blk(ps_dec,
  469|  14.7k|                                          ps_cur_mb_info,
  470|  14.7k|                                          ui2_luma_csbp,
  471|  14.7k|                                          pi2_coeff_data);
  472|  14.7k|            u4_luma_dc_only_csbp |= (u4_temp << 10);
  473|  14.7k|        }
  474|       |
  475|  31.4k|        if(pi2_dc_val != NULL)
  ------------------
  |  Branch (475:12): [True: 1.38k, False: 30.0k]
  ------------------
  476|  1.38k|        {
  477|  1.38k|            WORD32 i;
  478|  1.38k|            pi2_coeff_data = ps_dec->pi2_coeff_data;
  479|  6.92k|            for(i = 0; i < 4; i++)
  ------------------
  |  Branch (479:24): [True: 5.53k, False: 1.38k]
  ------------------
  480|  5.53k|            {
  481|  5.53k|                pi2_coeff_data[0] = pi2_dc_val[0];
  482|  5.53k|                pi2_coeff_data[4 * 16] = pi2_dc_val[4];
  483|  5.53k|                pi2_coeff_data[8 * 16] = pi2_dc_val[8];
  484|  5.53k|                pi2_coeff_data[12 * 16] = pi2_dc_val[12];
  485|       |
  486|  5.53k|                pi2_dc_val++; /* Point to next column */
  487|  5.53k|                pi2_coeff_data += 16;
  488|  5.53k|            }
  489|  1.38k|            u4_luma_dc_only_csbp = ps_cur_mb_info->u2_luma_csbp ^ 0xFFFF;
  490|  1.38k|        }
  491|  31.4k|        return u4_luma_dc_only_csbp;
  492|  31.4k|    }
  493|    612|    else
  494|    612|    {
  495|    612|        UWORD32 u4_luma_dc_only_cbp = 0;
  496|    612|        WORD32 dc_only_flag;
  497|    612|        if(ui2_luma_csbp)
  ------------------
  |  Branch (497:12): [True: 611, False: 1]
  ------------------
  498|    611|        {
  499|    611|            pi2_coeff_data = ps_dec->pi2_coeff_data;
  500|    611|            dc_only_flag = ih264d_unpack_coeff8x8_8x8blk_cavlc(ps_dec,
  501|    611|                                          ps_cur_mb_info,
  502|    611|                                          ui2_luma_csbp,
  503|    611|                                          pi2_coeff_data);
  504|    611|            INSERT_BIT(u4_luma_dc_only_cbp, 0, dc_only_flag);
  ------------------
  |  |  109|    611|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    611|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
  505|       |
  506|    611|            pi2_coeff_data += 64;
  507|       |
  508|    611|            ui2_luma_csbp = ui2_luma_csbp >> 2;
  509|    611|            dc_only_flag = ih264d_unpack_coeff8x8_8x8blk_cavlc(ps_dec,
  510|    611|                                          ps_cur_mb_info,
  511|    611|                                          ui2_luma_csbp,
  512|    611|                                          pi2_coeff_data);
  513|       |
  514|    611|            INSERT_BIT(u4_luma_dc_only_cbp, 1, dc_only_flag);
  ------------------
  |  |  109|    611|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    611|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
  515|       |
  516|    611|            pi2_coeff_data += 64;
  517|       |
  518|    611|            ui2_luma_csbp = ui2_luma_csbp >> 6;
  519|    611|            dc_only_flag = ih264d_unpack_coeff8x8_8x8blk_cavlc(ps_dec,
  520|    611|                                          ps_cur_mb_info,
  521|    611|                                          ui2_luma_csbp,
  522|    611|                                          pi2_coeff_data);
  523|       |
  524|    611|            INSERT_BIT(u4_luma_dc_only_cbp, 2, dc_only_flag);
  ------------------
  |  |  109|    611|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    611|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
  525|       |
  526|    611|            pi2_coeff_data += 64;
  527|    611|            ui2_luma_csbp = ui2_luma_csbp >> 2;
  528|    611|            dc_only_flag = ih264d_unpack_coeff8x8_8x8blk_cavlc(ps_dec,
  529|    611|                                          ps_cur_mb_info,
  530|    611|                                          ui2_luma_csbp,
  531|    611|                                          pi2_coeff_data);
  532|    611|            INSERT_BIT(u4_luma_dc_only_cbp, 3, dc_only_flag);
  ------------------
  |  |  109|    611|#define INSERT_BIT(x, pos, bit) { RESET_BIT(x, pos); (x) = (x) | (bit << pos); }
  |  |  ------------------
  |  |  |  |  105|    611|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  |  |  ------------------
  ------------------
  533|    611|        }
  534|    612|        return u4_luma_dc_only_cbp;
  535|    612|    }
  536|       |
  537|  32.0k|}
ih264d_unpack_chroma_coeff4x4_mb:
  541|  57.9k|{
  542|  57.9k|    UWORD8 u1_mb_type = ps_cur_mb_info->u1_mb_type;
  543|  57.9k|    UWORD16 ui2_chroma_csbp = ps_cur_mb_info->u2_chroma_csbp;
  544|  57.9k|    UWORD8 *pu1_inv_scan = ps_dec->pu1_inv_scan;
  545|  57.9k|    WORD16 *pi2_coeff_data = ps_dec->pi2_coeff_data;
  546|  57.9k|    WORD32 i;
  547|  57.9k|    WORD16 *pi2_dc_val_u = NULL;
  548|  57.9k|    WORD16 *pi2_dc_val_v = NULL;
  549|       |
  550|  57.9k|    PROFILE_DISABLE_UNPACK_CHROMA()
  ------------------
  |  |  113|  57.9k|#define PROFILE_DISABLE_UNPACK_CHROMA() ;
  ------------------
  551|  57.9k|    if((ps_cur_mb_info->u1_cbp >> 4) == CBPC_ALLZERO)
  ------------------
  |  |  507|  57.9k|#define CBPC_ALLZERO    0
  ------------------
  |  Branch (551:8): [True: 34.5k, False: 23.4k]
  ------------------
  552|  34.5k|        return;
  553|       |
  554|       |    /*
  555|       |     * Reserve the pointers to dc vals. The dc vals will be copied
  556|       |     * after unpacking of ac vals since memset to 0 inside.
  557|       |     */
  558|  23.4k|    if(CHECKBIT(ps_cur_mb_info->u1_yuv_dc_block_flag,1))
  ------------------
  |  |   54|  23.4k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 18.9k, False: 4.42k]
  |  |  ------------------
  ------------------
  559|  18.9k|    {
  560|  18.9k|        pi2_dc_val_u = (WORD16 *)ps_dec->pv_proc_tu_coeff_data;
  561|       |
  562|  18.9k|        ps_dec->pv_proc_tu_coeff_data = (void *)(pi2_dc_val_u + 4);
  563|  18.9k|    }
  564|  23.4k|    if(CHECKBIT(ps_cur_mb_info->u1_yuv_dc_block_flag,2))
  ------------------
  |  |   54|  23.4k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 18.6k, False: 4.81k]
  |  |  ------------------
  ------------------
  565|  18.6k|    {
  566|  18.6k|        pi2_dc_val_v = (WORD16 *)ps_dec->pv_proc_tu_coeff_data;
  567|       |
  568|  18.6k|        ps_dec->pv_proc_tu_coeff_data = (void *)(pi2_dc_val_v + 4);
  569|  18.6k|    }
  570|       |
  571|  23.4k|    if((ps_cur_mb_info->u1_cbp >> 4) == CBPC_NONZERO)
  ------------------
  |  |  509|  23.4k|#define CBPC_NONZERO    2
  ------------------
  |  Branch (571:8): [True: 12.5k, False: 10.8k]
  ------------------
  572|  12.5k|    {
  573|  12.5k|        pi2_coeff_data = ps_dec->pi2_coeff_data;
  574|  12.5k|        ih264d_unpack_coeff4x4_8x8blk_chroma(ps_dec,
  575|  12.5k|                                             ps_cur_mb_info,
  576|  12.5k|                                             ui2_chroma_csbp,
  577|  12.5k|                                             pi2_coeff_data);
  578|       |
  579|  12.5k|        pi2_coeff_data += 64;
  580|  12.5k|        ui2_chroma_csbp = ui2_chroma_csbp >> 4;
  581|  12.5k|        ih264d_unpack_coeff4x4_8x8blk_chroma(ps_dec,
  582|  12.5k|                                             ps_cur_mb_info,
  583|  12.5k|                                             ui2_chroma_csbp,
  584|  12.5k|                                             pi2_coeff_data);
  585|       |
  586|  12.5k|    }
  587|       |
  588|  23.4k|    pi2_coeff_data = ps_dec->pi2_coeff_data;
  589|  23.4k|    if(pi2_dc_val_u != NULL)
  ------------------
  |  Branch (589:8): [True: 18.9k, False: 4.42k]
  ------------------
  590|  18.9k|    {
  591|  18.9k|        pi2_coeff_data[0] = *pi2_dc_val_u++;
  592|  18.9k|        pi2_coeff_data[1 * 16] = *pi2_dc_val_u++;
  593|  18.9k|        pi2_coeff_data[2 * 16] = *pi2_dc_val_u++;
  594|  18.9k|        pi2_coeff_data[3 * 16] = *pi2_dc_val_u++;
  595|  18.9k|    }
  596|  4.42k|    else
  597|  4.42k|    {
  598|  4.42k|        pi2_coeff_data[0] = 0;
  599|  4.42k|        pi2_coeff_data[1 * 16] = 0;
  600|  4.42k|        pi2_coeff_data[2 * 16] = 0;
  601|  4.42k|        pi2_coeff_data[3 * 16] = 0;
  602|  4.42k|    }
  603|  23.4k|    pi2_coeff_data += 64;
  604|  23.4k|    if(pi2_dc_val_v != NULL)
  ------------------
  |  Branch (604:8): [True: 18.6k, False: 4.81k]
  ------------------
  605|  18.6k|    {
  606|  18.6k|        pi2_coeff_data[0] = *pi2_dc_val_v++;
  607|  18.6k|        pi2_coeff_data[1 * 16] = *pi2_dc_val_v++;
  608|  18.6k|        pi2_coeff_data[2 * 16] = *pi2_dc_val_v++;
  609|  18.6k|        pi2_coeff_data[3 * 16] = *pi2_dc_val_v++;
  610|  18.6k|    }
  611|  4.81k|    else
  612|  4.81k|    {
  613|  4.81k|        pi2_coeff_data[0] = 0;
  614|  4.81k|        pi2_coeff_data[1 * 16] = 0;
  615|  4.81k|        pi2_coeff_data[2 * 16] = 0;
  616|  4.81k|        pi2_coeff_data[3 * 16] = 0;
  617|  4.81k|    }
  618|  23.4k|}
ih264d_unpack_luma_coeff8x8_mb:
  621|  25.8k|{
  622|  25.8k|    WORD32 blk_8x8_cnt;
  623|  25.8k|    WORD16 *pi2_out_coeff_data = ps_dec->pi2_coeff_data;
  624|  25.8k|    UWORD8 u1_field_coding_flag = ps_cur_mb_info->ps_curmb->u1_mb_fld;
  625|  25.8k|    UWORD8 *pu1_inv_scan;
  626|  25.8k|    UWORD32 u4_luma_dc_only_cbp = 0;
  627|       |
  628|  25.8k|    PROFILE_DISABLE_UNPACK_LUMA()
  ------------------
  |  |  112|  25.8k|#define PROFILE_DISABLE_UNPACK_LUMA() ;
  ------------------
  629|  25.8k|    if(!u1_field_coding_flag)
  ------------------
  |  Branch (629:8): [True: 25.8k, False: 0]
  ------------------
  630|  25.8k|    {
  631|       |        /*******************************************************************/
  632|       |        /* initializing inverse scan  matrices                             */
  633|       |        /*******************************************************************/
  634|  25.8k|        pu1_inv_scan = (UWORD8 *)gau1_ih264d_inv_scan_prog8x8_cabac;
  635|  25.8k|    }
  636|      0|    else
  637|      0|    {
  638|       |        /*******************************************************************/
  639|       |        /* initializing inverse scan  matrices                             */
  640|       |        /*******************************************************************/
  641|      0|        pu1_inv_scan = (UWORD8 *)gau1_ih264d_inv_scan_int8x8_cabac;
  642|      0|    }
  643|       |
  644|   129k|    for(blk_8x8_cnt = 0; blk_8x8_cnt < 4; blk_8x8_cnt++)
  ------------------
  |  Branch (644:26): [True: 103k, False: 25.8k]
  ------------------
  645|   103k|    {
  646|   103k|        if(CHECKBIT(ps_cur_mb_info->u1_cbp, blk_8x8_cnt))
  ------------------
  |  |   54|   103k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 87.7k, False: 15.7k]
  |  |  ------------------
  ------------------
  647|  87.7k|        {
  648|  87.7k|            tu_blk8x8_coeff_data_t *ps_tu_8x8 = (tu_blk8x8_coeff_data_t *)ps_dec->pv_proc_tu_coeff_data;
  649|  87.7k|            UWORD32 u4_sig_coeff_map;
  650|  87.7k|            WORD32 idx = 0;
  651|  87.7k|            WORD16 *pi2_coeff_data = &ps_tu_8x8->ai2_level[0];
  652|  87.7k|            WORD32 num_coeff = 0;
  653|       |
  654|       |            /* memset 64 coefficient to zero */
  655|  87.7k|            memset(pi2_out_coeff_data,0,64*sizeof(WORD16));
  656|       |
  657|  87.7k|            u4_sig_coeff_map = ps_tu_8x8->au4_sig_coeff_map[1];
  658|       |
  659|   165k|            while(u4_sig_coeff_map)
  ------------------
  |  Branch (659:19): [True: 77.6k, False: 87.7k]
  ------------------
  660|  77.6k|            {
  661|  77.6k|                idx = CLZ(u4_sig_coeff_map);
  662|       |
  663|  77.6k|                idx = 31 - idx;
  664|  77.6k|                RESET_BIT(u4_sig_coeff_map,idx);
  ------------------
  |  |  105|  77.6k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  ------------------
  665|       |
  666|  77.6k|                idx = pu1_inv_scan[idx + 32];
  667|  77.6k|                pi2_out_coeff_data[idx] = *pi2_coeff_data++;
  668|  77.6k|                num_coeff++;
  669|  77.6k|            }
  670|       |
  671|  87.7k|            u4_sig_coeff_map = ps_tu_8x8->au4_sig_coeff_map[0];
  672|   337k|            while(u4_sig_coeff_map)
  ------------------
  |  Branch (672:19): [True: 249k, False: 87.7k]
  ------------------
  673|   249k|            {
  674|   249k|                idx = CLZ(u4_sig_coeff_map);
  675|       |
  676|   249k|                idx = 31 - idx;
  677|   249k|                RESET_BIT(u4_sig_coeff_map,idx);
  ------------------
  |  |  105|   249k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  ------------------
  678|       |
  679|   249k|                idx = pu1_inv_scan[idx];
  680|   249k|                pi2_out_coeff_data[idx] = *pi2_coeff_data++;
  681|   249k|                num_coeff++;
  682|   249k|            }
  683|       |
  684|  87.7k|            if((num_coeff == 1) && (idx == 0))
  ------------------
  |  Branch (684:16): [True: 5.69k, False: 82.0k]
  |  Branch (684:36): [True: 3.38k, False: 2.31k]
  ------------------
  685|  3.38k|            {
  686|  3.38k|                SET_BIT(u4_luma_dc_only_cbp,blk_8x8_cnt);
  ------------------
  |  |  106|  3.38k|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
  687|  3.38k|            }
  688|       |
  689|       |
  690|  87.7k|            {
  691|  87.7k|                WORD32 offset;
  692|  87.7k|                offset = (UWORD8 *)pi2_coeff_data - (UWORD8 *)ps_tu_8x8;
  693|  87.7k|                offset = ALIGN4(offset);
  ------------------
  |  |   52|  87.7k|#define ALIGN4(x)   ((((x) + 3) >> 2) << 2)
  ------------------
  694|  87.7k|                ps_dec->pv_proc_tu_coeff_data = (void *)((UWORD8 *)ps_dec->pv_proc_tu_coeff_data + offset);
  695|  87.7k|            }
  696|  87.7k|        }
  697|   103k|        pi2_out_coeff_data += 64;
  698|   103k|    }
  699|       |
  700|  25.8k|    return u4_luma_dc_only_cbp;
  701|  25.8k|}
ih264d_process_intra_mb:
  719|  10.0k|{
  720|  10.0k|    UWORD8 u1_mb_type = ps_cur_mb_info->u1_mb_type;
  721|  10.0k|    UWORD8 uc_temp = ps_cur_mb_info->u1_mb_ngbr_availablity;
  722|  10.0k|    UWORD8 u1_top_available = BOOLEAN(uc_temp & TOP_MB_AVAILABLE_MASK);
  ------------------
  |  |   61|  10.0k|#define BOOLEAN(x) (!!(x))
  ------------------
  723|  10.0k|    UWORD8 u1_left_available = BOOLEAN(uc_temp & LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   61|  10.0k|#define BOOLEAN(x) (!!(x))
  ------------------
  724|  10.0k|    UWORD8 u1_use_top_right_mb = BOOLEAN(uc_temp & TOP_RIGHT_MB_AVAILABLE_MASK);
  ------------------
  |  |   61|  10.0k|#define BOOLEAN(x) (!!(x))
  ------------------
  725|  10.0k|    UWORD8 u1_use_top_left_mb = BOOLEAN(uc_temp & TOP_LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   61|  10.0k|#define BOOLEAN(x) (!!(x))
  ------------------
  726|  10.0k|    UWORD8 uc_useTopMB = u1_top_available;
  727|  10.0k|    UWORD16 u2_use_left_mb = u1_left_available;
  728|  10.0k|    UWORD16 u2_use_left_mb_pack;
  729|  10.0k|    UWORD8 *pu1_luma_pred_buffer;
  730|       |    /* CHANGED CODE */
  731|  10.0k|    UWORD8 *pu1_luma_rec_buffer;
  732|  10.0k|    UWORD8 *puc_top;
  733|       |
  734|  10.0k|    mb_neigbour_params_t *ps_left_mb;
  735|  10.0k|    mb_neigbour_params_t *ps_top_mb;
  736|  10.0k|    mb_neigbour_params_t *ps_top_right_mb;
  737|  10.0k|    mb_neigbour_params_t *ps_curmb;
  738|       |
  739|  10.0k|    UWORD16 u2_mbx = ps_cur_mb_info->u2_mbx;
  740|  10.0k|    UWORD32 ui_pred_width, ui_rec_width;
  741|  10.0k|    WORD16 *pi2_y_coeff;
  742|  10.0k|    UWORD8 u1_mbaff, u1_topmb, u1_mb_field_decoding_flag;
  743|  10.0k|    UWORD32 u4_num_pmbair;
  744|  10.0k|    UWORD16 ui2_luma_csbp = ps_cur_mb_info->u2_luma_csbp;
  745|  10.0k|    UWORD8 *pu1_yleft, *pu1_ytop_left;
  746|       |    /* Chroma variables*/
  747|  10.0k|    UWORD8 *pu1_top_u;
  748|  10.0k|    UWORD8 *pu1_uleft;
  749|  10.0k|    UWORD8 *pu1_u_top_left;
  750|       |    /* CHANGED CODE */
  751|  10.0k|    UWORD8 *pu1_mb_cb_rei1_buffer, *pu1_mb_cr_rei1_buffer;
  752|  10.0k|    UWORD32 u4_recwidth_cr;
  753|       |    /* CHANGED CODE */
  754|  10.0k|    tfr_ctxt_t *ps_frame_buf = ps_dec->ps_frame_buf_ip_recon;
  755|  10.0k|    UWORD32 u4_luma_dc_only_csbp = 0;
  756|  10.0k|    UWORD32 u4_luma_dc_only_cbp = 0;
  757|       |
  758|  10.0k|    UWORD8 *pu1_prev_intra4x4_pred_mode_data = (UWORD8 *)ps_dec->pv_proc_tu_coeff_data;                 //Pointer to keep track of intra4x4_pred_mode data in pv_proc_tu_coeff_data buffer
  759|  10.0k|    u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  760|  10.0k|    u1_topmb = ps_cur_mb_info->u1_topmb;
  761|  10.0k|    u4_num_pmbair = (u4_mb_num >> u1_mbaff);
  762|       |
  763|       |
  764|       |    /*--------------------------------------------------------------------*/
  765|       |    /* Find the current MB's mb params                                    */
  766|       |    /*--------------------------------------------------------------------*/
  767|  10.0k|    u1_mb_field_decoding_flag = ps_cur_mb_info->u1_mb_field_decodingflag;
  768|       |
  769|  10.0k|    ps_curmb = ps_cur_mb_info->ps_curmb;
  770|  10.0k|    ps_top_mb = ps_cur_mb_info->ps_top_mb;
  771|  10.0k|    ps_left_mb = ps_cur_mb_info->ps_left_mb;
  772|  10.0k|    ps_top_right_mb = ps_cur_mb_info->ps_top_right_mb;
  773|       |
  774|       |    /*--------------------------------------------------------------------*/
  775|       |    /* Check whether neighbouring MB is Inter MB and                      */
  776|       |    /* constrained intra pred is 1.                                       */
  777|       |    /*--------------------------------------------------------------------*/
  778|  10.0k|    u2_use_left_mb_pack = (u2_use_left_mb << 8) + u2_use_left_mb;
  779|       |
  780|  10.0k|    if(ps_dec->ps_cur_pps->u1_constrained_intra_pred_flag)
  ------------------
  |  Branch (780:8): [True: 2.96k, False: 7.11k]
  ------------------
  781|  2.96k|    {
  782|  2.96k|        UWORD8 u1_left = (UWORD8)u2_use_left_mb;
  783|       |
  784|  2.96k|        uc_useTopMB = uc_useTopMB
  ------------------
  |  Branch (784:23): [True: 2.46k, False: 500]
  ------------------
  785|  2.46k|                        && ((ps_top_mb->u1_mb_type != P_MB)
  ------------------
  |  |  419|  2.46k|#define P_MB        2
  ------------------
  |  Branch (785:29): [True: 2.35k, False: 111]
  ------------------
  786|  2.35k|                                        && (ps_top_mb->u1_mb_type != B_MB));
  ------------------
  |  |  420|  2.35k|#define B_MB        3
  ------------------
  |  Branch (786:44): [True: 2.35k, False: 0]
  ------------------
  787|  2.96k|        u2_use_left_mb = u2_use_left_mb
  ------------------
  |  Branch (787:26): [True: 2.21k, False: 747]
  ------------------
  788|  2.21k|                        && ((ps_left_mb->u1_mb_type != P_MB)
  ------------------
  |  |  419|  2.21k|#define P_MB        2
  ------------------
  |  Branch (788:29): [True: 2.12k, False: 94]
  ------------------
  789|  2.12k|                                        && (ps_left_mb->u1_mb_type != B_MB));
  ------------------
  |  |  420|  2.12k|#define B_MB        3
  ------------------
  |  Branch (789:44): [True: 2.11k, False: 4]
  ------------------
  790|       |
  791|  2.96k|        u2_use_left_mb_pack = (u2_use_left_mb << 8) + u2_use_left_mb;
  792|  2.96k|        if(u1_mbaff)
  ------------------
  |  Branch (792:12): [True: 0, False: 2.96k]
  ------------------
  793|      0|        {
  794|      0|            if(u1_mb_field_decoding_flag ^ ps_left_mb->u1_mb_fld)
  ------------------
  |  Branch (794:16): [True: 0, False: 0]
  ------------------
  795|      0|            {
  796|      0|                u1_left = u1_left
  ------------------
  |  Branch (796:27): [True: 0, False: 0]
  ------------------
  797|      0|                                && (((ps_left_mb + 1)->u1_mb_type != P_MB)
  ------------------
  |  |  419|      0|#define P_MB        2
  ------------------
  |  Branch (797:37): [True: 0, False: 0]
  ------------------
  798|      0|                                                && ((ps_left_mb + 1)->u1_mb_type
  ------------------
  |  Branch (798:52): [True: 0, False: 0]
  ------------------
  799|      0|                                                                != B_MB));
  ------------------
  |  |  420|      0|#define B_MB        3
  ------------------
  800|      0|                u2_use_left_mb = u2_use_left_mb && u1_left;
  ------------------
  |  Branch (800:34): [True: 0, False: 0]
  |  Branch (800:52): [True: 0, False: 0]
  ------------------
  801|      0|                if(u1_mb_field_decoding_flag)
  ------------------
  |  Branch (801:20): [True: 0, False: 0]
  ------------------
  802|      0|                    u2_use_left_mb_pack = (u1_left << 8)
  803|      0|                                    + (u2_use_left_mb_pack & 0xff);
  804|      0|                else
  805|      0|                    u2_use_left_mb_pack = (u2_use_left_mb << 8)
  806|      0|                                    + (u2_use_left_mb);
  807|      0|            }
  808|      0|        }
  809|  2.96k|        u1_use_top_right_mb =
  810|  2.96k|                        u1_use_top_right_mb
  ------------------
  |  Branch (810:25): [True: 2.10k, False: 859]
  ------------------
  811|  2.10k|                                        && ((ps_top_right_mb->u1_mb_type != P_MB)
  ------------------
  |  |  419|  2.10k|#define P_MB        2
  ------------------
  |  Branch (811:45): [True: 2.02k, False: 82]
  ------------------
  812|  2.02k|                                                        && (ps_top_right_mb->u1_mb_type
  ------------------
  |  Branch (812:60): [True: 2.02k, False: 0]
  ------------------
  813|  2.02k|                                                                        != B_MB));
  ------------------
  |  |  420|  2.02k|#define B_MB        3
  ------------------
  814|       |
  815|  2.96k|        u1_use_top_left_mb =
  816|  2.96k|                        u1_use_top_left_mb
  ------------------
  |  Branch (816:25): [True: 2.11k, False: 849]
  ------------------
  817|  2.11k|                                        && ((ps_cur_mb_info->u1_topleft_mbtype != P_MB)
  ------------------
  |  |  419|  2.11k|#define P_MB        2
  ------------------
  |  Branch (817:45): [True: 2.02k, False: 91]
  ------------------
  818|  2.02k|                                                        && (ps_cur_mb_info->u1_topleft_mbtype
  ------------------
  |  Branch (818:60): [True: 2.01k, False: 4]
  ------------------
  819|  2.02k|                                                                        != B_MB));
  ------------------
  |  |  420|  2.02k|#define B_MB        3
  ------------------
  820|  2.96k|    }
  821|       |
  822|       |    /*********************Common pointer calculations *************************/
  823|       |    /* CHANGED CODE */
  824|  10.0k|    pu1_luma_pred_buffer = ps_dec->pu1_y;
  825|  10.0k|    pu1_luma_rec_buffer = ps_frame_buf->pu1_dest_y + (u4_num_pmbair << 4);
  826|  10.0k|    pu1_mb_cb_rei1_buffer = ps_frame_buf->pu1_dest_u
  827|  10.0k|                    + (u4_num_pmbair << 3) * YUV420SP_FACTOR;
  ------------------
  |  |  119|  10.0k|#define YUV420SP_FACTOR 2
  ------------------
  828|  10.0k|    pu1_mb_cr_rei1_buffer = ps_frame_buf->pu1_dest_v + (u4_num_pmbair << 3);
  829|  10.0k|    ui_pred_width = MB_SIZE;
  ------------------
  |  |  554|  10.0k|#define MB_SIZE             16
  ------------------
  830|  10.0k|    ui_rec_width = ps_dec->u2_frm_wd_y << u1_mb_field_decoding_flag;
  831|  10.0k|    u4_recwidth_cr = ps_dec->u2_frm_wd_uv << u1_mb_field_decoding_flag;
  832|       |    /************* Current and top luma pointer *****************/
  833|       |
  834|  10.0k|    if(u1_mbaff)
  ------------------
  |  Branch (834:8): [True: 0, False: 10.0k]
  ------------------
  835|      0|    {
  836|      0|        if(u1_topmb == 0)
  ------------------
  |  Branch (836:12): [True: 0, False: 0]
  ------------------
  837|      0|        {
  838|      0|            pu1_luma_rec_buffer += (
  839|      0|                            u1_mb_field_decoding_flag ?
  ------------------
  |  Branch (839:29): [True: 0, False: 0]
  ------------------
  840|      0|                                            (ui_rec_width >> 1) :
  841|      0|                                            (ui_rec_width << 4));
  842|      0|            pu1_mb_cb_rei1_buffer += (
  843|      0|                            u1_mb_field_decoding_flag ?
  ------------------
  |  Branch (843:29): [True: 0, False: 0]
  ------------------
  844|      0|                                            (u4_recwidth_cr >> 1) :
  845|      0|                                            (u4_recwidth_cr << 3));
  846|      0|            pu1_mb_cr_rei1_buffer += (
  847|      0|                            u1_mb_field_decoding_flag ?
  ------------------
  |  Branch (847:29): [True: 0, False: 0]
  ------------------
  848|      0|                                            (u4_recwidth_cr >> 1) :
  849|      0|                                            (u4_recwidth_cr << 3));
  850|      0|        }
  851|      0|    }
  852|       |
  853|       |    /* CHANGED CODE */
  854|  10.0k|    if(ps_dec->u4_use_intrapred_line_copy == 1)
  ------------------
  |  Branch (854:8): [True: 10.0k, False: 0]
  ------------------
  855|  10.0k|    {
  856|  10.0k|        puc_top = ps_dec->pu1_prev_y_intra_pred_line + (ps_cur_mb_info->u2_mbx << 4);
  857|  10.0k|        pu1_top_u = ps_dec->pu1_prev_u_intra_pred_line
  858|  10.0k|                        + (ps_cur_mb_info->u2_mbx << 3) * YUV420SP_FACTOR;
  ------------------
  |  |  119|  10.0k|#define YUV420SP_FACTOR 2
  ------------------
  859|  10.0k|    }
  860|      0|    else
  861|      0|    {
  862|      0|        puc_top = pu1_luma_rec_buffer - ui_rec_width;
  863|      0|        pu1_top_u = pu1_mb_cb_rei1_buffer - u4_recwidth_cr;
  864|      0|    }
  865|       |    /* CHANGED CODE */
  866|       |
  867|       |    /************* Left pointer *****************/
  868|  10.0k|    pu1_yleft = pu1_luma_rec_buffer - 1;
  869|  10.0k|    pu1_uleft = pu1_mb_cb_rei1_buffer - 1 * YUV420SP_FACTOR;
  ------------------
  |  |  119|  10.0k|#define YUV420SP_FACTOR 2
  ------------------
  870|       |
  871|       |    /**************Top Left pointer calculation**********/
  872|  10.0k|    pu1_ytop_left = puc_top - 1;
  873|  10.0k|    pu1_u_top_left = pu1_top_u - 1 * YUV420SP_FACTOR;
  ------------------
  |  |  119|  10.0k|#define YUV420SP_FACTOR 2
  ------------------
  874|       |
  875|       |    /* CHANGED CODE */
  876|  10.0k|    PROFILE_DISABLE_INTRA_PRED()
  ------------------
  |  |  105|  10.0k|#define PROFILE_DISABLE_INTRA_PRED() ;
  ------------------
  877|  10.0k|    {
  878|  10.0k|        pu1_prev_intra4x4_pred_mode_data = (UWORD8 *)ps_dec->pv_proc_tu_coeff_data;
  879|  10.0k|        if(u1_mb_type == I_4x4_MB && ps_cur_mb_info->u1_tran_form8x8 == 0)
  ------------------
  |  |  417|  20.1k|#define I_4x4_MB    0
  ------------------
  |  Branch (879:12): [True: 7.88k, False: 2.19k]
  |  Branch (879:38): [True: 3.32k, False: 4.56k]
  ------------------
  880|  3.32k|        {
  881|  3.32k|            ps_dec->pv_proc_tu_coeff_data = (void *)((UWORD8 *)ps_dec->pv_proc_tu_coeff_data + 32);
  882|       |
  883|  3.32k|        }
  884|  6.75k|        else if (u1_mb_type == I_4x4_MB && ps_cur_mb_info->u1_tran_form8x8 == 1)
  ------------------
  |  |  417|  13.5k|#define I_4x4_MB    0
  ------------------
  |  Branch (884:18): [True: 4.56k, False: 2.19k]
  |  Branch (884:44): [True: 4.56k, False: 0]
  ------------------
  885|  4.56k|        {
  886|  4.56k|            ps_dec->pv_proc_tu_coeff_data = (void *)((UWORD8 *)ps_dec->pv_proc_tu_coeff_data + 8);
  887|  4.56k|        }
  888|  10.0k|    }
  889|  10.0k|    if(!ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (889:8): [True: 5.51k, False: 4.56k]
  ------------------
  890|  5.51k|    {
  891|  5.51k|        u4_luma_dc_only_csbp = ih264d_unpack_luma_coeff4x4_mb(ps_dec,
  892|  5.51k|                                       ps_cur_mb_info,
  893|  5.51k|                                       1);
  894|  5.51k|    }
  895|  4.56k|    else
  896|  4.56k|    {
  897|  4.56k|        if(!ps_dec->ps_cur_pps->u1_entropy_coding_mode)
  ------------------
  |  Branch (897:12): [True: 0, False: 4.56k]
  ------------------
  898|      0|        {
  899|      0|            u4_luma_dc_only_cbp = ih264d_unpack_luma_coeff4x4_mb(ps_dec,
  900|      0|                                           ps_cur_mb_info,
  901|      0|                                           1);
  902|      0|        }
  903|  4.56k|        else
  904|  4.56k|        {
  905|  4.56k|            u4_luma_dc_only_cbp = ih264d_unpack_luma_coeff8x8_mb(ps_dec,
  906|  4.56k|                                           ps_cur_mb_info);
  907|  4.56k|        }
  908|  4.56k|    }
  909|       |
  910|  10.0k|    pi2_y_coeff = ps_dec->pi2_coeff_data;
  911|       |
  912|  10.0k|    if(u1_mb_type != I_4x4_MB)
  ------------------
  |  |  417|  10.0k|#define I_4x4_MB    0
  ------------------
  |  Branch (912:8): [True: 2.19k, False: 7.88k]
  ------------------
  913|  2.19k|    {
  914|  2.19k|        UWORD8 u1_intrapred_mode = MB_TYPE_TO_INTRA_16x16_MODE(u1_mb_type);
  ------------------
  |  |   45|  2.19k|#define MB_TYPE_TO_INTRA_16x16_MODE(x) ((x - 1) & 0x03)
  ------------------
  915|       |        /*--------------------------------------------------------------------*/
  916|       |        /* 16x16 IntraPrediction                                              */
  917|       |        /*--------------------------------------------------------------------*/
  918|  2.19k|        {
  919|  2.19k|            UWORD8 u1_packed_modes = (u1_top_available << 1)
  920|  2.19k|                            + u1_left_available;
  921|  2.19k|            UWORD8 u1_err_code =
  922|  2.19k|                            (u1_intrapred_mode & 1) ?
  ------------------
  |  Branch (922:29): [True: 696, False: 1.49k]
  ------------------
  923|    696|                                            u1_intrapred_mode :
  924|  2.19k|                                            (u1_intrapred_mode ^ 2);
  925|       |
  926|  2.19k|            if((u1_err_code & u1_packed_modes) ^ u1_err_code)
  ------------------
  |  Branch (926:16): [True: 366, False: 1.82k]
  ------------------
  927|    366|            {
  928|    366|                u1_intrapred_mode = 0;
  929|    366|            }
  930|  2.19k|        }
  931|  2.19k|        {
  932|       |            /* Align the size to multiple of 8, so that SIMD functions
  933|       |               can read 64 bits at a time. Only 33 bytes are actaully used */
  934|  2.19k|            UWORD8 au1_ngbr_pels[40];
  935|       |            /* Get neighbour pixels */
  936|       |            /* left pels */
  937|  2.19k|            if(u2_use_left_mb)
  ------------------
  |  Branch (937:16): [True: 1.30k, False: 885]
  ------------------
  938|  1.30k|            {
  939|  1.30k|                WORD32 i;
  940|  22.2k|                for(i = 0; i < 16; i++)
  ------------------
  |  Branch (940:28): [True: 20.9k, False: 1.30k]
  ------------------
  941|  20.9k|                    au1_ngbr_pels[16 - 1 - i] = pu1_yleft[i * ui_rec_width];
  942|  1.30k|            }
  943|    885|            else
  944|    885|            {
  945|    885|                memset(au1_ngbr_pels, 0, 16);
  946|    885|            }
  947|       |
  948|       |            /* top left pels */
  949|  2.19k|            au1_ngbr_pels[16] = *pu1_ytop_left;
  950|       |
  951|       |            /* top pels */
  952|  2.19k|            if(uc_useTopMB)
  ------------------
  |  Branch (952:16): [True: 1.92k, False: 273]
  ------------------
  953|  1.92k|            {
  954|  1.92k|                memcpy(au1_ngbr_pels + 16 + 1, puc_top, 16);
  955|  1.92k|            }
  956|    273|            else
  957|    273|            {
  958|    273|                memset(au1_ngbr_pels + 16 + 1, 0, 16);
  959|    273|            }
  960|  2.19k|            PROFILE_DISABLE_INTRA_PRED()
  ------------------
  |  |  105|  2.19k|#define PROFILE_DISABLE_INTRA_PRED() ;
  ------------------
  961|  2.19k|            ps_dec->apf_intra_pred_luma_16x16[u1_intrapred_mode](
  962|  2.19k|                            au1_ngbr_pels, pu1_luma_rec_buffer, 1, ui_rec_width,
  963|  2.19k|                            ((uc_useTopMB << 2) | u2_use_left_mb));
  964|  2.19k|        }
  965|  2.19k|        {
  966|  2.19k|            UWORD32 i;
  967|  2.19k|            WORD16 ai2_tmp[16];
  968|  37.2k|            for(i = 0; i < 16; i++)
  ------------------
  |  Branch (968:24): [True: 35.0k, False: 2.19k]
  ------------------
  969|  35.0k|            {
  970|  35.0k|                WORD16 *pi2_level = pi2_y_coeff + (i << 4);
  971|  35.0k|                UWORD8 *pu1_pred_sblk = pu1_luma_rec_buffer
  972|  35.0k|                                + ((i & 0x3) * BLK_SIZE)
  ------------------
  |  |  556|  35.0k|#define BLK_SIZE             4
  ------------------
  973|  35.0k|                                + (i >> 2) * (ui_rec_width << 2);
  974|  35.0k|                PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  35.0k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
  975|  35.0k|                {
  976|  35.0k|                    if(CHECKBIT(ps_cur_mb_info->u2_luma_csbp, i))
  ------------------
  |  |   54|  35.0k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 6.58k, False: 28.4k]
  |  |  ------------------
  ------------------
  977|  6.58k|                    {
  978|  6.58k|                        ps_dec->pf_iquant_itrans_recon_luma_4x4(
  979|  6.58k|                                        pi2_level,
  980|  6.58k|                                        pu1_pred_sblk,
  981|  6.58k|                                        pu1_pred_sblk,
  982|  6.58k|                                        ui_rec_width,
  983|  6.58k|                                        ui_rec_width,
  984|  6.58k|                                        gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6],
  985|  6.58k|                                        (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[0],
  986|  6.58k|                                        ps_cur_mb_info->u1_qp_div6, ai2_tmp, 1,
  987|  6.58k|                                        pi2_level);
  988|  6.58k|                    }
  989|  28.4k|                    else if((CHECKBIT(u4_luma_dc_only_csbp, i)) && pi2_level[0] != 0)
  ------------------
  |  |   54|  28.4k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  ------------------
  |  Branch (989:29): [True: 16.4k, False: 12.0k]
  |  Branch (989:68): [True: 14.7k, False: 1.68k]
  ------------------
  990|  14.7k|                    {
  991|  14.7k|                        ps_dec->pf_iquant_itrans_recon_luma_4x4_dc(
  992|  14.7k|                                        pi2_level,
  993|  14.7k|                                        pu1_pred_sblk,
  994|  14.7k|                                        pu1_pred_sblk,
  995|  14.7k|                                        ui_rec_width,
  996|  14.7k|                                        ui_rec_width,
  997|  14.7k|                                        gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6],
  998|  14.7k|                                        (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[0],
  999|  14.7k|                                        ps_cur_mb_info->u1_qp_div6, ai2_tmp, 1,
 1000|  14.7k|                                        pi2_level);
 1001|  14.7k|                    }
 1002|  35.0k|                }
 1003|  35.0k|            }
 1004|  2.19k|        }
 1005|  2.19k|    }
 1006|  7.88k|    else if(!ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (1006:13): [True: 3.32k, False: 4.56k]
  ------------------
 1007|  3.32k|    {
 1008|  3.32k|        UWORD8 u1_is_left_sub_block, u1_is_top_sub_block = uc_useTopMB;
 1009|  3.32k|        UWORD8 u1_sub_blk_x, u1_sub_blk_y, u1_sub_mb_num;
 1010|  3.32k|        WORD8 i1_top_pred_mode;
 1011|  3.32k|        WORD8 i1_left_pred_mode;
 1012|  3.32k|        UWORD8 *pu1_top, *pu1_left, *pu1_top_left, *pu1_top_right;
 1013|  3.32k|        WORD8 *pi1_cur_pred_mode, *pi1_left_pred_mode, *pc_topPredMode;
 1014|  3.32k|        UWORD16 ui2_left_pred_buf_width = 0xffff;
 1015|  3.32k|        WORD8 i1_intra_pred;
 1016|  3.32k|        UWORD8 *pu1_prev_intra4x4_pred_mode_flag = pu1_prev_intra4x4_pred_mode_data;
 1017|  3.32k|        UWORD8 *pu1_rem_intra4x4_pred_mode = pu1_prev_intra4x4_pred_mode_data + 16;
 1018|  3.32k|        WORD16 *pi2_y_coeff1;
 1019|  3.32k|        UWORD8 u1_cur_sub_block;
 1020|  3.32k|        UWORD16 ui2_top_rt_mask;
 1021|       |
 1022|       |        /*--------------------------------------------------------------------*/
 1023|       |        /* 4x4 IntraPrediction                                                */
 1024|       |        /*--------------------------------------------------------------------*/
 1025|       |        /* Calculation of Top Right subblock mask                             */
 1026|       |        /*                                                                    */
 1027|       |        /* (a) Set it to default mask                                         */
 1028|       |        /*     [It has 0 for sublocks which will never have top-right sub block] */
 1029|       |        /*                                                                    */
 1030|       |        /* (b) If top MB is not available                                     */
 1031|       |        /*      Clear the bits of the first row sub blocks                    */
 1032|       |        /*                                                                    */
 1033|       |        /* (c) Set/Clear bit for top-right sublock of MB                      */
 1034|       |        /*      [5 sub-block in decoding order] based on TOP RIGHT MB availablity */
 1035|       |        /*--------------------------------------------------------------------*/
 1036|       |
 1037|  3.32k|        pu1_top = puc_top;
 1038|       |
 1039|  3.32k|        ui2_top_rt_mask = (u1_use_top_right_mb << 3) | (0x5750);
 1040|  3.32k|        if(uc_useTopMB)
  ------------------
  |  Branch (1040:12): [True: 2.81k, False: 512]
  ------------------
 1041|  2.81k|            ui2_top_rt_mask |= 0x7;
 1042|       |
 1043|       |        /*Top Related initialisations*/
 1044|       |
 1045|       |
 1046|  3.32k|        pi1_cur_pred_mode = ps_cur_mb_info->ps_curmb->pi1_intrapredmodes;
 1047|  3.32k|        pc_topPredMode = ps_cur_mb_info->ps_top_mb->pi1_intrapredmodes;
 1048|       |        /*--------------------------------------
 1049|       |         if(u1_mbaff)
 1050|       |         {
 1051|       |
 1052|       |         pi1_cur_pred_mode += (u2_mbx << 2);
 1053|       |         pc_topPredMode = pi1_cur_pred_mode + ps_cur_mb_info->i1_offset;
 1054|       |         pi1_cur_pred_mode += (u1_topmb) ? 0: 4;
 1055|       |         }*/
 1056|       |
 1057|  3.32k|        if(u1_top_available)
  ------------------
  |  Branch (1057:12): [True: 2.83k, False: 491]
  ------------------
 1058|  2.83k|        {
 1059|  2.83k|            if(ps_top_mb->u1_mb_type == I_4x4_MB)
  ------------------
  |  |  417|  2.83k|#define I_4x4_MB    0
  ------------------
  |  Branch (1059:16): [True: 2.40k, False: 423]
  ------------------
 1060|  2.40k|                *(WORD32*)pi1_cur_pred_mode = *(WORD32*)pc_topPredMode;
 1061|    423|            else
 1062|    423|                *(WORD32*)pi1_cur_pred_mode =
 1063|    423|                                (uc_useTopMB) ? DC_DC_DC_DC : NOT_VALID;
  ------------------
  |  |  434|    402|#define DC_DC_DC_DC   0x02020202 /*packed 4 bytes used in Decode Intra Mb*/
  ------------------
                                              (uc_useTopMB) ? DC_DC_DC_DC : NOT_VALID;
  ------------------
  |  |  433|     21|#define NOT_VALID -1
  ------------------
  |  Branch (1063:33): [True: 402, False: 21]
  ------------------
 1064|  2.83k|        }
 1065|    491|        else
 1066|    491|            *(WORD32*)pi1_cur_pred_mode = NOT_VALID;
  ------------------
  |  |  433|    491|#define NOT_VALID -1
  ------------------
 1067|       |        /* CHANGED CODE */
 1068|       |
 1069|       |        /* CHANGED CODE */
 1070|       |
 1071|       |        /*Left Related initialisations*/
 1072|  3.32k|        pi1_left_pred_mode = ps_dec->pi1_left_pred_mode;
 1073|  3.32k|        if(!u1_mbaff)
  ------------------
  |  Branch (1073:12): [True: 3.32k, False: 0]
  ------------------
 1074|  3.32k|        {
 1075|       |
 1076|  3.32k|            if(u1_left_available)
  ------------------
  |  Branch (1076:16): [True: 2.26k, False: 1.05k]
  ------------------
 1077|  2.26k|            {
 1078|       |
 1079|  2.26k|                if(ps_left_mb->u1_mb_type != I_4x4_MB)
  ------------------
  |  |  417|  2.26k|#define I_4x4_MB    0
  ------------------
  |  Branch (1079:20): [True: 185, False: 2.08k]
  ------------------
 1080|    185|                    *(WORD32*)pi1_left_pred_mode =
 1081|    185|                                    (u2_use_left_mb_pack) ?
  ------------------
  |  Branch (1081:37): [True: 168, False: 17]
  ------------------
 1082|    168|                                    DC_DC_DC_DC :
  ------------------
  |  |  434|    168|#define DC_DC_DC_DC   0x02020202 /*packed 4 bytes used in Decode Intra Mb*/
  ------------------
 1083|    185|                                                            NOT_VALID;
  ------------------
  |  |  433|     17|#define NOT_VALID -1
  ------------------
 1084|       |
 1085|  2.26k|            }
 1086|  1.05k|            else
 1087|  1.05k|            {
 1088|       |
 1089|  1.05k|                *(WORD32*)pi1_left_pred_mode = NOT_VALID;
  ------------------
  |  |  433|  1.05k|#define NOT_VALID -1
  ------------------
 1090|  1.05k|            }
 1091|       |
 1092|  3.32k|        }
 1093|      0|        else
 1094|      0|        {
 1095|      0|            UWORD8 u1_curMbfld = ps_cur_mb_info->u1_mb_field_decodingflag;
 1096|      0|            UWORD8 u1_leftMbfld = ps_left_mb->u1_mb_fld;
 1097|       |
 1098|      0|            if(u1_curMbfld ^ u1_leftMbfld)
  ------------------
  |  Branch (1098:16): [True: 0, False: 0]
  ------------------
 1099|      0|            {
 1100|       |
 1101|      0|                if(u1_topmb
  ------------------
  |  Branch (1101:20): [True: 0, False: 0]
  ------------------
 1102|      0|                                | ((u1_topmb == 0)
  ------------------
  |  Branch (1102:36): [True: 0, False: 0]
  ------------------
 1103|      0|                                                && ((ps_curmb - 1)->u1_mb_type
  ------------------
  |  Branch (1103:52): [True: 0, False: 0]
  ------------------
 1104|      0|                                                                != I_4x4_MB)))
  ------------------
  |  |  417|      0|#define I_4x4_MB    0
  ------------------
 1105|      0|                {
 1106|      0|                    if(u1_left_available)
  ------------------
  |  Branch (1106:24): [True: 0, False: 0]
  ------------------
 1107|      0|                    {
 1108|      0|                        if(ps_left_mb->u1_mb_type != I_4x4_MB)
  ------------------
  |  |  417|      0|#define I_4x4_MB    0
  ------------------
  |  Branch (1108:28): [True: 0, False: 0]
  ------------------
 1109|      0|                        {
 1110|      0|                            if(CHECKBIT(u2_use_left_mb_pack,0) == 0)
  ------------------
  |  |   54|      0|#define CHECKBIT(a,i) ((a) &  (1 << i))
  ------------------
  |  Branch (1110:32): [True: 0, False: 0]
  ------------------
 1111|      0|                                *(WORD32*)pi1_left_pred_mode = NOT_VALID;
  ------------------
  |  |  433|      0|#define NOT_VALID -1
  ------------------
 1112|      0|                            else
 1113|      0|                                *(WORD32*)pi1_left_pred_mode = DC_DC_DC_DC;
  ------------------
  |  |  434|      0|#define DC_DC_DC_DC   0x02020202 /*packed 4 bytes used in Decode Intra Mb*/
  ------------------
 1114|      0|                        }
 1115|      0|                    }
 1116|      0|                    else
 1117|      0|                        *(WORD32*)pi1_left_pred_mode = NOT_VALID;
  ------------------
  |  |  433|      0|#define NOT_VALID -1
  ------------------
 1118|       |
 1119|      0|                    if(u1_curMbfld)
  ------------------
  |  Branch (1119:24): [True: 0, False: 0]
  ------------------
 1120|      0|                    {
 1121|      0|                        if(u1_left_available)
  ------------------
  |  Branch (1121:28): [True: 0, False: 0]
  ------------------
 1122|      0|                        {
 1123|      0|                            if((ps_left_mb + 1)->u1_mb_type != I_4x4_MB)
  ------------------
  |  |  417|      0|#define I_4x4_MB    0
  ------------------
  |  Branch (1123:32): [True: 0, False: 0]
  ------------------
 1124|      0|                            {
 1125|      0|                                if(u2_use_left_mb_pack >> 8)
  ------------------
  |  Branch (1125:36): [True: 0, False: 0]
  ------------------
 1126|      0|                                    *(WORD32*)(pi1_left_pred_mode + 4) =
 1127|      0|                                                    DC_DC_DC_DC;
  ------------------
  |  |  434|      0|#define DC_DC_DC_DC   0x02020202 /*packed 4 bytes used in Decode Intra Mb*/
  ------------------
 1128|      0|                                else
 1129|      0|                                    *(WORD32*)(pi1_left_pred_mode + 4) =
 1130|      0|                                                    NOT_VALID;
  ------------------
  |  |  433|      0|#define NOT_VALID -1
  ------------------
 1131|      0|                            }
 1132|      0|                        }
 1133|      0|                        else
 1134|      0|                            *(WORD32*)(pi1_left_pred_mode + 4) = NOT_VALID;
  ------------------
  |  |  433|      0|#define NOT_VALID -1
  ------------------
 1135|      0|                        pi1_left_pred_mode[1] = pi1_left_pred_mode[2];
 1136|      0|                        pi1_left_pred_mode[2] = pi1_left_pred_mode[4];
 1137|      0|                        pi1_left_pred_mode[3] = pi1_left_pred_mode[6];
 1138|      0|                        *(WORD32*)(pi1_left_pred_mode + 4) =
 1139|      0|                                        *(WORD32*)pi1_left_pred_mode;
 1140|      0|                    }
 1141|      0|                    else
 1142|      0|                    {
 1143|       |
 1144|      0|                        pi1_left_pred_mode[7] = pi1_left_pred_mode[3];
 1145|      0|                        pi1_left_pred_mode[6] = pi1_left_pred_mode[3];
 1146|      0|                        pi1_left_pred_mode[5] = pi1_left_pred_mode[2];
 1147|      0|                        pi1_left_pred_mode[4] = pi1_left_pred_mode[2];
 1148|      0|                        pi1_left_pred_mode[3] = pi1_left_pred_mode[1];
 1149|      0|                        pi1_left_pred_mode[2] = pi1_left_pred_mode[1];
 1150|      0|                        pi1_left_pred_mode[1] = pi1_left_pred_mode[0];
 1151|      0|                    }
 1152|      0|                }
 1153|      0|                pi1_left_pred_mode += (u1_topmb) ? 0 : 4;
  ------------------
  |  Branch (1153:39): [True: 0, False: 0]
  ------------------
 1154|      0|            }
 1155|      0|            else
 1156|      0|            {
 1157|       |
 1158|      0|                pi1_left_pred_mode += (u1_topmb) ? 0 : 4;
  ------------------
  |  Branch (1158:39): [True: 0, False: 0]
  ------------------
 1159|      0|                if(u1_left_available)
  ------------------
  |  Branch (1159:20): [True: 0, False: 0]
  ------------------
 1160|      0|                {
 1161|       |
 1162|      0|                    if(ps_left_mb->u1_mb_type != I_4x4_MB)
  ------------------
  |  |  417|      0|#define I_4x4_MB    0
  ------------------
  |  Branch (1162:24): [True: 0, False: 0]
  ------------------
 1163|      0|                        *(WORD32*)pi1_left_pred_mode =
 1164|      0|                                        (u2_use_left_mb_pack) ?
  ------------------
  |  Branch (1164:41): [True: 0, False: 0]
  ------------------
 1165|      0|                                        DC_DC_DC_DC :
  ------------------
  |  |  434|      0|#define DC_DC_DC_DC   0x02020202 /*packed 4 bytes used in Decode Intra Mb*/
  ------------------
 1166|      0|                                                                NOT_VALID;
  ------------------
  |  |  433|      0|#define NOT_VALID -1
  ------------------
 1167|      0|                }
 1168|      0|                else
 1169|      0|                    *(WORD32*)pi1_left_pred_mode = NOT_VALID;
  ------------------
  |  |  433|      0|#define NOT_VALID -1
  ------------------
 1170|      0|            }
 1171|      0|        }
 1172|       |        /* One time pointer initialisations*/
 1173|  3.32k|        pi2_y_coeff1 = pi2_y_coeff;
 1174|  3.32k|        pu1_top_left = pu1_ytop_left;
 1175|       |
 1176|       |        /* Scan the sub-blocks in Raster Scan Order */
 1177|  56.4k|        for(u1_sub_mb_num = 0; u1_sub_mb_num < 16; u1_sub_mb_num++)
  ------------------
  |  Branch (1177:32): [True: 53.1k, False: 3.32k]
  ------------------
 1178|  53.1k|        {
 1179|       |            /* Align the size to multiple of 8, so that SIMD functions
 1180|       |               can read 64 bits at a time. Only 13 bytes are actaully used */
 1181|  53.1k|            UWORD8 au1_ngbr_pels[16];
 1182|       |
 1183|  53.1k|            u1_sub_blk_x = u1_sub_mb_num & 0x3;
 1184|  53.1k|            u1_sub_blk_y = u1_sub_mb_num >> 2;
 1185|  53.1k|            i1_top_pred_mode = pi1_cur_pred_mode[u1_sub_blk_x];
 1186|  53.1k|            i1_left_pred_mode = pi1_left_pred_mode[u1_sub_blk_y];
 1187|  53.1k|            u1_use_top_right_mb = (!!CHECKBIT(ui2_top_rt_mask, u1_sub_mb_num));
  ------------------
  |  |   54|  53.1k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  ------------------
 1188|       |
 1189|       |            /*********** left subblock availability**********/
 1190|  53.1k|            if(u1_sub_blk_x)
  ------------------
  |  Branch (1190:16): [True: 39.8k, False: 13.2k]
  ------------------
 1191|  39.8k|                u1_is_left_sub_block = 1;
 1192|  13.2k|            else
 1193|  13.2k|                u1_is_left_sub_block =
 1194|  13.2k|                                (u1_sub_blk_y < 2) ?
  ------------------
  |  Branch (1194:33): [True: 6.64k, False: 6.64k]
  ------------------
 1195|  6.64k|                                                (CHECKBIT(u2_use_left_mb_pack,
  ------------------
  |  |   54|  6.64k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  ------------------
 1196|  6.64k|                                                          0)) :
 1197|  13.2k|                                                (u2_use_left_mb_pack >> 8);
 1198|       |
 1199|       |            /* CHANGED CODE */
 1200|  53.1k|            if(u1_sub_blk_y)
  ------------------
  |  Branch (1200:16): [True: 39.8k, False: 13.2k]
  ------------------
 1201|  39.8k|                u1_is_top_sub_block = 1;
 1202|       |
 1203|       |            /* CHANGED CODE */
 1204|       |            /***************** Top *********************/
 1205|  53.1k|            if(ps_dec->u4_use_intrapred_line_copy == 1)
  ------------------
  |  Branch (1205:16): [True: 53.1k, False: 0]
  ------------------
 1206|  53.1k|            {
 1207|       |
 1208|  53.1k|                if(u1_sub_blk_y)
  ------------------
  |  Branch (1208:20): [True: 39.8k, False: 13.2k]
  ------------------
 1209|  39.8k|                    pu1_top = pu1_luma_rec_buffer - ui_rec_width;
 1210|  13.2k|                else
 1211|  13.2k|                    pu1_top = puc_top + (u1_sub_blk_x << 2);
 1212|  53.1k|            }
 1213|      0|            else
 1214|      0|            {
 1215|      0|                pu1_top = pu1_luma_rec_buffer - ui_rec_width;
 1216|      0|            }
 1217|       |            /***************** Top Right *********************/
 1218|  53.1k|            pu1_top_right = pu1_top + 4;
 1219|       |            /***************** Top Left *********************/
 1220|  53.1k|            pu1_top_left = pu1_top - 1;
 1221|       |            /***************** Left *********************/
 1222|  53.1k|            pu1_left = pu1_luma_rec_buffer - 1;
 1223|       |            /* CHANGED CODE */
 1224|       |
 1225|       |            /*---------------------------------------------------------------*/
 1226|       |            /* Calculation of Intra prediction mode                          */
 1227|       |            /*---------------------------------------------------------------*/
 1228|  53.1k|            i1_intra_pred = ((i1_left_pred_mode < 0) | (i1_top_pred_mode < 0)) ?
  ------------------
  |  Branch (1228:29): [True: 5.90k, False: 47.2k]
  ------------------
 1229|  47.2k|                            DC : MIN(i1_left_pred_mode, i1_top_pred_mode);
  ------------------
  |  |  431|  5.90k|#define DC      2
  ------------------
                                          DC : MIN(i1_left_pred_mode, i1_top_pred_mode);
  ------------------
  |  |   61|   100k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 5.84k, False: 41.4k]
  |  |  ------------------
  ------------------
 1230|  53.1k|            {
 1231|  53.1k|                UWORD8 u1_packed_modes = (u1_is_top_sub_block << 1)
 1232|  53.1k|                                + u1_is_left_sub_block;
 1233|  53.1k|                UWORD8 *pu1_intra_err_codes =
 1234|  53.1k|                                (UWORD8 *)gau1_ih264d_intra_pred_err_code;
 1235|  53.1k|                UWORD8 uc_b2b0 = ((u1_sub_mb_num & 4) >> 1) | (u1_sub_mb_num & 1);
 1236|  53.1k|                UWORD8 uc_b3b1 = ((u1_sub_mb_num & 8) >> 2)
 1237|  53.1k|                                | ((u1_sub_mb_num & 2) >> 1);
 1238|       |
 1239|  53.1k|                u1_cur_sub_block = (uc_b3b1 << 2) + uc_b2b0;
 1240|  53.1k|                PROFILE_DISABLE_INTRA_PRED()
  ------------------
  |  |  105|  53.1k|#define PROFILE_DISABLE_INTRA_PRED() ;
  ------------------
 1241|  53.1k|                if(!pu1_prev_intra4x4_pred_mode_flag[u1_cur_sub_block])
  ------------------
  |  Branch (1241:20): [True: 34.7k, False: 18.4k]
  ------------------
 1242|  34.7k|                {
 1243|  34.7k|                    i1_intra_pred =
 1244|  34.7k|                                    pu1_rem_intra4x4_pred_mode[u1_cur_sub_block]
 1245|  34.7k|                                                    + (pu1_rem_intra4x4_pred_mode[u1_cur_sub_block]
 1246|  34.7k|                                                                    >= i1_intra_pred);
 1247|  34.7k|                }
 1248|  53.1k|                i1_intra_pred = CLIP3(0, 8, i1_intra_pred);
  ------------------
  |  |   77|  53.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 0, False: 53.1k]
  |  |  |  Branch (77:54): [True: 0, False: 53.1k]
  |  |  ------------------
  ------------------
 1249|  53.1k|                {
 1250|  53.1k|                    UWORD8 u1_err_code = pu1_intra_err_codes[i1_intra_pred];
 1251|       |
 1252|  53.1k|                    if((u1_err_code & u1_packed_modes) ^ u1_err_code)
  ------------------
  |  Branch (1252:24): [True: 1.02k, False: 52.1k]
  ------------------
 1253|  1.02k|                     {
 1254|  1.02k|                        i1_intra_pred = 0;
 1255|  1.02k|                     }
 1256|       |
 1257|  53.1k|                }
 1258|  53.1k|            }
 1259|  53.1k|            {
 1260|       |                /* Get neighbour pixels */
 1261|       |                /* left pels */
 1262|  53.1k|                if(u1_is_left_sub_block)
  ------------------
  |  Branch (1262:20): [True: 48.8k, False: 4.28k]
  ------------------
 1263|  48.8k|                {
 1264|  48.8k|                    WORD32 i;
 1265|   244k|                    for(i = 0; i < 4; i++)
  ------------------
  |  Branch (1265:32): [True: 195k, False: 48.8k]
  ------------------
 1266|   195k|                        au1_ngbr_pels[4 - 1 - i] = pu1_left[i * ui_rec_width];
 1267|  48.8k|                }
 1268|  4.28k|                else
 1269|  4.28k|                {
 1270|  4.28k|                    memset(au1_ngbr_pels, 0, 4);
 1271|  4.28k|                }
 1272|       |
 1273|       |                /* top left pels */
 1274|  53.1k|                au1_ngbr_pels[4] = *pu1_top_left;
 1275|       |
 1276|       |                /* top pels */
 1277|  53.1k|                if(u1_is_top_sub_block)
  ------------------
  |  Branch (1277:20): [True: 51.1k, False: 2.04k]
  ------------------
 1278|  51.1k|                {
 1279|  51.1k|                    memcpy(au1_ngbr_pels + 4 + 1, pu1_top, 4);
 1280|  51.1k|                }
 1281|  2.04k|                else
 1282|  2.04k|                {
 1283|  2.04k|                    memset(au1_ngbr_pels + 4 + 1, 0, 4);
 1284|  2.04k|                }
 1285|       |
 1286|       |                /* top right pels */
 1287|  53.1k|                if(u1_use_top_right_mb)
  ------------------
  |  Branch (1287:20): [True: 33.9k, False: 19.2k]
  ------------------
 1288|  33.9k|                {
 1289|  33.9k|                    memcpy(au1_ngbr_pels + 4 * 2 + 1, pu1_top_right, 4);
 1290|  33.9k|                }
 1291|  19.2k|                else if(u1_is_top_sub_block)
  ------------------
  |  Branch (1291:25): [True: 17.1k, False: 2.04k]
  ------------------
 1292|  17.1k|                {
 1293|  17.1k|                    memset(au1_ngbr_pels + 4 * 2 + 1, au1_ngbr_pels[4 * 2], 4);
 1294|  17.1k|                }
 1295|  53.1k|            }
 1296|  53.1k|            PROFILE_DISABLE_INTRA_PRED()
  ------------------
  |  |  105|  53.1k|#define PROFILE_DISABLE_INTRA_PRED() ;
  ------------------
 1297|  53.1k|            ps_dec->apf_intra_pred_luma_4x4[i1_intra_pred](
 1298|  53.1k|                            au1_ngbr_pels, pu1_luma_rec_buffer, 1,
 1299|  53.1k|                            ui_rec_width,
 1300|  53.1k|                            ((u1_is_top_sub_block << 2) | u1_is_left_sub_block));
 1301|       |
 1302|       |            /* CHANGED CODE */
 1303|  53.1k|            if(CHECKBIT(ui2_luma_csbp, u1_sub_mb_num))
  ------------------
  |  |   54|  53.1k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 37.1k, False: 15.9k]
  |  |  ------------------
  ------------------
 1304|  37.1k|            {
 1305|  37.1k|                WORD16 ai2_tmp[16];
 1306|  37.1k|                PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  37.1k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
 1307|  37.1k|                {
 1308|  37.1k|                    if(CHECKBIT(u4_luma_dc_only_csbp, u1_sub_mb_num))
  ------------------
  |  |   54|  37.1k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 1.32k, False: 35.8k]
  |  |  ------------------
  ------------------
 1309|  1.32k|                    {
 1310|  1.32k|                        ps_dec->pf_iquant_itrans_recon_luma_4x4_dc(
 1311|  1.32k|                                        pi2_y_coeff1,
 1312|  1.32k|                                        pu1_luma_rec_buffer,
 1313|  1.32k|                                        pu1_luma_rec_buffer,
 1314|  1.32k|                                        ui_rec_width,
 1315|  1.32k|                                        ui_rec_width,
 1316|  1.32k|                                        gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6],
 1317|  1.32k|                                        (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[0],
 1318|  1.32k|                                        ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0,
 1319|  1.32k|                                        NULL);
 1320|  1.32k|                    }
 1321|  35.8k|                    else
 1322|  35.8k|                    {
 1323|  35.8k|                        ps_dec->pf_iquant_itrans_recon_luma_4x4(
 1324|  35.8k|                                        pi2_y_coeff1,
 1325|  35.8k|                                        pu1_luma_rec_buffer,
 1326|  35.8k|                                        pu1_luma_rec_buffer,
 1327|  35.8k|                                        ui_rec_width,
 1328|  35.8k|                                        ui_rec_width,
 1329|  35.8k|                                        gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6],
 1330|  35.8k|                                        (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[0],
 1331|  35.8k|                                        ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0,
 1332|  35.8k|                                        NULL);
 1333|  35.8k|                    }
 1334|  37.1k|                }
 1335|       |
 1336|  37.1k|            }
 1337|       |
 1338|       |            /*---------------------------------------------------------------*/
 1339|       |            /* Update sub block number                                       */
 1340|       |            /*---------------------------------------------------------------*/
 1341|  53.1k|            pi2_y_coeff1 += 16;
 1342|  53.1k|            pu1_luma_rec_buffer +=
 1343|  53.1k|                            (u1_sub_blk_x == 3) ? (ui_rec_width << 2) - 12 : 4;
  ------------------
  |  Branch (1343:29): [True: 13.2k, False: 39.8k]
  ------------------
 1344|  53.1k|            pu1_luma_pred_buffer +=
 1345|  53.1k|                            (u1_sub_blk_x == 3) ? (ui_pred_width << 2) - 12 : 4;
  ------------------
  |  Branch (1345:29): [True: 13.2k, False: 39.8k]
  ------------------
 1346|       |            /* CHANGED CODE */
 1347|  53.1k|            pi1_cur_pred_mode[u1_sub_blk_x] = i1_intra_pred;
 1348|  53.1k|            pi1_left_pred_mode[u1_sub_blk_y] = i1_intra_pred;
 1349|  53.1k|        }
 1350|  3.32k|    }
 1351|  4.56k|    else if((u1_mb_type == I_4x4_MB) && (ps_cur_mb_info->u1_tran_form8x8 == 1))
  ------------------
  |  |  417|  4.56k|#define I_4x4_MB    0
  ------------------
  |  Branch (1351:13): [True: 4.56k, False: 0]
  |  Branch (1351:41): [True: 4.56k, False: 0]
  ------------------
 1352|  4.56k|    {
 1353|  4.56k|        UWORD8 u1_is_left_sub_block, u1_is_top_sub_block = uc_useTopMB;
 1354|  4.56k|        UWORD8 u1_sub_blk_x, u1_sub_blk_y;
 1355|  4.56k|        UWORD32 u4_sub_mb_num;
 1356|  4.56k|        WORD8 i1_top_pred_mode;
 1357|  4.56k|        WORD8 i1_left_pred_mode;
 1358|  4.56k|        UWORD8 *pu1_top, *pu1_left, *pu1_top_left;
 1359|  4.56k|        WORD8 *pi1_cur_pred_mode, *pi1_left_pred_mode, *pc_topPredMode;
 1360|  4.56k|        UWORD16 ui2_left_pred_buf_width = 0xffff;
 1361|  4.56k|        WORD8 i1_intra_pred;
 1362|  4.56k|        UWORD8 *pu1_prev_intra4x4_pred_mode_flag = pu1_prev_intra4x4_pred_mode_data;
 1363|  4.56k|        UWORD8 *pu1_rem_intra4x4_pred_mode = pu1_prev_intra4x4_pred_mode_data + 4;
 1364|  4.56k|        WORD16 *pi2_y_coeff1;
 1365|  4.56k|        UWORD16 ui2_top_rt_mask;
 1366|  4.56k|        UWORD32 u4_4x4_left_offset = 0;
 1367|       |
 1368|       |        /*--------------------------------------------------------------------*/
 1369|       |        /* 8x8 IntraPrediction                                                */
 1370|       |        /*--------------------------------------------------------------------*/
 1371|       |        /* Calculation of Top Right subblock mask                             */
 1372|       |        /*                                                                    */
 1373|       |        /* (a) Set it to default mask                                         */
 1374|       |        /*  [It has 0 for sublocks which will never have top-right sub block] */
 1375|       |        /*                                                                    */
 1376|       |        /* (b) If top MB is not available                                     */
 1377|       |        /*      Clear the bits of the first row sub blocks                    */
 1378|       |        /*                                                                    */
 1379|       |        /* (c) Set/Clear bit for top-right sublock of MB                      */
 1380|       |        /*  [5 sub-block in decoding order] based on TOP RIGHT MB availablity */
 1381|       |        /*                                                                    */
 1382|       |        /* ui2_top_rt_mask: marks availibility of top right(neighbour)         */
 1383|       |        /* in the 8x8 Block ordering                                          */
 1384|       |        /*                                                                    */
 1385|       |        /*      tr0   tr1                                                     */
 1386|       |        /*   0    1   tr3                                                     */
 1387|       |        /*   2    3                                                           */
 1388|       |        /*                                                                    */
 1389|       |        /*  Top rights for 0 is in top MB                                     */
 1390|       |        /*  top right of 1 will be in top right MB                            */
 1391|       |        /*  top right of 3 in right MB and hence not available                */
 1392|       |        /*  This corresponds to ui2_top_rt_mask  having default value 0x4      */
 1393|       |        /*--------------------------------------------------------------------*/
 1394|       |
 1395|  4.56k|        ui2_top_rt_mask = (u1_use_top_right_mb << 1) | (0x4);
 1396|       |
 1397|  4.56k|        if(uc_useTopMB)
  ------------------
  |  Branch (1397:12): [True: 4.40k, False: 155]
  ------------------
 1398|  4.40k|        {
 1399|  4.40k|            ui2_top_rt_mask |= 0x1;
 1400|  4.40k|        }
 1401|       |
 1402|       |        /* Top Related initialisations */
 1403|  4.56k|        pi1_cur_pred_mode = ps_cur_mb_info->ps_curmb->pi1_intrapredmodes;
 1404|  4.56k|        pc_topPredMode = ps_cur_mb_info->ps_top_mb->pi1_intrapredmodes;
 1405|       |        /*
 1406|       |         if(u1_mbaff)
 1407|       |         {
 1408|       |         pi1_cur_pred_mode += (u2_mbx << 2);
 1409|       |         pc_topPredMode = pi1_cur_pred_mode + ps_cur_mb_info->i1_offset;
 1410|       |         pi1_cur_pred_mode += (u1_topmb) ? 0: 4;
 1411|       |         }
 1412|       |         */
 1413|  4.56k|        if(u1_top_available)
  ------------------
  |  Branch (1413:12): [True: 4.45k, False: 110]
  ------------------
 1414|  4.45k|        {
 1415|  4.45k|            if(ps_top_mb->u1_mb_type == I_4x4_MB)
  ------------------
  |  |  417|  4.45k|#define I_4x4_MB    0
  ------------------
  |  Branch (1415:16): [True: 3.51k, False: 932]
  ------------------
 1416|  3.51k|            {
 1417|  3.51k|                *(WORD32*)pi1_cur_pred_mode = *(WORD32*)pc_topPredMode;
 1418|  3.51k|            }
 1419|    932|            else
 1420|    932|            {
 1421|    932|                *(WORD32*)pi1_cur_pred_mode =
 1422|    932|                                (uc_useTopMB) ? DC_DC_DC_DC : NOT_VALID;
  ------------------
  |  |  434|    887|#define DC_DC_DC_DC   0x02020202 /*packed 4 bytes used in Decode Intra Mb*/
  ------------------
                                              (uc_useTopMB) ? DC_DC_DC_DC : NOT_VALID;
  ------------------
  |  |  433|    977|#define NOT_VALID -1
  ------------------
  |  Branch (1422:33): [True: 887, False: 45]
  ------------------
 1423|    932|            }
 1424|  4.45k|        }
 1425|    110|        else
 1426|    110|        {
 1427|    110|            *(WORD32*)pi1_cur_pred_mode = NOT_VALID;
  ------------------
  |  |  433|    110|#define NOT_VALID -1
  ------------------
 1428|    110|        }
 1429|       |
 1430|  4.56k|        pu1_top = puc_top - 8;
 1431|       |
 1432|       |        /*Left Related initialisations*/
 1433|  4.56k|        pi1_left_pred_mode = ps_dec->pi1_left_pred_mode;
 1434|       |
 1435|  4.56k|        if(!u1_mbaff)
  ------------------
  |  Branch (1435:12): [True: 4.56k, False: 0]
  ------------------
 1436|  4.56k|        {
 1437|  4.56k|            if(u1_left_available)
  ------------------
  |  Branch (1437:16): [True: 2.28k, False: 2.27k]
  ------------------
 1438|  2.28k|            {
 1439|  2.28k|                if(ps_left_mb->u1_mb_type != I_4x4_MB)
  ------------------
  |  |  417|  2.28k|#define I_4x4_MB    0
  ------------------
  |  Branch (1439:20): [True: 470, False: 1.81k]
  ------------------
 1440|    470|                {
 1441|    470|                    *(WORD32*)pi1_left_pred_mode =
 1442|    470|                                    (u2_use_left_mb_pack) ?
  ------------------
  |  Branch (1442:37): [True: 432, False: 38]
  ------------------
 1443|    432|                                    DC_DC_DC_DC :
  ------------------
  |  |  434|    432|#define DC_DC_DC_DC   0x02020202 /*packed 4 bytes used in Decode Intra Mb*/
  ------------------
 1444|    470|                                                            NOT_VALID;
  ------------------
  |  |  433|    508|#define NOT_VALID -1
  ------------------
 1445|    470|                }
 1446|  2.28k|            }
 1447|  2.27k|            else
 1448|  2.27k|            {
 1449|  2.27k|                *(WORD32*)pi1_left_pred_mode = NOT_VALID;
  ------------------
  |  |  433|  2.27k|#define NOT_VALID -1
  ------------------
 1450|  2.27k|            }
 1451|  4.56k|        }
 1452|      0|        else
 1453|      0|        {
 1454|      0|            UWORD8 u1_curMbfld = ps_cur_mb_info->u1_mb_field_decodingflag;
 1455|       |
 1456|      0|            UWORD8 u1_leftMbfld = ps_left_mb->u1_mb_fld;
 1457|       |
 1458|      0|            if((!u1_curMbfld) && (u1_leftMbfld))
  ------------------
  |  Branch (1458:16): [True: 0, False: 0]
  |  Branch (1458:34): [True: 0, False: 0]
  ------------------
 1459|      0|            {
 1460|      0|                u4_4x4_left_offset = 1;
 1461|      0|            }
 1462|       |
 1463|      0|            if(u1_curMbfld ^ u1_leftMbfld)
  ------------------
  |  Branch (1463:16): [True: 0, False: 0]
  ------------------
 1464|      0|            {
 1465|       |
 1466|      0|                if(u1_topmb
  ------------------
  |  Branch (1466:20): [True: 0, False: 0]
  ------------------
 1467|      0|                                | ((u1_topmb == 0)
  ------------------
  |  Branch (1467:36): [True: 0, False: 0]
  ------------------
 1468|      0|                                                && ((ps_curmb - 1)->u1_mb_type
  ------------------
  |  Branch (1468:52): [True: 0, False: 0]
  ------------------
 1469|      0|                                                                != I_4x4_MB)))
  ------------------
  |  |  417|      0|#define I_4x4_MB    0
  ------------------
 1470|       |
 1471|      0|                {
 1472|      0|                    if(u1_left_available)
  ------------------
  |  Branch (1472:24): [True: 0, False: 0]
  ------------------
 1473|      0|                    {
 1474|      0|                        if(ps_left_mb->u1_mb_type != I_4x4_MB)
  ------------------
  |  |  417|      0|#define I_4x4_MB    0
  ------------------
  |  Branch (1474:28): [True: 0, False: 0]
  ------------------
 1475|      0|                        {
 1476|      0|                            if(CHECKBIT(u2_use_left_mb_pack,0) == 0)
  ------------------
  |  |   54|      0|#define CHECKBIT(a,i) ((a) &  (1 << i))
  ------------------
  |  Branch (1476:32): [True: 0, False: 0]
  ------------------
 1477|      0|                            {
 1478|      0|                                *(WORD32*)pi1_left_pred_mode = NOT_VALID;
  ------------------
  |  |  433|      0|#define NOT_VALID -1
  ------------------
 1479|      0|                            }
 1480|      0|                            else
 1481|      0|                            {
 1482|      0|                                *(WORD32*)pi1_left_pred_mode = DC_DC_DC_DC;
  ------------------
  |  |  434|      0|#define DC_DC_DC_DC   0x02020202 /*packed 4 bytes used in Decode Intra Mb*/
  ------------------
 1483|      0|                            }
 1484|      0|                        }
 1485|      0|                    }
 1486|      0|                    else
 1487|      0|                    {
 1488|      0|                        *(WORD32*)pi1_left_pred_mode = NOT_VALID;
  ------------------
  |  |  433|      0|#define NOT_VALID -1
  ------------------
 1489|      0|                    }
 1490|       |
 1491|      0|                    if(u1_curMbfld)
  ------------------
  |  Branch (1491:24): [True: 0, False: 0]
  ------------------
 1492|      0|                    {
 1493|      0|                        if(u1_left_available)
  ------------------
  |  Branch (1493:28): [True: 0, False: 0]
  ------------------
 1494|      0|                        {
 1495|      0|                            if((ps_left_mb + 1)->u1_mb_type != I_4x4_MB)
  ------------------
  |  |  417|      0|#define I_4x4_MB    0
  ------------------
  |  Branch (1495:32): [True: 0, False: 0]
  ------------------
 1496|      0|                            {
 1497|      0|                                if(u2_use_left_mb_pack >> 8)
  ------------------
  |  Branch (1497:36): [True: 0, False: 0]
  ------------------
 1498|      0|                                {
 1499|      0|                                    *(WORD32*)(pi1_left_pred_mode + 4) =
 1500|      0|                                                    DC_DC_DC_DC;
  ------------------
  |  |  434|      0|#define DC_DC_DC_DC   0x02020202 /*packed 4 bytes used in Decode Intra Mb*/
  ------------------
 1501|      0|                                }
 1502|      0|                                else
 1503|      0|                                {
 1504|      0|                                    *(WORD32*)(pi1_left_pred_mode + 4) =
 1505|      0|                                                    NOT_VALID;
  ------------------
  |  |  433|      0|#define NOT_VALID -1
  ------------------
 1506|      0|                                }
 1507|      0|                            }
 1508|      0|                        }
 1509|      0|                        else
 1510|      0|                        {
 1511|      0|                            *(WORD32*)(pi1_left_pred_mode + 4) = NOT_VALID;
  ------------------
  |  |  433|      0|#define NOT_VALID -1
  ------------------
 1512|      0|                        }
 1513|       |
 1514|      0|                        pi1_left_pred_mode[1] = pi1_left_pred_mode[2];
 1515|      0|                        pi1_left_pred_mode[2] = pi1_left_pred_mode[4];
 1516|      0|                        pi1_left_pred_mode[3] = pi1_left_pred_mode[6];
 1517|      0|                        *(WORD32*)(pi1_left_pred_mode + 4) =
 1518|      0|                                        *(WORD32*)pi1_left_pred_mode;
 1519|      0|                    }
 1520|      0|                    else
 1521|      0|                    {
 1522|      0|                        pi1_left_pred_mode[7] = pi1_left_pred_mode[3];
 1523|      0|                        pi1_left_pred_mode[6] = pi1_left_pred_mode[3];
 1524|      0|                        pi1_left_pred_mode[5] = pi1_left_pred_mode[2];
 1525|      0|                        pi1_left_pred_mode[4] = pi1_left_pred_mode[2];
 1526|      0|                        pi1_left_pred_mode[3] = pi1_left_pred_mode[1];
 1527|      0|                        pi1_left_pred_mode[2] = pi1_left_pred_mode[1];
 1528|      0|                        pi1_left_pred_mode[1] = pi1_left_pred_mode[0];
 1529|      0|                    }
 1530|      0|                }
 1531|      0|                pi1_left_pred_mode += (u1_topmb) ? 0 : 4;
  ------------------
  |  Branch (1531:39): [True: 0, False: 0]
  ------------------
 1532|      0|            }
 1533|      0|            else
 1534|      0|            {
 1535|      0|                pi1_left_pred_mode += (u1_topmb) ? 0 : 4;
  ------------------
  |  Branch (1535:39): [True: 0, False: 0]
  ------------------
 1536|       |
 1537|      0|                if(u1_left_available)
  ------------------
  |  Branch (1537:20): [True: 0, False: 0]
  ------------------
 1538|      0|                {
 1539|      0|                    if(ps_left_mb->u1_mb_type != I_4x4_MB)
  ------------------
  |  |  417|      0|#define I_4x4_MB    0
  ------------------
  |  Branch (1539:24): [True: 0, False: 0]
  ------------------
 1540|      0|                    {
 1541|      0|                        *(WORD32*)pi1_left_pred_mode =
 1542|      0|                                        (u2_use_left_mb_pack) ?
  ------------------
  |  Branch (1542:41): [True: 0, False: 0]
  ------------------
 1543|      0|                                        DC_DC_DC_DC :
  ------------------
  |  |  434|      0|#define DC_DC_DC_DC   0x02020202 /*packed 4 bytes used in Decode Intra Mb*/
  ------------------
 1544|      0|                                                                NOT_VALID;
  ------------------
  |  |  433|      0|#define NOT_VALID -1
  ------------------
 1545|      0|                    }
 1546|      0|                }
 1547|      0|                else
 1548|      0|                {
 1549|      0|                    *(WORD32*)pi1_left_pred_mode = NOT_VALID;
  ------------------
  |  |  433|      0|#define NOT_VALID -1
  ------------------
 1550|      0|                }
 1551|      0|            }
 1552|      0|        }
 1553|       |
 1554|       |        /* One time pointer initialisations*/
 1555|  4.56k|        pi2_y_coeff1 = pi2_y_coeff;
 1556|       |
 1557|  4.56k|        if(u1_use_top_left_mb)
  ------------------
  |  Branch (1557:12): [True: 2.19k, False: 2.37k]
  ------------------
 1558|  2.19k|        {
 1559|  2.19k|            pu1_top_left = pu1_ytop_left;
 1560|  2.19k|        }
 1561|  2.37k|        else
 1562|  2.37k|        {
 1563|  2.37k|            pu1_top_left = NULL;
 1564|  2.37k|        }
 1565|       |
 1566|       |        /* Scan the sub-blocks in Raster Scan Order */
 1567|  22.8k|        for(u4_sub_mb_num = 0; u4_sub_mb_num < 4; u4_sub_mb_num++)
  ------------------
  |  Branch (1567:32): [True: 18.2k, False: 4.56k]
  ------------------
 1568|  18.2k|        {
 1569|  18.2k|            u1_sub_blk_x = (u4_sub_mb_num & 0x1);
 1570|  18.2k|            u1_sub_blk_y = (u4_sub_mb_num >> 1);
 1571|  18.2k|            i1_top_pred_mode = pi1_cur_pred_mode[u1_sub_blk_x << 1];
 1572|  18.2k|            i1_left_pred_mode = pi1_left_pred_mode[u1_sub_blk_y << 1];
 1573|       |
 1574|  18.2k|            if(2 == u4_sub_mb_num)
  ------------------
  |  Branch (1574:16): [True: 4.56k, False: 13.6k]
  ------------------
 1575|  4.56k|            {
 1576|  4.56k|                i1_left_pred_mode = pi1_left_pred_mode[(u1_sub_blk_y << 1)
 1577|  4.56k|                                + u4_4x4_left_offset];
 1578|  4.56k|            }
 1579|       |
 1580|  18.2k|            u1_use_top_right_mb = (!!CHECKBIT(ui2_top_rt_mask, u4_sub_mb_num));
  ------------------
  |  |   54|  18.2k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  ------------------
 1581|       |
 1582|       |            /*********** left subblock availability**********/
 1583|  18.2k|            if(u1_sub_blk_x)
  ------------------
  |  Branch (1583:16): [True: 9.12k, False: 9.12k]
  ------------------
 1584|  9.12k|            {
 1585|  9.12k|                u1_is_left_sub_block = 1;
 1586|  9.12k|            }
 1587|  9.12k|            else
 1588|  9.12k|            {
 1589|  9.12k|                u1_is_left_sub_block =
 1590|  9.12k|                                (u1_sub_blk_y < 1) ?
  ------------------
  |  Branch (1590:33): [True: 4.56k, False: 4.56k]
  ------------------
 1591|  4.56k|                                                (CHECKBIT(u2_use_left_mb_pack,
  ------------------
  |  |   54|  4.56k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  ------------------
 1592|  4.56k|                                                          0)) :
 1593|  9.12k|                                                (u2_use_left_mb_pack >> 8);
 1594|  9.12k|            }
 1595|       |
 1596|       |            /***************** Top *********************/
 1597|  18.2k|            if(u1_sub_blk_y)
  ------------------
  |  Branch (1597:16): [True: 9.12k, False: 9.12k]
  ------------------
 1598|  9.12k|            {
 1599|  9.12k|                u1_is_top_sub_block = 1;
 1600|       |                // sushant
 1601|  9.12k|                pu1_top = /*pu1_luma_pred_buffer*/pu1_luma_rec_buffer - ui_rec_width;
 1602|  9.12k|            }
 1603|  9.12k|            else
 1604|  9.12k|            {
 1605|  9.12k|                pu1_top += 8;
 1606|  9.12k|            }
 1607|       |
 1608|       |            /***************** Left *********************/
 1609|  18.2k|            if((u1_sub_blk_x) | (u4_num_pmbair != 0))
  ------------------
  |  Branch (1609:16): [True: 13.6k, False: 4.55k]
  ------------------
 1610|  13.6k|            {
 1611|       |                // sushant
 1612|  13.6k|                pu1_left = /*pu1_luma_pred_buffer*/pu1_luma_rec_buffer - 1;
 1613|  13.6k|                ui2_left_pred_buf_width = ui_rec_width;
 1614|  13.6k|            }
 1615|  4.55k|            else
 1616|  4.55k|            {
 1617|  4.55k|                pu1_left = pu1_yleft;
 1618|  4.55k|                pu1_yleft += (ui_rec_width << 3);
 1619|  4.55k|                ui2_left_pred_buf_width = ui_rec_width;
 1620|  4.55k|            }
 1621|       |
 1622|       |            /***************** Top Left *********************/
 1623|  18.2k|            if(u4_sub_mb_num)
  ------------------
  |  Branch (1623:16): [True: 13.6k, False: 4.56k]
  ------------------
 1624|  13.6k|            {
 1625|  13.6k|                pu1_top_left = (u1_sub_blk_x) ?
  ------------------
  |  Branch (1625:32): [True: 9.12k, False: 4.56k]
  ------------------
 1626|  9.12k|                                pu1_top - 1 : pu1_left - ui_rec_width;
 1627|       |
 1628|  13.6k|                if((u1_sub_blk_x && (!u1_is_top_sub_block))
  ------------------
  |  Branch (1628:21): [True: 9.12k, False: 4.56k]
  |  Branch (1628:37): [True: 155, False: 8.96k]
  ------------------
 1629|  13.5k|                                || ((!u1_sub_blk_x) && (!u1_is_left_sub_block)))
  ------------------
  |  Branch (1629:37): [True: 4.56k, False: 8.96k]
  |  Branch (1629:56): [True: 2.31k, False: 2.24k]
  ------------------
 1630|  2.47k|                {
 1631|  2.47k|                    pu1_top_left = NULL;
 1632|  2.47k|                }
 1633|  13.6k|            }
 1634|       |
 1635|       |            /*---------------------------------------------------------------*/
 1636|       |            /* Calculation of Intra prediction mode                          */
 1637|       |            /*---------------------------------------------------------------*/
 1638|  18.2k|            i1_intra_pred = ((i1_left_pred_mode < 0) | (i1_top_pred_mode < 0)) ?
  ------------------
  |  Branch (1638:29): [True: 4.84k, False: 13.3k]
  ------------------
 1639|  13.3k|                            DC : MIN(i1_left_pred_mode, i1_top_pred_mode);
  ------------------
  |  |  431|  4.84k|#define DC      2
  ------------------
                                          DC : MIN(i1_left_pred_mode, i1_top_pred_mode);
  ------------------
  |  |   61|  31.6k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 4.37k, False: 9.02k]
  |  |  ------------------
  ------------------
 1640|  18.2k|            {
 1641|  18.2k|                UWORD8 u1_packed_modes = (u1_is_top_sub_block << 1)
 1642|  18.2k|                                + u1_is_left_sub_block;
 1643|  18.2k|                UWORD8 *pu1_intra_err_codes =
 1644|  18.2k|                                (UWORD8 *)gau1_ih264d_intra_pred_err_code;
 1645|       |
 1646|       |                /********************************************************************/
 1647|       |                /* Same intra4x4_pred_mode array is filled with intra4x4_pred_mode  */
 1648|       |                /* for a MB with 8x8 intrapredicition                               */
 1649|       |                /********************************************************************/
 1650|  18.2k|                PROFILE_DISABLE_INTRA_PRED()
  ------------------
  |  |  105|  18.2k|#define PROFILE_DISABLE_INTRA_PRED() ;
  ------------------
 1651|  18.2k|                if(!pu1_prev_intra4x4_pred_mode_flag[u4_sub_mb_num])
  ------------------
  |  Branch (1651:20): [True: 10.0k, False: 8.15k]
  ------------------
 1652|  10.0k|                {
 1653|  10.0k|                    i1_intra_pred = pu1_rem_intra4x4_pred_mode[u4_sub_mb_num]
 1654|  10.0k|                                    + (pu1_rem_intra4x4_pred_mode[u4_sub_mb_num]
 1655|  10.0k|                                                    >= i1_intra_pred);
 1656|  10.0k|                }
 1657|  18.2k|                i1_intra_pred = CLIP3(0, 8, i1_intra_pred);
  ------------------
  |  |   77|  18.2k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 0, False: 18.2k]
  |  |  |  Branch (77:54): [True: 0, False: 18.2k]
  |  |  ------------------
  ------------------
 1658|  18.2k|                {
 1659|  18.2k|                    UWORD8 u1_err_code = pu1_intra_err_codes[i1_intra_pred];
 1660|       |
 1661|  18.2k|                    if((u1_err_code & u1_packed_modes) ^ u1_err_code)
  ------------------
  |  Branch (1661:24): [True: 1.52k, False: 16.7k]
  ------------------
 1662|  1.52k|                    {
 1663|  1.52k|                        i1_intra_pred = 0;
 1664|  1.52k|                    }
 1665|  18.2k|                }
 1666|  18.2k|            }
 1667|       |
 1668|  18.2k|            {
 1669|       |                /* Align the size to multiple of 8, so that SIMD functions
 1670|       |                can read 64 bits at a time. Only 25 bytes are actaully used */
 1671|  18.2k|                UWORD8 au1_ngbr_pels[32] = {0};
 1672|  18.2k|                WORD32 ngbr_avail;
 1673|  18.2k|                ngbr_avail = u1_is_left_sub_block << 0;
 1674|  18.2k|                ngbr_avail |= u1_is_top_sub_block << 2;
 1675|       |
 1676|  18.2k|                if(pu1_top_left)
  ------------------
  |  Branch (1676:20): [True: 13.3k, False: 4.84k]
  ------------------
 1677|  13.3k|                    ngbr_avail |= 1 << 1;
 1678|       |
 1679|  18.2k|                ngbr_avail |= u1_use_top_right_mb << 3;
 1680|  18.2k|                PROFILE_DISABLE_INTRA_PRED()
  ------------------
  |  |  105|  18.2k|#define PROFILE_DISABLE_INTRA_PRED() ;
  ------------------
 1681|  18.2k|                {
 1682|  18.2k|                    ps_dec->pf_intra_pred_ref_filtering(pu1_left, pu1_top_left,
 1683|  18.2k|                                                        pu1_top, au1_ngbr_pels,
 1684|  18.2k|                                                        ui2_left_pred_buf_width,
 1685|  18.2k|                                                        ngbr_avail);
 1686|       |
 1687|  18.2k|                    ps_dec->apf_intra_pred_luma_8x8[i1_intra_pred](
 1688|  18.2k|                                    au1_ngbr_pels, pu1_luma_rec_buffer, 1,
 1689|  18.2k|                                    ui_rec_width,
 1690|  18.2k|                                    ((u1_is_top_sub_block << 2) | u1_is_left_sub_block));
 1691|  18.2k|                }
 1692|  18.2k|            }
 1693|       |
 1694|       |            /* Inverse Transform and Reconstruction */
 1695|  18.2k|            if(CHECKBIT(ps_cur_mb_info->u1_cbp, u4_sub_mb_num))
  ------------------
  |  |   54|  18.2k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 14.1k, False: 4.11k]
  |  |  ------------------
  ------------------
 1696|  14.1k|            {
 1697|  14.1k|                WORD16 *pi2_scale_matrix_ptr;
 1698|  14.1k|                WORD16 ai2_tmp[64];
 1699|       |
 1700|  14.1k|                pi2_scale_matrix_ptr =
 1701|  14.1k|                                ps_dec->s_high_profile.i2_scalinglist8x8[0];
 1702|  14.1k|                PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  14.1k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
 1703|  14.1k|                {
 1704|  14.1k|                    if(CHECKBIT(u4_luma_dc_only_cbp, u4_sub_mb_num))
  ------------------
  |  |   54|  14.1k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 2.23k, False: 11.8k]
  |  |  ------------------
  ------------------
 1705|  2.23k|                    {
 1706|  2.23k|                        ps_dec->pf_iquant_itrans_recon_luma_8x8_dc(
 1707|  2.23k|                                        pi2_y_coeff1,
 1708|  2.23k|                                        pu1_luma_rec_buffer,
 1709|  2.23k|                                        pu1_luma_rec_buffer,
 1710|  2.23k|                                        ui_rec_width,
 1711|  2.23k|                                        ui_rec_width,
 1712|  2.23k|                                        gau1_ih264d_dequant8x8_cavlc[ps_cur_mb_info->u1_qp_rem6],
 1713|  2.23k|                                        (UWORD16 *)pi2_scale_matrix_ptr,
 1714|  2.23k|                                        ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0,
 1715|  2.23k|                                        NULL);
 1716|  2.23k|                    }
 1717|  11.8k|                    else
 1718|  11.8k|                    {
 1719|  11.8k|                        ps_dec->pf_iquant_itrans_recon_luma_8x8(
 1720|  11.8k|                                        pi2_y_coeff1,
 1721|  11.8k|                                        pu1_luma_rec_buffer,
 1722|  11.8k|                                        pu1_luma_rec_buffer,
 1723|  11.8k|                                        ui_rec_width,
 1724|  11.8k|                                        ui_rec_width,
 1725|  11.8k|                                        gau1_ih264d_dequant8x8_cavlc[ps_cur_mb_info->u1_qp_rem6],
 1726|  11.8k|                                        (UWORD16 *)pi2_scale_matrix_ptr,
 1727|  11.8k|                                        ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0,
 1728|  11.8k|                                        NULL);
 1729|  11.8k|                    }
 1730|  14.1k|                }
 1731|       |
 1732|  14.1k|            }
 1733|       |
 1734|       |            /*---------------------------------------------------------------*/
 1735|       |            /* Update sub block number                                       */
 1736|       |            /*---------------------------------------------------------------*/
 1737|  18.2k|            pi2_y_coeff1 += 64;
 1738|       |
 1739|  18.2k|            pu1_luma_rec_buffer +=
 1740|  18.2k|                            (u1_sub_blk_x == 1) ?
  ------------------
  |  Branch (1740:29): [True: 9.12k, False: 9.12k]
  ------------------
 1741|  9.12k|                                            (ui_rec_width << 3) - (8 * 1) : 8;
 1742|       |
 1743|       |            /*---------------------------------------------------------------*/
 1744|       |            /* Pred mode filled in terms of 4x4 block so replicated in 2     */
 1745|       |            /* locations.                                                    */
 1746|       |            /*---------------------------------------------------------------*/
 1747|  18.2k|            pi1_cur_pred_mode[u1_sub_blk_x << 1] = i1_intra_pred;
 1748|  18.2k|            pi1_cur_pred_mode[(u1_sub_blk_x << 1) + 1] = i1_intra_pred;
 1749|  18.2k|            pi1_left_pred_mode[u1_sub_blk_y << 1] = i1_intra_pred;
 1750|  18.2k|            pi1_left_pred_mode[(u1_sub_blk_y << 1) + 1] = i1_intra_pred;
 1751|  18.2k|        }
 1752|  4.56k|    }
 1753|       |    /* Decode Chroma Block */
 1754|  10.0k|    ih264d_unpack_chroma_coeff4x4_mb(ps_dec,
 1755|  10.0k|                                     ps_cur_mb_info);
 1756|       |    /*--------------------------------------------------------------------*/
 1757|       |    /* Chroma Blocks decoding                                             */
 1758|       |    /*--------------------------------------------------------------------*/
 1759|  10.0k|    {
 1760|  10.0k|        UWORD8 u1_intra_chrom_pred_mode;
 1761|  10.0k|        UWORD8 u1_chroma_cbp = (UWORD8)(ps_cur_mb_info->u1_cbp >> 4);
 1762|       |
 1763|       |        /*--------------------------------------------------------------------*/
 1764|       |        /* Perform Chroma intra prediction                                    */
 1765|       |        /*--------------------------------------------------------------------*/
 1766|       |
 1767|  10.0k|        u1_intra_chrom_pred_mode = CHROMA_TO_LUMA_INTRA_MODE(
  ------------------
  |  |   44|  10.0k|#define CHROMA_TO_LUMA_INTRA_MODE(x)   (x ^ ( (!(x & 0x01)) << 1))
  ------------------
 1768|  10.0k|                        ps_cur_mb_info->u1_chroma_pred_mode);
 1769|       |
 1770|  10.0k|        {
 1771|  10.0k|            UWORD8 u1_packed_modes = (u1_top_available << 1)
 1772|  10.0k|                            + u1_left_available;
 1773|  10.0k|            UWORD8 u1_err_code =
 1774|  10.0k|                            (u1_intra_chrom_pred_mode & 1) ?
  ------------------
  |  Branch (1774:29): [True: 6.62k, False: 3.45k]
  ------------------
 1775|  6.62k|                                            u1_intra_chrom_pred_mode :
 1776|  10.0k|                                            (u1_intra_chrom_pred_mode ^ 2);
 1777|  10.0k|            if((u1_err_code & u1_packed_modes) ^ u1_err_code)
  ------------------
  |  Branch (1777:16): [True: 2.61k, False: 7.45k]
  ------------------
 1778|  2.61k|            {
 1779|  2.61k|                u1_intra_chrom_pred_mode = 0;
 1780|  2.61k|            }
 1781|  10.0k|        }
 1782|       |
 1783|       |        /* CHANGED CODE */
 1784|  10.0k|        if(u1_chroma_cbp != CBPC_ALLZERO)
  ------------------
  |  |  507|  10.0k|#define CBPC_ALLZERO    0
  ------------------
  |  Branch (1784:12): [True: 5.66k, False: 4.41k]
  ------------------
 1785|  5.66k|        {
 1786|  5.66k|            UWORD16 u2_chroma_csbp =
 1787|  5.66k|                            (u1_chroma_cbp == CBPC_ACZERO) ?
  ------------------
  |  |  508|  5.66k|#define CBPC_ACZERO     1
  ------------------
  |  Branch (1787:29): [True: 2.37k, False: 3.28k]
  ------------------
 1788|  3.28k|                                            0 : ps_cur_mb_info->u2_chroma_csbp;
 1789|  5.66k|            UWORD32 u4_scale_u;
 1790|  5.66k|            UWORD32 u4_scale_v;
 1791|       |
 1792|  5.66k|            {
 1793|  5.66k|                UWORD16 au2_ngbr_pels[33];
 1794|  5.66k|                UWORD8 *pu1_ngbr_pels = (UWORD8 *)au2_ngbr_pels;
 1795|  5.66k|                UWORD16 *pu2_left_uv;
 1796|  5.66k|                UWORD16 *pu2_topleft_uv;
 1797|  5.66k|                WORD32 use_left1 = (u2_use_left_mb_pack & 0x0ff);
 1798|  5.66k|                WORD32 use_left2 = (u2_use_left_mb_pack & 0xff00) >> 8;
 1799|       |
 1800|  5.66k|                pu2_left_uv = (UWORD16 *)pu1_uleft;
 1801|  5.66k|                pu2_topleft_uv = (UWORD16 *)pu1_u_top_left;
 1802|       |                /* Get neighbour pixels */
 1803|       |                /* left pels */
 1804|  5.66k|                if(u2_use_left_mb_pack)
  ------------------
  |  Branch (1804:20): [True: 3.73k, False: 1.93k]
  ------------------
 1805|  3.73k|                {
 1806|  3.73k|                    WORD32 i;
 1807|  3.73k|                    if(use_left1)
  ------------------
  |  Branch (1807:24): [True: 3.73k, False: 0]
  ------------------
 1808|  3.73k|                    {
 1809|  18.6k|                        for(i = 0; i < 4; i++)
  ------------------
  |  Branch (1809:36): [True: 14.9k, False: 3.73k]
  ------------------
 1810|  14.9k|                            au2_ngbr_pels[8 - 1 - i] = pu2_left_uv[i
 1811|  14.9k|                                            * u4_recwidth_cr / YUV420SP_FACTOR];
  ------------------
  |  |  119|  14.9k|#define YUV420SP_FACTOR 2
  ------------------
 1812|  3.73k|                    }
 1813|      0|                    else
 1814|      0|                    {
 1815|      0|                        memset(au2_ngbr_pels + 4, 0, 4 * sizeof(UWORD16));
 1816|      0|                    }
 1817|       |
 1818|  3.73k|                    if(use_left2)
  ------------------
  |  Branch (1818:24): [True: 3.73k, False: 0]
  ------------------
 1819|  3.73k|                    {
 1820|  18.6k|                        for(i = 4; i < 8; i++)
  ------------------
  |  Branch (1820:36): [True: 14.9k, False: 3.73k]
  ------------------
 1821|  14.9k|                            au2_ngbr_pels[8 - 1 - i] = pu2_left_uv[i
 1822|  14.9k|                                            * u4_recwidth_cr / YUV420SP_FACTOR];
  ------------------
  |  |  119|  14.9k|#define YUV420SP_FACTOR 2
  ------------------
 1823|  3.73k|                    }
 1824|      0|                    else
 1825|      0|                    {
 1826|      0|                        memset(au2_ngbr_pels, 0, 4 * sizeof(UWORD16));
 1827|      0|                    }
 1828|  3.73k|                }
 1829|  1.93k|                else
 1830|  1.93k|                {
 1831|  1.93k|                    memset(au2_ngbr_pels, 0, 8 * sizeof(UWORD16));
 1832|  1.93k|                }
 1833|       |
 1834|       |                /* top left pels */
 1835|  5.66k|                au2_ngbr_pels[8] = *pu2_topleft_uv;
 1836|       |
 1837|       |                /* top pels */
 1838|  5.66k|                if(uc_useTopMB)
  ------------------
  |  Branch (1838:20): [True: 5.40k, False: 256]
  ------------------
 1839|  5.40k|                {
 1840|  5.40k|                    memcpy(au2_ngbr_pels + 8 + 1, pu1_top_u,
 1841|  5.40k|                           8 * sizeof(UWORD16));
 1842|  5.40k|                }
 1843|    256|                else
 1844|    256|                {
 1845|    256|                    memset(au2_ngbr_pels + 8 + 1, 0, 8 * sizeof(UWORD16));
 1846|    256|                }
 1847|       |
 1848|  5.66k|                PROFILE_DISABLE_INTRA_PRED()
  ------------------
  |  |  105|  5.66k|#define PROFILE_DISABLE_INTRA_PRED() ;
  ------------------
 1849|  5.66k|                ps_dec->apf_intra_pred_chroma[u1_intra_chrom_pred_mode](
 1850|  5.66k|                                pu1_ngbr_pels,
 1851|  5.66k|                                pu1_mb_cb_rei1_buffer,
 1852|  5.66k|                                1,
 1853|  5.66k|                                u4_recwidth_cr,
 1854|  5.66k|                                ((uc_useTopMB << 2) | (use_left2 << 4)
 1855|  5.66k|                                                | use_left1));
 1856|  5.66k|            }
 1857|  5.66k|            u4_scale_u = ps_cur_mb_info->u1_qpc_div6;
 1858|  5.66k|            u4_scale_v = ps_cur_mb_info->u1_qpcr_div6;
 1859|  5.66k|            pi2_y_coeff = ps_dec->pi2_coeff_data;
 1860|       |
 1861|  5.66k|            {
 1862|  5.66k|                UWORD32 i;
 1863|  5.66k|                WORD16 ai2_tmp[16];
 1864|  28.3k|                for(i = 0; i < 4; i++)
  ------------------
  |  Branch (1864:28): [True: 22.6k, False: 5.66k]
  ------------------
 1865|  22.6k|                {
 1866|  22.6k|                    WORD16 *pi2_level = pi2_y_coeff + (i << 4);
 1867|  22.6k|                    UWORD8 *pu1_pred_sblk = pu1_mb_cb_rei1_buffer
 1868|  22.6k|                                    + ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR)
  ------------------
  |  |  556|  22.6k|#define BLK_SIZE             4
  ------------------
                                                  + ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR)
  ------------------
  |  |  119|  22.6k|#define YUV420SP_FACTOR 2
  ------------------
 1869|  22.6k|                                    + (i >> 1) * (u4_recwidth_cr << 2);
 1870|  22.6k|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  22.6k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
 1871|  22.6k|                    {
 1872|  22.6k|                        if(CHECKBIT(u2_chroma_csbp, i))
  ------------------
  |  |   54|  22.6k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 10.1k, False: 12.5k]
  |  |  ------------------
  ------------------
 1873|  10.1k|                        {
 1874|  10.1k|                            ps_dec->pf_iquant_itrans_recon_chroma_4x4(
 1875|  10.1k|                                            pi2_level,
 1876|  10.1k|                                            pu1_pred_sblk,
 1877|  10.1k|                                            pu1_pred_sblk,
 1878|  10.1k|                                            u4_recwidth_cr,
 1879|  10.1k|                                            u4_recwidth_cr,
 1880|  10.1k|                                            gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpc_rem6],
 1881|  10.1k|                                            (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[1],
 1882|  10.1k|                                            u4_scale_u, ai2_tmp, pi2_level);
 1883|  10.1k|                        }
 1884|  12.5k|                        else if(pi2_level[0] != 0)
  ------------------
  |  Branch (1884:33): [True: 8.99k, False: 3.50k]
  ------------------
 1885|  8.99k|                        {
 1886|  8.99k|                            ps_dec->pf_iquant_itrans_recon_chroma_4x4_dc(
 1887|  8.99k|                                            pi2_level,
 1888|  8.99k|                                            pu1_pred_sblk,
 1889|  8.99k|                                            pu1_pred_sblk,
 1890|  8.99k|                                            u4_recwidth_cr,
 1891|  8.99k|                                            u4_recwidth_cr,
 1892|  8.99k|                                            gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpc_rem6],
 1893|  8.99k|                                            (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[1],
 1894|  8.99k|                                            u4_scale_u, ai2_tmp, pi2_level);
 1895|  8.99k|                        }
 1896|  22.6k|                    }
 1897|       |
 1898|  22.6k|                }
 1899|  5.66k|            }
 1900|       |
 1901|  5.66k|            pi2_y_coeff += MB_CHROM_SIZE;
  ------------------
  |  |  564|  5.66k|#define MB_CHROM_SIZE                 64
  ------------------
 1902|  5.66k|            u2_chroma_csbp = u2_chroma_csbp >> 4;
 1903|  5.66k|            {
 1904|  5.66k|                UWORD32 i;
 1905|  5.66k|                WORD16 ai2_tmp[16];
 1906|  28.3k|                for(i = 0; i < 4; i++)
  ------------------
  |  Branch (1906:28): [True: 22.6k, False: 5.66k]
  ------------------
 1907|  22.6k|                {
 1908|  22.6k|                    WORD16 *pi2_level = pi2_y_coeff + (i << 4);
 1909|  22.6k|                    UWORD8 *pu1_pred_sblk = pu1_mb_cb_rei1_buffer + 1
 1910|  22.6k|                                    + ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR)
  ------------------
  |  |  556|  22.6k|#define BLK_SIZE             4
  ------------------
                                                  + ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR)
  ------------------
  |  |  119|  22.6k|#define YUV420SP_FACTOR 2
  ------------------
 1911|  22.6k|                                    + (i >> 1) * (u4_recwidth_cr << 2);
 1912|  22.6k|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  22.6k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
 1913|  22.6k|                    {
 1914|  22.6k|                        if(CHECKBIT(u2_chroma_csbp, i))
  ------------------
  |  |   54|  22.6k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 10.2k, False: 12.3k]
  |  |  ------------------
  ------------------
 1915|  10.2k|                        {
 1916|  10.2k|                            ps_dec->pf_iquant_itrans_recon_chroma_4x4(
 1917|  10.2k|                                            pi2_level,
 1918|  10.2k|                                            pu1_pred_sblk,
 1919|  10.2k|                                            pu1_pred_sblk,
 1920|  10.2k|                                            u4_recwidth_cr,
 1921|  10.2k|                                            u4_recwidth_cr,
 1922|  10.2k|                                            gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpcr_rem6],
 1923|  10.2k|                                            (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[2],
 1924|  10.2k|                                            u4_scale_v, ai2_tmp, pi2_level);
 1925|  10.2k|                        }
 1926|  12.3k|                        else if(pi2_level[0] != 0)
  ------------------
  |  Branch (1926:33): [True: 9.14k, False: 3.24k]
  ------------------
 1927|  9.14k|                        {
 1928|  9.14k|                            ps_dec->pf_iquant_itrans_recon_chroma_4x4_dc(
 1929|  9.14k|                                            pi2_level,
 1930|  9.14k|                                            pu1_pred_sblk,
 1931|  9.14k|                                            pu1_pred_sblk,
 1932|  9.14k|                                            u4_recwidth_cr,
 1933|  9.14k|                                            u4_recwidth_cr,
 1934|  9.14k|                                            gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpcr_rem6],
 1935|  9.14k|                                            (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[2],
 1936|  9.14k|                                            u4_scale_v, ai2_tmp, pi2_level);
 1937|  9.14k|                        }
 1938|  22.6k|                    }
 1939|  22.6k|                }
 1940|  5.66k|            }
 1941|       |
 1942|  5.66k|        }
 1943|  4.41k|        else
 1944|  4.41k|        {
 1945|       |            /* If no inverse transform is needed, pass recon buffer pointer */
 1946|       |            /* to Intraprediction module instead of pred buffer pointer     */
 1947|  4.41k|            {
 1948|  4.41k|                UWORD16 au2_ngbr_pels[33];
 1949|  4.41k|                UWORD8 *pu1_ngbr_pels = (UWORD8 *)au2_ngbr_pels;
 1950|  4.41k|                UWORD16 *pu2_left_uv;
 1951|  4.41k|                UWORD16 *pu2_topleft_uv;
 1952|  4.41k|                WORD32 use_left1 = (u2_use_left_mb_pack & 0x0ff);
 1953|  4.41k|                WORD32 use_left2 = (u2_use_left_mb_pack & 0xff00) >> 8;
 1954|       |
 1955|  4.41k|                pu2_topleft_uv = (UWORD16 *)pu1_u_top_left;
 1956|  4.41k|                pu2_left_uv = (UWORD16 *)pu1_uleft;
 1957|       |
 1958|       |                /* Get neighbour pixels */
 1959|       |                /* left pels */
 1960|  4.41k|                if(u2_use_left_mb_pack)
  ------------------
  |  Branch (1960:20): [True: 2.07k, False: 2.34k]
  ------------------
 1961|  2.07k|                {
 1962|  2.07k|                    WORD32 i;
 1963|  2.07k|                    if(use_left1)
  ------------------
  |  Branch (1963:24): [True: 2.07k, False: 0]
  ------------------
 1964|  2.07k|                    {
 1965|  10.3k|                        for(i = 0; i < 4; i++)
  ------------------
  |  Branch (1965:36): [True: 8.28k, False: 2.07k]
  ------------------
 1966|  8.28k|                            au2_ngbr_pels[8 - 1 - i] = pu2_left_uv[i
 1967|  8.28k|                                            * u4_recwidth_cr / YUV420SP_FACTOR];
  ------------------
  |  |  119|  8.28k|#define YUV420SP_FACTOR 2
  ------------------
 1968|  2.07k|                    }
 1969|      0|                    else
 1970|      0|                    {
 1971|      0|                        memset(au2_ngbr_pels + 4, 0, 4 * sizeof(UWORD16));
 1972|      0|                    }
 1973|       |
 1974|  2.07k|                    if(use_left2)
  ------------------
  |  Branch (1974:24): [True: 2.07k, False: 0]
  ------------------
 1975|  2.07k|                    {
 1976|  10.3k|                        for(i = 4; i < 8; i++)
  ------------------
  |  Branch (1976:36): [True: 8.28k, False: 2.07k]
  ------------------
 1977|  8.28k|                            au2_ngbr_pels[8 - 1 - i] = pu2_left_uv[i
 1978|  8.28k|                                            * u4_recwidth_cr / YUV420SP_FACTOR];
  ------------------
  |  |  119|  8.28k|#define YUV420SP_FACTOR 2
  ------------------
 1979|  2.07k|                    }
 1980|      0|                    else
 1981|      0|                    {
 1982|      0|                        memset(au2_ngbr_pels, 0, 4 * sizeof(UWORD16));
 1983|      0|                    }
 1984|       |
 1985|  2.07k|                }
 1986|  2.34k|                else
 1987|  2.34k|                {
 1988|  2.34k|                    memset(au2_ngbr_pels, 0, 8 * sizeof(UWORD16));
 1989|  2.34k|                }
 1990|       |
 1991|       |                /* top left pels */
 1992|  4.41k|                au2_ngbr_pels[8] = *pu2_topleft_uv;
 1993|       |
 1994|       |                /* top pels */
 1995|  4.41k|                if(uc_useTopMB)
  ------------------
  |  Branch (1995:20): [True: 3.72k, False: 684]
  ------------------
 1996|  3.72k|                {
 1997|  3.72k|                    memcpy(au2_ngbr_pels + 8 + 1, pu1_top_u,
 1998|  3.72k|                           8 * sizeof(UWORD16));
 1999|  3.72k|                }
 2000|    684|                else
 2001|    684|                {
 2002|    684|                    memset(au2_ngbr_pels + 8 + 1, 0, 8 * sizeof(UWORD16));
 2003|    684|                }
 2004|       |
 2005|  4.41k|                PROFILE_DISABLE_INTRA_PRED()
  ------------------
  |  |  105|  4.41k|#define PROFILE_DISABLE_INTRA_PRED() ;
  ------------------
 2006|  4.41k|                ps_dec->apf_intra_pred_chroma[u1_intra_chrom_pred_mode](
 2007|  4.41k|                                pu1_ngbr_pels,
 2008|  4.41k|                                pu1_mb_cb_rei1_buffer,
 2009|  4.41k|                                1,
 2010|  4.41k|                                u4_recwidth_cr,
 2011|  4.41k|                                ((uc_useTopMB << 2) | (use_left2 << 4)
 2012|  4.41k|                                                | use_left1));
 2013|  4.41k|            }
 2014|       |
 2015|  4.41k|        }
 2016|       |
 2017|  10.0k|    }
 2018|  10.0k|    return OK;
  ------------------
  |  |  114|  10.0k|#define OK        0
  ------------------
 2019|  10.0k|}

ih264d_insert_pic_in_ref_pic_listx:
   66|  4.45k|{
   67|  4.45k|    *ps_ref_pic_buf_lx = *ps_pic;
   68|  4.45k|}
ih264d_mv_pred_ref_tfr_nby2_pmb:
   73|  55.1k|{
   74|  55.1k|    parse_pmbarams_t * ps_mb_part_info;
   75|  55.1k|    parse_part_params_t * ps_part;
   76|  55.1k|    mv_pred_t *ps_mv_nmb, *ps_mv_nmb_start, *ps_mv_ntop, *ps_mv_ntop_start;
   77|  55.1k|    UWORD32 i, j;
   78|  55.1k|    const UWORD32 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
   79|  55.1k|    dec_mb_info_t * ps_cur_mb_info;
   80|  55.1k|    WORD32 i2_mv_x, i2_mv_y;
   81|  55.1k|    WORD32 ret;
   82|       |
   83|  55.1k|    ps_dec->i4_submb_ofst -= (WORD32)(u4_num_mbs - u4_mb_idx) << 4;
   84|  55.1k|    ps_mb_part_info = ps_dec->ps_parse_mb_data; // + u4_mb_idx;
   85|  55.1k|    ps_part = ps_dec->ps_parse_part_params; // + u4_mb_idx;
   86|       |
   87|       |    /* N/2 Mb MvPred and Transfer Setup Loop */
   88|   262k|    for(i = u4_mb_idx; i < u4_num_mbs; i++, ps_mb_part_info++)
  ------------------
  |  Branch (88:24): [True: 207k, False: 55.1k]
  ------------------
   89|   207k|    {
   90|   207k|        UWORD32 u1_colz;
   91|   207k|        UWORD32 u1_field;
   92|   207k|        mv_pred_t s_mvPred;
   93|   207k|        mv_pred_t *ps_mv_pred = &s_mvPred;
   94|       |
   95|       |
   96|       |
   97|   207k|        *ps_mv_pred = ps_dec->s_default_mv_pred;
   98|       |
   99|   207k|        ps_dec->i4_submb_ofst += SUB_BLK_SIZE;
  ------------------
  |  |  562|   207k|#define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|   207k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  |  |               #define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|   207k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  ------------------
  100|       |
  101|       |        /* Restore the slice scratch MbX and MbY context */
  102|   207k|        ps_cur_mb_info = ps_dec->ps_nmb_info + i;
  103|   207k|        u1_field = ps_cur_mb_info->u1_mb_field_decodingflag;
  104|       |
  105|       |
  106|       |
  107|   207k|        ps_mv_nmb_start = ps_dec->ps_mv_cur + (i << 4);
  108|   207k|        ps_dec->u2_mbx = ps_cur_mb_info->u2_mbx;
  109|   207k|        ps_dec->u2_mby = ps_cur_mb_info->u2_mby;
  110|   207k|        ps_dec->u2_mv_2mb[i & 0x1] = 0;
  111|       |
  112|       |        /* Look for MV Prediction and Reference Transfer in Non-I Mbs */
  113|   207k|        if(!ps_mb_part_info->u4_isI_mb)
  ------------------
  |  Branch (113:12): [True: 204k, False: 2.78k]
  ------------------
  114|   204k|        {
  115|   204k|            UWORD32 u1_blk_no;
  116|   204k|            WORD32 i1_ref_idx, i1_ref_idx1;
  117|   204k|            UWORD32 u1_sub_mb_x, u1_sub_mb_y, u1_sub_mb_num;
  118|   204k|            UWORD32 u1_num_part, u1_num_ref, u1_wd, u1_ht;
  119|   204k|            UWORD32 *pu4_wt_offst, **ppu4_wt_ofst;
  120|   204k|            UWORD32 u1_scale_ref, u4_bot_mb;
  121|   204k|            WORD8 *pi1_ref_idx = ps_mb_part_info->i1_ref_idx[0];
  122|   204k|            pic_buffer_t *ps_ref_frame, **pps_ref_frame;
  123|   204k|            deblk_mb_t * ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + i;
  124|       |
  125|       |            /* MB Level initialisations */
  126|   204k|            ps_dec->u4_num_pmbair = i >> u1_mbaff;
  127|   204k|            ps_dec->u4_mb_idx_mv = i;
  128|   204k|            ppu4_wt_ofst = ps_mb_part_info->pu4_wt_offst;
  129|   204k|            pps_ref_frame = ps_dec->ps_ref_pic_buf_lx[0];
  130|       |            /* CHANGED CODE */
  131|   204k|            ps_mv_ntop_start = ps_mv_nmb_start
  132|   204k|                            - (ps_dec->u2_frm_wd_in_mbs << (4 + u1_mbaff)) + 12;
  133|       |
  134|   204k|            u1_num_part = ps_mb_part_info->u1_num_part;
  135|   204k|            ps_cur_deblk_mb->u1_mb_type |= (u1_num_part > 1) << 1;
  136|   204k|            ps_cur_mb_info->u4_pred_info_pkd_idx = ps_dec->u4_pred_info_pkd_idx;
  137|   204k|            ps_cur_mb_info->u1_num_pred_parts = 0;
  138|       |
  139|       |
  140|       |            /****************************************************/
  141|       |            /* weighted u4_ofst pointer calculations, this loop  */
  142|       |            /* runs maximum 4 times, even in direct cases       */
  143|       |            /****************************************************/
  144|   204k|            u1_scale_ref = u1_mbaff & u1_field;
  145|       |
  146|   204k|            u4_bot_mb = 1 - ps_cur_mb_info->u1_topmb;
  147|   204k|            if(ps_dec->ps_cur_pps->u1_wted_pred_flag)
  ------------------
  |  Branch (147:16): [True: 153k, False: 51.0k]
  ------------------
  148|   153k|            {
  149|   153k|                u1_num_ref = MIN(u1_num_part, 4);
  ------------------
  |  |   61|   153k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 151k, False: 2.32k]
  |  |  ------------------
  ------------------
  150|   320k|                for(u1_blk_no = 0; u1_blk_no < u1_num_ref; u1_blk_no++)
  ------------------
  |  Branch (150:36): [True: 166k, False: 153k]
  ------------------
  151|   166k|                {
  152|   166k|                    i1_ref_idx = pi1_ref_idx[u1_blk_no];
  153|   166k|                    if(u1_scale_ref)
  ------------------
  |  Branch (153:24): [True: 0, False: 166k]
  ------------------
  154|      0|                        i1_ref_idx >>= 1;
  155|   166k|                    pu4_wt_offst = (UWORD32*)&ps_dec->pu4_wt_ofsts[2
  156|   166k|                                    * X3(i1_ref_idx)];
  ------------------
  |  |   92|   166k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  157|   166k|                    ppu4_wt_ofst[u1_blk_no] = pu4_wt_offst;
  158|   166k|                }
  159|   153k|            }
  160|  51.0k|            else
  161|  51.0k|            {
  162|  51.0k|                ppu4_wt_ofst[0] = NULL;
  163|  51.0k|                ppu4_wt_ofst[1] = NULL;
  164|  51.0k|                ppu4_wt_ofst[2] = NULL;
  165|  51.0k|                ppu4_wt_ofst[3] = NULL;
  166|  51.0k|            }
  167|       |
  168|       |            /**************************************************/
  169|       |            /* Loop on Partitions                             */
  170|       |            /**************************************************/
  171|   428k|            for(j = 0; j < u1_num_part; j++, ps_part++)
  ------------------
  |  Branch (171:24): [True: 223k, False: 204k]
  ------------------
  172|   223k|            {
  173|       |
  174|   223k|                u1_sub_mb_num = ps_part->u1_sub_mb_num;
  175|   223k|                ps_dec->u1_sub_mb_num = u1_sub_mb_num;
  176|       |
  177|   223k|                if(PART_NOT_DIRECT != ps_part->u1_is_direct)
  ------------------
  |  |  569|   223k|#define PART_NOT_DIRECT                0
  ------------------
  |  Branch (177:20): [True: 191k, False: 31.9k]
  ------------------
  178|   191k|                {
  179|       |                    /* Mb Skip Mode */
  180|       |                    /* Setting the default and other members of MvPred Structure */
  181|   191k|                    s_mvPred.i2_mv[2] = -1;
  182|   191k|                    s_mvPred.i2_mv[3] = -1;
  183|   191k|                    s_mvPred.i1_ref_frame[0] = 0;
  184|   191k|                    i1_ref_idx = (u1_scale_ref && u4_bot_mb) ? MAX_REF_BUFS : 0;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  |  Branch (184:35): [True: 0, False: 191k]
  |  Branch (184:51): [True: 0, False: 0]
  ------------------
  185|   191k|                    ps_ref_frame = pps_ref_frame[i1_ref_idx];
  186|   191k|                    s_mvPred.u1_col_ref_pic_idx = ps_ref_frame->u1_mv_buf_id;
  187|   191k|                    s_mvPred.u1_pic_type = ps_ref_frame->u1_pic_type;
  188|   191k|                    pu4_wt_offst = (UWORD32*)&ps_dec->pu4_wt_ofsts[0];
  189|       |
  190|   191k|                    ps_dec->pf_mvpred(ps_dec, ps_cur_mb_info, ps_mv_nmb_start,
  191|   191k|                                      ps_mv_ntop_start, &s_mvPred, 0, 4, 0, 1,
  192|   191k|                                      MB_SKIP);
  ------------------
  |  |  456|   191k|#define MB_SKIP     255
  ------------------
  193|       |
  194|       |
  195|       |
  196|       |
  197|       |
  198|       |
  199|   191k|                    {
  200|   191k|                        pred_info_pkd_t *ps_pred_pkd;
  201|   191k|                        ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  202|   191k|                    ih264d_fill_pred_info (s_mvPred.i2_mv,4,4,0,PRED_L0,ps_pred_pkd,ps_ref_frame->u1_pic_buf_id,
  ------------------
  |  |  483|   191k|#define PRED_L0   1
  ------------------
  203|   191k|                                           (i1_ref_idx >> u1_scale_ref),pu4_wt_offst,
  204|   191k|                                           ps_ref_frame->u1_pic_type);
  205|       |
  206|       |
  207|   191k|                    ps_dec->u4_pred_info_pkd_idx++;
  208|   191k|                    ps_cur_mb_info->u1_num_pred_parts++;
  209|   191k|                    }
  210|       |
  211|       |
  212|       |
  213|       |                    /* Storing colocated zero information */
  214|   191k|                    u1_colz = ((ABS(s_mvPred.i2_mv[0]) <= 1)
  ------------------
  |  |  100|   191k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 144, False: 191k]
  |  |  ------------------
  ------------------
  |  Branch (214:32): [True: 191k, False: 251]
  ------------------
  215|   191k|                                    && (ABS(s_mvPred.i2_mv[1]) <= 1))
  ------------------
  |  |  100|   191k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 21, False: 191k]
  |  |  ------------------
  ------------------
  |  Branch (215:40): [True: 191k, False: 21]
  ------------------
  216|   191k|                                    + (u1_field << 1);
  217|       |
  218|   191k|                    ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb_start, 0,
  219|   191k|                                       u1_colz, 4, 4);
  220|   191k|                }
  221|  31.9k|                else
  222|  31.9k|                {
  223|  31.9k|                    u1_sub_mb_x = u1_sub_mb_num & 0x03;
  224|  31.9k|                    u1_sub_mb_y = u1_sub_mb_num >> 2;
  225|  31.9k|                    u1_blk_no =
  226|  31.9k|                                    (u1_num_part < 4) ?
  ------------------
  |  Branch (226:37): [True: 16.1k, False: 15.8k]
  ------------------
  227|  16.1k|                                                    j :
  228|  31.9k|                                                    (((u1_sub_mb_y >> 1) << 1)
  229|  15.8k|                                                                    + (u1_sub_mb_x
  230|  15.8k|                                                                                    >> 1));
  231|       |
  232|  31.9k|                    ps_mv_ntop = ps_mv_ntop_start + u1_sub_mb_x;
  233|  31.9k|                    ps_mv_nmb = ps_mv_nmb_start + u1_sub_mb_num;
  234|       |
  235|  31.9k|                    u1_wd = ps_part->u1_partwidth;
  236|  31.9k|                    u1_ht = ps_part->u1_partheight;
  237|       |
  238|       |                    /* Populate the colpic info and reference frames */
  239|  31.9k|                    i1_ref_idx = pi1_ref_idx[u1_blk_no];
  240|  31.9k|                    s_mvPred.i1_ref_frame[0] = i1_ref_idx;
  241|       |
  242|       |                    /********************************************************/
  243|       |                    /* Predict Mv                                           */
  244|       |                    /* Add Mv Residuals and store back                      */
  245|       |                    /********************************************************/
  246|  31.9k|                    ps_dec->pf_mvpred(ps_dec, ps_cur_mb_info, ps_mv_nmb, ps_mv_ntop,
  247|  31.9k|                                      &s_mvPred, u1_sub_mb_num, u1_wd, 0, 1,
  248|  31.9k|                                      ps_cur_mb_info->u1_mb_mc_mode);
  249|  31.9k|                    i2_mv_x = ps_mv_nmb->i2_mv[0];
  250|  31.9k|                    i2_mv_y = ps_mv_nmb->i2_mv[1];
  251|  31.9k|                    i2_mv_x += s_mvPred.i2_mv[0];
  252|  31.9k|                    i2_mv_y += s_mvPred.i2_mv[1];
  253|  31.9k|                    s_mvPred.i2_mv[0] = i2_mv_x;
  254|  31.9k|                    s_mvPred.i2_mv[1] = i2_mv_y;
  255|       |
  256|       |                    /********************************************************/
  257|       |                    /* Transfer setup call                                  */
  258|       |                    /* convert RefIdx if it is MbAff                        */
  259|       |                    /* Pass Weight Offset and refFrame                      */
  260|       |                    /********************************************************/
  261|  31.9k|                    i1_ref_idx1 = i1_ref_idx >> u1_scale_ref;
  262|  31.9k|                    if(u1_scale_ref && ((i1_ref_idx & 0x01) != u4_bot_mb))
  ------------------
  |  Branch (262:24): [True: 0, False: 31.9k]
  |  Branch (262:40): [True: 0, False: 0]
  ------------------
  263|      0|                        i1_ref_idx1 += MAX_REF_BUFS;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  264|  31.9k|                    ps_ref_frame = pps_ref_frame[i1_ref_idx1];
  265|  31.9k|                    pu4_wt_offst = ppu4_wt_ofst[u1_blk_no];
  266|       |
  267|       |
  268|       |
  269|       |
  270|       |
  271|       |
  272|  31.9k|                    {
  273|  31.9k|                    pred_info_pkd_t *ps_pred_pkd;
  274|  31.9k|                    ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  275|  31.9k|                    ih264d_fill_pred_info (s_mvPred.i2_mv,u1_wd,u1_ht,u1_sub_mb_num,PRED_L0,ps_pred_pkd,
  ------------------
  |  |  483|  31.9k|#define PRED_L0   1
  ------------------
  276|  31.9k|                                           ps_ref_frame->u1_pic_buf_id,(i1_ref_idx >> u1_scale_ref),pu4_wt_offst,
  277|  31.9k|                                           ps_ref_frame->u1_pic_type);
  278|       |
  279|  31.9k|                    ps_dec->u4_pred_info_pkd_idx++;
  280|  31.9k|                    ps_cur_mb_info->u1_num_pred_parts++;
  281|  31.9k|                    }
  282|       |
  283|       |
  284|       |
  285|       |                    /* Fill colocated info in MvPred structure */
  286|  31.9k|                    s_mvPred.u1_col_ref_pic_idx = ps_ref_frame->u1_mv_buf_id;
  287|  31.9k|                    s_mvPred.u1_pic_type = ps_ref_frame->u1_pic_type;
  288|       |
  289|       |                    /* Calculating colocated zero information */
  290|  31.9k|                    u1_colz =
  291|  31.9k|                                    (u1_field << 1)
  292|  31.9k|                                                    | ((i1_ref_idx == 0)
  ------------------
  |  Branch (292:56): [True: 26.5k, False: 5.39k]
  ------------------
  293|  26.5k|                                                                    && (ABS(i2_mv_x)
  ------------------
  |  |  100|  26.5k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 9.65k, False: 16.8k]
  |  |  ------------------
  ------------------
  |  Branch (293:72): [True: 5.24k, False: 21.2k]
  ------------------
  294|  26.5k|                                                                                    <= 1)
  295|  5.24k|                                                                    && (ABS(i2_mv_y)
  ------------------
  |  |  100|  5.24k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 1.69k, False: 3.55k]
  |  |  ------------------
  ------------------
  |  Branch (295:72): [True: 3.89k, False: 1.35k]
  ------------------
  296|  5.24k|                                                                                    <= 1));
  297|  31.9k|                    u1_colz |= ps_mb_part_info->u1_col_info[u1_blk_no];
  298|       |
  299|       |                    /* Replicate the motion vectors and colzero u4_flag  */
  300|       |                    /* for all sub-partitions                         */
  301|       |
  302|  31.9k|                    ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb,
  303|  31.9k|                                       u1_sub_mb_num, u1_colz, u1_ht,
  304|  31.9k|                                       u1_wd);
  305|  31.9k|                }
  306|   223k|            }
  307|       |
  308|   204k|        }
  309|  2.78k|        else
  310|  2.78k|        {
  311|       |            /* Storing colocated zero information */
  312|  2.78k|            ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb_start, 0,
  313|  2.78k|                               (UWORD8)(u1_field << 1), 4, 4);
  314|       |
  315|  2.78k|        }
  316|       |        /*if num _cores is set to 3,compute bs will be done in another thread*/
  317|   207k|        if(ps_dec->u4_num_cores < 3)
  ------------------
  |  Branch (317:12): [True: 207k, False: 0]
  ------------------
  318|   207k|        {
  319|       |
  320|   207k|            if(ps_dec->u4_app_disable_deblk_frm == 0)
  ------------------
  |  Branch (320:16): [True: 207k, False: 0]
  ------------------
  321|   207k|                ps_dec->pf_compute_bs(ps_dec, ps_cur_mb_info,
  322|   207k|                                     (UWORD16)(i >> u1_mbaff));
  323|   207k|        }
  324|   207k|    }
  325|       |
  326|       |
  327|       |
  328|  55.1k|    return OK;
  ------------------
  |  |  114|  55.1k|#define OK        0
  ------------------
  329|  55.1k|}
ih264d_decode_recon_tfr_nmb:
  338|  47.3k|{
  339|  47.3k|    WORD32 i,j;
  340|  47.3k|    UWORD32 u1_end_of_row_next;
  341|  47.3k|    dec_mb_info_t * ps_cur_mb_info;
  342|  47.3k|    UWORD32 u4_update_mbaff = 0;
  343|  47.3k|    WORD32 ret;
  344|  47.3k|    const UWORD32 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  345|  47.3k|    const UWORD32 u1_slice_type = ps_dec->ps_cur_slice->u1_slice_type;
  346|  47.3k|    const WORD32 u1_skip_th = (
  347|  47.3k|                    (u1_slice_type != I_SLICE) ?
  ------------------
  |  |  370|  47.3k|#define I_SLICE  2
  ------------------
  |  Branch (347:21): [True: 46.6k, False: 692]
  ------------------
  348|  46.6k|                                    (ps_dec->u1_B ? B_8x8 : PRED_8x8R0) : -1);
  ------------------
  |  |  480|  7.30k|#define B_8x8    22
  ------------------
                                                  (ps_dec->u1_B ? B_8x8 : PRED_8x8R0) : -1);
  ------------------
  |  |  454|  39.3k|#define PRED_8x8R0  4
  ------------------
  |  Branch (348:38): [True: 7.30k, False: 39.3k]
  ------------------
  349|  47.3k|    const UWORD32 u1_ipcm_th = (
  350|  47.3k|                    (u1_slice_type != I_SLICE) ? (ps_dec->u1_B ? 23 : 5) : 0);
  ------------------
  |  |  370|  47.3k|#define I_SLICE  2
  ------------------
  |  Branch (350:21): [True: 46.6k, False: 692]
  |  Branch (350:51): [True: 7.30k, False: 39.3k]
  ------------------
  351|       |
  352|       |
  353|       |
  354|       |
  355|       |
  356|       |    /* N Mb MC Loop */
  357|   444k|    for(i = u4_mb_idx; i < u4_num_mbs; i++)
  ------------------
  |  Branch (357:24): [True: 397k, False: 47.3k]
  ------------------
  358|   397k|    {
  359|   397k|        ps_cur_mb_info = ps_dec->ps_nmb_info + i;
  360|   397k|        ps_dec->u4_dma_buf_idx = 0;
  361|   397k|        ps_dec->u4_pred_info_idx = 0;
  362|       |
  363|   397k|        if(ps_cur_mb_info->u1_mb_type <= u1_skip_th)
  ------------------
  |  Branch (363:12): [True: 17.3k, False: 380k]
  ------------------
  364|  17.3k|        {
  365|  17.3k|            {
  366|  17.3k|                WORD32 pred_cnt = 0;
  367|  17.3k|                pred_info_pkd_t *ps_pred_pkd;
  368|  17.3k|                UWORD32 u4_pred_info_pkd_idx;
  369|  17.3k|                WORD8 i1_pred;
  370|       |
  371|  17.3k|                u4_pred_info_pkd_idx = ps_cur_mb_info->u4_pred_info_pkd_idx;
  372|       |
  373|  63.0k|                while(pred_cnt < ps_cur_mb_info->u1_num_pred_parts)
  ------------------
  |  Branch (373:23): [True: 45.7k, False: 17.3k]
  ------------------
  374|  45.7k|                {
  375|       |
  376|  45.7k|                    ps_pred_pkd = ps_dec->ps_pred_pkd + u4_pred_info_pkd_idx;
  377|       |
  378|  45.7k|                     ps_dec->p_form_mb_part_info(ps_pred_pkd,ps_dec,
  379|  45.7k|                                               ps_cur_mb_info->u2_mbx,ps_cur_mb_info->u2_mby,(i >> u1_mbaff),
  380|  45.7k|                                         ps_cur_mb_info);
  381|  45.7k|                    u4_pred_info_pkd_idx++;
  382|  45.7k|                    pred_cnt++;
  383|  45.7k|                }
  384|  17.3k|            }
  385|       |
  386|  17.3k|            ps_dec->p_motion_compensate(ps_dec, ps_cur_mb_info);
  387|       |
  388|  17.3k|        }
  389|   380k|        else if(ps_cur_mb_info->u1_mb_type == MB_SKIP)
  ------------------
  |  |  456|   380k|#define MB_SKIP     255
  ------------------
  |  Branch (389:17): [True: 377k, False: 2.38k]
  ------------------
  390|   377k|        {
  391|   377k|            {
  392|   377k|                WORD32 pred_cnt = 0;
  393|   377k|                pred_info_pkd_t *ps_pred_pkd;
  394|   377k|                UWORD32 u4_pred_info_pkd_idx;
  395|   377k|                WORD8 i1_pred;
  396|       |
  397|   377k|                u4_pred_info_pkd_idx = ps_cur_mb_info->u4_pred_info_pkd_idx;
  398|       |
  399|   764k|                while(pred_cnt < ps_cur_mb_info->u1_num_pred_parts)
  ------------------
  |  Branch (399:23): [True: 386k, False: 377k]
  ------------------
  400|   386k|                {
  401|       |
  402|   386k|                    ps_pred_pkd = ps_dec->ps_pred_pkd + u4_pred_info_pkd_idx;
  403|       |
  404|   386k|                    ps_dec->p_form_mb_part_info(ps_pred_pkd,ps_dec,
  405|   386k|                                               ps_cur_mb_info->u2_mbx,ps_cur_mb_info->u2_mby,(i >> u1_mbaff),
  406|   386k|                                         ps_cur_mb_info);
  407|       |
  408|   386k|                    u4_pred_info_pkd_idx++;
  409|   386k|                    pred_cnt++;
  410|   386k|                }
  411|   377k|            }
  412|       |            /* Decode MB skip */
  413|   377k|            ps_dec->p_motion_compensate(ps_dec, ps_cur_mb_info);
  414|       |
  415|   377k|        }
  416|       |
  417|   397k|     }
  418|       |
  419|       |
  420|       |    /* N Mb IQ IT RECON  Loop */
  421|   444k|    for(j = u4_mb_idx; j < i; j++)
  ------------------
  |  Branch (421:24): [True: 397k, False: 47.3k]
  ------------------
  422|   397k|    {
  423|   397k|        ps_cur_mb_info = ps_dec->ps_nmb_info + j;
  424|       |
  425|   397k|        if(ps_cur_mb_info->u1_mb_type <= u1_skip_th)
  ------------------
  |  Branch (425:12): [True: 17.3k, False: 380k]
  ------------------
  426|  17.3k|        {
  427|  17.3k|            ih264d_process_inter_mb(ps_dec, ps_cur_mb_info, j);
  428|       |
  429|  17.3k|        }
  430|   380k|        else if(ps_cur_mb_info->u1_mb_type != MB_SKIP)
  ------------------
  |  |  456|   380k|#define MB_SKIP     255
  ------------------
  |  Branch (430:17): [True: 2.38k, False: 377k]
  ------------------
  431|  2.38k|        {
  432|  2.38k|            if((u1_ipcm_th + 25) != ps_cur_mb_info->u1_mb_type)
  ------------------
  |  Branch (432:16): [True: 2.28k, False: 93]
  ------------------
  433|  2.28k|            {
  434|  2.28k|                ps_cur_mb_info->u1_mb_type -= (u1_skip_th + 1);
  435|  2.28k|                ih264d_process_intra_mb(ps_dec, ps_cur_mb_info, j);
  436|  2.28k|            }
  437|  2.38k|        }
  438|       |
  439|       |
  440|   397k|        if(ps_dec->u4_use_intrapred_line_copy)
  ------------------
  |  Branch (440:12): [True: 397k, False: 0]
  ------------------
  441|   397k|        {
  442|   397k|            ih264d_copy_intra_pred_line(ps_dec, ps_cur_mb_info, j);
  443|   397k|        }
  444|       |
  445|   397k|    }
  446|       |
  447|       |    /*N MB deblocking*/
  448|  47.3k|    if(ps_dec->u4_nmb_deblk == 1)
  ------------------
  |  Branch (448:8): [True: 47.3k, False: 0]
  ------------------
  449|  47.3k|    {
  450|       |
  451|  47.3k|        UWORD32 u4_cur_mb, u4_right_mb;
  452|  47.3k|        UWORD32 u4_mb_x, u4_mb_y;
  453|  47.3k|        UWORD32 u4_wd_y, u4_wd_uv;
  454|  47.3k|        tfr_ctxt_t *ps_tfr_cxt = &(ps_dec->s_tran_addrecon);
  455|  47.3k|        UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag;
  456|  47.3k|        const WORD32 i4_cb_qp_idx_ofst =
  457|  47.3k|                       ps_dec->ps_cur_pps->i1_chroma_qp_index_offset;
  458|  47.3k|        const WORD32 i4_cr_qp_idx_ofst =
  459|  47.3k|                       ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset;
  460|       |
  461|  47.3k|        u4_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag;
  462|  47.3k|        u4_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag;
  463|       |
  464|       |
  465|  47.3k|        ps_cur_mb_info = ps_dec->ps_nmb_info + u4_mb_idx;
  466|       |
  467|  47.3k|        ps_dec->u4_deblk_mb_x = ps_cur_mb_info->u2_mbx;
  468|  47.3k|        ps_dec->u4_deblk_mb_y = ps_cur_mb_info->u2_mby;
  469|       |
  470|   444k|        for(j = u4_mb_idx; j < i; j++)
  ------------------
  |  Branch (470:28): [True: 397k, False: 47.3k]
  ------------------
  471|   397k|        {
  472|       |
  473|   397k|            ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt,
  474|   397k|                                       i4_cb_qp_idx_ofst, i4_cr_qp_idx_ofst,
  475|   397k|                                        u4_wd_y, u4_wd_uv);
  476|       |
  477|       |
  478|   397k|        }
  479|       |
  480|       |
  481|       |
  482|  47.3k|    }
  483|       |
  484|       |
  485|       |
  486|  47.3k|    if(u4_tfr_n_mb)
  ------------------
  |  Branch (486:8): [True: 47.3k, False: 0]
  ------------------
  487|  47.3k|    {
  488|       |        /****************************************************************/
  489|       |        /* Check for End Of Row in Next iteration                       */
  490|       |        /****************************************************************/
  491|  47.3k|        u1_end_of_row_next =
  492|  47.3k|                        u4_num_mbs_next
  ------------------
  |  Branch (492:25): [True: 793, False: 46.5k]
  ------------------
  493|    793|                                        && (u4_num_mbs_next
  ------------------
  |  Branch (493:44): [True: 793, False: 0]
  ------------------
  494|    793|                                                        <= (ps_dec->u4_recon_mb_grp
  495|    793|                                                                        >> u1_mbaff));
  496|       |
  497|       |        /****************************************************************/
  498|       |        /* Transfer the Following things                                */
  499|       |        /* N-Mb DeblkParams Data    ( To Ext DeblkParams Buffer )       */
  500|       |        /* N-Mb Recon Data          ( To Ext Frame Buffer )             */
  501|       |        /* N-Mb Intrapredline Data  ( Updated Internally)               */
  502|       |        /* N-Mb MV Data             ( To Ext MV Buffer )                */
  503|       |        /* N-Mb MVTop/TopRight Data ( To Int MV Top Scratch Buffers)    */
  504|       |        /****************************************************************/
  505|  47.3k|        ih264d_transfer_mb_group_data(ps_dec, u4_num_mbs, u4_end_of_row,
  506|  47.3k|                                      u1_end_of_row_next);
  507|  47.3k|        ps_dec->u4_num_mbs_prev_nmb = u4_num_mbs;
  508|       |
  509|  47.3k|        ps_dec->u4_pred_info_idx = 0;
  510|  47.3k|        ps_dec->u4_dma_buf_idx = 0;
  511|       |
  512|       |
  513|  47.3k|    }
  514|  47.3k|    return OK;
  ------------------
  |  |  114|  47.3k|#define OK        0
  ------------------
  515|  47.3k|}
ih264d_process_inter_mb:
  532|  20.5k|{
  533|       |    /* CHANGED CODE */
  534|  20.5k|    UWORD8 *pu1_rec_y, *pu1_rec_u, *pu1_rec_v;
  535|       |
  536|       |    /*CHANGED CODE */
  537|  20.5k|    UWORD32 ui_rec_width, u4_recwidth_cr;
  538|  20.5k|    WORD16 *pi2_y_coeff;
  539|  20.5k|    UWORD32 u1_mb_field_decoding_flag;
  540|  20.5k|    const UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  541|  20.5k|    UWORD32 uc_botMb;
  542|  20.5k|    UWORD32 u4_num_pmbair;
  543|       |    /* CHANGED CODE */
  544|  20.5k|    tfr_ctxt_t *ps_frame_buf = ps_dec->ps_frame_buf_ip_recon;
  545|  20.5k|    UWORD32 u4_luma_dc_only_csbp = 0;
  546|  20.5k|    UWORD32 u4_luma_dc_only_cbp = 0;
  547|       |    /* CHANGED CODE */
  548|       |
  549|  20.5k|    uc_botMb = 1 - ps_cur_mb_info->u1_topmb;
  550|  20.5k|    u4_num_pmbair = (u4_mb_num >> u1_mbaff);
  551|  20.5k|    u1_mb_field_decoding_flag = ps_cur_mb_info->u1_mb_field_decodingflag;
  552|       |
  553|       |
  554|       |    /* CHANGED CODE */
  555|  20.5k|    pu1_rec_y = ps_frame_buf->pu1_dest_y + (u4_num_pmbair << 4);
  556|  20.5k|    pu1_rec_u =
  557|  20.5k|                    ps_frame_buf->pu1_dest_u
  558|  20.5k|                                    + (u4_num_pmbair << 3) * YUV420SP_FACTOR;
  ------------------
  |  |  119|  20.5k|#define YUV420SP_FACTOR 2
  ------------------
  559|  20.5k|    pu1_rec_v = ps_frame_buf->pu1_dest_v + (u4_num_pmbair << 3);
  560|  20.5k|    ui_rec_width = ps_dec->u2_frm_wd_y << u1_mb_field_decoding_flag;
  561|  20.5k|    u4_recwidth_cr = ps_dec->u2_frm_wd_uv << u1_mb_field_decoding_flag;
  562|       |
  563|       |    /* CHANGED CODE */
  564|       |
  565|  20.5k|    if(u1_mbaff)
  ------------------
  |  Branch (565:8): [True: 0, False: 20.5k]
  ------------------
  566|      0|    {
  567|      0|        if(uc_botMb)
  ------------------
  |  Branch (567:12): [True: 0, False: 0]
  ------------------
  568|      0|        {
  569|      0|            pu1_rec_y += (u1_mb_field_decoding_flag ?
  ------------------
  |  Branch (569:27): [True: 0, False: 0]
  ------------------
  570|      0|                            (ui_rec_width >> 1) : (ui_rec_width << 4));
  571|      0|            pu1_rec_u += (u1_mb_field_decoding_flag ?
  ------------------
  |  Branch (571:27): [True: 0, False: 0]
  ------------------
  572|      0|                            (u4_recwidth_cr >> 1) : (u4_recwidth_cr << 3));
  573|      0|            pu1_rec_v += (u1_mb_field_decoding_flag ?
  ------------------
  |  Branch (573:27): [True: 0, False: 0]
  ------------------
  574|      0|                            (u4_recwidth_cr >> 1) : (u4_recwidth_cr << 3));
  575|      0|        }
  576|      0|    }
  577|       |
  578|  20.5k|    if(!ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (578:8): [True: 17.8k, False: 2.72k]
  ------------------
  579|  17.8k|    {
  580|  17.8k|        u4_luma_dc_only_csbp = ih264d_unpack_luma_coeff4x4_mb(ps_dec,
  581|  17.8k|                                       ps_cur_mb_info,
  582|  17.8k|                                       0);
  583|  17.8k|    }
  584|  2.72k|    else
  585|  2.72k|    {
  586|  2.72k|        if(!ps_dec->ps_cur_pps->u1_entropy_coding_mode)
  ------------------
  |  Branch (586:12): [True: 607, False: 2.11k]
  ------------------
  587|    607|        {
  588|    607|            u4_luma_dc_only_cbp = ih264d_unpack_luma_coeff4x4_mb(ps_dec,
  589|    607|                                           ps_cur_mb_info,
  590|    607|                                           0);
  591|    607|        }
  592|  2.11k|        else
  593|  2.11k|        {
  594|  2.11k|            u4_luma_dc_only_cbp = ih264d_unpack_luma_coeff8x8_mb(ps_dec,
  595|  2.11k|                                           ps_cur_mb_info);
  596|  2.11k|        }
  597|  2.72k|    }
  598|       |
  599|  20.5k|    pi2_y_coeff = ps_dec->pi2_coeff_data;
  600|       |    /* Inverse Transform and Reconstruction */
  601|  20.5k|    if(ps_cur_mb_info->u1_cbp & 0x0f)
  ------------------
  |  Branch (601:8): [True: 8.38k, False: 12.1k]
  ------------------
  602|  8.38k|    {
  603|       |        /* CHANGED CODE */
  604|  8.38k|        if(!ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (604:12): [True: 5.66k, False: 2.72k]
  ------------------
  605|  5.66k|        {
  606|  5.66k|            UWORD32 i;
  607|  5.66k|            WORD16 ai2_tmp[16];
  608|  96.2k|            for(i = 0; i < 16; i++)
  ------------------
  |  Branch (608:24): [True: 90.5k, False: 5.66k]
  ------------------
  609|  90.5k|            {
  610|  90.5k|                if(CHECKBIT(ps_cur_mb_info->u2_luma_csbp, i))
  ------------------
  |  |   54|  90.5k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 27.8k, False: 62.7k]
  |  |  ------------------
  ------------------
  611|  27.8k|                {
  612|  27.8k|                    WORD16 *pi2_level = pi2_y_coeff + (i << 4);
  613|  27.8k|                    UWORD8 *pu1_pred_sblk = pu1_rec_y + ((i & 0x3) * BLK_SIZE)
  ------------------
  |  |  556|  27.8k|#define BLK_SIZE             4
  ------------------
  614|  27.8k|                                    + (i >> 2) * (ui_rec_width << 2);
  615|  27.8k|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  27.8k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
  616|  27.8k|                    {
  617|  27.8k|                        if(CHECKBIT(u4_luma_dc_only_csbp, i))
  ------------------
  |  |   54|  27.8k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 3.70k, False: 24.1k]
  |  |  ------------------
  ------------------
  618|  3.70k|                        {
  619|  3.70k|                            ps_dec->pf_iquant_itrans_recon_luma_4x4_dc(
  620|  3.70k|                                            pi2_level,
  621|  3.70k|                                            pu1_pred_sblk,
  622|  3.70k|                                            pu1_pred_sblk,
  623|  3.70k|                                            ui_rec_width,
  624|  3.70k|                                            ui_rec_width,
  625|  3.70k|                                            gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6],
  626|  3.70k|                                            (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[3],
  627|  3.70k|                                            ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0,
  628|  3.70k|                                            NULL);
  629|  3.70k|                        }
  630|  24.1k|                        else
  631|  24.1k|                        {
  632|  24.1k|                            ps_dec->pf_iquant_itrans_recon_luma_4x4(
  633|  24.1k|                                            pi2_level,
  634|  24.1k|                                            pu1_pred_sblk,
  635|  24.1k|                                            pu1_pred_sblk,
  636|  24.1k|                                            ui_rec_width,
  637|  24.1k|                                            ui_rec_width,
  638|  24.1k|                                            gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6],
  639|  24.1k|                                            (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[3],
  640|  24.1k|                                            ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0,
  641|  24.1k|                                            NULL);
  642|  24.1k|                        }
  643|  27.8k|                    }
  644|  27.8k|                }
  645|  90.5k|            }
  646|  5.66k|        }
  647|  2.72k|        else
  648|  2.72k|        {
  649|  2.72k|            WORD16 *pi2_scale_matrix_ptr;
  650|  2.72k|            WORD32 i;
  651|       |
  652|  2.72k|            pi2_scale_matrix_ptr =
  653|  2.72k|                            ps_dec->s_high_profile.i2_scalinglist8x8[1];
  654|       |
  655|  13.6k|            for(i = 0; i < 4; i++)
  ------------------
  |  Branch (655:24): [True: 10.8k, False: 2.72k]
  ------------------
  656|  10.8k|            {
  657|  10.8k|                WORD16 ai2_tmp[64];
  658|  10.8k|                WORD16 *pi16_levelBlock = pi2_y_coeff + (i << 6); /* move to the next 8x8 adding 64 */
  659|       |
  660|  10.8k|                UWORD8 *pu1_pred_sblk = pu1_rec_y + ((i & 0x1) * BLK8x8SIZE)
  ------------------
  |  |  555|  10.8k|#define BLK8x8SIZE          8
  ------------------
  661|  10.8k|                                + (i >> 1) * (ui_rec_width << 3);
  662|  10.8k|                if(CHECKBIT(ps_cur_mb_info->u1_cbp, i))
  ------------------
  |  |   54|  10.8k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 7.49k, False: 3.39k]
  |  |  ------------------
  ------------------
  663|  7.49k|                {
  664|  7.49k|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  7.49k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
  665|  7.49k|                    {
  666|  7.49k|                        if(CHECKBIT(u4_luma_dc_only_cbp, i))
  ------------------
  |  |   54|  7.49k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 174, False: 7.31k]
  |  |  ------------------
  ------------------
  667|    174|                        {
  668|    174|                            ps_dec->pf_iquant_itrans_recon_luma_8x8_dc(
  669|    174|                                            pi16_levelBlock,
  670|    174|                                            pu1_pred_sblk,
  671|    174|                                            pu1_pred_sblk,
  672|    174|                                            ui_rec_width,
  673|    174|                                            ui_rec_width,
  674|    174|                                            gau1_ih264d_dequant8x8_cavlc[ps_cur_mb_info->u1_qp_rem6],
  675|    174|                                            (UWORD16 *)pi2_scale_matrix_ptr,
  676|    174|                                            ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0,
  677|    174|                                            NULL);
  678|    174|                        }
  679|  7.31k|                        else
  680|  7.31k|                        {
  681|  7.31k|                            ps_dec->pf_iquant_itrans_recon_luma_8x8(
  682|  7.31k|                                            pi16_levelBlock,
  683|  7.31k|                                            pu1_pred_sblk,
  684|  7.31k|                                            pu1_pred_sblk,
  685|  7.31k|                                            ui_rec_width,
  686|  7.31k|                                            ui_rec_width,
  687|  7.31k|                                            gau1_ih264d_dequant8x8_cavlc[ps_cur_mb_info->u1_qp_rem6],
  688|  7.31k|                                            (UWORD16 *)pi2_scale_matrix_ptr,
  689|  7.31k|                                            ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0,
  690|  7.31k|                                            NULL);
  691|  7.31k|                        }
  692|  7.49k|                    }
  693|  7.49k|                }
  694|  10.8k|            }
  695|       |
  696|  2.72k|        }
  697|  8.38k|    }
  698|       |
  699|       |    /* Decode Chroma Block */
  700|  20.5k|    ih264d_unpack_chroma_coeff4x4_mb(ps_dec,
  701|  20.5k|                                     ps_cur_mb_info);
  702|       |    /*--------------------------------------------------------------------*/
  703|       |    /* Chroma Blocks decoding                                             */
  704|       |    /*--------------------------------------------------------------------*/
  705|  20.5k|    {
  706|  20.5k|        UWORD8 u1_chroma_cbp = (UWORD8)(ps_cur_mb_info->u1_cbp >> 4);
  707|       |
  708|  20.5k|        if(u1_chroma_cbp != CBPC_ALLZERO)
  ------------------
  |  |  507|  20.5k|#define CBPC_ALLZERO    0
  ------------------
  |  Branch (708:12): [True: 4.02k, False: 16.5k]
  ------------------
  709|  4.02k|        {
  710|  4.02k|            UWORD32 u4_scale_u = ps_cur_mb_info->u1_qpc_div6;
  711|  4.02k|            UWORD32 u4_scale_v = ps_cur_mb_info->u1_qpcr_div6;
  712|  4.02k|            UWORD16 u2_chroma_csbp = ps_cur_mb_info->u2_chroma_csbp;
  713|       |
  714|  4.02k|            pi2_y_coeff = ps_dec->pi2_coeff_data;
  715|       |
  716|  4.02k|            {
  717|  4.02k|                UWORD32 i;
  718|  4.02k|                WORD16 ai2_tmp[16];
  719|  20.1k|                for(i = 0; i < 4; i++)
  ------------------
  |  Branch (719:28): [True: 16.1k, False: 4.02k]
  ------------------
  720|  16.1k|                {
  721|  16.1k|                    WORD16 *pi2_level = pi2_y_coeff + (i << 4);
  722|  16.1k|                    UWORD8 *pu1_pred_sblk = pu1_rec_u
  723|  16.1k|                                    + ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR)
  ------------------
  |  |  556|  16.1k|#define BLK_SIZE             4
  ------------------
                                                  + ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR)
  ------------------
  |  |  119|  16.1k|#define YUV420SP_FACTOR 2
  ------------------
  724|  16.1k|                                    + (i >> 1) * (u4_recwidth_cr << 2);
  725|  16.1k|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  16.1k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
  726|  16.1k|                    {
  727|  16.1k|                        if(CHECKBIT(u2_chroma_csbp, i))
  ------------------
  |  |   54|  16.1k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 1.02k, False: 15.0k]
  |  |  ------------------
  ------------------
  728|  1.02k|                        {
  729|  1.02k|                            ps_dec->pf_iquant_itrans_recon_chroma_4x4(
  730|  1.02k|                                            pi2_level,
  731|  1.02k|                                            pu1_pred_sblk,
  732|  1.02k|                                            pu1_pred_sblk,
  733|  1.02k|                                            u4_recwidth_cr,
  734|  1.02k|                                            u4_recwidth_cr,
  735|  1.02k|                                            gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpc_rem6],
  736|  1.02k|                                            (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[4],
  737|  1.02k|                                            u4_scale_u, ai2_tmp, pi2_level);
  738|  1.02k|                        }
  739|  15.0k|                        else if(pi2_level[0] != 0)
  ------------------
  |  Branch (739:33): [True: 8.29k, False: 6.78k]
  ------------------
  740|  8.29k|                        {
  741|  8.29k|                            ps_dec->pf_iquant_itrans_recon_chroma_4x4_dc(
  742|  8.29k|                                            pi2_level,
  743|  8.29k|                                            pu1_pred_sblk,
  744|  8.29k|                                            pu1_pred_sblk,
  745|  8.29k|                                            u4_recwidth_cr,
  746|  8.29k|                                            u4_recwidth_cr,
  747|  8.29k|                                            gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpc_rem6],
  748|  8.29k|                                            (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[4],
  749|  8.29k|                                            u4_scale_u, ai2_tmp, pi2_level);
  750|  8.29k|                        }
  751|  16.1k|                    }
  752|  16.1k|                }
  753|  4.02k|            }
  754|       |
  755|  4.02k|            pi2_y_coeff += MB_CHROM_SIZE;
  ------------------
  |  |  564|  4.02k|#define MB_CHROM_SIZE                 64
  ------------------
  756|  4.02k|            u2_chroma_csbp >>= 4;
  757|       |
  758|  4.02k|            {
  759|  4.02k|                UWORD32 i;
  760|  4.02k|                WORD16 ai2_tmp[16];
  761|  20.1k|                for(i = 0; i < 4; i++)
  ------------------
  |  Branch (761:28): [True: 16.1k, False: 4.02k]
  ------------------
  762|  16.1k|                {
  763|  16.1k|                    WORD16 *pi2_level = pi2_y_coeff + (i << 4);
  764|  16.1k|                    UWORD8 *pu1_pred_sblk = pu1_rec_u + 1
  765|  16.1k|                                    + ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR)
  ------------------
  |  |  556|  16.1k|#define BLK_SIZE             4
  ------------------
                                                  + ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR)
  ------------------
  |  |  119|  16.1k|#define YUV420SP_FACTOR 2
  ------------------
  766|  16.1k|                                    + (i >> 1) * (u4_recwidth_cr << 2);
  767|  16.1k|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  16.1k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
  768|  16.1k|                    {
  769|  16.1k|                        if(CHECKBIT(u2_chroma_csbp, i))
  ------------------
  |  |   54|  16.1k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 1.24k, False: 14.8k]
  |  |  ------------------
  ------------------
  770|  1.24k|                        {
  771|  1.24k|                            ps_dec->pf_iquant_itrans_recon_chroma_4x4(
  772|  1.24k|                                            pi2_level,
  773|  1.24k|                                            pu1_pred_sblk,
  774|  1.24k|                                            pu1_pred_sblk,
  775|  1.24k|                                            u4_recwidth_cr,
  776|  1.24k|                                            u4_recwidth_cr,
  777|  1.24k|                                            gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpcr_rem6],
  778|  1.24k|                                            (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[5],
  779|  1.24k|                                            u4_scale_v, ai2_tmp, pi2_level);
  780|  1.24k|                        }
  781|  14.8k|                        else if(pi2_level[0] != 0)
  ------------------
  |  Branch (781:33): [True: 6.45k, False: 8.41k]
  ------------------
  782|  6.45k|                        {
  783|  6.45k|                            ps_dec->pf_iquant_itrans_recon_chroma_4x4_dc(
  784|  6.45k|                                            pi2_level,
  785|  6.45k|                                            pu1_pred_sblk,
  786|  6.45k|                                            pu1_pred_sblk,
  787|  6.45k|                                            u4_recwidth_cr,
  788|  6.45k|                                            u4_recwidth_cr,
  789|  6.45k|                                            gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpcr_rem6],
  790|  6.45k|                                            (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[5],
  791|  6.45k|                                            u4_scale_v, ai2_tmp, pi2_level);
  792|  6.45k|                        }
  793|  16.1k|                    }
  794|  16.1k|                }
  795|  4.02k|            }
  796|  4.02k|        }
  797|  20.5k|    }
  798|  20.5k|    return (0);
  799|  20.5k|}
ih264d_parse_pred_weight_table:
  815|  1.95k|{
  816|  1.95k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  817|  1.95k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  818|  1.95k|    WORD8 i, cont, lx;
  819|  1.95k|    UWORD8 uc_weight_flag;
  820|  1.95k|    UWORD32 *pui32_weight_offset_lx;
  821|  1.95k|    WORD16 c_weight, c_offset;
  822|  1.95k|    UWORD32 ui32_y_def_weight_ofst, ui32_cr_def_weight_ofst;
  823|  1.95k|    UWORD32 ui32_temp;
  824|  1.95k|    UWORD8 uc_luma_log2_weight_denom;
  825|  1.95k|    UWORD8 uc_chroma_log2_weight_denom;
  826|       |
  827|       |    /* Variables for error resilience checks */
  828|  1.95k|    UWORD32 u4_temp;
  829|  1.95k|    WORD32 i_temp;
  830|       |
  831|  1.95k|    u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  832|  1.95k|    if(u4_temp > MAX_LOG2_WEIGHT_DENOM)
  ------------------
  |  |  608|  1.95k|#define MAX_LOG2_WEIGHT_DENOM       7
  ------------------
  |  Branch (832:8): [True: 39, False: 1.91k]
  ------------------
  833|     39|    {
  834|     39|        return ERROR_PRED_WEIGHT_TABLE_T;
  835|     39|    }
  836|  1.91k|    uc_luma_log2_weight_denom = u4_temp;
  837|  1.91k|    COPYTHECONTEXT("SH: luma_log2_weight_denom",uc_luma_log2_weight_denom);
  838|  1.91k|    ui32_y_def_weight_ofst = (1 << uc_luma_log2_weight_denom);
  839|       |
  840|  1.91k|    u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  841|  1.91k|    if(u4_temp > MAX_LOG2_WEIGHT_DENOM)
  ------------------
  |  |  608|  1.91k|#define MAX_LOG2_WEIGHT_DENOM       7
  ------------------
  |  Branch (841:8): [True: 10, False: 1.90k]
  ------------------
  842|     10|    {
  843|     10|        return ERROR_PRED_WEIGHT_TABLE_T;
  844|     10|    }
  845|  1.90k|    uc_chroma_log2_weight_denom = u4_temp;
  846|  1.90k|    COPYTHECONTEXT("SH: chroma_log2_weight_denom",uc_chroma_log2_weight_denom);
  847|  1.90k|    ui32_cr_def_weight_ofst = (1 << uc_chroma_log2_weight_denom);
  848|       |
  849|  1.90k|    ps_cur_slice->u2_log2Y_crwd = uc_luma_log2_weight_denom
  850|  1.90k|                    | (uc_chroma_log2_weight_denom << 8);
  851|       |
  852|  1.90k|    cont = (ps_cur_slice->u1_slice_type == B_SLICE);
  ------------------
  |  |  369|  1.90k|#define B_SLICE  1
  ------------------
  853|  1.90k|    lx = 0;
  854|  1.90k|    do
  855|  1.91k|    {
  856|  3.76k|        for(i = 0; i < ps_cur_slice->u1_num_ref_idx_lx_active[lx]; i++)
  ------------------
  |  Branch (856:20): [True: 1.89k, False: 1.87k]
  ------------------
  857|  1.89k|        {
  858|  1.89k|            pui32_weight_offset_lx = ps_cur_slice->u4_wt_ofst_lx[lx][i];
  859|       |
  860|  1.89k|            uc_weight_flag = ih264d_get_bit_h264(ps_bitstrm);
  861|  1.89k|            pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  862|  1.89k|            COPYTHECONTEXT("SH: luma_weight_l0_flag",uc_weight_flag);
  863|  1.89k|            if(uc_weight_flag)
  ------------------
  |  Branch (863:16): [True: 499, False: 1.39k]
  ------------------
  864|    499|            {
  865|    499|                i_temp = ih264d_sev(pu4_bitstrm_ofst,
  866|    499|                                    pu4_bitstrm_buf);
  867|    499|                if((i_temp < PRED_WEIGHT_MIN) || (i_temp > PRED_WEIGHT_MAX))
  ------------------
  |  |  609|    499|#define PRED_WEIGHT_MIN             (-128)
  ------------------
                              if((i_temp < PRED_WEIGHT_MIN) || (i_temp > PRED_WEIGHT_MAX))
  ------------------
  |  |  610|    499|#define PRED_WEIGHT_MAX             127
  ------------------
  |  Branch (867:20): [True: 0, False: 499]
  |  Branch (867:50): [True: 14, False: 485]
  ------------------
  868|     14|                    return ERROR_PRED_WEIGHT_TABLE_T;
  869|    485|                c_weight = i_temp;
  870|    485|                COPYTHECONTEXT("SH: luma_weight_l0",c_weight);
  871|       |
  872|    485|                i_temp = ih264d_sev(pu4_bitstrm_ofst,
  873|    485|                                    pu4_bitstrm_buf);
  874|    485|                if((i_temp < PRED_WEIGHT_MIN) || (i_temp > PRED_WEIGHT_MAX))
  ------------------
  |  |  609|    485|#define PRED_WEIGHT_MIN             (-128)
  ------------------
                              if((i_temp < PRED_WEIGHT_MIN) || (i_temp > PRED_WEIGHT_MAX))
  ------------------
  |  |  610|    485|#define PRED_WEIGHT_MAX             127
  ------------------
  |  Branch (874:20): [True: 0, False: 485]
  |  Branch (874:50): [True: 0, False: 485]
  ------------------
  875|      0|                    return ERROR_PRED_WEIGHT_TABLE_T;
  876|    485|                c_offset = i_temp;
  877|    485|                COPYTHECONTEXT("SH: luma_offset_l0",c_offset);
  878|       |
  879|    485|                ui32_temp = (c_offset << 16) | (c_weight & 0xFFFF);
  880|    485|                pui32_weight_offset_lx[0] = ui32_temp;
  881|    485|            }
  882|  1.39k|            else
  883|  1.39k|            {
  884|       |
  885|  1.39k|                pui32_weight_offset_lx[0] = ui32_y_def_weight_ofst;
  886|  1.39k|            }
  887|       |
  888|  1.87k|            {
  889|  1.87k|                WORD8 c_weightCb, c_weightCr, c_offsetCb, c_offsetCr;
  890|  1.87k|                uc_weight_flag = ih264d_get_bit_h264(ps_bitstrm);
  891|  1.87k|                pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  892|  1.87k|                COPYTHECONTEXT("SH: chroma_weight_l0_flag",uc_weight_flag);
  893|  1.87k|                if(uc_weight_flag)
  ------------------
  |  Branch (893:20): [True: 969, False: 908]
  ------------------
  894|    969|                {
  895|    969|                    i_temp = ih264d_sev(pu4_bitstrm_ofst,
  896|    969|                                        pu4_bitstrm_buf);
  897|    969|                    if((i_temp < PRED_WEIGHT_MIN) || (i_temp > PRED_WEIGHT_MAX))
  ------------------
  |  |  609|    969|#define PRED_WEIGHT_MIN             (-128)
  ------------------
                                  if((i_temp < PRED_WEIGHT_MIN) || (i_temp > PRED_WEIGHT_MAX))
  ------------------
  |  |  610|    968|#define PRED_WEIGHT_MAX             127
  ------------------
  |  Branch (897:24): [True: 1, False: 968]
  |  Branch (897:54): [True: 0, False: 968]
  ------------------
  898|      1|                        return ERROR_PRED_WEIGHT_TABLE_T;
  899|    968|                    c_weightCb = i_temp;
  900|    968|                    COPYTHECONTEXT("SH: chroma_weight_l0",c_weightCb);
  901|       |
  902|    968|                    i_temp = ih264d_sev(pu4_bitstrm_ofst,
  903|    968|                                        pu4_bitstrm_buf);
  904|    968|                    if((i_temp < PRED_WEIGHT_MIN) || (i_temp > PRED_WEIGHT_MAX))
  ------------------
  |  |  609|    968|#define PRED_WEIGHT_MIN             (-128)
  ------------------
                                  if((i_temp < PRED_WEIGHT_MIN) || (i_temp > PRED_WEIGHT_MAX))
  ------------------
  |  |  610|    953|#define PRED_WEIGHT_MAX             127
  ------------------
  |  Branch (904:24): [True: 15, False: 953]
  |  Branch (904:54): [True: 5, False: 948]
  ------------------
  905|     20|                        return ERROR_PRED_WEIGHT_TABLE_T;
  906|    948|                    c_offsetCb = i_temp;
  907|    948|                    COPYTHECONTEXT("SH: chroma_weight_l0",c_offsetCb);
  908|       |
  909|    948|                    ui32_temp = (c_offsetCb << 16) | (c_weightCb & 0xFFFF);
  910|    948|                    pui32_weight_offset_lx[1] = ui32_temp;
  911|       |
  912|    948|                    i_temp = ih264d_sev(pu4_bitstrm_ofst,
  913|    948|                                        pu4_bitstrm_buf);
  914|    948|                    if((i_temp < PRED_WEIGHT_MIN) || (i_temp > PRED_WEIGHT_MAX))
  ------------------
  |  |  609|    948|#define PRED_WEIGHT_MIN             (-128)
  ------------------
                                  if((i_temp < PRED_WEIGHT_MIN) || (i_temp > PRED_WEIGHT_MAX))
  ------------------
  |  |  610|    948|#define PRED_WEIGHT_MAX             127
  ------------------
  |  Branch (914:24): [True: 0, False: 948]
  |  Branch (914:54): [True: 0, False: 948]
  ------------------
  915|      0|                        return ERROR_PRED_WEIGHT_TABLE_T;
  916|    948|                    c_weightCr = i_temp;
  917|    948|                    COPYTHECONTEXT("SH: chroma_weight_l0",c_weightCr);
  918|       |
  919|    948|                    i_temp = ih264d_sev(pu4_bitstrm_ofst,
  920|    948|                                        pu4_bitstrm_buf);
  921|    948|                    if((i_temp < PRED_WEIGHT_MIN) || (i_temp > PRED_WEIGHT_MAX))
  ------------------
  |  |  609|    948|#define PRED_WEIGHT_MIN             (-128)
  ------------------
                                  if((i_temp < PRED_WEIGHT_MIN) || (i_temp > PRED_WEIGHT_MAX))
  ------------------
  |  |  610|    948|#define PRED_WEIGHT_MAX             127
  ------------------
  |  Branch (921:24): [True: 0, False: 948]
  |  Branch (921:54): [True: 3, False: 945]
  ------------------
  922|      3|                        return ERROR_PRED_WEIGHT_TABLE_T;
  923|    945|                    c_offsetCr = i_temp;
  924|    945|                    COPYTHECONTEXT("SH: chroma_weight_l0",c_offsetCr);
  925|       |
  926|    945|                    ui32_temp = (c_offsetCr << 16) | (c_weightCr & 0xFFFF);
  927|    945|                    pui32_weight_offset_lx[2] = ui32_temp;
  928|    945|                }
  929|    908|                else
  930|    908|                {
  931|    908|                    pui32_weight_offset_lx[1] = ui32_cr_def_weight_ofst;
  932|    908|                    pui32_weight_offset_lx[2] = ui32_cr_def_weight_ofst;
  933|    908|                }
  934|  1.87k|            }
  935|  1.87k|        }
  936|  1.87k|        lx++;
  937|  1.87k|    }
  938|  1.90k|    while(cont--);
  ------------------
  |  Branch (938:11): [True: 6, False: 1.86k]
  ------------------
  939|       |
  940|  1.86k|    return OK;
  ------------------
  |  |  114|  1.86k|#define OK        0
  ------------------
  941|  1.90k|}
ih264d_init_ref_idx_lx_p:
  985|  2.30k|{
  986|  2.30k|    struct pic_buffer_t *ps_ref_pic_buf_lx;
  987|  2.30k|    dpb_manager_t *ps_dpb_mgr;
  988|  2.30k|    struct dpb_info_t *ps_next_dpb;
  989|  2.30k|    WORD8 i, j;
  990|  2.30k|    UWORD8 u1_max_lt_index, u1_min_lt_index;
  991|  2.30k|    UWORD32 u4_lt_index;
  992|  2.30k|    UWORD8 u1_field_pic_flag;
  993|  2.30k|    dec_slice_params_t *ps_cur_slice;
  994|  2.30k|    UWORD8 u1_L0;
  995|  2.30k|    WORD32 i4_cur_pic_num, i4_min_st_pic_num;
  996|  2.30k|    WORD32 i4_temp_pic_num, i4_ref_pic_num;
  997|  2.30k|    UWORD8 u1_num_short_term_bufs;
  998|  2.30k|    UWORD8 u1_max_ref_idx_l0;
  999|  2.30k|    struct pic_buffer_t *aps_st_pic_bufs[2 * MAX_REF_BUFS] = {NULL};
 1000|       |
 1001|  2.30k|    ps_cur_slice = ps_dec->ps_cur_slice;
 1002|  2.30k|    u1_field_pic_flag = ps_cur_slice->u1_field_pic_flag;
 1003|  2.30k|    u1_max_ref_idx_l0 = ps_cur_slice->u1_num_ref_idx_lx_active[0]
 1004|  2.30k|                    << u1_field_pic_flag;
 1005|       |
 1006|  2.30k|    ps_dpb_mgr = ps_dec->ps_dpb_mgr;
 1007|       |    /* Get the current frame number */
 1008|  2.30k|    i4_cur_pic_num = ps_dec->ps_cur_pic->i4_pic_num;
 1009|       |
 1010|       |    /* Get Min pic_num,MinLt */
 1011|  2.30k|    i4_min_st_pic_num = i4_cur_pic_num;
 1012|  2.30k|    u1_max_lt_index = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|  2.30k|#define MAX_REF_BUFS    32
  ------------------
 1013|  2.30k|    u1_min_lt_index = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|  2.30k|#define MAX_REF_BUFS    32
  ------------------
 1014|       |
 1015|       |    /* Start from ST head */
 1016|  2.30k|    ps_next_dpb = ps_dpb_mgr->ps_dpb_st_head;
 1017|  3.28k|    for(i = 0; i < ps_dpb_mgr->u1_num_st_ref_bufs; i++)
  ------------------
  |  Branch (1017:16): [True: 981, False: 2.30k]
  ------------------
 1018|    981|    {
 1019|    981|        i4_ref_pic_num = ps_next_dpb->ps_pic_buf->i4_pic_num;
 1020|    981|        if(i4_ref_pic_num < i4_cur_pic_num)
  ------------------
  |  Branch (1020:12): [True: 217, False: 764]
  ------------------
 1021|    217|        {
 1022|       |            /* RefPic Buf pic_num is before Current pic_num in decode order */
 1023|    217|            i4_min_st_pic_num = MIN(i4_min_st_pic_num, i4_ref_pic_num);
  ------------------
  |  |   61|    217|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 1, False: 216]
  |  |  ------------------
  ------------------
 1024|    217|        }
 1025|       |
 1026|       |        /* Chase the next link */
 1027|    981|        ps_next_dpb = ps_next_dpb->ps_prev_short;
 1028|    981|    }
 1029|       |
 1030|       |    /* Sort ST ref pocs in ascending order */
 1031|  2.30k|    ps_next_dpb = ps_dpb_mgr->ps_dpb_st_head;
 1032|  3.28k|    for (j = 0; j < ps_dpb_mgr->u1_num_st_ref_bufs; j++)
  ------------------
  |  Branch (1032:17): [True: 981, False: 2.30k]
  ------------------
 1033|    981|    {
 1034|    981|        aps_st_pic_bufs[j] = ps_next_dpb->ps_pic_buf;
 1035|    981|        ps_next_dpb = ps_next_dpb->ps_prev_short;
 1036|    981|    }
 1037|  2.30k|    qsort(aps_st_pic_bufs, ps_dpb_mgr->u1_num_st_ref_bufs,
 1038|  2.30k|        sizeof(aps_st_pic_bufs[0]), pic_num_compare);
 1039|       |
 1040|       |    /* Start from LT head */
 1041|  2.30k|    ps_next_dpb = ps_dpb_mgr->ps_dpb_ht_head;
 1042|  2.30k|    if(ps_next_dpb)
  ------------------
  |  Branch (1042:8): [True: 1.04k, False: 1.26k]
  ------------------
 1043|  1.04k|    {
 1044|  1.04k|        u1_max_lt_index = ps_next_dpb->u1_lt_idx;
 1045|  1.04k|        u1_min_lt_index = ps_next_dpb->u1_lt_idx;
 1046|       |
 1047|  2.09k|        for(i = 0; i < ps_dpb_mgr->u1_num_lt_ref_bufs; i++)
  ------------------
  |  Branch (1047:20): [True: 1.04k, False: 1.04k]
  ------------------
 1048|  1.04k|        {
 1049|  1.04k|            u4_lt_index = ps_next_dpb->u1_lt_idx;
 1050|  1.04k|            u1_max_lt_index = (UWORD8)(MAX(u1_max_lt_index, u4_lt_index));
  ------------------
  |  |   60|  1.04k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 1.04k]
  |  |  ------------------
  ------------------
 1051|  1.04k|            u1_min_lt_index = (UWORD8)(MIN(u1_min_lt_index, u4_lt_index));
  ------------------
  |  |   61|  1.04k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 3, False: 1.04k]
  |  |  ------------------
  ------------------
 1052|       |
 1053|       |            /* Chase the next link */
 1054|  1.04k|            ps_next_dpb = ps_next_dpb->ps_prev_long;
 1055|  1.04k|        }
 1056|  1.04k|    }
 1057|       |    /* 1. Initialize refIdxL0 */
 1058|  2.30k|    u1_L0 = 0;
 1059|  2.30k|    if(u1_field_pic_flag)
  ------------------
  |  Branch (1059:8): [True: 0, False: 2.30k]
  ------------------
 1060|      0|    {
 1061|      0|        ps_ref_pic_buf_lx = ps_dpb_mgr->ps_init_dpb[0][0];
 1062|      0|        ps_ref_pic_buf_lx += MAX_REF_BUFS;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
 1063|      0|        i4_temp_pic_num = i4_cur_pic_num;
 1064|      0|    }
 1065|  2.30k|    else
 1066|  2.30k|    {
 1067|  2.30k|        ps_ref_pic_buf_lx = ps_dpb_mgr->ps_init_dpb[0][0];
 1068|  2.30k|        i4_temp_pic_num = i4_cur_pic_num;
 1069|  2.30k|    }
 1070|       |    /* Arrange all short term buffers in output order as given by pic_num */
 1071|       |    /* Arrange pic_num's less than Curr pic_num in the descending pic_num */
 1072|       |    /* order starting from (Curr pic_num - 1)                             */
 1073|  3.28k|    for(j = ps_dpb_mgr->u1_num_st_ref_bufs - 1; j >= 0; j--)
  ------------------
  |  Branch (1073:49): [True: 981, False: 2.30k]
  ------------------
 1074|    981|    {
 1075|    981|        if(aps_st_pic_bufs[j])
  ------------------
  |  Branch (1075:12): [True: 981, False: 0]
  ------------------
 1076|    981|        {
 1077|       |            /* Copy info in pic buffer */
 1078|    981|            ih264d_insert_pic_in_ref_pic_listx(ps_ref_pic_buf_lx,
 1079|    981|                                               aps_st_pic_bufs[j]);
 1080|    981|            ps_ref_pic_buf_lx++;
 1081|    981|            u1_L0++;
 1082|    981|        }
 1083|    981|    }
 1084|       |
 1085|       |    /* Arrange all Long term buffers in ascending order, in LongtermIndex */
 1086|       |    /* Start from LT head */
 1087|  2.30k|    u1_num_short_term_bufs = u1_L0;
 1088|  4.63k|    for(u4_lt_index = u1_min_lt_index; u4_lt_index <= u1_max_lt_index;
  ------------------
  |  Branch (1088:40): [True: 2.32k, False: 2.30k]
  ------------------
 1089|  2.32k|                    u4_lt_index++)
 1090|  2.32k|    {
 1091|  2.32k|        ps_next_dpb = ps_dpb_mgr->ps_dpb_ht_head;
 1092|  2.37k|        for(i = 0; i < ps_dpb_mgr->u1_num_lt_ref_bufs; i++)
  ------------------
  |  Branch (1092:20): [True: 1.09k, False: 1.27k]
  ------------------
 1093|  1.09k|        {
 1094|  1.09k|            if(ps_next_dpb->u1_lt_idx == u4_lt_index)
  ------------------
  |  Branch (1094:16): [True: 1.04k, False: 46]
  ------------------
 1095|  1.04k|            {
 1096|  1.04k|                ih264d_insert_pic_in_ref_pic_listx(ps_ref_pic_buf_lx,
 1097|  1.04k|                                                   ps_next_dpb->ps_pic_buf);
 1098|       |
 1099|  1.04k|                ps_ref_pic_buf_lx->u1_long_term_pic_num =
 1100|  1.04k|                                ps_ref_pic_buf_lx->u1_long_term_frm_idx;
 1101|  1.04k|                ps_ref_pic_buf_lx++;
 1102|  1.04k|                u1_L0++;
 1103|  1.04k|                break;
 1104|  1.04k|            }
 1105|     46|            ps_next_dpb = ps_next_dpb->ps_prev_long;
 1106|     46|        }
 1107|  2.32k|    }
 1108|       |
 1109|  2.30k|    if(u1_field_pic_flag)
  ------------------
  |  Branch (1109:8): [True: 0, False: 2.30k]
  ------------------
 1110|      0|    {
 1111|       |        /* Initialize the rest of the entries in the */
 1112|       |        /* reference list to handle of errors        */
 1113|      0|        {
 1114|      0|            UWORD8 u1_i;
 1115|      0|            pic_buffer_t ref_pic;
 1116|       |
 1117|      0|            ref_pic = *(ps_dpb_mgr->ps_init_dpb[0][0] + MAX_REF_BUFS);
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
 1118|       |
 1119|      0|            if(NULL == ref_pic.pu1_buf1)
  ------------------
  |  Branch (1119:16): [True: 0, False: 0]
  ------------------
 1120|      0|            {
 1121|      0|                ref_pic = *ps_dec->ps_cur_pic;
 1122|      0|            }
 1123|      0|            for(u1_i = u1_L0; u1_i < u1_max_ref_idx_l0; u1_i++)
  ------------------
  |  Branch (1123:31): [True: 0, False: 0]
  ------------------
 1124|      0|            {
 1125|      0|                *ps_ref_pic_buf_lx = ref_pic;
 1126|      0|                ps_ref_pic_buf_lx++;
 1127|      0|            }
 1128|      0|        }
 1129|       |
 1130|      0|        ih264d_convert_frm_to_fld_list(
 1131|      0|                        ps_dpb_mgr->ps_init_dpb[0][0] + MAX_REF_BUFS, &u1_L0,
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
 1132|      0|                        ps_dec, u1_num_short_term_bufs);
 1133|       |
 1134|      0|        ps_ref_pic_buf_lx = ps_dpb_mgr->ps_init_dpb[0][0] + u1_L0;
 1135|      0|    }
 1136|       |
 1137|       |    /* Initialize the rest of the entries in the */
 1138|       |    /* reference list to handle of errors        */
 1139|  2.30k|    {
 1140|  2.30k|        UWORD8 u1_i;
 1141|  2.30k|        pic_buffer_t ref_pic;
 1142|       |
 1143|  2.30k|        ref_pic = *(ps_dpb_mgr->ps_init_dpb[0][0]);
 1144|       |
 1145|  2.30k|        if(NULL == ref_pic.pu1_buf1)
  ------------------
  |  Branch (1145:12): [True: 0, False: 2.30k]
  ------------------
 1146|      0|        {
 1147|      0|            ref_pic = *ps_dec->ps_cur_pic;
 1148|      0|        }
 1149|  4.88k|        for(u1_i = u1_L0; u1_i < u1_max_ref_idx_l0; u1_i++)
  ------------------
  |  Branch (1149:27): [True: 2.57k, False: 2.30k]
  ------------------
 1150|  2.57k|        {
 1151|  2.57k|            *ps_ref_pic_buf_lx = ref_pic;
 1152|  2.57k|            ps_ref_pic_buf_lx++;
 1153|  2.57k|        }
 1154|  2.30k|    }
 1155|  2.30k|    ps_dec->ps_cur_slice->u1_initial_list_size[0] = u1_L0;
 1156|  2.30k|}
ih264d_process_pslice.c:pic_num_compare:
  944|      3|{
  945|      3|    struct pic_buffer_t *ps_pic1 = *(struct pic_buffer_t **) pv_pic1;
  946|      3|    struct pic_buffer_t *ps_pic2 = *(struct pic_buffer_t **) pv_pic2;
  947|      3|    if (ps_pic1->i4_pic_num < ps_pic2->i4_pic_num)
  ------------------
  |  Branch (947:9): [True: 2, False: 1]
  ------------------
  948|      2|    {
  949|      2|        return -1;
  950|      2|    }
  951|      1|    else if (ps_pic1->i4_pic_num > ps_pic2->i4_pic_num)
  ------------------
  |  Branch (951:14): [True: 1, False: 0]
  ------------------
  952|      1|    {
  953|      1|        return 1;
  954|      1|    }
  955|      0|    else
  956|      0|    {
  957|      0|        return 0;
  958|      0|    }
  959|      3|}

ih264d_scaling_list:
   52|  4.62k|{
   53|  4.62k|    WORD32 i4_j, i4_delta_scale, i4_lastScale = 8, i4_nextScale = 8;
   54|  4.62k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
   55|  4.62k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
   56|       |
   57|  4.62k|    *pu1_use_default_scaling_matrix_flag = 0;
   58|       |
   59|   135k|    for(i4_j = 0; i4_j < i4_size_of_scalinglist; i4_j++)
  ------------------
  |  Branch (59:19): [True: 131k, False: 4.57k]
  ------------------
   60|   131k|    {
   61|   131k|        if(i4_nextScale != 0)
  ------------------
  |  Branch (61:12): [True: 49.7k, False: 81.2k]
  ------------------
   62|  49.7k|        {
   63|  49.7k|            i4_delta_scale = ih264d_sev(pu4_bitstrm_ofst,
   64|  49.7k|                                        pu4_bitstrm_buf);
   65|       |
   66|  49.7k|            if(i4_delta_scale < MIN_H264_DELTA_SCALE ||
  ------------------
  |  |  639|  99.4k|#define MIN_H264_DELTA_SCALE (-128)
  ------------------
  |  Branch (66:16): [True: 31, False: 49.6k]
  ------------------
   67|  49.6k|                        i4_delta_scale > MAX_H264_DELTA_SCALE)
  ------------------
  |  |  644|  49.6k|#define MAX_H264_DELTA_SCALE 127
  ------------------
  |  Branch (67:25): [True: 12, False: 49.6k]
  ------------------
   68|     43|            {
   69|     43|                return ERROR_INV_RANGE_QP_T;
   70|     43|            }
   71|  49.6k|            i4_nextScale = ((i4_lastScale + i4_delta_scale + 256) & 0xff);
   72|       |
   73|  49.6k|            *pu1_use_default_scaling_matrix_flag = ((i4_j == 0)
  ------------------
  |  Branch (73:53): [True: 4.62k, False: 45.0k]
  ------------------
   74|  4.62k|                            && (i4_nextScale == 0));
  ------------------
  |  Branch (74:32): [True: 2, False: 4.62k]
  ------------------
   75|       |
   76|  49.6k|        }
   77|   130k|        pi2_scaling_list[i4_j] =
   78|   130k|                        (i4_nextScale == 0) ? (i4_lastScale) : (i4_nextScale);
  ------------------
  |  Branch (78:25): [True: 85.4k, False: 45.5k]
  ------------------
   79|   130k|        i4_lastScale = pi2_scaling_list[i4_j];
   80|   130k|    }
   81|  4.57k|    return OK;
  ------------------
  |  |  114|  4.57k|#define OK        0
  ------------------
   82|  4.62k|}
ih264d_form_default_scaling_matrix:
   85|  3.07k|{
   86|       |
   87|       |    /*************************************************************************/
   88|       |    /* perform the inverse scanning for the frame and field scaling matrices */
   89|       |    /*************************************************************************/
   90|  3.07k|    {
   91|  3.07k|        UWORD8 *pu1_inv_scan;
   92|  3.07k|        WORD32 i4_i, i4_j;
   93|       |
   94|  3.07k|        pu1_inv_scan = (UWORD8 *)gau1_ih264d_inv_scan;
   95|       |
   96|       |        /* for all 4x4 matrices */
   97|  21.5k|        for(i4_i = 0; i4_i < 6; i4_i++)
  ------------------
  |  Branch (97:23): [True: 18.4k, False: 3.07k]
  ------------------
   98|  18.4k|        {
   99|   313k|            for(i4_j = 0; i4_j < 16; i4_j++)
  ------------------
  |  Branch (99:27): [True: 295k, False: 18.4k]
  ------------------
  100|   295k|            {
  101|   295k|                ps_dec->s_high_profile.i2_scalinglist4x4[i4_i][pu1_inv_scan[i4_j]] =
  102|   295k|                                16;
  103|       |
  104|   295k|            }
  105|  18.4k|        }
  106|       |
  107|       |        /* for all 8x8 matrices */
  108|  9.23k|        for(i4_i = 0; i4_i < 2; i4_i++)
  ------------------
  |  Branch (108:23): [True: 6.15k, False: 3.07k]
  ------------------
  109|  6.15k|        {
  110|   400k|            for(i4_j = 0; i4_j < 64; i4_j++)
  ------------------
  |  Branch (110:27): [True: 393k, False: 6.15k]
  ------------------
  111|   393k|            {
  112|   393k|                ps_dec->s_high_profile.i2_scalinglist8x8[i4_i][gau1_ih264d_inv_scan_prog8x8_cabac[i4_j]] =
  113|   393k|                                16;
  114|       |
  115|   393k|            }
  116|  6.15k|        }
  117|  3.07k|    }
  118|  3.07k|    return OK;
  ------------------
  |  |  114|  3.07k|#define OK        0
  ------------------
  119|  3.07k|}
ih264d_form_scaling_matrix_picture:
  124|  1.01k|{
  125|       |    /* default scaling matrices */
  126|  1.01k|    WORD32 i4_i;
  127|       |
  128|       |    /* check the SPS first */
  129|  1.01k|    if(ps_seq->i4_seq_scaling_matrix_present_flag)
  ------------------
  |  Branch (129:8): [True: 1.01k, False: 0]
  ------------------
  130|  1.01k|    {
  131|  9.12k|        for(i4_i = 0; i4_i < 8; i4_i++)
  ------------------
  |  Branch (131:23): [True: 8.11k, False: 1.01k]
  ------------------
  132|  8.11k|        {
  133|  8.11k|            if(i4_i < 6)
  ------------------
  |  Branch (133:16): [True: 6.08k, False: 2.02k]
  ------------------
  134|  6.08k|            {
  135|       |                /* fall-back rule A */
  136|  6.08k|                if(!ps_seq->u1_seq_scaling_list_present_flag[i4_i])
  ------------------
  |  Branch (136:20): [True: 1.92k, False: 4.16k]
  ------------------
  137|  1.92k|                {
  138|  1.92k|                    if((i4_i == 0) || (i4_i == 3))
  ------------------
  |  Branch (138:24): [True: 80, False: 1.84k]
  |  Branch (138:39): [True: 612, False: 1.22k]
  ------------------
  139|    692|                    {
  140|    692|                        ps_dec->s_high_profile.pi2_scale_mat[i4_i] =
  141|    692|                                        (i4_i == 0) ? (WORD16 *)(gai2_ih264d_default_intra4x4) : (WORD16 *)(gai2_ih264d_default_inter4x4);
  ------------------
  |  Branch (141:41): [True: 80, False: 612]
  ------------------
  142|    692|                    }
  143|  1.22k|                    else
  144|  1.22k|                    {
  145|  1.22k|                        ps_dec->s_high_profile.pi2_scale_mat[i4_i] =
  146|  1.22k|                                        ps_dec->s_high_profile.pi2_scale_mat[i4_i
  147|  1.22k|                                                        - 1];
  148|  1.22k|                    }
  149|  1.92k|                }
  150|  4.16k|                else
  151|  4.16k|                {
  152|  4.16k|                    if(ps_seq->u1_use_default_scaling_matrix_flag[i4_i])
  ------------------
  |  Branch (152:24): [True: 0, False: 4.16k]
  ------------------
  153|      0|                    {
  154|      0|                        ps_dec->s_high_profile.pi2_scale_mat[i4_i] =
  155|      0|                                        (i4_i < 3) ? (WORD16 *)(gai2_ih264d_default_intra4x4) : (WORD16 *)(gai2_ih264d_default_inter4x4);
  ------------------
  |  Branch (155:41): [True: 0, False: 0]
  ------------------
  156|      0|                    }
  157|  4.16k|                    else
  158|  4.16k|                    {
  159|  4.16k|                        ps_dec->s_high_profile.pi2_scale_mat[i4_i] =
  160|  4.16k|                                        ps_seq->i2_scalinglist4x4[i4_i];
  161|  4.16k|                    }
  162|  4.16k|                }
  163|       |
  164|  6.08k|            }
  165|  2.02k|            else
  166|  2.02k|            {
  167|       |                /* fall-back rule A */
  168|  2.02k|                if((!ps_seq->u1_seq_scaling_list_present_flag[i4_i])
  ------------------
  |  Branch (168:20): [True: 1.05k, False: 973]
  ------------------
  169|    973|                                || (ps_seq->u1_use_default_scaling_matrix_flag[i4_i]))
  ------------------
  |  Branch (169:36): [True: 0, False: 973]
  ------------------
  170|  1.05k|                {
  171|  1.05k|                    ps_dec->s_high_profile.pi2_scale_mat[i4_i] =
  172|  1.05k|                                    (i4_i == 6) ? ((WORD16*)gai2_ih264d_default_intra8x8) : ((WORD16*)gai2_ih264d_default_inter8x8);
  ------------------
  |  Branch (172:37): [True: 41, False: 1.01k]
  ------------------
  173|  1.05k|                }
  174|    973|                else
  175|    973|                {
  176|    973|                    ps_dec->s_high_profile.pi2_scale_mat[i4_i] =
  177|    973|                                    ps_seq->i2_scalinglist8x8[i4_i - 6];
  178|    973|                }
  179|  2.02k|            }
  180|  8.11k|        }
  181|  1.01k|    }
  182|       |
  183|       |    /* checking for the PPS */
  184|       |
  185|  1.01k|    if(ps_pic->i4_pic_scaling_matrix_present_flag)
  ------------------
  |  Branch (185:8): [True: 345, False: 669]
  ------------------
  186|    345|    {
  187|  3.10k|        for(i4_i = 0; i4_i < 8; i4_i++)
  ------------------
  |  Branch (187:23): [True: 2.76k, False: 345]
  ------------------
  188|  2.76k|        {
  189|  2.76k|            if(i4_i < 6)
  ------------------
  |  Branch (189:16): [True: 2.07k, False: 690]
  ------------------
  190|  2.07k|            {
  191|       |                /* fall back rule B */
  192|  2.07k|                if(!ps_pic->u1_pic_scaling_list_present_flag[i4_i])
  ------------------
  |  Branch (192:20): [True: 1.70k, False: 370]
  ------------------
  193|  1.70k|                {
  194|  1.70k|                    if((i4_i == 0) || (i4_i == 3))
  ------------------
  |  Branch (194:24): [True: 345, False: 1.35k]
  |  Branch (194:39): [True: 31, False: 1.32k]
  ------------------
  195|    376|                    {
  196|    376|                        if(!ps_seq->i4_seq_scaling_matrix_present_flag)
  ------------------
  |  Branch (196:28): [True: 0, False: 376]
  ------------------
  197|      0|                        {
  198|      0|                            ps_dec->s_high_profile.pi2_scale_mat[i4_i] =
  199|      0|                                            (i4_i == 0) ? (WORD16 *)(gai2_ih264d_default_intra4x4) : (WORD16 *)(gai2_ih264d_default_inter4x4);
  ------------------
  |  Branch (199:45): [True: 0, False: 0]
  ------------------
  200|      0|                        }
  201|    376|                    }
  202|  1.32k|                    else
  203|  1.32k|                    {
  204|  1.32k|                        ps_dec->s_high_profile.pi2_scale_mat[i4_i] =
  205|  1.32k|                                        ps_dec->s_high_profile.pi2_scale_mat[i4_i
  206|  1.32k|                                                        - 1];
  207|  1.32k|                    }
  208|  1.70k|                }
  209|    370|                else
  210|    370|                {
  211|    370|                    if(ps_pic->u1_pic_use_default_scaling_matrix_flag[i4_i])
  ------------------
  |  Branch (211:24): [True: 0, False: 370]
  ------------------
  212|      0|                    {
  213|      0|                        ps_dec->s_high_profile.pi2_scale_mat[i4_i] =
  214|      0|                                        (i4_i < 3) ? (WORD16 *)(gai2_ih264d_default_intra4x4) : (WORD16 *)(gai2_ih264d_default_inter4x4);
  ------------------
  |  Branch (214:41): [True: 0, False: 0]
  ------------------
  215|      0|                    }
  216|    370|                    else
  217|    370|                    {
  218|    370|                        ps_dec->s_high_profile.pi2_scale_mat[i4_i] =
  219|    370|                                        ps_pic->i2_pic_scalinglist4x4[i4_i];
  220|    370|                    }
  221|    370|                }
  222|  2.07k|            }
  223|    690|            else
  224|    690|            {
  225|    690|                if(!ps_pic->u1_pic_scaling_list_present_flag[i4_i])
  ------------------
  |  Branch (225:20): [True: 320, False: 370]
  ------------------
  226|    320|                {
  227|    320|                    if(!ps_seq->i4_seq_scaling_matrix_present_flag)
  ------------------
  |  Branch (227:24): [True: 0, False: 320]
  ------------------
  228|      0|                    {
  229|      0|                        ps_dec->s_high_profile.pi2_scale_mat[i4_i] =
  230|      0|                                        (i4_i == 6) ? ((WORD16*)gai2_ih264d_default_intra8x8) : ((WORD16*)gai2_ih264d_default_inter8x8);
  ------------------
  |  Branch (230:41): [True: 0, False: 0]
  ------------------
  231|      0|                    }
  232|    320|                }
  233|    370|                else
  234|    370|                {
  235|    370|                    if(ps_pic->u1_pic_use_default_scaling_matrix_flag[i4_i])
  ------------------
  |  Branch (235:24): [True: 0, False: 370]
  ------------------
  236|      0|                    {
  237|      0|                        ps_dec->s_high_profile.pi2_scale_mat[i4_i] =
  238|      0|                                        (i4_i == 6) ? (WORD16 *)(gai2_ih264d_default_intra8x8) : (WORD16 *)(gai2_ih264d_default_inter8x8);
  ------------------
  |  Branch (238:41): [True: 0, False: 0]
  ------------------
  239|      0|                    }
  240|    370|                    else
  241|    370|                    {
  242|    370|                        ps_dec->s_high_profile.pi2_scale_mat[i4_i] =
  243|    370|                                        ps_pic->i2_pic_scalinglist8x8[i4_i - 6];
  244|    370|                    }
  245|    370|                }
  246|    690|            }
  247|  2.76k|        }
  248|    345|    }
  249|       |
  250|       |    /*************************************************************************/
  251|       |    /* perform the inverse scanning for the frame and field scaling matrices */
  252|       |    /*************************************************************************/
  253|  1.01k|    {
  254|  1.01k|        UWORD8 *pu1_inv_scan_4x4;
  255|  1.01k|        WORD32 i4_i, i4_j;
  256|       |
  257|  1.01k|        pu1_inv_scan_4x4 = (UWORD8 *)gau1_ih264d_inv_scan;
  258|       |
  259|       |        /* for all 4x4 matrices */
  260|  7.09k|        for(i4_i = 0; i4_i < 6; i4_i++)
  ------------------
  |  Branch (260:23): [True: 6.08k, False: 1.01k]
  ------------------
  261|  6.08k|        {
  262|  6.08k|            if(ps_dec->s_high_profile.pi2_scale_mat[i4_i] == NULL)
  ------------------
  |  Branch (262:16): [True: 0, False: 6.08k]
  ------------------
  263|      0|                return ERROR_CORRUPTED_SLICE;
  264|       |
  265|   103k|            for(i4_j = 0; i4_j < 16; i4_j++)
  ------------------
  |  Branch (265:27): [True: 97.3k, False: 6.08k]
  ------------------
  266|  97.3k|            {
  267|  97.3k|                ps_dec->s_high_profile.i2_scalinglist4x4[i4_i][pu1_inv_scan_4x4[i4_j]] =
  268|  97.3k|                                ps_dec->s_high_profile.pi2_scale_mat[i4_i][i4_j];
  269|       |
  270|  97.3k|            }
  271|  6.08k|        }
  272|       |
  273|       |        /* for all 8x8 matrices */
  274|  3.04k|        for(i4_i = 0; i4_i < 2; i4_i++)
  ------------------
  |  Branch (274:23): [True: 2.02k, False: 1.01k]
  ------------------
  275|  2.02k|        {
  276|  2.02k|            if(ps_dec->s_high_profile.pi2_scale_mat[i4_i + 6] == NULL)
  ------------------
  |  Branch (276:16): [True: 0, False: 2.02k]
  ------------------
  277|      0|                return ERROR_CORRUPTED_SLICE;
  278|       |
  279|   131k|            for(i4_j = 0; i4_j < 64; i4_j++)
  ------------------
  |  Branch (279:27): [True: 129k, False: 2.02k]
  ------------------
  280|   129k|            {
  281|   129k|                ps_dec->s_high_profile.i2_scalinglist8x8[i4_i][gau1_ih264d_inv_scan_prog8x8_cabac[i4_j]] =
  282|   129k|                                ps_dec->s_high_profile.pi2_scale_mat[i4_i + 6][i4_j];
  283|       |
  284|   129k|            }
  285|  2.02k|        }
  286|  1.01k|    }
  287|  1.01k|    return OK;
  ------------------
  |  |  114|  1.01k|#define OK        0
  ------------------
  288|  1.01k|}

ih264d_parse_buffering_period:
   74|      1|{
   75|      1|    UWORD8 u1_seq_parameter_set_id;
   76|      1|    dec_seq_params_t *ps_seq;
   77|      1|    UWORD8 u1_nal_hrd_present, u1_vcl_hrd_present;
   78|      1|    UWORD32 i;
   79|      1|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
   80|      1|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
   81|      1|    UNUSED(ps_buf_prd);
  ------------------
  |  |   45|      1|#define UNUSED(x) ((void)(x))
  ------------------
   82|      1|    u1_seq_parameter_set_id = ih264d_uev(pu4_bitstrm_ofst,
   83|      1|                                         pu4_bitstrm_buf);
   84|      1|    if(u1_seq_parameter_set_id >= MAX_NUM_SEQ_PARAMS)
  ------------------
  |  |  521|      1|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
  |  Branch (84:8): [True: 0, False: 1]
  ------------------
   85|      0|        return ERROR_INVALID_SEQ_PARAM;
   86|      1|    ps_seq = &ps_dec->ps_sps[u1_seq_parameter_set_id];
   87|      1|    if(TRUE != ps_seq->u1_is_valid)
  ------------------
  |  |  591|      1|#define TRUE    1
  ------------------
  |  Branch (87:8): [True: 1, False: 0]
  ------------------
   88|      1|        return ERROR_INVALID_SEQ_PARAM;
   89|       |
   90|      0|    ps_dec->ps_sei->u1_seq_param_set_id = u1_seq_parameter_set_id;
   91|      0|    ps_dec->ps_cur_sps = ps_seq;
   92|      0|    if(FALSE == ps_seq->u1_is_valid)
  ------------------
  |  |  592|      0|#define FALSE   0
  ------------------
  |  Branch (92:8): [True: 0, False: 0]
  ------------------
   93|      0|        return ERROR_INVALID_SEQ_PARAM;
   94|      0|    if(1 == ps_seq->u1_vui_parameters_present_flag)
  ------------------
  |  Branch (94:8): [True: 0, False: 0]
  ------------------
   95|      0|    {
   96|      0|        u1_nal_hrd_present = ps_seq->s_vui.u1_nal_hrd_params_present;
   97|      0|        if(u1_nal_hrd_present)
  ------------------
  |  Branch (97:12): [True: 0, False: 0]
  ------------------
   98|      0|        {
   99|      0|            for(i = 0; i < ps_seq->s_vui.s_nal_hrd.u4_cpb_cnt; i++)
  ------------------
  |  Branch (99:24): [True: 0, False: 0]
  ------------------
  100|      0|            {
  101|      0|                ih264d_get_bits_h264(
  102|      0|                                ps_bitstrm,
  103|      0|                                ps_seq->s_vui.s_nal_hrd.u1_initial_cpb_removal_delay);
  104|      0|                ih264d_get_bits_h264(
  105|      0|                                ps_bitstrm,
  106|      0|                                ps_seq->s_vui.s_nal_hrd.u1_initial_cpb_removal_delay);
  107|      0|            }
  108|      0|        }
  109|       |
  110|      0|        u1_vcl_hrd_present = ps_seq->s_vui.u1_vcl_hrd_params_present;
  111|      0|        if(u1_vcl_hrd_present)
  ------------------
  |  Branch (111:12): [True: 0, False: 0]
  ------------------
  112|      0|        {
  113|      0|            for(i = 0; i < ps_seq->s_vui.s_vcl_hrd.u4_cpb_cnt; i++)
  ------------------
  |  Branch (113:24): [True: 0, False: 0]
  ------------------
  114|      0|            {
  115|      0|                ih264d_get_bits_h264(
  116|      0|                                ps_bitstrm,
  117|      0|                                ps_seq->s_vui.s_vcl_hrd.u1_initial_cpb_removal_delay);
  118|      0|                ih264d_get_bits_h264(
  119|      0|                                ps_bitstrm,
  120|      0|                                ps_seq->s_vui.s_vcl_hrd.u1_initial_cpb_removal_delay);
  121|      0|            }
  122|      0|        }
  123|      0|    }
  124|      0|    return (OK);
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  125|      0|}
ih264d_parse_recovery_point:
  235|     19|{
  236|     19|    sei *ps_sei = ps_dec->ps_sei;
  237|     19|    dec_err_status_t *ps_err = ps_dec->ps_dec_err_status;
  238|     19|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  239|     19|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  240|     19|    UNUSED(ui4_payload_size);
  ------------------
  |  |   45|     19|#define UNUSED(x) ((void)(x))
  ------------------
  241|     19|    ps_sei->u2_recovery_frame_cnt = ih264d_uev(pu4_bitstrm_ofst,
  242|     19|                                               pu4_bitstrm_buf);
  243|     19|    ps_err->u4_frm_sei_sync = ps_err->u4_cur_frm
  244|     19|                    + ps_sei->u2_recovery_frame_cnt;
  245|     19|    ps_sei->u1_exact_match_flag = ih264d_get_bit_h264(ps_bitstrm);
  246|     19|    ps_sei->u1_broken_link_flag = ih264d_get_bit_h264(ps_bitstrm);
  247|     19|    ps_sei->u1_changing_slice_grp_idc = ih264d_get_bits_h264(ps_bitstrm, 2);
  248|       |
  249|     19|    return (OK);
  ------------------
  |  |  114|     19|#define OK        0
  ------------------
  250|     19|}
ih264d_parse_mdcv:
  276|      1|{
  277|      1|    sei *ps_sei = ps_dec->ps_sei_parse;
  278|      1|    dec_err_status_t *ps_err = ps_dec->ps_dec_err_status;
  279|      1|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  280|      1|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  281|      1|    UWORD32 u4_count;
  282|      1|    UNUSED(ui4_payload_size);
  ------------------
  |  |   45|      1|#define UNUSED(x) ((void)(x))
  ------------------
  283|       |
  284|      1|    if((ps_dec == NULL) || (ps_sei == NULL))
  ------------------
  |  Branch (284:8): [True: 0, False: 1]
  |  Branch (284:28): [True: 0, False: 1]
  ------------------
  285|      0|    {
  286|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  287|      0|    }
  288|       |
  289|      1|    ps_sei->u1_sei_mdcv_params_present_flag = 1;
  290|       |
  291|       |    /* display primaries x */
  292|      2|    for(u4_count = 0; u4_count < NUM_SEI_MDCV_PRIMARIES; u4_count++)
  ------------------
  |  |   51|      2|#define NUM_SEI_MDCV_PRIMARIES        3
  ------------------
  |  Branch (292:23): [True: 2, False: 0]
  ------------------
  293|      2|    {
  294|      2|        ps_sei->s_sei_mdcv_params.au2_display_primaries_x[u4_count] =
  295|      2|                                    (UWORD16)ih264d_get_bits_h264(ps_bitstrm, 16);
  296|       |
  297|      2|        if((ps_sei->s_sei_mdcv_params.au2_display_primaries_x[u4_count] >
  ------------------
  |  Branch (297:12): [True: 0, False: 2]
  ------------------
  298|      2|                                                DISPLAY_PRIMARIES_X_UPPER_LIMIT) ||
  ------------------
  |  |  620|      2|#define DISPLAY_PRIMARIES_X_UPPER_LIMIT                37000
  ------------------
  299|      2|           (ps_sei->s_sei_mdcv_params.au2_display_primaries_x[u4_count] <
  ------------------
  |  Branch (299:12): [True: 0, False: 2]
  ------------------
  300|      2|                                                DISPLAY_PRIMARIES_X_LOWER_LIMIT) ||
  ------------------
  |  |  621|      2|#define DISPLAY_PRIMARIES_X_LOWER_LIMIT                5
  ------------------
  301|      2|           ((ps_sei->s_sei_mdcv_params.au2_display_primaries_x[u4_count] %
  ------------------
  |  Branch (301:12): [True: 0, False: 2]
  ------------------
  302|      2|                                               DISPLAY_PRIMARIES_X_DIVISION_FACTOR) != 0))
  ------------------
  |  |  622|      2|#define DISPLAY_PRIMARIES_X_DIVISION_FACTOR            5
  ------------------
  303|      0|        {
  304|      0|            ps_sei->u1_sei_mdcv_params_present_flag = 0;
  305|      0|            return ERROR_INV_SEI_MDCV_PARAMS;
  306|      0|        }
  307|       |
  308|      2|        ps_sei->s_sei_mdcv_params.au2_display_primaries_y[u4_count] =
  309|      2|                                    (UWORD16)ih264d_get_bits_h264(ps_bitstrm, 16);
  310|       |
  311|      2|        if((ps_sei->s_sei_mdcv_params.au2_display_primaries_y[u4_count] >
  ------------------
  |  Branch (311:12): [True: 1, False: 1]
  ------------------
  312|      2|                                                DISPLAY_PRIMARIES_Y_UPPER_LIMIT) ||
  ------------------
  |  |  624|      2|#define DISPLAY_PRIMARIES_Y_UPPER_LIMIT                42000
  ------------------
  313|      1|           (ps_sei->s_sei_mdcv_params.au2_display_primaries_y[u4_count] <
  ------------------
  |  Branch (313:12): [True: 0, False: 1]
  ------------------
  314|      1|                                               DISPLAY_PRIMARIES_Y_LOWER_LIMIT) ||
  ------------------
  |  |  625|      1|#define DISPLAY_PRIMARIES_Y_LOWER_LIMIT                5
  ------------------
  315|      1|           ((ps_sei->s_sei_mdcv_params.au2_display_primaries_y[u4_count] %
  ------------------
  |  Branch (315:12): [True: 0, False: 1]
  ------------------
  316|      1|                                              DISPLAY_PRIMARIES_Y_DIVISION_FACTOR) != 0))
  ------------------
  |  |  626|      1|#define DISPLAY_PRIMARIES_Y_DIVISION_FACTOR            5
  ------------------
  317|      1|        {
  318|      1|            ps_sei->u1_sei_mdcv_params_present_flag = 0;
  319|      1|            return ERROR_INV_SEI_MDCV_PARAMS;
  320|      1|        }
  321|      2|    }
  322|       |
  323|       |    /* white point x */
  324|      0|    ps_sei->s_sei_mdcv_params.u2_white_point_x = (UWORD16)ih264d_get_bits_h264(ps_bitstrm, 16);
  325|       |
  326|      0|    if((ps_sei->s_sei_mdcv_params.u2_white_point_x > WHITE_POINT_X_UPPER_LIMIT) ||
  ------------------
  |  |  628|      0|#define WHITE_POINT_X_UPPER_LIMIT                      37000
  ------------------
  |  Branch (326:8): [True: 0, False: 0]
  ------------------
  327|      0|       (ps_sei->s_sei_mdcv_params.u2_white_point_x < WHITE_POINT_X_LOWER_LIMIT) ||
  ------------------
  |  |  629|      0|#define WHITE_POINT_X_LOWER_LIMIT                      5
  ------------------
  |  Branch (327:8): [True: 0, False: 0]
  ------------------
  328|      0|       ((ps_sei->s_sei_mdcv_params.u2_white_point_x % WHITE_POINT_X_DIVISION_FACTOR) != 0))
  ------------------
  |  |  630|      0|#define WHITE_POINT_X_DIVISION_FACTOR                  5
  ------------------
  |  Branch (328:8): [True: 0, False: 0]
  ------------------
  329|      0|    {
  330|      0|        ps_sei->u1_sei_mdcv_params_present_flag = 0;
  331|      0|        return ERROR_INV_SEI_MDCV_PARAMS;
  332|      0|    }
  333|       |    /* white point y */
  334|      0|    ps_sei->s_sei_mdcv_params.u2_white_point_y = (UWORD16)ih264d_get_bits_h264(ps_bitstrm, 16);
  335|       |
  336|      0|    if((ps_sei->s_sei_mdcv_params.u2_white_point_y > WHITE_POINT_Y_UPPER_LIMIT) ||
  ------------------
  |  |  632|      0|#define WHITE_POINT_Y_UPPER_LIMIT                      42000
  ------------------
  |  Branch (336:8): [True: 0, False: 0]
  ------------------
  337|      0|       (ps_sei->s_sei_mdcv_params.u2_white_point_y < WHITE_POINT_Y_LOWER_LIMIT) ||
  ------------------
  |  |  633|      0|#define WHITE_POINT_Y_LOWER_LIMIT                      5
  ------------------
  |  Branch (337:8): [True: 0, False: 0]
  ------------------
  338|      0|       ((ps_sei->s_sei_mdcv_params.u2_white_point_y % WHITE_POINT_Y_DIVISION_FACTOR) != 0))
  ------------------
  |  |  634|      0|#define WHITE_POINT_Y_DIVISION_FACTOR                  5
  ------------------
  |  Branch (338:8): [True: 0, False: 0]
  ------------------
  339|      0|    {
  340|      0|        ps_sei->u1_sei_mdcv_params_present_flag = 0;
  341|      0|        return ERROR_INV_SEI_MDCV_PARAMS;
  342|      0|    }
  343|       |    /* max display mastering luminance */
  344|      0|    ps_sei->s_sei_mdcv_params.u4_max_display_mastering_luminance =
  345|      0|                                    (UWORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
  346|       |
  347|      0|    if((ps_sei->s_sei_mdcv_params.u4_max_display_mastering_luminance >
  ------------------
  |  Branch (347:8): [True: 0, False: 0]
  ------------------
  348|      0|                                            MAX_DISPLAY_MASTERING_LUMINANCE_UPPER_LIMIT) ||
  ------------------
  |  |  636|      0|#define MAX_DISPLAY_MASTERING_LUMINANCE_UPPER_LIMIT        100000000
  ------------------
  349|      0|       (ps_sei->s_sei_mdcv_params.u4_max_display_mastering_luminance <
  ------------------
  |  Branch (349:8): [True: 0, False: 0]
  ------------------
  350|      0|                                            MAX_DISPLAY_MASTERING_LUMINANCE_LOWER_LIMIT) ||
  ------------------
  |  |  637|      0|#define MAX_DISPLAY_MASTERING_LUMINANCE_LOWER_LIMIT        50000
  ------------------
  351|      0|       ((ps_sei->s_sei_mdcv_params.u4_max_display_mastering_luminance %
  ------------------
  |  Branch (351:8): [True: 0, False: 0]
  ------------------
  352|      0|                                        MAX_DISPLAY_MASTERING_LUMINANCE_DIVISION_FACTOR) != 0))
  ------------------
  |  |  638|      0|#define MAX_DISPLAY_MASTERING_LUMINANCE_DIVISION_FACTOR    10000
  ------------------
  353|      0|    {
  354|      0|        ps_sei->u1_sei_mdcv_params_present_flag = 0;
  355|      0|        return ERROR_INV_SEI_MDCV_PARAMS;
  356|      0|    }
  357|       |    /* min display mastering luminance */
  358|      0|    ps_sei->s_sei_mdcv_params.u4_min_display_mastering_luminance =
  359|      0|                                    (UWORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
  360|       |
  361|      0|    if((ps_sei->s_sei_mdcv_params.u4_min_display_mastering_luminance >
  ------------------
  |  Branch (361:8): [True: 0, False: 0]
  ------------------
  362|      0|                                            MIN_DISPLAY_MASTERING_LUMINANCE_UPPER_LIMIT) ||
  ------------------
  |  |  640|      0|#define MIN_DISPLAY_MASTERING_LUMINANCE_UPPER_LIMIT        50000
  ------------------
  363|      0|        (ps_sei->s_sei_mdcv_params.u4_min_display_mastering_luminance <
  ------------------
  |  Branch (363:9): [True: 0, False: 0]
  ------------------
  364|      0|                                            MIN_DISPLAY_MASTERING_LUMINANCE_LOWER_LIMIT))
  ------------------
  |  |  641|      0|#define MIN_DISPLAY_MASTERING_LUMINANCE_LOWER_LIMIT        1
  ------------------
  365|      0|    {
  366|      0|        ps_sei->u1_sei_mdcv_params_present_flag = 0;
  367|      0|        return ERROR_INV_SEI_MDCV_PARAMS;
  368|      0|    }
  369|      0|    if(ps_sei->s_sei_mdcv_params.u4_max_display_mastering_luminance <=
  ------------------
  |  Branch (369:8): [True: 0, False: 0]
  ------------------
  370|      0|            ps_sei->s_sei_mdcv_params.u4_min_display_mastering_luminance)
  371|      0|    {
  372|      0|        ps_sei->u1_sei_mdcv_params_present_flag = 0;
  373|      0|        return ERROR_INV_SEI_MDCV_PARAMS;
  374|      0|    }
  375|      0|    return (OK);
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  376|      0|}
ih264d_parse_ccv:
  510|  69.4k|{
  511|  69.4k|    sei *ps_sei = ps_dec->ps_sei_parse;
  512|  69.4k|    dec_err_status_t *ps_err = ps_dec->ps_dec_err_status;
  513|  69.4k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  514|  69.4k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  515|  69.4k|    UWORD32 u4_count;
  516|  69.4k|    UNUSED(ui4_payload_size);
  ------------------
  |  |   45|  69.4k|#define UNUSED(x) ((void)(x))
  ------------------
  517|       |
  518|  69.4k|    if((ps_dec == NULL) || (ps_sei == NULL))
  ------------------
  |  Branch (518:8): [True: 0, False: 69.4k]
  |  Branch (518:28): [True: 0, False: 69.4k]
  ------------------
  519|      0|    {
  520|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  521|      0|    }
  522|       |
  523|  69.4k|    ps_sei->u1_sei_ccv_params_present_flag = 0;
  524|       |
  525|  69.4k|    ps_sei->s_sei_ccv_params.u1_ccv_cancel_flag = (UWORD8)ih264d_get_bit_h264(ps_bitstrm);
  526|       |
  527|  69.4k|    if(ps_sei->s_sei_ccv_params.u1_ccv_cancel_flag > 1)
  ------------------
  |  Branch (527:8): [True: 0, False: 69.4k]
  ------------------
  528|      0|    {
  529|      0|        return ERROR_INV_SEI_CCV_PARAMS;
  530|      0|    }
  531|  69.4k|    if(0 == ps_sei->s_sei_ccv_params.u1_ccv_cancel_flag)
  ------------------
  |  Branch (531:8): [True: 4.44k, False: 65.0k]
  ------------------
  532|  4.44k|    {
  533|  4.44k|        ps_sei->s_sei_ccv_params.u1_ccv_persistence_flag =
  534|  4.44k|                                                (UWORD8)ih264d_get_bit_h264(ps_bitstrm);
  535|  4.44k|        if(ps_sei->s_sei_ccv_params.u1_ccv_persistence_flag > 1)
  ------------------
  |  Branch (535:12): [True: 0, False: 4.44k]
  ------------------
  536|      0|        {
  537|      0|            return ERROR_INV_SEI_CCV_PARAMS;
  538|      0|        }
  539|  4.44k|        ps_sei->s_sei_ccv_params.u1_ccv_primaries_present_flag =
  540|  4.44k|                                                (UWORD8)ih264d_get_bit_h264(ps_bitstrm);
  541|  4.44k|        if(ps_sei->s_sei_ccv_params.u1_ccv_primaries_present_flag > 1)
  ------------------
  |  Branch (541:12): [True: 0, False: 4.44k]
  ------------------
  542|      0|        {
  543|      0|            return ERROR_INV_SEI_CCV_PARAMS;
  544|      0|        }
  545|  4.44k|        ps_sei->s_sei_ccv_params.u1_ccv_min_luminance_value_present_flag =
  546|  4.44k|                                                (UWORD8)ih264d_get_bit_h264(ps_bitstrm);
  547|  4.44k|        if(ps_sei->s_sei_ccv_params.u1_ccv_min_luminance_value_present_flag > 1)
  ------------------
  |  Branch (547:12): [True: 0, False: 4.44k]
  ------------------
  548|      0|        {
  549|      0|            return ERROR_INV_SEI_CCV_PARAMS;
  550|      0|        }
  551|  4.44k|        ps_sei->s_sei_ccv_params.u1_ccv_max_luminance_value_present_flag =
  552|  4.44k|                                                (UWORD8)ih264d_get_bit_h264(ps_bitstrm);
  553|  4.44k|        if(ps_sei->s_sei_ccv_params.u1_ccv_max_luminance_value_present_flag > 1)
  ------------------
  |  Branch (553:12): [True: 0, False: 4.44k]
  ------------------
  554|      0|        {
  555|      0|            return ERROR_INV_SEI_CCV_PARAMS;
  556|      0|        }
  557|  4.44k|        ps_sei->s_sei_ccv_params.u1_ccv_avg_luminance_value_present_flag =
  558|  4.44k|                                                (UWORD8)ih264d_get_bit_h264(ps_bitstrm);
  559|  4.44k|        if(ps_sei->s_sei_ccv_params.u1_ccv_avg_luminance_value_present_flag > 1)
  ------------------
  |  Branch (559:12): [True: 0, False: 4.44k]
  ------------------
  560|      0|        {
  561|      0|            return ERROR_INV_SEI_CCV_PARAMS;
  562|      0|        }
  563|       |
  564|  4.44k|        if((ps_sei->s_sei_ccv_params.u1_ccv_primaries_present_flag == 0) &&
  ------------------
  |  Branch (564:12): [True: 4.44k, False: 4]
  ------------------
  565|  4.44k|           (ps_sei->s_sei_ccv_params.u1_ccv_min_luminance_value_present_flag == 0) &&
  ------------------
  |  Branch (565:12): [True: 0, False: 4.44k]
  ------------------
  566|      0|           (ps_sei->s_sei_ccv_params.u1_ccv_max_luminance_value_present_flag == 0) &&
  ------------------
  |  Branch (566:12): [True: 0, False: 0]
  ------------------
  567|      0|           (ps_sei->s_sei_ccv_params.u1_ccv_avg_luminance_value_present_flag == 0))
  ------------------
  |  Branch (567:12): [True: 0, False: 0]
  ------------------
  568|      0|        {
  569|      0|            return ERROR_INV_SEI_CCV_PARAMS;
  570|      0|	 }
  571|       |
  572|  4.44k|        ps_sei->s_sei_ccv_params.u1_ccv_reserved_zero_2bits =
  573|  4.44k|                                                (UWORD8)ih264d_get_bits_h264(ps_bitstrm, 2);
  574|  4.44k|        if((ps_sei->s_sei_ccv_params.u1_ccv_reserved_zero_2bits != 0))
  ------------------
  |  Branch (574:12): [True: 0, False: 4.44k]
  ------------------
  575|      0|        {
  576|      0|            return ERROR_INV_SEI_CCV_PARAMS;
  577|      0|        }
  578|       |
  579|       |        /* ccv primaries */
  580|  4.44k|        if(1 == ps_sei->s_sei_ccv_params.u1_ccv_primaries_present_flag)
  ------------------
  |  Branch (580:12): [True: 4, False: 4.44k]
  ------------------
  581|      4|        {
  582|      6|            for(u4_count = 0; u4_count < NUM_SEI_CCV_PRIMARIES; u4_count++)
  ------------------
  |  |   56|      6|#define NUM_SEI_CCV_PRIMARIES         3
  ------------------
  |  Branch (582:31): [True: 6, False: 0]
  ------------------
  583|      6|            {
  584|      6|                ps_sei->s_sei_ccv_params.ai4_ccv_primaries_x[u4_count] =
  585|      6|                                                (WORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
  586|      6|                if((ps_sei->s_sei_ccv_params.ai4_ccv_primaries_x[u4_count] >
  ------------------
  |  Branch (586:20): [True: 0, False: 6]
  ------------------
  587|      6|                                                        CCV_PRIMARIES_X_UPPER_LIMIT) ||
  ------------------
  |  |  646|      6|#define CCV_PRIMARIES_X_UPPER_LIMIT        5000000
  ------------------
  588|      6|                   (ps_sei->s_sei_ccv_params.ai4_ccv_primaries_x[u4_count] <
  ------------------
  |  Branch (588:20): [True: 2, False: 4]
  ------------------
  589|      6|                                                        CCV_PRIMARIES_X_LOWER_LIMIT))
  ------------------
  |  |  647|      6|#define CCV_PRIMARIES_X_LOWER_LIMIT        -5000000
  ------------------
  590|      2|                {
  591|      2|                    return ERROR_INV_SEI_CCV_PARAMS;
  592|      2|                }
  593|       |
  594|      4|                ps_sei->s_sei_ccv_params.ai4_ccv_primaries_y[u4_count] =
  595|      4|                                                (WORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
  596|      4|                if((ps_sei->s_sei_ccv_params.ai4_ccv_primaries_y[u4_count] >
  ------------------
  |  Branch (596:20): [True: 0, False: 4]
  ------------------
  597|      4|                                                        CCV_PRIMARIES_Y_UPPER_LIMIT) ||
  ------------------
  |  |  648|      4|#define CCV_PRIMARIES_Y_UPPER_LIMIT        5000000
  ------------------
  598|      4|                   (ps_sei->s_sei_ccv_params.ai4_ccv_primaries_y[u4_count] <
  ------------------
  |  Branch (598:20): [True: 2, False: 2]
  ------------------
  599|      4|                                                        CCV_PRIMARIES_Y_LOWER_LIMIT))
  ------------------
  |  |  649|      4|#define CCV_PRIMARIES_Y_LOWER_LIMIT        -5000000
  ------------------
  600|      2|                {
  601|      2|                    return ERROR_INV_SEI_CCV_PARAMS;
  602|      2|                }
  603|      4|            }
  604|      4|        }
  605|       |
  606|  4.44k|        if(1 == ps_sei->s_sei_ccv_params.u1_ccv_min_luminance_value_present_flag)
  ------------------
  |  Branch (606:12): [True: 4.44k, False: 0]
  ------------------
  607|  4.44k|        {
  608|  4.44k|            ps_sei->s_sei_ccv_params.u4_ccv_min_luminance_value =
  609|  4.44k|                                                (UWORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
  610|  4.44k|        }
  611|       |
  612|  4.44k|        if(1 == ps_sei->s_sei_ccv_params.u1_ccv_max_luminance_value_present_flag)
  ------------------
  |  Branch (612:12): [True: 4.44k, False: 0]
  ------------------
  613|  4.44k|        {
  614|  4.44k|            ps_sei->s_sei_ccv_params.u4_ccv_max_luminance_value =
  615|  4.44k|                                                (UWORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
  616|  4.44k|            if((1 == ps_sei->s_sei_ccv_params.u1_ccv_min_luminance_value_present_flag) &&
  ------------------
  |  Branch (616:16): [True: 4.44k, False: 0]
  ------------------
  617|  4.44k|                (ps_sei->s_sei_ccv_params.u4_ccv_max_luminance_value <
  ------------------
  |  Branch (617:17): [True: 20, False: 4.42k]
  ------------------
  618|  4.44k|                                                ps_sei->s_sei_ccv_params.u4_ccv_min_luminance_value))
  619|     20|            {
  620|     20|                return ERROR_INV_SEI_CCV_PARAMS;
  621|     20|            }
  622|  4.44k|        }
  623|  4.42k|        if(1 == ps_sei->s_sei_ccv_params.u1_ccv_avg_luminance_value_present_flag)
  ------------------
  |  Branch (623:12): [True: 5, False: 4.41k]
  ------------------
  624|      5|        {
  625|      5|            ps_sei->s_sei_ccv_params.u4_ccv_avg_luminance_value =
  626|      5|                                                (UWORD32)ih264d_get_bits_h264(ps_bitstrm, 32);
  627|      5|            if((1 == ps_sei->s_sei_ccv_params.u1_ccv_min_luminance_value_present_flag) &&
  ------------------
  |  Branch (627:16): [True: 5, False: 0]
  ------------------
  628|      5|                (ps_sei->s_sei_ccv_params.u4_ccv_avg_luminance_value <
  ------------------
  |  Branch (628:17): [True: 0, False: 5]
  ------------------
  629|      5|                                                ps_sei->s_sei_ccv_params.u4_ccv_min_luminance_value))
  630|      0|            {
  631|      0|                return ERROR_INV_SEI_CCV_PARAMS;
  632|      0|            }
  633|      5|            if((1 == ps_sei->s_sei_ccv_params.u1_ccv_max_luminance_value_present_flag) &&
  ------------------
  |  Branch (633:16): [True: 5, False: 0]
  ------------------
  634|      5|                (ps_sei->s_sei_ccv_params.u4_ccv_max_luminance_value <
  ------------------
  |  Branch (634:17): [True: 0, False: 5]
  ------------------
  635|      5|                                                ps_sei->s_sei_ccv_params.u4_ccv_avg_luminance_value))
  636|      0|            {
  637|      0|                return ERROR_INV_SEI_CCV_PARAMS;
  638|      0|            }
  639|      5|        }
  640|  4.42k|    }
  641|  69.4k|    ps_sei->u1_sei_ccv_params_present_flag = 1;
  642|  69.4k|    return (OK);
  ------------------
  |  |  114|  69.4k|#define OK        0
  ------------------
  643|  69.4k|}
ih264d_parse_sii:
  668|  1.17k|{
  669|  1.17k|    sei *ps_sei;
  670|  1.17k|    dec_err_status_t *ps_err;
  671|  1.17k|    int i;
  672|  1.17k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  673|  1.17k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  674|  1.17k|    UNUSED(ui4_payload_size);
  ------------------
  |  |   45|  1.17k|#define UNUSED(x) ((void)(x))
  ------------------
  675|       |
  676|  1.17k|    if(ps_dec == NULL)
  ------------------
  |  Branch (676:8): [True: 0, False: 1.17k]
  ------------------
  677|      0|    {
  678|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  679|      0|    }
  680|  1.17k|    ps_sei = ps_dec->ps_sei_parse;
  681|       |
  682|  1.17k|    if(ps_sei == NULL)
  ------------------
  |  Branch (682:8): [True: 0, False: 1.17k]
  ------------------
  683|      0|    {
  684|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  685|      0|    }
  686|  1.17k|    ps_err = ps_dec->ps_dec_err_status;
  687|       |
  688|  1.17k|    ps_sei->u1_sei_sii_params_present_flag = 0;
  689|  1.17k|    memset(&ps_sei->s_sei_sii_params, 0, sizeof(ps_sei->s_sei_sii_params));
  690|       |
  691|  1.17k|    ps_sei->s_sei_sii_params.u4_sii_sub_layer_idx = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  692|       |
  693|  1.17k|    if(0 == ps_sei->s_sei_sii_params.u4_sii_sub_layer_idx)
  ------------------
  |  Branch (693:8): [True: 1.17k, False: 2]
  ------------------
  694|  1.17k|    {
  695|  1.17k|        ps_sei->s_sei_sii_params.u1_shutter_interval_info_present_flag =
  696|  1.17k|            (UWORD8) ih264d_get_bit_h264(ps_bitstrm);
  697|       |
  698|  1.17k|        if(1 == ps_sei->s_sei_sii_params.u1_shutter_interval_info_present_flag)
  ------------------
  |  Branch (698:12): [True: 0, False: 1.17k]
  ------------------
  699|      0|        {
  700|      0|            ps_sei->s_sei_sii_params.u4_sii_time_scale =
  701|      0|                (UWORD32) ih264d_get_bits_h264(ps_bitstrm, 32);
  702|       |
  703|      0|            ps_sei->s_sei_sii_params.u1_fixed_shutter_interval_within_cvs_flag =
  704|      0|                (UWORD8) ih264d_get_bit_h264(ps_bitstrm);
  705|       |
  706|      0|            if(1 == ps_sei->s_sei_sii_params.u1_fixed_shutter_interval_within_cvs_flag)
  ------------------
  |  Branch (706:16): [True: 0, False: 0]
  ------------------
  707|      0|            {
  708|      0|                ps_sei->s_sei_sii_params.u4_sii_num_units_in_shutter_interval =
  709|      0|                    (UWORD32) ih264d_get_bits_h264(ps_bitstrm, 32);
  710|      0|            }
  711|      0|            else
  712|      0|            {
  713|      0|                ps_sei->s_sei_sii_params.u1_sii_max_sub_layers_minus1 =
  714|      0|                    (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 3);
  715|      0|                for(i = 0; i <= ps_sei->s_sei_sii_params.u1_sii_max_sub_layers_minus1; i++)
  ------------------
  |  Branch (715:28): [True: 0, False: 0]
  ------------------
  716|      0|                {
  717|      0|                    ps_sei->s_sei_sii_params.au4_sub_layer_num_units_in_shutter_interval[i] =
  718|      0|                        (UWORD32) ih264d_get_bits_h264(ps_bitstrm, 32);
  719|      0|                }
  720|      0|            }
  721|      0|        }
  722|  1.17k|    }
  723|       |
  724|  1.17k|    if((ps_sei->s_sei_sii_params.u4_sii_sub_layer_idx >
  ------------------
  |  Branch (724:8): [True: 2, False: 1.17k]
  ------------------
  725|  1.17k|        ps_sei->s_sei_sii_params.u1_sii_max_sub_layers_minus1) &&
  726|      2|       (ps_sei->s_sei_sii_params.u1_fixed_shutter_interval_within_cvs_flag == 0))
  ------------------
  |  Branch (726:8): [True: 2, False: 0]
  ------------------
  727|      2|    {
  728|      2|        return ERROR_INV_SEI_SII_PARAMS;
  729|      2|    }
  730|       |
  731|  1.17k|    ps_sei->u1_sei_sii_params_present_flag = 1;
  732|  1.17k|    return (OK);
  ------------------
  |  |  114|  1.17k|#define OK        0
  ------------------
  733|  1.17k|}
ih264d_parse_fgc:
  758|      1|{
  759|      1|    sei *ps_sei = ps_dec->ps_sei_parse;
  760|      1|    dec_err_status_t *ps_err = ps_dec->ps_dec_err_status;
  761|      1|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  762|      1|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  763|      1|    UWORD32 u4_count;
  764|      1|    WORD32 i4_luma_bitdepth, i4_chroma_bitdepth;
  765|      1|    UWORD32 c, i, j;
  766|      1|    UNUSED(ui4_payload_size);
  ------------------
  |  |   45|      1|#define UNUSED(x) ((void)(x))
  ------------------
  767|       |
  768|      1|    if((ps_dec == NULL) || (ps_sei == NULL))
  ------------------
  |  Branch (768:8): [True: 0, False: 1]
  |  Branch (768:28): [True: 0, False: 1]
  ------------------
  769|      0|    {
  770|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  771|      0|    }
  772|       |
  773|      1|    ps_sei->u1_sei_fgc_params_present_flag = 0;
  774|       |
  775|      1|    ps_sei->s_sei_fgc_params.u1_film_grain_characteristics_cancel_flag =
  776|      1|        (UWORD8) ih264d_get_bit_h264(ps_bitstrm);
  777|       |
  778|      1|    if(0 == ps_sei->s_sei_fgc_params.u1_film_grain_characteristics_cancel_flag)
  ------------------
  |  Branch (778:8): [True: 1, False: 0]
  ------------------
  779|      1|    {
  780|      1|        ps_sei->s_sei_fgc_params.u1_film_grain_model_id =
  781|      1|            (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 2);
  782|      1|        if(ps_sei->s_sei_fgc_params.u1_film_grain_model_id > 1)
  ------------------
  |  Branch (782:12): [True: 0, False: 1]
  ------------------
  783|      0|        {
  784|      0|            return ERROR_INV_SEI_FGC_PARAMS;
  785|      0|        }
  786|      1|        ps_sei->s_sei_fgc_params.u1_separate_colour_description_present_flag =
  787|      1|            (UWORD8) ih264d_get_bit_h264(ps_bitstrm);
  788|       |
  789|      1|        if(ps_sei->s_sei_fgc_params.u1_separate_colour_description_present_flag)
  ------------------
  |  Branch (789:12): [True: 1, False: 0]
  ------------------
  790|      1|        {
  791|      1|            ps_sei->s_sei_fgc_params.u1_film_grain_bit_depth_luma_minus8 =
  792|      1|                (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 3);
  793|       |
  794|      1|            i4_luma_bitdepth = ps_sei->s_sei_fgc_params.u1_film_grain_bit_depth_luma_minus8 + 8;
  795|       |
  796|      1|            ps_sei->s_sei_fgc_params.u1_film_grain_bit_depth_chroma_minus8 =
  797|      1|                (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 3);
  798|       |
  799|      1|            i4_chroma_bitdepth = ps_sei->s_sei_fgc_params.u1_film_grain_bit_depth_chroma_minus8 + 8;
  800|       |
  801|      1|            ps_sei->s_sei_fgc_params.u1_film_grain_full_range_flag =
  802|      1|                (UWORD8) ih264d_get_bit_h264(ps_bitstrm);
  803|       |
  804|      1|            ps_sei->s_sei_fgc_params.u1_film_grain_colour_primaries =
  805|      1|                (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 8);
  806|       |
  807|      1|            ps_sei->s_sei_fgc_params.u1_film_grain_transfer_characteristics =
  808|      1|                (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 8);
  809|       |
  810|      1|            ps_sei->s_sei_fgc_params.u1_film_grain_matrix_coefficients =
  811|      1|                (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 8);
  812|      1|        }
  813|      0|        else
  814|      0|        {
  815|      0|            if(ps_dec->ps_cur_sps == NULL)
  ------------------
  |  Branch (815:16): [True: 0, False: 0]
  ------------------
  816|      0|            {
  817|      0|                return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  818|      0|            }
  819|      0|            i4_luma_bitdepth = ps_dec->ps_cur_sps->i4_bit_depth_luma_minus8 + 8;
  820|      0|            i4_chroma_bitdepth = ps_dec->ps_cur_sps->i4_bit_depth_chroma_minus8 + 8;
  821|      0|        }
  822|      1|        ps_sei->s_sei_fgc_params.u1_blending_mode_id = (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 2);
  823|       |
  824|      1|        if(ps_sei->s_sei_fgc_params.u1_blending_mode_id > 1)
  ------------------
  |  Branch (824:12): [True: 0, False: 1]
  ------------------
  825|      0|        {
  826|      0|            return ERROR_INV_SEI_FGC_PARAMS;
  827|      0|        }
  828|       |
  829|      1|        ps_sei->s_sei_fgc_params.u1_log2_scale_factor =
  830|      1|            (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 4);
  831|       |
  832|      4|        for(c = 0; c < SEI_FGC_NUM_COLOUR_COMPONENTS; c++)
  ------------------
  |  |   63|      4|#define SEI_FGC_NUM_COLOUR_COMPONENTS 3
  ------------------
  |  Branch (832:20): [True: 3, False: 1]
  ------------------
  833|      3|        {
  834|      3|            ps_sei->s_sei_fgc_params.au1_comp_model_present_flag[c] =
  835|      3|                (UWORD8) ih264d_get_bit_h264(ps_bitstrm);
  836|      3|        }
  837|       |
  838|      4|        for(c = 0; c < SEI_FGC_NUM_COLOUR_COMPONENTS; c++)
  ------------------
  |  |   63|      4|#define SEI_FGC_NUM_COLOUR_COMPONENTS 3
  ------------------
  |  Branch (838:20): [True: 3, False: 1]
  ------------------
  839|      3|        {
  840|      3|            if(ps_sei->s_sei_fgc_params.au1_comp_model_present_flag[c])
  ------------------
  |  Branch (840:16): [True: 3, False: 0]
  ------------------
  841|      3|            {
  842|      3|                ps_sei->s_sei_fgc_params.au1_num_intensity_intervals_minus1[c] =
  843|      3|                    (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 8);
  844|       |
  845|      3|                ps_sei->s_sei_fgc_params.au1_num_model_values_minus1[c] =
  846|      3|                    (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 3);
  847|       |
  848|      3|                if(ps_sei->s_sei_fgc_params.au1_num_model_values_minus1[c] >
  ------------------
  |  Branch (848:20): [True: 0, False: 3]
  ------------------
  849|      3|                   (SEI_FGC_MAX_NUM_MODEL_VALUES - 1))
  ------------------
  |  |   64|      3|#define SEI_FGC_MAX_NUM_MODEL_VALUES 6
  ------------------
  850|      0|                {
  851|      0|                    return ERROR_INV_SEI_FGC_PARAMS;
  852|      0|                }
  853|       |
  854|    439|                for(i = 0; i <= ps_sei->s_sei_fgc_params.au1_num_intensity_intervals_minus1[c]; i++)
  ------------------
  |  Branch (854:28): [True: 436, False: 3]
  ------------------
  855|    436|                {
  856|       |                    /* Although the fag end of both the NALU and the bitstream buffer */
  857|       |                    /* is being parsed, not all FGC SEI symbols would have been */
  858|       |                    /* decoded semantically. The code below detects this condition */
  859|    436|                    if((ps_bitstrm->u4_ofst + 8 + 8) >= ps_bitstrm->u4_max_ofst)
  ------------------
  |  Branch (859:24): [True: 0, False: 436]
  ------------------
  860|      0|                    {
  861|      0|                        return ERROR_INV_SEI_FGC_PARAMS;
  862|      0|                    }
  863|       |
  864|    436|                    ps_sei->s_sei_fgc_params.au1_intensity_interval_lower_bound[c][i] =
  865|    436|                        (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 8);
  866|       |
  867|    436|                    ps_sei->s_sei_fgc_params.au1_intensity_interval_upper_bound[c][i] =
  868|    436|                        (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 8);
  869|       |
  870|  2.45k|                    for(j = 0; j <= ps_sei->s_sei_fgc_params.au1_num_model_values_minus1[c]; j++)
  ------------------
  |  Branch (870:32): [True: 2.02k, False: 436]
  ------------------
  871|  2.02k|                    {
  872|  2.02k|                        ps_sei->s_sei_fgc_params.ai4_comp_model_value[c][i][j] =
  873|  2.02k|                            (WORD32) ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  874|  2.02k|                        if(0 == ps_sei->s_sei_fgc_params.u1_film_grain_model_id)
  ------------------
  |  Branch (874:28): [True: 0, False: 2.02k]
  ------------------
  875|      0|                        {
  876|      0|                            if((1 == j) || (2 == j))
  ------------------
  |  Branch (876:32): [True: 0, False: 0]
  |  Branch (876:44): [True: 0, False: 0]
  ------------------
  877|      0|                            {
  878|      0|                                if((ps_sei->s_sei_fgc_params.ai4_comp_model_value[c][i][j] < 0) ||
  ------------------
  |  Branch (878:36): [True: 0, False: 0]
  ------------------
  879|      0|                                   (ps_sei->s_sei_fgc_params.ai4_comp_model_value[c][i][j] > 16))
  ------------------
  |  Branch (879:36): [True: 0, False: 0]
  ------------------
  880|      0|                                    return ERROR_INV_SEI_FGC_PARAMS;
  881|      0|                            }
  882|      0|                            else if((3 == j) || (4 == j))
  ------------------
  |  Branch (882:37): [True: 0, False: 0]
  |  Branch (882:49): [True: 0, False: 0]
  ------------------
  883|      0|                            {
  884|      0|                                if((ps_sei->s_sei_fgc_params.ai4_comp_model_value[c][i][j] < 0) ||
  ------------------
  |  Branch (884:36): [True: 0, False: 0]
  ------------------
  885|      0|                                   (ps_sei->s_sei_fgc_params.ai4_comp_model_value[c][i][j] >
  ------------------
  |  Branch (885:36): [True: 0, False: 0]
  ------------------
  886|      0|                                    ps_sei->s_sei_fgc_params.ai4_comp_model_value[c][i][j - 2]))
  887|      0|                                    return ERROR_INV_SEI_FGC_PARAMS;
  888|      0|                            }
  889|      0|                            else
  890|      0|                            {
  891|      0|                                WORD32 max_lim = (c == 0) ? (1 << i4_luma_bitdepth) - 1
  ------------------
  |  Branch (891:50): [True: 0, False: 0]
  ------------------
  892|      0|                                                          : (1 << i4_chroma_bitdepth) - 1;
  893|       |
  894|      0|                                if((ps_sei->s_sei_fgc_params.ai4_comp_model_value[c][i][j] < 0) ||
  ------------------
  |  Branch (894:36): [True: 0, False: 0]
  ------------------
  895|      0|                                   (ps_sei->s_sei_fgc_params.ai4_comp_model_value[c][i][j] >
  ------------------
  |  Branch (895:36): [True: 0, False: 0]
  ------------------
  896|      0|                                    max_lim))
  897|      0|                                {
  898|      0|                                    return ERROR_INV_SEI_FGC_PARAMS;
  899|      0|                                }
  900|      0|                            }
  901|      0|                        }
  902|  2.02k|                        else
  903|  2.02k|                        {
  904|  2.02k|                            WORD32 max_lim = (c == 0) ? (1 << (i4_luma_bitdepth - 1))
  ------------------
  |  Branch (904:46): [True: 402, False: 1.61k]
  ------------------
  905|  2.02k|                                                      : (1 << (i4_chroma_bitdepth - 1));
  906|       |
  907|  2.02k|                            if((ps_sei->s_sei_fgc_params.ai4_comp_model_value[c][i][j] <
  ------------------
  |  Branch (907:32): [True: 0, False: 2.02k]
  ------------------
  908|  2.02k|                                -max_lim) ||
  909|  2.02k|                               (ps_sei->s_sei_fgc_params.ai4_comp_model_value[c][i][j] >= max_lim))
  ------------------
  |  Branch (909:32): [True: 0, False: 2.02k]
  ------------------
  910|      0|                            {
  911|      0|                                return ERROR_INV_SEI_FGC_PARAMS;
  912|      0|                            }
  913|  2.02k|                        }
  914|  2.02k|                    }
  915|    436|                }
  916|      3|            }
  917|      3|        }
  918|       |
  919|      1|        ps_sei->s_sei_fgc_params.u4_film_grain_characteristics_repetition_period =
  920|      1|            (UWORD32) ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  921|       |
  922|      1|        if(ps_sei->s_sei_fgc_params.u4_film_grain_characteristics_repetition_period < 0 ||
  ------------------
  |  Branch (922:12): [True: 0, False: 1]
  ------------------
  923|      1|           ps_sei->s_sei_fgc_params.u4_film_grain_characteristics_repetition_period > 16384)
  ------------------
  |  Branch (923:12): [True: 0, False: 1]
  ------------------
  924|      0|        {
  925|      0|            return ERROR_INV_SEI_FGC_PARAMS;
  926|      0|        }
  927|       |
  928|      1|        ps_sei->u1_sei_fgc_params_present_flag = 1;
  929|      1|    }
  930|       |
  931|      1|    return (OK);
  ------------------
  |  |  114|      1|#define OK        0
  ------------------
  932|      1|}
ih264d_parse_sei_payload:
  961|  73.1k|{
  962|  73.1k|    sei *ps_sei;
  963|  73.1k|    WORD32 i4_status = 0;
  964|  73.1k|    ps_sei = (sei *)ps_dec->ps_sei_parse;
  965|       |
  966|  73.1k|    if(ui4_payload_size == 0)
  ------------------
  |  Branch (966:8): [True: 17, False: 73.0k]
  ------------------
  967|     17|        return -1;
  968|  73.0k|    if(NULL == ps_bitstrm)
  ------------------
  |  Branch (968:8): [True: 0, False: 73.0k]
  ------------------
  969|      0|    {
  970|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  971|      0|    }
  972|       |
  973|  73.0k|    switch(ui4_payload_type)
  974|  73.0k|    {
  975|      1|        case SEI_BUF_PERIOD:
  ------------------
  |  |   48|      1|#define SEI_BUF_PERIOD      0
  ------------------
  |  Branch (975:9): [True: 1, False: 73.0k]
  ------------------
  976|       |
  977|      1|            i4_status = ih264d_parse_buffering_period(&ps_sei->s_buf_period,
  978|      1|                                                      ps_bitstrm, ps_dec);
  979|      1|            break;
  980|      0|        case SEI_PIC_TIMING:
  ------------------
  |  |   49|      0|#define SEI_PIC_TIMING      1
  ------------------
  |  Branch (980:9): [True: 0, False: 73.0k]
  ------------------
  981|      0|            if(NULL == ps_dec->ps_cur_sps)
  ------------------
  |  Branch (981:16): [True: 0, False: 0]
  ------------------
  982|      0|                i4_status = ih264d_flush_bits_h264(ps_bitstrm, (ui4_payload_size << 3));
  983|      0|            else
  984|      0|                i4_status = ih264d_parse_pic_timing(ps_bitstrm, ps_dec,
  985|      0|                                        ui4_payload_size);
  986|      0|            break;
  987|     19|        case SEI_RECOVERY_PT:
  ------------------
  |  |   54|     19|#define SEI_RECOVERY_PT     6
  ------------------
  |  Branch (987:9): [True: 19, False: 73.0k]
  ------------------
  988|     19|            i4_status = ih264d_parse_recovery_point(ps_bitstrm, ps_dec,
  989|     19|                                        ui4_payload_size);
  990|     19|            break;
  991|      1|        case SEI_MASTERING_DISP_COL_VOL:
  ------------------
  |  |   68|      1|#define SEI_MASTERING_DISP_COL_VOL       137
  ------------------
  |  Branch (991:9): [True: 1, False: 73.0k]
  ------------------
  992|       |
  993|      1|            i4_status = ih264d_parse_mdcv(ps_bitstrm, ps_dec,
  994|      1|                                          ui4_payload_size);
  995|      1|            break;
  996|      0|        case SEI_CONTENT_LIGHT_LEVEL_DATA:
  ------------------
  |  |   69|      0|#define SEI_CONTENT_LIGHT_LEVEL_DATA     144
  ------------------
  |  Branch (996:9): [True: 0, False: 73.0k]
  ------------------
  997|       |
  998|      0|            i4_status = ih264d_parse_cll(ps_bitstrm, ps_dec,
  999|      0|                                         ui4_payload_size);
 1000|      0|            break;
 1001|      0|        case SEI_AMBIENT_VIEWING_ENVIRONMENT:
  ------------------
  |  |   70|      0|#define SEI_AMBIENT_VIEWING_ENVIRONMENT  148
  ------------------
  |  Branch (1001:9): [True: 0, False: 73.0k]
  ------------------
 1002|       |
 1003|      0|            i4_status = ih264d_parse_ave(ps_bitstrm, ps_dec,
 1004|      0|                                         ui4_payload_size);
 1005|      0|            break;
 1006|  69.4k|        case SEI_CONTENT_COLOR_VOLUME:
  ------------------
  |  |   71|  69.4k|#define SEI_CONTENT_COLOR_VOLUME         149
  ------------------
  |  Branch (1006:9): [True: 69.4k, False: 3.61k]
  ------------------
 1007|       |
 1008|  69.4k|            i4_status = ih264d_parse_ccv(ps_bitstrm, ps_dec,
 1009|  69.4k|                                         ui4_payload_size);
 1010|  69.4k|            break;
 1011|  1.17k|        case SEI_SHUTTER_INTERVAL_INFO:
  ------------------
  |  |   72|  1.17k|#define SEI_SHUTTER_INTERVAL_INFO        205
  ------------------
  |  Branch (1011:9): [True: 1.17k, False: 71.9k]
  ------------------
 1012|       |
 1013|  1.17k|            i4_status = ih264d_parse_sii(ps_bitstrm, ps_dec, ui4_payload_size);
 1014|  1.17k|            break;
 1015|       |
 1016|      1|        case SEI_FILM_GRAIN_CHARACTERISTICS:
  ------------------
  |  |   67|      1|#define SEI_FILM_GRAIN_CHARACTERISTICS 19
  ------------------
  |  Branch (1016:9): [True: 1, False: 73.0k]
  ------------------
 1017|      1|            i4_status = ih264d_parse_fgc(ps_bitstrm, ps_dec, ui4_payload_size);
 1018|       |
 1019|      1|            break;
 1020|  2.41k|        default:
  ------------------
  |  Branch (1020:9): [True: 2.41k, False: 70.6k]
  ------------------
 1021|  2.41k|            i4_status = ih264d_flush_bits_h264(ps_bitstrm, (ui4_payload_size << 3));
 1022|  2.41k|            break;
 1023|  73.0k|    }
 1024|  73.0k|    return (i4_status);
 1025|  73.0k|}
ih264d_parse_sei_message:
 1051|    117|{
 1052|    117|    UWORD32 ui4_payload_type, ui4_payload_size;
 1053|    117|    UWORD32 u4_bits;
 1054|    117|    WORD32 i4_status = 0;
 1055|       |
 1056|    117|    do
 1057|  73.1k|    {
 1058|  73.1k|        ui4_payload_type = 0;
 1059|       |
 1060|  73.1k|        if(!CHECK_BITS_SUFFICIENT(ps_bitstrm, 8))
  ------------------
  |  |   95|  73.1k|  (ps_bitstrm->u4_ofst + bits_to_read <= ps_bitstrm->u4_max_ofst)
  ------------------
  |  Branch (1060:12): [True: 4, False: 73.1k]
  ------------------
 1061|      4|        {
 1062|      4|            return ERROR_EOB_GETBITS_T;
 1063|      4|        }
 1064|  73.1k|        u4_bits = ih264d_get_bits_h264(ps_bitstrm, 8);
 1065|  73.2k|        while(0xff == u4_bits && CHECK_BITS_SUFFICIENT(ps_bitstrm, 8))
  ------------------
  |  |   95|    105|  (ps_bitstrm->u4_ofst + bits_to_read <= ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (95:3): [True: 105, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1065:15): [True: 105, False: 73.1k]
  ------------------
 1066|    105|        {
 1067|    105|            u4_bits = ih264d_get_bits_h264(ps_bitstrm, 8);
 1068|    105|            ui4_payload_type += 255;
 1069|    105|        }
 1070|  73.1k|        ui4_payload_type += u4_bits;
 1071|       |
 1072|  73.1k|        ui4_payload_size = 0;
 1073|  73.1k|        if(!CHECK_BITS_SUFFICIENT(ps_bitstrm, 8))
  ------------------
  |  |   95|  73.1k|  (ps_bitstrm->u4_ofst + bits_to_read <= ps_bitstrm->u4_max_ofst)
  ------------------
  |  Branch (1073:12): [True: 9, False: 73.1k]
  ------------------
 1074|      9|        {
 1075|      9|            return ERROR_EOB_GETBITS_T;
 1076|      9|        }
 1077|  73.1k|        u4_bits = ih264d_get_bits_h264(ps_bitstrm, 8);
 1078|  73.2k|        while(0xff == u4_bits && CHECK_BITS_SUFFICIENT(ps_bitstrm, 8))
  ------------------
  |  |   95|     99|  (ps_bitstrm->u4_ofst + bits_to_read <= ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (95:3): [True: 92, False: 7]
  |  |  ------------------
  ------------------
  |  Branch (1078:15): [True: 99, False: 73.1k]
  ------------------
 1079|     92|        {
 1080|     92|            u4_bits = ih264d_get_bits_h264(ps_bitstrm, 8);
 1081|     92|            ui4_payload_size += 255;
 1082|     92|        }
 1083|  73.1k|        ui4_payload_size += u4_bits;
 1084|       |
 1085|  73.1k|        if(!CHECK_BITS_SUFFICIENT(ps_bitstrm, (ui4_payload_size << 3)))
  ------------------
  |  |   95|  73.1k|  (ps_bitstrm->u4_ofst + bits_to_read <= ps_bitstrm->u4_max_ofst)
  ------------------
  |  Branch (1085:12): [True: 59, False: 73.1k]
  ------------------
 1086|     59|        {
 1087|     59|            return ERROR_EOB_GETBITS_T;
 1088|     59|        }
 1089|  73.1k|        i4_status = ih264d_parse_sei_payload(ps_bitstrm, ui4_payload_type,
 1090|  73.1k|                                             ui4_payload_size, ps_dec);
 1091|  73.1k|        if(i4_status != OK)
  ------------------
  |  |  114|  73.1k|#define OK        0
  ------------------
  |  Branch (1091:12): [True: 45, False: 73.0k]
  ------------------
 1092|     45|            return i4_status;
 1093|       |
 1094|  73.0k|        if(ih264d_check_byte_aligned(ps_bitstrm) == 0)
  ------------------
  |  Branch (1094:12): [True: 66.2k, False: 6.83k]
  ------------------
 1095|  66.2k|        {
 1096|  66.2k|            u4_bits = ih264d_get_bit_h264(ps_bitstrm);
 1097|  66.2k|            if(0 == u4_bits)
  ------------------
  |  Branch (1097:16): [True: 66.2k, False: 11]
  ------------------
 1098|  66.2k|            {
 1099|  66.2k|                H264_DEC_DEBUG_PRINT("\nError in parsing SEI message");
  ------------------
  |  |   39|  66.2k|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
 1100|  66.2k|            }
 1101|   462k|            while(0 == ih264d_check_byte_aligned(ps_bitstrm)
  ------------------
  |  Branch (1101:19): [True: 396k, False: 66.2k]
  ------------------
 1102|   396k|                            && CHECK_BITS_SUFFICIENT(ps_bitstrm, 1))
  ------------------
  |  |   95|   396k|  (ps_bitstrm->u4_ofst + bits_to_read <= ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (95:3): [True: 396k, False: 0]
  |  |  ------------------
  ------------------
 1103|   396k|            {
 1104|   396k|                u4_bits = ih264d_get_bit_h264(ps_bitstrm);
 1105|   396k|                if(u4_bits)
  ------------------
  |  Branch (1105:20): [True: 198k, False: 197k]
  ------------------
 1106|   198k|                {
 1107|   198k|                    H264_DEC_DEBUG_PRINT("\nError in parsing SEI message");
  ------------------
  |  |   39|   198k|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
 1108|   198k|                }
 1109|   396k|            }
 1110|  66.2k|        }
 1111|  73.0k|    }
 1112|    117|    while(MORE_RBSP_DATA(ps_bitstrm));
  ------------------
  |  |   97|  73.0k|    CHECK_BITS_SUFFICIENT(ps_bitstrm, 1)
  |  |  ------------------
  |  |  |  |   95|  73.0k|  (ps_bitstrm->u4_ofst + bits_to_read <= ps_bitstrm->u4_max_ofst)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (95:3): [True: 73.0k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1113|      0|    return (i4_status);
 1114|    117|}
ih264d_export_sei_mdcv_params:
 1137|  6.11k|{
 1138|  6.11k|    if((ps_sei_export == NULL) || (ps_sei == NULL))
  ------------------
  |  Branch (1138:8): [True: 0, False: 6.11k]
  |  Branch (1138:35): [True: 2.52k, False: 3.58k]
  ------------------
 1139|  2.52k|    {
 1140|  2.52k|        return NOT_OK;
  ------------------
  |  |  116|  2.52k|#define NOT_OK    -1
  ------------------
 1141|  2.52k|    }
 1142|       |
 1143|  3.58k|    ps_sei_export->u1_sei_mdcv_params_present_flag = ps_sei->u1_sei_mdcv_params_present_flag;
 1144|  3.58k|    ps_sei_decode_op->u1_sei_mdcv_params_present_flag = ps_sei->u1_sei_mdcv_params_present_flag;
 1145|       |
 1146|  3.58k|    if(0 == ps_sei_export->u1_sei_mdcv_params_present_flag)
  ------------------
  |  Branch (1146:8): [True: 3.58k, False: 0]
  ------------------
 1147|  3.58k|    {
 1148|  3.58k|        memset(&ps_sei_export->s_sei_mdcv_params, 0, sizeof(sei_mdcv_params_t));
 1149|  3.58k|    }
 1150|      0|    else
 1151|      0|    {
 1152|      0|        memcpy(&ps_sei_export->s_sei_mdcv_params, &ps_sei->s_sei_mdcv_params,
 1153|      0|                                                    sizeof(sei_mdcv_params_t));
 1154|      0|    }
 1155|       |
 1156|  3.58k|    return (OK);
  ------------------
  |  |  114|  3.58k|#define OK        0
  ------------------
 1157|  6.11k|}
ih264d_export_sei_cll_params:
 1180|  6.11k|{
 1181|  6.11k|    if((ps_sei_export == NULL) || (ps_sei == NULL))
  ------------------
  |  Branch (1181:8): [True: 0, False: 6.11k]
  |  Branch (1181:35): [True: 2.52k, False: 3.58k]
  ------------------
 1182|  2.52k|    {
 1183|  2.52k|        return NOT_OK;
  ------------------
  |  |  116|  2.52k|#define NOT_OK    -1
  ------------------
 1184|  2.52k|    }
 1185|       |
 1186|  3.58k|    ps_sei_export->u1_sei_cll_params_present_flag = ps_sei->u1_sei_cll_params_present_flag;
 1187|  3.58k|    ps_sei_decode_op->u1_sei_cll_params_present_flag = ps_sei->u1_sei_cll_params_present_flag;
 1188|       |
 1189|  3.58k|    if(0 == ps_sei_export->u1_sei_cll_params_present_flag)
  ------------------
  |  Branch (1189:8): [True: 3.58k, False: 0]
  ------------------
 1190|  3.58k|    {
 1191|  3.58k|        memset(&ps_sei_export->s_sei_cll_params, 0, sizeof(sei_cll_params_t));
 1192|  3.58k|    }
 1193|      0|    else
 1194|      0|    {
 1195|      0|        memcpy(&ps_sei_export->s_sei_cll_params, &ps_sei->s_sei_cll_params,
 1196|      0|                                                    sizeof(sei_cll_params_t));
 1197|      0|    }
 1198|  3.58k|    return (OK);
  ------------------
  |  |  114|  3.58k|#define OK        0
  ------------------
 1199|  6.11k|}
ih264d_export_sei_ave_params:
 1222|  6.11k|{
 1223|  6.11k|    if((ps_sei_export == NULL) || (ps_sei == NULL))
  ------------------
  |  Branch (1223:8): [True: 0, False: 6.11k]
  |  Branch (1223:35): [True: 2.52k, False: 3.58k]
  ------------------
 1224|  2.52k|    {
 1225|  2.52k|        return NOT_OK;
  ------------------
  |  |  116|  2.52k|#define NOT_OK    -1
  ------------------
 1226|  2.52k|    }
 1227|       |
 1228|  3.58k|    ps_sei_export->u1_sei_ave_params_present_flag = ps_sei->u1_sei_ave_params_present_flag;
 1229|  3.58k|    ps_sei_decode_op->u1_sei_ave_params_present_flag = ps_sei->u1_sei_ave_params_present_flag;
 1230|       |
 1231|  3.58k|    if(0 == ps_sei_export->u1_sei_ave_params_present_flag)
  ------------------
  |  Branch (1231:8): [True: 3.58k, False: 0]
  ------------------
 1232|  3.58k|    {
 1233|  3.58k|        memset(&ps_sei_export->s_sei_ave_params, 0, sizeof(sei_ave_params_t));
 1234|  3.58k|    }
 1235|      0|    else
 1236|      0|    {
 1237|      0|        memcpy(&ps_sei_export->s_sei_ave_params, &ps_sei->s_sei_ave_params,
 1238|      0|                                                    sizeof(sei_ave_params_t));
 1239|      0|    }
 1240|       |
 1241|  3.58k|    return (OK);
  ------------------
  |  |  114|  3.58k|#define OK        0
  ------------------
 1242|  6.11k|}
ih264d_export_sei_ccv_params:
 1265|  6.11k|{
 1266|  6.11k|    if((ps_sei_export == NULL) || (ps_sei == NULL))
  ------------------
  |  Branch (1266:8): [True: 0, False: 6.11k]
  |  Branch (1266:35): [True: 2.52k, False: 3.58k]
  ------------------
 1267|  2.52k|    {
 1268|  2.52k|        return NOT_OK;
  ------------------
  |  |  116|  2.52k|#define NOT_OK    -1
  ------------------
 1269|  2.52k|    }
 1270|       |
 1271|  3.58k|    ps_sei_export->u1_sei_ccv_params_present_flag = ps_sei->u1_sei_ccv_params_present_flag;
 1272|  3.58k|    ps_sei_decode_op->u1_sei_ccv_params_present_flag = ps_sei->u1_sei_ccv_params_present_flag;
 1273|       |
 1274|  3.58k|    if(0 == ps_sei_export->u1_sei_ccv_params_present_flag)
  ------------------
  |  Branch (1274:8): [True: 3.55k, False: 32]
  ------------------
 1275|  3.55k|    {
 1276|  3.55k|        memset(&ps_sei_export->s_sei_ccv_params, 0, sizeof(sei_ccv_params_t));
 1277|  3.55k|    }
 1278|     32|    else
 1279|     32|    {
 1280|     32|        memcpy(&ps_sei_export->s_sei_ccv_params, &ps_sei->s_sei_ccv_params,
 1281|     32|                                                    sizeof(sei_ccv_params_t));
 1282|     32|    }
 1283|  3.58k|    return (OK);
  ------------------
  |  |  114|  3.58k|#define OK        0
  ------------------
 1284|  6.11k|}
ih264d_export_sei_sii_params:
 1307|  6.11k|{
 1308|  6.11k|    if((ps_sei_export == NULL) || (ps_sei == NULL))
  ------------------
  |  Branch (1308:8): [True: 0, False: 6.11k]
  |  Branch (1308:35): [True: 2.52k, False: 3.58k]
  ------------------
 1309|  2.52k|    {
 1310|  2.52k|        return NOT_OK;
  ------------------
  |  |  116|  2.52k|#define NOT_OK    -1
  ------------------
 1311|  2.52k|    }
 1312|       |
 1313|  3.58k|    ps_sei_export->u1_sei_sii_params_present_flag = ps_sei->u1_sei_sii_params_present_flag;
 1314|  3.58k|    ps_sei_decode_op->u1_sei_sii_params_present_flag = ps_sei->u1_sei_sii_params_present_flag;
 1315|       |
 1316|  3.58k|    if(0 == ps_sei_export->u1_sei_sii_params_present_flag)
  ------------------
  |  Branch (1316:8): [True: 3.58k, False: 0]
  ------------------
 1317|  3.58k|    {
 1318|  3.58k|        memset(&ps_sei_export->s_sei_sii_params, 0, sizeof(sei_sii_params_t));
 1319|  3.58k|    }
 1320|      0|    else
 1321|      0|    {
 1322|      0|        memcpy(&ps_sei_export->s_sei_sii_params, &ps_sei->s_sei_sii_params,
 1323|      0|               sizeof(sei_sii_params_t));
 1324|      0|    }
 1325|  3.58k|    return (OK);
  ------------------
  |  |  114|  3.58k|#define OK        0
  ------------------
 1326|  6.11k|}
ih264d_export_sei_fgc_params:
 1349|  6.11k|{
 1350|  6.11k|    if((ps_sei_export == NULL) || (ps_sei == NULL))
  ------------------
  |  Branch (1350:8): [True: 0, False: 6.11k]
  |  Branch (1350:35): [True: 2.52k, False: 3.58k]
  ------------------
 1351|  2.52k|    {
 1352|  2.52k|        return NOT_OK;
  ------------------
  |  |  116|  2.52k|#define NOT_OK    -1
  ------------------
 1353|  2.52k|    }
 1354|       |
 1355|  3.58k|    ps_sei_export->u1_sei_fgc_params_present_flag = ps_sei->u1_sei_fgc_params_present_flag;
 1356|  3.58k|    ps_sei_decode_op->u1_sei_fgc_params_present_flag = ps_sei->u1_sei_fgc_params_present_flag;
 1357|       |
 1358|  3.58k|    if(0 == ps_sei_export->u1_sei_fgc_params_present_flag)
  ------------------
  |  Branch (1358:8): [True: 3.51k, False: 75]
  ------------------
 1359|  3.51k|    {
 1360|  3.51k|        memset(&ps_sei_export->s_sei_fgc_params, 0, sizeof(sei_fgc_params_t));
 1361|  3.51k|    }
 1362|     75|    else
 1363|     75|    {
 1364|     75|        memcpy(&ps_sei_export->s_sei_fgc_params, &ps_sei->s_sei_fgc_params,
 1365|     75|               sizeof(sei_fgc_params_t));
 1366|     75|    }
 1367|       |
 1368|  3.58k|    return (OK);
  ------------------
  |  |  114|  3.58k|#define OK        0
  ------------------
 1369|  6.11k|}

ih264d_check_mb_map_deblk:
  322|   464k|{
  323|   464k|    UWORD32 i = 0;
  324|   464k|    UWORD32 u4_mb_num;
  325|   464k|    UWORD32 u4_cond;
  326|   464k|    volatile UWORD8 *mb_map = ps_dec->pu1_recon_mb_map;
  327|   464k|    const WORD32 i4_cb_qp_idx_ofst =
  328|   464k|                    ps_dec->ps_cur_pps->i1_chroma_qp_index_offset;
  329|   464k|    const WORD32 i4_cr_qp_idx_ofst =
  330|   464k|                    ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset;
  331|       |
  332|   464k|    UWORD32 u4_wd_y, u4_wd_uv;
  333|   464k|    UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag;
  334|       |
  335|       |
  336|   464k|    u4_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag;
  337|   464k|    u4_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag;
  338|       |
  339|       |
  340|   477k|    for(i = 0; i < deblk_mb_grp; i++)
  ------------------
  |  Branch (340:16): [True: 13.1k, False: 464k]
  ------------------
  341|  13.1k|    {
  342|  13.1k|        WORD32 nop_cnt = 8*128;
  343|  13.1k|        while(u4_check_mb_map == 1 && ps_dec->i4_break_threads != 1 && ps_dec->i4_error_code == 0)
  ------------------
  |  Branch (343:15): [True: 0, False: 13.1k]
  |  Branch (343:39): [True: 0, False: 0]
  |  Branch (343:72): [True: 0, False: 0]
  ------------------
  344|      0|        {
  345|      0|            u4_mb_num = ps_dec->u4_cur_deblk_mb_num;
  346|       |            /*we wait for the right mb because of intra pred data dependency*/
  347|      0|            u4_mb_num = MIN(u4_mb_num + 1, (ps_dec->u4_deblk_mb_y + 1) * ps_dec->u2_frm_wd_in_mbs - 1);
  ------------------
  |  |   61|      0|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  348|      0|            CHECK_MB_MAP_BYTE(u4_mb_num, mb_map, u4_cond);
  ------------------
  |  |   80|      0|#define CHECK_MB_MAP_BYTE(u4_mb_num, mb_map, u4_cond)                                               \
  |  |   81|      0|{                                                                                                   \
  |  |   82|      0|        volatile UWORD8 *pu1_mb_flag;                                                               \
  |  |   83|      0|                                                                                                    \
  |  |   84|      0|        pu1_mb_flag    = (UWORD8 *)mb_map + (u4_mb_num );                                           \
  |  |   85|      0|                                                                                                    \
  |  |   86|      0|        u4_cond = (*pu1_mb_flag);                                                                   \
  |  |   87|      0|}
  ------------------
  349|       |
  350|      0|            if(u4_cond)
  ------------------
  |  Branch (350:16): [True: 0, False: 0]
  ------------------
  351|      0|            {
  352|      0|                break;
  353|      0|            }
  354|      0|            else
  355|      0|            {
  356|      0|                if(nop_cnt > 0)
  ------------------
  |  Branch (356:20): [True: 0, False: 0]
  ------------------
  357|      0|                {
  358|      0|                    nop_cnt -= 128;
  359|      0|                    NOP(128);
  ------------------
  |  |   87|      0|#define NOP(nop_cnt) {UWORD32 nop_i; for (nop_i = 0; nop_i < nop_cnt; nop_i++) asm("nop");}
  |  |  ------------------
  |  |  |  Branch (87:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  360|      0|                }
  361|      0|                else
  362|      0|                {
  363|      0|                    nop_cnt = 8*128;
  364|      0|                    ithread_yield();
  365|      0|                }
  366|      0|            }
  367|      0|        }
  368|  13.1k|        if(ps_dec->i4_break_threads == 1 || ps_dec->i4_error_code != 0)
  ------------------
  |  Branch (368:12): [True: 0, False: 13.1k]
  |  Branch (368:45): [True: 0, False: 13.1k]
  ------------------
  369|      0|        {
  370|      0|            break;
  371|      0|        }
  372|       |
  373|  13.1k|        ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt,
  374|  13.1k|                                   i4_cb_qp_idx_ofst, i4_cr_qp_idx_ofst,
  375|  13.1k|                                    u4_wd_y, u4_wd_uv);
  376|       |
  377|       |
  378|  13.1k|    }
  379|       |
  380|       |
  381|   464k|}

ih264d_parse_tfr_nmb:
   68|  40.7k|{
   69|  40.7k|    WORD32 i, u4_mb_num;
   70|       |
   71|  40.7k|    const UWORD32 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
   72|  40.7k|    UWORD32 u4_n_mb_start;
   73|       |
   74|  40.7k|    UNUSED(u4_mb_idx);
  ------------------
  |  |   45|  40.7k|#define UNUSED(x) ((void)(x))
  ------------------
   75|  40.7k|    UNUSED(u4_num_mbs_next);
  ------------------
  |  |   45|  40.7k|#define UNUSED(x) ((void)(x))
  ------------------
   76|  40.7k|    if(u4_tfr_n_mb)
  ------------------
  |  Branch (76:8): [True: 40.7k, False: 0]
  ------------------
   77|  40.7k|    {
   78|       |
   79|       |
   80|  40.7k|        u4_n_mb_start = (ps_dec->u4_cur_mb_addr + 1) - u4_num_mbs;
   81|       |
   82|       |        // copy into s_frmMbInfo
   83|       |
   84|  40.7k|        u4_mb_num = u4_n_mb_start;
   85|  40.7k|        u4_mb_num = (ps_dec->u4_cur_mb_addr + 1) - u4_num_mbs;
   86|       |
   87|   204k|        for(i = 0; i < u4_num_mbs; i++)
  ------------------
  |  Branch (87:20): [True: 163k, False: 40.7k]
  ------------------
   88|   163k|        {
   89|   163k|            UPDATE_SLICE_NUM_MAP(ps_dec->pu2_slice_num_map, u4_mb_num,
  ------------------
  |  |  148|   163k|#define UPDATE_SLICE_NUM_MAP(slice_map, u4_mb_number,u2_slice_num)                                                  \
  |  |  149|   163k|{                                                                                                   \
  |  |  150|   163k|        volatile UWORD16 *pu2_slice_map;                                                               \
  |  |  151|   163k|                                                                                                    \
  |  |  152|   163k|        pu2_slice_map    = (UWORD16 *)slice_map + (u4_mb_number);                                         \
  |  |  153|   163k|        (*pu2_slice_map) = u2_slice_num;                                                              \
  |  |  154|   163k|}
  ------------------
   90|   163k|                                 ps_dec->u2_cur_slice_num);
   91|   163k|            DATA_SYNC();
  ------------------
  |  |  116|   163k|#define DATA_SYNC()  __sync_synchronize()
  ------------------
   92|   163k|            UPDATE_MB_MAP_MBNUM_BYTE(ps_dec->pu1_dec_mb_map, u4_mb_num);
  ------------------
  |  |  136|   163k|#define UPDATE_MB_MAP_MBNUM_BYTE(mb_map, u4_mb_number)                                                  \
  |  |  137|   163k|{                                                                                                   \
  |  |  138|   163k|        volatile UWORD8 *pu1_mb_flag;                                                                       \
  |  |  139|   163k|                                                                                                    \
  |  |  140|   163k|        pu1_mb_flag    = (UWORD8 *)mb_map + (u4_mb_number);                                                     \
  |  |  141|   163k|        /*                                                                                          \
  |  |  142|   163k|         * In case of MbAff, update the mb_map only if the entire MB is done. We can check that     \
  |  |  143|   163k|         * by checking if Y is odd, implying that this is the second row in the MbAff MB            \
  |  |  144|   163k|         */                                                                                         \
  |  |  145|   163k|        (*pu1_mb_flag) = 1;                                                             \
  |  |  146|   163k|}
  ------------------
   93|       |
   94|   163k|            u4_mb_num++;
   95|   163k|        }
   96|       |
   97|       |        /****************************************************************/
   98|       |        /* Check for End Of Row in Next iteration                       */
   99|       |        /****************************************************************/
  100|       |
  101|       |        /****************************************************************/
  102|       |        /* Transfer the Following things                                */
  103|       |        /* N-Mb DeblkParams Data    ( To Ext DeblkParams Buffer )       */
  104|       |        /* N-Mb Recon Data          ( To Ext Frame Buffer )             */
  105|       |        /* N-Mb Intrapredline Data  ( Updated Internally)               */
  106|       |        /* N-Mb MV Data             ( To Ext MV Buffer )                */
  107|       |        /* N-Mb MVTop/TopRight Data ( To Int MV Top Scratch Buffers)    */
  108|       |        /****************************************************************/
  109|       |
  110|       |        /* Swap top and current pointers */
  111|       |
  112|  40.7k|        ps_dec->s_tran_addrecon_parse.pu1_dest_y +=
  113|  40.7k|                        ps_dec->s_tran_addrecon_parse.u4_inc_y[u4_end_of_row];
  114|  40.7k|        ps_dec->s_tran_addrecon_parse.pu1_dest_u +=
  115|  40.7k|                        ps_dec->s_tran_addrecon_parse.u4_inc_uv[u4_end_of_row];
  116|  40.7k|        ps_dec->s_tran_addrecon_parse.pu1_dest_v +=
  117|  40.7k|                        ps_dec->s_tran_addrecon_parse.u4_inc_uv[u4_end_of_row];
  118|       |
  119|  40.7k|        if(u4_end_of_row)
  ------------------
  |  Branch (119:12): [True: 40.4k, False: 331]
  ------------------
  120|  40.4k|        {
  121|  40.4k|            UWORD16 u2_mb_y;
  122|  40.4k|            UWORD32 u4_frame_stride, y_offset;
  123|       |
  124|  40.4k|            ps_dec->ps_top_mb_row = ps_dec->ps_cur_mb_row;
  125|  40.4k|            ps_dec->ps_cur_mb_row += ((ps_dec->u2_frm_wd_in_mbs) << u1_mbaff);
  126|       |
  127|  40.4k|            u2_mb_y = ps_dec->u2_mby + (1 + u1_mbaff);
  128|  40.4k|            u4_frame_stride = ps_dec->u2_frm_wd_y
  129|  40.4k|                            << ps_dec->ps_cur_slice->u1_field_pic_flag;
  130|  40.4k|            y_offset = (u2_mb_y * u4_frame_stride) << 4;
  131|  40.4k|            ps_dec->s_tran_addrecon_parse.pu1_dest_y =
  132|  40.4k|                            ps_dec->s_cur_pic.pu1_buf1 + y_offset;
  133|       |
  134|  40.4k|            u4_frame_stride = ps_dec->u2_frm_wd_uv
  135|  40.4k|                            << ps_dec->ps_cur_slice->u1_field_pic_flag;
  136|  40.4k|            y_offset = (u2_mb_y * u4_frame_stride) << 3;
  137|  40.4k|            ps_dec->s_tran_addrecon_parse.pu1_dest_u =
  138|  40.4k|                            ps_dec->s_cur_pic.pu1_buf2 + y_offset;
  139|  40.4k|            ps_dec->s_tran_addrecon_parse.pu1_dest_v =
  140|  40.4k|                            ps_dec->s_cur_pic.pu1_buf3 + y_offset;
  141|       |
  142|  40.4k|        }
  143|       |
  144|  40.7k|        ps_dec->ps_deblk_mbn += u4_num_mbs;
  145|       |
  146|       |        /*
  147|       |         * The Slice boundary is also a valid condition to transfer. So recalculate
  148|       |         * the Left increment, in case the number of MBs is lesser than the
  149|       |         * N MB value. c_numMbs will be equal to N of N MB if the entire N Mb is
  150|       |         * decoded.
  151|       |         */
  152|  40.7k|        ps_dec->s_tran_addrecon.u2_mv_left_inc = ((u4_num_mbs >> u1_mbaff) - 1)
  153|  40.7k|                        << (4 + u1_mbaff);
  154|  40.7k|        ps_dec->s_tran_addrecon.u2_mv_top_left_inc = (u4_num_mbs << 2) - 1
  155|  40.7k|                        - (u1_mbaff << 2);
  156|       |
  157|       |        /* reassign left MV and cur MV pointers */
  158|  40.7k|        ps_dec->ps_mv_left = ps_dec->ps_mv_cur
  159|  40.7k|                        + ps_dec->s_tran_addrecon.u2_mv_left_inc;
  160|       |
  161|  40.7k|        ps_dec->ps_mv_cur += (u4_num_mbs << 4);
  162|  40.7k|        ps_dec->u4_num_mbs_prev_nmb = u4_num_mbs;
  163|       |
  164|  40.7k|    }
  165|  40.7k|}
ih264d_decode_tfr_nmb:
  171|  5.50k|{
  172|       |
  173|  5.50k|    UWORD32 u1_end_of_row_next;
  174|       |
  175|  5.50k|    const UWORD32 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  176|       |
  177|       |    /****************************************************************/
  178|       |    /* Check for End Of Row in Next iteration                       */
  179|       |    /****************************************************************/
  180|  5.50k|    u1_end_of_row_next = u4_num_mbs_next &&
  ------------------
  |  Branch (180:26): [True: 249, False: 5.25k]
  ------------------
  181|    249|                        ((u4_num_mbs_next) <= (ps_dec->u4_recon_mb_grp >> u1_mbaff));
  ------------------
  |  Branch (181:25): [True: 249, False: 0]
  ------------------
  182|       |
  183|       |    /****************************************************************/
  184|       |    /* Transfer the Following things                                */
  185|       |    /* N-Mb DeblkParams Data    ( To Ext DeblkParams Buffer )       */
  186|       |    /* N-Mb Recon Data          ( To Ext Frame Buffer )             */
  187|       |    /* N-Mb Intrapredline Data  ( Updated Internally)               */
  188|       |    /* N-Mb MV Data             ( To Ext MV Buffer )                */
  189|       |    /* N-Mb MVTop/TopRight Data ( To Int MV Top Scratch Buffers)    */
  190|       |    /****************************************************************/
  191|  5.50k|    if(u4_end_of_row)
  ------------------
  |  Branch (191:8): [True: 5.25k, False: 249]
  ------------------
  192|  5.25k|    {
  193|  5.25k|        ps_dec->i2_dec_thread_mb_y += (1 << u1_mbaff);
  194|  5.25k|    }
  195|  5.50k|    ih264d_transfer_mb_group_data(ps_dec, u4_num_mbs, u4_end_of_row,
  196|  5.50k|                                  u1_end_of_row_next);
  197|       |
  198|  5.50k|}
ih264d_decode_recon_tfr_nmb_thread:
  204|  1.03k|{
  205|  1.03k|    WORD32 i,j;
  206|  1.03k|    dec_mb_info_t * ps_cur_mb_info;
  207|  1.03k|    UWORD32 u4_update_mbaff = 0;
  208|  1.03k|    const UWORD32 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  209|  1.03k|    UWORD32 u1_slice_type, u1_B;
  210|  1.03k|    WORD32 u1_skip_th;
  211|  1.03k|    UWORD32 u1_ipcm_th;
  212|  1.03k|    UWORD32 u4_cond;
  213|  1.03k|    UWORD16 u2_slice_num,u2_cur_dec_mb_num;
  214|  1.03k|    WORD32 ret;
  215|  1.03k|    UWORD32 u4_mb_num;
  216|  1.03k|    WORD32 nop_cnt = 8*128;
  217|  1.03k|    u1_slice_type = ps_dec->ps_decode_cur_slice->slice_type;
  218|       |
  219|  1.03k|    u1_B = (u1_slice_type == B_SLICE);
  ------------------
  |  |  369|  1.03k|#define B_SLICE  1
  ------------------
  220|       |
  221|  1.03k|    u1_skip_th = ((u1_slice_type != I_SLICE) ?
  ------------------
  |  |  370|  1.03k|#define I_SLICE  2
  ------------------
  |  Branch (221:19): [True: 991, False: 39]
  ------------------
  222|    991|                                    (u1_B ? B_8x8 : PRED_8x8R0) : -1);
  ------------------
  |  |  480|    502|#define B_8x8    22
  ------------------
                                                  (u1_B ? B_8x8 : PRED_8x8R0) : -1);
  ------------------
  |  |  454|    489|#define PRED_8x8R0  4
  ------------------
  |  Branch (222:38): [True: 502, False: 489]
  ------------------
  223|       |
  224|  1.03k|    u1_ipcm_th = ((u1_slice_type != I_SLICE) ? (u1_B ? 23 : 5) : 0);
  ------------------
  |  |  370|  1.03k|#define I_SLICE  2
  ------------------
  |  Branch (224:19): [True: 991, False: 39]
  |  Branch (224:49): [True: 502, False: 489]
  ------------------
  225|       |
  226|  1.03k|    u2_cur_dec_mb_num = ps_dec->cur_dec_mb_num;
  227|       |
  228|  22.2k|    while(ps_dec->i4_break_threads != 1 && ps_dec->i4_error_code == 0)
  ------------------
  |  Branch (228:11): [True: 22.2k, False: 0]
  |  Branch (228:44): [True: 22.2k, False: 0]
  ------------------
  229|  22.2k|    {
  230|       |
  231|  22.2k|        UWORD32 u4_max_mb = (UWORD32)(ps_dec->i2_dec_thread_mb_y + (1 << u1_mbaff)) * ps_dec->u2_frm_wd_in_mbs - 1;
  232|  22.2k|        u4_mb_num = u2_cur_dec_mb_num;
  233|       |        /*introducing 1 MB delay*/
  234|  22.2k|        u4_mb_num = MIN(u4_mb_num + u4_num_mbs + 1, u4_max_mb);
  ------------------
  |  |   61|  22.2k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 0, False: 22.2k]
  |  |  ------------------
  ------------------
  235|       |
  236|  22.2k|        CHECK_MB_MAP_BYTE(u4_mb_num, ps_dec->pu1_dec_mb_map, u4_cond);
  ------------------
  |  |   80|  22.2k|#define CHECK_MB_MAP_BYTE(u4_mb_num, mb_map, u4_cond)                                               \
  |  |   81|  22.2k|{                                                                                                   \
  |  |   82|  22.2k|        volatile UWORD8 *pu1_mb_flag;                                                               \
  |  |   83|  22.2k|                                                                                                    \
  |  |   84|  22.2k|        pu1_mb_flag    = (UWORD8 *)mb_map + (u4_mb_num );                                           \
  |  |   85|  22.2k|                                                                                                    \
  |  |   86|  22.2k|        u4_cond = (*pu1_mb_flag);                                                                   \
  |  |   87|  22.2k|}
  ------------------
  237|  22.2k|        if(u4_cond)
  ------------------
  |  Branch (237:12): [True: 1.03k, False: 21.2k]
  ------------------
  238|  1.03k|        {
  239|  1.03k|            break;
  240|  1.03k|        }
  241|  21.2k|        else
  242|  21.2k|        {
  243|  21.2k|            if(nop_cnt > 0)
  ------------------
  |  Branch (243:16): [True: 18.8k, False: 2.38k]
  ------------------
  244|  18.8k|            {
  245|  18.8k|                nop_cnt -= 128;
  246|  18.8k|                NOP(128);
  ------------------
  |  |   87|  2.42M|#define NOP(nop_cnt) {UWORD32 nop_i; for (nop_i = 0; nop_i < nop_cnt; nop_i++) asm("nop");}
  |  |  ------------------
  |  |  |  Branch (87:54): [True: 2.40M, False: 18.8k]
  |  |  ------------------
  ------------------
  247|  18.8k|            }
  248|  2.38k|            else
  249|  2.38k|            {
  250|  2.38k|                if(ps_dec->u4_output_present && (2 == ps_dec->u4_num_cores) &&
  ------------------
  |  Branch (250:20): [True: 518, False: 1.87k]
  |  Branch (250:49): [True: 518, False: 0]
  ------------------
  251|    518|                   (ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht))
  ------------------
  |  Branch (251:20): [True: 172, False: 346]
  ------------------
  252|    172|                {
  253|    172|                    ps_dec->u4_fmt_conv_num_rows =
  254|    172|                                MIN(FMT_CONV_NUM_ROWS,
  ------------------
  |  |   61|    172|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 153, False: 19]
  |  |  ------------------
  ------------------
  255|    172|                                    (ps_dec->s_disp_frame_info.u4_y_ht
  256|    172|                                                    - ps_dec->u4_fmt_conv_cur_row));
  257|    172|                    ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op),
  258|    172|                                          ps_dec->u4_fmt_conv_cur_row,
  259|    172|                                          ps_dec->u4_fmt_conv_num_rows);
  260|    172|                    ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
  261|    172|                }
  262|  2.21k|                else
  263|  2.21k|                {
  264|  2.21k|                    nop_cnt = 8*128;
  265|  2.21k|                    ithread_yield();
  266|  2.21k|                }
  267|  2.38k|            }
  268|  21.2k|        }
  269|  22.2k|    }
  270|  1.03k|    if(ps_dec->i4_break_threads == 1 || ps_dec->i4_error_code != 0)
  ------------------
  |  Branch (270:8): [True: 0, False: 1.03k]
  |  Branch (270:41): [True: 0, False: 1.03k]
  ------------------
  271|      0|    {
  272|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  273|      0|    }
  274|       |    /* N Mb MC Loop */
  275|  11.7k|    for(i = 0; i < u4_num_mbs; i++)
  ------------------
  |  Branch (275:16): [True: 10.9k, False: 862]
  ------------------
  276|  10.9k|    {
  277|  10.9k|        u4_mb_num = u2_cur_dec_mb_num;
  278|       |
  279|  10.9k|        GET_SLICE_NUM_MAP(ps_dec->pu2_slice_num_map, u2_cur_dec_mb_num,
  ------------------
  |  |  156|  10.9k|#define GET_SLICE_NUM_MAP(slice_map, mb_number,u2_slice_num)                                                  \
  |  |  157|  10.9k|{                                                                                                   \
  |  |  158|  10.9k|        volatile UWORD16 *pu2_slice_map;                                                               \
  |  |  159|  10.9k|                                                                                                    \
  |  |  160|  10.9k|        pu2_slice_map    = (UWORD16 *)slice_map + (mb_number);                                         \
  |  |  161|  10.9k|        u2_slice_num = (*pu2_slice_map) ;                                                               \
  |  |  162|  10.9k|}
  ------------------
  280|  10.9k|                          u2_slice_num);
  281|       |
  282|  10.9k|        if(u2_slice_num != ps_dec->u2_cur_slice_num_dec_thread)
  ------------------
  |  Branch (282:12): [True: 168, False: 10.7k]
  ------------------
  283|    168|        {
  284|    168|            ps_dec->u4_cur_slice_decode_done = 1;
  285|    168|            break;
  286|    168|        }
  287|       |
  288|  10.7k|        ps_cur_mb_info = &ps_dec->ps_frm_mb_info[u2_cur_dec_mb_num];
  289|       |
  290|  10.7k|        ps_dec->u4_dma_buf_idx = 0;
  291|  10.7k|        ps_dec->u4_pred_info_idx = 0;
  292|       |
  293|  10.7k|        if(ps_cur_mb_info->u1_mb_type <= u1_skip_th)
  ------------------
  |  Branch (293:12): [True: 2.22k, False: 8.54k]
  ------------------
  294|  2.22k|        {
  295|  2.22k|            WORD32 pred_cnt = 0;
  296|  2.22k|            pred_info_pkd_t *ps_pred_pkd;
  297|  2.22k|            UWORD32 u4_pred_info_pkd_idx;
  298|  2.22k|            WORD8 i1_pred;
  299|       |
  300|  2.22k|            u4_pred_info_pkd_idx = ps_cur_mb_info->u4_pred_info_pkd_idx;
  301|       |
  302|  9.11k|            while(pred_cnt < ps_cur_mb_info->u1_num_pred_parts)
  ------------------
  |  Branch (302:19): [True: 6.89k, False: 2.22k]
  ------------------
  303|  6.89k|            {
  304|  6.89k|                ps_pred_pkd = ps_dec->ps_pred_pkd + u4_pred_info_pkd_idx;
  305|       |
  306|  6.89k|                ps_dec->p_form_mb_part_info_thread(ps_pred_pkd,ps_dec,
  307|  6.89k|                                                   ps_cur_mb_info->u2_mbx,
  308|  6.89k|                                                   ps_cur_mb_info->u2_mby,
  309|  6.89k|                                                   (i >> u1_mbaff),
  310|  6.89k|                                                   ps_cur_mb_info);
  311|       |
  312|  6.89k|                u4_pred_info_pkd_idx++;
  313|  6.89k|                pred_cnt++;
  314|  6.89k|            }
  315|  2.22k|            ps_dec->p_mc_dec_thread(ps_dec, ps_cur_mb_info);
  316|  2.22k|        }
  317|  8.54k|        else if(ps_cur_mb_info->u1_mb_type == MB_SKIP)
  ------------------
  |  |  456|  8.54k|#define MB_SKIP     255
  ------------------
  |  Branch (317:17): [True: 6.96k, False: 1.57k]
  ------------------
  318|  6.96k|        {
  319|  6.96k|            WORD32 pred_cnt = 0;
  320|  6.96k|            pred_info_pkd_t *ps_pred_pkd;
  321|  6.96k|            UWORD32 u4_pred_info_pkd_idx;
  322|  6.96k|            WORD8 i1_pred;
  323|       |
  324|  6.96k|            u4_pred_info_pkd_idx = ps_cur_mb_info->u4_pred_info_pkd_idx;
  325|       |
  326|  16.9k|            while(pred_cnt < ps_cur_mb_info->u1_num_pred_parts)
  ------------------
  |  Branch (326:19): [True: 9.99k, False: 6.96k]
  ------------------
  327|  9.99k|            {
  328|  9.99k|                ps_pred_pkd = ps_dec->ps_pred_pkd + u4_pred_info_pkd_idx;
  329|       |
  330|  9.99k|                ps_dec->p_form_mb_part_info_thread(ps_pred_pkd,ps_dec,
  331|  9.99k|                                                   ps_cur_mb_info->u2_mbx,
  332|  9.99k|                                                   ps_cur_mb_info->u2_mby,
  333|  9.99k|                                                   (i >> u1_mbaff),
  334|  9.99k|                                                   ps_cur_mb_info);
  335|       |
  336|  9.99k|                u4_pred_info_pkd_idx++;
  337|  9.99k|                pred_cnt++;
  338|  9.99k|            }
  339|       |            /* Decode MB skip */
  340|  6.96k|            ps_dec->p_mc_dec_thread(ps_dec, ps_cur_mb_info);
  341|  6.96k|        }
  342|       |
  343|  10.7k|        u2_cur_dec_mb_num++;
  344|  10.7k|    }
  345|       |
  346|       |    /* N Mb IQ IT RECON  Loop */
  347|  11.7k|    for(j = 0; j < i; j++)
  ------------------
  |  Branch (347:16): [True: 10.7k, False: 1.03k]
  ------------------
  348|  10.7k|    {
  349|  10.7k|        ps_cur_mb_info = &ps_dec->ps_frm_mb_info[ps_dec->cur_dec_mb_num];
  350|       |
  351|  10.7k|        if((ps_dec->u4_num_cores == 2) || !ps_dec->i1_recon_in_thread3_flag)
  ------------------
  |  Branch (351:12): [True: 10.7k, False: 0]
  |  Branch (351:43): [True: 0, False: 0]
  ------------------
  352|  10.7k|        {
  353|  10.7k|            if(ps_cur_mb_info->u1_mb_type <= u1_skip_th)
  ------------------
  |  Branch (353:16): [True: 2.22k, False: 8.54k]
  ------------------
  354|  2.22k|            {
  355|  2.22k|                ih264d_process_inter_mb(ps_dec, ps_cur_mb_info, j);
  356|  2.22k|            }
  357|  8.54k|            else if(ps_cur_mb_info->u1_mb_type != MB_SKIP)
  ------------------
  |  |  456|  8.54k|#define MB_SKIP     255
  ------------------
  |  Branch (357:21): [True: 1.57k, False: 6.96k]
  ------------------
  358|  1.57k|            {
  359|  1.57k|                if((u1_ipcm_th + 25) != ps_cur_mb_info->u1_mb_type)
  ------------------
  |  Branch (359:20): [True: 1.57k, False: 0]
  ------------------
  360|  1.57k|                {
  361|  1.57k|                    ps_cur_mb_info->u1_mb_type -= (u1_skip_th + 1);
  362|  1.57k|                    ih264d_process_intra_mb(ps_dec, ps_cur_mb_info, j);
  363|  1.57k|                }
  364|  1.57k|            }
  365|       |
  366|       |
  367|  10.7k|         if(ps_dec->u4_use_intrapred_line_copy == 1)
  ------------------
  |  Branch (367:13): [True: 10.7k, False: 0]
  ------------------
  368|  10.7k|                ih264d_copy_intra_pred_line(ps_dec, ps_cur_mb_info, j);
  369|  10.7k|        }
  370|       |
  371|  10.7k|        DATA_SYNC();
  ------------------
  |  |  116|  10.7k|#define DATA_SYNC()  __sync_synchronize()
  ------------------
  372|       |
  373|  10.7k|        if(u1_mbaff)
  ------------------
  |  Branch (373:12): [True: 0, False: 10.7k]
  ------------------
  374|      0|        {
  375|      0|            if(u4_update_mbaff)
  ------------------
  |  Branch (375:16): [True: 0, False: 0]
  ------------------
  376|      0|            {
  377|      0|                UWORD32 u4_mb_num = ps_cur_mb_info->u2_mbx
  378|      0|                                + ps_dec->u2_frm_wd_in_mbs
  379|      0|                                                * (ps_cur_mb_info->u2_mby >> 1);
  380|      0|                UPDATE_MB_MAP_MBNUM_BYTE(ps_dec->pu1_recon_mb_map, u4_mb_num);
  ------------------
  |  |  136|      0|#define UPDATE_MB_MAP_MBNUM_BYTE(mb_map, u4_mb_number)                                                  \
  |  |  137|      0|{                                                                                                   \
  |  |  138|      0|        volatile UWORD8 *pu1_mb_flag;                                                                       \
  |  |  139|      0|                                                                                                    \
  |  |  140|      0|        pu1_mb_flag    = (UWORD8 *)mb_map + (u4_mb_number);                                                     \
  |  |  141|      0|        /*                                                                                          \
  |  |  142|      0|         * In case of MbAff, update the mb_map only if the entire MB is done. We can check that     \
  |  |  143|      0|         * by checking if Y is odd, implying that this is the second row in the MbAff MB            \
  |  |  144|      0|         */                                                                                         \
  |  |  145|      0|        (*pu1_mb_flag) = 1;                                                             \
  |  |  146|      0|}
  ------------------
  381|      0|                u4_update_mbaff = 0;
  382|      0|            }
  383|      0|            else
  384|      0|            {
  385|      0|                u4_update_mbaff = 1;
  386|      0|            }
  387|      0|        }
  388|  10.7k|        else
  389|  10.7k|        {
  390|  10.7k|            UWORD32 u4_mb_num = ps_cur_mb_info->u2_mbx
  391|  10.7k|                            + ps_dec->u2_frm_wd_in_mbs * ps_cur_mb_info->u2_mby;
  392|  10.7k|            UPDATE_MB_MAP_MBNUM_BYTE(ps_dec->pu1_recon_mb_map, u4_mb_num);
  ------------------
  |  |  136|  10.7k|#define UPDATE_MB_MAP_MBNUM_BYTE(mb_map, u4_mb_number)                                                  \
  |  |  137|  10.7k|{                                                                                                   \
  |  |  138|  10.7k|        volatile UWORD8 *pu1_mb_flag;                                                                       \
  |  |  139|  10.7k|                                                                                                    \
  |  |  140|  10.7k|        pu1_mb_flag    = (UWORD8 *)mb_map + (u4_mb_number);                                                     \
  |  |  141|  10.7k|        /*                                                                                          \
  |  |  142|  10.7k|         * In case of MbAff, update the mb_map only if the entire MB is done. We can check that     \
  |  |  143|  10.7k|         * by checking if Y is odd, implying that this is the second row in the MbAff MB            \
  |  |  144|  10.7k|         */                                                                                         \
  |  |  145|  10.7k|        (*pu1_mb_flag) = 1;                                                             \
  |  |  146|  10.7k|}
  ------------------
  393|  10.7k|        }
  394|  10.7k|        ps_dec->cur_dec_mb_num++;
  395|  10.7k|     }
  396|       |
  397|       |    /*N MB deblocking*/
  398|  1.03k|    if(ps_dec->u4_nmb_deblk == 1)
  ------------------
  |  Branch (398:8): [True: 0, False: 1.03k]
  ------------------
  399|      0|    {
  400|      0|        UWORD32 u4_wd_y, u4_wd_uv;
  401|      0|        tfr_ctxt_t *ps_tfr_cxt = &(ps_dec->s_tran_addrecon);
  402|      0|        UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag;
  403|      0|        const WORD32 i4_cb_qp_idx_ofst =
  404|      0|                       ps_dec->ps_cur_pps->i1_chroma_qp_index_offset;
  405|      0|        const WORD32 i4_cr_qp_idx_ofst =
  406|      0|                       ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset;
  407|       |
  408|      0|        u4_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag;
  409|      0|        u4_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag;
  410|       |
  411|      0|        ps_cur_mb_info = &ps_dec->ps_frm_mb_info[ps_dec->u4_cur_deblk_mb_num];
  412|       |
  413|      0|        ps_dec->u4_deblk_mb_x = ps_cur_mb_info->u2_mbx;
  414|      0|        ps_dec->u4_deblk_mb_y = ps_cur_mb_info->u2_mby;
  415|       |
  416|       |
  417|      0|        for(j = 0; j < i; j++)
  ------------------
  |  Branch (417:20): [True: 0, False: 0]
  ------------------
  418|      0|        {
  419|      0|            ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt,
  420|      0|                                       i4_cb_qp_idx_ofst, i4_cr_qp_idx_ofst,
  421|      0|                                        u4_wd_y, u4_wd_uv);
  422|       |
  423|      0|        }
  424|      0|    }
  425|       |
  426|       |    /*handle the last mb in picture case*/
  427|  1.03k|    if(ps_dec->cur_dec_mb_num > ps_dec->ps_cur_sps->u4_max_mb_addr)
  ------------------
  |  Branch (427:8): [True: 93, False: 937]
  ------------------
  428|     93|        ps_dec->u4_cur_slice_decode_done = 1;
  429|       |
  430|  1.03k|    if(i != u4_num_mbs)
  ------------------
  |  Branch (430:8): [True: 168, False: 862]
  ------------------
  431|    168|    {
  432|    168|        u4_end_of_row = 0;
  433|       |        /*Number of MB's left in row*/
  434|    168|        u4_num_mbs_next = u4_num_mbs_next + ((u4_num_mbs - i) >> u1_mbaff);
  435|    168|    }
  436|       |
  437|  1.03k|    ih264d_decode_tfr_nmb(ps_dec, (i), u4_num_mbs_next, u4_end_of_row);
  438|       |
  439|  1.03k|    return OK;
  ------------------
  |  |  114|  1.03k|#define OK        0
  ------------------
  440|  1.03k|}
ih264d_decode_slice_thread:
  443|    619|{
  444|    619|    UWORD32 u4_num_mbs_next, u4_num_mbsleft, u4_end_of_row = 0;
  445|    619|    const UWORD32 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs;
  446|    619|    UWORD32 u4_mbaff, u4_num_mbs;
  447|       |
  448|    619|    UWORD16 u2_first_mb_in_slice;
  449|    619|    UWORD16 i16_mb_x, i16_mb_y;
  450|    619|    UWORD8 u1_field_pic;
  451|    619|    UWORD32 u4_frame_stride, x_offset, y_offset;
  452|    619|    WORD32 ret;
  453|    619|    WORD32 nop_cnt = 8 * 128;
  454|       |
  455|    619|    tfr_ctxt_t *ps_trns_addr;
  456|       |
  457|       |    /*check for mb map of first mb in slice to ensure slice header is parsed*/
  458|  5.02k|    while(ps_dec->i4_break_threads != 1 && ps_dec->i4_error_code == 0)
  ------------------
  |  Branch (458:11): [True: 5.02k, False: 0]
  |  Branch (458:44): [True: 4.66k, False: 358]
  ------------------
  459|  4.66k|    {
  460|  4.66k|        UWORD32 u4_mb_num = ps_dec->cur_dec_mb_num;
  461|  4.66k|        UWORD32 u4_cond = 0;
  462|  4.66k|        CHECK_MB_MAP_BYTE(u4_mb_num, ps_dec->pu1_dec_mb_map, u4_cond);
  ------------------
  |  |   80|  4.66k|#define CHECK_MB_MAP_BYTE(u4_mb_num, mb_map, u4_cond)                                               \
  |  |   81|  4.66k|{                                                                                                   \
  |  |   82|  4.66k|        volatile UWORD8 *pu1_mb_flag;                                                               \
  |  |   83|  4.66k|                                                                                                    \
  |  |   84|  4.66k|        pu1_mb_flag    = (UWORD8 *)mb_map + (u4_mb_num );                                           \
  |  |   85|  4.66k|                                                                                                    \
  |  |   86|  4.66k|        u4_cond = (*pu1_mb_flag);                                                                   \
  |  |   87|  4.66k|}
  ------------------
  463|  4.66k|        if(u4_cond)
  ------------------
  |  Branch (463:12): [True: 261, False: 4.40k]
  ------------------
  464|    261|        {
  465|    261|            break;
  466|    261|        }
  467|  4.40k|        else
  468|  4.40k|        {
  469|  4.40k|            if(nop_cnt > 0)
  ------------------
  |  Branch (469:16): [True: 3.78k, False: 620]
  ------------------
  470|  3.78k|            {
  471|  3.78k|                nop_cnt -= 128;
  472|  3.78k|                NOP(128);
  ------------------
  |  |   87|   488k|#define NOP(nop_cnt) {UWORD32 nop_i; for (nop_i = 0; nop_i < nop_cnt; nop_i++) asm("nop");}
  |  |  ------------------
  |  |  |  Branch (87:54): [True: 484k, False: 3.78k]
  |  |  ------------------
  ------------------
  473|  3.78k|            }
  474|    620|            else if(ps_dec->u4_output_present && (2 == ps_dec->u4_num_cores) &&
  ------------------
  |  Branch (474:21): [True: 228, False: 392]
  |  Branch (474:50): [True: 228, False: 0]
  ------------------
  475|    228|               (ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht))
  ------------------
  |  Branch (475:16): [True: 188, False: 40]
  ------------------
  476|    188|            {
  477|    188|                ps_dec->u4_fmt_conv_num_rows =
  478|    188|                                MIN(FMT_CONV_NUM_ROWS,
  ------------------
  |  |   61|    188|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 176, False: 12]
  |  |  ------------------
  ------------------
  479|    188|                                    (ps_dec->s_disp_frame_info.u4_y_ht
  480|    188|                                                    - ps_dec->u4_fmt_conv_cur_row));
  481|    188|                ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op),
  482|    188|                                      ps_dec->u4_fmt_conv_cur_row,
  483|    188|                                      ps_dec->u4_fmt_conv_num_rows);
  484|    188|                ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
  485|    188|            }
  486|    432|            else
  487|    432|            {
  488|    432|                nop_cnt = 8*128;
  489|    432|                ithread_yield();
  490|    432|            }
  491|  4.40k|            DEBUG_THREADS_PRINTF("waiting for mb mapcur_dec_mb_num = %d,ps_dec->u4_cur_mb_addr  = %d\n",u2_cur_dec_mb_num,
  492|  4.40k|                            ps_dec->u4_cur_mb_addr);
  493|       |
  494|  4.40k|        }
  495|  4.66k|    }
  496|    619|    if(ps_dec->i4_break_threads == 1 || ps_dec->i4_error_code != 0)
  ------------------
  |  Branch (496:8): [True: 0, False: 619]
  |  Branch (496:41): [True: 358, False: 261]
  ------------------
  497|    358|    {
  498|    358|        return NOT_OK;
  ------------------
  |  |  116|    358|#define NOT_OK    -1
  ------------------
  499|    358|    }
  500|       |
  501|       |
  502|       |
  503|    261|    u4_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  504|       |
  505|    261|    u2_first_mb_in_slice = ps_dec->ps_decode_cur_slice->u4_first_mb_in_slice;
  506|       |
  507|    261|    i16_mb_x = MOD(u2_first_mb_in_slice, i2_pic_wdin_mbs);
  ------------------
  |  |   64|    261|#define MOD(x,y) ((x)%(y))
  ------------------
  508|    261|    i16_mb_y = DIV(u2_first_mb_in_slice, i2_pic_wdin_mbs);
  ------------------
  |  |   65|    261|#define DIV(x,y) ((x)/(y))
  ------------------
  509|    261|    i16_mb_y <<= u4_mbaff;
  510|    261|    ps_dec->i2_dec_thread_mb_y = i16_mb_y;
  511|       |
  512|       |
  513|    261|    ps_dec->cur_dec_mb_num = u2_first_mb_in_slice << u4_mbaff;
  514|       |
  515|    261|    if((ps_dec->u4_num_cores == 2) || !ps_dec->i1_recon_in_thread3_flag)
  ------------------
  |  Branch (515:8): [True: 261, False: 0]
  |  Branch (515:39): [True: 0, False: 0]
  ------------------
  516|    261|    {
  517|    261|        ps_dec->pv_proc_tu_coeff_data =
  518|    261|                (void *) ps_dec->ps_decode_cur_slice->pv_tu_coeff_data_start;
  519|    261|    }
  520|       |
  521|       |    // recalculate recon pointers
  522|    261|    u1_field_pic = ps_dec->ps_cur_slice->u1_field_pic_flag;
  523|    261|    u4_frame_stride = ps_dec->u2_frm_wd_y << u1_field_pic;
  524|    261|    x_offset = i16_mb_x << 4;
  525|    261|    y_offset = (i16_mb_y * u4_frame_stride) << 4;
  526|       |
  527|    261|    ps_trns_addr = &(ps_dec->s_tran_addrecon);
  528|       |
  529|    261|    ps_trns_addr->pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1 + x_offset + y_offset;
  530|       |
  531|    261|    u4_frame_stride = ps_dec->u2_frm_wd_uv << u1_field_pic;
  532|    261|    x_offset >>= 1;
  533|    261|    y_offset = (i16_mb_y * u4_frame_stride) << 3;
  534|       |
  535|    261|    x_offset *= YUV420SP_FACTOR;
  ------------------
  |  |  119|    261|#define YUV420SP_FACTOR 2
  ------------------
  536|       |
  537|    261|    ps_trns_addr->pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2 + x_offset + y_offset;
  538|    261|    ps_trns_addr->pu1_dest_v = ps_dec->s_cur_pic.pu1_buf3 + x_offset + y_offset;
  539|       |
  540|    261|    ps_trns_addr->pu1_mb_y = ps_trns_addr->pu1_dest_y;
  541|    261|    ps_trns_addr->pu1_mb_u = ps_trns_addr->pu1_dest_u;
  542|    261|    ps_trns_addr->pu1_mb_v = ps_trns_addr->pu1_dest_v;
  543|       |
  544|       |
  545|       |    /* Initialise MC and formMbPartInfo fn ptrs one time based on profile_idc */
  546|    261|    {
  547|    261|        ps_dec->p_mc_dec_thread = ih264d_motion_compensate_bp;
  548|    261|        ps_dec->p_form_mb_part_info_thread = ih264d_form_mb_part_info_bp;
  549|    261|    }
  550|    261|    {
  551|    261|        UWORD8 uc_nofield_nombaff;
  552|    261|        uc_nofield_nombaff = ((ps_dec->ps_cur_slice->u1_field_pic_flag == 0)
  ------------------
  |  Branch (552:31): [True: 261, False: 0]
  ------------------
  553|    261|                        && (ps_dec->ps_cur_slice->u1_mbaff_frame_flag == 0)
  ------------------
  |  Branch (553:28): [True: 261, False: 0]
  ------------------
  554|    261|                        && (ps_dec->ps_decode_cur_slice->slice_type != B_SLICE)
  ------------------
  |  |  369|    261|#define B_SLICE  1
  ------------------
  |  Branch (554:28): [True: 88, False: 173]
  ------------------
  555|     88|                        && (ps_dec->ps_cur_pps->u1_wted_pred_flag == 0));
  ------------------
  |  Branch (555:28): [True: 85, False: 3]
  ------------------
  556|       |
  557|    261|        if(uc_nofield_nombaff == 0)
  ------------------
  |  Branch (557:12): [True: 176, False: 85]
  ------------------
  558|    176|        {
  559|    176|            ps_dec->p_mc_dec_thread = ih264d_motion_compensate_mp;
  560|    176|            ps_dec->p_form_mb_part_info_thread = ih264d_form_mb_part_info_mp;
  561|    176|        }
  562|       |
  563|    261|    }
  564|       |
  565|    261|    ps_dec->u4_cur_slice_decode_done = 0;
  566|       |
  567|       |
  568|  1.29k|    while(ps_dec->u4_cur_slice_decode_done != 1)
  ------------------
  |  Branch (568:11): [True: 1.03k, False: 261]
  ------------------
  569|  1.03k|    {
  570|       |
  571|  1.03k|        u4_num_mbsleft = ((i2_pic_wdin_mbs - i16_mb_x) << u4_mbaff);
  572|       |
  573|  1.03k|        if(u4_num_mbsleft <= ps_dec->u4_recon_mb_grp)
  ------------------
  |  Branch (573:12): [True: 1.03k, False: 0]
  ------------------
  574|  1.03k|        {
  575|  1.03k|            u4_num_mbs = u4_num_mbsleft;
  576|       |
  577|       |            /*Indicate number of mb's left in a row*/
  578|  1.03k|            u4_num_mbs_next = 0;
  579|  1.03k|            u4_end_of_row = 1;
  580|  1.03k|            i16_mb_x = 0;
  581|  1.03k|        }
  582|      0|        else
  583|      0|        {
  584|      0|            u4_num_mbs = ps_dec->u4_recon_mb_grp;
  585|       |
  586|       |            /*Indicate number of mb's left in a row*/
  587|      0|            u4_num_mbs_next = i2_pic_wdin_mbs - i16_mb_x
  588|      0|                            - (ps_dec->u4_recon_mb_grp >> u4_mbaff);
  589|      0|            i16_mb_x += (u4_num_mbs >> u4_mbaff);
  590|      0|            u4_end_of_row = 0;
  591|       |
  592|      0|        }
  593|  1.03k|        ret = ih264d_decode_recon_tfr_nmb_thread(ps_dec, u4_num_mbs, u4_num_mbs_next,
  594|  1.03k|                                           u4_end_of_row);
  595|  1.03k|        if(ret != OK)
  ------------------
  |  |  114|  1.03k|#define OK        0
  ------------------
  |  Branch (595:12): [True: 0, False: 1.03k]
  ------------------
  596|      0|            return ret;
  597|  1.03k|    }
  598|    261|    return OK;
  ------------------
  |  |  114|    261|#define OK        0
  ------------------
  599|    261|}
ih264d_decode_picture_thread:
  602|    451|{
  603|    451|    ithread_set_name("ih264d_decode_picture_thread");
  604|       |
  605|    451|    while(1)
  ------------------
  |  Branch (605:11): [True: 451, Folded]
  ------------------
  606|    451|    {
  607|    451|        WORD32 ret;
  608|    451|        if(ps_dec->i4_threads_active)
  ------------------
  |  Branch (608:12): [True: 0, False: 451]
  ------------------
  609|      0|        {
  610|      0|            ret = ithread_mutex_lock(ps_dec->apv_proc_start_mutex[0]);
  611|      0|            if(OK != ret)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (611:16): [True: 0, False: 0]
  ------------------
  612|      0|                break;
  613|       |
  614|      0|            while(ps_dec->ai4_process_start[0] != PROC_START)
  ------------------
  |  Branch (614:19): [True: 0, False: 0]
  ------------------
  615|      0|            {
  616|      0|                ithread_cond_wait(ps_dec->apv_proc_start_condition[0],
  617|      0|                                  ps_dec->apv_proc_start_mutex[0]);
  618|      0|            }
  619|      0|            ps_dec->ai4_process_start[0] = PROC_IN_PROGRESS;
  620|       |
  621|      0|            ret = ithread_mutex_unlock(ps_dec->apv_proc_start_mutex[0]);
  622|      0|            if(OK != ret || ps_dec->i4_break_threads == 1)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (622:16): [True: 0, False: 0]
  |  Branch (622:29): [True: 0, False: 0]
  ------------------
  623|      0|                break;
  624|      0|        }
  625|    619|        while(1)
  ------------------
  |  Branch (625:15): [True: 619, Folded]
  ------------------
  626|    619|        {
  627|       |            /*Complete all writes before processing next slice*/
  628|       |
  629|    619|            DEBUG_THREADS_PRINTF(" Entering decode slice\n");
  630|       |
  631|    619|            ih264d_decode_slice_thread(ps_dec);
  632|    619|            DEBUG_THREADS_PRINTF(" Exit  ih264d_decode_slice_thread \n");
  633|       |
  634|       |
  635|    619|            if((ps_dec->cur_dec_mb_num > ps_dec->ps_cur_sps->u4_max_mb_addr) ||
  ------------------
  |  Branch (635:16): [True: 93, False: 526]
  ------------------
  636|    526|               (ps_dec->i4_error_code != 0) || (ps_dec->i4_break_threads == 1))
  ------------------
  |  Branch (636:16): [True: 358, False: 168]
  |  Branch (636:48): [True: 0, False: 168]
  ------------------
  637|    451|            {
  638|       |                /*Last slice in frame*/
  639|    451|                break;
  640|    451|            }
  641|    168|            else
  642|    168|            {
  643|    168|                ps_dec->ps_decode_cur_slice++;
  644|    168|                ps_dec->u2_cur_slice_num_dec_thread++;
  645|    168|            }
  646|       |
  647|    619|        }
  648|    451|        if(ps_dec->u4_output_present && (2 == ps_dec->u4_num_cores) &&
  ------------------
  |  Branch (648:12): [True: 195, False: 256]
  |  Branch (648:41): [True: 195, False: 0]
  ------------------
  649|    195|            (ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht))
  ------------------
  |  Branch (649:13): [True: 164, False: 31]
  ------------------
  650|    164|        {
  651|    164|            ps_dec->u4_fmt_conv_num_rows =
  652|    164|                            (ps_dec->s_disp_frame_info.u4_y_ht
  653|    164|                                            - ps_dec->u4_fmt_conv_cur_row);
  654|    164|            ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op),
  655|    164|                                ps_dec->u4_fmt_conv_cur_row,
  656|    164|                                ps_dec->u4_fmt_conv_num_rows);
  657|    164|            ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
  658|    164|        }
  659|       |
  660|    451|        if(ps_dec->i4_threads_active)
  ------------------
  |  Branch (660:12): [True: 0, False: 451]
  ------------------
  661|      0|        {
  662|      0|            ret = ithread_mutex_lock(ps_dec->apv_proc_done_mutex[0]);
  663|      0|            if(OK != ret)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (663:16): [True: 0, False: 0]
  ------------------
  664|      0|                break;
  665|       |
  666|      0|            ps_dec->ai4_process_done[0] = PROC_DONE;
  667|      0|            ithread_cond_signal(ps_dec->apv_proc_done_condition[0]);
  668|       |
  669|      0|            ret = ithread_mutex_unlock(ps_dec->apv_proc_done_mutex[0]);
  670|      0|            if(OK != ret)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (670:16): [True: 0, False: 0]
  ------------------
  671|      0|                break;
  672|      0|        }
  673|    451|        else
  674|    451|        {
  675|    451|            break;
  676|    451|        }
  677|    451|    }
  678|    451|}
ih264d_signal_decode_thread:
  681|  1.93k|{
  682|  1.93k|    if(ps_dec->u4_dec_thread_created == 1)
  ------------------
  |  Branch (682:8): [True: 846, False: 1.08k]
  ------------------
  683|    846|    {
  684|    846|        if(ps_dec->i4_threads_active)
  ------------------
  |  Branch (684:12): [True: 0, False: 846]
  ------------------
  685|      0|        {
  686|      0|            proc_state_t i4_process_state;
  687|      0|            ithread_mutex_lock(ps_dec->apv_proc_start_mutex[0]);
  688|      0|            i4_process_state = ps_dec->ai4_process_start[0];
  689|      0|            ithread_mutex_unlock(ps_dec->apv_proc_start_mutex[0]);
  690|       |
  691|       |            // only wait if the thread has started decoding
  692|      0|            if(i4_process_state != PROC_INIT)
  ------------------
  |  Branch (692:16): [True: 0, False: 0]
  ------------------
  693|      0|            {
  694|      0|                ithread_mutex_lock(ps_dec->apv_proc_done_mutex[0]);
  695|       |
  696|      0|                while(ps_dec->ai4_process_done[0] != PROC_DONE)
  ------------------
  |  Branch (696:23): [True: 0, False: 0]
  ------------------
  697|      0|                {
  698|      0|                    ithread_cond_wait(ps_dec->apv_proc_done_condition[0],
  699|      0|                                        ps_dec->apv_proc_done_mutex[0]);
  700|      0|                }
  701|      0|                ps_dec->ai4_process_done[0] = PROC_INIT;
  702|      0|                ithread_mutex_unlock(ps_dec->apv_proc_done_mutex[0]);
  703|      0|            }
  704|      0|        }
  705|    846|        else
  706|    846|        {
  707|       |            ithread_join(ps_dec->pv_dec_thread_handle, NULL);
  708|    846|            ps_dec->u4_dec_thread_created = 0;
  709|    846|        }
  710|    846|    }
  711|  1.93k|}

ih264d_is_end_of_pic:
   88|    536|{
   89|    536|    WORD8 i1_is_end_of_pic;
   90|    536|    WORD8 a, b, c, d, e, f, g, h;
   91|       |
   92|    536|    a = b = c = d = e = f = g = h = 0;
   93|    536|    a = (ps_prev_slice->u2_frame_num != u2_frame_num);
   94|    536|    b = (ps_prev_slice->u1_field_pic_flag != u1_field_pic_flag);
   95|    536|    if(u1_field_pic_flag && ps_prev_slice->u1_field_pic_flag)
  ------------------
  |  Branch (95:8): [True: 0, False: 536]
  |  Branch (95:29): [True: 0, False: 0]
  ------------------
   96|      0|        c = (u1_bottom_field_flag != ps_prev_slice->u1_bottom_field_flag);
   97|    536|    d =
   98|    536|                    (u1_nal_ref_idc == 0 && ps_prev_slice->u1_nal_ref_idc != 0)
  ------------------
  |  Branch (98:22): [True: 536, False: 0]
  |  Branch (98:45): [True: 0, False: 536]
  ------------------
   99|    536|                                    || (u1_nal_ref_idc != 0
  ------------------
  |  Branch (99:41): [True: 0, False: 536]
  ------------------
  100|      0|                                                    && ps_prev_slice->u1_nal_ref_idc
  ------------------
  |  Branch (100:56): [True: 0, False: 0]
  ------------------
  101|      0|                                                                    == 0);
  102|    536|    if(!a)
  ------------------
  |  Branch (102:8): [True: 535, False: 1]
  ------------------
  103|    535|    {
  104|    535|        if((u1_pic_order_cnt_type == 0)
  ------------------
  |  Branch (104:12): [True: 535, False: 0]
  ------------------
  105|    535|                        && (ps_prev_slice->u1_pic_order_cnt_type == 0))
  ------------------
  |  Branch (105:28): [True: 535, False: 0]
  ------------------
  106|    535|        {
  107|    535|            e =
  108|    535|                            ((ps_cur_poc->i4_pic_order_cnt_lsb
  ------------------
  |  Branch (108:30): [True: 0, False: 535]
  ------------------
  109|    535|                                            != ps_prev_poc->i4_pic_order_cnt_lsb)
  110|    535|                                            || (ps_cur_poc->i4_delta_pic_order_cnt_bottom
  ------------------
  |  Branch (110:48): [True: 0, False: 535]
  ------------------
  111|    535|                                                            != ps_prev_poc->i4_delta_pic_order_cnt_bottom));
  112|    535|        }
  113|       |
  114|    535|        if((u1_pic_order_cnt_type == 1)
  ------------------
  |  Branch (114:12): [True: 0, False: 535]
  ------------------
  115|      0|                        && (ps_prev_slice->u1_pic_order_cnt_type == 1))
  ------------------
  |  Branch (115:28): [True: 0, False: 0]
  ------------------
  116|      0|        {
  117|      0|            f =
  118|      0|                            ((ps_cur_poc->i4_delta_pic_order_cnt[0]
  ------------------
  |  Branch (118:30): [True: 0, False: 0]
  ------------------
  119|      0|                                            != ps_prev_poc->i4_delta_pic_order_cnt[0])
  120|      0|                                            || (ps_cur_poc->i4_delta_pic_order_cnt[1]
  ------------------
  |  Branch (120:48): [True: 0, False: 0]
  ------------------
  121|      0|                                                            != ps_prev_poc->i4_delta_pic_order_cnt[1]));
  122|      0|        }
  123|    535|    }
  124|       |
  125|    536|    if((u1_nal_unit_type == IDR_SLICE_NAL)
  ------------------
  |  |  328|    536|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (125:8): [True: 1, False: 535]
  ------------------
  126|      1|                    && (ps_prev_slice->u1_nal_unit_type == IDR_SLICE_NAL))
  ------------------
  |  |  328|      1|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (126:24): [True: 1, False: 0]
  ------------------
  127|      1|    {
  128|      1|        g = (u4_idr_pic_id != ps_prev_slice->u4_idr_pic_id);
  129|      1|    }
  130|       |
  131|    536|    if((u1_nal_unit_type == IDR_SLICE_NAL)
  ------------------
  |  |  328|    536|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (131:8): [True: 1, False: 535]
  ------------------
  132|      1|                    && (ps_prev_slice->u1_nal_unit_type != IDR_SLICE_NAL))
  ------------------
  |  |  328|      1|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (132:24): [True: 0, False: 1]
  ------------------
  133|      0|    {
  134|      0|        h = 1;
  135|      0|    }
  136|    536|    i1_is_end_of_pic = a + b + c + d + e + f + g + h;
  137|    536|    return (i1_is_end_of_pic);
  138|    536|}
ih264d_end_of_pic_processing:
  531|  3.42k|{
  532|  3.42k|    UWORD8 u1_pic_type, u1_nal_ref_idc;
  533|  3.42k|    dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice;
  534|       |
  535|       |    /* If nal_ref_idc is equal to 0 for one slice or slice data partition NAL
  536|       |     unit of a particular picture, it shall be equal to 0 for all slice and
  537|       |     slice data partition NAL units of the picture. nal_ref_idc greater
  538|       |     than 0 indicates that the content of the NAL unit belongs to a decoded
  539|       |     picture that is stored and marked for use as a reference picture in the
  540|       |     decoded picture buffer. */
  541|       |
  542|       |    /* 1. Do MMCO
  543|       |     2. Add Cur Pic to list of reference pics.
  544|       |     */
  545|       |
  546|       |    /* Call MMCO */
  547|  3.42k|    u1_pic_type = 0;
  548|  3.42k|    u1_nal_ref_idc = ps_cur_slice->u1_nal_ref_idc;
  549|       |
  550|  3.42k|    if(u1_nal_ref_idc)
  ------------------
  |  Branch (550:8): [True: 2.89k, False: 530]
  ------------------
  551|  2.89k|    {
  552|  2.89k|        if(ps_cur_slice->u1_nal_unit_type == IDR_SLICE_NAL)
  ------------------
  |  |  328|  2.89k|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (552:12): [True: 2.82k, False: 70]
  ------------------
  553|  2.82k|        {
  554|  2.82k|            ps_dec->ps_dpb_mgr->u1_mmco_error_in_seq = 0;
  555|  2.82k|            if(ps_dec->ps_dpb_cmds->u1_long_term_reference_flag == 0)
  ------------------
  |  Branch (555:16): [True: 1.94k, False: 880]
  ------------------
  556|  1.94k|            {
  557|  1.94k|                ih264d_reset_ref_bufs(ps_dec->ps_dpb_mgr);
  558|       |                /* ignore DPB errors */
  559|  1.94k|                ih264d_insert_st_node(ps_dec->ps_dpb_mgr,
  560|  1.94k|                                      ps_dec->ps_cur_pic,
  561|  1.94k|                                      ps_dec->u1_pic_buf_id,
  562|  1.94k|                                      ps_cur_slice->u2_frame_num);
  563|  1.94k|                ps_dec->ps_dpb_mgr->u1_max_lt_frame_idx = NO_LONG_TERM_INDICIES;
  ------------------
  |  |   53|  1.94k|#define NO_LONG_TERM_INDICIES      255
  ------------------
  564|  1.94k|            }
  565|    880|            else
  566|    880|            {
  567|       |                /* Equivalent of inserting a pic directly as longterm Pic */
  568|       |
  569|    880|                {
  570|       |                    /* ignore DPB errors */
  571|    880|                    ih264d_insert_st_node(ps_dec->ps_dpb_mgr,
  572|    880|                                          ps_dec->ps_cur_pic,
  573|    880|                                          ps_dec->u1_pic_buf_id,
  574|    880|                                          ps_cur_slice->u2_frame_num);
  575|       |
  576|       |                    /* Set longTermIdx = 0, MaxLongTermFrameIdx = 0 */
  577|    880|                    ih264d_delete_st_node_or_make_lt(
  578|    880|                                    ps_dec->ps_dpb_mgr,
  579|    880|                                    ps_cur_slice->u2_frame_num, 0,
  580|    880|                                    ps_cur_slice->u1_field_pic_flag);
  581|       |
  582|    880|                    ps_dec->ps_dpb_mgr->u1_max_lt_frame_idx = 0;
  583|    880|                }
  584|    880|            }
  585|  2.82k|        }
  586|     70|        else
  587|     70|        {
  588|       |
  589|     70|            {
  590|     70|                UWORD16 u2_pic_num = ps_cur_slice->u2_frame_num;
  591|       |
  592|     70|                if(!ps_dec->ps_dpb_mgr->u1_mmco_error_in_seq)
  ------------------
  |  Branch (592:20): [True: 57, False: 13]
  ------------------
  593|     57|                {
  594|     57|                    WORD32 ret = ih264d_do_mmco_buffer(ps_dec->ps_dpb_cmds, ps_dec->ps_dpb_mgr,
  595|     57|                                               ps_dec->ps_cur_sps->u1_num_ref_frames, u2_pic_num,
  596|     57|                                               (ps_dec->ps_cur_sps->u2_u4_max_pic_num_minus1),
  597|     57|                                               ps_dec->u1_nal_unit_type, ps_dec->ps_cur_pic,
  598|     57|                                               ps_dec->u1_pic_buf_id,
  599|     57|                                               ps_cur_slice->u1_field_pic_flag,
  600|     57|                                               ps_dec->e_dec_status);
  601|     57|                    ps_dec->ps_dpb_mgr->u1_mmco_error_in_seq = ret != OK;
  ------------------
  |  |  114|     57|#define OK        0
  ------------------
  602|     57|                }
  603|     70|            }
  604|     70|        }
  605|  2.89k|        ih264d_update_default_index_list(ps_dec->ps_dpb_mgr);
  606|  2.89k|    }
  607|       |
  608|  3.42k|    if(ps_cur_slice->u1_field_pic_flag)
  ------------------
  |  Branch (608:8): [True: 0, False: 3.42k]
  ------------------
  609|      0|    {
  610|      0|        if(ps_cur_slice->u1_bottom_field_flag)
  ------------------
  |  Branch (610:12): [True: 0, False: 0]
  ------------------
  611|      0|        {
  612|      0|            if(u1_nal_ref_idc)
  ------------------
  |  Branch (612:16): [True: 0, False: 0]
  ------------------
  613|      0|                u1_pic_type = u1_pic_type | BOT_REF;
  ------------------
  |  |  358|      0|#define BOT_REF         0x10
  ------------------
  614|      0|            u1_pic_type = u1_pic_type | BOT_FLD;
  ------------------
  |  |  354|      0|#define BOT_FLD         0x02
  ------------------
  615|      0|        }
  616|      0|        else
  617|      0|        {
  618|      0|            if(u1_nal_ref_idc)
  ------------------
  |  Branch (618:16): [True: 0, False: 0]
  ------------------
  619|      0|                u1_pic_type = u1_pic_type | TOP_REF;
  ------------------
  |  |  357|      0|#define TOP_REF         0x08
  ------------------
  620|      0|            u1_pic_type = u1_pic_type | TOP_FLD;
  ------------------
  |  |  353|      0|#define TOP_FLD         0x01
  ------------------
  621|      0|        }
  622|      0|    }
  623|  3.42k|    else
  624|  3.42k|        u1_pic_type = TOP_REF | BOT_REF;
  ------------------
  |  |  357|  3.42k|#define TOP_REF         0x08
  ------------------
                      u1_pic_type = TOP_REF | BOT_REF;
  ------------------
  |  |  358|  3.42k|#define BOT_REF         0x10
  ------------------
  625|  3.42k|    ps_dec->ps_cur_pic->u1_pic_type |= u1_pic_type;
  626|       |
  627|       |
  628|  3.42k|    if(ps_cur_slice->u1_field_pic_flag)
  ------------------
  |  Branch (628:8): [True: 0, False: 3.42k]
  ------------------
  629|      0|    {
  630|      0|        H264_DEC_DEBUG_PRINT("Toggling secondField\n");
  ------------------
  |  |   39|      0|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
  631|      0|        ps_dec->u1_second_field = 1 - ps_dec->u1_second_field;
  632|      0|    }
  633|       |
  634|  3.42k|    return OK;
  ------------------
  |  |  114|  3.42k|#define OK        0
  ------------------
  635|  3.42k|}
ih264d_get_dpb_size:
  659|  7.88k|{
  660|  7.88k|    WORD32 i4_size;
  661|  7.88k|    UWORD8 u1_level_idc;
  662|       |
  663|  7.88k|    u1_level_idc = ps_seq->u1_level_idc;
  664|       |
  665|  7.88k|    switch(u1_level_idc)
  666|  7.88k|    {
  667|      0|        case 10:
  ------------------
  |  Branch (667:9): [True: 0, False: 7.88k]
  ------------------
  668|      0|            i4_size = 152064;
  669|      0|            break;
  670|  1.47k|        case 11:
  ------------------
  |  Branch (670:9): [True: 1.47k, False: 6.40k]
  ------------------
  671|  1.47k|            i4_size = 345600;
  672|  1.47k|            break;
  673|     13|        case 12:
  ------------------
  |  Branch (673:9): [True: 13, False: 7.86k]
  ------------------
  674|     13|            i4_size = 912384;
  675|     13|            break;
  676|      0|        case 13:
  ------------------
  |  Branch (676:9): [True: 0, False: 7.88k]
  ------------------
  677|      0|            i4_size = 912384;
  678|      0|            break;
  679|  1.39k|        case 20:
  ------------------
  |  Branch (679:9): [True: 1.39k, False: 6.48k]
  ------------------
  680|  1.39k|            i4_size = 912384;
  681|  1.39k|            break;
  682|     79|        case 21:
  ------------------
  |  Branch (682:9): [True: 79, False: 7.80k]
  ------------------
  683|     79|            i4_size = 1824768;
  684|     79|            break;
  685|      0|        case 22:
  ------------------
  |  Branch (685:9): [True: 0, False: 7.88k]
  ------------------
  686|      0|            i4_size = 3110400;
  687|      0|            break;
  688|      2|        case 30:
  ------------------
  |  Branch (688:9): [True: 2, False: 7.87k]
  ------------------
  689|      2|            i4_size = 3110400;
  690|      2|            break;
  691|     13|        case 31:
  ------------------
  |  Branch (691:9): [True: 13, False: 7.86k]
  ------------------
  692|     13|            i4_size = 6912000;
  693|     13|            break;
  694|     94|        case 32:
  ------------------
  |  Branch (694:9): [True: 94, False: 7.78k]
  ------------------
  695|     94|            i4_size = 7864320;
  696|     94|            break;
  697|     23|        case 40:
  ------------------
  |  Branch (697:9): [True: 23, False: 7.85k]
  ------------------
  698|     23|            i4_size = 12582912;
  699|     23|            break;
  700|  4.69k|        case 41:
  ------------------
  |  Branch (700:9): [True: 4.69k, False: 3.18k]
  ------------------
  701|  4.69k|            i4_size = 12582912;
  702|  4.69k|            break;
  703|      0|        case 42:
  ------------------
  |  Branch (703:9): [True: 0, False: 7.88k]
  ------------------
  704|      0|            i4_size = 12582912;
  705|      0|            break;
  706|      4|        case 50:
  ------------------
  |  Branch (706:9): [True: 4, False: 7.87k]
  ------------------
  707|      4|            i4_size = 42393600;
  708|      4|            break;
  709|      0|        case 51:
  ------------------
  |  Branch (709:9): [True: 0, False: 7.88k]
  ------------------
  710|      0|            i4_size = 70778880;
  711|      0|            break;
  712|      0|        case 52:
  ------------------
  |  Branch (712:9): [True: 0, False: 7.88k]
  ------------------
  713|      0|            i4_size = 70778880;
  714|      0|            break;
  715|     91|        default:
  ------------------
  |  Branch (715:9): [True: 91, False: 7.79k]
  ------------------
  716|     91|            i4_size = 70778880;
  717|     91|            break;
  718|  7.88k|    }
  719|       |
  720|  7.88k|    i4_size /= (ps_seq->u2_frm_wd_in_mbs * (ps_seq->u2_frm_ht_in_mbs << (1 - ps_seq->u1_frame_mbs_only_flag)));
  721|  7.88k|    i4_size /= 384;
  722|  7.88k|    i4_size = MIN(i4_size, 16);
  ------------------
  |  |   61|  7.88k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 158, False: 7.72k]
  |  |  ------------------
  ------------------
  723|  7.88k|    i4_size = MAX(i4_size, 1);
  ------------------
  |  |   60|  7.88k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 7.88k, False: 0]
  |  |  ------------------
  ------------------
  724|  7.88k|    return (i4_size);
  725|  7.88k|}
ih264d_init_dec_mb_grp:
  737|    160|{
  738|    160|    dec_seq_params_t *ps_seq = ps_dec->ps_cur_sps;
  739|    160|    UWORD8 u1_frm = ps_seq->u1_frame_mbs_only_flag;
  740|       |
  741|    160|    ps_dec->u4_recon_mb_grp = ps_dec->u2_frm_wd_in_mbs << ps_seq->u1_mb_aff_flag;
  742|       |
  743|    160|    ps_dec->u4_recon_mb_grp_pair = ps_dec->u4_recon_mb_grp >> 1;
  744|       |
  745|    160|    if(!ps_dec->u4_recon_mb_grp)
  ------------------
  |  Branch (745:8): [True: 0, False: 160]
  ------------------
  746|      0|    {
  747|      0|        return ERROR_MB_GROUP_ASSGN_T;
  748|      0|    }
  749|       |
  750|    160|    ps_dec->u4_num_mbs_prev_nmb = ps_dec->u4_recon_mb_grp;
  751|       |
  752|    160|    return OK;
  ------------------
  |  |  114|    160|#define OK        0
  ------------------
  753|    160|}
ih264d_get_next_display_field:
  979|  5.17k|{
  980|  5.17k|    pic_buffer_t *pic_buf;
  981|       |
  982|  5.17k|    UWORD8 i1_cur_fld;
  983|  5.17k|    WORD32 u4_api_ret = -1;
  984|  5.17k|    WORD32 i4_disp_buf_id;
  985|  5.17k|    iv_yuv_buf_t *ps_op_frm;
  986|       |
  987|       |
  988|       |
  989|  5.17k|    ps_op_frm = &(ps_dec->s_disp_frame_info);
  990|  5.17k|    H264_MUTEX_LOCK(&ps_dec->process_disp_mutex);
  991|  5.17k|    pic_buf = (pic_buffer_t *)ih264_disp_mgr_get(
  992|  5.17k|                    (disp_mgr_t *)ps_dec->pv_disp_buf_mgr, &i4_disp_buf_id);
  993|  5.17k|    ps_dec->u4_num_fld_in_frm = 0;
  994|  5.17k|    u4_api_ret = -1;
  995|  5.17k|    pv_disp_op->u4_ts = 0;
  996|  5.17k|    pv_disp_op->e_output_format = ps_dec->u1_chroma_format;
  997|       |
  998|  5.17k|    pv_disp_op->s_disp_frm_buf.pv_y_buf = ps_out_buffer->pu1_bufs[0];
  999|  5.17k|    pv_disp_op->s_disp_frm_buf.pv_u_buf = ps_out_buffer->pu1_bufs[1];
 1000|  5.17k|    pv_disp_op->s_disp_frm_buf.pv_v_buf = ps_out_buffer->pu1_bufs[2];
 1001|  5.17k|    ps_dec->i4_display_index  = DEFAULT_POC;
  ------------------
  |  |   45|  5.17k|#define DEFAULT_POC 0x7FFFFFFF
  ------------------
 1002|  5.17k|    if(pic_buf != NULL)
  ------------------
  |  Branch (1002:8): [True: 3.03k, False: 2.14k]
  ------------------
 1003|  3.03k|    {
 1004|  3.03k|        ps_dec->pv_disp_sei_params = &pic_buf->s_sei_pic;
 1005|  3.03k|        pv_disp_op->e4_fld_type = 0;
 1006|  3.03k|        pv_disp_op->u4_disp_buf_id = i4_disp_buf_id;
 1007|       |
 1008|  3.03k|        ps_op_frm->u4_y_ht = pic_buf->u2_disp_height << 1;
 1009|  3.03k|        ps_op_frm->u4_u_ht = ps_op_frm->u4_v_ht = ps_op_frm->u4_y_ht >> 1;
 1010|  3.03k|        ps_op_frm->u4_y_wd = pic_buf->u2_disp_width;
 1011|       |
 1012|  3.03k|        ps_op_frm->u4_u_wd = ps_op_frm->u4_v_wd = ps_op_frm->u4_y_wd >> 1;
 1013|       |
 1014|  3.03k|        ps_op_frm->u4_y_strd = pic_buf->u2_frm_wd_y;
 1015|  3.03k|        ps_op_frm->u4_u_strd = ps_op_frm->u4_v_strd = pic_buf->u2_frm_wd_uv;
 1016|       |
 1017|       |        /* ! */
 1018|  3.03k|        pv_disp_op->u4_ts = pic_buf->u4_ts;
 1019|  3.03k|        ps_dec->i4_display_index = pic_buf->i4_poc;
 1020|       |
 1021|       |        /* set the start of the Y, U and V buffer pointer for display    */
 1022|  3.03k|        ps_op_frm->pv_y_buf = pic_buf->pu1_buf1 + pic_buf->u2_crop_offset_y;
 1023|  3.03k|        ps_op_frm->pv_u_buf = pic_buf->pu1_buf2 + pic_buf->u2_crop_offset_uv;
 1024|  3.03k|        ps_op_frm->pv_v_buf = pic_buf->pu1_buf3 + pic_buf->u2_crop_offset_uv;
 1025|  3.03k|        ps_dec->u4_num_fld_in_frm++;
 1026|  3.03k|        ps_dec->u4_num_fld_in_frm++;
 1027|  3.03k|        u4_api_ret = 0;
 1028|       |
 1029|  3.03k|        if(pic_buf->u1_picturetype == 0)
  ------------------
  |  Branch (1029:12): [True: 3.03k, False: 0]
  ------------------
 1030|  3.03k|            pv_disp_op->u4_progressive_frame_flag = 1;
 1031|      0|        else
 1032|      0|            pv_disp_op->u4_progressive_frame_flag = 0;
 1033|       |
 1034|  3.03k|    } H264_MUTEX_UNLOCK(&ps_dec->process_disp_mutex);
 1035|  5.17k|    pv_disp_op->u4_error_code = u4_api_ret;
 1036|  5.17k|    pv_disp_op->e_pic_type = 0xFFFFFFFF; //Junk;
 1037|       |
 1038|  5.17k|    if(u4_api_ret)
  ------------------
  |  Branch (1038:8): [True: 2.14k, False: 3.03k]
  ------------------
 1039|  2.14k|    {
 1040|  2.14k|        pv_disp_op->u4_error_code = 1; //put a proper error code here
 1041|  2.14k|    }
 1042|  3.03k|    else
 1043|  3.03k|    {
 1044|       |
 1045|       |        //Release the buffer if being sent for display
 1046|  3.03k|        UWORD32 temp;
 1047|  3.03k|        UWORD32 dest_inc_Y = 0, dest_inc_UV = 0;
 1048|       |
 1049|  3.03k|        pv_disp_op->s_disp_frm_buf.u4_y_wd = temp = MIN(ps_op_frm->u4_y_wd,
  ------------------
  |  |   61|  3.03k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 3.03k, False: 0]
  |  |  ------------------
  ------------------
 1050|  3.03k|                                                        ps_op_frm->u4_y_strd);
 1051|  3.03k|        pv_disp_op->s_disp_frm_buf.u4_u_wd = pv_disp_op->s_disp_frm_buf.u4_y_wd
 1052|  3.03k|                        >> 1;
 1053|  3.03k|        pv_disp_op->s_disp_frm_buf.u4_v_wd = pv_disp_op->s_disp_frm_buf.u4_y_wd
 1054|  3.03k|                        >> 1;
 1055|       |
 1056|  3.03k|        pv_disp_op->s_disp_frm_buf.u4_y_ht = ps_op_frm->u4_y_ht;
 1057|  3.03k|        pv_disp_op->s_disp_frm_buf.u4_u_ht = pv_disp_op->s_disp_frm_buf.u4_y_ht
 1058|  3.03k|                        >> 1;
 1059|  3.03k|        pv_disp_op->s_disp_frm_buf.u4_v_ht = pv_disp_op->s_disp_frm_buf.u4_y_ht
 1060|  3.03k|                        >> 1;
 1061|  3.03k|        if(0 == ps_dec->u4_share_disp_buf)
  ------------------
  |  Branch (1061:12): [True: 3.03k, False: 0]
  ------------------
 1062|  3.03k|        {
 1063|  3.03k|            pv_disp_op->s_disp_frm_buf.u4_y_strd =
 1064|  3.03k|                            pv_disp_op->s_disp_frm_buf.u4_y_wd;
 1065|  3.03k|            pv_disp_op->s_disp_frm_buf.u4_u_strd =
 1066|  3.03k|                            pv_disp_op->s_disp_frm_buf.u4_y_wd >> 1;
 1067|  3.03k|            pv_disp_op->s_disp_frm_buf.u4_v_strd =
 1068|  3.03k|                            pv_disp_op->s_disp_frm_buf.u4_y_wd >> 1;
 1069|       |
 1070|  3.03k|        }
 1071|      0|        else
 1072|      0|        {
 1073|      0|            pv_disp_op->s_disp_frm_buf.u4_y_strd = ps_op_frm->u4_y_strd;
 1074|      0|        }
 1075|       |
 1076|  3.03k|        if(ps_dec->u4_app_disp_width)
  ------------------
  |  Branch (1076:12): [True: 0, False: 3.03k]
  ------------------
 1077|      0|        {
 1078|      0|            pv_disp_op->s_disp_frm_buf.u4_y_strd = MAX(
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1079|      0|                            ps_dec->u4_app_disp_width,
 1080|      0|                            pv_disp_op->s_disp_frm_buf.u4_y_strd);
 1081|      0|        }
 1082|       |
 1083|  3.03k|        pv_disp_op->u4_error_code = 0;
 1084|  3.03k|        if(pv_disp_op->e_output_format == IV_YUV_420P)
  ------------------
  |  Branch (1084:12): [True: 763, False: 2.27k]
  ------------------
 1085|    763|        {
 1086|    763|            UWORD32 i;
 1087|    763|            pv_disp_op->s_disp_frm_buf.u4_u_strd =
 1088|    763|                            pv_disp_op->s_disp_frm_buf.u4_y_strd >> 1;
 1089|    763|            pv_disp_op->s_disp_frm_buf.u4_v_strd =
 1090|    763|                            pv_disp_op->s_disp_frm_buf.u4_y_strd >> 1;
 1091|       |
 1092|    763|            pv_disp_op->s_disp_frm_buf.u4_u_wd = ps_op_frm->u4_y_wd >> 1;
 1093|    763|            pv_disp_op->s_disp_frm_buf.u4_v_wd = ps_op_frm->u4_y_wd >> 1;
 1094|       |
 1095|    763|            if(1 == ps_dec->u4_share_disp_buf)
  ------------------
  |  Branch (1095:16): [True: 0, False: 763]
  ------------------
 1096|      0|            {
 1097|      0|                pv_disp_op->s_disp_frm_buf.pv_y_buf = ps_op_frm->pv_y_buf;
 1098|       |
 1099|      0|                for(i = 0; i < MAX_DISP_BUFS_NEW; i++)
  ------------------
  |  |   76|      0|#define MAX_DISP_BUFS_NEW 64
  ------------------
  |  Branch (1099:28): [True: 0, False: 0]
  ------------------
 1100|      0|                {
 1101|      0|                    UWORD8 *buf = ps_dec->disp_bufs[i].buf[0];
 1102|      0|                    buf += ps_dec->disp_bufs[i].u4_ofst[0];
 1103|      0|                    if(((UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_y_buf
  ------------------
  |  Branch (1103:24): [True: 0, False: 0]
  ------------------
 1104|      0|                                    - pic_buf->u2_crop_offset_y) == buf)
 1105|      0|                    {
 1106|      0|                        buf = ps_dec->disp_bufs[i].buf[1];
 1107|      0|                        buf += ps_dec->disp_bufs[i].u4_ofst[1];
 1108|      0|                        pv_disp_op->s_disp_frm_buf.pv_u_buf = buf
 1109|      0|                                        + (pic_buf->u2_crop_offset_uv
 1110|      0|                                           / YUV420SP_FACTOR);
  ------------------
  |  |  119|      0|#define YUV420SP_FACTOR 2
  ------------------
 1111|       |
 1112|      0|                        buf = ps_dec->disp_bufs[i].buf[2];
 1113|      0|                        buf += ps_dec->disp_bufs[i].u4_ofst[2];
 1114|      0|                        pv_disp_op->s_disp_frm_buf.pv_v_buf = buf
 1115|      0|                                        + (pic_buf->u2_crop_offset_uv
 1116|      0|                                           / YUV420SP_FACTOR);
  ------------------
  |  |  119|      0|#define YUV420SP_FACTOR 2
  ------------------
 1117|       |
 1118|      0|                    }
 1119|      0|                }
 1120|      0|            }
 1121|       |
 1122|    763|        }
 1123|  2.27k|        else if((pv_disp_op->e_output_format == IV_YUV_420SP_UV)
  ------------------
  |  Branch (1123:17): [True: 1.67k, False: 595]
  ------------------
 1124|    595|                        || (pv_disp_op->e_output_format == IV_YUV_420SP_VU))
  ------------------
  |  Branch (1124:28): [True: 595, False: 0]
  ------------------
 1125|  2.27k|        {
 1126|  2.27k|            pv_disp_op->s_disp_frm_buf.u4_u_strd =
 1127|  2.27k|                            pv_disp_op->s_disp_frm_buf.u4_y_strd;
 1128|  2.27k|            pv_disp_op->s_disp_frm_buf.u4_v_strd = 0;
 1129|       |
 1130|  2.27k|            if(1 == ps_dec->u4_share_disp_buf)
  ------------------
  |  Branch (1130:16): [True: 0, False: 2.27k]
  ------------------
 1131|      0|            {
 1132|      0|                UWORD32 i;
 1133|       |
 1134|      0|                pv_disp_op->s_disp_frm_buf.pv_y_buf = ps_op_frm->pv_y_buf;
 1135|       |
 1136|      0|                for(i = 0; i < MAX_DISP_BUFS_NEW; i++)
  ------------------
  |  |   76|      0|#define MAX_DISP_BUFS_NEW 64
  ------------------
  |  Branch (1136:28): [True: 0, False: 0]
  ------------------
 1137|      0|                {
 1138|      0|                    UWORD8 *buf = ps_dec->disp_bufs[i].buf[0];
 1139|      0|                    buf += ps_dec->disp_bufs[i].u4_ofst[0];
 1140|      0|                    if((UWORD8 *)pv_disp_op->s_disp_frm_buf.pv_y_buf
  ------------------
  |  Branch (1140:24): [True: 0, False: 0]
  ------------------
 1141|      0|                                    - pic_buf->u2_crop_offset_y == buf)
 1142|      0|                    {
 1143|      0|                        buf = ps_dec->disp_bufs[i].buf[1];
 1144|      0|                        buf += ps_dec->disp_bufs[i].u4_ofst[1];
 1145|      0|                        pv_disp_op->s_disp_frm_buf.pv_u_buf = buf
 1146|      0|                                        + pic_buf->u2_crop_offset_uv;
 1147|      0|                        ;
 1148|       |
 1149|      0|                        buf = ps_dec->disp_bufs[i].buf[2];
 1150|      0|                        buf += ps_dec->disp_bufs[i].u4_ofst[2];
 1151|      0|                        pv_disp_op->s_disp_frm_buf.pv_v_buf = buf
 1152|      0|                                        + pic_buf->u2_crop_offset_uv;
 1153|      0|                        ;
 1154|      0|                    }
 1155|      0|                }
 1156|      0|            }
 1157|  2.27k|            pv_disp_op->s_disp_frm_buf.u4_u_wd =
 1158|  2.27k|                            pv_disp_op->s_disp_frm_buf.u4_y_wd;
 1159|  2.27k|            pv_disp_op->s_disp_frm_buf.u4_v_wd = 0;
 1160|       |
 1161|  2.27k|        }
 1162|      0|        else if((pv_disp_op->e_output_format == IV_RGB_565)
  ------------------
  |  Branch (1162:17): [True: 0, False: 0]
  ------------------
 1163|      0|                        || (pv_disp_op->e_output_format == IV_YUV_422ILE))
  ------------------
  |  Branch (1163:28): [True: 0, False: 0]
  ------------------
 1164|      0|        {
 1165|       |
 1166|      0|            pv_disp_op->s_disp_frm_buf.u4_u_strd = 0;
 1167|      0|            pv_disp_op->s_disp_frm_buf.u4_v_strd = 0;
 1168|      0|            pv_disp_op->s_disp_frm_buf.u4_u_wd = 0;
 1169|      0|            pv_disp_op->s_disp_frm_buf.u4_v_wd = 0;
 1170|      0|            pv_disp_op->s_disp_frm_buf.u4_u_ht = 0;
 1171|      0|            pv_disp_op->s_disp_frm_buf.u4_v_ht = 0;
 1172|       |
 1173|      0|        }
 1174|       |
 1175|       |
 1176|  3.03k|    }
 1177|       |
 1178|  5.17k|    return u4_api_ret;
 1179|  5.17k|}
ih264d_release_display_field:
 1203|  3.42k|{
 1204|  3.42k|    if(1 == pv_disp_op->u4_error_code)
  ------------------
  |  Branch (1204:8): [True: 1.52k, False: 1.89k]
  ------------------
 1205|  1.52k|    {
 1206|  1.52k|        if(1 == ps_dec->u1_flushfrm)
  ------------------
  |  Branch (1206:12): [True: 0, False: 1.52k]
  ------------------
 1207|      0|        {
 1208|      0|            UWORD32 i;
 1209|       |
 1210|      0|            if(1 == ps_dec->u4_share_disp_buf)
  ------------------
  |  Branch (1210:16): [True: 0, False: 0]
  ------------------
 1211|      0|            {
 1212|      0|                H264_MUTEX_LOCK(&ps_dec->process_disp_mutex);
 1213|      0|                for(i = 0; i < (MAX_DISP_BUFS_NEW); i++)
  ------------------
  |  |   76|      0|#define MAX_DISP_BUFS_NEW 64
  ------------------
  |  Branch (1213:28): [True: 0, False: 0]
  ------------------
 1214|      0|                {
 1215|      0|                    if(1 == ps_dec->u4_disp_buf_mapping[i])
  ------------------
  |  Branch (1215:24): [True: 0, False: 0]
  ------------------
 1216|      0|                    {
 1217|      0|                        ih264_buf_mgr_release(
 1218|      0|                                        (buf_mgr_t *)ps_dec->pv_pic_buf_mgr, i,
 1219|      0|                                        BUF_MGR_IO);
  ------------------
  |  |   53|      0|#define BUF_MGR_IO           (1 << 3)
  ------------------
 1220|      0|                        ps_dec->u4_disp_buf_mapping[i] = 0;
 1221|      0|                    }
 1222|      0|                } H264_MUTEX_UNLOCK(&ps_dec->process_disp_mutex);
 1223|       |
 1224|      0|                memset(ps_dec->u4_disp_buf_to_be_freed, 0,
 1225|      0|                       (MAX_DISP_BUFS_NEW) * sizeof(UWORD32));
  ------------------
  |  |   76|      0|#define MAX_DISP_BUFS_NEW 64
  ------------------
 1226|      0|                for(i = 0; i < ps_dec->u1_pic_bufs; i++)
  ------------------
  |  Branch (1226:28): [True: 0, False: 0]
  ------------------
 1227|      0|                    ps_dec->u4_disp_buf_mapping[i] = 1;
 1228|      0|            }
 1229|      0|            ps_dec->u1_flushfrm = 0;
 1230|       |
 1231|      0|        }
 1232|  1.52k|    }
 1233|  1.89k|    else
 1234|  1.89k|    {
 1235|  1.89k|        H264_MUTEX_LOCK(&ps_dec->process_disp_mutex);
 1236|       |
 1237|  1.89k|        if(0 == ps_dec->u4_share_disp_buf)
  ------------------
  |  Branch (1237:12): [True: 1.89k, False: 0]
  ------------------
 1238|  1.89k|        {
 1239|  1.89k|            ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr,
 1240|  1.89k|                                  pv_disp_op->u4_disp_buf_id,
 1241|  1.89k|                                  BUF_MGR_IO);
  ------------------
  |  |   53|  1.89k|#define BUF_MGR_IO           (1 << 3)
  ------------------
 1242|       |
 1243|  1.89k|        }
 1244|      0|        else
 1245|      0|        {
 1246|      0|            ps_dec->u4_disp_buf_mapping[pv_disp_op->u4_disp_buf_id] = 1;
 1247|      0|        } H264_MUTEX_UNLOCK(&ps_dec->process_disp_mutex);
 1248|       |
 1249|  1.89k|    }
 1250|  3.42k|}
ih264d_assign_display_seq:
 1274|  3.42k|{
 1275|  3.42k|    WORD32 i;
 1276|  3.42k|    WORD32 i4_min_poc;
 1277|  3.42k|    WORD32 i4_min_poc_buf_id;
 1278|  3.42k|    WORD32 i4_min_index;
 1279|  3.42k|    dpb_manager_t *ps_dpb_mgr = ps_dec->ps_dpb_mgr;
 1280|  3.42k|    WORD32 (*i4_poc_buf_id_map)[3] = ps_dpb_mgr->ai4_poc_buf_id_map;
 1281|       |
 1282|  3.42k|    i4_min_poc = 0x7fffffff;
 1283|  3.42k|    i4_min_poc_buf_id = -1;
 1284|  3.42k|    i4_min_index = -1;
 1285|       |
 1286|  3.42k|    if(ps_dpb_mgr->i1_poc_buf_id_entries >= ps_dec->i4_display_delay)
  ------------------
  |  Branch (1286:8): [True: 221, False: 3.20k]
  ------------------
 1287|    221|    {
 1288|  3.75k|        for(i = 0; i < MAX_FRAMES; i++)
  ------------------
  |  |  600|  3.75k|#define MAX_FRAMES              16
  ------------------
  |  Branch (1288:20): [True: 3.53k, False: 221]
  ------------------
 1289|  3.53k|        {
 1290|  3.53k|            if((i4_poc_buf_id_map[i][0] != -1)
  ------------------
  |  Branch (1290:16): [True: 2.99k, False: 540]
  ------------------
 1291|  2.99k|                            && (DO_NOT_DISP
  ------------------
  |  |  602|  2.99k|#define DO_NOT_DISP             254
  ------------------
  |  Branch (1291:32): [True: 2.99k, False: 0]
  ------------------
 1292|  2.99k|                                            != ps_dpb_mgr->ai4_poc_buf_id_map[i][0]))
 1293|  2.99k|            {
 1294|       |                /* Checking for <= is necessary to handle cases where there is one
 1295|       |                   valid buffer with poc set to 0x7FFFFFFF. */
 1296|  2.99k|                if(i4_poc_buf_id_map[i][1] <= i4_min_poc)
  ------------------
  |  Branch (1296:20): [True: 1.02k, False: 1.97k]
  ------------------
 1297|  1.02k|                {
 1298|  1.02k|                    i4_min_poc = i4_poc_buf_id_map[i][1];
 1299|  1.02k|                    i4_min_poc_buf_id = i4_poc_buf_id_map[i][0];
 1300|  1.02k|                    i4_min_index = i;
 1301|  1.02k|                }
 1302|  2.99k|            }
 1303|  3.53k|        }
 1304|       |
 1305|    221|        if((i4_min_index != -1) && (DO_NOT_DISP != i4_min_poc_buf_id))
  ------------------
  |  |  602|    221|#define DO_NOT_DISP             254
  ------------------
  |  Branch (1305:12): [True: 221, False: 0]
  |  Branch (1305:36): [True: 221, False: 0]
  ------------------
 1306|    221|        {
 1307|    221|            ps_dec->i4_cur_display_seq++;
 1308|    221|            ih264_disp_mgr_add(
 1309|    221|                            (disp_mgr_t *)ps_dec->pv_disp_buf_mgr,
 1310|    221|                            i4_min_poc_buf_id, ps_dec->i4_cur_display_seq,
 1311|    221|                            ps_dec->apv_buf_id_pic_buf_map[i4_min_poc_buf_id]);
 1312|    221|            i4_poc_buf_id_map[i4_min_index][0] = -1;
 1313|    221|            i4_poc_buf_id_map[i4_min_index][1] = 0x7fffffff;
 1314|    221|            ps_dpb_mgr->i1_poc_buf_id_entries--;
 1315|    221|        }
 1316|      0|        else if(DO_NOT_DISP == i4_min_poc_buf_id)
  ------------------
  |  |  602|      0|#define DO_NOT_DISP             254
  ------------------
  |  Branch (1316:17): [True: 0, False: 0]
  ------------------
 1317|      0|        {
 1318|      0|            WORD32 i4_error_code;
 1319|      0|            i4_error_code = ERROR_GAPS_IN_FRM_NUM;
 1320|       |//          i4_error_code |= 1<<IVD_CORRUPTEDDATA;
 1321|      0|            return i4_error_code;
 1322|      0|        }
 1323|    221|    }
 1324|  3.42k|    return OK;
  ------------------
  |  |  114|  3.42k|#define OK        0
  ------------------
 1325|  3.42k|}
ih264d_release_display_bufs:
 1350|  2.87k|{
 1351|  2.87k|    WORD32 i, j;
 1352|  2.87k|    WORD32 i4_min_poc;
 1353|  2.87k|    WORD32 i4_min_poc_buf_id;
 1354|  2.87k|    WORD32 i4_min_index;
 1355|  2.87k|    WORD64 i8_temp;
 1356|  2.87k|    dpb_manager_t *ps_dpb_mgr = ps_dec->ps_dpb_mgr;
 1357|  2.87k|    WORD32 (*i4_poc_buf_id_map)[3] = ps_dpb_mgr->ai4_poc_buf_id_map;
 1358|       |
 1359|  2.87k|    i4_min_poc = 0x7fffffff;
 1360|  2.87k|    i4_min_poc_buf_id = 0;
 1361|  2.87k|    i4_min_index = 0;
 1362|       |
 1363|  2.87k|    ih264d_delete_nonref_nondisplay_pics(ps_dpb_mgr);
 1364|       |
 1365|  5.82k|    for(j = 0; j < ps_dpb_mgr->i1_poc_buf_id_entries; j++)
  ------------------
  |  Branch (1365:16): [True: 2.94k, False: 2.87k]
  ------------------
 1366|  2.94k|    {
 1367|  2.94k|        i4_min_poc = 0x7fffffff;
 1368|  50.0k|        for(i = 0; i < MAX_FRAMES; i++)
  ------------------
  |  |  600|  50.0k|#define MAX_FRAMES              16
  ------------------
  |  Branch (1368:20): [True: 47.1k, False: 2.94k]
  ------------------
 1369|  47.1k|        {
 1370|  47.1k|            if(i4_poc_buf_id_map[i][0] != -1)
  ------------------
  |  Branch (1370:16): [True: 4.13k, False: 43.0k]
  ------------------
 1371|  4.13k|            {
 1372|       |                /* Checking for <= is necessary to handle cases where there is one
 1373|       |                   valid buffer with poc set to 0x7FFFFFFF. */
 1374|  4.13k|                if(i4_poc_buf_id_map[i][1] <= i4_min_poc)
  ------------------
  |  Branch (1374:20): [True: 3.30k, False: 827]
  ------------------
 1375|  3.30k|                {
 1376|  3.30k|                    i4_min_poc = i4_poc_buf_id_map[i][1];
 1377|  3.30k|                    i4_min_poc_buf_id = i4_poc_buf_id_map[i][0];
 1378|  3.30k|                    i4_min_index = i;
 1379|  3.30k|                }
 1380|  4.13k|            }
 1381|  47.1k|        }
 1382|       |
 1383|  2.94k|        if(DO_NOT_DISP != i4_min_poc_buf_id)
  ------------------
  |  |  602|  2.94k|#define DO_NOT_DISP             254
  ------------------
  |  Branch (1383:12): [True: 2.94k, False: 0]
  ------------------
 1384|  2.94k|        {
 1385|  2.94k|            ps_dec->i4_cur_display_seq++;
 1386|  2.94k|            ih264_disp_mgr_add(
 1387|  2.94k|                            (disp_mgr_t *)ps_dec->pv_disp_buf_mgr,
 1388|  2.94k|                            i4_min_poc_buf_id, ps_dec->i4_cur_display_seq,
 1389|  2.94k|                            ps_dec->apv_buf_id_pic_buf_map[i4_min_poc_buf_id]);
 1390|  2.94k|            i4_poc_buf_id_map[i4_min_index][0] = -1;
 1391|  2.94k|            i4_poc_buf_id_map[i4_min_index][1] = 0x7fffffff;
 1392|  2.94k|            ps_dpb_mgr->ai4_poc_buf_id_map[i4_min_index][2] = 0;
 1393|  2.94k|        }
 1394|      0|        else
 1395|      0|        {
 1396|      0|            i4_poc_buf_id_map[i4_min_index][0] = -1;
 1397|      0|            i4_poc_buf_id_map[i4_min_index][1] = 0x7fffffff;
 1398|      0|            ps_dpb_mgr->ai4_poc_buf_id_map[i4_min_index][2] = 0;
 1399|      0|        }
 1400|  2.94k|    }
 1401|  2.87k|    ps_dpb_mgr->i1_poc_buf_id_entries = 0;
 1402|  2.87k|    i8_temp = (WORD64)ps_dec->i4_prev_max_display_seq + ps_dec->i4_max_poc
 1403|  2.87k|              + ps_dec->u1_max_dec_frame_buffering + 1;
 1404|       |    /*If i4_prev_max_display_seq overflows integer range, reset it */
 1405|  2.87k|    ps_dec->i4_prev_max_display_seq = IS_OUT_OF_RANGE_S32(i8_temp)?
  ------------------
  |  |   58|  2.87k|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 2.87k]
  |  |  |  Branch (58:54): [True: 0, False: 2.87k]
  |  |  ------------------
  ------------------
 1406|  2.87k|                                      0 : i8_temp;
 1407|  2.87k|    ps_dec->i4_max_poc = 0;
 1408|  2.87k|}
ih264d_assign_pic_num:
 1440|  4.09k|{
 1441|  4.09k|    dpb_manager_t *ps_dpb_mgr;
 1442|  4.09k|    struct dpb_info_t *ps_next_dpb;
 1443|  4.09k|    WORD8 i;
 1444|  4.09k|    WORD32 i4_cur_frame_num, i4_max_frame_num;
 1445|  4.09k|    WORD32 i4_ref_frame_num;
 1446|  4.09k|    UWORD8 u1_fld_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag;
 1447|       |
 1448|  4.09k|    i4_max_frame_num = ps_dec->ps_cur_sps->u2_u4_max_pic_num_minus1 + 1;
 1449|  4.09k|    i4_cur_frame_num = ps_dec->ps_cur_pic->i4_frame_num;
 1450|  4.09k|    ps_dpb_mgr = ps_dec->ps_dpb_mgr;
 1451|       |
 1452|       |    /* Start from ST head */
 1453|  4.09k|    ps_next_dpb = ps_dpb_mgr->ps_dpb_st_head;
 1454|  6.61k|    for(i = 0; i < ps_dpb_mgr->u1_num_st_ref_bufs; i++)
  ------------------
  |  Branch (1454:16): [True: 2.52k, False: 4.09k]
  ------------------
 1455|  2.52k|    {
 1456|  2.52k|        WORD32 i4_pic_num;
 1457|       |
 1458|  2.52k|        i4_ref_frame_num = ps_next_dpb->ps_pic_buf->i4_frame_num;
 1459|  2.52k|        if(i4_ref_frame_num > i4_cur_frame_num)
  ------------------
  |  Branch (1459:12): [True: 286, False: 2.23k]
  ------------------
 1460|    286|        {
 1461|       |            /* RefPic Buf frame_num is before Current frame_num in decode order */
 1462|    286|            i4_pic_num = i4_ref_frame_num - i4_max_frame_num;
 1463|    286|        }
 1464|  2.23k|        else
 1465|  2.23k|        {
 1466|       |            /* RefPic Buf frame_num is after Current frame_num in decode order */
 1467|  2.23k|            i4_pic_num = i4_ref_frame_num;
 1468|  2.23k|        }
 1469|       |
 1470|  2.52k|        ps_next_dpb->ps_pic_buf->i4_pic_num = i4_pic_num;
 1471|  2.52k|        ps_next_dpb->i4_frame_num = i4_pic_num;
 1472|  2.52k|        ps_next_dpb->ps_pic_buf->u1_long_term_frm_idx = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|  2.52k|#define MAX_REF_BUFS    32
  ------------------
 1473|  2.52k|        if(u1_fld_pic_flag)
  ------------------
  |  Branch (1473:12): [True: 0, False: 2.52k]
  ------------------
 1474|      0|        {
 1475|       |            /* Assign the pic num to top fields and bot fields */
 1476|       |
 1477|      0|            ps_next_dpb->s_top_field.i4_pic_num = i4_pic_num * 2
 1478|      0|                            + !(ps_dec->ps_cur_slice->u1_bottom_field_flag);
 1479|      0|            ps_next_dpb->s_bot_field.i4_pic_num = i4_pic_num * 2
 1480|      0|                            + ps_dec->ps_cur_slice->u1_bottom_field_flag;
 1481|      0|        }
 1482|       |        /* Chase the next link */
 1483|  2.52k|        ps_next_dpb = ps_next_dpb->ps_prev_short;
 1484|  2.52k|    }
 1485|       |
 1486|  4.09k|    if(ps_dec->ps_cur_sps->u1_gaps_in_frame_num_value_allowed_flag
  ------------------
  |  Branch (1486:8): [True: 0, False: 4.09k]
  ------------------
 1487|      0|                    && ps_dpb_mgr->u1_num_gaps)
  ------------------
  |  Branch (1487:24): [True: 0, False: 0]
  ------------------
 1488|      0|    {
 1489|      0|        WORD32 i4_start_frm, i4_end_frm;
 1490|       |        /* Assign pic numbers for gaps */
 1491|      0|        for(i = 0; i < MAX_FRAMES; i++)
  ------------------
  |  |  600|      0|#define MAX_FRAMES              16
  ------------------
  |  Branch (1491:20): [True: 0, False: 0]
  ------------------
 1492|      0|        {
 1493|      0|            i4_start_frm = ps_dpb_mgr->ai4_gaps_start_frm_num[i];
 1494|      0|            if(i4_start_frm != INVALID_FRAME_NUM)
  ------------------
  |  |  601|      0|#define INVALID_FRAME_NUM       0x0fffffff
  ------------------
  |  Branch (1494:16): [True: 0, False: 0]
  ------------------
 1495|      0|            {
 1496|      0|                if(i4_start_frm > i4_cur_frame_num)
  ------------------
  |  Branch (1496:20): [True: 0, False: 0]
  ------------------
 1497|      0|                {
 1498|       |                    /* gap's frame_num is before Current frame_num in
 1499|       |                     decode order */
 1500|      0|                    i4_start_frm -= i4_max_frame_num;
 1501|      0|                }
 1502|      0|                ps_dpb_mgr->ai4_gaps_start_frm_num[i] = i4_start_frm;
 1503|      0|                i4_end_frm = ps_dpb_mgr->ai4_gaps_end_frm_num[i];
 1504|       |
 1505|      0|                if(i4_end_frm > i4_cur_frame_num)
  ------------------
  |  Branch (1505:20): [True: 0, False: 0]
  ------------------
 1506|      0|                {
 1507|       |                    /* gap's frame_num is before Current frame_num in
 1508|       |                     decode order */
 1509|      0|                    i4_end_frm -= i4_max_frame_num;
 1510|      0|                }
 1511|      0|                ps_dpb_mgr->ai4_gaps_end_frm_num[i] = i4_end_frm;
 1512|      0|            }
 1513|      0|        }
 1514|      0|    }
 1515|  4.09k|}
ih264d_update_qp:
 1530|  22.0k|{
 1531|  22.0k|    WORD32 i_temp;
 1532|  22.0k|    i_temp = (ps_dec->u1_qp + i1_qp + 52) % 52;
 1533|       |
 1534|  22.0k|    if((i_temp < 0) || (i_temp > 51) || (i1_qp < -26) || (i1_qp > 25))
  ------------------
  |  Branch (1534:8): [True: 0, False: 22.0k]
  |  Branch (1534:24): [True: 0, False: 22.0k]
  |  Branch (1534:41): [True: 0, False: 22.0k]
  |  Branch (1534:58): [True: 0, False: 22.0k]
  ------------------
 1535|      0|        return ERROR_INV_RANGE_QP_T;
 1536|       |
 1537|  22.0k|    ps_dec->u1_qp = i_temp;
 1538|  22.0k|    ps_dec->u1_qp_y_rem6 = ps_dec->u1_qp % 6;
 1539|  22.0k|    ps_dec->u1_qp_y_div6 = ps_dec->u1_qp / 6;
 1540|  22.0k|    i_temp = CLIP3(0, 51, ps_dec->u1_qp + ps_dec->ps_cur_pps->i1_chroma_qp_index_offset);
  ------------------
  |  |   77|  22.0k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 720, False: 21.3k]
  |  |  |  Branch (77:54): [True: 10, False: 21.3k]
  |  |  ------------------
  ------------------
 1541|  22.0k|    ps_dec->u1_qp_u_rem6 = MOD(gau1_ih264d_qp_scale_cr[12 + i_temp], 6);
  ------------------
  |  |   64|  22.0k|#define MOD(x,y) ((x)%(y))
  ------------------
 1542|  22.0k|    ps_dec->u1_qp_u_div6 = DIV(gau1_ih264d_qp_scale_cr[12 + i_temp], 6);
  ------------------
  |  |   65|  22.0k|#define DIV(x,y) ((x)/(y))
  ------------------
 1543|       |
 1544|  22.0k|    i_temp = CLIP3(0, 51, ps_dec->u1_qp + ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset);
  ------------------
  |  |   77|  22.0k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 12, False: 22.0k]
  |  |  |  Branch (77:54): [True: 462, False: 21.5k]
  |  |  ------------------
  ------------------
 1545|  22.0k|    ps_dec->u1_qp_v_rem6 = MOD(gau1_ih264d_qp_scale_cr[12 + i_temp], 6);
  ------------------
  |  |   64|  22.0k|#define MOD(x,y) ((x)%(y))
  ------------------
 1546|  22.0k|    ps_dec->u1_qp_v_div6 = DIV(gau1_ih264d_qp_scale_cr[12 + i_temp], 6);
  ------------------
  |  |   65|  22.0k|#define DIV(x,y) ((x)/(y))
  ------------------
 1547|       |
 1548|  22.0k|    ps_dec->pu2_quant_scale_y =
 1549|  22.0k|                    gau2_ih264_iquant_scale_4x4[ps_dec->u1_qp_y_rem6];
 1550|  22.0k|    ps_dec->pu2_quant_scale_u =
 1551|  22.0k|                    gau2_ih264_iquant_scale_4x4[ps_dec->u1_qp_u_rem6];
 1552|  22.0k|    ps_dec->pu2_quant_scale_v =
 1553|  22.0k|                    gau2_ih264_iquant_scale_4x4[ps_dec->u1_qp_v_rem6];
 1554|  22.0k|    return OK;
  ------------------
  |  |  114|  22.0k|#define OK        0
  ------------------
 1555|  22.0k|}
ih264d_create_pic_buffers:
 1750|    160|{
 1751|    160|    struct pic_buffer_t *ps_pic_buf;
 1752|    160|    UWORD8 i;
 1753|    160|    UWORD32 u4_luma_size, u4_chroma_size;
 1754|    160|    UWORD8 u1_frm = ps_dec->ps_cur_sps->u1_frame_mbs_only_flag;
 1755|    160|    WORD32 j;
 1756|    160|    UWORD8 *pu1_buf;
 1757|       |
 1758|    160|    ps_pic_buf = ps_dec->ps_pic_buf_base;
 1759|    160|    ih264_disp_mgr_init((disp_mgr_t *)ps_dec->pv_disp_buf_mgr);
 1760|    160|    ih264_buf_mgr_init((buf_mgr_t *)ps_dec->pv_pic_buf_mgr);
 1761|    160|    u4_luma_size = ps_dec->u2_frm_wd_y * ps_dec->u2_frm_ht_y;
 1762|    160|    u4_chroma_size = ps_dec->u2_frm_wd_uv * ps_dec->u2_frm_ht_uv;
 1763|       |
 1764|    160|    {
 1765|    160|        if(ps_dec->u4_share_disp_buf == 1)
  ------------------
  |  Branch (1765:12): [True: 0, False: 160]
  ------------------
 1766|      0|        {
 1767|       |            /* In case of buffers getting shared between application and library
 1768|       |             there is no need of reference memtabs. Instead of setting the i4_size
 1769|       |             to zero, it is reduced to a small i4_size to ensure that changes
 1770|       |             in the code are minimal */
 1771|      0|            if((ps_dec->u1_chroma_format == IV_YUV_420SP_UV)
  ------------------
  |  Branch (1771:16): [True: 0, False: 0]
  ------------------
 1772|      0|                            || (ps_dec->u1_chroma_format == IV_YUV_420SP_VU)
  ------------------
  |  Branch (1772:32): [True: 0, False: 0]
  ------------------
 1773|      0|                            || (ps_dec->u1_chroma_format == IV_YUV_420P))
  ------------------
  |  Branch (1773:32): [True: 0, False: 0]
  ------------------
 1774|      0|            {
 1775|      0|                u4_luma_size = 64;
 1776|      0|            }
 1777|       |
 1778|      0|            if(ps_dec->u1_chroma_format == IV_YUV_420SP_UV)
  ------------------
  |  Branch (1778:16): [True: 0, False: 0]
  ------------------
 1779|      0|            {
 1780|      0|                u4_chroma_size = 64;
 1781|      0|            }
 1782|       |
 1783|      0|        }
 1784|    160|    }
 1785|       |
 1786|    160|    pu1_buf = ps_dec->pu1_pic_buf_base;
 1787|       |
 1788|       |    /* Allocate memory for refernce buffers */
 1789|  2.93k|    for(i = 0; i < u1_num_of_buf; i++)
  ------------------
  |  Branch (1789:16): [True: 2.77k, False: 160]
  ------------------
 1790|  2.77k|    {
 1791|  2.77k|        UWORD32 u4_offset;
 1792|  2.77k|        WORD32 buf_ret;
 1793|  2.77k|        UWORD8 *pu1_luma, *pu1_chroma;
 1794|  2.77k|        void *pv_mem_ctxt = ps_dec->pv_mem_ctxt;
 1795|       |
 1796|  2.77k|        pu1_luma = pu1_buf;
 1797|  2.77k|        pu1_buf += ALIGN64(u4_luma_size);
  ------------------
  |  |   48|  2.77k|#define ALIGN64(x)  ((((x) + 63) >> 6) << 6)
  ------------------
 1798|  2.77k|        pu1_chroma = pu1_buf;
 1799|  2.77k|        pu1_buf += ALIGN64(u4_chroma_size);
  ------------------
  |  |   48|  2.77k|#define ALIGN64(x)  ((((x) + 63) >> 6) << 6)
  ------------------
 1800|       |
 1801|       |        /* Offset to the start of the pic from the top left corner of the frame
 1802|       |         buffer */
 1803|       |
 1804|  2.77k|        if((0 == ps_dec->u4_share_disp_buf)
  ------------------
  |  Branch (1804:12): [True: 2.77k, False: 0]
  ------------------
 1805|      0|                        || (NULL == ps_dec->disp_bufs[i].buf[0]))
  ------------------
  |  Branch (1805:28): [True: 0, False: 0]
  ------------------
 1806|  2.77k|        {
 1807|  2.77k|            UWORD32 pad_len_h, pad_len_v;
 1808|       |
 1809|  2.77k|            u4_offset = ps_dec->u2_frm_wd_y * (PAD_LEN_Y_V << 1) + PAD_LEN_Y_H;
  ------------------
  |  |  572|  2.77k|#define PAD_LEN_Y_V                   20
  ------------------
                          u4_offset = ps_dec->u2_frm_wd_y * (PAD_LEN_Y_V << 1) + PAD_LEN_Y_H;
  ------------------
  |  |  571|  2.77k|#define PAD_LEN_Y_H                   32
  ------------------
 1810|  2.77k|            ps_pic_buf->pu1_buf1 = (UWORD8 *)(pu1_luma) + u4_offset;
 1811|       |
 1812|  2.77k|            pad_len_h = MAX(PAD_LEN_UV_H, (PAD_LEN_Y_H >> 1));
  ------------------
  |  |   60|  2.77k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [Folded, False: 2.77k]
  |  |  ------------------
  ------------------
 1813|  2.77k|            pad_len_v = MAX(PAD_LEN_UV_V, PAD_LEN_Y_V);
  ------------------
  |  |   60|  2.77k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [Folded, False: 2.77k]
  |  |  ------------------
  ------------------
 1814|       |
 1815|  2.77k|            u4_offset = ps_dec->u2_frm_wd_uv * pad_len_v + pad_len_h;
 1816|       |
 1817|  2.77k|            ps_pic_buf->pu1_buf2 = (UWORD8 *)(pu1_chroma) + u4_offset;
 1818|  2.77k|            ps_pic_buf->pu1_buf3 = (UWORD8 *)(NULL) + u4_offset;
 1819|       |
 1820|  2.77k|        }
 1821|      0|        else
 1822|      0|        {
 1823|      0|            UWORD32 pad_len_h, pad_len_v;
 1824|      0|            u4_offset = ps_dec->u2_frm_wd_y * (PAD_LEN_Y_V << 1) + PAD_LEN_Y_H;
  ------------------
  |  |  572|      0|#define PAD_LEN_Y_V                   20
  ------------------
                          u4_offset = ps_dec->u2_frm_wd_y * (PAD_LEN_Y_V << 1) + PAD_LEN_Y_H;
  ------------------
  |  |  571|      0|#define PAD_LEN_Y_H                   32
  ------------------
 1825|      0|            ps_pic_buf->pu1_buf1 = (UWORD8 *)ps_dec->disp_bufs[i].buf[0]
 1826|      0|                            + u4_offset;
 1827|       |
 1828|      0|            ps_dec->disp_bufs[i].u4_ofst[0] = u4_offset;
 1829|       |
 1830|      0|            if(ps_dec->u1_chroma_format == IV_YUV_420P)
  ------------------
  |  Branch (1830:16): [True: 0, False: 0]
  ------------------
 1831|      0|            {
 1832|      0|                pad_len_h = MAX(PAD_LEN_UV_H * YUV420SP_FACTOR,
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, Folded]
  |  |  ------------------
  ------------------
 1833|      0|                                (PAD_LEN_Y_H >> 1));
 1834|      0|                pad_len_v = MAX(PAD_LEN_UV_V, PAD_LEN_Y_V);
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1835|       |
 1836|      0|                u4_offset = ps_dec->u2_frm_wd_uv * pad_len_v + pad_len_h;
 1837|      0|                ps_pic_buf->pu1_buf2 = (UWORD8 *)(pu1_chroma) + u4_offset;
 1838|      0|                ps_pic_buf->pu1_buf3 = (UWORD8 *)(NULL) + u4_offset;
 1839|       |
 1840|      0|                ps_dec->disp_bufs[i].u4_ofst[1] = u4_offset;
 1841|      0|                ps_dec->disp_bufs[i].u4_ofst[2] = u4_offset;
 1842|       |
 1843|      0|            }
 1844|      0|            else
 1845|      0|            {
 1846|      0|                pad_len_h = MAX(PAD_LEN_UV_H * YUV420SP_FACTOR,
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, Folded]
  |  |  ------------------
  ------------------
 1847|      0|                                (PAD_LEN_Y_H >> 1));
 1848|      0|                pad_len_v = MAX(PAD_LEN_UV_V, PAD_LEN_Y_V);
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1849|       |
 1850|      0|                u4_offset = ps_dec->u2_frm_wd_uv * pad_len_v + pad_len_h;
 1851|      0|                ps_pic_buf->pu1_buf2 = (UWORD8 *)(ps_dec->disp_bufs[i].buf[1])
 1852|      0|                                + u4_offset;
 1853|      0|                ps_pic_buf->pu1_buf3 = (UWORD8 *)(ps_dec->disp_bufs[i].buf[1])
 1854|      0|                                + u4_offset;
 1855|       |
 1856|      0|                ps_dec->disp_bufs[i].u4_ofst[1] = u4_offset;
 1857|      0|                ps_dec->disp_bufs[i].u4_ofst[2] = u4_offset;
 1858|      0|            }
 1859|      0|        }
 1860|       |
 1861|  2.77k|        ps_pic_buf->u2_frm_ht_y = ps_dec->u2_frm_ht_y;
 1862|  2.77k|        ps_pic_buf->u2_frm_ht_uv = ps_dec->u2_frm_ht_uv;
 1863|  2.77k|        ps_pic_buf->u2_frm_wd_y = ps_dec->u2_frm_wd_y;
 1864|  2.77k|        ps_pic_buf->u2_frm_wd_uv = ps_dec->u2_frm_wd_uv;
 1865|       |
 1866|  2.77k|        ps_pic_buf->u1_pic_buf_id = i;
 1867|       |
 1868|  2.77k|        buf_ret = ih264_buf_mgr_add((buf_mgr_t *)ps_dec->pv_pic_buf_mgr,
 1869|  2.77k|                                    ps_pic_buf, i);
 1870|  2.77k|        if(0 != buf_ret)
  ------------------
  |  Branch (1870:12): [True: 0, False: 2.77k]
  ------------------
 1871|      0|        {
 1872|      0|            ps_dec->i4_error_code = ERROR_BUF_MGR;
 1873|      0|            return ERROR_BUF_MGR;
 1874|      0|        }
 1875|       |
 1876|  2.77k|        ps_dec->apv_buf_id_pic_buf_map[i] = (void *)ps_pic_buf;
 1877|  2.77k|        ps_pic_buf++;
 1878|  2.77k|    }
 1879|       |
 1880|    160|    if(1 == ps_dec->u4_share_disp_buf)
  ------------------
  |  Branch (1880:8): [True: 0, False: 160]
  ------------------
 1881|      0|    {
 1882|      0|        for(i = 0; i < u1_num_of_buf; i++)
  ------------------
  |  Branch (1882:20): [True: 0, False: 0]
  ------------------
 1883|      0|            ps_dec->u4_disp_buf_mapping[i] = 1;
 1884|      0|    }
 1885|    160|    return OK;
  ------------------
  |  |  114|    160|#define OK        0
  ------------------
 1886|    160|}
ih264d_allocate_dynamic_bufs:
 1903|    160|{
 1904|    160|    struct MemReq s_MemReq;
 1905|    160|    struct MemBlock *p_MemBlock;
 1906|       |
 1907|    160|    pred_info_t *ps_pred_frame;
 1908|    160|    dec_mb_info_t *ps_frm_mb_info;
 1909|    160|    dec_slice_struct_t *ps_dec_slice_buf;
 1910|    160|    UWORD8 *pu1_dec_mb_map, *pu1_recon_mb_map;
 1911|    160|    UWORD16 *pu2_slice_num_map;
 1912|       |
 1913|    160|    WORD16 *pi16_res_coeff;
 1914|    160|    WORD16 i16_status = 0;
 1915|    160|    UWORD8 uc_frmOrFld = (1 - ps_dec->ps_cur_sps->u1_frame_mbs_only_flag);
 1916|    160|    UWORD16 u4_luma_wd = ps_dec->u2_frm_wd_y;
 1917|    160|    UWORD16 u4_chroma_wd = ps_dec->u2_frm_wd_uv;
 1918|    160|    WORD8 c_i = 0;
 1919|    160|    dec_seq_params_t *ps_sps = ps_dec->ps_cur_sps;
 1920|    160|    UWORD32 u4_total_mbs = ps_sps->u4_total_num_of_mbs << uc_frmOrFld;
 1921|    160|    UWORD32 u4_wd_mbs = ps_dec->u2_frm_wd_in_mbs;
 1922|    160|    UWORD32 u4_ht_mbs = ps_dec->u2_frm_ht_in_mbs;
 1923|    160|    UWORD32 u4_blk_wd;
 1924|    160|    UWORD32 ui_size = 0;
 1925|    160|    UWORD32 u4_int_scratch_size = 0, u4_ref_pred_size = 0;
 1926|    160|    UWORD8 *pu1_buf;
 1927|    160|    WORD32 num_entries;
 1928|    160|    WORD32 size;
 1929|    160|    void *pv_buf;
 1930|    160|    UWORD32 u4_num_bufs;
 1931|    160|    UWORD32 u4_luma_size, u4_chroma_size;
 1932|    160|    void *pv_mem_ctxt = ps_dec->pv_mem_ctxt;
 1933|       |
 1934|       |    /* Free any dynamic buffers that are allocated earlier. As ps_dec is memset to zero  */
 1935|       |    /* at the beginning, it is safe to call this even if no memory was allocated earlier */
 1936|    160|    ih264d_free_dynamic_bufs(ps_dec);
 1937|       |
 1938|    160|    size = u4_total_mbs;
 1939|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1940|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 1941|    160|    memset(pv_buf, 0, size);
 1942|    160|    ps_dec->pu1_dec_mb_map = pv_buf;
 1943|       |
 1944|    160|    size = u4_total_mbs;
 1945|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1946|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 1947|    160|    memset(pv_buf, 0, size);
 1948|    160|    ps_dec->pu1_recon_mb_map = pv_buf;
 1949|       |
 1950|    160|    size = u4_total_mbs * sizeof(UWORD16);
 1951|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1952|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 1953|    160|    memset(pv_buf, 0, size);
 1954|    160|    ps_dec->pu2_slice_num_map = pv_buf;
 1955|       |
 1956|       |    /************************************************************/
 1957|       |    /* Post allocation Initialisations                          */
 1958|       |    /************************************************************/
 1959|    160|    ps_dec->ps_parse_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
 1960|    160|    ps_dec->ps_decode_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
 1961|    160|    ps_dec->ps_computebs_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
 1962|       |
 1963|    160|    ps_dec->ps_pred_start = ps_dec->ps_pred;
 1964|       |
 1965|    160|    size = sizeof(parse_pmbarams_t) * (ps_dec->u4_recon_mb_grp);
 1966|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1967|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 1968|    160|    memset(pv_buf, 0, size);
 1969|    160|    ps_dec->ps_parse_mb_data = pv_buf;
 1970|       |
 1971|    160|    size = sizeof(parse_part_params_t)
 1972|    160|                        * ((ps_dec->u4_recon_mb_grp) << 4);
 1973|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1974|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 1975|    160|    memset(pv_buf, 0, size);
 1976|    160|    ps_dec->ps_parse_part_params = pv_buf;
 1977|       |
 1978|    160|    size = ((u4_wd_mbs * sizeof(deblkmb_neighbour_t)) << uc_frmOrFld);
 1979|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1980|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 1981|    160|    memset(pv_buf, 0, size);
 1982|    160|    ps_dec->ps_deblk_top_mb = pv_buf;
 1983|       |
 1984|    160|    size = ((sizeof(ctxt_inc_mb_info_t))
 1985|    160|                        * (((u4_wd_mbs + 1) << uc_frmOrFld) + 1));
 1986|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1987|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 1988|    160|    memset(pv_buf, 0, size);
 1989|    160|    ps_dec->p_ctxt_inc_mb_map = pv_buf;
 1990|       |
 1991|       |    /* 0th entry of CtxtIncMbMap will be always be containing default values
 1992|       |     for CABAC context representing MB not available */
 1993|    160|    ps_dec->p_ctxt_inc_mb_map += 1;
 1994|       |
 1995|    160|    size = (sizeof(mv_pred_t) * ps_dec->u4_recon_mb_grp
 1996|    160|                        * 16);
 1997|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1998|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 1999|    160|    memset(pv_buf, 0, size);
 2000|    160|    ps_dec->ps_mv_p[0] = pv_buf;
 2001|       |
 2002|    160|    size = (sizeof(mv_pred_t) * ps_dec->u4_recon_mb_grp
 2003|    160|                        * 16);
 2004|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2005|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 2006|    160|    memset(pv_buf, 0, size);
 2007|    160|    ps_dec->ps_mv_p[1] = pv_buf;
 2008|       |
 2009|    160|    {
 2010|    160|        UWORD8 i;
 2011|    800|        for(i = 0; i < MV_SCRATCH_BUFS; i++)
  ------------------
  |  |   62|    800|#define MV_SCRATCH_BUFS             4
  ------------------
  |  Branch (2011:20): [True: 640, False: 160]
  ------------------
 2012|    640|        {
 2013|    640|            size = (sizeof(mv_pred_t)
 2014|    640|                            * ps_dec->u4_recon_mb_grp * 4);
 2015|    640|            pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2016|    640|            RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    640|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 640]
  |  |  ------------------
  ------------------
 2017|    640|            memset(pv_buf, 0, size);
 2018|    640|            ps_dec->ps_mv_top_p[i] = pv_buf;
 2019|    640|        }
 2020|    160|    }
 2021|       |
 2022|    160|    size = sizeof(UWORD8) * ((u4_wd_mbs + 2) * MB_SIZE) * 2;
  ------------------
  |  |  554|    160|#define MB_SIZE             16
  ------------------
 2023|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2024|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 2025|    160|    ps_dec->pu1_y_intra_pred_line = pv_buf;
 2026|    160|    memset(ps_dec->pu1_y_intra_pred_line, 0, size);
 2027|    160|    ps_dec->pu1_y_intra_pred_line += MB_SIZE;
  ------------------
  |  |  554|    160|#define MB_SIZE             16
  ------------------
 2028|       |
 2029|    160|    size = sizeof(UWORD8) * ((u4_wd_mbs + 2) * MB_SIZE) * 2;
  ------------------
  |  |  554|    160|#define MB_SIZE             16
  ------------------
 2030|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2031|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 2032|    160|    ps_dec->pu1_u_intra_pred_line = pv_buf;
 2033|    160|    memset(ps_dec->pu1_u_intra_pred_line, 0, size);
 2034|    160|    ps_dec->pu1_u_intra_pred_line += MB_SIZE;
  ------------------
  |  |  554|    160|#define MB_SIZE             16
  ------------------
 2035|       |
 2036|    160|    size = sizeof(UWORD8) * ((u4_wd_mbs + 2) * MB_SIZE) * 2;
  ------------------
  |  |  554|    160|#define MB_SIZE             16
  ------------------
 2037|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2038|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 2039|    160|    ps_dec->pu1_v_intra_pred_line = pv_buf;
 2040|    160|    memset(ps_dec->pu1_v_intra_pred_line, 0, size);
 2041|    160|    ps_dec->pu1_v_intra_pred_line += MB_SIZE;
  ------------------
  |  |  554|    160|#define MB_SIZE             16
  ------------------
 2042|       |
 2043|    160|    if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (2043:8): [True: 31, False: 129]
  ------------------
 2044|     31|    {
 2045|       |        /* Needs one extra row of info, to hold top row data */
 2046|     31|        size = sizeof(mb_neigbour_params_t)
 2047|     31|                        * 2 * ((u4_wd_mbs + 2) * (u4_ht_mbs + 1));
 2048|     31|    }
 2049|    129|    else
 2050|    129|    {
 2051|    129|        size = sizeof(mb_neigbour_params_t)
 2052|    129|                        * 2 * ((u4_wd_mbs + 2) << uc_frmOrFld);
 2053|    129|    }
 2054|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2055|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 2056|       |
 2057|    160|    ps_dec->ps_nbr_mb_row = pv_buf;
 2058|    160|    memset(ps_dec->ps_nbr_mb_row, 0, size);
 2059|       |
 2060|       |    /* Allocate deblock MB info */
 2061|    160|    size = (u4_total_mbs + u4_wd_mbs) * sizeof(deblk_mb_t);
 2062|       |
 2063|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2064|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 2065|    160|    ps_dec->ps_deblk_pic = pv_buf;
 2066|       |
 2067|    160|    memset(ps_dec->ps_deblk_pic, 0, size);
 2068|       |
 2069|       |    /* Allocate frame level mb info */
 2070|    160|    size = sizeof(dec_mb_info_t) * u4_total_mbs;
 2071|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2072|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 2073|    160|    ps_dec->ps_frm_mb_info = pv_buf;
 2074|    160|    memset(ps_dec->ps_frm_mb_info, 0, size);
 2075|       |
 2076|       |    /* Allocate memory for slice headers dec_slice_struct_t */
 2077|    160|    num_entries = MAX_FRAMES;
  ------------------
  |  |  600|    160|#define MAX_FRAMES              16
  ------------------
 2078|    160|    if((1 >= ps_dec->ps_cur_sps->u1_num_ref_frames) &&
  ------------------
  |  Branch (2078:8): [True: 120, False: 40]
  ------------------
 2079|    120|        (0 == ps_dec->i4_display_delay))
  ------------------
  |  Branch (2079:9): [True: 0, False: 120]
  ------------------
 2080|      0|    {
 2081|      0|        num_entries = 1;
 2082|      0|    }
 2083|    160|    num_entries = ((2 * num_entries) + 1);
 2084|    160|    num_entries *= 2;
 2085|       |
 2086|    160|    size = num_entries * sizeof(void *);
 2087|    160|    size += PAD_MAP_IDX_POC * sizeof(void *);
  ------------------
  |  |  100|    160|#define PAD_MAP_IDX_POC             (1)
  ------------------
 2088|    160|    size *= u4_total_mbs;
 2089|    160|    size += sizeof(dec_slice_struct_t) * u4_total_mbs;
 2090|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2091|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 2092|       |
 2093|    160|    ps_dec->ps_dec_slice_buf = pv_buf;
 2094|    160|    memset(ps_dec->ps_dec_slice_buf, 0, size);
 2095|    160|    pu1_buf = (UWORD8 *)ps_dec->ps_dec_slice_buf;
 2096|    160|    pu1_buf += sizeof(dec_slice_struct_t) * u4_total_mbs;
 2097|    160|    ps_dec->pv_map_ref_idx_to_poc_buf = (void *)pu1_buf;
 2098|       |
 2099|       |    /* Allocate memory for packed pred info */
 2100|    160|    num_entries = u4_total_mbs;
 2101|    160|    num_entries *= 16 * 2;
 2102|       |
 2103|    160|    size = sizeof(pred_info_pkd_t) * num_entries;
 2104|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2105|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 2106|    160|    memset(pv_buf, 0, size);
 2107|    160|    ps_dec->ps_pred_pkd = pv_buf;
 2108|       |
 2109|       |    /* Allocate memory for coeff data */
 2110|    160|    size = MB_LUM_SIZE * sizeof(WORD16);
  ------------------
  |  |  563|    160|#define MB_LUM_SIZE                   256
  ------------------
 2111|       |    /*For I16x16 MBs, 16 4x4 AC coeffs and 1 4x4 DC coeff TU blocks will be sent
 2112|       |    For all MBs along with 8 4x4 AC coeffs 2 2x2 DC coeff TU blocks will be sent
 2113|       |    So use 17 4x4 TU blocks for luma and 9 4x4 TU blocks for chroma */
 2114|    160|    size += u4_total_mbs * (MAX(17 * sizeof(tu_sblk4x4_coeff_data_t),4 * sizeof(tu_blk8x8_coeff_data_t))
  ------------------
  |  |   60|    160|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 160, Folded]
  |  |  ------------------
  ------------------
 2115|    160|                                            + 9 * sizeof(tu_sblk4x4_coeff_data_t));
 2116|       |    //32 bytes for each mb to store u1_prev_intra4x4_pred_mode and u1_rem_intra4x4_pred_mode data
 2117|    160|    size += u4_total_mbs * 32;
 2118|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2119|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 2120|    160|    memset(pv_buf, 0, size);
 2121|       |
 2122|    160|    ps_dec->pi2_coeff_data = pv_buf;
 2123|       |
 2124|    160|    ps_dec->pv_pic_tu_coeff_data = (void *)(ps_dec->pi2_coeff_data + MB_LUM_SIZE);
  ------------------
  |  |  563|    160|#define MB_LUM_SIZE                   256
  ------------------
 2125|       |
 2126|       |    /* Allocate MV bank buffer */
 2127|    160|    {
 2128|    160|        UWORD32 col_flag_buffer_size, mvpred_buffer_size;
 2129|       |
 2130|    160|        col_flag_buffer_size = ((ps_dec->u2_pic_wd * ps_dec->u2_pic_ht) >> 4);
 2131|    160|        mvpred_buffer_size = sizeof(mv_pred_t)
 2132|    160|                        * ((ps_dec->u2_pic_wd * (ps_dec->u2_pic_ht + PAD_MV_BANK_ROW)) >> 4);
  ------------------
  |  |  576|    160|#define PAD_MV_BANK_ROW             64
  ------------------
 2133|       |
 2134|    160|        u4_num_bufs = ps_dec->ps_cur_sps->u1_num_ref_frames + 1;
 2135|       |
 2136|    160|        u4_num_bufs = MIN(u4_num_bufs, ps_dec->u1_pic_bufs);
  ------------------
  |  |   61|    160|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 160, False: 0]
  |  |  ------------------
  ------------------
 2137|    160|        u4_num_bufs = MAX(u4_num_bufs, 2);
  ------------------
  |  |   60|    160|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 40, False: 120]
  |  |  ------------------
  ------------------
 2138|    160|        size = ALIGN64(mvpred_buffer_size) + ALIGN64(col_flag_buffer_size);
  ------------------
  |  |   48|    160|#define ALIGN64(x)  ((((x) + 63) >> 6) << 6)
  ------------------
                      size = ALIGN64(mvpred_buffer_size) + ALIGN64(col_flag_buffer_size);
  ------------------
  |  |   48|    160|#define ALIGN64(x)  ((((x) + 63) >> 6) << 6)
  ------------------
 2139|    160|        size *= u4_num_bufs;
 2140|    160|        pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2141|    160|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 2142|    160|        memset(pv_buf, 0, size);
 2143|    160|        ps_dec->pu1_mv_bank_buf_base = pv_buf;
 2144|    160|    }
 2145|       |
 2146|       |    /* Allocate Pic buffer */
 2147|      0|    u4_luma_size = ps_dec->u2_frm_wd_y * ps_dec->u2_frm_ht_y;
 2148|    160|    u4_chroma_size = ps_dec->u2_frm_wd_uv * ps_dec->u2_frm_ht_uv;
 2149|       |
 2150|    160|    {
 2151|    160|        if(ps_dec->u4_share_disp_buf == 1)
  ------------------
  |  Branch (2151:12): [True: 0, False: 160]
  ------------------
 2152|      0|        {
 2153|       |            /* In case of buffers getting shared between application and library
 2154|       |             there is no need of reference memtabs. Instead of setting the i4_size
 2155|       |             to zero, it is reduced to a small i4_size to ensure that changes
 2156|       |             in the code are minimal */
 2157|      0|            if((ps_dec->u1_chroma_format == IV_YUV_420SP_UV)
  ------------------
  |  Branch (2157:16): [True: 0, False: 0]
  ------------------
 2158|      0|                            || (ps_dec->u1_chroma_format == IV_YUV_420SP_VU)
  ------------------
  |  Branch (2158:32): [True: 0, False: 0]
  ------------------
 2159|      0|                            || (ps_dec->u1_chroma_format == IV_YUV_420P))
  ------------------
  |  Branch (2159:32): [True: 0, False: 0]
  ------------------
 2160|      0|            {
 2161|      0|                u4_luma_size = 64;
 2162|      0|            }
 2163|       |
 2164|      0|            if(ps_dec->u1_chroma_format == IV_YUV_420SP_UV)
  ------------------
  |  Branch (2164:16): [True: 0, False: 0]
  ------------------
 2165|      0|            {
 2166|      0|                u4_chroma_size = 64;
 2167|      0|            }
 2168|       |
 2169|      0|        }
 2170|    160|    }
 2171|       |
 2172|    160|    size = ALIGN64(u4_luma_size) + ALIGN64(u4_chroma_size);
  ------------------
  |  |   48|    160|#define ALIGN64(x)  ((((x) + 63) >> 6) << 6)
  ------------------
                  size = ALIGN64(u4_luma_size) + ALIGN64(u4_chroma_size);
  ------------------
  |  |   48|    160|#define ALIGN64(x)  ((((x) + 63) >> 6) << 6)
  ------------------
 2173|    160|    size *= ps_dec->u1_pic_bufs;
 2174|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2175|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
 2176|    160|    memset(pv_buf, 0, size);
 2177|    160|    ps_dec->pu1_pic_buf_base = pv_buf;
 2178|       |
 2179|       |    /* Allocate memory for mb_info maps */
 2180|    160|    if(ps_dec->u1_enable_mb_info)
  ------------------
  |  Branch (2180:8): [True: 0, False: 160]
  ------------------
 2181|      0|    {
 2182|      0|        size = (u4_total_mbs << 2) * MAX_DISP_BUFS_NEW;
  ------------------
  |  |   76|      0|#define MAX_DISP_BUFS_NEW 64
  ------------------
 2183|       |
 2184|      0|        pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2185|      0|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|      0|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2186|      0|        memset(pv_buf, 0, size);
 2187|      0|        ps_dec->pu1_qp_map_base = pv_buf;
 2188|       |
 2189|      0|        pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2190|      0|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|      0|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2191|      0|        memset(pv_buf, 0, size);
 2192|      0|        ps_dec->pu1_mb_type_map_base = pv_buf;
 2193|      0|    }
 2194|       |
 2195|       |    /* Post allocation Increment Actions */
 2196|       |
 2197|       |    /***************************************************************************/
 2198|       |    /*Initialize cabac context pointers for every SE that has fixed contextIdx */
 2199|       |    /***************************************************************************/
 2200|    160|    {
 2201|    160|        bin_ctxt_model_t * const p_cabac_ctxt_table_t =
 2202|    160|                        ps_dec->p_cabac_ctxt_table_t;
 2203|    160|        bin_ctxt_model_t * * p_coeff_abs_level_minus1_t =
 2204|    160|                        ps_dec->p_coeff_abs_level_minus1_t;
 2205|    160|        bin_ctxt_model_t * * p_cbf_t = ps_dec->p_cbf_t;
 2206|       |
 2207|    160|        ps_dec->p_mb_field_dec_flag_t = p_cabac_ctxt_table_t
 2208|    160|                        + MB_FIELD_DECODING_FLAG;
 2209|    160|        ps_dec->p_prev_intra4x4_pred_mode_flag_t = p_cabac_ctxt_table_t
 2210|    160|                        + PREV_INTRA4X4_PRED_MODE_FLAG;
 2211|    160|        ps_dec->p_rem_intra4x4_pred_mode_t = p_cabac_ctxt_table_t
 2212|    160|                        + REM_INTRA4X4_PRED_MODE;
 2213|    160|        ps_dec->p_intra_chroma_pred_mode_t = p_cabac_ctxt_table_t
 2214|    160|                        + INTRA_CHROMA_PRED_MODE;
 2215|    160|        ps_dec->p_mb_qp_delta_t = p_cabac_ctxt_table_t + MB_QP_DELTA;
 2216|    160|        ps_dec->p_ref_idx_t = p_cabac_ctxt_table_t + REF_IDX;
 2217|    160|        ps_dec->p_mvd_x_t = p_cabac_ctxt_table_t + MVD_X;
 2218|    160|        ps_dec->p_mvd_y_t = p_cabac_ctxt_table_t + MVD_Y;
 2219|    160|        p_cbf_t[0] = p_cabac_ctxt_table_t + CBF + 0;
 2220|    160|        p_cbf_t[1] = p_cabac_ctxt_table_t + CBF + 4;
 2221|    160|        p_cbf_t[2] = p_cabac_ctxt_table_t + CBF + 8;
 2222|    160|        p_cbf_t[3] = p_cabac_ctxt_table_t + CBF + 12;
 2223|    160|        p_cbf_t[4] = p_cabac_ctxt_table_t + CBF + 16;
 2224|    160|        ps_dec->p_cbp_luma_t = p_cabac_ctxt_table_t + CBP_LUMA;
 2225|    160|        ps_dec->p_cbp_chroma_t = p_cabac_ctxt_table_t + CBP_CHROMA;
 2226|       |
 2227|    160|        p_coeff_abs_level_minus1_t[LUMA_DC_CTXCAT] = p_cabac_ctxt_table_t
  ------------------
  |  |   71|    160|#define LUMA_DC_CTXCAT    0
  ------------------
 2228|    160|                        + COEFF_ABS_LEVEL_MINUS1 + COEFF_ABS_LEVEL_CAT_0_OFFSET;
 2229|       |
 2230|    160|        p_coeff_abs_level_minus1_t[LUMA_AC_CTXCAT] = p_cabac_ctxt_table_t
  ------------------
  |  |   72|    160|#define LUMA_AC_CTXCAT    1
  ------------------
 2231|    160|                        + COEFF_ABS_LEVEL_MINUS1 + COEFF_ABS_LEVEL_CAT_1_OFFSET;
 2232|       |
 2233|    160|        p_coeff_abs_level_minus1_t[LUMA_4X4_CTXCAT] = p_cabac_ctxt_table_t
  ------------------
  |  |   73|    160|#define LUMA_4X4_CTXCAT   2
  ------------------
 2234|    160|                        + COEFF_ABS_LEVEL_MINUS1 + COEFF_ABS_LEVEL_CAT_2_OFFSET;
 2235|       |
 2236|    160|        p_coeff_abs_level_minus1_t[CHROMA_DC_CTXCAT] = p_cabac_ctxt_table_t
  ------------------
  |  |   74|    160|#define CHROMA_DC_CTXCAT  3
  ------------------
 2237|    160|                        + COEFF_ABS_LEVEL_MINUS1 + COEFF_ABS_LEVEL_CAT_3_OFFSET;
 2238|       |
 2239|    160|        p_coeff_abs_level_minus1_t[CHROMA_AC_CTXCAT] = p_cabac_ctxt_table_t
  ------------------
  |  |   75|    160|#define CHROMA_AC_CTXCAT  4
  ------------------
 2240|    160|                        + COEFF_ABS_LEVEL_MINUS1 + COEFF_ABS_LEVEL_CAT_4_OFFSET;
 2241|       |
 2242|    160|        p_coeff_abs_level_minus1_t[LUMA_8X8_CTXCAT] = p_cabac_ctxt_table_t
  ------------------
  |  |   76|    160|#define LUMA_8X8_CTXCAT   5
  ------------------
 2243|    160|                        + COEFF_ABS_LEVEL_MINUS1_8X8
 2244|    160|                        + COEFF_ABS_LEVEL_CAT_5_OFFSET;
 2245|       |
 2246|       |        /********************************************************/
 2247|       |        /* context for the high profile related syntax elements */
 2248|       |        /* This is maintained seperately in s_high_profile     */
 2249|       |        /********************************************************/
 2250|    160|        {
 2251|       |
 2252|    160|            ps_dec->s_high_profile.ps_transform8x8_flag = p_cabac_ctxt_table_t
 2253|    160|                            + TRANSFORM_SIZE_8X8_FLAG;
 2254|       |
 2255|    160|            ps_dec->s_high_profile.ps_sigcoeff_8x8_frame = p_cabac_ctxt_table_t
 2256|    160|                            + SIGNIFICANT_COEFF_FLAG_8X8_FRAME;
 2257|       |
 2258|    160|            ps_dec->s_high_profile.ps_last_sigcoeff_8x8_frame =
 2259|    160|                            p_cabac_ctxt_table_t
 2260|    160|                                            + LAST_SIGNIFICANT_COEFF_FLAG_8X8_FRAME;
 2261|       |
 2262|    160|            ps_dec->s_high_profile.ps_coeff_abs_levelminus1 =
 2263|    160|                            p_cabac_ctxt_table_t + COEFF_ABS_LEVEL_MINUS1_8X8;
 2264|       |
 2265|    160|            ps_dec->s_high_profile.ps_sigcoeff_8x8_field = p_cabac_ctxt_table_t
 2266|    160|                            + SIGNIFICANT_COEFF_FLAG_8X8_FIELD;
 2267|       |
 2268|    160|            ps_dec->s_high_profile.ps_last_sigcoeff_8x8_field =
 2269|    160|                            p_cabac_ctxt_table_t
 2270|    160|                                            + LAST_SIGNIFICANT_COEFF_FLAG_8X8_FIELD;
 2271|    160|        }
 2272|    160|    }
 2273|    160|    return (i16_status);
 2274|    160|}
ih264d_free_dynamic_bufs:
 2291|  2.50k|{
 2292|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_deblk_pic);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2293|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu1_dec_mb_map);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2294|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu1_recon_mb_map);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2295|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu2_slice_num_map);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2296|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_dec_slice_buf);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2297|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_frm_mb_info);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2298|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pi2_coeff_data);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2299|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_parse_mb_data);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2300|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_parse_part_params);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2301|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_deblk_top_mb);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2302|       |
 2303|  2.50k|    if(ps_dec->p_ctxt_inc_mb_map)
  ------------------
  |  Branch (2303:8): [True: 160, False: 2.34k]
  ------------------
 2304|    160|    {
 2305|    160|        ps_dec->p_ctxt_inc_mb_map -= 1;
 2306|    160|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->p_ctxt_inc_mb_map);
  ------------------
  |  |   43|    160|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    160|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 0]
  |  |  ------------------
  ------------------
 2307|    160|    }
 2308|       |
 2309|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_mv_p[0]);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2310|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_mv_p[1]);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2311|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_pred_pkd);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2312|  2.50k|    {
 2313|  2.50k|        UWORD8 i;
 2314|  12.5k|        for(i = 0; i < MV_SCRATCH_BUFS; i++)
  ------------------
  |  |   62|  12.5k|#define MV_SCRATCH_BUFS             4
  ------------------
  |  Branch (2314:20): [True: 10.0k, False: 2.50k]
  ------------------
 2315|  10.0k|        {
 2316|  10.0k|            PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_mv_top_p[i]);
  ------------------
  |  |   43|  10.0k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  10.0k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 640, False: 9.39k]
  |  |  ------------------
  ------------------
 2317|  10.0k|        }
 2318|  2.50k|    }
 2319|       |
 2320|  2.50k|    if(ps_dec->pu1_y_intra_pred_line)
  ------------------
  |  Branch (2320:8): [True: 160, False: 2.34k]
  ------------------
 2321|    160|    {
 2322|    160|        ps_dec->pu1_y_intra_pred_line -= MB_SIZE;
  ------------------
  |  |  554|    160|#define MB_SIZE             16
  ------------------
 2323|    160|    }
 2324|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu1_y_intra_pred_line);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2325|       |
 2326|  2.50k|    if(ps_dec->pu1_u_intra_pred_line)
  ------------------
  |  Branch (2326:8): [True: 160, False: 2.34k]
  ------------------
 2327|    160|    {
 2328|    160|        ps_dec->pu1_u_intra_pred_line -= MB_SIZE;
  ------------------
  |  |  554|    160|#define MB_SIZE             16
  ------------------
 2329|    160|    }
 2330|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu1_u_intra_pred_line);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2331|       |
 2332|  2.50k|    if(ps_dec->pu1_v_intra_pred_line)
  ------------------
  |  Branch (2332:8): [True: 160, False: 2.34k]
  ------------------
 2333|    160|    {
 2334|    160|        ps_dec->pu1_v_intra_pred_line -= MB_SIZE;
  ------------------
  |  |  554|    160|#define MB_SIZE             16
  ------------------
 2335|    160|    }
 2336|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu1_v_intra_pred_line);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2337|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_nbr_mb_row);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2338|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu1_mv_bank_buf_base);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2339|  2.50k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu1_pic_buf_base);
  ------------------
  |  |   43|  2.50k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.50k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.34k]
  |  |  ------------------
  ------------------
 2340|       |
 2341|       |    /* Free memory for mb_info maps */
 2342|  2.50k|    if(ps_dec->u1_enable_mb_info)
  ------------------
  |  Branch (2342:8): [True: 0, False: 2.50k]
  ------------------
 2343|      0|    {
 2344|      0|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu1_qp_map_base);
  ------------------
  |  |   43|      0|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|      0|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2345|       |        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu1_mb_type_map_base);
  ------------------
  |  |   43|      0|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|      0|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2346|      0|    }
 2347|  2.50k|    return 0;
 2348|  2.50k|}
ih264d_create_mv_bank:
 2375|    160|{
 2376|    160|    UWORD8  i;
 2377|    160|    UWORD32 col_flag_buffer_size, mvpred_buffer_size;
 2378|    160|    UWORD8 *pu1_mv_buf_mgr_base, *pu1_mv_bank_base;
 2379|    160|    col_mv_buf_t *ps_col_mv;
 2380|    160|    mv_pred_t *ps_mv;
 2381|    160|    UWORD8 *pu1_col_zero_flag_buf;
 2382|    160|    dec_struct_t *ps_dec = (dec_struct_t *)pv_dec;
 2383|    160|    WORD32 buf_ret;
 2384|    160|    UWORD32 u4_num_bufs;
 2385|    160|    UWORD8 *pu1_buf;
 2386|    160|    WORD32 size;
 2387|    160|    void *pv_mem_ctxt = ps_dec->pv_mem_ctxt;
 2388|       |
 2389|    160|    col_flag_buffer_size = ((ui_width * ui_height) >> 4);
 2390|    160|    mvpred_buffer_size = sizeof(mv_pred_t)
 2391|    160|                    * ((ui_width * (ui_height + PAD_MV_BANK_ROW)) >> 4);
  ------------------
  |  |  576|    160|#define PAD_MV_BANK_ROW             64
  ------------------
 2392|       |
 2393|    160|    ih264_buf_mgr_init((buf_mgr_t *)ps_dec->pv_mv_buf_mgr);
 2394|       |
 2395|    160|    ps_col_mv = ps_dec->ps_col_mv_base;
 2396|       |
 2397|    160|    u4_num_bufs = ps_dec->ps_cur_sps->u1_num_ref_frames + 1;
 2398|       |
 2399|    160|    u4_num_bufs = MIN(u4_num_bufs, ps_dec->u1_pic_bufs);
  ------------------
  |  |   61|    160|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 160, False: 0]
  |  |  ------------------
  ------------------
 2400|    160|    u4_num_bufs = MAX(u4_num_bufs, 2);
  ------------------
  |  |   60|    160|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 40, False: 120]
  |  |  ------------------
  ------------------
 2401|    160|    pu1_buf = ps_dec->pu1_mv_bank_buf_base;
 2402|    701|    for(i = 0 ; i < u4_num_bufs ; i++)
  ------------------
  |  Branch (2402:17): [True: 541, False: 160]
  ------------------
 2403|    541|    {
 2404|    541|        pu1_col_zero_flag_buf = pu1_buf;
 2405|    541|        pu1_buf += ALIGN64(col_flag_buffer_size);
  ------------------
  |  |   48|    541|#define ALIGN64(x)  ((((x) + 63) >> 6) << 6)
  ------------------
 2406|       |
 2407|    541|        ps_mv = (mv_pred_t *)pu1_buf;
 2408|    541|        pu1_buf += ALIGN64(mvpred_buffer_size);
  ------------------
  |  |   48|    541|#define ALIGN64(x)  ((((x) + 63) >> 6) << 6)
  ------------------
 2409|       |
 2410|    541|        memset(ps_mv, 0, ((ui_width * OFFSET_MV_BANK_ROW) >> 4) * sizeof(mv_pred_t));
  ------------------
  |  |   97|    541|#define OFFSET_MV_BANK_ROW          ((PAD_MV_BANK_ROW)>>1)
  |  |  ------------------
  |  |  |  |  576|    541|#define PAD_MV_BANK_ROW             64
  |  |  ------------------
  ------------------
 2411|    541|        ps_mv += (ui_width*OFFSET_MV_BANK_ROW) >> 4;
  ------------------
  |  |   97|    541|#define OFFSET_MV_BANK_ROW          ((PAD_MV_BANK_ROW)>>1)
  |  |  ------------------
  |  |  |  |  576|    541|#define PAD_MV_BANK_ROW             64
  |  |  ------------------
  ------------------
 2412|       |
 2413|    541|        ps_col_mv->pv_col_zero_flag = (void *)pu1_col_zero_flag_buf;
 2414|    541|        ps_col_mv->pv_mv = (void *)ps_mv;
 2415|    541|        buf_ret = ih264_buf_mgr_add((buf_mgr_t *)ps_dec->pv_mv_buf_mgr, ps_col_mv, i);
 2416|    541|        if(0 != buf_ret)
  ------------------
  |  Branch (2416:12): [True: 0, False: 541]
  ------------------
 2417|      0|        {
 2418|      0|            ps_dec->i4_error_code = ERROR_BUF_MGR;
 2419|      0|            return ERROR_BUF_MGR;
 2420|      0|        }
 2421|    541|        ps_col_mv++;
 2422|    541|    }
 2423|    160|    return OK;
  ------------------
  |  |  114|    160|#define OK        0
  ------------------
 2424|    160|}
ih264d_unpack_coeff4x4_dc_4x4blk:
 2429|  42.1k|{
 2430|  42.1k|    UWORD16 u2_sig_coeff_map = ps_tu_4x4->u2_sig_coeff_map;
 2431|  42.1k|    WORD32 idx;
 2432|  42.1k|    WORD16 *pi2_coeff_data = &ps_tu_4x4->ai2_level[0];
 2433|       |
 2434|   105k|    while(u2_sig_coeff_map)
  ------------------
  |  Branch (2434:11): [True: 63.5k, False: 42.1k]
  ------------------
 2435|  63.5k|    {
 2436|  63.5k|        idx = CLZ(u2_sig_coeff_map);
 2437|       |
 2438|  63.5k|        idx = 31 - idx;
 2439|  63.5k|        RESET_BIT(u2_sig_coeff_map,idx);
  ------------------
  |  |  105|  63.5k|#define RESET_BIT(x, pos) (x) = (x) & ~(1 << pos);
  ------------------
 2440|       |
 2441|  63.5k|        idx = pu1_inv_scan[idx];
 2442|  63.5k|        pi2_out_coeff_data[idx] = *pi2_coeff_data++;
 2443|       |
 2444|  63.5k|    }
 2445|  42.1k|}

ih264d_parse_hrd_parametres:
   70|    211|{
   71|    211|    UWORD8 u1_index;
   72|    211|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
   73|    211|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
   74|       |
   75|    211|    ps_hrd->u4_cpb_cnt = 1
   76|    211|                    + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
   77|    211|    if(ps_hrd->u4_cpb_cnt > 31)
  ------------------
  |  Branch (77:8): [True: 7, False: 204]
  ------------------
   78|      7|        return ERROR_INV_SPS_PPS_T;
   79|    204|    ps_hrd->u1_bit_rate_scale = ih264d_get_bits_h264(ps_bitstrm, 4);
   80|    204|    ps_hrd->u1_cpb_size_scale = ih264d_get_bits_h264(ps_bitstrm, 4);
   81|       |
   82|    820|    for(u1_index = 0; u1_index < (UWORD8)ps_hrd->u4_cpb_cnt; u1_index++)
  ------------------
  |  Branch (82:23): [True: 616, False: 204]
  ------------------
   83|    616|    {
   84|    616|        ps_hrd->u4_bit_rate[u1_index] = 1
   85|    616|                        + ih264d_uev(pu4_bitstrm_ofst,
   86|    616|                                     pu4_bitstrm_buf);
   87|    616|        ps_hrd->u4_cpb_size[u1_index] = 1
   88|    616|                        + ih264d_uev(pu4_bitstrm_ofst,
   89|    616|                                     pu4_bitstrm_buf);
   90|    616|        ps_hrd->u1_cbr_flag[u1_index] = ih264d_get_bits_h264(ps_bitstrm, 1);
   91|    616|    }
   92|       |
   93|    204|    ps_hrd->u1_initial_cpb_removal_delay = 1
   94|    204|                    + ih264d_get_bits_h264(ps_bitstrm, 5);
   95|    204|    ps_hrd->u1_cpb_removal_delay_length = 1
   96|    204|                    + ih264d_get_bits_h264(ps_bitstrm, 5);
   97|    204|    ps_hrd->u1_dpb_output_delay_length = 1
   98|    204|                    + ih264d_get_bits_h264(ps_bitstrm, 5);
   99|    204|    ps_hrd->u1_time_offset_length = ih264d_get_bits_h264(ps_bitstrm, 5);
  100|       |
  101|    204|    return OK;
  ------------------
  |  |  114|    204|#define OK        0
  ------------------
  102|    211|}
ih264d_parse_vui_parametres:
  127|  5.48k|{
  128|  5.48k|    UWORD8 u4_bits;
  129|  5.48k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  130|  5.48k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  131|  5.48k|    WORD32 ret;
  132|       |
  133|  5.48k|    u4_bits = ih264d_get_bits_h264(ps_bitstrm, 1);
  134|  5.48k|    if(u4_bits)
  ------------------
  |  Branch (134:8): [True: 5.32k, False: 164]
  ------------------
  135|  5.32k|    {
  136|  5.32k|        u4_bits = ih264d_get_bits_h264(ps_bitstrm, 8);
  137|  5.32k|        ps_vu4->u1_aspect_ratio_idc = (UWORD8)u4_bits;
  138|  5.32k|        if(VUI_EXTENDED_SAR == u4_bits)
  ------------------
  |  |   46|  5.32k|#define VUI_EXTENDED_SAR    255
  ------------------
  |  Branch (138:12): [True: 822, False: 4.49k]
  ------------------
  139|    822|        {
  140|    822|            ps_vu4->u2_sar_width = ih264d_get_bits_h264(ps_bitstrm, 16);
  141|    822|            ps_vu4->u2_sar_height = ih264d_get_bits_h264(ps_bitstrm, 16);
  142|    822|        }
  143|  5.32k|    }
  144|       |
  145|  5.48k|    u4_bits = ih264d_get_bits_h264(ps_bitstrm, 1);
  146|  5.48k|    if(u4_bits)
  ------------------
  |  Branch (146:8): [True: 181, False: 5.30k]
  ------------------
  147|    181|    {
  148|    181|        ps_vu4->u1_overscan_appropriate_flag = ih264d_get_bits_h264(
  149|    181|                        ps_bitstrm, 1);
  150|    181|    }
  151|  5.48k|    u4_bits = ih264d_get_bits_h264(ps_bitstrm, 1);
  152|       |    /* Initialize to unspecified (5 for video_format and
  153|       |       2 for colour_primaries, tfr_chars, matrix_coeffs  */
  154|  5.48k|    ps_vu4->u1_video_format = 5;
  155|  5.48k|    ps_vu4->u1_video_full_range_flag = 0;
  156|  5.48k|    ps_vu4->u1_colour_primaries = 2;
  157|  5.48k|    ps_vu4->u1_tfr_chars = 2;
  158|  5.48k|    ps_vu4->u1_matrix_coeffs = 2;
  159|       |
  160|  5.48k|    if(u4_bits)
  ------------------
  |  Branch (160:8): [True: 17, False: 5.46k]
  ------------------
  161|     17|    {
  162|     17|        ps_vu4->u1_video_format = ih264d_get_bits_h264(ps_bitstrm, 3);
  163|     17|        ps_vu4->u1_video_full_range_flag = ih264d_get_bits_h264(ps_bitstrm,
  164|     17|                                                                1);
  165|     17|        u4_bits = ih264d_get_bits_h264(ps_bitstrm, 1);
  166|     17|        if(u4_bits)
  ------------------
  |  Branch (166:12): [True: 4, False: 13]
  ------------------
  167|      4|        {
  168|      4|            ps_vu4->u1_colour_primaries = ih264d_get_bits_h264(ps_bitstrm,
  169|      4|                                                               8);
  170|      4|            ps_vu4->u1_tfr_chars = ih264d_get_bits_h264(ps_bitstrm, 8);
  171|      4|            ps_vu4->u1_matrix_coeffs = ih264d_get_bits_h264(ps_bitstrm, 8);
  172|      4|        }
  173|     17|    }
  174|       |
  175|  5.48k|    u4_bits = ih264d_get_bits_h264(ps_bitstrm, 1);
  176|  5.48k|    if(u4_bits)
  ------------------
  |  Branch (176:8): [True: 143, False: 5.34k]
  ------------------
  177|    143|    {
  178|    143|        ps_vu4->u1_cr_top_field = ih264d_uev(pu4_bitstrm_ofst,
  179|    143|                                             pu4_bitstrm_buf);
  180|    143|        ps_vu4->u1_cr_bottom_field = ih264d_uev(pu4_bitstrm_ofst,
  181|    143|                                                pu4_bitstrm_buf);
  182|    143|    }
  183|       |
  184|  5.48k|    u4_bits = ih264d_get_bits_h264(ps_bitstrm, 1);
  185|  5.48k|    if(u4_bits)
  ------------------
  |  Branch (185:8): [True: 10, False: 5.47k]
  ------------------
  186|     10|    {
  187|     10|        ps_vu4->u4_num_units_in_tick = ih264d_get_bits_h264(ps_bitstrm, 32);
  188|     10|        ps_vu4->u4_time_scale = ih264d_get_bits_h264(ps_bitstrm, 32);
  189|     10|        ps_vu4->u1_fixed_frame_rate_flag = ih264d_get_bits_h264(ps_bitstrm,
  190|     10|                                                                1);
  191|     10|    }
  192|       |
  193|  5.48k|    u4_bits = ih264d_get_bits_h264(ps_bitstrm, 1);
  194|  5.48k|    ps_vu4->u1_nal_hrd_params_present = u4_bits;
  195|  5.48k|    if(u4_bits)
  ------------------
  |  Branch (195:8): [True: 145, False: 5.34k]
  ------------------
  196|    145|    {
  197|    145|        ret = ih264d_parse_hrd_parametres(&ps_vu4->s_nal_hrd, ps_bitstrm);
  198|    145|        if(ret != OK)
  ------------------
  |  |  114|    145|#define OK        0
  ------------------
  |  Branch (198:12): [True: 0, False: 145]
  ------------------
  199|      0|            return ret;
  200|    145|    }
  201|  5.48k|    u4_bits = ih264d_get_bits_h264(ps_bitstrm, 1);
  202|  5.48k|    ps_vu4->u1_vcl_hrd_params_present = u4_bits;
  203|  5.48k|    if(u4_bits)
  ------------------
  |  Branch (203:8): [True: 4, False: 5.48k]
  ------------------
  204|      4|    {
  205|      4|        ret = ih264d_parse_hrd_parametres(&ps_vu4->s_vcl_hrd, ps_bitstrm);
  206|      4|        if(ret != OK)
  ------------------
  |  |  114|      4|#define OK        0
  ------------------
  |  Branch (206:12): [True: 0, False: 4]
  ------------------
  207|      0|            return ret;
  208|      4|    }
  209|       |
  210|  5.48k|    if(ps_vu4->u1_nal_hrd_params_present || u4_bits)
  ------------------
  |  Branch (210:8): [True: 145, False: 5.34k]
  |  Branch (210:45): [True: 0, False: 5.34k]
  ------------------
  211|    145|    {
  212|    145|        ps_vu4->u1_low_delay_hrd_flag = ih264d_get_bits_h264(ps_bitstrm, 1);
  213|    145|    }
  214|  5.48k|    ps_vu4->u1_pic_struct_present_flag = ih264d_get_bits_h264(ps_bitstrm, 1);
  215|       |
  216|  5.48k|    ps_vu4->u1_bitstream_restriction_flag = ih264d_get_bits_h264(ps_bitstrm, 1);
  217|       |
  218|  5.48k|    if(ps_vu4->u1_bitstream_restriction_flag)
  ------------------
  |  Branch (218:8): [True: 142, False: 5.34k]
  ------------------
  219|    142|    {
  220|    142|        ps_vu4->u1_mv_over_pic_boundaries_flag = ih264d_get_bits_h264(
  221|    142|                        ps_bitstrm, 1);
  222|    142|        ps_vu4->u4_max_bytes_per_pic_denom = ih264d_uev(pu4_bitstrm_ofst,
  223|    142|                                                        pu4_bitstrm_buf);
  224|    142|        ps_vu4->u4_max_bits_per_mb_denom = ih264d_uev(pu4_bitstrm_ofst,
  225|    142|                                                      pu4_bitstrm_buf);
  226|    142|        ps_vu4->u4_log2_max_mv_length_horz = ih264d_uev(pu4_bitstrm_ofst,
  227|    142|                                                        pu4_bitstrm_buf);
  228|    142|        ps_vu4->u4_log2_max_mv_length_vert = ih264d_uev(pu4_bitstrm_ofst,
  229|    142|                                                        pu4_bitstrm_buf);
  230|    142|        ps_vu4->u4_num_reorder_frames = ih264d_uev(pu4_bitstrm_ofst,
  231|    142|                                                   pu4_bitstrm_buf);
  232|    142|        ps_vu4->u4_max_dec_frame_buffering = ih264d_uev(pu4_bitstrm_ofst,
  233|    142|                                                        pu4_bitstrm_buf);
  234|    142|        if((ps_vu4->u4_max_dec_frame_buffering > (H264_MAX_REF_PICS * 2)) ||
  ------------------
  |  |  534|    142|#define H264_MAX_REF_PICS         16
  ------------------
  |  Branch (234:12): [True: 0, False: 142]
  ------------------
  235|    142|           (ps_vu4->u4_num_reorder_frames > ps_vu4->u4_max_dec_frame_buffering))
  ------------------
  |  Branch (235:12): [True: 0, False: 142]
  ------------------
  236|      0|        {
  237|      0|            return ERROR_INV_SPS_PPS_T;
  238|      0|        }
  239|    142|    }
  240|  5.34k|    else
  241|  5.34k|    {
  242|       |        /* Setting this to a large value if not present */
  243|  5.34k|        ps_vu4->u4_num_reorder_frames = 64;
  244|  5.34k|        ps_vu4->u4_max_dec_frame_buffering = 64;
  245|  5.34k|    }
  246|       |
  247|  5.48k|    return OK;
  ------------------
  |  |  114|  5.48k|#define OK        0
  ------------------
  248|  5.48k|}

isvcd_set_processor:
  979|    154|{
  980|    154|    isvcd_ctl_set_processor_ip_t *ps_ip;
  981|    154|    isvcd_ctl_set_processor_op_t *ps_op;
  982|    154|    UWORD8 u1_layer_id;
  983|    154|    svc_dec_lyr_struct_t *ps_codec;
  984|    154|    svc_dec_ctxt_t *ps_svcd_ctxt;
  985|    154|    ps_svcd_ctxt = (svc_dec_ctxt_t *) dec_hdl->pv_codec_handle;
  986|       |
  987|    154|    ps_ip = (isvcd_ctl_set_processor_ip_t *) pv_api_ip;
  988|    154|    ps_op = (isvcd_ctl_set_processor_op_t *) pv_api_op;
  989|       |
  990|    154|    ps_svcd_ctxt->e_processor_arch = (IVD_ARCH_T) ps_ip->u4_arch;
  991|    154|    ps_svcd_ctxt->e_processor_soc = (IVD_SOC_T) ps_ip->u4_soc;
  992|       |
  993|    616|    for(u1_layer_id = 0; u1_layer_id < MAX_NUM_RES_LYRS; u1_layer_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (993:26): [True: 462, False: 154]
  ------------------
  994|    462|    {
  995|    462|        ps_codec = &ps_svcd_ctxt->ps_svc_dec_lyr[u1_layer_id];
  996|    462|        ps_codec->s_dec.e_processor_arch = (IVD_ARCH_T) ps_ip->u4_arch;
  997|    462|        ps_codec->s_dec.e_processor_soc = (IVD_SOC_T) ps_ip->u4_soc;
  998|       |
  999|    462|        isvcd_init_function_ptr(ps_codec);
 1000|    462|    }
 1001|       |
 1002|    154|    ps_op->u4_error_code = 0;
 1003|    154|    return IV_SUCCESS;
 1004|    154|}
isvcd_init_decoder:
 1029|  1.88k|{
 1030|  1.88k|    svc_dec_lyr_struct_t *ps_svc_lyr_dec = (svc_dec_lyr_struct_t *) ps_dec_svc_lyr_params;
 1031|  1.88k|    dec_struct_t *ps_dec;
 1032|  1.88k|    dec_slice_params_t *ps_cur_slice;
 1033|  1.88k|    pocstruct_t *ps_prev_poc, *ps_cur_poc;
 1034|  1.88k|    size_t size;
 1035|  1.88k|    ps_dec = &ps_svc_lyr_dec->s_dec;
 1036|       |
 1037|  1.88k|    size = sizeof(pred_info_t) * 2 * 32;
 1038|  1.88k|    memset(ps_dec->ps_pred, 0, size);
 1039|       |
 1040|  1.88k|    size = sizeof(disp_mgr_t);
 1041|  1.88k|    memset(ps_dec->pv_disp_buf_mgr, 0, size);
 1042|       |
 1043|  1.88k|    size = ih264_buf_mgr_size();
 1044|  1.88k|    memset(ps_dec->pv_pic_buf_mgr, 0, size);
 1045|       |
 1046|  1.88k|    size = sizeof(dec_err_status_t);
 1047|  1.88k|    memset(ps_dec->ps_dec_err_status, 0, size);
 1048|       |
 1049|  1.88k|    size = sizeof(sei);
 1050|  1.88k|    memset(ps_dec->ps_sei, 0, size);
 1051|       |
 1052|  1.88k|    size = sizeof(sei);
 1053|  1.88k|    memset(ps_dec->ps_sei_parse, 0, size);
 1054|       |
 1055|  1.88k|    size = sizeof(dpb_commands_t);
 1056|  1.88k|    memset(ps_dec->ps_dpb_cmds, 0, size);
 1057|       |
 1058|  1.88k|    size = sizeof(dec_bit_stream_t);
 1059|  1.88k|    memset(ps_dec->ps_bitstrm, 0, size);
 1060|       |
 1061|  1.88k|    size = sizeof(dec_slice_params_t);
 1062|  1.88k|    memset(ps_dec->ps_cur_slice, 0, size);
 1063|       |
 1064|  1.88k|    size = MAX(sizeof(dec_seq_params_t), sizeof(dec_pic_params_t));
  ------------------
  |  |   60|  1.88k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 1.88k, Folded]
  |  |  ------------------
  ------------------
 1065|  1.88k|    memset(ps_dec->pv_scratch_sps_pps, 0, size);
 1066|       |
 1067|  1.88k|    size = sizeof(dec_svc_seq_params_t);
 1068|  1.88k|    memset(ps_svc_lyr_dec->pv_scratch_subset_sps, 0, size);
 1069|       |
 1070|  1.88k|    size = sizeof(ctxt_inc_mb_info_t);
 1071|  1.88k|    memset(ps_dec->ps_left_mb_ctxt_info, 0, size);
 1072|       |
 1073|  1.88k|    size = (sizeof(neighbouradd_t) << 2);
 1074|  1.88k|    memset(ps_dec->ps_left_mvpred_addr, 0, size);
 1075|       |
 1076|  1.88k|    size = ih264_buf_mgr_size();
 1077|  1.88k|    memset(ps_dec->pv_mv_buf_mgr, 0, size);
 1078|       |
 1079|       |    /* Free any dynamic buffers that are allocated */
 1080|  1.88k|    isvcd_free_dynamic_bufs(ps_svc_lyr_dec);
 1081|       |
 1082|  1.88k|    isvcd_init_dpb_ref_bufs(ps_dec);
 1083|       |
 1084|  1.88k|    ps_cur_slice = ps_dec->ps_cur_slice;
 1085|  1.88k|    ps_dec->init_done = 0;
 1086|       |
 1087|  1.88k|    ps_dec->u4_num_cores = 1;
 1088|  1.88k|    ps_dec->u2_pic_ht = ps_dec->u2_pic_wd = 0;
 1089|       |
 1090|  1.88k|    ps_dec->u1_separate_parse = DEFAULT_SEPARATE_PARSE;
  ------------------
  |  |  540|  1.88k|#define DEFAULT_SEPARATE_PARSE (H264_DEFAULT_NUM_CORES == 2)? 1 :0
  |  |  ------------------
  |  |  |  |  539|  1.88k|#define H264_DEFAULT_NUM_CORES 1
  |  |  ------------------
  |  |  |  Branch (540:32): [Folded, False: 1.88k]
  |  |  ------------------
  ------------------
 1091|  1.88k|    ps_dec->u4_app_disable_deblk_frm = 0;
 1092|  1.88k|    ps_dec->i4_degrade_type = 0;
 1093|  1.88k|    ps_dec->i4_degrade_pics = 0;
 1094|       |
 1095|       |    /* Initialization of function pointers ih264d_deblock_picture function*/
 1096|  1.88k|    ps_dec->p_DeblockPicture[0] = ih264d_deblock_picture_non_mbaff;
 1097|  1.88k|    ps_dec->p_DeblockPicture[1] = ih264d_deblock_picture_mbaff;
 1098|       |
 1099|  1.88k|    ps_dec->s_cab_dec_env.pv_codec_handle = ps_dec;
 1100|  1.88k|    ps_dec->u4_num_fld_in_frm = 0;
 1101|  1.88k|    ps_dec->ps_dpb_mgr->pv_codec_handle = ps_dec;
 1102|       |
 1103|       |    /* Initialize the sei validity u4_flag with zero indiacting sei is not valid*/
 1104|  1.88k|    ps_dec->ps_sei->u1_is_valid = 0;
 1105|       |
 1106|       |    /* decParams Initializations */
 1107|  1.88k|    ps_dec->ps_cur_pps = NULL;
 1108|  1.88k|    ps_dec->ps_cur_sps = NULL;
 1109|  1.88k|    ps_dec->u1_init_dec_flag = 0;
 1110|  1.88k|    ps_dec->u1_first_slice_in_stream = 1;
 1111|  1.88k|    ps_dec->u1_last_pic_not_decoded = 0;
 1112|  1.88k|    ps_dec->u4_app_disp_width = 0;
 1113|  1.88k|    ps_dec->i4_header_decoded = 0;
 1114|  1.88k|    ps_dec->u4_total_frames_decoded = 0;
 1115|       |
 1116|  1.88k|    ps_dec->i4_error_code = 0;
 1117|  1.88k|    ps_dec->i4_content_type = IV_CONTENTTYPE_NA;
 1118|  1.88k|    ps_dec->ps_cur_slice->u1_mbaff_frame_flag = 0;
 1119|       |
 1120|  1.88k|    ps_dec->ps_dec_err_status->u1_err_flag = ACCEPT_ALL_PICS;
  ------------------
  |  |  600|  1.88k|#define ACCEPT_ALL_PICS   (0x00)
  ------------------
 1121|  1.88k|    ps_dec->ps_dec_err_status->u1_cur_pic_type = PIC_TYPE_UNKNOWN;
  ------------------
  |  |  607|  1.88k|#define PIC_TYPE_UNKNOWN  (0xFF)
  ------------------
 1122|  1.88k|    ps_dec->ps_dec_err_status->u4_frm_sei_sync = SYNC_FRM_DEFAULT;
  ------------------
  |  |  609|  1.88k|#define SYNC_FRM_DEFAULT  (0xFFFFFFFF)
  ------------------
 1123|  1.88k|    ps_dec->ps_dec_err_status->u4_cur_frm = INIT_FRAME;
  ------------------
  |  |  610|  1.88k|#define INIT_FRAME        (0xFFFFFF)
  ------------------
 1124|  1.88k|    ps_dec->ps_dec_err_status->u1_pic_aud_i = PIC_TYPE_UNKNOWN;
  ------------------
  |  |  607|  1.88k|#define PIC_TYPE_UNKNOWN  (0xFF)
  ------------------
 1125|       |
 1126|  1.88k|    ps_dec->u1_pr_sl_type = 0xFF;
 1127|  1.88k|    ps_dec->u2_mbx = 0xffff;
 1128|  1.88k|    ps_dec->u2_mby = 0;
 1129|  1.88k|    ps_dec->u4_total_mbs_coded = 0;
 1130|       |
 1131|       |    /* POC initializations */
 1132|  1.88k|    ps_prev_poc = &ps_dec->s_prev_pic_poc;
 1133|  1.88k|    ps_cur_poc = &ps_dec->s_cur_pic_poc;
 1134|  1.88k|    ps_prev_poc->i4_pic_order_cnt_lsb = ps_cur_poc->i4_pic_order_cnt_lsb = 0;
 1135|  1.88k|    ps_prev_poc->i4_pic_order_cnt_msb = ps_cur_poc->i4_pic_order_cnt_msb = 0;
 1136|  1.88k|    ps_prev_poc->i4_delta_pic_order_cnt_bottom = ps_cur_poc->i4_delta_pic_order_cnt_bottom = 0;
 1137|  1.88k|    ps_prev_poc->i4_delta_pic_order_cnt[0] = ps_cur_poc->i4_delta_pic_order_cnt[0] = 0;
 1138|  1.88k|    ps_prev_poc->i4_delta_pic_order_cnt[1] = ps_cur_poc->i4_delta_pic_order_cnt[1] = 0;
 1139|  1.88k|    ps_prev_poc->u1_mmco_equalto5 = ps_cur_poc->u1_mmco_equalto5 = 0;
 1140|  1.88k|    ps_prev_poc->i4_top_field_order_count = ps_cur_poc->i4_top_field_order_count = 0;
 1141|  1.88k|    ps_prev_poc->i4_bottom_field_order_count = ps_cur_poc->i4_bottom_field_order_count = 0;
 1142|  1.88k|    ps_prev_poc->u1_bot_field = ps_cur_poc->u1_bot_field = 0;
 1143|  1.88k|    ps_prev_poc->u1_mmco_equalto5 = ps_cur_poc->u1_mmco_equalto5 = 0;
 1144|  1.88k|    ps_prev_poc->i4_prev_frame_num_ofst = ps_cur_poc->i4_prev_frame_num_ofst = 0;
 1145|  1.88k|    ps_cur_slice->u1_mmco_equalto5 = 0;
 1146|  1.88k|    ps_cur_slice->u2_frame_num = 0;
 1147|       |
 1148|  1.88k|    ps_dec->i4_max_poc = 0;
 1149|  1.88k|    ps_dec->i4_prev_max_display_seq = 0;
 1150|  1.88k|    ps_dec->u4_recon_mb_grp = 4;
 1151|  1.88k|    ps_dec->i4_reorder_depth = -1;
 1152|       |
 1153|       |    /* Field PIC initializations */
 1154|  1.88k|    ps_dec->u1_second_field = 0;
 1155|  1.88k|    ps_dec->s_prev_seq_params.u1_eoseq_pending = 0;
 1156|       |
 1157|       |    /* Set the cropping parameters as zero */
 1158|  1.88k|    ps_dec->u2_crop_offset_y = 0;
 1159|  1.88k|    ps_dec->u2_crop_offset_uv = 0;
 1160|       |
 1161|       |    /* The Initial Frame Rate Info is not Present */
 1162|  1.88k|    ps_dec->i4_vui_frame_rate = -1;
 1163|  1.88k|    ps_dec->i4_pic_type = NA_SLICE;
  ------------------
  |  |  367|  1.88k|#define NA_SLICE -1
  ------------------
 1164|  1.88k|    ps_dec->i4_frametype = IV_NA_FRAME;
 1165|  1.88k|    ps_dec->i4_content_type = IV_CONTENTTYPE_NA;
 1166|       |
 1167|  1.88k|    ps_dec->u1_res_changed = 0;
 1168|       |
 1169|  1.88k|    ps_dec->u1_frame_decoded_flag = 0;
 1170|       |
 1171|       |    /* Set the default frame seek mask mode */
 1172|  1.88k|    ps_dec->u4_skip_frm_mask = SKIP_NONE;
  ------------------
  |  |  375|  1.88k|#define SKIP_NONE  (0x0)
  ------------------
 1173|       |
 1174|       |    /********************************************************/
 1175|       |    /* Initialize CAVLC residual decoding function pointers */
 1176|       |    /********************************************************/
 1177|  1.88k|    ps_dec->pf_cavlc_4x4res_block[0] = ih264d_cavlc_4x4res_block_totalcoeff_1;
 1178|  1.88k|    ps_dec->pf_cavlc_4x4res_block[1] = ih264d_cavlc_4x4res_block_totalcoeff_2to10;
 1179|  1.88k|    ps_dec->pf_cavlc_4x4res_block[2] = ih264d_cavlc_4x4res_block_totalcoeff_11to16;
 1180|       |
 1181|  1.88k|    ps_dec->pf_cavlc_parse4x4coeff[0] = ih264d_cavlc_parse4x4coeff_n0to7;
 1182|  1.88k|    ps_dec->pf_cavlc_parse4x4coeff[1] = ih264d_cavlc_parse4x4coeff_n8;
 1183|       |
 1184|  1.88k|    ps_dec->pf_cavlc_parse_8x8block[0] = ih264d_cavlc_parse_8x8block_none_available;
 1185|  1.88k|    ps_dec->pf_cavlc_parse_8x8block[1] = ih264d_cavlc_parse_8x8block_left_available;
 1186|  1.88k|    ps_dec->pf_cavlc_parse_8x8block[2] = ih264d_cavlc_parse_8x8block_top_available;
 1187|  1.88k|    ps_dec->pf_cavlc_parse_8x8block[3] = ih264d_cavlc_parse_8x8block_both_available;
 1188|       |
 1189|       |    /***************************************************************************/
 1190|       |    /* Initialize Bs calculation function pointers for P and B, 16x16/non16x16 */
 1191|       |    /***************************************************************************/
 1192|  1.88k|    ps_dec->pf_fill_bs1[0][0] = ih264d_fill_bs1_16x16mb_pslice;
 1193|  1.88k|    ps_dec->pf_fill_bs1[0][1] = ih264d_fill_bs1_non16x16mb_pslice;
 1194|       |
 1195|  1.88k|    ps_dec->pf_fill_bs1[1][0] = ih264d_fill_bs1_16x16mb_bslice;
 1196|  1.88k|    ps_dec->pf_fill_bs1[1][1] = ih264d_fill_bs1_non16x16mb_bslice;
 1197|       |
 1198|  1.88k|    ps_dec->pf_fill_bs_xtra_left_edge[0] = ih264d_fill_bs_xtra_left_edge_cur_frm;
 1199|  1.88k|    ps_dec->pf_fill_bs_xtra_left_edge[1] = ih264d_fill_bs_xtra_left_edge_cur_fld;
 1200|       |
 1201|       |    /* Initialize Reference Pic Buffers */
 1202|  1.88k|    ih264d_init_ref_bufs(ps_dec->ps_dpb_mgr);
 1203|       |
 1204|  1.88k|    ps_dec->u2_prv_frame_num = 0;
 1205|  1.88k|    ps_dec->u1_top_bottom_decoded = 0;
 1206|  1.88k|    ps_dec->u1_dangling_field = 0;
 1207|       |
 1208|  1.88k|    ps_dec->s_cab_dec_env.cabac_table = gau4_ih264d_cabac_table;
 1209|       |
 1210|  1.88k|    ps_dec->pu1_left_mv_ctxt_inc = ps_dec->u1_left_mv_ctxt_inc_arr[0];
 1211|  1.88k|    ps_dec->pi1_left_ref_idx_ctxt_inc = &ps_dec->i1_left_ref_idx_ctx_inc_arr[0][0];
 1212|  1.88k|    ps_dec->pu1_left_yuv_dc_csbp = &ps_dec->u1_yuv_dc_csbp_topmb;
 1213|       |
 1214|       |    /* ! */
 1215|       |    /* Initializing flush frame u4_flag */
 1216|  1.88k|    ps_dec->u1_flushfrm = 0;
 1217|       |
 1218|  1.88k|    ps_dec->s_cab_dec_env.pv_codec_handle = (void *) ps_dec;
 1219|  1.88k|    ps_dec->ps_bitstrm->pv_codec_handle = (void *) ps_dec;
 1220|  1.88k|    ps_dec->ps_cur_slice->pv_codec_handle = (void *) ps_dec;
 1221|  1.88k|    ps_dec->ps_dpb_mgr->pv_codec_handle = (void *) ps_dec;
 1222|       |
 1223|  1.88k|    memset(ps_dec->disp_bufs, 0, (MAX_DISP_BUFS_NEW) * sizeof(disp_buf_t));
  ------------------
  |  |   76|  1.88k|#define MAX_DISP_BUFS_NEW 64
  ------------------
 1224|  1.88k|    memset(ps_dec->u4_disp_buf_mapping, 0, (MAX_DISP_BUFS_NEW) * sizeof(UWORD32));
  ------------------
  |  |   76|  1.88k|#define MAX_DISP_BUFS_NEW 64
  ------------------
 1225|  1.88k|    memset(ps_dec->u4_disp_buf_to_be_freed, 0, (MAX_DISP_BUFS_NEW) * sizeof(UWORD32));
  ------------------
  |  |   76|  1.88k|#define MAX_DISP_BUFS_NEW 64
  ------------------
 1226|  1.88k|    memset(ps_dec->ps_cur_slice, 0, sizeof(dec_slice_params_t));
 1227|       |
 1228|  1.88k|    ih264d_init_arch(ps_dec);
 1229|  1.88k|    isvcd_init_function_ptr(ps_svc_lyr_dec);
 1230|  1.88k|    ps_dec->e_frm_out_mode = IVD_DISPLAY_FRAME_OUT;
 1231|  1.88k|    ps_dec->init_done = 1;
 1232|  1.88k|    ps_svc_lyr_dec->u1_layer_identifier = BASE_LAYER;
  ------------------
  |  |  108|  1.88k|#define BASE_LAYER 0
  ------------------
 1233|  1.88k|}
isvcd_nal_parse_ctxt_free:
 1257|    154|{
 1258|    154|    dec_struct_t *ps_dec;
 1259|    154|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 1260|    154|    void (*pf_aligned_free)(void *pv_mem_ctxt, void *pv_buf);
 1261|    154|    void *pv_mem_ctxt;
 1262|    154|    nal_parse_ctxt_t *ps_ctxt;
 1263|    154|    ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[0];
 1264|    154|    ps_dec = &ps_svc_lyr_dec->s_dec;
 1265|    154|    pf_aligned_free = ps_dec->pf_aligned_free;
 1266|       |
 1267|    154|    pv_mem_ctxt = ps_dec->pv_mem_ctxt;
 1268|    154|    ps_ctxt = (nal_parse_ctxt_t *) ps_svcd_ctxt->pv_nal_parse_ctxt;
 1269|       |
 1270|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->s_dqid_ctxt.ps_dqid_node);
 1271|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->pv_nal_header_buf);
 1272|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->pv_nal_unit);
 1273|    154|    pf_aligned_free(pv_mem_ctxt, ps_svcd_ctxt->pv_vcl_nal_buff);
 1274|    154|    pf_aligned_free(pv_mem_ctxt, ps_svcd_ctxt->pv_non_vcl_nal_buff);
 1275|    154|    pf_aligned_free(pv_mem_ctxt, ps_svcd_ctxt->pv_nal_parse_ctxt);
 1276|    154|}
isvcd_residual_resample_ctxt_free:
 1299|    154|{
 1300|    154|    dec_struct_t *ps_dec;
 1301|    154|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 1302|    154|    void (*pf_aligned_free)(void *pv_mem_ctxt, void *pv_buf);
 1303|    154|    void *pv_mem_ctxt;
 1304|    154|    residual_sampling_ctxt_t *ps_ctxt;
 1305|    154|    ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[0];
 1306|    154|    ps_dec = &ps_svc_lyr_dec->s_dec;
 1307|    154|    pf_aligned_free = ps_dec->pf_aligned_free;
 1308|       |
 1309|    154|    pv_mem_ctxt = ps_dec->pv_mem_ctxt;
 1310|    154|    ps_ctxt = (residual_sampling_ctxt_t *) ps_svcd_ctxt->pv_residual_sample_ctxt;
 1311|       |
 1312|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->pi2_refarray_buffer);
 1313|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->pu1_ref_x_ptr_incr);
 1314|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.ps_x_offset_length);
 1315|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.ps_y_offset_length);
 1316|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.ps_x_pos_phase);
 1317|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.ps_y_pos_phase);
 1318|    154|    pf_aligned_free(pv_mem_ctxt, ps_svcd_ctxt->pv_residual_sample_ctxt);
 1319|    154|}
isvcd_intra_resample_ctxt_free:
 1342|    154|{
 1343|    154|    dec_struct_t *ps_dec;
 1344|    154|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 1345|    154|    void (*pf_aligned_free)(void *pv_mem_ctxt, void *pv_buf);
 1346|    154|    void *pv_mem_ctxt;
 1347|    154|    intra_sampling_ctxt_t *ps_ctxt;
 1348|    154|    ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[0];
 1349|    154|    ps_dec = &ps_svc_lyr_dec->s_dec;
 1350|    154|    pf_aligned_free = ps_dec->pf_aligned_free;
 1351|       |
 1352|    154|    pv_mem_ctxt = ps_dec->pv_mem_ctxt;
 1353|    154|    ps_ctxt = (intra_sampling_ctxt_t *) ps_svcd_ctxt->pv_intra_sample_ctxt;
 1354|       |
 1355|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->pu1_refarray_buffer);
 1356|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->pu1_refarray_cb);
 1357|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->pu1_refarray_cr);
 1358|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->pi4_temp_interpolation_buffer);
 1359|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.ps_x_offset_length);
 1360|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.ps_y_offset_length);
 1361|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.ps_x_min_max);
 1362|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.ps_y_min_max);
 1363|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.ps_x_pos_phase);
 1364|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.ps_y_pos_phase);
 1365|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.pi2_xd_index);
 1366|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.pi2_yd_index);
 1367|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.pi2_ya_index);
 1368|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.ps_seg_lookup_horz);
 1369|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.ps_seg_lookup_vert);
 1370|    154|    pf_aligned_free(pv_mem_ctxt, ps_ctxt->as_res_lyrs[0].s_luma_map_ctxt.pu1_refarray_x_idx);
 1371|    154|    pf_aligned_free(pv_mem_ctxt, ps_svcd_ctxt->pv_intra_sample_ctxt);
 1372|    154|    pf_aligned_free(pv_mem_ctxt, ps_svcd_ctxt->pv_ii_pred_ctxt);
 1373|    154|}
isvcd_mode_mv_resample_ctxt_free:
 1395|    154|{
 1396|    154|    dec_struct_t *ps_dec;
 1397|    154|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 1398|    154|    void (*pf_aligned_free)(void *pv_mem_ctxt, void *pv_buf);
 1399|    154|    void *pv_mem_ctxt;
 1400|    154|    mode_motion_ctxt_t *ps_mode_motion;
 1401|       |
 1402|    154|    ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[0];
 1403|    154|    ps_dec = &ps_svc_lyr_dec->s_dec;
 1404|    154|    pf_aligned_free = ps_dec->pf_aligned_free;
 1405|       |
 1406|    154|    pv_mem_ctxt = ps_dec->pv_mem_ctxt;
 1407|    154|    ps_mode_motion = (mode_motion_ctxt_t *) ps_svcd_ctxt->pv_mode_mv_sample_ctxt;
 1408|       |
 1409|    154|    pf_aligned_free(pv_mem_ctxt, ps_mode_motion->ps_motion_pred_struct);
 1410|    154|    pf_aligned_free(pv_mem_ctxt, ps_mode_motion->as_res_lyr_mem[0].pi2_ref_loc_x);
 1411|    154|    pf_aligned_free(pv_mem_ctxt, ps_mode_motion->as_res_lyr_mem[0].pi2_ref_loc_y);
 1412|    154|    pf_aligned_free(pv_mem_ctxt, ps_svcd_ctxt->pv_ref_lyr_offset);
 1413|    154|    pf_aligned_free(pv_mem_ctxt, ps_svcd_ctxt->pv_mode_mv_sample_ctxt);
 1414|    154|}
isvcd_free_static_bufs:
 1437|    154|{
 1438|    154|    dec_struct_t *ps_dec;
 1439|    154|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 1440|       |
 1441|    154|    UWORD8 u1_layer_id;
 1442|    154|    svc_dec_ctxt_t *ps_svcd_ctxt;
 1443|       |
 1444|    154|    void (*pf_aligned_free)(void *pv_mem_ctxt, void *pv_buf);
 1445|    154|    void *pv_mem_ctxt;
 1446|       |
 1447|    154|    ps_svcd_ctxt = (svc_dec_ctxt_t *) dec_hdl->pv_codec_handle;
 1448|       |
 1449|    154|    isvcd_intra_resample_ctxt_free(ps_svcd_ctxt);
 1450|    154|    isvcd_residual_resample_ctxt_free(ps_svcd_ctxt);
 1451|    154|    isvcd_mode_mv_resample_ctxt_free(ps_svcd_ctxt);
 1452|    154|    isvcd_nal_parse_ctxt_free(ps_svcd_ctxt);
 1453|       |
 1454|    616|    for(u1_layer_id = 0; u1_layer_id < MAX_NUM_RES_LYRS; u1_layer_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (1454:26): [True: 462, False: 154]
  ------------------
 1455|    462|    {
 1456|    462|        ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[u1_layer_id];
 1457|    462|        ps_dec = &ps_svc_lyr_dec->s_dec;
 1458|    462|        pf_aligned_free = ps_dec->pf_aligned_free;
 1459|    462|        pv_mem_ctxt = ps_dec->pv_mem_ctxt;
 1460|       |
 1461|       |#ifdef KEEP_THREADS_ACTIVE
 1462|       |        /* Wait for threads */
 1463|       |        ps_dec->i4_break_threads = 1;
 1464|       |        if(ps_dec->u4_dec_thread_created)
 1465|       |        {
 1466|       |            ithread_mutex_lock(ps_dec->apv_proc_start_mutex[0]);
 1467|       |
 1468|       |            ps_dec->ai4_process_start[0] = PROC_START;
 1469|       |
 1470|       |            ithread_cond_signal(ps_dec->apv_proc_start_condition[0]);
 1471|       |
 1472|       |            ithread_mutex_unlock(ps_dec->apv_proc_start_mutex[0]);
 1473|       |
 1474|       |            ithread_join(ps_dec->pv_dec_thread_handle, NULL);
 1475|       |
 1476|       |            ps_dec->u4_dec_thread_created = 0;
 1477|       |        }
 1478|       |
 1479|       |        if(ps_dec->u4_bs_deblk_thread_created)
 1480|       |        {
 1481|       |            ithread_mutex_lock(ps_dec->apv_proc_start_mutex[1]);
 1482|       |
 1483|       |            ps_dec->ai4_process_start[1] = PROC_START;
 1484|       |
 1485|       |            ithread_cond_signal(ps_dec->apv_proc_start_condition[1]);
 1486|       |
 1487|       |            ithread_mutex_unlock(ps_dec->apv_proc_start_mutex[1]);
 1488|       |
 1489|       |            ithread_join(ps_dec->pv_bs_deblk_thread_handle, NULL);
 1490|       |
 1491|       |            ps_dec->u4_bs_deblk_thread_created = 0;
 1492|       |        }
 1493|       |
 1494|       |        // destroy mutex and condition variable for both the threads
 1495|       |        // 1. ih264d_decode_picture_thread
 1496|       |        // 2. ih264d_recon_deblk_thread
 1497|       |        {
 1498|       |            UWORD32 i;
 1499|       |            for(i = 0; i < 2; i++)
 1500|       |            {
 1501|       |                ithread_cond_destroy(ps_dec->apv_proc_start_condition[i]);
 1502|       |                ithread_cond_destroy(ps_dec->apv_proc_done_condition[i]);
 1503|       |
 1504|       |                ithread_mutex_destroy(ps_dec->apv_proc_start_mutex[i]);
 1505|       |                ithread_mutex_destroy(ps_dec->apv_proc_done_mutex[i]);
 1506|       |            }
 1507|       |        }
 1508|       |        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->apv_proc_start_mutex[0]);
 1509|       |        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->apv_proc_start_condition[0]);
 1510|       |#endif
 1511|    462|        if(0 == u1_layer_id)
  ------------------
  |  Branch (1511:12): [True: 154, False: 308]
  ------------------
 1512|    154|        {
 1513|    154|            UWORD8 u1_sps_ctr;
 1514|    154|            PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_sps);
  ------------------
  |  |   43|    154|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    154|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 154, False: 0]
  |  |  ------------------
  ------------------
 1515|  10.0k|            for(u1_sps_ctr = 0; u1_sps_ctr < (2 * MAX_NUM_SEQ_PARAMS); u1_sps_ctr++)
  ------------------
  |  |  521|  10.0k|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
  |  Branch (1515:33): [True: 9.85k, False: 154]
  ------------------
 1516|  9.85k|            {
 1517|  9.85k|                if(NULL != ps_svcd_ctxt->ps_subset_sps[u1_sps_ctr].s_sps_svc_ext.ps_svc_vui_ext)
  ------------------
  |  Branch (1517:20): [True: 9, False: 9.84k]
  ------------------
 1518|      9|                {
 1519|      9|                    PS_DEC_ALIGNED_FREE(
  ------------------
  |  |   43|      9|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|      9|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 9, False: 0]
  |  |  ------------------
  ------------------
 1520|      9|                        ps_dec,
 1521|      9|                        ps_svcd_ctxt->ps_subset_sps[u1_sps_ctr].s_sps_svc_ext.ps_svc_vui_ext);
 1522|      9|                }
 1523|  9.85k|            }
 1524|    154|            PS_DEC_ALIGNED_FREE(ps_dec, ps_svc_lyr_dec->ps_subset_sps);
  ------------------
  |  |   43|    154|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    154|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 154, False: 0]
  |  |  ------------------
  ------------------
 1525|    154|            PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_pps);
  ------------------
  |  |   43|    154|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    154|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 154, False: 0]
  |  |  ------------------
  ------------------
 1526|    154|            PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_sei);
  ------------------
  |  |   43|    154|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    154|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 154, False: 0]
  |  |  ------------------
  ------------------
 1527|    154|            PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_sei_parse);
  ------------------
  |  |   43|    154|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    154|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 154, False: 0]
  |  |  ------------------
  ------------------
 1528|    154|        }
 1529|       |
 1530|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pv_dec_thread_handle);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1531|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pv_bs_deblk_thread_handle);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1532|       |
 1533|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_dpb_mgr);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1534|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_pred);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1535|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pv_disp_buf_mgr);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1536|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_pic_buf_base);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1537|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_dec_err_status);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1538|       |
 1539|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_dpb_cmds);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1540|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_bitstrm);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1541|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_svc_lyr_dec->ps_nal_svc_ext);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1542|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_cur_slice);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1543|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pv_scratch_sps_pps);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1544|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_svc_lyr_dec->pv_scratch_subset_sps);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1545|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu1_bits_buf_static);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1546|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ppv_map_ref_idx_to_poc_base);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1547|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->p_cabac_ctxt_table_t);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1548|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_left_mb_ctxt_info);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1549|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu1_ref_buff_base);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1550|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pi2_pred1);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1551|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu1_temp_mc_buffer);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1552|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu1_init_dpb_base);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1553|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu4_mbaff_wt_mat);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1554|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu4_wts_ofsts_mat);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1555|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_left_mvpred_addr);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1556|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->ps_col_mv_base);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1557|    462|        PS_DEC_ALIGNED_FREE(ps_dec, ps_svc_lyr_dec->pu1_ii_resamp_buffer_luma);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1558|       |
 1559|    462|        if(NULL != ps_dec->pv_pic_buf_mgr)
  ------------------
  |  Branch (1559:12): [True: 462, False: 0]
  ------------------
 1560|    462|        {
 1561|    462|            if(u1_layer_id < ps_svcd_ctxt->u1_prev_num_res_layers)
  ------------------
  |  Branch (1561:16): [True: 277, False: 185]
  ------------------
 1562|    277|            {
 1563|    277|                if(((buf_mgr_t *) ps_dec->pv_pic_buf_mgr)->pv_mutex != NULL)
  ------------------
  |  Branch (1563:20): [True: 100, False: 177]
  ------------------
 1564|    100|                    ih264_buf_mgr_free(ps_dec->pv_pic_buf_mgr);
 1565|    277|            }
 1566|    462|            PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pv_pic_buf_mgr);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1567|    462|        }
 1568|    462|        if(NULL != ps_dec->pv_mv_buf_mgr)
  ------------------
  |  Branch (1568:12): [True: 462, False: 0]
  ------------------
 1569|    462|        {
 1570|    462|            if(u1_layer_id < ps_svcd_ctxt->u1_prev_num_res_layers)
  ------------------
  |  Branch (1570:16): [True: 277, False: 185]
  ------------------
 1571|    277|            {
 1572|    277|                if(((buf_mgr_t *) ps_dec->pv_mv_buf_mgr)->pv_mutex != NULL)
  ------------------
  |  Branch (1572:20): [True: 100, False: 177]
  ------------------
 1573|    100|                    ih264_buf_mgr_free(ps_dec->pv_mv_buf_mgr);
 1574|    277|            }
 1575|    462|            PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pv_mv_buf_mgr);
  ------------------
  |  |   43|    462|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|    462|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 462, False: 0]
  |  |  ------------------
  ------------------
 1576|    462|        }
 1577|    462|    }
 1578|       |
 1579|    154|    pf_aligned_free(pv_mem_ctxt, ps_svcd_ctxt->ps_svc_dec_lyr);
 1580|    154|    pf_aligned_free(pv_mem_ctxt, dec_hdl->pv_codec_handle);
 1581|       |
 1582|    154|    if(dec_hdl)
  ------------------
  |  Branch (1582:8): [True: 154, False: 0]
  ------------------
 1583|    154|    {
 1584|    154|        pf_aligned_free(pv_mem_ctxt, dec_hdl);
 1585|    154|    }
 1586|       |
 1587|    154|    return IV_SUCCESS;
 1588|    154|}
isvcd_nal_parse_ctxt_create:
 1614|    154|{
 1615|    154|    isvcd_create_ip_t *ps_create_ip;
 1616|    154|    void *pv_buf;
 1617|    154|    void *(*pf_aligned_alloc)(void *pv_mem_ctxt, WORD32 alignment, WORD32 size);
 1618|    154|    void *pv_mem_ctxt;
 1619|    154|    WORD32 size;
 1620|    154|    nal_parse_ctxt_t *ps_nal_parse_ctxt;
 1621|    154|    UWORD8 *pu1_ptr;
 1622|    154|    UNUSED(pv_api_op);
  ------------------
  |  |   45|    154|#define UNUSED(x) ((void)(x))
  ------------------
 1623|       |
 1624|    154|    ps_create_ip = (isvcd_create_ip_t *) pv_api_ip;
 1625|       |
 1626|    154|    pf_aligned_alloc = ps_create_ip->s_ivd_create_ip_t.pf_aligned_alloc;
 1627|    154|    pv_mem_ctxt = ps_create_ip->s_ivd_create_ip_t.pv_mem_ctxt;
 1628|       |
 1629|       |    /*-----------------------------------------------------------------------*/
 1630|       |    /* Handle                                                                */
 1631|       |    /*-----------------------------------------------------------------------*/
 1632|    154|    size = sizeof(nal_parse_ctxt_t);
 1633|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1634|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1635|    154|    memset(pv_buf, 0, size);
 1636|    154|    ps_nal_parse_ctxt = pv_buf;
 1637|       |
 1638|       |    /* set the lowest dqid to -1 */
 1639|    154|    ps_nal_parse_ctxt->i4_prev_dq_id = -1;
 1640|       |
 1641|       |    /*-----------------------------------------------------------------------*/
 1642|       |    /* DQID list buffer and initialization of vcl node buffer context        */
 1643|       |    /*-----------------------------------------------------------------------*/
 1644|    154|    {
 1645|    154|        WORD32 i4_lyr_idx;
 1646|    154|        WORD32 i4_max_num_lyrs;
 1647|    154|        vcl_node_t *ps_vcl_node;
 1648|    154|        dqid_node_t *ps_dqid_node;
 1649|    154|        dqid_ctxt_t *ps_dqid_ctxt;
 1650|       |
 1651|    154|        size = sizeof(vcl_node_t);
 1652|    154|        size += sizeof(dqid_node_t);
 1653|    154|        size *= MAX_NUM_RES_LYRS;
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 1654|       |
 1655|    154|        ps_dqid_ctxt = &ps_nal_parse_ctxt->s_dqid_ctxt;
 1656|       |
 1657|    154|        ps_dqid_ctxt->i4_max_num_lyrs = MAX_NUM_RES_LYRS;
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 1658|       |
 1659|    154|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1660|    154|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1661|    154|        memset(pv_buf, 0, size);
 1662|       |
 1663|    154|        ps_dqid_ctxt->ps_dqid_node = pv_buf;
 1664|    154|        ps_dqid_node = ps_dqid_ctxt->ps_dqid_node;
 1665|       |
 1666|    154|        i4_max_num_lyrs = ps_dqid_ctxt->i4_max_num_lyrs;
 1667|       |
 1668|    154|        pu1_ptr = pv_buf;
 1669|    154|        pu1_ptr += sizeof(dqid_node_t) * i4_max_num_lyrs;
 1670|    154|        ps_vcl_node = (vcl_node_t *) pu1_ptr;
 1671|       |
 1672|    616|        for(i4_lyr_idx = 0; i4_lyr_idx < i4_max_num_lyrs; i4_lyr_idx++)
  ------------------
  |  Branch (1672:29): [True: 462, False: 154]
  ------------------
 1673|    462|        {
 1674|    462|            ps_dqid_node->ps_vcl_node = ps_vcl_node;
 1675|       |
 1676|       |            /* Loop updates */
 1677|    462|            ps_vcl_node += 1;
 1678|    462|            ps_dqid_node += 1;
 1679|    462|        } /* Loop over all the layers */
 1680|    154|    }
 1681|       |
 1682|       |    /*-----------------------------------------------------------------------*/
 1683|       |    /* Common memory                                                         */
 1684|       |    /*-----------------------------------------------------------------------*/
 1685|    154|    size = UP_ALIGN_8(HEADER_BUFFER_LEN_BEFORE_EP);
  ------------------
  |  |   51|    154|#define UP_ALIGN_8(x) (((((UWORD64) x) + 7) >> 3) << 3)
  ------------------
 1686|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1687|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1688|    154|    memset(pv_buf, 0, size);
 1689|    154|    ps_nal_parse_ctxt->pv_nal_header_buf = (void *) pv_buf;
 1690|       |
 1691|       |    /*-----------------------------------------------------------------------*/
 1692|       |    /* Layer params memory                                                   */
 1693|       |    /*-----------------------------------------------------------------------*/
 1694|    154|    size = sizeof(nal_unit_t);
 1695|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1696|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1697|    154|    memset(pv_buf, 0, size);
 1698|    154|    ps_nal_parse_ctxt->pv_nal_unit = pv_buf;
 1699|       |
 1700|    154|    size = MAX_VCL_NAL_BUFF_SIZE * sizeof(UWORD8);
  ------------------
  |  |   69|    154|#define MAX_VCL_NAL_BUFF_SIZE (1024 * 1024 * 2)
  ------------------
 1701|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1702|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1703|    154|    memset(pv_buf, 0, size);
 1704|    154|    ps_svcd_ctxt->pv_vcl_nal_buff = pv_buf;
 1705|       |
 1706|    154|    size = MAX_NON_VCL_NAL_BUFF_SIZE * sizeof(UWORD8);
  ------------------
  |  |   70|    154|#define MAX_NON_VCL_NAL_BUFF_SIZE (1024 * 1024 * 2)
  ------------------
 1707|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1708|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1709|    154|    memset(pv_buf, 0, size);
 1710|    154|    ps_svcd_ctxt->pv_non_vcl_nal_buff = pv_buf;
 1711|       |
 1712|       |    /*-----------------------------------------------------------------------*/
 1713|       |    /* Registering the seq and pic prms buffer pointers                      */
 1714|       |    /*-----------------------------------------------------------------------*/
 1715|    154|    if(NULL == ps_svcd_ctxt->ps_sps || NULL == ps_svcd_ctxt->ps_pps)
  ------------------
  |  Branch (1715:8): [True: 0, False: 154]
  |  Branch (1715:40): [True: 0, False: 154]
  ------------------
 1716|      0|    {
 1717|      0|        return IV_FAIL;
 1718|      0|    }
 1719|       |
 1720|    154|    ps_svcd_ctxt->pv_nal_parse_ctxt = ps_nal_parse_ctxt;
 1721|    154|    ps_nal_parse_ctxt->pv_seq_prms = ps_svcd_ctxt->ps_sps;
 1722|    154|    ps_nal_parse_ctxt->pv_pic_prms = ps_svcd_ctxt->ps_pps;
 1723|       |
 1724|       |    /* register VCL and NON VCL buffer pointers */
 1725|    154|    if(NULL == ps_svcd_ctxt->pv_vcl_nal_buff || NULL == ps_svcd_ctxt->pv_non_vcl_nal_buff)
  ------------------
  |  Branch (1725:8): [True: 0, False: 154]
  |  Branch (1725:49): [True: 0, False: 154]
  ------------------
 1726|      0|    {
 1727|      0|        return IV_FAIL;
 1728|      0|    }
 1729|       |
 1730|    154|    ps_nal_parse_ctxt->pv_vcl_nal_buf = (UWORD8 *) ps_svcd_ctxt->pv_vcl_nal_buff;
 1731|    154|    ps_nal_parse_ctxt->pv_non_vcl_nal_buf = (UWORD8 *) ps_svcd_ctxt->pv_non_vcl_nal_buff;
 1732|    154|    isvcd_nal_parse_reset_ctxt(ANNEX_B, PARTIAL_INPUT_MODE, ps_nal_parse_ctxt);
  ------------------
  |  |   64|    154|#define ANNEX_B 0     /*!< Annex B stream*/
  ------------------
 1733|       |
 1734|    154|    return IV_SUCCESS;
 1735|    154|}
isvcd_intra_resample_ctxt_create:
 1759|    154|{
 1760|    154|    isvcd_create_ip_t *ps_create_ip;
 1761|    154|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 1762|    154|    void *pv_buf;
 1763|    154|    UWORD8 u1_layer_id;
 1764|    154|    void *(*pf_aligned_alloc)(void *pv_mem_ctxt, WORD32 alignment, WORD32 size);
 1765|    154|    void *pv_mem_ctxt;
 1766|    154|    WORD32 size;
 1767|    154|    intra_inter_pred_ctxt_t *ps_ii_pred_ctxt;
 1768|       |
 1769|    154|    intra_sampling_ctxt_t *ps_ctxt;
 1770|    154|    UNUSED(pv_api_op);
  ------------------
  |  |   45|    154|#define UNUSED(x) ((void)(x))
  ------------------
 1771|    154|    ps_create_ip = (isvcd_create_ip_t *) pv_api_ip;
 1772|       |
 1773|    154|    pf_aligned_alloc = ps_create_ip->s_ivd_create_ip_t.pf_aligned_alloc;
 1774|    154|    pv_mem_ctxt = ps_create_ip->s_ivd_create_ip_t.pv_mem_ctxt;
 1775|       |
 1776|    154|    {
 1777|    154|        intra_samp_lyr_ctxt *ps_lyr_ctxt;
 1778|       |
 1779|       |        /* allocate context structure */
 1780|    154|        size = ((sizeof(intra_sampling_ctxt_t) + 127) >> 7) << 7;
 1781|    154|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1782|    154|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1783|    154|        memset(pv_buf, 0, size);
 1784|    154|        ps_ctxt = pv_buf;
 1785|       |
 1786|       |        /* luma reference array buffer  */
 1787|    154|        size = REF_ARRAY_WIDTH * REF_ARRAY_HEIGHT * sizeof(UWORD8);
  ------------------
  |  |   73|    154|#define REF_ARRAY_WIDTH 48
  ------------------
                      size = REF_ARRAY_WIDTH * REF_ARRAY_HEIGHT * sizeof(UWORD8);
  ------------------
  |  |   74|    154|#define REF_ARRAY_HEIGHT 48
  ------------------
 1788|    154|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1789|    154|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1790|    154|        memset(pv_buf, 0, size);
 1791|    154|        ps_ctxt->pu1_refarray_buffer = pv_buf;
 1792|       |
 1793|       |        /* cb reference array buffer */
 1794|    154|        size = REF_ARRAY_WIDTH * REF_ARRAY_HEIGHT * sizeof(UWORD8);
  ------------------
  |  |   73|    154|#define REF_ARRAY_WIDTH 48
  ------------------
                      size = REF_ARRAY_WIDTH * REF_ARRAY_HEIGHT * sizeof(UWORD8);
  ------------------
  |  |   74|    154|#define REF_ARRAY_HEIGHT 48
  ------------------
 1795|    154|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1796|    154|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1797|    154|        memset(pv_buf, 0, size);
 1798|    154|        ps_ctxt->pu1_refarray_cb = pv_buf;
 1799|       |
 1800|       |        /* cr reference array buffer */
 1801|    154|        size = ((DYADIC_REF_W_C + 2) * (DYADIC_REF_H_C + 2) * sizeof(UWORD8));
  ------------------
  |  |   58|    154|#define DYADIC_REF_W_C 10
  ------------------
                      size = ((DYADIC_REF_W_C + 2) * (DYADIC_REF_H_C + 2) * sizeof(UWORD8));
  ------------------
  |  |   59|    154|#define DYADIC_REF_H_C 10
  ------------------
 1802|    154|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1803|    154|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1804|    154|        memset(pv_buf, 0, size);
 1805|    154|        ps_ctxt->pu1_refarray_cr = pv_buf;
 1806|       |
 1807|       |        /* Temp Intermediate Buffer */
 1808|    154|        size = INTERMEDIATE_BUFF_WIDTH * INTERMEDIATE_BUFF_HEIGHT * sizeof(WORD32);
  ------------------
  |  |   50|    154|#define INTERMEDIATE_BUFF_WIDTH 48
  ------------------
                      size = INTERMEDIATE_BUFF_WIDTH * INTERMEDIATE_BUFF_HEIGHT * sizeof(WORD32);
  ------------------
  |  |   51|    154|#define INTERMEDIATE_BUFF_HEIGHT (MB_HEIGHT + 4)
  |  |  ------------------
  |  |  |  |   68|    154|#define MB_HEIGHT 16
  |  |  ------------------
  ------------------
 1809|    154|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1810|    154|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1811|    154|        memset(pv_buf, 0, size);
 1812|    154|        ps_ctxt->pi4_temp_interpolation_buffer = pv_buf;
 1813|       |
 1814|       |        /****************** projected locations buffers ******************/
 1815|    154|        {
 1816|    154|            intra_samp_map_ctxt_t *ps_luma_map;
 1817|    154|            intra_samp_map_ctxt_t *ps_chroma_map;
 1818|    154|            WORD32 i4_lyr_id;
 1819|    154|            ref_mb_map_t *ps_off_len_map;
 1820|    154|            ref_pixel_map_t *ps_pos_phase_map;
 1821|    154|            ref_min_max_map_t *ps_min_max;
 1822|    154|            WORD16 *pi2_mem;
 1823|    154|            UWORD8 *pu1_mem;
 1824|    154|            seg_lookup_desc_t *ps_seg_lookup;
 1825|       |
 1826|       |            /****************** Horz offset length ******************/
 1827|       |
 1828|    154|            size = (H264_MAX_FRAME_WIDTH >> 4) * MAX_NUM_RES_LYRS * 2 * sizeof(ref_mb_map_t);
  ------------------
  |  |   39|    154|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
                          size = (H264_MAX_FRAME_WIDTH >> 4) * MAX_NUM_RES_LYRS * 2 * sizeof(ref_mb_map_t);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 1829|    154|            pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1830|    154|            RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1831|    154|            memset(pv_buf, 0, size);
 1832|    154|            ps_off_len_map = pv_buf;
 1833|       |
 1834|       |            /* loop over num layers -1 */
 1835|    616|            for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (1835:32): [True: 462, False: 154]
  ------------------
 1836|    462|            {
 1837|       |                /* derive the layer map ctxt */
 1838|    462|                ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 1839|    462|                ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 1840|    462|                ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 1841|       |
 1842|       |                /* initialise the pointers */
 1843|    462|                ps_luma_map->ps_x_offset_length = ps_off_len_map;
 1844|    462|                ps_off_len_map += (H264_MAX_FRAME_WIDTH >> 4);
  ------------------
  |  |   39|    462|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
 1845|    462|                ps_chroma_map->ps_x_offset_length = ps_off_len_map;
 1846|    462|                ps_off_len_map += (H264_MAX_FRAME_WIDTH >> 4);
  ------------------
  |  |   39|    462|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
 1847|       |
 1848|    462|            } /* end of loop over resolution layers */
 1849|       |
 1850|       |            /****************** Vert offset length ******************/
 1851|    154|            size = (H264_MAX_FRAME_HEIGHT >> 4) * MAX_NUM_RES_LYRS * 2 * sizeof(ref_mb_map_t);
  ------------------
  |  |   40|    154|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
                          size = (H264_MAX_FRAME_HEIGHT >> 4) * MAX_NUM_RES_LYRS * 2 * sizeof(ref_mb_map_t);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 1852|    154|            pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1853|    154|            RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1854|    154|            memset(pv_buf, 0, size);
 1855|    154|            ps_off_len_map = pv_buf;
 1856|       |
 1857|       |            /* loop over num layers -1 */
 1858|    616|            for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (1858:32): [True: 462, False: 154]
  ------------------
 1859|    462|            {
 1860|       |                /* derive the layer map ctxt */
 1861|    462|                ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 1862|    462|                ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 1863|    462|                ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 1864|       |
 1865|       |                /* initialise the pointers */
 1866|    462|                ps_luma_map->ps_y_offset_length = ps_off_len_map;
 1867|    462|                ps_off_len_map += (H264_MAX_FRAME_HEIGHT >> 4);
  ------------------
  |  |   40|    462|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
 1868|    462|                ps_chroma_map->ps_y_offset_length = ps_off_len_map;
 1869|    462|                ps_off_len_map += (H264_MAX_FRAME_HEIGHT >> 4);
  ------------------
  |  |   40|    462|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
 1870|       |
 1871|    462|            } /* end of loop over resolution layers */
 1872|       |
 1873|       |            /****************** Horz Min Max Pos ******************/
 1874|       |
 1875|    154|            size = (H264_MAX_FRAME_WIDTH >> 4) * MAX_NUM_RES_LYRS * 2 * sizeof(ref_mb_map_t);
  ------------------
  |  |   39|    154|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
                          size = (H264_MAX_FRAME_WIDTH >> 4) * MAX_NUM_RES_LYRS * 2 * sizeof(ref_mb_map_t);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 1876|    154|            pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1877|    154|            RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1878|    154|            memset(pv_buf, 0, size);
 1879|    154|            ps_min_max = pv_buf;
 1880|       |
 1881|       |            /* loop over num layers -1 */
 1882|    616|            for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (1882:32): [True: 462, False: 154]
  ------------------
 1883|    462|            {
 1884|       |                /* derive the layer map ctxt */
 1885|    462|                ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 1886|    462|                ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 1887|    462|                ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 1888|       |
 1889|       |                /* initialise the pointers */
 1890|    462|                ps_luma_map->ps_x_min_max = ps_min_max;
 1891|    462|                ps_min_max += (H264_MAX_FRAME_WIDTH >> 4);
  ------------------
  |  |   39|    462|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
 1892|    462|                ps_chroma_map->ps_x_min_max = ps_min_max;
 1893|    462|                ps_min_max += (H264_MAX_FRAME_WIDTH >> 4);
  ------------------
  |  |   39|    462|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
 1894|    462|            } /* end of loop over resolution layers */
 1895|       |
 1896|       |            /****************** Vert Min Max Pos ******************/
 1897|    154|            size = (H264_MAX_FRAME_HEIGHT >> 4) * MAX_NUM_RES_LYRS * 2 * sizeof(ref_mb_map_t);
  ------------------
  |  |   40|    154|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
                          size = (H264_MAX_FRAME_HEIGHT >> 4) * MAX_NUM_RES_LYRS * 2 * sizeof(ref_mb_map_t);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 1898|       |
 1899|    154|            pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1900|    154|            RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1901|    154|            memset(pv_buf, 0, size);
 1902|    154|            ps_min_max = pv_buf;
 1903|       |
 1904|       |            /* loop over num layers -1 */
 1905|    616|            for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (1905:32): [True: 462, False: 154]
  ------------------
 1906|    462|            {
 1907|       |                /* derive the layer map ctxt */
 1908|    462|                ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 1909|    462|                ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 1910|    462|                ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 1911|       |
 1912|       |                /* initialise the pointers */
 1913|    462|                ps_luma_map->ps_y_min_max = ps_min_max;
 1914|    462|                ps_min_max += (H264_MAX_FRAME_HEIGHT >> 4);
  ------------------
  |  |   40|    462|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
 1915|    462|                ps_chroma_map->ps_y_min_max = ps_min_max;
 1916|    462|                ps_min_max += (H264_MAX_FRAME_HEIGHT >> 4);
  ------------------
  |  |   40|    462|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
 1917|       |
 1918|    462|            } /* end of loop over resolution layers */
 1919|       |
 1920|       |            /****************** Horz position phase ******************/
 1921|    154|            size = (H264_MAX_FRAME_WIDTH) *MAX_NUM_RES_LYRS * 2 * sizeof(ref_pixel_map_t);
  ------------------
  |  |   39|    154|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
                          size = (H264_MAX_FRAME_WIDTH) *MAX_NUM_RES_LYRS * 2 * sizeof(ref_pixel_map_t);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 1922|    154|            pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1923|    154|            RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1924|    154|            memset(pv_buf, 0, size);
 1925|    154|            ps_pos_phase_map = pv_buf;
 1926|       |
 1927|       |            /* loop over num layers -1 */
 1928|    616|            for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (1928:32): [True: 462, False: 154]
  ------------------
 1929|    462|            {
 1930|       |                /* derive the layer map ctxt */
 1931|    462|                ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 1932|    462|                ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 1933|    462|                ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 1934|       |
 1935|       |                /* initialise the pointers */
 1936|    462|                ps_luma_map->ps_x_pos_phase = ps_pos_phase_map;
 1937|    462|                ps_pos_phase_map += (H264_MAX_FRAME_WIDTH);
  ------------------
  |  |   39|    462|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
 1938|    462|                ps_chroma_map->ps_x_pos_phase = ps_pos_phase_map;
 1939|    462|                ps_pos_phase_map += (H264_MAX_FRAME_WIDTH);
  ------------------
  |  |   39|    462|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
 1940|       |
 1941|    462|            } /* end of loop over resolution layers */
 1942|       |
 1943|       |            /****************** Vert position phase ******************/
 1944|       |
 1945|    154|            size = (H264_MAX_FRAME_HEIGHT) *MAX_NUM_RES_LYRS * 2 * sizeof(ref_pixel_map_t);
  ------------------
  |  |   40|    154|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
                          size = (H264_MAX_FRAME_HEIGHT) *MAX_NUM_RES_LYRS * 2 * sizeof(ref_pixel_map_t);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 1946|    154|            pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1947|    154|            RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1948|    154|            memset(pv_buf, 0, size);
 1949|    154|            ps_pos_phase_map = pv_buf;
 1950|       |
 1951|       |            /* loop over num layers -1 */
 1952|    616|            for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (1952:32): [True: 462, False: 154]
  ------------------
 1953|    462|            {
 1954|       |                /* derive the layer map ctxt */
 1955|    462|                ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 1956|    462|                ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 1957|    462|                ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 1958|       |
 1959|       |                /* initialise the pointers */
 1960|    462|                ps_luma_map->ps_y_pos_phase = ps_pos_phase_map;
 1961|    462|                ps_pos_phase_map += (H264_MAX_FRAME_HEIGHT);
  ------------------
  |  |   40|    462|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
 1962|    462|                ps_chroma_map->ps_y_pos_phase = ps_pos_phase_map;
 1963|    462|                ps_pos_phase_map += (H264_MAX_FRAME_HEIGHT);
  ------------------
  |  |   40|    462|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
 1964|       |
 1965|    462|            } /* end of loop over resolution layers */
 1966|       |
 1967|       |            /**************** XD Index ******************************/
 1968|    154|            size = (MB_WIDTH) *MAX_NUM_RES_LYRS * 2 * sizeof(WORD16);
  ------------------
  |  |   67|    154|#define MB_WIDTH 16
  ------------------
                          size = (MB_WIDTH) *MAX_NUM_RES_LYRS * 2 * sizeof(WORD16);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 1969|    154|            pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1970|    154|            RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1971|    154|            memset(pv_buf, 0, size);
 1972|    154|            pi2_mem = pv_buf;
 1973|       |
 1974|       |            /* loop over num layers -1 */
 1975|    616|            for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (1975:32): [True: 462, False: 154]
  ------------------
 1976|    462|            {
 1977|       |                /* derive the layer map ctxt */
 1978|    462|                ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 1979|    462|                ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 1980|    462|                ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 1981|       |
 1982|       |                /* initialise the pointers */
 1983|    462|                ps_luma_map->pi2_xd_index = pi2_mem;
 1984|    462|                pi2_mem += MB_WIDTH;
  ------------------
  |  |   67|    462|#define MB_WIDTH 16
  ------------------
 1985|    462|                ps_chroma_map->pi2_xd_index = pi2_mem;
 1986|    462|                pi2_mem += MB_WIDTH;
  ------------------
  |  |   67|    462|#define MB_WIDTH 16
  ------------------
 1987|       |
 1988|    462|            } /* end of loop over resolution layers */
 1989|       |
 1990|       |            /**************** YD Index ******************************/
 1991|    154|            size = (MB_HEIGHT) *MAX_NUM_RES_LYRS * 2 * sizeof(WORD16);
  ------------------
  |  |   68|    154|#define MB_HEIGHT 16
  ------------------
                          size = (MB_HEIGHT) *MAX_NUM_RES_LYRS * 2 * sizeof(WORD16);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 1992|    154|            pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 1993|    154|            RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 1994|    154|            memset(pv_buf, 0, size);
 1995|    154|            pi2_mem = pv_buf;
 1996|       |
 1997|       |            /* loop over num layers -1 */
 1998|    616|            for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (1998:32): [True: 462, False: 154]
  ------------------
 1999|    462|            {
 2000|       |                /* derive the layer map ctxt */
 2001|    462|                ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 2002|    462|                ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 2003|    462|                ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 2004|       |
 2005|       |                /* initialise the pointers */
 2006|    462|                ps_luma_map->pi2_yd_index = pi2_mem;
 2007|    462|                pi2_mem += MB_HEIGHT;
  ------------------
  |  |   68|    462|#define MB_HEIGHT 16
  ------------------
 2008|    462|                ps_chroma_map->pi2_yd_index = pi2_mem;
 2009|    462|                pi2_mem += MB_HEIGHT;
  ------------------
  |  |   68|    462|#define MB_HEIGHT 16
  ------------------
 2010|       |
 2011|    462|            } /* end of loop over resolution layers */
 2012|       |
 2013|       |            /**************** YA Index ******************************/
 2014|    154|            size = MB_HEIGHT * MAX_NUM_RES_LYRS * 2 * sizeof(WORD16);
  ------------------
  |  |   68|    154|#define MB_HEIGHT 16
  ------------------
                          size = MB_HEIGHT * MAX_NUM_RES_LYRS * 2 * sizeof(WORD16);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 2015|    154|            pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2016|    154|            RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2017|    154|            memset(pv_buf, 0, size);
 2018|    154|            pi2_mem = pv_buf;
 2019|       |
 2020|       |            /* loop over num layers -1 */
 2021|    616|            for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2021:32): [True: 462, False: 154]
  ------------------
 2022|    462|            {
 2023|       |                /* derive the layer map ctxt */
 2024|    462|                ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 2025|    462|                ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 2026|    462|                ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 2027|       |
 2028|       |                /* initialise the pointers */
 2029|    462|                ps_luma_map->pi2_ya_index = pi2_mem;
 2030|    462|                pi2_mem += MB_HEIGHT;
  ------------------
  |  |   68|    462|#define MB_HEIGHT 16
  ------------------
 2031|    462|                ps_chroma_map->pi2_ya_index = pi2_mem;
 2032|    462|                pi2_mem += MB_HEIGHT;
  ------------------
  |  |   68|    462|#define MB_HEIGHT 16
  ------------------
 2033|       |
 2034|    462|            } /* end of loop over resolution layers */
 2035|       |
 2036|       |            /**************** Horizontal segment lookup **************************/
 2037|       |            /* (MB_WIDTH x seg_lookup_desc_t) x (num layers - 1)   (for luma   )*/
 2038|       |            /* (BLOCK_WIDTH x seg_lookup_desc_t) x (num layers - 1) (for chroma )*/
 2039|    154|            size = (MB_WIDTH * sizeof(seg_lookup_desc_t)) * MAX_NUM_RES_LYRS;
  ------------------
  |  |   67|    154|#define MB_WIDTH 16
  ------------------
                          size = (MB_WIDTH * sizeof(seg_lookup_desc_t)) * MAX_NUM_RES_LYRS;
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 2040|       |
 2041|    154|            size += (BLOCK_WIDTH * sizeof(seg_lookup_desc_t)) * MAX_NUM_RES_LYRS;
  ------------------
  |  |   64|    154|#define BLOCK_WIDTH 8
  ------------------
                          size += (BLOCK_WIDTH * sizeof(seg_lookup_desc_t)) * MAX_NUM_RES_LYRS;
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 2042|       |
 2043|    154|            pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2044|    154|            RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2045|    154|            memset(pv_buf, 0, size);
 2046|    154|            ps_seg_lookup = pv_buf;
 2047|       |
 2048|       |            /* loop over num layers -1 */
 2049|    616|            for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2049:32): [True: 462, False: 154]
  ------------------
 2050|    462|            {
 2051|       |                /* derive the layer map ctxt */
 2052|    462|                ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 2053|    462|                ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 2054|    462|                ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 2055|       |
 2056|       |                /* initialise the pointers */
 2057|    462|                ps_luma_map->ps_seg_lookup_horz = ps_seg_lookup;
 2058|    462|                ps_seg_lookup += MB_WIDTH;
  ------------------
  |  |   67|    462|#define MB_WIDTH 16
  ------------------
 2059|    462|                ps_chroma_map->ps_seg_lookup_horz = ps_seg_lookup;
 2060|    462|                ps_seg_lookup += BLOCK_WIDTH;
  ------------------
  |  |   64|    462|#define BLOCK_WIDTH 8
  ------------------
 2061|       |
 2062|    462|            } /* end of loop over resolution layers */
 2063|       |
 2064|       |            /**************** Vertical segment lookup ****************************/
 2065|       |            /* (MB_HEIGHT x seg_lookup_desc_t) x (num layers - 1)    (for luma  )*/
 2066|       |            /* (BLOCK_HEIGHT x seg_lookup_desc_t) x (num layers - 1) (for chroma)*/
 2067|    154|            size = (MB_HEIGHT * sizeof(seg_lookup_desc_t)) * MAX_NUM_RES_LYRS;
  ------------------
  |  |   68|    154|#define MB_HEIGHT 16
  ------------------
                          size = (MB_HEIGHT * sizeof(seg_lookup_desc_t)) * MAX_NUM_RES_LYRS;
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 2068|       |
 2069|    154|            size += (BLOCK_HEIGHT * sizeof(seg_lookup_desc_t)) * MAX_NUM_RES_LYRS;
  ------------------
  |  |   65|    154|#define BLOCK_HEIGHT 8
  ------------------
                          size += (BLOCK_HEIGHT * sizeof(seg_lookup_desc_t)) * MAX_NUM_RES_LYRS;
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 2070|       |
 2071|    154|            pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2072|    154|            RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2073|    154|            memset(pv_buf, 0, size);
 2074|    154|            ps_seg_lookup = pv_buf;
 2075|       |
 2076|       |            /* loop over num layers -1 */
 2077|    616|            for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2077:32): [True: 462, False: 154]
  ------------------
 2078|    462|            {
 2079|       |                /* derive the layer map ctxt */
 2080|    462|                ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 2081|    462|                ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 2082|    462|                ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 2083|       |
 2084|       |                /* initialise the pointers */
 2085|    462|                ps_luma_map->ps_seg_lookup_vert = ps_seg_lookup;
 2086|    462|                ps_seg_lookup += MB_HEIGHT;
  ------------------
  |  |   68|    462|#define MB_HEIGHT 16
  ------------------
 2087|    462|                ps_chroma_map->ps_seg_lookup_vert = ps_seg_lookup;
 2088|    462|                ps_seg_lookup += BLOCK_HEIGHT;
  ------------------
  |  |   65|    462|#define BLOCK_HEIGHT 8
  ------------------
 2089|       |
 2090|    462|            } /* end of loop over resolution layers */
 2091|       |
 2092|       |            /**************** X and Y Reference Array Index lookup ***************/
 2093|       |            /* (MAX_REF_IDX_ARRAY) x (num layers - 1)     (for luma  x-index)     */
 2094|       |            /* (MAX_REF_IDX_ARRAY) x (num layers - 1)     (for luma  y-index)     */
 2095|       |            /* (MAX_REF_IDX_ARRAY) x (num layers - 1)     (for chroma x-index)    */
 2096|       |            /* (MAX_REF_IDX_ARRAY) x (num layers - 1)     (for chroma y-index)    */
 2097|       |            /*********************************************************************/
 2098|    154|            size = (MAX_REF_IDX_ARRAY * MAX_NUM_RES_LYRS * 4);
  ------------------
  |  |   55|    154|#define MAX_REF_IDX_ARRAY (MAX_REF_ARR_WD_HT + MB_WIDTH)
  |  |  ------------------
  |  |  |  |   53|    154|#define MAX_REF_ARR_WD_HT 48
  |  |  ------------------
  |  |               #define MAX_REF_IDX_ARRAY (MAX_REF_ARR_WD_HT + MB_WIDTH)
  |  |  ------------------
  |  |  |  |   67|    154|#define MB_WIDTH 16
  |  |  ------------------
  ------------------
                          size = (MAX_REF_IDX_ARRAY * MAX_NUM_RES_LYRS * 4);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 2099|    154|            pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2100|    154|            RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2101|    154|            memset(pv_buf, 0, size);
 2102|    154|            pu1_mem = pv_buf;
 2103|       |
 2104|       |            /* loop over num layers -1 */
 2105|    616|            for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2105:32): [True: 462, False: 154]
  ------------------
 2106|    462|            {
 2107|       |                /* derive the layer map ctxt */
 2108|    462|                ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 2109|    462|                ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 2110|    462|                ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 2111|       |
 2112|       |                /* initialise the pointers */
 2113|    462|                ps_luma_map->pu1_refarray_x_idx = pu1_mem;
 2114|    462|                pu1_mem += MAX_REF_IDX_ARRAY;
  ------------------
  |  |   55|    462|#define MAX_REF_IDX_ARRAY (MAX_REF_ARR_WD_HT + MB_WIDTH)
  |  |  ------------------
  |  |  |  |   53|    462|#define MAX_REF_ARR_WD_HT 48
  |  |  ------------------
  |  |               #define MAX_REF_IDX_ARRAY (MAX_REF_ARR_WD_HT + MB_WIDTH)
  |  |  ------------------
  |  |  |  |   67|    462|#define MB_WIDTH 16
  |  |  ------------------
  ------------------
 2115|       |
 2116|    462|                ps_luma_map->pu1_refarray_y_idx = pu1_mem;
 2117|    462|                pu1_mem += MAX_REF_IDX_ARRAY;
  ------------------
  |  |   55|    462|#define MAX_REF_IDX_ARRAY (MAX_REF_ARR_WD_HT + MB_WIDTH)
  |  |  ------------------
  |  |  |  |   53|    462|#define MAX_REF_ARR_WD_HT 48
  |  |  ------------------
  |  |               #define MAX_REF_IDX_ARRAY (MAX_REF_ARR_WD_HT + MB_WIDTH)
  |  |  ------------------
  |  |  |  |   67|    462|#define MB_WIDTH 16
  |  |  ------------------
  ------------------
 2118|       |
 2119|    462|                ps_chroma_map->pu1_refarray_x_idx = pu1_mem;
 2120|    462|                pu1_mem += MAX_REF_IDX_ARRAY;
  ------------------
  |  |   55|    462|#define MAX_REF_IDX_ARRAY (MAX_REF_ARR_WD_HT + MB_WIDTH)
  |  |  ------------------
  |  |  |  |   53|    462|#define MAX_REF_ARR_WD_HT 48
  |  |  ------------------
  |  |               #define MAX_REF_IDX_ARRAY (MAX_REF_ARR_WD_HT + MB_WIDTH)
  |  |  ------------------
  |  |  |  |   67|    462|#define MB_WIDTH 16
  |  |  ------------------
  ------------------
 2121|       |
 2122|    462|                ps_chroma_map->pu1_refarray_y_idx = pu1_mem;
 2123|    462|                pu1_mem += MAX_REF_IDX_ARRAY;
  ------------------
  |  |   55|    462|#define MAX_REF_IDX_ARRAY (MAX_REF_ARR_WD_HT + MB_WIDTH)
  |  |  ------------------
  |  |  |  |   53|    462|#define MAX_REF_ARR_WD_HT 48
  |  |  ------------------
  |  |               #define MAX_REF_IDX_ARRAY (MAX_REF_ARR_WD_HT + MB_WIDTH)
  |  |  ------------------
  |  |  |  |   67|    462|#define MB_WIDTH 16
  |  |  ------------------
  ------------------
 2124|       |
 2125|    462|            } /* end of loop over resolution layers */
 2126|    154|        }
 2127|       |
 2128|      0|        size = ((sizeof(intra_inter_pred_ctxt_t) + 127) >> 7) << 7;
 2129|    154|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2130|    154|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2131|    154|        memset(pv_buf, 0, size);
 2132|    154|        ps_ii_pred_ctxt = pv_buf;
 2133|    154|    }
 2134|       |
 2135|      0|    ps_svcd_ctxt->pv_intra_sample_ctxt = ps_ctxt;
 2136|    154|    ps_svcd_ctxt->pv_ii_pred_ctxt = ps_ii_pred_ctxt;
 2137|       |
 2138|    616|    for(u1_layer_id = 0; u1_layer_id < MAX_NUM_RES_LYRS; u1_layer_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2138:26): [True: 462, False: 154]
  ------------------
 2139|    462|    {
 2140|    462|        ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[u1_layer_id];
 2141|    462|        ps_svc_lyr_dec->pv_intra_sample_ctxt = ps_svcd_ctxt->pv_intra_sample_ctxt;
 2142|    462|        ps_svc_lyr_dec->pv_ii_pred_ctxt = ps_svcd_ctxt->pv_ii_pred_ctxt;
 2143|    462|    }
 2144|       |
 2145|    154|    return IV_SUCCESS;
 2146|    154|}
isvcd_residual_resample_ctxt_create:
 2170|    154|{
 2171|    154|    isvcd_create_ip_t *ps_create_ip;
 2172|    154|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 2173|    154|    void *pv_buf;
 2174|    154|    UWORD8 u1_layer_id;
 2175|    154|    void *(*pf_aligned_alloc)(void *pv_mem_ctxt, WORD32 alignment, WORD32 size);
 2176|    154|    void *pv_mem_ctxt;
 2177|    154|    WORD32 size;
 2178|       |
 2179|    154|    residual_sampling_ctxt_t *ps_ctxt;
 2180|    154|    res_lyr_ctxt *ps_lyr_ctxt;
 2181|    154|    UNUSED(pv_api_op);
  ------------------
  |  |   45|    154|#define UNUSED(x) ((void)(x))
  ------------------
 2182|    154|    ps_create_ip = (isvcd_create_ip_t *) pv_api_ip;
 2183|       |
 2184|    154|    pf_aligned_alloc = ps_create_ip->s_ivd_create_ip_t.pf_aligned_alloc;
 2185|    154|    pv_mem_ctxt = ps_create_ip->s_ivd_create_ip_t.pv_mem_ctxt;
 2186|       |
 2187|       |    /* allocate context structure */
 2188|    154|    size = ((sizeof(residual_sampling_ctxt_t) + 127) >> 7) << 7;
 2189|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2190|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2191|    154|    memset(pv_buf, 0, size);
 2192|    154|    ps_ctxt = pv_buf;
 2193|       |
 2194|       |    /* reference array buffer  */
 2195|    154|    size = REF_ARRAY_WIDTH_RES_SAMP * REF_ARRAY_HEIGHT_RES_SAMP * sizeof(WORD16);
  ------------------
  |  |   45|    154|#define REF_ARRAY_WIDTH_RES_SAMP (MB_WIDTH + 6)
  |  |  ------------------
  |  |  |  |   67|    154|#define MB_WIDTH 16
  |  |  ------------------
  ------------------
                  size = REF_ARRAY_WIDTH_RES_SAMP * REF_ARRAY_HEIGHT_RES_SAMP * sizeof(WORD16);
  ------------------
  |  |   46|    154|#define REF_ARRAY_HEIGHT_RES_SAMP (MB_HEIGHT + 6)
  |  |  ------------------
  |  |  |  |   68|    154|#define MB_HEIGHT 16
  |  |  ------------------
  ------------------
 2196|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2197|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2198|    154|    memset(pv_buf, 0, size);
 2199|    154|    ps_ctxt->pi2_refarray_buffer = pv_buf;
 2200|       |
 2201|       |    /* reference array pointer increment buffer */
 2202|    154|    {
 2203|    154|        WORD32 i4_size;
 2204|       |
 2205|    154|        i4_size = REF_ARRAY_WIDTH_RES_SAMP * REF_ARRAY_HEIGHT_RES_SAMP * sizeof(UWORD8);
  ------------------
  |  |   45|    154|#define REF_ARRAY_WIDTH_RES_SAMP (MB_WIDTH + 6)
  |  |  ------------------
  |  |  |  |   67|    154|#define MB_WIDTH 16
  |  |  ------------------
  ------------------
                      i4_size = REF_ARRAY_WIDTH_RES_SAMP * REF_ARRAY_HEIGHT_RES_SAMP * sizeof(UWORD8);
  ------------------
  |  |   46|    154|#define REF_ARRAY_HEIGHT_RES_SAMP (MB_HEIGHT + 6)
  |  |  ------------------
  |  |  |  |   68|    154|#define MB_HEIGHT 16
  |  |  ------------------
  ------------------
 2206|    154|        size = REF_ARRAY_WIDTH_RES_SAMP * REF_ARRAY_HEIGHT_RES_SAMP * 2 * sizeof(UWORD8);
  ------------------
  |  |   45|    154|#define REF_ARRAY_WIDTH_RES_SAMP (MB_WIDTH + 6)
  |  |  ------------------
  |  |  |  |   67|    154|#define MB_WIDTH 16
  |  |  ------------------
  ------------------
                      size = REF_ARRAY_WIDTH_RES_SAMP * REF_ARRAY_HEIGHT_RES_SAMP * 2 * sizeof(UWORD8);
  ------------------
  |  |   46|    154|#define REF_ARRAY_HEIGHT_RES_SAMP (MB_HEIGHT + 6)
  |  |  ------------------
  |  |  |  |   68|    154|#define MB_HEIGHT 16
  |  |  ------------------
  ------------------
 2207|    154|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2208|    154|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2209|    154|        memset(pv_buf, 0, size);
 2210|    154|        ps_ctxt->pu1_ref_x_ptr_incr = pv_buf;
 2211|    154|        ps_ctxt->pu1_ref_y_ptr_incr = ps_ctxt->pu1_ref_x_ptr_incr + i4_size;
 2212|    154|    }
 2213|       |
 2214|       |    /****************** projected locations buffers ******************/
 2215|      0|    {
 2216|    154|        residual_samp_map_ctxt_t *ps_luma_map;
 2217|    154|        residual_samp_map_ctxt_t *ps_chroma_map;
 2218|    154|        WORD32 i4_lyr_id;
 2219|    154|        ref_mb_map_t *ps_off_len_map;
 2220|    154|        ref_pixel_map_t *ps_pos_phase_map;
 2221|       |
 2222|       |        /****************** Horz offset length ******************/
 2223|    154|        size = (H264_MAX_FRAME_WIDTH >> 4) * MAX_NUM_RES_LYRS * 2 * sizeof(ref_mb_map_t);
  ------------------
  |  |   39|    154|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
                      size = (H264_MAX_FRAME_WIDTH >> 4) * MAX_NUM_RES_LYRS * 2 * sizeof(ref_mb_map_t);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 2224|    154|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2225|    154|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2226|    154|        memset(pv_buf, 0, size);
 2227|    154|        ps_off_len_map = pv_buf;
 2228|       |
 2229|       |        /* loop over num layers -1 */
 2230|    616|        for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2230:28): [True: 462, False: 154]
  ------------------
 2231|    462|        {
 2232|       |            /* derive the layer map ctxt */
 2233|    462|            ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 2234|    462|            ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 2235|    462|            ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 2236|       |
 2237|       |            /* initialise the pointers */
 2238|    462|            ps_luma_map->ps_x_offset_length = ps_off_len_map;
 2239|    462|            ps_off_len_map += (H264_MAX_FRAME_WIDTH >> 4);
  ------------------
  |  |   39|    462|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
 2240|    462|            ps_chroma_map->ps_x_offset_length = ps_off_len_map;
 2241|    462|            ps_off_len_map += (H264_MAX_FRAME_WIDTH >> 4);
  ------------------
  |  |   39|    462|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
 2242|       |
 2243|    462|        } /* end of loop over resolution layers */
 2244|       |
 2245|       |        /****************** Vert offset length ******************/
 2246|    154|        size = (H264_MAX_FRAME_HEIGHT >> 4) * MAX_NUM_RES_LYRS * 2 * sizeof(ref_mb_map_t);
  ------------------
  |  |   40|    154|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
                      size = (H264_MAX_FRAME_HEIGHT >> 4) * MAX_NUM_RES_LYRS * 2 * sizeof(ref_mb_map_t);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 2247|    154|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2248|    154|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2249|    154|        memset(pv_buf, 0, size);
 2250|    154|        ps_off_len_map = pv_buf;
 2251|       |
 2252|       |        /* loop over num layers -1 */
 2253|    616|        for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2253:28): [True: 462, False: 154]
  ------------------
 2254|    462|        {
 2255|       |            /* derive the layer map ctxt */
 2256|    462|            ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 2257|    462|            ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 2258|    462|            ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 2259|       |
 2260|       |            /* initialise the pointers */
 2261|    462|            ps_luma_map->ps_y_offset_length = ps_off_len_map;
 2262|    462|            ps_off_len_map += (H264_MAX_FRAME_HEIGHT >> 4);
  ------------------
  |  |   40|    462|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
 2263|    462|            ps_chroma_map->ps_y_offset_length = ps_off_len_map;
 2264|    462|            ps_off_len_map += (H264_MAX_FRAME_HEIGHT >> 4);
  ------------------
  |  |   40|    462|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
 2265|       |
 2266|    462|        } /* end of loop over resolution layers */
 2267|       |
 2268|       |        /****************** Horz position phase ******************/
 2269|    154|        size = H264_MAX_FRAME_WIDTH * MAX_NUM_RES_LYRS * 2 * sizeof(ref_pixel_map_t);
  ------------------
  |  |   39|    154|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
                      size = H264_MAX_FRAME_WIDTH * MAX_NUM_RES_LYRS * 2 * sizeof(ref_pixel_map_t);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 2270|    154|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2271|    154|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2272|    154|        memset(pv_buf, 0, size);
 2273|    154|        ps_pos_phase_map = pv_buf;
 2274|       |
 2275|       |        /* loop over num layers -1 */
 2276|    616|        for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2276:28): [True: 462, False: 154]
  ------------------
 2277|    462|        {
 2278|       |            /* derive the layer map ctxt */
 2279|    462|            ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 2280|    462|            ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 2281|    462|            ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 2282|       |
 2283|       |            /* initialise the pointers */
 2284|    462|            ps_luma_map->ps_x_pos_phase = ps_pos_phase_map;
 2285|    462|            ps_pos_phase_map += H264_MAX_FRAME_WIDTH;
  ------------------
  |  |   39|    462|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
 2286|    462|            ps_chroma_map->ps_x_pos_phase = ps_pos_phase_map;
 2287|    462|            ps_pos_phase_map += H264_MAX_FRAME_WIDTH;
  ------------------
  |  |   39|    462|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
 2288|       |
 2289|    462|        } /* end of loop over resolution layers */
 2290|       |
 2291|       |        /****************** Vert position phase ******************/
 2292|       |
 2293|    154|        size = H264_MAX_FRAME_HEIGHT * MAX_NUM_RES_LYRS * 2 * sizeof(ref_pixel_map_t);
  ------------------
  |  |   40|    154|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
                      size = H264_MAX_FRAME_HEIGHT * MAX_NUM_RES_LYRS * 2 * sizeof(ref_pixel_map_t);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 2294|    154|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2295|    154|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2296|    154|        memset(pv_buf, 0, size);
 2297|    154|        ps_pos_phase_map = pv_buf;
 2298|       |
 2299|       |        /* loop over num layers -1 */
 2300|    616|        for(i4_lyr_id = 0; i4_lyr_id < MAX_NUM_RES_LYRS; i4_lyr_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2300:28): [True: 462, False: 154]
  ------------------
 2301|    462|        {
 2302|       |            /* derive the layer map ctxt */
 2303|    462|            ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[i4_lyr_id];
 2304|    462|            ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 2305|    462|            ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 2306|       |
 2307|       |            /* initialise the pointers */
 2308|    462|            ps_luma_map->ps_y_pos_phase = ps_pos_phase_map;
 2309|    462|            ps_pos_phase_map += H264_MAX_FRAME_HEIGHT;
  ------------------
  |  |   40|    462|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
 2310|    462|            ps_chroma_map->ps_y_pos_phase = ps_pos_phase_map;
 2311|    462|            ps_pos_phase_map += H264_MAX_FRAME_HEIGHT;
  ------------------
  |  |   40|    462|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
 2312|       |
 2313|    462|        } /* end of loop over resolution layers */
 2314|    154|    }
 2315|       |
 2316|      0|    ps_svcd_ctxt->pv_residual_sample_ctxt = ps_ctxt;
 2317|       |
 2318|    616|    for(u1_layer_id = 0; u1_layer_id < MAX_NUM_RES_LYRS; u1_layer_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2318:26): [True: 462, False: 154]
  ------------------
 2319|    462|    {
 2320|    462|        ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[u1_layer_id];
 2321|    462|        ps_svc_lyr_dec->pv_residual_sample_ctxt = ps_svcd_ctxt->pv_residual_sample_ctxt;
 2322|    462|    }
 2323|    154|    return IV_SUCCESS;
 2324|    154|}
isvcd_mode_mv_resample_ctxt_create:
 2347|    154|{
 2348|    154|    isvcd_create_ip_t *ps_create_ip;
 2349|    154|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 2350|    154|    void *pv_buf;
 2351|    154|    WORD16 *pi2_mem;
 2352|    154|    UWORD8 u1_layer_id;
 2353|    154|    void *(*pf_aligned_alloc)(void *pv_mem_ctxt, WORD32 alignment, WORD32 size);
 2354|    154|    void *pv_mem_ctxt;
 2355|    154|    WORD32 size, i4_res_id;
 2356|    154|    ref_lyr_scaled_offset_t *ps_ref_pic_offsets;
 2357|    154|    mode_motion_ctxt_t *ps_mode_motion;
 2358|    154|    mode_motion_lyr_ctxt *ps_lyr_mem;
 2359|    154|    UNUSED(pv_api_op);
  ------------------
  |  |   45|    154|#define UNUSED(x) ((void)(x))
  ------------------
 2360|    154|    ps_create_ip = (isvcd_create_ip_t *) pv_api_ip;
 2361|       |
 2362|    154|    pf_aligned_alloc = ps_create_ip->s_ivd_create_ip_t.pf_aligned_alloc;
 2363|    154|    pv_mem_ctxt = ps_create_ip->s_ivd_create_ip_t.pv_mem_ctxt;
 2364|       |
 2365|    154|    size = ((sizeof(mode_motion_ctxt_t) + 127) >> 7) << 7;
 2366|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2367|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2368|    154|    memset(pv_buf, 0, size);
 2369|    154|    ps_mode_motion = pv_buf;
 2370|       |
 2371|       |    /* motion pred structure */
 2372|    154|    size = 2 * NUM_MB_PARTS * NUM_SUB_MB_PARTS * sizeof(mv_pred_t);
  ------------------
  |  |   59|    154|#define NUM_MB_PARTS 4
  ------------------
                  size = 2 * NUM_MB_PARTS * NUM_SUB_MB_PARTS * sizeof(mv_pred_t);
  ------------------
  |  |   60|    154|#define NUM_SUB_MB_PARTS 4
  ------------------
 2373|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2374|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2375|    154|    memset(pv_buf, 0, size);
 2376|    154|    ps_mode_motion->ps_motion_pred_struct = (mv_pred_t *) pv_buf;
 2377|       |
 2378|       |    /* projected locations X */
 2379|    154|    size = H264_MAX_FRAME_WIDTH * MAX_NUM_RES_LYRS * sizeof(WORD16);
  ------------------
  |  |   39|    154|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
                  size = H264_MAX_FRAME_WIDTH * MAX_NUM_RES_LYRS * sizeof(WORD16);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 2380|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2381|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2382|    154|    memset(pv_buf, 0, size);
 2383|    154|    pi2_mem = (WORD16 *) pv_buf;
 2384|       |
 2385|       |    /* loop over NUM resolution layers */
 2386|    616|    for(i4_res_id = 0; i4_res_id < MAX_NUM_RES_LYRS; i4_res_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2386:24): [True: 462, False: 154]
  ------------------
 2387|    462|    {
 2388|    462|        ps_lyr_mem = &ps_mode_motion->as_res_lyr_mem[i4_res_id];
 2389|       |
 2390|       |        /* initialise the pointers */
 2391|    462|        ps_lyr_mem->pi2_ref_loc_x = pi2_mem;
 2392|       |
 2393|       |        /* increment the buffer pointer */
 2394|    462|        pi2_mem += H264_MAX_FRAME_WIDTH;
  ------------------
  |  |   39|    462|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
 2395|       |
 2396|    462|    } /* end of loop over num resolution layers */
 2397|       |
 2398|       |    /* projected locations Y */
 2399|    154|    size = H264_MAX_FRAME_HEIGHT * MAX_NUM_RES_LYRS * sizeof(WORD16);
  ------------------
  |  |   40|    154|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
                  size = H264_MAX_FRAME_HEIGHT * MAX_NUM_RES_LYRS * sizeof(WORD16);
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 2400|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2401|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2402|    154|    memset(pv_buf, 0, size);
 2403|    154|    pi2_mem = (WORD16 *) pv_buf;
 2404|       |    /* loop over NUM resolution layers */
 2405|    616|    for(i4_res_id = 0; i4_res_id < MAX_NUM_RES_LYRS; i4_res_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2405:24): [True: 462, False: 154]
  ------------------
 2406|    462|    {
 2407|    462|        ps_lyr_mem = &ps_mode_motion->as_res_lyr_mem[i4_res_id];
 2408|       |
 2409|       |        /* initialise the pointers */
 2410|    462|        ps_lyr_mem->pi2_ref_loc_y = pi2_mem;
 2411|       |        /* increment the buffer pointer */
 2412|    462|        pi2_mem += H264_MAX_FRAME_HEIGHT;
  ------------------
  |  |   40|    462|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
 2413|       |
 2414|    462|    } /* end of loop over num resolution layers */
 2415|       |
 2416|    154|    size = sizeof(ref_lyr_scaled_offset_t) * MAX_NUM_RES_LYRS * MAX_NUM_PIC_BUFS;
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
                  size = sizeof(ref_lyr_scaled_offset_t) * MAX_NUM_RES_LYRS * MAX_NUM_PIC_BUFS;
  ------------------
  |  |   99|    154|#define MAX_NUM_PIC_BUFS (32 + 1)
  ------------------
 2417|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2418|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2419|    154|    memset(pv_buf, 0, size);
 2420|    154|    ps_svcd_ctxt->pv_ref_lyr_offset = pv_buf;
 2421|       |
 2422|       |    /* loop over NUM resolution layers */
 2423|    154|    ps_ref_pic_offsets = (ref_lyr_scaled_offset_t *) ps_svcd_ctxt->pv_ref_lyr_offset;
 2424|       |
 2425|    616|    for(i4_res_id = 0; i4_res_id < MAX_NUM_RES_LYRS; i4_res_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2425:24): [True: 462, False: 154]
  ------------------
 2426|    462|    {
 2427|    462|        ps_lyr_mem = &ps_mode_motion->as_res_lyr_mem[i4_res_id];
 2428|       |
 2429|       |        /* store the current resolution layer pic offset start pointer */
 2430|    462|        ps_lyr_mem->ps_ref_pic_lyr_offsets = ps_ref_pic_offsets + (i4_res_id * MAX_NUM_PIC_BUFS);
  ------------------
  |  |   99|    462|#define MAX_NUM_PIC_BUFS (32 + 1)
  ------------------
 2431|       |
 2432|    462|    } /* end of loop over num resolution layers */
 2433|       |
 2434|    154|    ps_svcd_ctxt->pv_mode_mv_sample_ctxt = ps_mode_motion;
 2435|       |
 2436|    616|    for(u1_layer_id = 0; u1_layer_id < MAX_NUM_RES_LYRS; u1_layer_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2436:26): [True: 462, False: 154]
  ------------------
 2437|    462|    {
 2438|    462|        ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[u1_layer_id];
 2439|    462|        ps_svc_lyr_dec->pv_mode_mv_sample_ctxt = ps_svcd_ctxt->pv_mode_mv_sample_ctxt;
 2440|    462|        ps_svc_lyr_dec->pv_ref_lyr_offset = ps_svcd_ctxt->pv_ref_lyr_offset;
 2441|    462|    }
 2442|    154|    return IV_SUCCESS;
 2443|    154|}
isvcd_allocate_static_bufs:
 2465|    155|{
 2466|    155|    isvcd_create_ip_t *ps_create_ip;
 2467|    155|    isvcd_create_op_t *ps_create_op;
 2468|    155|    void *pv_buf;
 2469|    155|    UWORD8 *pu1_buf;
 2470|    155|    dec_struct_t *ps_dec;
 2471|    155|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 2472|    155|    svc_dec_ctxt_t *ps_svcd_ctxt;
 2473|    155|    void *(*pf_aligned_alloc)(void *pv_mem_ctxt, WORD32 alignment, WORD32 size);
 2474|    155|    void (*pf_aligned_free)(void *pv_mem_ctxt, void *pv_buf);
 2475|    155|    void *pv_mem_ctxt;
 2476|    155|    WORD32 size;
 2477|    155|    UWORD8 u1_layer_id, u1_sps_ctr;
 2478|    155|    UWORD8 u1_chroma_format;
 2479|    155|    WORD32 ret;
 2480|       |
 2481|    155|    ps_create_ip = (isvcd_create_ip_t *) pv_api_ip;
 2482|    155|    ps_create_op = (isvcd_create_op_t *) pv_api_op;
 2483|       |
 2484|    155|    ps_create_op->s_ivd_create_op_t.u4_error_code = 0;
 2485|    155|    pf_aligned_alloc = ps_create_ip->s_ivd_create_ip_t.pf_aligned_alloc;
 2486|    155|    pf_aligned_free = ps_create_ip->s_ivd_create_ip_t.pf_aligned_free;
 2487|    155|    pv_mem_ctxt = ps_create_ip->s_ivd_create_ip_t.pv_mem_ctxt;
 2488|    155|    u1_chroma_format = (UWORD8) (ps_create_ip->s_ivd_create_ip_t.e_output_format);
 2489|       |
 2490|    155|    if((u1_chroma_format != IV_YUV_420P) && (u1_chroma_format != IV_YUV_420SP_UV) &&
  ------------------
  |  Branch (2490:8): [True: 74, False: 81]
  |  Branch (2490:45): [True: 35, False: 39]
  ------------------
 2491|     35|       (u1_chroma_format != IV_YUV_420SP_VU))
  ------------------
  |  Branch (2491:8): [True: 1, False: 34]
  ------------------
 2492|      1|    {
 2493|      1|        ps_create_op->s_ivd_create_op_t.pv_handle = NULL;
 2494|       |
 2495|      1|        return IV_FAIL;
 2496|      1|    }
 2497|       |
 2498|       |    /* Initialize return handle to NULL */
 2499|    154|    ps_create_op->s_ivd_create_op_t.pv_handle = NULL;
 2500|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, sizeof(iv_obj_t));
 2501|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2502|    154|    memset(pv_buf, 0, sizeof(iv_obj_t));
 2503|    154|    *dec_hdl = (iv_obj_t *) pv_buf;
 2504|    154|    ps_create_op->s_ivd_create_op_t.pv_handle = *dec_hdl;
 2505|       |
 2506|    154|    (*dec_hdl)->pv_codec_handle = NULL;
 2507|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, sizeof(svc_dec_ctxt_t));
 2508|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2509|    154|    (*dec_hdl)->pv_codec_handle = (svc_dec_ctxt_t *) pv_buf;
 2510|    154|    ps_svcd_ctxt = (svc_dec_ctxt_t *) pv_buf;
 2511|       |
 2512|    154|    memset(ps_svcd_ctxt, 0, sizeof(svc_dec_ctxt_t));
 2513|       |
 2514|    154|    ps_svcd_ctxt->u1_prev_num_res_layers = UINT8_MAX;
 2515|    154|    ps_svcd_ctxt->u1_pre_parse_in_flush = 1;
 2516|       |    /* set default to maximum values supported */
 2517|    154|    ps_svcd_ctxt->u1_tgt_dep_id = MAX_DEPENDENCY_ID;
  ------------------
  |  |  103|    154|#define MAX_DEPENDENCY_ID 4
  ------------------
 2518|    154|    ps_svcd_ctxt->u1_tgt_quality_id = MAX_QUALITY_ID;
  ------------------
  |  |  102|    154|#define MAX_QUALITY_ID 0
  ------------------
 2519|    154|    ps_svcd_ctxt->u1_tgt_temp_id = MAX_TEMPORAL_ID;
  ------------------
  |  |  104|    154|#define MAX_TEMPORAL_ID 7
  ------------------
 2520|    154|    ps_svcd_ctxt->u1_tgt_priority_id = MAX_PRIORITY_ID;
  ------------------
  |  |  105|    154|#define MAX_PRIORITY_ID 63
  ------------------
 2521|       |
 2522|       |    /* two sets of MAX_NUM_SEQ_PARAMS are created one for sps-base layer;  one for
 2523|       |     * subset_sps- enhancement*/
 2524|    154|    size = ((sizeof(dec_seq_params_t)) * MAX_NUM_SEQ_PARAMS * 2);
  ------------------
  |  |  521|    154|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
 2525|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2526|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2527|    154|    memset(pv_buf, 0, size);
 2528|    154|    ps_svcd_ctxt->ps_sps = pv_buf;
 2529|       |
 2530|       |    /* two sets of MAX_NUM_SEQ_PARAMS are created one for sps-base layer;  one for
 2531|       |     * subset_sps- enhancement*/
 2532|    154|    size = ((sizeof(dec_svc_seq_params_t)) * MAX_NUM_SEQ_PARAMS * 2);
  ------------------
  |  |  521|    154|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
 2533|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2534|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2535|    154|    memset(pv_buf, 0, size);
 2536|    154|    ps_svcd_ctxt->ps_subset_sps = pv_buf;
 2537|       |
 2538|  10.0k|    for(u1_sps_ctr = 0; u1_sps_ctr < (2 * MAX_NUM_SEQ_PARAMS); u1_sps_ctr++)
  ------------------
  |  |  521|  10.0k|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
  |  Branch (2538:25): [True: 9.85k, False: 154]
  ------------------
 2539|  9.85k|    {
 2540|  9.85k|        ps_svcd_ctxt->ps_subset_sps[u1_sps_ctr].ps_seq = &ps_svcd_ctxt->ps_sps[u1_sps_ctr];
 2541|  9.85k|    }
 2542|       |
 2543|    154|    size = sizeof(sei);
 2544|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2545|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2546|    154|    memset(pv_buf, 0, size);
 2547|    154|    ps_svcd_ctxt->ps_sei = (sei *) pv_buf;
 2548|       |
 2549|    154|    size = sizeof(sei);
 2550|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2551|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2552|    154|    memset(pv_buf, 0, size);
 2553|    154|    ps_svcd_ctxt->ps_sei_parse = (sei *) pv_buf;
 2554|       |
 2555|    154|    size = (sizeof(dec_pic_params_t)) * MAX_NUM_PIC_PARAMS;
  ------------------
  |  |  524|    154|#define MAX_NUM_PIC_PARAMS 256
  ------------------
 2556|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2557|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2558|    154|    memset(pv_buf, 0, size);
 2559|    154|    ps_svcd_ctxt->ps_pps = pv_buf;
 2560|       |
 2561|    154|    size = (sizeof(svc_dec_lyr_struct_t)) * MAX_NUM_RES_LYRS;
  ------------------
  |  |   94|    154|#define MAX_NUM_RES_LYRS 3
  ------------------
 2562|    154|    pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2563|    154|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    154|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 154]
  |  |  ------------------
  ------------------
 2564|    154|    memset(pv_buf, 0, size);
 2565|    154|    ps_svcd_ctxt->ps_svc_dec_lyr = pv_buf;
 2566|    154|    ps_svcd_ctxt->u1_target_layer_id = 0;
 2567|    154|    ps_svcd_ctxt->u1_cur_layer_id = 0;
 2568|    154|    ps_svcd_ctxt->i4_eos_flag = 0;
 2569|       |
 2570|    154|    ret = isvcd_mode_mv_resample_ctxt_create(ps_svcd_ctxt, pv_api_ip, pv_api_op);
 2571|    154|    if(ret != IV_SUCCESS)
  ------------------
  |  Branch (2571:8): [True: 0, False: 154]
  ------------------
 2572|      0|    {
 2573|      0|        return ret;
 2574|      0|    }
 2575|    154|    ret = isvcd_intra_resample_ctxt_create(ps_svcd_ctxt, pv_api_ip, pv_api_op);
 2576|    154|    if(ret != IV_SUCCESS)
  ------------------
  |  Branch (2576:8): [True: 0, False: 154]
  ------------------
 2577|      0|    {
 2578|      0|        return ret;
 2579|      0|    }
 2580|    154|    ret = isvcd_residual_resample_ctxt_create(ps_svcd_ctxt, pv_api_ip, pv_api_op);
 2581|    154|    if(ret != IV_SUCCESS)
  ------------------
  |  Branch (2581:8): [True: 0, False: 154]
  ------------------
 2582|      0|    {
 2583|      0|        return ret;
 2584|      0|    }
 2585|    154|    ret = isvcd_nal_parse_ctxt_create(ps_svcd_ctxt, pv_api_ip, pv_api_op);
 2586|    154|    if(ret != IV_SUCCESS)
  ------------------
  |  Branch (2586:8): [True: 0, False: 154]
  ------------------
 2587|      0|    {
 2588|      0|        return ret;
 2589|      0|    }
 2590|    616|    for(u1_layer_id = 0; u1_layer_id < MAX_NUM_RES_LYRS; u1_layer_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (2590:26): [True: 462, False: 154]
  ------------------
 2591|    462|    {
 2592|    462|        ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[u1_layer_id];
 2593|    462|        ps_dec = &ps_svc_lyr_dec->s_dec;
 2594|       |
 2595|    462|        ps_svc_lyr_dec->ps_svcd_ctxt = ps_svcd_ctxt;
 2596|    462|        ps_svc_lyr_dec->u1_layer_id = u1_layer_id;
 2597|    462|        ps_svc_lyr_dec->u1_dyadic_flag = 1;
 2598|    462|        ps_svc_lyr_dec->u1_restricted_res_change_flag = 1;
 2599|    462|        ps_svc_lyr_dec->u1_base_res_flag = 1;
 2600|    462|        ps_svc_lyr_dec->u1_ref_layer_id = u1_layer_id - 1;
 2601|    462|        ps_svc_lyr_dec->ps_dec_svc_ref_layer =
 2602|    462|            &ps_svcd_ctxt->ps_svc_dec_lyr[ps_svc_lyr_dec->u1_ref_layer_id];
 2603|    462|        ps_svc_lyr_dec->u4_pps_id_for_layer = UINT32_MAX;
 2604|       |
 2605|    462|#ifndef LOGO_EN
 2606|    462|        ps_dec->u4_share_disp_buf = ps_create_ip->s_ivd_create_ip_t.u4_share_disp_buf;
 2607|       |#else
 2608|       |        ps_dec->u4_share_disp_buf = 0;
 2609|       |#endif
 2610|       |
 2611|    462|        ps_dec->u1_chroma_format = (UWORD8) (ps_create_ip->s_ivd_create_ip_t.e_output_format);
 2612|       |
 2613|    462|        if((ps_dec->u1_chroma_format != IV_YUV_420P) &&
  ------------------
  |  Branch (2613:12): [True: 219, False: 243]
  ------------------
 2614|    219|           (ps_dec->u1_chroma_format != IV_YUV_420SP_UV) &&
  ------------------
  |  Branch (2614:12): [True: 102, False: 117]
  ------------------
 2615|    102|           (ps_dec->u1_chroma_format != IV_YUV_420SP_VU))
  ------------------
  |  Branch (2615:12): [True: 0, False: 102]
  ------------------
 2616|      0|        {
 2617|      0|            ps_dec->u4_share_disp_buf = 0;
 2618|      0|        }
 2619|       |
 2620|    462|        ps_dec->u1_enable_mb_info = ps_create_ip->u4_enable_frame_info;
 2621|    462|        ps_dec->pf_aligned_alloc = pf_aligned_alloc;
 2622|    462|        ps_dec->pf_aligned_free = pf_aligned_free;
 2623|    462|        ps_dec->pv_mem_ctxt = pv_mem_ctxt;
 2624|       |
 2625|    462|        ps_dec->ps_sps = ps_svcd_ctxt->ps_sps;
 2626|    462|        ps_svc_lyr_dec->ps_subset_sps = ps_svcd_ctxt->ps_subset_sps;
 2627|    462|        ps_dec->ps_pps = ps_svcd_ctxt->ps_pps;
 2628|    462|        ps_dec->ps_sei = ps_svcd_ctxt->ps_sei;
 2629|    462|        ps_dec->ps_sei_parse = ps_svcd_ctxt->ps_sei_parse;
 2630|       |
 2631|    462|        size = ithread_get_handle_size();
 2632|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2633|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2634|    462|        memset(pv_buf, 0, size);
 2635|    462|        ps_dec->pv_dec_thread_handle = pv_buf;
 2636|       |
 2637|    462|        size = ithread_get_handle_size();
 2638|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2639|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2640|    462|        memset(pv_buf, 0, size);
 2641|    462|        ps_dec->pv_bs_deblk_thread_handle = pv_buf;
 2642|       |
 2643|       |#ifdef KEEP_THREADS_ACTIVE
 2644|       |        {
 2645|       |            UWORD32 i;
 2646|       |            /* Request memory to hold mutex (start/done) for both threads */
 2647|       |            size = ithread_get_mutex_lock_size() << 2;
 2648|       |            pv_buf = pf_aligned_alloc(pv_mem_ctxt, 8, size);
 2649|       |            RETURN_IF((NULL == pv_buf), IV_FAIL);
 2650|       |            memset(pv_buf, 0, size);
 2651|       |
 2652|       |            // init mutex variable for both the threads
 2653|       |            // 1. ih264d_decode_picture_thread
 2654|       |            // 2. ih264d_recon_deblk_thread
 2655|       |            for(i = 0; i < 2; i++)
 2656|       |            {
 2657|       |                WORD32 ret;
 2658|       |                WORD32 mutex_size = ithread_get_mutex_lock_size();
 2659|       |
 2660|       |                ps_dec->apv_proc_start_mutex[i] = (UWORD8 *) pv_buf + (2 * i * mutex_size);
 2661|       |                ps_dec->apv_proc_done_mutex[i] = (UWORD8 *) pv_buf + ((2 * i + 1) * mutex_size);
 2662|       |
 2663|       |                ret = ithread_mutex_init(ps_dec->apv_proc_start_mutex[0]);
 2664|       |                RETURN_IF((ret != IV_SUCCESS), ret);
 2665|       |
 2666|       |                ret = ithread_mutex_init(ps_dec->apv_proc_done_mutex[i]);
 2667|       |                RETURN_IF((ret != IV_SUCCESS), ret);
 2668|       |            }
 2669|       |
 2670|       |            size = ithread_get_cond_struct_size() << 2;
 2671|       |            pv_buf = pf_aligned_alloc(pv_mem_ctxt, 8, size);
 2672|       |            RETURN_IF((NULL == pv_buf), IV_FAIL);
 2673|       |            memset(pv_buf, 0, size);
 2674|       |
 2675|       |            // init condition variable for both the threads
 2676|       |            for(i = 0; i < 2; i++)
 2677|       |            {
 2678|       |                WORD32 ret;
 2679|       |                WORD32 cond_size = ithread_get_cond_struct_size();
 2680|       |                ps_dec->apv_proc_start_condition[i] = (UWORD8 *) pv_buf + (2 * i * cond_size);
 2681|       |                ps_dec->apv_proc_done_condition[i] = (UWORD8 *) pv_buf + ((2 * i + 1) * cond_size);
 2682|       |
 2683|       |                ret = ithread_cond_init(ps_dec->apv_proc_start_condition[i]);
 2684|       |                RETURN_IF((ret != IV_SUCCESS), ret);
 2685|       |
 2686|       |                ret = ithread_cond_init(ps_dec->apv_proc_done_condition[i]);
 2687|       |                RETURN_IF((ret != IV_SUCCESS), ret);
 2688|       |            }
 2689|       |        }
 2690|       |#endif
 2691|    462|        size = sizeof(dpb_manager_t);
 2692|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2693|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2694|    462|        memset(pv_buf, 0, size);
 2695|    462|        ps_dec->ps_dpb_mgr = pv_buf;
 2696|       |
 2697|    462|        size = sizeof(pred_info_t) * 2 * 32;
 2698|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2699|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2700|    462|        memset(pv_buf, 0, size);
 2701|    462|        ps_dec->ps_pred = pv_buf;
 2702|       |
 2703|    462|        size = sizeof(disp_mgr_t);
 2704|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2705|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2706|    462|        memset(pv_buf, 0, size);
 2707|    462|        ps_dec->pv_disp_buf_mgr = pv_buf;
 2708|       |
 2709|    462|        size = ih264_buf_mgr_size();
 2710|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2711|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2712|    462|        memset(pv_buf, 0, size);
 2713|    462|        ps_dec->pv_pic_buf_mgr = pv_buf;
 2714|       |
 2715|    462|        size = sizeof(struct pic_buffer_t) * (H264_MAX_REF_PICS * 2);
  ------------------
  |  |  534|    462|#define H264_MAX_REF_PICS         16
  ------------------
 2716|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2717|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2718|    462|        memset(pv_buf, 0, size);
 2719|    462|        ps_dec->ps_pic_buf_base = pv_buf;
 2720|       |
 2721|    462|        size = sizeof(dec_err_status_t);
 2722|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2723|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2724|    462|        memset(pv_buf, 0, size);
 2725|    462|        ps_dec->ps_dec_err_status = (dec_err_status_t *) pv_buf;
 2726|       |
 2727|    462|        size = sizeof(dpb_commands_t);
 2728|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2729|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2730|    462|        memset(pv_buf, 0, size);
 2731|    462|        ps_dec->ps_dpb_cmds = (dpb_commands_t *) pv_buf;
 2732|       |
 2733|    462|        size = sizeof(dec_bit_stream_t);
 2734|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2735|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2736|    462|        memset(pv_buf, 0, size);
 2737|    462|        ps_dec->ps_bitstrm = (dec_bit_stream_t *) pv_buf;
 2738|       |
 2739|    462|        size = sizeof(dec_nal_unit_svc_ext_params_t);
 2740|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2741|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2742|    462|        memset(pv_buf, 0, size);
 2743|    462|        ps_svc_lyr_dec->ps_nal_svc_ext = (dec_nal_unit_svc_ext_params_t *) pv_buf;
 2744|       |
 2745|    462|        size = sizeof(dec_slice_params_t);
 2746|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2747|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2748|    462|        memset(pv_buf, 0, size);
 2749|    462|        ps_dec->ps_cur_slice = (dec_slice_params_t *) pv_buf;
 2750|       |
 2751|    462|        size = MAX(sizeof(dec_seq_params_t), sizeof(dec_pic_params_t));
  ------------------
  |  |   60|    462|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 462, Folded]
  |  |  ------------------
  ------------------
 2752|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2753|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2754|    462|        memset(pv_buf, 0, size);
 2755|    462|        ps_dec->pv_scratch_sps_pps = pv_buf;
 2756|       |
 2757|    462|        size = sizeof(dec_svc_seq_params_t);
 2758|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2759|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2760|    462|        memset(pv_buf, 0, size);
 2761|    462|        ps_svc_lyr_dec->pv_scratch_subset_sps = pv_buf;
 2762|       |
 2763|    462|        ps_dec->u4_static_bits_buf_size = 256000;
 2764|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, ps_dec->u4_static_bits_buf_size);
 2765|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2766|    462|        memset(pv_buf, 0, ps_dec->u4_static_bits_buf_size);
 2767|    462|        ps_dec->pu1_bits_buf_static = pv_buf;
 2768|       |
 2769|    462|        size = ((TOTAL_LIST_ENTRIES + PAD_MAP_IDX_POC) * sizeof(void *));
  ------------------
  |  |   95|    462|#define TOTAL_LIST_ENTRIES      6 * POC_LIST_L0_TO_L1_DIFF//BOT_LIST_FLD_L1 + POC_LIST_L0_TO_L1_DIFF_1  //0+33+33+17+17+17+17
  |  |  ------------------
  |  |  |  |   86|    462|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|    462|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      size = ((TOTAL_LIST_ENTRIES + PAD_MAP_IDX_POC) * sizeof(void *));
  ------------------
  |  |  100|    462|#define PAD_MAP_IDX_POC             (1)
  ------------------
 2770|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2771|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2772|    462|        ps_dec->ppv_map_ref_idx_to_poc_base = pv_buf;
 2773|    462|        memset(ps_dec->ppv_map_ref_idx_to_poc_base, 0, size);
 2774|       |
 2775|    462|        ps_dec->ppv_map_ref_idx_to_poc = ps_dec->ppv_map_ref_idx_to_poc_base + OFFSET_MAP_IDX_POC;
  ------------------
  |  |  103|    462|#define OFFSET_MAP_IDX_POC          (1)
  ------------------
 2776|       |
 2777|    462|        size = (sizeof(bin_ctxt_model_t) * NUM_CABAC_CTXTS_SVC);
  ------------------
  |  |   46|    462|#define NUM_CABAC_CTXTS_SVC 467
  ------------------
 2778|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2779|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2780|    462|        memset(pv_buf, 0, size);
 2781|    462|        ps_dec->p_cabac_ctxt_table_t = pv_buf;
 2782|       |
 2783|    462|        size = sizeof(ctxt_inc_mb_info_t);
 2784|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2785|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2786|    462|        memset(pv_buf, 0, size);
 2787|    462|        ps_dec->ps_left_mb_ctxt_info = pv_buf;
 2788|       |
 2789|    462|        size = MAX_REF_BUF_SIZE * 2;
  ------------------
  |  |   67|    462|#define MAX_REF_BUF_SIZE       (3776*2*2)
  ------------------
 2790|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2791|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2792|    462|        memset(pv_buf, 0, size);
 2793|    462|        ps_dec->pu1_ref_buff_base = pv_buf;
 2794|    462|        ps_dec->pu1_ref_buff = ps_dec->pu1_ref_buff_base + MAX_REF_BUF_SIZE;
  ------------------
  |  |   67|    462|#define MAX_REF_BUF_SIZE       (3776*2*2)
  ------------------
 2795|       |
 2796|    462|        size = ((sizeof(WORD16)) * PRED_BUFFER_WIDTH * PRED_BUFFER_HEIGHT * 2);
  ------------------
  |  |   55|    462|#define PRED_BUFFER_WIDTH   24*2
  ------------------
                      size = ((sizeof(WORD16)) * PRED_BUFFER_WIDTH * PRED_BUFFER_HEIGHT * 2);
  ------------------
  |  |   56|    462|#define PRED_BUFFER_HEIGHT  24*2
  ------------------
 2797|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2798|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2799|    462|        memset(pv_buf, 0, size);
 2800|    462|        ps_dec->pi2_pred1 = pv_buf;
 2801|       |
 2802|    462|        size = sizeof(UWORD8) * (MB_LUM_SIZE);
  ------------------
  |  |  563|    462|#define MB_LUM_SIZE                   256
  ------------------
 2803|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2804|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2805|    462|        memset(pv_buf, 0, size);
 2806|    462|        ps_dec->pu1_temp_mc_buffer = pv_buf;
 2807|       |
 2808|    462|        size = 8 * MAX_REF_BUFS * sizeof(struct pic_buffer_t);
  ------------------
  |  |   75|    462|#define MAX_REF_BUFS    32
  ------------------
 2809|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2810|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2811|    462|        memset(pv_buf, 0, size);
 2812|       |
 2813|    462|        ps_dec->pu1_init_dpb_base = pv_buf;
 2814|    462|        pu1_buf = pv_buf;
 2815|    462|        ps_dec->ps_dpb_mgr->ps_init_dpb[0][0] = (struct pic_buffer_t *) pu1_buf;
 2816|       |
 2817|    462|        pu1_buf += size / 2;
 2818|    462|        ps_dec->ps_dpb_mgr->ps_init_dpb[1][0] = (struct pic_buffer_t *) pu1_buf;
 2819|       |
 2820|    462|        size = (sizeof(UWORD32) * 2 * 3 * ((MAX_FRAMES << 1) * (MAX_FRAMES << 1)) * 2);
  ------------------
  |  |  600|    462|#define MAX_FRAMES              16
  ------------------
                      size = (sizeof(UWORD32) * 2 * 3 * ((MAX_FRAMES << 1) * (MAX_FRAMES << 1)) * 2);
  ------------------
  |  |  600|    462|#define MAX_FRAMES              16
  ------------------
 2821|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2822|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2823|    462|        memset(pv_buf, 0, size);
 2824|    462|        ps_dec->pu4_mbaff_wt_mat = pv_buf;
 2825|       |
 2826|    462|        size = sizeof(UWORD32) * 2 * 3 * ((MAX_FRAMES << 1) * (MAX_FRAMES << 1));
  ------------------
  |  |  600|    462|#define MAX_FRAMES              16
  ------------------
                      size = sizeof(UWORD32) * 2 * 3 * ((MAX_FRAMES << 1) * (MAX_FRAMES << 1));
  ------------------
  |  |  600|    462|#define MAX_FRAMES              16
  ------------------
 2827|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2828|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2829|    462|        memset(pv_buf, 0, size);
 2830|    462|        ps_dec->pu4_wts_ofsts_mat = pv_buf;
 2831|       |
 2832|    462|        size = (sizeof(neighbouradd_t) << 2);
 2833|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2834|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2835|    462|        memset(pv_buf, 0, size);
 2836|    462|        ps_dec->ps_left_mvpred_addr = pv_buf;
 2837|       |
 2838|    462|        size = ih264_buf_mgr_size();
 2839|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2840|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2841|    462|        memset(pv_buf, 0, size);
 2842|    462|        ps_dec->pv_mv_buf_mgr = pv_buf;
 2843|       |
 2844|    462|        size = sizeof(col_mv_buf_t) * (H264_MAX_REF_PICS * 2);
  ------------------
  |  |  534|    462|#define H264_MAX_REF_PICS         16
  ------------------
 2845|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2846|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2847|    462|        ps_dec->ps_col_mv_base = pv_buf;
 2848|    462|        memset(ps_dec->ps_col_mv_base, 0, size);
 2849|       |
 2850|    462|        size = ((MB_SIZE * MB_SIZE * 3) >> 1) + MB_SIZE;
  ------------------
  |  |  554|    462|#define MB_SIZE             16
  ------------------
                      size = ((MB_SIZE * MB_SIZE * 3) >> 1) + MB_SIZE;
  ------------------
  |  |  554|    462|#define MB_SIZE             16
  ------------------
                      size = ((MB_SIZE * MB_SIZE * 3) >> 1) + MB_SIZE;
  ------------------
  |  |  554|    462|#define MB_SIZE             16
  ------------------
 2851|    462|        pv_buf = pf_aligned_alloc(pv_mem_ctxt, 128, size);
 2852|    462|        RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    462|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 462]
  |  |  ------------------
  ------------------
 2853|    462|        ps_svc_lyr_dec->pu1_ii_resamp_buffer_luma = pv_buf;
 2854|    462|        ps_svc_lyr_dec->pu1_ii_resamp_buffer_chroma =
 2855|    462|            ps_svc_lyr_dec->pu1_ii_resamp_buffer_luma + (MB_SIZE * MB_SIZE);
  ------------------
  |  |  554|    462|#define MB_SIZE             16
  ------------------
                          ps_svc_lyr_dec->pu1_ii_resamp_buffer_luma + (MB_SIZE * MB_SIZE);
  ------------------
  |  |  554|    462|#define MB_SIZE             16
  ------------------
 2856|    462|        memset(ps_svc_lyr_dec->pu1_ii_resamp_buffer_luma, 0, size);
 2857|       |
 2858|    462|        isvcd_init_decoder(ps_svc_lyr_dec);
 2859|    462|    }
 2860|    154|    return IV_SUCCESS;
 2861|    154|}
isvcd_create:
 2884|    155|{
 2885|    155|    isvcd_create_ip_t *ps_create_ip;
 2886|    155|    isvcd_create_op_t *ps_create_op;
 2887|    155|    WORD32 ret;
 2888|       |
 2889|    155|    ps_create_ip = (isvcd_create_ip_t *) pv_api_ip;
 2890|    155|    ps_create_op = (isvcd_create_op_t *) pv_api_op;
 2891|       |
 2892|    155|    ps_create_op->s_ivd_create_op_t.u4_error_code = 0;
 2893|    155|    dec_hdl = NULL;
 2894|    155|    ret = isvcd_allocate_static_bufs(&dec_hdl, pv_api_ip, pv_api_op);
 2895|       |
 2896|       |    /* If allocation of some buffer fails, then free buffers allocated till then */
 2897|    155|    if(IV_FAIL == ret)
  ------------------
  |  Branch (2897:8): [True: 1, False: 154]
  ------------------
 2898|      1|    {
 2899|      1|        if(dec_hdl)
  ------------------
  |  Branch (2899:12): [True: 0, False: 1]
  ------------------
 2900|      0|        {
 2901|      0|            if(dec_hdl->pv_codec_handle)
  ------------------
  |  Branch (2901:16): [True: 0, False: 0]
  ------------------
 2902|      0|            {
 2903|      0|                isvcd_free_static_bufs(dec_hdl);
 2904|      0|            }
 2905|      0|            else
 2906|      0|            {
 2907|      0|                void (*pf_aligned_free)(void *pv_mem_ctxt, void *pv_buf);
 2908|      0|                void *pv_mem_ctxt;
 2909|       |
 2910|      0|                pf_aligned_free = ps_create_ip->s_ivd_create_ip_t.pf_aligned_free;
 2911|      0|                pv_mem_ctxt = ps_create_ip->s_ivd_create_ip_t.pv_mem_ctxt;
 2912|      0|                pf_aligned_free(pv_mem_ctxt, dec_hdl);
 2913|      0|            }
 2914|      0|        }
 2915|      1|        ps_create_op->s_ivd_create_op_t.u4_error_code = IVD_MEM_ALLOC_FAILED;
 2916|      1|        ps_create_op->s_ivd_create_op_t.u4_error_code |= 1 << IVD_FATALERROR;
 2917|      1|        return IV_FAIL;
 2918|      1|    }
 2919|       |
 2920|    154|    return IV_SUCCESS;
 2921|    155|}
isvcd_update_dqid:
 2951|  9.70k|{
 2952|  9.70k|    vcl_node_t *ps_vcl_node;
 2953|       |
 2954|       |    /* sanity checks */
 2955|  9.70k|    if((NULL == ps_cur_lyr_node) || (NULL == pps_bot_lyr_node))
  ------------------
  |  Branch (2955:8): [True: 0, False: 9.70k]
  |  Branch (2955:37): [True: 0, False: 9.70k]
  ------------------
 2956|      0|    {
 2957|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 2958|      0|    }
 2959|       |
 2960|  9.70k|    ps_vcl_node = ps_cur_lyr_node->ps_bot_node;
 2961|  9.70k|    while(NULL != ps_vcl_node)
  ------------------
  |  Branch (2961:11): [True: 3.78k, False: 5.91k]
  ------------------
 2962|  3.78k|    {
 2963|  3.78k|        WORD32 i4_dqid;
 2964|       |
 2965|  3.78k|        i4_dqid = (ps_vcl_node->i4_dependency_id << 4) + ps_vcl_node->i4_quality_id;
 2966|       |
 2967|       |        /* if reference layer DQ ID matches */
 2968|       |        /* or reference layer is a layer below reference dq id layer */
 2969|  3.78k|        if((i4_dqid == i4_ref_lyr_dqid) ||
  ------------------
  |  Branch (2969:12): [True: 3.68k, False: 101]
  ------------------
 2970|    101|           (ps_vcl_node->i4_quality_id < (i4_ref_lyr_dqid & 0x0F)) ||
  ------------------
  |  Branch (2970:12): [True: 101, False: 0]
  ------------------
 2971|      0|           (ps_vcl_node->i4_dependency_id < (i4_ref_lyr_dqid >> 4)))
  ------------------
  |  Branch (2971:12): [True: 0, False: 0]
  ------------------
 2972|  3.78k|        {
 2973|  3.78k|            break;
 2974|  3.78k|        }
 2975|      0|        ps_vcl_node = ps_vcl_node->ps_bot_node;
 2976|      0|    }
 2977|       |
 2978|       |    /* Update the top and bottom node of ref layer and current layer nodes */
 2979|       |
 2980|  9.70k|    if(NULL != ps_vcl_node)
  ------------------
  |  Branch (2980:8): [True: 3.78k, False: 5.91k]
  ------------------
 2981|  3.78k|    {
 2982|  3.78k|        ps_cur_lyr_node->ps_bot_node = ps_vcl_node;
 2983|  3.78k|        ps_vcl_node->ps_top_node = ps_cur_lyr_node;
 2984|  3.78k|    }
 2985|       |
 2986|       |    /* Update pointer to bottom VCL node */
 2987|  9.70k|    *pps_bot_lyr_node = ps_vcl_node;
 2988|  9.70k|    return (OK);
  ------------------
  |  |  114|  9.70k|#define OK        0
  ------------------
 2989|  9.70k|}
isvcd_detect_res_change:
 3017|  9.69k|{
 3018|  9.69k|    UWORD16 u2_scaled_ref_width_sps;
 3019|  9.69k|    UWORD16 u2_scaled_ref_ht_sps;
 3020|  9.69k|    UNUSED(ps_prev_subset_sps);
  ------------------
  |  |   45|  9.69k|#define UNUSED(x) ((void)(x))
  ------------------
 3021|       |
 3022|  9.69k|    if(NULL == ps_prev_sps)
  ------------------
  |  Branch (3022:8): [True: 5.91k, False: 3.78k]
  ------------------
 3023|  5.91k|    {
 3024|       |        /* indicates bottom most layer in Access unit */
 3025|  5.91k|        return (SVCD_FALSE);
  ------------------
  |  |   45|  5.91k|#define SVCD_FALSE 0
  ------------------
 3026|  5.91k|    }
 3027|       |    /* Check for the ESS idc */
 3028|  3.78k|    if(2 == ps_curr_subset_sps->s_sps_svc_ext.u1_extended_spatial_scalability_idc)
  ------------------
  |  Branch (3028:8): [True: 0, False: 3.78k]
  ------------------
 3029|      0|    {
 3030|      0|        return (SVCD_TRUE);
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 3031|      0|    }
 3032|       |
 3033|       |    /* Calculate the scaled reference width and height */
 3034|  3.78k|    u2_scaled_ref_width_sps = (ps_curr_sps->u2_frm_wd_in_mbs << 4);
 3035|  3.78k|    u2_scaled_ref_width_sps -=
 3036|  3.78k|        (ps_curr_subset_sps->s_sps_svc_ext.i4_seq_scaled_ref_layer_left_offset +
 3037|  3.78k|         ps_curr_subset_sps->s_sps_svc_ext.i4_seq_scaled_ref_layer_right_offset);
 3038|       |
 3039|  3.78k|    u2_scaled_ref_ht_sps = (ps_curr_sps->u2_frm_ht_in_mbs << 4);
 3040|  3.78k|    u2_scaled_ref_ht_sps -=
 3041|  3.78k|        (ps_curr_subset_sps->s_sps_svc_ext.i4_seq_scaled_ref_layer_top_offset +
 3042|  3.78k|         ps_curr_subset_sps->s_sps_svc_ext.i4_seq_scaled_ref_layer_bottom_offset);
 3043|       |
 3044|       |    /* Check for frame width being different */
 3045|  3.78k|    if(u2_scaled_ref_width_sps != (ps_prev_sps->u2_frm_wd_in_mbs << 4))
  ------------------
  |  Branch (3045:8): [True: 2.59k, False: 1.19k]
  ------------------
 3046|  2.59k|    {
 3047|  2.59k|        return (SVCD_TRUE);
  ------------------
  |  |   46|  2.59k|#define SVCD_TRUE 1
  ------------------
 3048|  2.59k|    }
 3049|       |
 3050|       |    /* Check for frame height being different */
 3051|  1.19k|    if(u2_scaled_ref_ht_sps != (ps_prev_sps->u2_frm_ht_in_mbs << 4))
  ------------------
  |  Branch (3051:8): [True: 31, False: 1.16k]
  ------------------
 3052|     31|    {
 3053|     31|        return (SVCD_TRUE);
  ------------------
  |  |   46|     31|#define SVCD_TRUE 1
  ------------------
 3054|     31|    }
 3055|       |
 3056|       |    /* check for crop offset not MB aligned */
 3057|  1.16k|    if((0 != (ps_curr_subset_sps->s_sps_svc_ext.i4_seq_scaled_ref_layer_left_offset & 15)) ||
  ------------------
  |  Branch (3057:8): [True: 0, False: 1.16k]
  ------------------
 3058|  1.16k|       (0 != (ps_curr_subset_sps->s_sps_svc_ext.i4_seq_scaled_ref_layer_top_offset & 15)))
  ------------------
  |  Branch (3058:8): [True: 0, False: 1.16k]
  ------------------
 3059|      0|    {
 3060|      0|        return (SVCD_TRUE);
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 3061|      0|    }
 3062|       |
 3063|       |    /* check for chroma Phase Y being different */
 3064|  1.16k|    if(ps_curr_subset_sps->s_sps_svc_ext.u1_chroma_phase_x_plus1_flag !=
  ------------------
  |  Branch (3064:8): [True: 0, False: 1.16k]
  ------------------
 3065|  1.16k|       ps_curr_subset_sps->s_sps_svc_ext.u1_seq_ref_layer_chroma_phase_x_plus1_flag)
 3066|      0|    {
 3067|      0|        return (SVCD_TRUE);
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 3068|      0|    }
 3069|       |
 3070|       |    /* check for chroma Phase Y being different */
 3071|  1.16k|    if(ps_curr_subset_sps->s_sps_svc_ext.u1_chroma_phase_y_plus1 !=
  ------------------
  |  Branch (3071:8): [True: 0, False: 1.16k]
  ------------------
 3072|  1.16k|       ps_curr_subset_sps->s_sps_svc_ext.u1_seq_ref_layer_chroma_phase_y_plus1)
 3073|      0|    {
 3074|      0|        return (SVCD_TRUE);
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 3075|      0|    }
 3076|       |
 3077|       |    /* If none of the above are true then there is no resolution change */
 3078|  1.16k|    return (SVCD_FALSE);
  ------------------
  |  |   45|  1.16k|#define SVCD_FALSE 0
  ------------------
 3079|  1.16k|}
isvcd_parse_ref_pic_list_modify:
 3107|  1.60k|{
 3108|  1.60k|    WORD32 i4_mod_flag;
 3109|  1.60k|    UWORD16 ui_nextUev;
 3110|  1.60k|    WORD32 i4_num_sets_ctr = 0;
 3111|  1.60k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 3112|  1.60k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
 3113|       |
 3114|  1.60k|    if(I_SLICE != ps_slice_prms->u1_slice_type)
  ------------------
  |  |  370|  1.60k|#define I_SLICE  2
  ------------------
  |  Branch (3114:8): [True: 1.54k, False: 54]
  ------------------
 3115|  1.54k|    {
 3116|       |        /* ref_pic_list_modification_flag_l0 */
 3117|  1.54k|        i4_mod_flag = ih264d_get_bit_h264(ps_bitstrm);
 3118|       |
 3119|  1.54k|        if(0 != i4_mod_flag)
  ------------------
  |  Branch (3119:12): [True: 780, False: 767]
  ------------------
 3120|    780|        {
 3121|    780|            WORD32 i4_mod_pic_num_idc;
 3122|       |
 3123|    780|            i4_num_sets_ctr = 0;
 3124|    780|            do
 3125|  2.58k|            {
 3126|       |                /* modification_of_pic_nums_idc */
 3127|  2.58k|                i4_mod_pic_num_idc = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3128|       |
 3129|  2.58k|                if((i4_mod_pic_num_idc > 3) || (i4_mod_pic_num_idc < 0))
  ------------------
  |  Branch (3129:20): [True: 687, False: 1.89k]
  |  Branch (3129:48): [True: 8, False: 1.89k]
  ------------------
 3130|    695|                {
 3131|    695|                    return ERROR_INV_SLICE_HDR_T;
 3132|    695|                }
 3133|  1.89k|                if(3 != i4_mod_pic_num_idc)
  ------------------
  |  Branch (3133:20): [True: 1.84k, False: 50]
  ------------------
 3134|  1.84k|                {
 3135|       |                    /* i4_mod_pic_num_idc = 0,1 ==> abs_diff_pic_num_minus1 */
 3136|       |                    /* i4_mod_pic_num_idc = 2 ==> long_term_pic_num */
 3137|       |
 3138|  1.84k|                    ui_nextUev = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3139|  1.84k|                    if(ui_nextUev > (ps_curr_sps->u2_u4_max_pic_num_minus1 + 1))
  ------------------
  |  Branch (3139:24): [True: 3, False: 1.83k]
  ------------------
 3140|      3|                        return ERROR_INV_SLICE_HDR_T;
 3141|  1.84k|                }
 3142|       |
 3143|  1.88k|                i4_num_sets_ctr++;
 3144|       |
 3145|       |                /* if the number of commands recieved exceeds max limit */
 3146|  1.88k|                if((H264_MAX_REF_PICS) == i4_num_sets_ctr) break;
  ------------------
  |  |  534|  1.88k|#define H264_MAX_REF_PICS         16
  ------------------
  |  Branch (3146:20): [True: 32, False: 1.85k]
  ------------------
 3147|       |
 3148|  1.88k|            } while(3 != i4_mod_pic_num_idc);
  ------------------
  |  Branch (3148:21): [True: 1.80k, False: 50]
  ------------------
 3149|    780|        }
 3150|       |
 3151|       |        /*********** if (I_SLICE != u1_slice_type) ***************************/
 3152|  1.54k|    }
 3153|       |
 3154|    903|    if(B_SLICE != ps_slice_prms->u1_slice_type)
  ------------------
  |  |  369|    903|#define B_SLICE  1
  ------------------
  |  Branch (3154:8): [True: 796, False: 107]
  ------------------
 3155|    796|    {
 3156|    796|        return (OK);
  ------------------
  |  |  114|    796|#define OK        0
  ------------------
 3157|    796|    }
 3158|       |
 3159|       |    /* ref_pic_list_modification_flag_l1 */
 3160|    107|    i4_mod_flag = ih264d_get_bit_h264(ps_bitstrm);
 3161|       |
 3162|    107|    if(0 != i4_mod_flag)
  ------------------
  |  Branch (3162:8): [True: 62, False: 45]
  ------------------
 3163|     62|    {
 3164|     62|        WORD32 i4_mod_pic_num_idc;
 3165|       |
 3166|     62|        do
 3167|    409|        {
 3168|       |            /* modification_of_pic_nums_idc */
 3169|    409|            i4_mod_pic_num_idc = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3170|       |
 3171|    409|            if((i4_mod_pic_num_idc > 3) || (i4_mod_pic_num_idc < 0))
  ------------------
  |  Branch (3171:16): [True: 62, False: 347]
  |  Branch (3171:44): [True: 0, False: 347]
  ------------------
 3172|     62|            {
 3173|     62|                return ERROR_INV_SLICE_HDR_T;
 3174|     62|            }
 3175|    347|            if(3 != i4_mod_pic_num_idc)
  ------------------
  |  Branch (3175:16): [True: 347, False: 0]
  ------------------
 3176|    347|            {
 3177|       |                /* i4_mod_pic_num_idc = 0,1 ==> abs_diff_pic_num_minus1 */
 3178|       |                /* i4_mod_pic_num_idc = 2 ==> long_term_pic_num */
 3179|       |
 3180|    347|                ui_nextUev = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3181|    347|                if(ui_nextUev > (ps_curr_sps->u2_u4_max_pic_num_minus1 + 1))
  ------------------
  |  Branch (3181:20): [True: 0, False: 347]
  ------------------
 3182|      0|                    return ERROR_INV_SLICE_HDR_T;
 3183|    347|            }
 3184|       |
 3185|    347|            i4_num_sets_ctr++;
 3186|       |
 3187|       |            /* if the number of commands recieved exceeds max limit */
 3188|    347|            if((H264_MAX_REF_PICS) == i4_num_sets_ctr) break;
  ------------------
  |  |  534|    347|#define H264_MAX_REF_PICS         16
  ------------------
  |  Branch (3188:16): [True: 0, False: 347]
  ------------------
 3189|       |
 3190|    347|        } while(3 != i4_mod_pic_num_idc);
  ------------------
  |  Branch (3190:17): [True: 347, False: 0]
  ------------------
 3191|     62|    }
 3192|       |
 3193|     45|    return (OK);
  ------------------
  |  |  114|     45|#define OK        0
  ------------------
 3194|    107|}
isvcd_parse_slice_hdr_refdq_id:
 3228|  2.22k|{
 3229|  2.22k|    UWORD8 u1_pps_id;
 3230|  2.22k|    WORD32 i_temp;
 3231|  2.22k|    UWORD32 u4_temp;
 3232|  2.22k|    WORD32 i4_nal_unit_type;
 3233|  2.22k|    WORD32 i4_nal_ref_idc, i4_quality_id;
 3234|  2.22k|    WORD32 i4_use_ref_base, i4_idr_pic_flag;
 3235|  2.22k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 3236|  2.22k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
 3237|  2.22k|    dec_svc_seq_params_t *ps_subset_sps = NULL;
 3238|  2.22k|    WORD32 ret = OK;
  ------------------
  |  |  114|  2.22k|#define OK        0
  ------------------
 3239|       |
 3240|  2.22k|    i4_nal_unit_type = ps_vcl_node->i4_nal_unit_type;
 3241|  2.22k|    i4_nal_ref_idc = ps_vcl_node->i4_nal_ref_idc;
 3242|  2.22k|    i4_quality_id = ps_vcl_node->i4_quality_id;
 3243|  2.22k|    i4_use_ref_base = ps_vcl_node->i4_use_ref_base;
 3244|  2.22k|    i4_idr_pic_flag = ps_vcl_node->i4_idr_pic_flag;
 3245|       |
 3246|       |    /*-----------------------------------------------------------------------*/
 3247|       |    /*--------------------- first mb in slice -------------------------------*/
 3248|       |    /*-----------------------------------------------------------------------*/
 3249|  2.22k|    ps_slice_prms->u2_first_mb_in_slice = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3250|       |
 3251|       |    /*-----------------------------------------------------------------------*/
 3252|       |    /*---------------------------- slice type -------------------------------*/
 3253|       |    /*-----------------------------------------------------------------------*/
 3254|  2.22k|    ps_slice_prms->u1_slice_type = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3255|  2.22k|    if(ps_slice_prms->u1_slice_type > 4)
  ------------------
  |  Branch (3255:8): [True: 63, False: 2.16k]
  ------------------
 3256|     63|    {
 3257|     63|        ps_slice_prms->u1_slice_type -= 5;
 3258|     63|    }
 3259|       |
 3260|       |    /*-----------------------------------------------------------------------*/
 3261|       |    /*----------------------------- PPS id ----------------------------------*/
 3262|       |    /*-----------------------------------------------------------------------*/
 3263|  2.22k|    u1_pps_id = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3264|       |
 3265|       |    /* set correspoding sps and pps id also */
 3266|  2.22k|    ps_pps += u1_pps_id;
 3267|  2.22k|    if(FALSE == ps_pps->u1_is_valid)
  ------------------
  |  |  592|  2.22k|#define FALSE   0
  ------------------
  |  Branch (3267:8): [True: 127, False: 2.09k]
  ------------------
 3268|    127|    {
 3269|    127|        return ERROR_INV_SLICE_HDR_T;
 3270|    127|    }
 3271|  2.09k|    ps_sps = ps_pps->ps_sps;
 3272|  2.09k|    ps_subset_sps = &ps_svcd_ctxt->ps_subset_sps[ps_sps->u1_seq_parameter_set_id];
 3273|  2.09k|    if(CODED_SLICE_EXTENSION_NAL == i4_nal_unit_type)
  ------------------
  |  |   66|  2.09k|#define CODED_SLICE_EXTENSION_NAL 20
  ------------------
  |  Branch (3273:8): [True: 2.01k, False: 81]
  ------------------
 3274|  2.01k|    {
 3275|  2.01k|        ps_sps += MAX_NUM_SEQ_PARAMS;
  ------------------
  |  |  521|  2.01k|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
 3276|  2.01k|        ps_subset_sps =
 3277|  2.01k|            &ps_svcd_ctxt->ps_subset_sps[MAX_NUM_SEQ_PARAMS + ps_sps->u1_seq_parameter_set_id];
  ------------------
  |  |  521|  2.01k|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
 3278|  2.01k|    }
 3279|       |    /*-----------------------------------------------------------------------*/
 3280|       |    /*--------------------------- frm num -----------------------------------*/
 3281|       |    /*-----------------------------------------------------------------------*/
 3282|  2.09k|    if(!ps_sps) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (3282:8): [True: 0, False: 2.09k]
  ------------------
 3283|  2.09k|    if(FALSE == ps_sps->u1_is_valid) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  |  592|  2.09k|#define FALSE   0
  ------------------
  |  Branch (3283:8): [True: 178, False: 1.91k]
  ------------------
 3284|       |
 3285|  1.91k|    ps_slice_prms->u2_frame_num = ih264d_get_bits_h264(ps_bitstrm, ps_sps->u1_bits_in_frm_num);
 3286|       |
 3287|       |    /*-----------------------------------------------------------------------*/
 3288|       |    /*------------------ field pic flag and bottom field flag ---------------*/
 3289|       |    /*-----------------------------------------------------------------------*/
 3290|  1.91k|    if(SVCD_TRUE != ps_sps->u1_frame_mbs_only_flag)
  ------------------
  |  |   46|  1.91k|#define SVCD_TRUE 1
  ------------------
  |  Branch (3290:8): [True: 28, False: 1.89k]
  ------------------
 3291|     28|    {
 3292|     28|        return ERROR_INV_SLICE_HDR_T;
 3293|     28|    }
 3294|       |    /*-----------------------------------------------------------------------*/
 3295|       |    /*--------------------------- IDR pic id --------------------------------*/
 3296|       |    /*-----------------------------------------------------------------------*/
 3297|  1.89k|    if(SVCD_TRUE == i4_idr_pic_flag)
  ------------------
  |  |   46|  1.89k|#define SVCD_TRUE 1
  ------------------
  |  Branch (3297:8): [True: 1.86k, False: 26]
  ------------------
 3298|  1.86k|    {
 3299|  1.86k|        UWORD32 u4_idr_pic_id = 0;
 3300|  1.86k|        u4_idr_pic_id = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3301|  1.86k|        if(u4_idr_pic_id > 65535) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (3301:12): [True: 206, False: 1.65k]
  ------------------
 3302|  1.86k|    }
 3303|       |
 3304|       |    /*-----------------------------------------------------------------------*/
 3305|       |    /*----------------- poc lsb and delts_poc_bottom ------------------------*/
 3306|       |    /*-----------------------------------------------------------------------*/
 3307|  1.68k|    if(0 == ps_sps->u1_pic_order_cnt_type)
  ------------------
  |  Branch (3307:8): [True: 1.64k, False: 38]
  ------------------
 3308|  1.64k|    {
 3309|  1.64k|        i_temp = ih264d_get_bits_h264(ps_bitstrm, ps_sps->u1_log2_max_pic_order_cnt_lsb_minus);
 3310|       |
 3311|  1.64k|        if(i_temp < 0 || i_temp >= ps_sps->i4_max_pic_order_cntLsb) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (3311:12): [True: 0, False: 1.64k]
  |  Branch (3311:26): [True: 0, False: 1.64k]
  ------------------
 3312|  1.64k|        if(SVCD_TRUE == ps_pps->u1_pic_order_present_flag)
  ------------------
  |  |   46|  1.64k|#define SVCD_TRUE 1
  ------------------
  |  Branch (3312:12): [True: 76, False: 1.57k]
  ------------------
 3313|     76|        {
 3314|     76|            i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3315|     76|        }
 3316|  1.64k|    }
 3317|       |
 3318|       |    /*-----------------------------------------------------------------------*/
 3319|       |    /*---------------- delta_poc_count[0] and [1] ---------------------------*/
 3320|       |    /*-----------------------------------------------------------------------*/
 3321|  1.68k|    if((1 == ps_sps->u1_pic_order_cnt_type) && (!ps_sps->u1_delta_pic_order_always_zero_flag))
  ------------------
  |  Branch (3321:8): [True: 38, False: 1.64k]
  |  Branch (3321:48): [True: 38, False: 0]
  ------------------
 3322|     38|    {
 3323|     38|        i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3324|       |
 3325|     38|        if(ps_pps->u1_pic_order_present_flag)
  ------------------
  |  Branch (3325:12): [True: 0, False: 38]
  ------------------
 3326|      0|        {
 3327|      0|            i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3328|      0|        }
 3329|     38|    }
 3330|       |
 3331|       |    /*-----------------------------------------------------------------------*/
 3332|       |    /*---------------------- redundant pic cnt ------------------------------*/
 3333|       |    /*-----------------------------------------------------------------------*/
 3334|  1.68k|    if(ps_pps->u1_redundant_pic_cnt_present_flag)
  ------------------
  |  Branch (3334:8): [True: 1.38k, False: 298]
  ------------------
 3335|  1.38k|    {
 3336|  1.38k|        u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3337|  1.38k|        if(u4_temp > MAX_REDUNDANT_PIC_CNT) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  |  611|  1.38k|#define MAX_REDUNDANT_PIC_CNT       127
  ------------------
  |  Branch (3337:12): [True: 55, False: 1.33k]
  ------------------
 3338|  1.38k|    }
 3339|       |    /*-----------------------------------------------------------------------*/
 3340|       |    /*-----------------Direct_spatial_mv_pred_flag --------------------------*/
 3341|       |    /*-----------------num ref active override flag -------------------------*/
 3342|       |    /*-----------------num_ref_idx_active_l0&1 ------------------------------*/
 3343|       |    /*-----------------------------------------------------------------------*/
 3344|  1.63k|    if(0 == i4_quality_id)
  ------------------
  |  Branch (3344:8): [True: 1.63k, False: 0]
  ------------------
 3345|  1.63k|    {
 3346|  1.63k|        if(B_SLICE == ps_slice_prms->u1_slice_type)
  ------------------
  |  |  369|  1.63k|#define B_SLICE  1
  ------------------
  |  Branch (3346:12): [True: 171, False: 1.45k]
  ------------------
 3347|    171|        {
 3348|    171|            ps_slice_prms->u1_direct_spatial_mv_pred_flag = ih264d_get_bit_h264(ps_bitstrm);
 3349|    171|        }
 3350|       |
 3351|  1.63k|        if((P_SLICE == ps_slice_prms->u1_slice_type) || (B_SLICE == ps_slice_prms->u1_slice_type))
  ------------------
  |  |  368|  1.63k|#define P_SLICE  0
  ------------------
                      if((P_SLICE == ps_slice_prms->u1_slice_type) || (B_SLICE == ps_slice_prms->u1_slice_type))
  ------------------
  |  |  369|    230|#define B_SLICE  1
  ------------------
  |  Branch (3351:12): [True: 1.40k, False: 230]
  |  Branch (3351:57): [True: 171, False: 59]
  ------------------
 3352|  1.57k|        {
 3353|  1.57k|            WORD8 i1_over_ride_flag;
 3354|  1.57k|            i1_over_ride_flag = ih264d_get_bit_h264(ps_bitstrm);
 3355|       |
 3356|  1.57k|            ps_slice_prms->u1_num_ref_idx_active_override_flag = i1_over_ride_flag;
 3357|       |
 3358|  1.57k|            if(SVCD_TRUE == i1_over_ride_flag)
  ------------------
  |  |   46|  1.57k|#define SVCD_TRUE 1
  ------------------
  |  Branch (3358:16): [True: 1.02k, False: 544]
  ------------------
 3359|  1.02k|            {
 3360|  1.02k|                UWORD8 u8_ref_idx_l0;
 3361|  1.02k|                u8_ref_idx_l0 = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3362|  1.02k|                if(u8_ref_idx_l0 > H264_MAX_REF_PICS)
  ------------------
  |  |  534|  1.02k|#define H264_MAX_REF_PICS         16
  ------------------
  |  Branch (3362:20): [True: 29, False: 998]
  ------------------
 3363|     29|                {
 3364|     29|                    return ERROR_NUM_REF;
 3365|     29|                }
 3366|    998|                if(B_SLICE == ps_slice_prms->u1_slice_type)
  ------------------
  |  |  369|    998|#define B_SLICE  1
  ------------------
  |  Branch (3366:20): [True: 150, False: 848]
  ------------------
 3367|    150|                {
 3368|    150|                    UWORD8 u8_ref_idx_l1;
 3369|    150|                    u8_ref_idx_l1 = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3370|    150|                    if(u8_ref_idx_l1 > H264_MAX_REF_PICS)
  ------------------
  |  |  534|    150|#define H264_MAX_REF_PICS         16
  ------------------
  |  Branch (3370:24): [True: 0, False: 150]
  ------------------
 3371|      0|                    {
 3372|      0|                        return ERROR_NUM_REF;
 3373|      0|                    }
 3374|    150|                }
 3375|    998|            }
 3376|  1.57k|        }
 3377|       |
 3378|       |        /*-----------------------------------------------------------------------*/
 3379|       |        /*---------------------- ref pic list modification ----------------------*/
 3380|       |        /*-----------------------------------------------------------------------*/
 3381|  1.60k|        {
 3382|  1.60k|            ret = isvcd_parse_ref_pic_list_modify(ps_bitstrm, ps_slice_prms, ps_sps);
 3383|  1.60k|            if(OK != ret) return ret;
  ------------------
  |  |  114|  1.60k|#define OK        0
  ------------------
  |  Branch (3383:16): [True: 760, False: 841]
  ------------------
 3384|  1.60k|        }
 3385|       |
 3386|    841|        if(((1 == ps_pps->u1_wted_pred_flag) && (P_SLICE == ps_slice_prms->u1_slice_type)) ||
  ------------------
  |  |  368|    599|#define P_SLICE  0
  ------------------
  |  Branch (3386:13): [True: 599, False: 242]
  |  Branch (3386:49): [True: 520, False: 79]
  ------------------
 3387|    321|           ((B_SLICE == ps_slice_prms->u1_slice_type) && (1 == ps_pps->u1_wted_bipred_idc)))
  ------------------
  |  |  369|    321|#define B_SLICE  1
  ------------------
  |  Branch (3387:13): [True: 45, False: 276]
  |  Branch (3387:58): [True: 0, False: 45]
  ------------------
 3388|    520|        {
 3389|    520|            if((ps_slice_prms->u1_num_ref_idx_lx_active[0] >= H264_MAX_REF_IDX) ||
  ------------------
  |  |  535|    520|#define H264_MAX_REF_IDX          32
  ------------------
  |  Branch (3389:16): [True: 0, False: 520]
  ------------------
 3390|    520|               (ps_slice_prms->u1_num_ref_idx_lx_active[1] >= H264_MAX_REF_IDX))
  ------------------
  |  |  535|    520|#define H264_MAX_REF_IDX          32
  ------------------
  |  Branch (3390:16): [True: 0, False: 520]
  ------------------
 3391|      0|            {
 3392|      0|                return ERROR_NUM_REF;
 3393|      0|            }
 3394|       |            /*-------------------------------------------------------------------*/
 3395|       |            /*------------------------- Pred weight table -----------------------*/
 3396|       |            /*-------------------------------------------------------------------*/
 3397|    520|            if(CODED_SLICE_EXTENSION_NAL == i4_nal_unit_type)
  ------------------
  |  |   66|    520|#define CODED_SLICE_EXTENSION_NAL 20
  ------------------
  |  Branch (3397:16): [True: 513, False: 7]
  ------------------
 3398|    513|            {
 3399|    513|                WORD32 i4_base_pred_wt_tbl_flag = 1;
 3400|       |
 3401|       |                /* base_pred_weight_table_flag */
 3402|    513|                if(0 == i4_no_int_lyr_pred)
  ------------------
  |  Branch (3402:20): [True: 513, False: 0]
  ------------------
 3403|    513|                {
 3404|    513|                    i4_base_pred_wt_tbl_flag = ih264d_get_bit_h264(ps_bitstrm);
 3405|    513|                }
 3406|       |
 3407|    513|                if((1 == i4_no_int_lyr_pred) || (0 == i4_base_pred_wt_tbl_flag))
  ------------------
  |  Branch (3407:20): [True: 0, False: 513]
  |  Branch (3407:49): [True: 496, False: 17]
  ------------------
 3408|    496|                {
 3409|    496|                    ret = ih264d_parse_pred_weight_table(ps_slice_prms, ps_bitstrm);
 3410|    496|                    if(ret != OK) return ret;
  ------------------
  |  |  114|    496|#define OK        0
  ------------------
  |  Branch (3410:24): [True: 0, False: 496]
  ------------------
 3411|    496|                }
 3412|    513|            }
 3413|      7|            else
 3414|      7|            {
 3415|      7|                ret = ih264d_parse_pred_weight_table(ps_slice_prms, ps_bitstrm);
 3416|      7|                if(ret != OK) return ret;
  ------------------
  |  |  114|      7|#define OK        0
  ------------------
  |  Branch (3416:20): [True: 7, False: 0]
  ------------------
 3417|      7|            }
 3418|    520|        }
 3419|       |
 3420|       |        /*-----------------------------------------------------------------------*/
 3421|       |        /*------------------------- ref pic marking -----------------------------*/
 3422|       |        /*-----------------------------------------------------------------------*/
 3423|    834|        if(0 != i4_nal_ref_idc)
  ------------------
  |  Branch (3423:12): [True: 818, False: 16]
  ------------------
 3424|    818|        {
 3425|    818|            dec_struct_t *ps_dec;
 3426|    818|            svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 3427|    818|            UWORD8 u1_store_ref_base_pic;
 3428|    818|            ps_svc_lyr_dec = ps_svcd_ctxt->ps_svc_dec_lyr;
 3429|    818|            ps_dec = &ps_svc_lyr_dec->s_dec;
 3430|    818|            {
 3431|    818|                dec_seq_params_t *ps_sps_tmp = ps_pps->ps_sps;
 3432|       |
 3433|    818|                ps_dec->u1_nal_unit_type = i4_nal_unit_type;
 3434|    818|                ps_svc_lyr_dec->ps_nal_svc_ext->u1_idr_flag = i4_idr_pic_flag;
 3435|    818|                ps_dec->ps_cur_sps = ps_sps;
 3436|    818|                ps_dec->ps_cur_pps = ps_pps;
 3437|    818|                ps_pps->ps_sps = ps_sps;
 3438|       |
 3439|    818|                if(ps_svc_lyr_dec->ps_nal_svc_ext->u1_idr_flag)
  ------------------
  |  Branch (3439:20): [True: 808, False: 10]
  ------------------
 3440|    808|                    ps_dec->u1_nal_unit_type = IDR_SLICE_NAL;
  ------------------
  |  |  328|    808|#define IDR_SLICE_NAL                   5
  ------------------
 3441|       |
 3442|    818|                i_temp = ih264d_read_mmco_commands(ps_dec);
 3443|    818|                ps_pps->ps_sps = ps_sps_tmp;
 3444|    818|                ps_dec->u1_nal_unit_type = i4_nal_unit_type;
 3445|    818|                if(i_temp < 0)
  ------------------
  |  Branch (3445:20): [True: 1, False: 817]
  ------------------
 3446|      1|                {
 3447|      1|                    return ERROR_DBP_MANAGER_T;
 3448|      1|                }
 3449|    817|                ps_dec->u4_bitoffset = i_temp;
 3450|    817|            }
 3451|       |
 3452|    817|            if(0 == ps_subset_sps->s_sps_svc_ext.u1_slice_header_restriction_flag)
  ------------------
  |  Branch (3452:16): [True: 235, False: 582]
  ------------------
 3453|    235|            {
 3454|       |                /* store_ref_base_pic_flag */
 3455|    235|                u1_store_ref_base_pic = ih264d_get_bit_h264(ps_bitstrm);
 3456|    235|                if(0 != u1_store_ref_base_pic)
  ------------------
  |  Branch (3456:20): [True: 83, False: 152]
  ------------------
 3457|     83|                {
 3458|     83|                    return ERROR_INV_SLICE_HDR_T;
 3459|     83|                }
 3460|       |
 3461|    152|                if(((1 == i4_use_ref_base) || (1 == u1_store_ref_base_pic)) &&
  ------------------
  |  Branch (3461:21): [True: 0, False: 152]
  |  Branch (3461:47): [True: 0, False: 152]
  ------------------
 3462|      0|                   (SVCD_FALSE == i4_idr_pic_flag))
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
  |  Branch (3462:20): [True: 0, False: 0]
  ------------------
 3463|      0|                {
 3464|      0|                    i_temp = isvcd_dec_ref_base_pic_marking(
 3465|      0|                        &ps_svc_lyr_dec->s_svc_slice_params.s_ref_base_pic_marking_svc_ext,
 3466|      0|                        ps_bitstrm);
 3467|      0|                    if(i_temp != OK)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (3467:24): [True: 0, False: 0]
  ------------------
 3468|      0|                    {
 3469|      0|                        return i_temp;
 3470|      0|                    }
 3471|      0|                }
 3472|       |                /******* End of if (SVC_VCL_NAL == i4_nal_unit_type) *********/
 3473|    152|            }
 3474|       |            /******** End of if(0 != i4_nal_ref_idc) *************************/
 3475|    817|        }
 3476|       |        /************* End of if(0 == i4_quality_id) *************************/
 3477|    834|    }
 3478|       |
 3479|       |    /*-----------------------------------------------------------------------*/
 3480|       |    /*--------------------------- cabac int idc -----------------------------*/
 3481|       |    /*-----------------------------------------------------------------------*/
 3482|    750|    if((ps_pps->u1_entropy_coding_mode == CABAC) && (I_SLICE != ps_slice_prms->u1_slice_type))
  ------------------
  |  |  339|    750|#define CABAC  1
  ------------------
                  if((ps_pps->u1_entropy_coding_mode == CABAC) && (I_SLICE != ps_slice_prms->u1_slice_type))
  ------------------
  |  |  370|    585|#define I_SLICE  2
  ------------------
  |  Branch (3482:8): [True: 585, False: 165]
  |  Branch (3482:53): [True: 542, False: 43]
  ------------------
 3483|    542|    {
 3484|    542|        ps_slice_prms->u1_cabac_init_idc = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3485|    542|        if(ps_slice_prms->u1_cabac_init_idc > MAX_CABAC_INIT_IDC)
  ------------------
  |  |  537|    542|#define MAX_CABAC_INIT_IDC        2
  ------------------
  |  Branch (3485:12): [True: 492, False: 50]
  ------------------
 3486|    492|        {
 3487|    492|            return ERROR_INV_SLICE_HDR_T;
 3488|    492|        }
 3489|    542|    }
 3490|       |
 3491|       |    /*-----------------------------------------------------------------------*/
 3492|       |    /*--------------------------- slice qp delta ----------------------------*/
 3493|       |    /*-----------------------------------------------------------------------*/
 3494|    258|    {
 3495|    258|        WORD8 i1_slice_qp_delta;
 3496|    258|        i1_slice_qp_delta = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3497|    258|        i1_slice_qp_delta += ps_pps->u1_pic_init_qp;
 3498|    258|        if((i1_slice_qp_delta < MIN_H264_QP) || (i1_slice_qp_delta > MAX_H264_QP))
  ------------------
  |  |  629|    258|#define MIN_H264_QP 0
  ------------------
                      if((i1_slice_qp_delta < MIN_H264_QP) || (i1_slice_qp_delta > MAX_H264_QP))
  ------------------
  |  |  634|    252|#define MAX_H264_QP 51
  ------------------
  |  Branch (3498:12): [True: 6, False: 252]
  |  Branch (3498:49): [True: 8, False: 244]
  ------------------
 3499|     14|        {
 3500|     14|            return ERROR_INV_RANGE_QP_T;
 3501|     14|        }
 3502|    244|        ps_slice_prms->u1_slice_qp = (UWORD8) i1_slice_qp_delta;
 3503|    244|    }
 3504|       |
 3505|       |    /*-----------------------------------------------------------------------*/
 3506|       |    /*--------------------------- disable dblk filter idc -------------------*/
 3507|       |    /*-----------------------------------------------------------------------*/
 3508|       |    /* Set to default value */
 3509|       |
 3510|      0|    ps_slice_prms->u1_disable_dblk_filter_idc = 0;
 3511|    244|    if(SVCD_TRUE == ps_pps->u1_deblocking_filter_parameters_present_flag)
  ------------------
  |  |   46|    244|#define SVCD_TRUE 1
  ------------------
  |  Branch (3511:8): [True: 94, False: 150]
  ------------------
 3512|     94|    {
 3513|     94|        ps_slice_prms->u1_disable_dblk_filter_idc = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3514|       |
 3515|     94|        if(ps_slice_prms->u1_disable_dblk_filter_idc > SLICE_BOUNDARY_DBLK_DISABLED)
  ------------------
  |  |  547|     94|#define SLICE_BOUNDARY_DBLK_DISABLED  2
  ------------------
  |  Branch (3515:12): [True: 33, False: 61]
  ------------------
 3516|     33|        {
 3517|     33|            return ERROR_INV_SLICE_HDR_T;
 3518|     33|        }
 3519|       |        /*-------------------------------------------------------------------*/
 3520|       |        /*--------------------------- slice_alpha_c0_offset_div2 ------------*/
 3521|       |        /*--------------------------- slice_beta_offset_div2 ----------------*/
 3522|       |        /*-------------------------------------------------------------------*/
 3523|     61|        if(1 != ps_slice_prms->u1_disable_dblk_filter_idc)
  ------------------
  |  Branch (3523:12): [True: 59, False: 2]
  ------------------
 3524|     59|        {
 3525|       |            /* slice_alpha_c0_offset_div2 */
 3526|     59|            ps_slice_prms->i1_slice_alpha_c0_offset = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3527|     59|            if((MIN_DBLK_FIL_OFF > ps_slice_prms->i1_slice_alpha_c0_offset) ||
  ------------------
  |  |  550|     59|#define MIN_DBLK_FIL_OFF              -12
  ------------------
  |  Branch (3527:16): [True: 2, False: 57]
  ------------------
 3528|     57|               (ps_slice_prms->i1_slice_alpha_c0_offset > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  551|     57|#define MAX_DBLK_FIL_OFF              12
  ------------------
  |  Branch (3528:16): [True: 0, False: 57]
  ------------------
 3529|      2|            {
 3530|      2|                return ERROR_INV_SLICE_HDR_T;
 3531|      2|            }
 3532|     57|            ps_slice_prms->i1_slice_beta_offset = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3533|     57|            if((MIN_DBLK_FIL_OFF > ps_slice_prms->i1_slice_beta_offset) ||
  ------------------
  |  |  550|     57|#define MIN_DBLK_FIL_OFF              -12
  ------------------
  |  Branch (3533:16): [True: 0, False: 57]
  ------------------
 3534|     57|               (ps_slice_prms->i1_slice_beta_offset > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  551|     57|#define MAX_DBLK_FIL_OFF              12
  ------------------
  |  Branch (3534:16): [True: 0, False: 57]
  ------------------
 3535|      0|            {
 3536|      0|                return ERROR_INV_SLICE_HDR_T;
 3537|      0|            }
 3538|     57|        }
 3539|     61|    }
 3540|       |
 3541|    209|    *pi4_ref_dq_id = -1;
 3542|       |
 3543|    209|    if((0 == i4_no_int_lyr_pred) && (0 == i4_quality_id))
  ------------------
  |  Branch (3543:8): [True: 157, False: 52]
  |  Branch (3543:37): [True: 157, False: 0]
  ------------------
 3544|    157|    {
 3545|    157|        WORD32 i4_inter_lyr_dblk_idc;
 3546|    157|        WORD32 i4_inter_lyr_alpha_c0_offset;
 3547|    157|        WORD32 i4_inter_lyr_beta_offset;
 3548|       |
 3549|       |        /*-------------------------------------------------------------------*/
 3550|       |        /*--------------------------- ref_layer_dq_id -----------------------*/
 3551|       |        /*-------------------------------------------------------------------*/
 3552|    157|        *pi4_ref_dq_id = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3553|       |
 3554|    157|        if(*pi4_ref_dq_id > MAX_REF_DEP_ID)
  ------------------
  |  |  106|    157|#define MAX_REF_DEP_ID ((MAX_DEPENDENCY_ID << 4) | MAX_QUALITY_ID)
  |  |  ------------------
  |  |  |  |  103|    157|#define MAX_DEPENDENCY_ID 4
  |  |  ------------------
  |  |               #define MAX_REF_DEP_ID ((MAX_DEPENDENCY_ID << 4) | MAX_QUALITY_ID)
  |  |  ------------------
  |  |  |  |  102|    157|#define MAX_QUALITY_ID 0
  |  |  ------------------
  ------------------
  |  Branch (3554:12): [True: 10, False: 147]
  ------------------
 3555|     10|        {
 3556|     10|            return ERROR_INV_SLICE_HDR_T;
 3557|     10|        }
 3558|       |        /* ------------------------------------------- */
 3559|       |        /* ---- Inter layer de-blocking parameters ---- */
 3560|       |        /* ------------------------------------------- */
 3561|    147|        i4_inter_lyr_dblk_idc = 0;
 3562|    147|        i4_inter_lyr_alpha_c0_offset = 0;
 3563|    147|        i4_inter_lyr_beta_offset = 0;
 3564|    147|        if(SVCD_TRUE ==
  ------------------
  |  |   46|    147|#define SVCD_TRUE 1
  ------------------
  |  Branch (3564:12): [True: 52, False: 95]
  ------------------
 3565|    147|           ps_subset_sps->s_sps_svc_ext.u1_inter_layer_deblocking_filter_control_present_flag)
 3566|     52|        {
 3567|     52|            i4_inter_lyr_dblk_idc = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3568|       |
 3569|     52|            if(i4_inter_lyr_dblk_idc > 6)
  ------------------
  |  Branch (3569:16): [True: 0, False: 52]
  ------------------
 3570|      0|            {
 3571|      0|                return ERROR_INV_SLICE_HDR_T;
 3572|      0|            }
 3573|     52|            if(1 != i4_inter_lyr_dblk_idc)
  ------------------
  |  Branch (3573:16): [True: 31, False: 21]
  ------------------
 3574|     31|            {
 3575|       |                /* Alpha Offset */
 3576|     31|                i4_inter_lyr_alpha_c0_offset = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3577|     31|                if(i4_inter_lyr_alpha_c0_offset > 6 || i4_inter_lyr_alpha_c0_offset < -6)
  ------------------
  |  Branch (3577:20): [True: 0, False: 31]
  |  Branch (3577:56): [True: 0, False: 31]
  ------------------
 3578|      0|                {
 3579|      0|                    return ERROR_INV_SLICE_HDR_T;
 3580|      0|                }
 3581|     31|                i4_inter_lyr_alpha_c0_offset <<= 1;
 3582|       |
 3583|       |                /* Beta Offset */
 3584|     31|                i4_inter_lyr_beta_offset = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3585|     31|                if(i4_inter_lyr_beta_offset > 6 || i4_inter_lyr_beta_offset < -6)
  ------------------
  |  Branch (3585:20): [True: 1, False: 30]
  |  Branch (3585:52): [True: 0, False: 30]
  ------------------
 3586|      1|                {
 3587|      1|                    return ERROR_INV_SLICE_HDR_T;
 3588|      1|                }
 3589|     30|                i4_inter_lyr_beta_offset <<= 1;
 3590|     30|            }
 3591|     52|        }
 3592|    146|        ps_vcl_node->i4_inter_lyr_dblk_idc = i4_inter_lyr_dblk_idc;
 3593|    146|        ps_vcl_node->i4_inter_lyr_beta_offset = i4_inter_lyr_beta_offset;
 3594|    146|        ps_vcl_node->i4_inter_lyr_alpha_c0_offset = i4_inter_lyr_alpha_c0_offset;
 3595|    146|    }
 3596|       |
 3597|    198|    return (0);
 3598|    209|}
isvcd_get_ref_lyr_dqid:
 3631|  3.97k|{
 3632|  3.97k|    WORD32 i4_status;
 3633|  3.97k|    WORD32 ai4_ref_dq_id[2] = {0};
 3634|  3.97k|    WORD32 i4_num_slc_dec;
 3635|       |
 3636|       |    /* local structures */
 3637|  3.97k|    dec_slice_params_t s_slice_prms = {0};
 3638|       |
 3639|       |    /* vcl buffer */
 3640|  3.97k|    vcl_buf_hdr_t *ps_vcl_buf;
 3641|  3.97k|    dec_struct_t *ps_dec;
 3642|  3.97k|    svc_dec_lyr_struct_t *ps_svc_lyr_dec = ps_svcd_ctxt->ps_svc_dec_lyr;
 3643|  3.97k|    UNUSED(i4_prev_au_dqid);
  ------------------
  |  |   45|  3.97k|#define UNUSED(x) ((void)(x))
  ------------------
 3644|  3.97k|    ps_dec = &ps_svc_lyr_dec->s_dec;
 3645|       |    /* Sanity checks */
 3646|  3.97k|    if((NULL == ps_vcl_node) || (NULL == ps_sps) || (NULL == ps_pps) || (NULL == pi4_ref_lyr_dqid))
  ------------------
  |  Branch (3646:8): [True: 0, False: 3.97k]
  |  Branch (3646:33): [True: 0, False: 3.97k]
  |  Branch (3646:53): [True: 0, False: 3.97k]
  |  Branch (3646:73): [True: 0, False: 3.97k]
  ------------------
 3647|      0|    {
 3648|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 3649|      0|    }
 3650|       |
 3651|  3.97k|    i4_num_slc_dec = 0;
 3652|  3.97k|    ps_vcl_buf = ps_vcl_node->ps_first_vcl_nal;
 3653|  3.97k|    i4_status = NOT_OK;
  ------------------
  |  |  116|  3.97k|#define NOT_OK    -1
  ------------------
 3654|       |
 3655|  3.97k|    while(NULL != ps_vcl_buf)
  ------------------
  |  Branch (3655:11): [True: 2.22k, False: 1.74k]
  ------------------
 3656|  2.22k|    {
 3657|  2.22k|        WORD32 i4_error;
 3658|       |
 3659|       |        /* Fill the stream context structure */
 3660|  2.22k|        ps_dec->ps_bitstrm->u4_ofst = 0;
 3661|  2.22k|        ps_dec->ps_bitstrm->pu4_buffer =
 3662|  2.22k|            (UWORD32 *) ((UWORD8 *) ps_vcl_buf + ps_vcl_buf->i4_buf_offset +
 3663|  2.22k|                         ps_vcl_buf->i4_slice_offset);
 3664|  2.22k|        ps_dec->ps_bitstrm->u4_max_ofst = ps_vcl_buf->u4_max_bits;
 3665|       |
 3666|       |        /* call the function which decodes the slice header */
 3667|  2.22k|        i4_error = isvcd_parse_slice_hdr_refdq_id(ps_vcl_node, &s_slice_prms, ps_dec->ps_bitstrm,
 3668|  2.22k|                                                  &ai4_ref_dq_id[i4_num_slc_dec], ps_sps, ps_pps,
 3669|  2.22k|                                                  ps_vcl_buf->i4_no_int_lyr_pred, ps_svcd_ctxt);
 3670|       |
 3671|       |        /* store the first error encountered */
 3672|  2.22k|        if(0 == *pi4_err_code)
  ------------------
  |  Branch (3672:12): [True: 75, False: 2.14k]
  ------------------
 3673|     75|        {
 3674|     75|            *pi4_err_code = i4_error;
 3675|     75|        }
 3676|  2.22k|        if(i4_error != 0)
  ------------------
  |  Branch (3676:12): [True: 2.02k, False: 198]
  ------------------
 3677|  2.02k|        {
 3678|       |            /* check on the Error returned */
 3679|  2.02k|            return NOT_OK;
  ------------------
  |  |  116|  2.02k|#define NOT_OK    -1
  ------------------
 3680|  2.02k|        }
 3681|       |
 3682|       |        /* set the return status */
 3683|    198|        i4_status = OK;
  ------------------
  |  |  114|    198|#define OK        0
  ------------------
 3684|    198|        break;
 3685|       |
 3686|       |        /* go to the next slice header */
 3687|      0|        ps_vcl_buf = ps_vcl_buf->ps_next;
 3688|      0|    }
 3689|       |
 3690|       |    /* set the appropriate reference dqid of the first slice */
 3691|  1.94k|    *pi4_ref_lyr_dqid = ai4_ref_dq_id[0];
 3692|       |
 3693|  1.94k|    return (i4_status);
 3694|  3.97k|}
isvcd_conceal_node_params:
 3719|  3.83k|{
 3720|  3.83k|    vcl_node_t *ps_node;
 3721|  3.83k|    WORD32 i4_conceal_lyrs;
 3722|  3.83k|    WORD32 i4_no_gaps_flag;
 3723|       |
 3724|       |    /* get the bottom node */
 3725|  3.83k|    ps_node = ps_vcl_nal->ps_bot_node;
 3726|  3.83k|    i4_conceal_lyrs = SVCD_FALSE;
  ------------------
  |  |   45|  3.83k|#define SVCD_FALSE 0
  ------------------
 3727|  3.83k|    i4_no_gaps_flag = SVCD_FALSE;
  ------------------
  |  |   45|  3.83k|#define SVCD_FALSE 0
  ------------------
 3728|       |
 3729|       |    /* loop over all nodes present in the current AU */
 3730|  11.5k|    while(NULL != ps_node)
  ------------------
  |  Branch (3730:11): [True: 7.67k, False: 3.83k]
  ------------------
 3731|  7.67k|    {
 3732|  7.67k|        WORD32 i4_dep_id = 0;
 3733|  7.67k|        WORD32 i4_qua_id = 0;
 3734|  7.67k|        UWORD16 u2_frm_num_dep = 0;
 3735|  7.67k|        WORD32 i4_idr_pic_flag = 0;
 3736|  7.67k|        WORD32 i4_idr_pic_num = 0;
 3737|  7.67k|        WORD32 i4_nal_ref_idc = 0;
 3738|  7.67k|        WORD32 i4_poc_syntax = 0;
 3739|  7.67k|        WORD32 i4_qua_zero_lyr_sts = 0;
 3740|       |
 3741|  7.67k|        i4_dep_id = ps_node->i4_dependency_id;
 3742|  7.67k|        i4_qua_id = ps_node->i4_quality_id;
 3743|       |
 3744|       |        /* reset the quality 0 layer updated status */
 3745|  7.67k|        if(0 == i4_qua_id)
  ------------------
  |  Branch (3745:12): [True: 7.67k, False: 0]
  ------------------
 3746|  7.67k|        {
 3747|  7.67k|            i4_qua_zero_lyr_sts = SVCD_FALSE;
  ------------------
  |  |   45|  7.67k|#define SVCD_FALSE 0
  ------------------
 3748|  7.67k|        }
 3749|       |
 3750|       |        /* process the quality id 0 layers */
 3751|  7.67k|        if((0 == i4_qua_id) && (NULL != ps_node->ps_first_vcl_nal))
  ------------------
  |  Branch (3751:12): [True: 7.67k, False: 0]
  |  Branch (3751:32): [True: 5.74k, False: 1.92k]
  ------------------
 3752|  5.74k|        {
 3753|       |            /* if current and previous are reference pictures */
 3754|  5.74k|            if((0 != ps_prev_au_prms[i4_dep_id].i4_nal_ref_id) && (0 != ps_node->i4_nal_ref_idc))
  ------------------
  |  Branch (3754:16): [True: 4.99k, False: 748]
  |  Branch (3754:67): [True: 4.56k, False: 430]
  ------------------
 3755|  4.56k|            {
 3756|  4.56k|                if(ps_prev_au_prms[i4_dep_id].u2_frm_num == ps_node->u2_frm_num)
  ------------------
  |  Branch (3756:20): [True: 1.75k, False: 2.80k]
  ------------------
 3757|  1.75k|                {
 3758|       |                    /* frame number is concealed */
 3759|  1.75k|                    ps_node->u2_frm_num++;
 3760|  1.75k|                    i4_conceal_lyrs = SVCD_TRUE;
  ------------------
  |  |   46|  1.75k|#define SVCD_TRUE 1
  ------------------
 3761|  1.75k|                }
 3762|  2.80k|                else if((SVCD_TRUE == i4_conceal_lyrs) || (SVCD_TRUE == i4_no_gaps_flag))
  ------------------
  |  |   46|  2.80k|#define SVCD_TRUE 1
  ------------------
                              else if((SVCD_TRUE == i4_conceal_lyrs) || (SVCD_TRUE == i4_no_gaps_flag))
  ------------------
  |  |   46|  1.93k|#define SVCD_TRUE 1
  ------------------
  |  Branch (3762:25): [True: 875, False: 1.93k]
  |  Branch (3762:59): [True: 78, False: 1.85k]
  ------------------
 3763|    953|                {
 3764|       |                    /* if the current au frm_num is less than prev */
 3765|       |                    /* or the difference is greater than 1         */
 3766|    953|                    if((ps_prev_au_prms[i4_dep_id].u2_frm_num > ps_node->u2_frm_num) ||
  ------------------
  |  Branch (3766:24): [True: 0, False: 953]
  ------------------
 3767|    953|                       ((ps_node->u2_frm_num - ps_prev_au_prms[i4_dep_id].u2_frm_num) > 1))
  ------------------
  |  Branch (3767:24): [True: 953, False: 0]
  ------------------
 3768|    953|                    {
 3769|       |                        /* frame number is concealed */
 3770|    953|                        ps_node->u2_frm_num = ps_prev_au_prms[i4_dep_id].u2_frm_num + 1;
 3771|    953|                    }
 3772|    953|                }
 3773|       |
 3774|       |                /* set the no gaps flag */
 3775|  4.56k|                if(1 == (ps_node->u2_frm_num - ps_prev_au_prms[i4_dep_id].u2_frm_num))
  ------------------
  |  Branch (3775:20): [True: 2.90k, False: 1.65k]
  ------------------
 3776|  2.90k|                {
 3777|  2.90k|                    i4_no_gaps_flag = SVCD_TRUE;
  ------------------
  |  |   46|  2.90k|#define SVCD_TRUE 1
  ------------------
 3778|  2.90k|                }
 3779|  4.56k|            }
 3780|       |
 3781|       |            /* store the final frame number */
 3782|  5.74k|            u2_frm_num_dep = ps_node->u2_frm_num;
 3783|  5.74k|            i4_idr_pic_flag = ps_node->i4_idr_pic_flag;
 3784|  5.74k|            i4_idr_pic_num = ps_node->i4_idr_pic_num;
 3785|  5.74k|            i4_nal_ref_idc = ps_node->i4_nal_ref_idc;
 3786|  5.74k|            i4_poc_syntax = ps_node->i4_poc_syntax;
 3787|  5.74k|            i4_qua_zero_lyr_sts = SVCD_TRUE;
  ------------------
  |  |   46|  5.74k|#define SVCD_TRUE 1
  ------------------
 3788|  5.74k|        }
 3789|  1.92k|        else
 3790|  1.92k|        {
 3791|  1.92k|            if(SVCD_TRUE == i4_qua_zero_lyr_sts)
  ------------------
  |  |   46|  1.92k|#define SVCD_TRUE 1
  ------------------
  |  Branch (3791:16): [True: 0, False: 1.92k]
  ------------------
 3792|      0|            {
 3793|       |                /* for higher quality layers store the same value */
 3794|       |                /* present in the quality id 0 layer              */
 3795|      0|                ps_node->u2_frm_num = u2_frm_num_dep;
 3796|      0|                ps_node->i4_idr_pic_flag = i4_idr_pic_flag;
 3797|      0|                ps_node->i4_idr_pic_num = i4_idr_pic_num;
 3798|      0|                ps_node->i4_nal_ref_idc = i4_nal_ref_idc;
 3799|      0|                ps_node->i4_poc_syntax = i4_poc_syntax;
 3800|      0|            }
 3801|  1.92k|        }
 3802|       |
 3803|       |        /* get the upper node pointer */
 3804|  7.67k|        ps_node = ps_node->ps_top_node;
 3805|  7.67k|    }
 3806|  3.83k|}
isvcd_refine_dep_list:
 3840|  5.97k|{
 3841|  5.97k|    vcl_nal_t *ps_vcl_nal;
 3842|  5.97k|    vcl_node_t *ps_vcl_node;
 3843|  5.97k|    WORD32 i4_idr_pic_flag;
 3844|  5.97k|    WORD32 i4_nal_ref_idc;
 3845|  5.97k|    WORD32 i4_idr_pic_num;
 3846|  5.97k|    WORD32 i4_num_res_lyrs_bup;
 3847|  5.97k|    WORD32 i4_restore_prms_flag;
 3848|  5.97k|    vcl_node_t *ps_node_bup;
 3849|  5.97k|    WORD32 ai4_dep_id[MAX_NUM_RES_LYRS] = {0};
 3850|       |
 3851|       |    /* used for checking the init prms */
 3852|  5.97k|    dec_seq_params_t *ps_sps_tgt_minus1_lyr = NULL;
 3853|  5.97k|    dec_seq_params_t *ps_sps_tgt_minus2_lyr = NULL;
 3854|  5.97k|    UNUSED(pi4_err_code);
  ------------------
  |  |   45|  5.97k|#define UNUSED(x) ((void)(x))
  ------------------
 3855|       |    /* sanity checks */
 3856|  5.97k|    if((NULL == pv_out_vcl_ctxt) || (NULL == ps_sps) || (NULL == ps_pps))
  ------------------
  |  Branch (3856:8): [True: 0, False: 5.97k]
  |  Branch (3856:37): [True: 0, False: 5.97k]
  |  Branch (3856:57): [True: 0, False: 5.97k]
  ------------------
 3857|      0|    {
 3858|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 3859|      0|    }
 3860|       |
 3861|  5.97k|    ps_vcl_nal = (vcl_nal_t *) pv_out_vcl_ctxt;
 3862|       |
 3863|       |    /*  no node is present */
 3864|  5.97k|    if(NULL == ps_vcl_nal->ps_bot_node)
  ------------------
  |  Branch (3864:8): [True: 0, False: 5.97k]
  ------------------
 3865|      0|    {
 3866|      0|        return (NOT_OK);
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 3867|      0|    }
 3868|       |
 3869|       |    /* set the single layer flag if top node and bottom node are same */
 3870|  5.97k|    if((ps_vcl_nal->ps_bot_node == ps_vcl_nal->ps_top_node) &&
  ------------------
  |  Branch (3870:8): [True: 2.13k, False: 3.83k]
  ------------------
 3871|  2.13k|       (0 == ps_vcl_nal->ps_bot_node->i4_dependency_id))
  ------------------
  |  Branch (3871:8): [True: 2.13k, False: 0]
  ------------------
 3872|  2.13k|    {
 3873|  2.13k|    }
 3874|  3.83k|    else
 3875|  3.83k|    {
 3876|       |        /* call the function which corrects the frame number of each node */
 3877|       |        /* based on previous access unit frame number                     */
 3878|  3.83k|        isvcd_conceal_node_params(ps_vcl_nal, ps_prev_au_prms);
 3879|  3.83k|    }
 3880|       |    /* get the top most node */
 3881|  5.97k|    ps_vcl_node = ps_vcl_nal->ps_top_node;
 3882|       |
 3883|       |    /* get the IDR picture flag for top most layer in current AU */
 3884|       |    /* if not valid then set the value present in the first valid node */
 3885|  5.97k|    {
 3886|  5.97k|        vcl_node_t *ps_node;
 3887|  5.97k|        WORD32 i4_node_present_flag;
 3888|       |
 3889|  5.97k|        ps_node = ps_vcl_node;
 3890|  5.97k|        i4_node_present_flag = SVCD_FALSE;
  ------------------
  |  |   45|  5.97k|#define SVCD_FALSE 0
  ------------------
 3891|       |
 3892|       |        /* store default values */
 3893|  5.97k|        i4_idr_pic_flag = SVCD_FALSE;
  ------------------
  |  |   45|  5.97k|#define SVCD_FALSE 0
  ------------------
 3894|  5.97k|        i4_nal_ref_idc = 0;
 3895|  5.97k|        i4_idr_pic_num = 0;
 3896|       |
 3897|       |        /* loop until valid node */
 3898|  6.00k|        while(NULL != ps_node)
  ------------------
  |  Branch (3898:15): [True: 5.99k, False: 13]
  ------------------
 3899|  5.99k|        {
 3900|  5.99k|            if(NULL != ps_node->ps_first_vcl_nal)
  ------------------
  |  Branch (3900:16): [True: 4.23k, False: 1.76k]
  ------------------
 3901|  4.23k|            {
 3902|  4.23k|                i4_idr_pic_flag = ps_node->i4_idr_pic_flag;
 3903|  4.23k|                i4_nal_ref_idc = ps_node->i4_nal_ref_idc;
 3904|  4.23k|                i4_idr_pic_num = ps_node->i4_idr_pic_num;
 3905|  4.23k|                i4_node_present_flag = SVCD_TRUE;
  ------------------
  |  |   46|  4.23k|#define SVCD_TRUE 1
  ------------------
 3906|  4.23k|                break;
 3907|  4.23k|            }
 3908|  1.76k|            else if(SVCD_TRUE == ps_node->i4_idr_pic_flag)
  ------------------
  |  |   46|  1.76k|#define SVCD_TRUE 1
  ------------------
  |  Branch (3908:21): [True: 1.72k, False: 39]
  ------------------
 3909|  1.72k|            {
 3910|  1.72k|                i4_idr_pic_flag = ps_node->i4_idr_pic_flag;
 3911|  1.72k|                i4_nal_ref_idc = ps_node->i4_nal_ref_idc;
 3912|  1.72k|                i4_idr_pic_num = ps_node->i4_idr_pic_num;
 3913|  1.72k|                i4_node_present_flag = SVCD_TRUE;
  ------------------
  |  |   46|  1.72k|#define SVCD_TRUE 1
  ------------------
 3914|  1.72k|                break;
 3915|  1.72k|            }
 3916|       |            /* point to next node */
 3917|     39|            ps_node = ps_node->ps_bot_node;
 3918|     39|        }
 3919|       |
 3920|       |        /* alteast one node should be present */
 3921|  5.97k|        if(SVCD_FALSE == i4_node_present_flag)
  ------------------
  |  |   45|  5.97k|#define SVCD_FALSE 0
  ------------------
  |  Branch (3921:12): [True: 13, False: 5.95k]
  ------------------
 3922|     13|        {
 3923|     13|            return (NOT_OK);
  ------------------
  |  |  116|     13|#define NOT_OK    -1
  ------------------
 3924|     13|        }
 3925|  5.97k|    }
 3926|       |
 3927|       |    /* initially the access unit is considered to have a single resolution */
 3928|  5.95k|    ai4_dep_id[0] = 0;
 3929|  5.95k|    ps_vcl_nal->i4_num_res_lyrs = 1;
 3930|  5.95k|    i4_restore_prms_flag = SVCD_FALSE;
  ------------------
  |  |   45|  5.95k|#define SVCD_FALSE 0
  ------------------
 3931|       |
 3932|       |    /*-----------------------------------------------------------------------*/
 3933|       |    /* loop until all the nodes are processed                                */
 3934|       |    /*-----------------------------------------------------------------------*/
 3935|  15.6k|    while(NULL != ps_vcl_node)
  ------------------
  |  Branch (3935:11): [True: 9.74k, False: 5.91k]
  ------------------
 3936|  9.74k|    {
 3937|  9.74k|        WORD32 i4_ref_lyr_dqid, i4_status;
 3938|  9.74k|        vcl_node_t *ps_bot_vcl_node;
 3939|  9.74k|        WORD32 i4_res_chnge_flag = SVCD_FALSE;
  ------------------
  |  |   45|  9.74k|#define SVCD_FALSE 0
  ------------------
 3940|  9.74k|        WORD32 i4_dep_id, i4_qua_id;
 3941|  9.74k|        WORD32 i4_prev_sps_pps_valid;
 3942|  9.74k|        WORD32 i4_prev_au_prms_valid;
 3943|       |
 3944|       |        /* set the reference layer DQID to -1 */
 3945|  9.74k|        i4_ref_lyr_dqid = -1;
 3946|       |
 3947|       |        /* get the current layer dependency and quality id */
 3948|  9.74k|        i4_dep_id = ps_vcl_node->i4_dependency_id;
 3949|  9.74k|        i4_qua_id = ps_vcl_node->i4_quality_id;
 3950|       |
 3951|       |        /* get the valid status of prev access unit params */
 3952|  9.74k|        i4_prev_au_prms_valid = ps_prev_au_prms[i4_dep_id].i4_updated_sts;
 3953|  9.74k|        i4_prev_sps_pps_valid = ps_pps_sps_prev[(i4_dep_id << 4) + i4_qua_id].i4_updated_sts;
 3954|       |
 3955|       |        /* missing layer handling */
 3956|  9.74k|        if(NULL == ps_vcl_node->ps_first_vcl_nal)
  ------------------
  |  Branch (3956:12): [True: 1.89k, False: 7.85k]
  ------------------
 3957|  1.89k|        {
 3958|       |            /* store the params appropriately */
 3959|  1.89k|            ps_vcl_node->i4_idr_pic_flag = i4_idr_pic_flag;
 3960|  1.89k|            ps_vcl_node->i4_nal_ref_idc = i4_nal_ref_idc;
 3961|  1.89k|            ps_vcl_node->i4_idr_pic_num = i4_idr_pic_num;
 3962|  1.89k|            ps_vcl_node->i4_num_slices = 0;
 3963|  1.89k|            ps_vcl_node->i4_use_ref_base = 0;
 3964|  1.89k|            ps_vcl_node->i4_temporal_id = 0;
 3965|       |
 3966|  1.89k|            if((0 != i4_dep_id) || (0 != i4_qua_id))
  ------------------
  |  Branch (3966:16): [True: 1.74k, False: 144]
  |  Branch (3966:36): [True: 0, False: 144]
  ------------------
 3967|  1.74k|            {
 3968|  1.74k|                ps_vcl_node->i4_nal_unit_type = CODED_SLICE_EXTENSION_NAL;
  ------------------
  |  |   66|  1.74k|#define CODED_SLICE_EXTENSION_NAL 20
  ------------------
 3969|  1.74k|                ps_vcl_node->u1_acc_no_int_pred = 0;
 3970|  1.74k|            }
 3971|    144|            else if(SVCD_TRUE == i4_idr_pic_flag)
  ------------------
  |  |   46|    144|#define SVCD_TRUE 1
  ------------------
  |  Branch (3971:21): [True: 136, False: 8]
  ------------------
 3972|    136|            {
 3973|    136|                ps_vcl_node->i4_nal_unit_type = IDR_SLICE_NAL;
  ------------------
  |  |  328|    136|#define IDR_SLICE_NAL                   5
  ------------------
 3974|    136|                ps_vcl_node->u1_acc_no_int_pred = 1;
 3975|    136|            }
 3976|      8|            else
 3977|      8|            {
 3978|      8|                ps_vcl_node->i4_nal_unit_type = SLICE_NAL;
  ------------------
  |  |  324|      8|#define SLICE_NAL                       1
  ------------------
 3979|      8|                ps_vcl_node->u1_acc_no_int_pred = 1;
 3980|      8|            }
 3981|       |
 3982|  1.89k|            if(SVCD_FALSE == i4_idr_pic_flag)
  ------------------
  |  |   45|  1.89k|#define SVCD_FALSE 0
  ------------------
  |  Branch (3982:16): [True: 25, False: 1.86k]
  ------------------
 3983|     25|            {
 3984|       |                /* pick the other params form previous access unit */
 3985|     25|                if(SVCD_TRUE == i4_prev_sps_pps_valid)
  ------------------
  |  |   46|     25|#define SVCD_TRUE 1
  ------------------
  |  Branch (3985:20): [True: 25, False: 0]
  ------------------
 3986|     25|                {
 3987|     25|                    ps_vcl_node->u1_pps_id =
 3988|     25|                        ps_pps_sps_prev[(i4_dep_id << 4) + i4_qua_id].u1_pps_id;
 3989|       |
 3990|     25|                    ps_vcl_node->u1_sps_id =
 3991|     25|                        ps_pps_sps_prev[(i4_dep_id << 4) + i4_qua_id].u1_sps_id;
 3992|     25|                }
 3993|       |
 3994|     25|                if(SVCD_TRUE == i4_prev_au_prms_valid)
  ------------------
  |  |   46|     25|#define SVCD_TRUE 1
  ------------------
  |  Branch (3994:20): [True: 25, False: 0]
  ------------------
 3995|     25|                {
 3996|     25|                    if(0 == ps_vcl_node->i4_nal_ref_idc)
  ------------------
  |  Branch (3996:24): [True: 15, False: 10]
  ------------------
 3997|     15|                    {
 3998|     15|                        ps_vcl_node->u2_frm_num = ps_prev_au_prms[i4_dep_id].u2_frm_num;
 3999|     15|                    }
 4000|     10|                    else
 4001|     10|                    {
 4002|     10|                        ps_vcl_node->u2_frm_num = ps_prev_au_prms[i4_dep_id].u2_frm_num + 1;
 4003|     10|                    }
 4004|     25|                }
 4005|     25|            }
 4006|  1.89k|        }
 4007|       |
 4008|       |        /* SPS id cannot change unless its an IDR pic */
 4009|  9.74k|        if(SVCD_FALSE == ps_vcl_node->i4_idr_pic_flag)
  ------------------
  |  |   45|  9.74k|#define SVCD_FALSE 0
  ------------------
  |  Branch (4009:12): [True: 1.40k, False: 8.33k]
  ------------------
 4010|  1.40k|        {
 4011|  1.40k|            if(SVCD_TRUE == i4_prev_sps_pps_valid)
  ------------------
  |  |   46|  1.40k|#define SVCD_TRUE 1
  ------------------
  |  Branch (4011:16): [True: 1.40k, False: 3]
  ------------------
 4012|  1.40k|            {
 4013|       |                /* store the SPS id of the current layer */
 4014|  1.40k|                ps_vcl_node->u1_sps_id = ps_pps_sps_prev[(i4_dep_id << 4) + i4_qua_id].u1_sps_id;
 4015|  1.40k|            }
 4016|  1.40k|        }
 4017|       |
 4018|       |        /* store the PPS id and SPS id of the current layer */
 4019|  9.74k|        ps_pps_sps_prev[(i4_dep_id << 4) + i4_qua_id].u1_pps_id = ps_vcl_node->u1_pps_id;
 4020|  9.74k|        ps_pps_sps_prev[(i4_dep_id << 4) + i4_qua_id].u1_sps_id = ps_vcl_node->u1_sps_id;
 4021|  9.74k|        ps_pps_sps_prev[(i4_dep_id << 4) + i4_qua_id].i4_updated_sts = SVCD_TRUE;
  ------------------
  |  |   46|  9.74k|#define SVCD_TRUE 1
  ------------------
 4022|       |
 4023|       |        /* handling of no_inter_layer_pred_flag 1 cases */
 4024|  9.74k|        if((1 == ps_vcl_node->u1_acc_no_int_pred) && (NULL != ps_vcl_node->ps_bot_node))
  ------------------
  |  Branch (4024:12): [True: 5.77k, False: 3.97k]
  |  Branch (4024:54): [True: 46, False: 5.72k]
  ------------------
 4025|     46|        {
 4026|     46|            if(SVCD_TRUE == i4_idr_pic_flag)
  ------------------
  |  |   46|     46|#define SVCD_TRUE 1
  ------------------
  |  Branch (4026:16): [True: 4, False: 42]
  ------------------
 4027|      4|            {
 4028|       |                /* take a back up of the parameters till the current node. */
 4029|       |                /* these parameters will be restored at the end of loop */
 4030|       |
 4031|      4|                if(SVCD_FALSE == i4_restore_prms_flag)
  ------------------
  |  |   45|      4|#define SVCD_FALSE 0
  ------------------
  |  Branch (4031:20): [True: 4, False: 0]
  ------------------
 4032|      4|                {
 4033|       |                    /* get the number of resolution detected so far */
 4034|      4|                    i4_num_res_lyrs_bup = ps_vcl_nal->i4_num_res_lyrs;
 4035|       |
 4036|      4|                    ps_node_bup = ps_vcl_node;
 4037|       |
 4038|       |                    /* set the restore params flag */
 4039|      4|                    i4_restore_prms_flag = SVCD_TRUE;
  ------------------
  |  |   46|      4|#define SVCD_TRUE 1
  ------------------
 4040|      4|                }
 4041|      4|            }
 4042|     42|            else
 4043|     42|            {
 4044|     42|                ps_vcl_node->i4_ref_dq_id = -1;
 4045|     42|                ps_vcl_node->i4_res_change_flag = i4_res_chnge_flag;
 4046|       |
 4047|       |                /* store the reference DQID for current dependency */
 4048|     42|                ps_prev_au_prms[i4_dep_id].i4_ref_dq_id = -1;
 4049|     42|                ps_prev_au_prms[i4_dep_id].u2_frm_num = ps_vcl_node->u2_frm_num;
 4050|     42|                ps_prev_au_prms[i4_dep_id].i4_nal_ref_id = ps_vcl_node->i4_nal_ref_idc;
 4051|       |
 4052|       |                /* the bottom node is set to NULL */
 4053|     42|                ps_vcl_node->ps_bot_node = NULL;
 4054|     42|                break;
 4055|     42|            }
 4056|     46|        }
 4057|       |
 4058|       |        /* derive the reference layer DQID for quality id equal to 0 */
 4059|  9.70k|        if(0 == i4_qua_id)
  ------------------
  |  Branch (4059:12): [True: 9.70k, False: 0]
  ------------------
 4060|  9.70k|        {
 4061|  9.70k|            dec_seq_params_t *ps_curr_sps;
 4062|  9.70k|            dec_svc_seq_params_t *ps_curr_subset_sps;
 4063|       |
 4064|       |            /* derive current SPS */
 4065|  9.70k|            ps_curr_sps = ps_sps + ps_vcl_node->u1_sps_id;
 4066|  9.70k|            ps_curr_subset_sps = ps_subset_sps + ps_vcl_node->u1_sps_id;
 4067|       |
 4068|  9.70k|            {
 4069|  9.70k|                WORD32 i4_max_frm_num;
 4070|       |
 4071|       |                /* get the maximum value of frame number */
 4072|  9.70k|                i4_max_frm_num = (1 << (ps_curr_sps->u1_bits_in_frm_num + 1));
 4073|  9.70k|                ps_vcl_node->u2_frm_num = ps_vcl_node->u2_frm_num % i4_max_frm_num;
 4074|  9.70k|                if(SVCD_TRUE == ps_vcl_node->i4_idr_pic_flag)
  ------------------
  |  |   46|  9.70k|#define SVCD_TRUE 1
  ------------------
  |  Branch (4074:20): [True: 8.33k, False: 1.36k]
  ------------------
 4075|  8.33k|                {
 4076|       |                    /* if idr then frm num should be 0 */
 4077|  8.33k|                    ps_vcl_node->u2_frm_num = 0;
 4078|  8.33k|                }
 4079|  9.70k|            }
 4080|       |
 4081|       |            /* store default params to inter layer deblocking params */
 4082|  9.70k|            ps_vcl_node->i4_inter_lyr_dblk_idc = 0;
 4083|  9.70k|            ps_vcl_node->i4_inter_lyr_beta_offset = 0;
 4084|  9.70k|            ps_vcl_node->i4_inter_lyr_alpha_c0_offset = 0;
 4085|       |            /* No SEI support for scalability info*/
 4086|  9.70k|            i4_status = NOT_OK;
  ------------------
  |  |  116|  9.70k|#define NOT_OK    -1
  ------------------
 4087|       |
 4088|       |            /* if no inter layer pred flag is present set the   */
 4089|       |            /* status to fail since the slices will not contain */
 4090|       |            /* reference layer Dqid                             */
 4091|  9.70k|            if(1 == ps_vcl_node->u1_acc_no_int_pred)
  ------------------
  |  Branch (4091:16): [True: 5.73k, False: 3.97k]
  ------------------
 4092|  5.73k|            {
 4093|  5.73k|                i4_status = NOT_OK;
  ------------------
  |  |  116|  5.73k|#define NOT_OK    -1
  ------------------
 4094|  5.73k|            }
 4095|  3.97k|            else
 4096|  3.97k|            {
 4097|  3.97k|                WORD32 *pi4_ref_dq_id;
 4098|  3.97k|                WORD32 i4_ref_dq_id_temp;
 4099|       |
 4100|       |                /* check if the SEI message has given the ref_dq_id */
 4101|  3.97k|                if(NOT_OK == i4_status)
  ------------------
  |  |  116|  3.97k|#define NOT_OK    -1
  ------------------
  |  Branch (4101:20): [True: 3.97k, False: 0]
  ------------------
 4102|  3.97k|                {
 4103|  3.97k|                    pi4_ref_dq_id = &i4_ref_lyr_dqid;
 4104|  3.97k|                }
 4105|      0|                else
 4106|      0|                {
 4107|      0|                    pi4_ref_dq_id = &i4_ref_dq_id_temp;
 4108|      0|                }
 4109|       |
 4110|  3.97k|                i4_status = isvcd_get_ref_lyr_dqid(ps_vcl_node, ps_sps, ps_pps, pi4_ref_dq_id,
 4111|  3.97k|                                                   ps_prev_au_prms[i4_dep_id].i4_ref_dq_id,
 4112|  3.97k|                                                   &ps_svcd_ctxt->i4_error_code, ps_svcd_ctxt);
 4113|  3.97k|            }
 4114|       |
 4115|       |            /* no slice in the layer has been successfully decoded */
 4116|  9.70k|            if(NOT_OK == i4_status)
  ------------------
  |  |  116|  9.70k|#define NOT_OK    -1
  ------------------
  |  Branch (4116:16): [True: 9.50k, False: 198]
  ------------------
 4117|  9.50k|            {
 4118|       |                /* check for IDR picture */
 4119|  9.50k|                if(SVCD_TRUE == i4_idr_pic_flag)
  ------------------
  |  |   46|  9.50k|#define SVCD_TRUE 1
  ------------------
  |  Branch (4119:20): [True: 8.64k, False: 856]
  ------------------
 4120|  8.64k|                {
 4121|       |                    /* set the next lower layer as the reference layer */
 4122|  8.64k|                    if(NULL != ps_vcl_node->ps_bot_node)
  ------------------
  |  Branch (4122:24): [True: 3.60k, False: 5.04k]
  ------------------
 4123|  3.60k|                    {
 4124|  3.60k|                        i4_ref_lyr_dqid = ps_vcl_node->ps_bot_node->i4_dependency_id << 4;
 4125|       |
 4126|  3.60k|                        i4_ref_lyr_dqid += ps_vcl_node->ps_bot_node->i4_quality_id;
 4127|  3.60k|                    }
 4128|  5.04k|                    else
 4129|  5.04k|                    {
 4130|  5.04k|                        i4_ref_lyr_dqid = -1;
 4131|  5.04k|                    }
 4132|  8.64k|                }
 4133|    856|                else
 4134|    856|                {
 4135|       |                    /* take the reference dq id from previous access unit */
 4136|    856|                    i4_ref_lyr_dqid = ps_prev_au_prms[i4_dep_id].i4_ref_dq_id;
 4137|    856|                }
 4138|  9.50k|            }
 4139|       |
 4140|       |            /* Update the DQID list based on ref DQID.     */
 4141|       |            /* This routine also updates the ref_dq_id     */
 4142|       |            /* in case the actual layer is completely lost */
 4143|  9.70k|            i4_status = isvcd_update_dqid(i4_ref_lyr_dqid, ps_vcl_node, &ps_bot_vcl_node);
 4144|       |
 4145|  9.70k|            if(!(OK == i4_status))
  ------------------
  |  |  114|  9.70k|#define OK        0
  ------------------
  |  Branch (4145:16): [True: 0, False: 9.70k]
  ------------------
 4146|      0|            {
 4147|      0|                return i4_status;
 4148|      0|            }
 4149|       |
 4150|       |            /* store the reference DQID for current depedency and */
 4151|       |            /* quality id 0 layer                                 */
 4152|  9.70k|            ps_prev_au_prms[i4_dep_id].i4_ref_dq_id = i4_ref_lyr_dqid;
 4153|  9.70k|            ps_prev_au_prms[i4_dep_id].i4_nal_ref_id = ps_vcl_node->i4_nal_ref_idc;
 4154|  9.70k|            ps_prev_au_prms[i4_dep_id].u2_frm_num = ps_vcl_node->u2_frm_num;
 4155|  9.70k|            ps_prev_au_prms[i4_dep_id].i4_updated_sts = SVCD_TRUE;
  ------------------
  |  |   46|  9.70k|#define SVCD_TRUE 1
  ------------------
 4156|       |
 4157|       |            /* ------- Detect Resolution Change ---------------- */
 4158|  9.70k|            {
 4159|  9.70k|                dec_seq_params_t *ps_lower_sps = NULL;
 4160|  9.70k|                dec_svc_seq_params_t *ps_lower_subset_sps = NULL;
 4161|       |
 4162|  9.70k|                if(NULL != ps_bot_vcl_node)
  ------------------
  |  Branch (4162:20): [True: 3.78k, False: 5.91k]
  ------------------
 4163|  3.78k|                {
 4164|  3.78k|                    if((NULL != ps_bot_vcl_node->ps_first_vcl_nal) ||
  ------------------
  |  Branch (4164:24): [True: 3.64k, False: 145]
  ------------------
 4165|    145|                       (SVCD_TRUE == i4_idr_pic_flag))
  ------------------
  |  |   46|    145|#define SVCD_TRUE 1
  ------------------
  |  Branch (4165:24): [True: 134, False: 11]
  ------------------
 4166|  3.77k|                    {
 4167|       |                        /* get the SPS of layer */
 4168|  3.77k|                        ps_lower_sps = ps_sps + ps_bot_vcl_node->u1_sps_id;
 4169|  3.77k|                        ps_lower_subset_sps = ps_subset_sps + ps_bot_vcl_node->u1_sps_id;
 4170|  3.77k|                    }
 4171|     11|                    else
 4172|     11|                    {
 4173|       |                        /* if the bottom layer is completely missed */
 4174|     11|                        WORD32 i4_bot_dep_id, i4_bot_qua_id;
 4175|     11|                        UWORD8 u1_sps_id = 0;
 4176|       |
 4177|       |                        /* sps id is picked from previous access unit */
 4178|     11|                        i4_bot_dep_id = ps_bot_vcl_node->i4_dependency_id;
 4179|     11|                        i4_bot_qua_id = ps_bot_vcl_node->i4_quality_id;
 4180|       |
 4181|     11|                        if(SVCD_TRUE ==
  ------------------
  |  |   46|     11|#define SVCD_TRUE 1
  ------------------
  |  Branch (4181:28): [True: 8, False: 3]
  ------------------
 4182|     11|                           ps_pps_sps_prev[(i4_bot_dep_id << 4) + i4_bot_qua_id].i4_updated_sts)
 4183|      8|                        {
 4184|      8|                            u1_sps_id =
 4185|      8|                                ps_pps_sps_prev[(i4_bot_dep_id << 4) + i4_bot_qua_id].u1_sps_id;
 4186|      8|                        }
 4187|      3|                        else
 4188|      3|                        {
 4189|       |                            /* should not enter here */
 4190|      3|                            return NOT_OK;
  ------------------
  |  |  116|      3|#define NOT_OK    -1
  ------------------
 4191|      3|                        }
 4192|       |
 4193|       |                        /* get the SPS of lower layer */
 4194|      8|                        ps_lower_sps = ps_sps + u1_sps_id;
 4195|      8|                        ps_lower_subset_sps = ps_subset_sps + u1_sps_id;
 4196|      8|                    }
 4197|  3.78k|                }
 4198|       |
 4199|       |                /* call the function which detects resolution change */
 4200|  9.69k|                i4_res_chnge_flag = isvcd_detect_res_change(
 4201|  9.69k|                    ps_curr_sps, ps_lower_sps, ps_curr_subset_sps, ps_lower_subset_sps);
 4202|       |
 4203|       |                /* if a resolution exists below current resolution */
 4204|  9.69k|                if(SVCD_TRUE == i4_res_chnge_flag)
  ------------------
  |  |   46|  9.69k|#define SVCD_TRUE 1
  ------------------
  |  Branch (4204:20): [True: 2.62k, False: 7.07k]
  ------------------
 4205|  2.62k|                {
 4206|       |                    /* if current picture id IDR */
 4207|  2.62k|                    if(SVCD_TRUE == i4_idr_pic_flag)
  ------------------
  |  |   46|  2.62k|#define SVCD_TRUE 1
  ------------------
  |  Branch (4207:24): [True: 2.60k, False: 25]
  ------------------
 4208|  2.60k|                    {
 4209|       |                        /* store the depedency id of bottom most layer in current resolution */
 4210|  2.60k|                        ai4_dep_id[ps_vcl_nal->i4_num_res_lyrs - 1] = i4_dep_id;
 4211|  2.60k|                    }
 4212|       |
 4213|       |                    /* increment the num resolution layer counter */
 4214|  2.62k|                    ps_vcl_nal->i4_num_res_lyrs++;
 4215|       |
 4216|       |                    /* store the SPS of target -1 and -2 resolution layers */
 4217|  2.62k|                    if(2 == ps_vcl_nal->i4_num_res_lyrs)
  ------------------
  |  Branch (4217:24): [True: 2.62k, False: 0]
  ------------------
 4218|  2.62k|                    {
 4219|  2.62k|                        ps_sps_tgt_minus1_lyr = ps_curr_sps;
 4220|  2.62k|                    }
 4221|      0|                    else if(3 == ps_vcl_nal->i4_num_res_lyrs)
  ------------------
  |  Branch (4221:29): [True: 0, False: 0]
  ------------------
 4222|      0|                    {
 4223|      0|                        ps_sps_tgt_minus2_lyr = ps_curr_sps;
 4224|      0|                    }
 4225|      0|                    else if(ps_vcl_nal->i4_num_res_lyrs > MAX_NUM_RES_LYRS)
  ------------------
  |  |   94|      0|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (4225:29): [True: 0, False: 0]
  ------------------
 4226|      0|                    {
 4227|      0|                        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 4228|      0|                    }
 4229|  2.62k|                }
 4230|  9.69k|            }
 4231|       |
 4232|       |            /* -------- end of resolution change detection -------- */
 4233|  9.69k|        }
 4234|      0|        else
 4235|      0|        {
 4236|      0|            i4_ref_lyr_dqid = (i4_dep_id << 4);
 4237|      0|            i4_ref_lyr_dqid += (i4_qua_id - 1);
 4238|       |
 4239|       |            /* Update the DQID list based on ref DQID.     */
 4240|       |            /* This routine also updates the ref_dq_id     */
 4241|       |            /* in case the actual layer is completely lost */
 4242|      0|            i4_status = isvcd_update_dqid(i4_ref_lyr_dqid, ps_vcl_node, &ps_bot_vcl_node);
 4243|       |
 4244|      0|            if(!(OK == i4_status))
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (4244:16): [True: 0, False: 0]
  ------------------
 4245|      0|            {
 4246|      0|                return i4_status;
 4247|      0|            }
 4248|      0|            if(SVCD_TRUE == ps_vcl_node->i4_idr_pic_flag)
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
  |  Branch (4248:16): [True: 0, False: 0]
  ------------------
 4249|      0|            {
 4250|       |                /* if idr then frm num should be 0 */
 4251|      0|                ps_vcl_node->u2_frm_num = 0;
 4252|      0|            }
 4253|      0|        }
 4254|       |
 4255|       |        /* Update resolution change flag inside VCL    */
 4256|       |        /* node structure. This parameter is later used*/
 4257|       |        /* in detecting the top most layer in the      */
 4258|       |        /* resolution currently being decoded          */
 4259|  9.69k|        ps_vcl_node->i4_res_change_flag = i4_res_chnge_flag;
 4260|  9.69k|        ps_vcl_node->i4_ref_dq_id = i4_ref_lyr_dqid;
 4261|       |
 4262|       |        /* go to the next node */
 4263|  9.69k|        ps_vcl_node = ps_bot_vcl_node;
 4264|  9.69k|    }
 4265|       |
 4266|       |    /* update the Dependency array for each resolution */
 4267|  5.95k|    if(SVCD_TRUE == i4_idr_pic_flag)
  ------------------
  |  |   46|  5.95k|#define SVCD_TRUE 1
  ------------------
  |  Branch (4267:8): [True: 5.10k, False: 853]
  ------------------
 4268|  5.10k|    {
 4269|  5.10k|        WORD32 i4_idx;
 4270|       |
 4271|  5.10k|        ai4_dep_id[ps_vcl_nal->i4_num_res_lyrs - 1] = 0;
 4272|       |
 4273|       |        /* loop over number of resolutions detected */
 4274|  12.8k|        for(i4_idx = 0; i4_idx < ps_vcl_nal->i4_num_res_lyrs; i4_idx++)
  ------------------
  |  Branch (4274:25): [True: 7.70k, False: 5.10k]
  ------------------
 4275|  7.70k|        {
 4276|  7.70k|            pi4_dep_id_map[i4_idx] = ai4_dep_id[ps_vcl_nal->i4_num_res_lyrs - 1 - i4_idx];
 4277|  7.70k|        }
 4278|  5.10k|    }
 4279|       |
 4280|  5.95k|    if(SVCD_TRUE == i4_restore_prms_flag)
  ------------------
  |  |   46|  5.95k|#define SVCD_TRUE 1
  ------------------
  |  Branch (4280:8): [True: 4, False: 5.95k]
  ------------------
 4281|      4|    {
 4282|       |        /* restore the number of resolutions */
 4283|      4|        ps_vcl_nal->i4_num_res_lyrs = i4_num_res_lyrs_bup;
 4284|       |
 4285|      4|        ps_vcl_node = ps_node_bup;
 4286|       |
 4287|       |        /* set the bottom node to NULL */
 4288|      4|        ps_vcl_node->ps_bot_node = NULL;
 4289|       |
 4290|      4|        ps_vcl_node->i4_ref_dq_id = -1;
 4291|      4|        ps_vcl_node->i4_res_change_flag = SVCD_FALSE;
  ------------------
  |  |   45|      4|#define SVCD_FALSE 0
  ------------------
 4292|       |
 4293|       |        /* store the reference DQID for current dependency */
 4294|      4|        ps_prev_au_prms[ps_vcl_node->i4_dependency_id].i4_ref_dq_id = -1;
 4295|       |
 4296|      4|        ps_prev_au_prms[ps_vcl_node->i4_dependency_id].u2_frm_num = ps_vcl_node->u2_frm_num;
 4297|       |
 4298|      4|        ps_prev_au_prms[ps_vcl_node->i4_dependency_id].i4_nal_ref_id = ps_vcl_node->i4_nal_ref_idc;
 4299|      4|    }
 4300|       |
 4301|       |    /* Finally update the bottom most node in the current access unit */
 4302|  5.95k|    ps_vcl_node = ps_vcl_nal->ps_top_node;
 4303|       |
 4304|  9.73k|    while(NULL != ps_vcl_node->ps_bot_node)
  ------------------
  |  Branch (4304:11): [True: 3.78k, False: 5.95k]
  ------------------
 4305|  3.78k|    {
 4306|  3.78k|        ps_vcl_node = ps_vcl_node->ps_bot_node;
 4307|  3.78k|    }
 4308|       |
 4309|  5.95k|    ps_vcl_nal->ps_bot_node = ps_vcl_node;
 4310|       |
 4311|       |    /* check on validity of Target Layer -1 and -2 dimensions */
 4312|  5.95k|    if((NULL != ps_sps_tgt_minus1_lyr) && (0 == ps_sps_tgt_minus1_lyr->u1_is_valid))
  ------------------
  |  Branch (4312:8): [True: 2.62k, False: 3.32k]
  |  Branch (4312:43): [True: 473, False: 2.15k]
  ------------------
 4313|    473|    {
 4314|    473|        if((H264_MAX_FRAME_WIDTH < (WORD32) (ps_sps_tgt_minus1_lyr->u2_frm_wd_in_mbs << 4)) ||
  ------------------
  |  |   39|    473|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
  |  Branch (4314:12): [True: 0, False: 473]
  ------------------
 4315|    473|           (H264_MAX_FRAME_HEIGHT < (WORD32) (ps_sps_tgt_minus1_lyr->u2_frm_ht_in_mbs << 4)))
  ------------------
  |  |   40|    473|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
  |  Branch (4315:12): [True: 0, False: 473]
  ------------------
 4316|      0|        {
 4317|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 4318|      0|        }
 4319|    473|    }
 4320|       |
 4321|  5.95k|    if((NULL != ps_sps_tgt_minus2_lyr) && (0 == ps_sps_tgt_minus2_lyr->u1_is_valid))
  ------------------
  |  Branch (4321:8): [True: 0, False: 5.95k]
  |  Branch (4321:43): [True: 0, False: 0]
  ------------------
 4322|      0|    {
 4323|      0|        if((H264_MAX_FRAME_WIDTH < (WORD32) (ps_sps_tgt_minus2_lyr->u2_frm_wd_in_mbs << 4)) ||
  ------------------
  |  |   39|      0|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
  |  Branch (4323:12): [True: 0, False: 0]
  ------------------
 4324|      0|           (H264_MAX_FRAME_HEIGHT < (WORD32) (ps_sps_tgt_minus2_lyr->u2_frm_ht_in_mbs << 4)))
  ------------------
  |  |   40|      0|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
  |  Branch (4324:12): [True: 0, False: 0]
  ------------------
 4325|      0|        {
 4326|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 4327|      0|        }
 4328|      0|    }
 4329|       |
 4330|  5.95k|    return (OK);
  ------------------
  |  |  114|  5.95k|#define OK        0
  ------------------
 4331|  5.95k|}
isvcd_dec_non_vcl:
 4361|  5.76k|{
 4362|       |    /* local varibles */
 4363|  5.76k|    non_vcl_nal_t *ps_non_vcl;
 4364|  5.76k|    WORD32 i4_unit_indx;
 4365|  5.76k|    non_vcl_buf_hdr_t *ps_non_vcl_buf;
 4366|  5.76k|    WORD32 i_status = OK;
  ------------------
  |  |  114|  5.76k|#define OK        0
  ------------------
 4367|  5.76k|    dec_struct_t *ps_dec;
 4368|  5.76k|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 4369|  5.76k|    dec_bit_stream_t *ps_bitstrm;
 4370|       |
 4371|  5.76k|    if((NULL == pv_out_non_vcl) || (NULL == pv_seq_params) || (NULL == pv_pic_params))
  ------------------
  |  Branch (4371:8): [True: 0, False: 5.76k]
  |  Branch (4371:36): [True: 0, False: 5.76k]
  |  Branch (4371:63): [True: 0, False: 5.76k]
  ------------------
 4372|      0|    {
 4373|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 4374|      0|    }
 4375|  5.76k|    UNUSED(pv_seq_params);
  ------------------
  |  |   45|  5.76k|#define UNUSED(x) ((void)(x))
  ------------------
 4376|  5.76k|    UNUSED(pv_pic_params);
  ------------------
  |  |   45|  5.76k|#define UNUSED(x) ((void)(x))
  ------------------
 4377|       |
 4378|       |    /* currently SEI decoding is not supported */
 4379|       |    /* derive the local variables */
 4380|  5.76k|    ps_non_vcl = (non_vcl_nal_t *) pv_out_non_vcl;
 4381|  5.76k|    ps_non_vcl_buf = ps_non_vcl->ps_first_non_vcl_nal;
 4382|  5.76k|    if(NULL == ps_non_vcl_buf) return (NOT_OK);
  ------------------
  |  |  116|    177|#define NOT_OK    -1
  ------------------
  |  Branch (4382:8): [True: 177, False: 5.59k]
  ------------------
 4383|       |
 4384|       |    /* loop until all NON VCL NAL are decoded */
 4385|  96.7k|    for(i4_unit_indx = 0; i4_unit_indx < ps_non_vcl->i4_num_non_vcl_nals; i4_unit_indx++)
  ------------------
  |  Branch (4385:27): [True: 92.5k, False: 4.21k]
  ------------------
 4386|  92.5k|    {
 4387|  92.5k|        UWORD32 u4_nal_unit_type;
 4388|  92.5k|        ps_svc_lyr_dec = ps_svcd_ctxt->ps_svc_dec_lyr;
 4389|  92.5k|        ps_dec = &ps_svc_lyr_dec->s_dec;
 4390|  92.5k|        if(NULL == ps_non_vcl_buf) return (NOT_OK);
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (4390:12): [True: 0, False: 92.5k]
  ------------------
 4391|       |        /* get the current NAL unit type */
 4392|  92.5k|        u4_nal_unit_type = (UWORD32) ps_non_vcl_buf->i4_nal_unit_type;
 4393|  92.5k|        if(u4_nal_unit_type > MAX_SVC_NAL_UNIT_TYPE) return (NOT_OK);
  ------------------
  |  |   73|  92.5k|#define MAX_SVC_NAL_UNIT_TYPE 31
  ------------------
                      if(u4_nal_unit_type > MAX_SVC_NAL_UNIT_TYPE) return (NOT_OK);
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (4393:12): [True: 0, False: 92.5k]
  ------------------
 4394|  92.5k|        ps_dec->u1_nal_unit_type = u4_nal_unit_type;
 4395|       |
 4396|  92.5k|        ps_dec->ps_bitstrm->pu4_buffer =
 4397|  92.5k|            (UWORD32 *) ((UWORD8 *) ps_non_vcl_buf + ps_non_vcl_buf->i4_buf_offset);
 4398|  92.5k|        ps_dec->ps_bitstrm->u4_ofst = 0;
 4399|  92.5k|        ps_dec->ps_bitstrm->u4_max_ofst = isvcd_nal_rbsp_to_sodb(
 4400|  92.5k|            (UWORD8 *) ps_dec->ps_bitstrm->pu4_buffer, ps_non_vcl_buf->i4_buf_size, 0);
 4401|  92.5k|        if(ps_dec->ps_bitstrm->u4_max_ofst <= 0) return (NOT_OK);
  ------------------
  |  |  116|    196|#define NOT_OK    -1
  ------------------
  |  Branch (4401:12): [True: 196, False: 92.3k]
  ------------------
 4402|       |
 4403|  92.3k|        ps_bitstrm = ps_dec->ps_bitstrm;
 4404|       |
 4405|       |        /* call the processing module based on nal unit type */
 4406|  92.3k|        switch(u4_nal_unit_type)
 4407|  92.3k|        {
 4408|  6.75k|            case SEQ_PARAM_NAL:
  ------------------
  |  |  330|  6.75k|#define SEQ_PARAM_NAL                   7
  ------------------
  |  Branch (4408:13): [True: 6.75k, False: 85.5k]
  ------------------
 4409|       |
 4410|  6.75k|                i_status = isvcd_parse_sps(ps_svc_lyr_dec, ps_bitstrm);
 4411|       |
 4412|  6.75k|                if(!i_status)
  ------------------
  |  Branch (4412:20): [True: 6.19k, False: 560]
  ------------------
 4413|  6.19k|                {
 4414|  6.19k|                    ps_dec->i4_header_decoded |= 0x1;
 4415|  6.19k|                    ps_svcd_ctxt->u4_num_sps_ctr++;
 4416|       |
 4417|  6.19k|                    if(ps_svcd_ctxt->pic_width < ps_svc_lyr_dec->pic_width)
  ------------------
  |  Branch (4417:24): [True: 118, False: 6.07k]
  ------------------
 4418|    118|                    {
 4419|    118|                        ps_svcd_ctxt->pic_width = ps_svc_lyr_dec->pic_width;
 4420|    118|                    }
 4421|  6.19k|                    if(ps_svcd_ctxt->pic_height < ps_svc_lyr_dec->pic_height)
  ------------------
  |  Branch (4421:24): [True: 118, False: 6.07k]
  ------------------
 4422|    118|                    {
 4423|    118|                        ps_svcd_ctxt->pic_height = ps_svc_lyr_dec->pic_height;
 4424|    118|                    }
 4425|  6.19k|                }
 4426|       |
 4427|  6.75k|                if(i_status) return i_status;
  ------------------
  |  Branch (4427:20): [True: 560, False: 6.19k]
  ------------------
 4428|       |
 4429|  6.19k|                break;
 4430|  6.19k|            case SUBSET_SPS_NAL:
  ------------------
  |  |   65|  1.86k|#define SUBSET_SPS_NAL 15
  ------------------
  |  Branch (4430:13): [True: 1.86k, False: 90.4k]
  ------------------
 4431|       |
 4432|  1.86k|                i_status = isvcd_parse_subset_sps(ps_svc_lyr_dec, ps_bitstrm);
 4433|       |
 4434|  1.86k|                if(!i_status)
  ------------------
  |  Branch (4434:20): [True: 1.52k, False: 344]
  ------------------
 4435|  1.52k|                {
 4436|  1.52k|                    ps_svcd_ctxt->u4_num_sps_ctr++;
 4437|  1.52k|                    ps_dec->i4_header_decoded |= 0x1;
 4438|       |
 4439|  1.52k|                    if(ps_svcd_ctxt->pic_width < ps_svc_lyr_dec->pic_width)
  ------------------
  |  Branch (4439:24): [True: 63, False: 1.46k]
  ------------------
 4440|     63|                    {
 4441|     63|                        ps_svcd_ctxt->pic_width = ps_svc_lyr_dec->pic_width;
 4442|     63|                    }
 4443|  1.52k|                    if(ps_svcd_ctxt->pic_height < ps_svc_lyr_dec->pic_height)
  ------------------
  |  Branch (4443:24): [True: 59, False: 1.46k]
  ------------------
 4444|     59|                    {
 4445|     59|                        ps_svcd_ctxt->pic_height = ps_svc_lyr_dec->pic_height;
 4446|     59|                    }
 4447|  1.52k|                }
 4448|  1.86k|                if(i_status) return i_status;
  ------------------
  |  Branch (4448:20): [True: 344, False: 1.52k]
  ------------------
 4449|       |
 4450|  1.52k|                break;
 4451|       |
 4452|  3.48k|            case PIC_PARAM_NAL:
  ------------------
  |  |  331|  3.48k|#define PIC_PARAM_NAL                   8
  ------------------
  |  Branch (4452:13): [True: 3.48k, False: 88.8k]
  ------------------
 4453|       |
 4454|  3.48k|                i_status = isvcd_parse_pps(ps_svc_lyr_dec, ps_bitstrm);
 4455|  3.48k|                if(!i_status)
  ------------------
  |  Branch (4455:20): [True: 3.32k, False: 157]
  ------------------
 4456|  3.32k|                {
 4457|  3.32k|                    ps_dec->i4_header_decoded |= 0x2;
 4458|  3.32k|                    ps_svcd_ctxt->u4_num_pps_ctr++;
 4459|  3.32k|                }
 4460|  3.48k|                if(i_status) return i_status;
  ------------------
  |  Branch (4460:20): [True: 157, False: 3.32k]
  ------------------
 4461|  3.32k|                break;
 4462|  3.32k|            case SEI_NAL:
  ------------------
  |  |  329|    117|#define SEI_NAL                         6
  ------------------
  |  Branch (4462:13): [True: 117, False: 92.2k]
  ------------------
 4463|    117|            {
 4464|    117|                i_status = ih264d_parse_sei_message(ps_dec, ps_bitstrm);
 4465|    117|                if(i_status) return i_status;
  ------------------
  |  Branch (4465:20): [True: 117, False: 0]
  ------------------
 4466|      0|                ih264d_parse_sei(ps_dec, ps_bitstrm);
 4467|      0|            }
 4468|      0|            break;
 4469|  80.1k|            default:
  ------------------
  |  Branch (4469:13): [True: 80.1k, False: 12.2k]
  ------------------
 4470|       |                /* no other NON VCL UNIT is supported */
 4471|  80.1k|                break;
 4472|  92.3k|        }
 4473|       |
 4474|       |        /* get the next non vcl bufffer */
 4475|  91.1k|        ps_non_vcl_buf = ps_non_vcl_buf->ps_next;
 4476|       |
 4477|  91.1k|    } /* end of loop over all NAL units */
 4478|       |
 4479|  4.21k|    return (OK);
  ------------------
  |  |  114|  4.21k|#define OK        0
  ------------------
 4480|  5.59k|}
isvcd_seq_hdr_dec:
 4505|  2.95k|{
 4506|  2.95k|    WORD32 i4_status;
 4507|       |
 4508|       |    /* Decode all non VCL NAL till first VCL NAL is encountered */
 4509|  2.95k|    ps_svcd_ctxt->s_non_vcl_nal.i4_num_non_vcl_nals = 0;
 4510|  2.95k|    i4_status = isvcd_nal_parse_non_vcl_nal(
 4511|  2.95k|        ps_svcd_ctxt->pv_nal_parse_ctxt, ps_in_bufs->pv_stream_buffer, &ps_svcd_ctxt->s_non_vcl_nal,
 4512|  2.95k|        pu4_bytes_consumed, &ps_in_bufs->u4_num_Bytes);
 4513|       |
 4514|       |    /* Note: The bitstream extraction module expects updated  */
 4515|       |    /* pointer whenever a new call to this module has been    */
 4516|       |    /* made. Hence the buffer pointer has to be incremented   */
 4517|       |    /* by bytes consumed                                      */
 4518|  2.95k|    ps_in_bufs->u4_num_Bytes -= *pu4_bytes_consumed;
 4519|       |
 4520|       |    /* ------------------------------------------------------ */
 4521|       |    /* Decoding of non VCL data. As current implementation it */
 4522|       |    /* decodes the followings:                                */
 4523|       |    /*          1. Sequence parameter set                     */
 4524|       |    /*          2. Picture parameter set                      */
 4525|       |    /*          3. SEI message                                */
 4526|       |    /* ------------------------------------------------------ */
 4527|  2.95k|    i4_status = isvcd_dec_non_vcl(&ps_svcd_ctxt->s_non_vcl_nal, ps_svcd_ctxt->ps_sps, ps_svcd_ctxt->ps_pps,
 4528|  2.95k|                      ps_svcd_ctxt);
 4529|       |
 4530|  2.95k|    return (i4_status);
 4531|  2.95k|}
isvcd_pre_parse_refine_au:
 4560|  20.3k|{
 4561|  20.3k|    WORD32 i4_status = 0, i4_non_vcl_status;
 4562|  20.3k|    UWORD32 u4_bytes_consumed = 0;
 4563|  20.3k|    dec_struct_t *ps_dec;
 4564|  20.3k|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 4565|  20.3k|    ps_svc_lyr_dec = ps_svcd_ctxt->ps_svc_dec_lyr;
 4566|  20.3k|    ps_dec = &ps_svc_lyr_dec->s_dec;
 4567|       |
 4568|       |    /* Sequence header decode:                                 */
 4569|       |    /* If sequence header is not decoded then decode  the seq  */
 4570|       |    /* uence header                                            */
 4571|       |
 4572|  20.3k|    if(SVCD_FALSE == ps_dec->i4_header_decoded)
  ------------------
  |  |   45|  20.3k|#define SVCD_FALSE 0
  ------------------
  |  Branch (4572:8): [True: 2.95k, False: 17.4k]
  ------------------
 4573|  2.95k|    {
 4574|  2.95k|        i4_status = isvcd_seq_hdr_dec(ps_svcd_ctxt, ps_in_bufs, &u4_bytes_consumed);
 4575|       |
 4576|  2.95k|        if((VCL_NAL_FOUND_TRUE == i4_status) && (ps_svcd_ctxt->u4_num_sps_ctr != 0) &&
  ------------------
  |  Branch (4576:12): [True: 0, False: 2.95k]
  |  Branch (4576:49): [True: 0, False: 0]
  ------------------
 4577|      0|           (ps_svcd_ctxt->u4_num_pps_ctr != 0))
  ------------------
  |  Branch (4577:12): [True: 0, False: 0]
  ------------------
 4578|      0|        {
 4579|       |            /* set the header decoded flag */
 4580|      0|            ps_dec->i4_header_decoded = 3;
 4581|      0|        }
 4582|  2.95k|    }
 4583|  20.3k|    *pu4_bytes_consumed = u4_bytes_consumed;
 4584|  20.3k|    if (i4_status)
  ------------------
  |  Branch (4584:9): [True: 440, False: 19.9k]
  ------------------
 4585|    440|    {
 4586|    440|        return NOT_OK;
  ------------------
  |  |  116|    440|#define NOT_OK    -1
  ------------------
 4587|    440|    }
 4588|  19.9k|    if(1 == ps_dec->i4_decode_header)
  ------------------
  |  Branch (4588:8): [True: 11.3k, False: 8.63k]
  ------------------
 4589|  11.3k|    {
 4590|  11.3k|        return OK;
  ------------------
  |  |  114|  11.3k|#define OK        0
  ------------------
 4591|  11.3k|    }
 4592|       |    /* Bit-stream Parsing. It performs following tasks:        */
 4593|       |    /*          1. NAL hader decoder                           */
 4594|       |    /*          2. Emulation prevention and byte swap          */
 4595|       |    /*             (During this process data to moved to output*/
 4596|       |    /*              buffer)                                    */
 4597|       |    /*          3. Dependency list creation based on NAL header*/
 4598|       |    /*          4. Detection of picture boundary               */
 4599|       |    /* NOTE1:                                                  */
 4600|       |    /*       Output buffers for VCL and non VCL data are       */
 4601|       |    /*       different. VCL data can be retrieved through      */
 4602|       |    /*       dependency list. Whereas non VCL data is stored in*/
 4603|       |    /*       one single buffer, which is accessed through NON  */
 4604|       |    /*       VCL structure                                     */
 4605|       |    /* NOTE2:Partial input case for nal parsing requires a     */
 4606|       |    /*       flush API to be called when end of bitstream      */
 4607|       |    /*       occurs                                            */
 4608|       |
 4609|  8.63k|    if(SVCD_FALSE == ps_svcd_ctxt->i4_eos_flag)
  ------------------
  |  |   45|  8.63k|#define SVCD_FALSE 0
  ------------------
  |  Branch (4609:8): [True: 8.63k, False: 0]
  ------------------
 4610|  8.63k|    {
 4611|  8.63k|        if(ps_dec->i4_header_decoded == 3)
  ------------------
  |  Branch (4611:12): [True: 6.27k, False: 2.36k]
  ------------------
 4612|  6.27k|        {
 4613|  6.27k|            i4_status = isvcd_nal_parse_vcl_nal_partial(
 4614|  6.27k|                ps_svcd_ctxt->pv_nal_parse_ctxt, ps_in_bufs->pv_stream_buffer,
 4615|  6.27k|                &ps_svcd_ctxt->s_non_vcl_nal, &ps_svcd_ctxt->s_vcl_nal, &u4_bytes_consumed,
 4616|  6.27k|                &ps_in_bufs->u4_num_Bytes);
 4617|  6.27k|        }
 4618|  2.36k|        else
 4619|  2.36k|        {
 4620|  2.36k|            return NOT_OK;
  ------------------
  |  |  116|  2.36k|#define NOT_OK    -1
  ------------------
 4621|  2.36k|        }
 4622|  8.63k|    }
 4623|      0|    else
 4624|      0|    {
 4625|      0|        void *pv_nal_parse_ctxt;
 4626|      0|        pv_nal_parse_ctxt = ps_svcd_ctxt->pv_nal_parse_ctxt;
 4627|       |
 4628|      0|        i4_status = isvcd_nal_parse_partial_signal_eos(pv_nal_parse_ctxt, &ps_svcd_ctxt->s_vcl_nal,
 4629|      0|                                                       &ps_svcd_ctxt->s_non_vcl_nal);
 4630|       |
 4631|      0|        u4_bytes_consumed = 0;
 4632|      0|    }
 4633|       |
 4634|  6.27k|    *pu4_bytes_consumed += u4_bytes_consumed;
 4635|       |
 4636|       |    /* Picture Boundary detected: Go ahead and do the decoding  */
 4637|       |    /* Picture boundary not detected: Otherwsie retrun from this*/
 4638|       |    /* function and update the bytes consumed variable. This    */
 4639|       |    /* should be repeated till we get a picture boundary        */
 4640|       |
 4641|  6.27k|    if(PIC_BOUNDARY_FALSE == i4_status)
  ------------------
  |  Branch (4641:8): [True: 306, False: 5.97k]
  ------------------
 4642|    306|    {
 4643|    306|        return (NOT_OK);
  ------------------
  |  |  116|    306|#define NOT_OK    -1
  ------------------
 4644|    306|    }
 4645|       |
 4646|  5.97k|    else if(FLUSH_DECODED_PICTURE == i4_status)
  ------------------
  |  Branch (4646:13): [True: 0, False: 5.97k]
  ------------------
 4647|      0|    {
 4648|       |        /* No more data is expected to come. Pictures decoded   */
 4649|       |        /* so far needs to be sent for display                  */
 4650|      0|        return (FLUSH);
  ------------------
  |  |   50|      0|#define FLUSH 2
  ------------------
 4651|      0|    }
 4652|       |
 4653|  5.97k|    if(PIC_BOUNDARY_TRUE != i4_status)
  ------------------
  |  Branch (4653:8): [True: 0, False: 5.97k]
  ------------------
 4654|      0|    {
 4655|      0|        return (NOT_OK);
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 4656|      0|    }
 4657|       |
 4658|       |    /* check if the application has set any of the skip modes       */
 4659|       |    /* add the support for P and B skip modes                       */
 4660|       |    /* if(ps_dec_ctxt->s_dyn_prms.u1_frame_skip_mode)               */
 4661|       |
 4662|       |    /* Parse slice header to decode reference layer dQId and refine */
 4663|       |    /* the dependency list                                          */
 4664|       |    /* NOTE: Yes, this processing could be moved into NAL parsing   */
 4665|       |    /*       routine to avoid unneccessary emulation prevention and */
 4666|       |    /*       byte swapping over discardable data. This Optimization */
 4667|       |    /*       has been deferred for some time. In future if we found */
 4668|       |    /*       that there are many such streams which doesn't set     */
 4669|       |    /*       'discard_flag' correctly in NAL header, we will take a */
 4670|       |    /*       hit to optimize it.                                    */
 4671|       |
 4672|       |    /* At present this routine also performs the following          */
 4673|       |    /* 1. Refine DQID list based on reference layer DQID            */
 4674|       |    /* 2. Calculates the POC for the target layer                   */
 4675|       |
 4676|  5.97k|    {
 4677|  5.97k|        i4_status = isvcd_refine_dep_list(
 4678|  5.97k|            &ps_svcd_ctxt->s_vcl_nal, ps_svcd_ctxt->ps_sps, ps_svcd_ctxt->ps_subset_sps,
 4679|  5.97k|            ps_svcd_ctxt->ps_pps, &ps_svcd_ctxt->ai4_dq_id_map[0], &ps_svcd_ctxt->as_au_prms_dep[0],
 4680|  5.97k|            &ps_svcd_ctxt->as_pps_sps_prev_au[0], &ps_svcd_ctxt->i4_error_code, ps_svcd_ctxt);
 4681|  5.97k|    }
 4682|       |
 4683|  5.97k|    if(0 != ps_svcd_ctxt->s_non_vcl_nal.i4_num_non_vcl_nals)
  ------------------
  |  Branch (4683:8): [True: 2.81k, False: 3.16k]
  ------------------
 4684|  2.81k|    {
 4685|       |        /* Decoding of non VCL data. In current implementation it  */
 4686|       |        /* decodes the followings:                                 */
 4687|       |        /*          1. Sequence parameter set                      */
 4688|       |        /*          2. Picture parameter set                       */
 4689|       |        /*          3. SEI message                                 */
 4690|  2.81k|        i4_non_vcl_status = isvcd_dec_non_vcl(&ps_svcd_ctxt->s_non_vcl_nal, ps_svcd_ctxt->ps_sps,
 4691|  2.81k|                                              ps_svcd_ctxt->ps_pps, ps_svcd_ctxt);
 4692|       |
 4693|  2.81k|        if(OK != i4_non_vcl_status) return i4_non_vcl_status;
  ------------------
  |  |  114|  2.81k|#define OK        0
  ------------------
  |  Branch (4693:12): [True: 1.11k, False: 1.69k]
  ------------------
 4694|  2.81k|    }
 4695|  4.85k|    if(OK != i4_status) return (i4_status);
  ------------------
  |  |  114|  4.85k|#define OK        0
  ------------------
  |  Branch (4695:8): [True: 12, False: 4.84k]
  ------------------
 4696|  4.84k|    return (OK);
  ------------------
  |  |  114|  4.84k|#define OK        0
  ------------------
 4697|  4.85k|}
isvcd_video_decode:
 4721|  20.5k|{
 4722|  20.5k|    dec_struct_t *ps_dec;
 4723|  20.5k|    dec_struct_t *ps_dec_zero_lyr;
 4724|  20.5k|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 4725|  20.5k|    svc_dec_lyr_struct_t *ps_svc_lyr_zero_dec;
 4726|       |
 4727|  20.5k|    svc_dec_ctxt_t *ps_svcd_ctxt;
 4728|  20.5k|    WORD32 i4_err_status = 0;
 4729|       |
 4730|  20.5k|    UWORD32 bytes_consumed = 0;
 4731|  20.5k|    WORD32 ret = 0, api_ret_value = IV_SUCCESS;
 4732|  20.5k|    isvcd_video_decode_ip_t *ps_h264d_dec_ip;
 4733|  20.5k|    isvcd_video_decode_op_t *ps_h264d_dec_op;
 4734|  20.5k|    ivd_video_decode_ip_t *ps_dec_ip;
 4735|  20.5k|    ivd_video_decode_op_t *ps_dec_op;
 4736|  20.5k|    UWORD8 u1_res_id;
 4737|       |
 4738|  20.5k|    ithread_set_name((void *) "Parse_thread");
 4739|       |
 4740|  20.5k|    ps_svcd_ctxt = (svc_dec_ctxt_t *) (dec_hdl->pv_codec_handle);
 4741|  20.5k|    ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[0];
 4742|  20.5k|    ps_dec = &ps_svc_lyr_dec->s_dec;
 4743|       |
 4744|  20.5k|    ps_h264d_dec_ip = (isvcd_video_decode_ip_t *) pv_api_ip;
 4745|  20.5k|    ps_h264d_dec_op = (isvcd_video_decode_op_t *) pv_api_op;
 4746|  20.5k|    ps_dec_ip = &ps_h264d_dec_ip->s_ivd_video_decode_ip_t;
 4747|  20.5k|    ps_dec_op = &ps_h264d_dec_op->s_ivd_video_decode_op_t;
 4748|       |
 4749|  20.5k|    {
 4750|  20.5k|        UWORD32 u4_size;
 4751|  20.5k|        u4_size = ps_dec_op->u4_size;
 4752|  20.5k|        memset(ps_h264d_dec_op, 0, sizeof(isvcd_video_decode_op_t));
 4753|  20.5k|        ps_dec_op->u4_size = u4_size;
 4754|  20.5k|    }
 4755|       |
 4756|  20.5k|    ps_dec->pv_dec_out = ps_dec_op;
 4757|  20.5k|    if(ps_dec->init_done != 1)
  ------------------
  |  Branch (4757:8): [True: 0, False: 20.5k]
  ------------------
 4758|      0|    {
 4759|      0|        return IV_FAIL;
 4760|      0|    }
 4761|       |
 4762|       |    /*Data memory barries instruction,so that bitstream write by the application
 4763|       |     * is complete*/
 4764|  20.5k|    DATA_SYNC();
  ------------------
  |  |  116|  20.5k|#define DATA_SYNC()  __sync_synchronize()
  ------------------
 4765|       |
 4766|  20.5k|    if(0 == ps_dec->u1_flushfrm)
  ------------------
  |  Branch (4766:8): [True: 20.5k, False: 0]
  ------------------
 4767|  20.5k|    {
 4768|  20.5k|        if(ps_dec_ip->pv_stream_buffer == NULL)
  ------------------
  |  Branch (4768:12): [True: 0, False: 20.5k]
  ------------------
 4769|      0|        {
 4770|      0|            ps_dec_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
 4771|      0|            ps_dec_op->u4_error_code |= IVD_DEC_FRM_BS_BUF_NULL;
 4772|      0|            return IV_FAIL;
 4773|      0|        }
 4774|  20.5k|        if(ps_dec_ip->u4_num_Bytes <= 16)
  ------------------
  |  Branch (4774:12): [True: 134, False: 20.3k]
  ------------------
 4775|    134|        {
 4776|    134|            ps_dec_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
 4777|    134|            ps_dec_op->u4_error_code |= IVD_DEC_NUMBYTES_INV;
 4778|    134|            return IV_FAIL;
 4779|    134|        }
 4780|  20.5k|    }
 4781|       |#ifdef KEEP_THREADS_ACTIVE
 4782|       |    {
 4783|       |        UWORD32 i;
 4784|       |        ps_dec->i4_break_threads = 0;
 4785|       |        for(i = 0; i < 2; i++)
 4786|       |        {
 4787|       |            ret = ithread_mutex_lock(ps_dec->apv_proc_start_mutex[i]);
 4788|       |            RETURN_IF((ret != IV_SUCCESS), ret);
 4789|       |
 4790|       |            ps_dec->ai4_process_start[i] = PROC_INIT;
 4791|       |
 4792|       |            ret = ithread_mutex_unlock(ps_dec->apv_proc_start_mutex[i]);
 4793|       |            RETURN_IF((ret != IV_SUCCESS), ret);
 4794|       |        }
 4795|       |    }
 4796|       |#else
 4797|  20.3k|    ps_dec->u4_dec_thread_created = 0;
 4798|  20.3k|    ps_dec->u4_bs_deblk_thread_created = 0;
 4799|  20.3k|#endif
 4800|  20.3k|    ps_dec_op->u4_num_bytes_consumed = 0;
 4801|  20.3k|    ps_dec_op->i4_reorder_depth = -1;
 4802|  20.3k|    ps_dec_op->i4_display_index = DEFAULT_POC;
  ------------------
  |  |   45|  20.3k|#define DEFAULT_POC 0x7FFFFFFF
  ------------------
 4803|       |
 4804|  20.3k|    ps_dec->ps_out_buffer = NULL;
 4805|  20.3k|    if(ps_dec_ip->u4_size >= offsetof(ivd_video_decode_ip_t, s_out_buffer))
  ------------------
  |  Branch (4805:8): [True: 20.3k, False: 0]
  ------------------
 4806|  20.3k|        ps_dec->ps_out_buffer = &ps_dec_ip->s_out_buffer;
 4807|       |
 4808|  20.3k|    if(0 == ps_dec->u4_share_disp_buf && ps_dec->i4_decode_header == 0)
  ------------------
  |  Branch (4808:8): [True: 20.3k, False: 0]
  |  Branch (4808:42): [True: 8.76k, False: 11.6k]
  ------------------
 4809|  8.76k|    {
 4810|  8.76k|        UWORD32 i;
 4811|  8.76k|        if((ps_dec->ps_out_buffer->u4_num_bufs == 0) ||
  ------------------
  |  Branch (4811:12): [True: 0, False: 8.76k]
  ------------------
 4812|  8.76k|           (ps_dec->ps_out_buffer->u4_num_bufs > IVD_VIDDEC_MAX_IO_BUFFERS))
  ------------------
  |  |   45|  8.76k|#define IVD_VIDDEC_MAX_IO_BUFFERS 64
  ------------------
  |  Branch (4812:12): [True: 0, False: 8.76k]
  ------------------
 4813|      0|        {
 4814|      0|            ps_dec_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
 4815|      0|            ps_dec_op->u4_error_code |= IVD_DISP_FRM_ZERO_OP_BUFS;
 4816|      0|            return IV_FAIL;
 4817|      0|        }
 4818|       |
 4819|  29.5k|        for(i = 0; i < ps_dec->ps_out_buffer->u4_num_bufs; i++)
  ------------------
  |  Branch (4819:20): [True: 20.8k, False: 8.76k]
  ------------------
 4820|  20.8k|        {
 4821|  20.8k|            if(ps_dec->ps_out_buffer->pu1_bufs[i] == NULL)
  ------------------
  |  Branch (4821:16): [True: 0, False: 20.8k]
  ------------------
 4822|      0|            {
 4823|      0|                ps_dec_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
 4824|      0|                ps_dec_op->u4_error_code |= IVD_DISP_FRM_OP_BUF_NULL;
 4825|      0|                return IV_FAIL;
 4826|      0|            }
 4827|       |
 4828|  20.8k|            if(ps_dec->ps_out_buffer->u4_min_out_buf_size[i] == 0)
  ------------------
  |  Branch (4828:16): [True: 0, False: 20.8k]
  ------------------
 4829|      0|            {
 4830|      0|                ps_dec_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
 4831|      0|                ps_dec_op->u4_error_code |= IVD_DISP_FRM_ZERO_OP_BUF_SIZE;
 4832|      0|                return IV_FAIL;
 4833|      0|            }
 4834|  20.8k|        }
 4835|  8.76k|    }
 4836|       |
 4837|  20.3k|    if(ps_dec->u4_total_frames_decoded >= NUM_FRAMES_LIMIT)
  ------------------
  |  |  157|  20.3k|#define NUM_FRAMES_LIMIT 0x7FFFFFFF
  ------------------
  |  Branch (4837:8): [True: 0, False: 20.3k]
  ------------------
 4838|      0|    {
 4839|      0|        ps_dec_op->u4_error_code = ERROR_FRAME_LIMIT_OVER;
 4840|      0|        return IV_FAIL;
 4841|      0|    }
 4842|       |
 4843|  20.3k|    ps_dec_op->u4_error_code = 0;
 4844|  20.3k|    ps_dec_op->e_pic_type = IV_NA_FRAME;
 4845|  20.3k|    ps_dec_op->u4_output_present = 0;
 4846|  20.3k|    ps_dec_op->u4_frame_decoded_flag = 0;
 4847|       |
 4848|       |    /* In case the decoder is not in flush mode(in shared mode),
 4849|       |     then decoder has to pick up a buffer to write current frame.
 4850|       |     Check if a frame is available in such cases */
 4851|  20.3k|    if(ps_dec->u1_init_dec_flag == 1 && ps_dec->u4_share_disp_buf == 1 && ps_dec->u1_flushfrm == 0)
  ------------------
  |  Branch (4851:8): [True: 5.06k, False: 15.3k]
  |  Branch (4851:41): [True: 0, False: 5.06k]
  |  Branch (4851:75): [True: 0, False: 0]
  ------------------
 4852|      0|    {
 4853|      0|        UWORD32 i;
 4854|      0|        WORD32 disp_avail = 0, free_id;
 4855|       |
 4856|       |        /* Check if at least one buffer is available with the codec */
 4857|       |        /* If not then return to application with error */
 4858|      0|        for(i = 0; i < ps_dec->u1_pic_bufs; i++)
  ------------------
  |  Branch (4858:20): [True: 0, False: 0]
  ------------------
 4859|      0|        {
 4860|      0|            if(0 == ps_dec->u4_disp_buf_mapping[i] || 1 == ps_dec->u4_disp_buf_to_be_freed[i])
  ------------------
  |  Branch (4860:16): [True: 0, False: 0]
  |  Branch (4860:55): [True: 0, False: 0]
  ------------------
 4861|      0|            {
 4862|      0|                disp_avail = 1;
 4863|      0|                break;
 4864|      0|            }
 4865|      0|        }
 4866|       |
 4867|      0|        if(0 == disp_avail)
  ------------------
  |  Branch (4867:12): [True: 0, False: 0]
  ------------------
 4868|      0|        {
 4869|       |            /* If something is queued for display wait for that buffer to be returned
 4870|       |             */
 4871|       |
 4872|      0|            ps_dec_op->u4_error_code = IVD_DEC_REF_BUF_NULL;
 4873|      0|            ps_dec_op->u4_error_code |= (1 << IVD_UNSUPPORTEDPARAM);
 4874|      0|            return (IV_FAIL);
 4875|      0|        }
 4876|       |
 4877|      0|        while(1)
  ------------------
  |  Branch (4877:15): [True: 0, Folded]
  ------------------
 4878|      0|        {
 4879|      0|            pic_buffer_t *ps_pic_buf;
 4880|      0|            ps_pic_buf = (pic_buffer_t *) ih264_buf_mgr_get_next_free(
 4881|      0|                (buf_mgr_t *) ps_dec->pv_pic_buf_mgr, &free_id);
 4882|       |
 4883|      0|            if(ps_pic_buf == NULL)
  ------------------
  |  Branch (4883:16): [True: 0, False: 0]
  ------------------
 4884|      0|            {
 4885|      0|                UWORD32 display_queued = 0;
 4886|       |
 4887|       |                /* check if any buffer was given for display which is not returned yet */
 4888|      0|                for(i = 0; i < (MAX_DISP_BUFS_NEW); i++)
  ------------------
  |  |   76|      0|#define MAX_DISP_BUFS_NEW 64
  ------------------
  |  Branch (4888:28): [True: 0, False: 0]
  ------------------
 4889|      0|                {
 4890|      0|                    if(0 != ps_dec->u4_disp_buf_mapping[i])
  ------------------
  |  Branch (4890:24): [True: 0, False: 0]
  ------------------
 4891|      0|                    {
 4892|      0|                        display_queued = 1;
 4893|      0|                        break;
 4894|      0|                    }
 4895|      0|                }
 4896|       |                /* If some buffer is queued for display, then codec has to singal an
 4897|       |                 error and wait for that buffer to be returned. If nothing is queued for
 4898|       |                 display then codec has ownership of all display buffers and it can
 4899|       |                 reuse any of the existing buffers and continue decoding */
 4900|       |
 4901|      0|                if(1 == display_queued)
  ------------------
  |  Branch (4901:20): [True: 0, False: 0]
  ------------------
 4902|      0|                {
 4903|       |                    /* If something is queued for display wait for that buffer to be
 4904|       |                     * returned */
 4905|      0|                    ps_dec_op->u4_error_code = IVD_DEC_REF_BUF_NULL;
 4906|      0|                    ps_dec_op->u4_error_code |= (1 << IVD_UNSUPPORTEDPARAM);
 4907|      0|                    return (IV_FAIL);
 4908|      0|                }
 4909|      0|            }
 4910|      0|            else
 4911|      0|            {
 4912|       |                /* If the buffer is with display, then mark it as in use and then look
 4913|       |                 * for a buffer again */
 4914|      0|                if(1 == ps_dec->u4_disp_buf_mapping[free_id])
  ------------------
  |  Branch (4914:20): [True: 0, False: 0]
  ------------------
 4915|      0|                {
 4916|      0|                    ih264_buf_mgr_set_status((buf_mgr_t *) ps_dec->pv_pic_buf_mgr, free_id,
 4917|      0|                                             BUF_MGR_IO);
  ------------------
  |  |   53|      0|#define BUF_MGR_IO           (1 << 3)
  ------------------
 4918|      0|                }
 4919|      0|                else
 4920|      0|                {
 4921|       |                    /**
 4922|       |                     *  Found a free buffer for present call. Release it now.
 4923|       |                     *  Will be again obtained later.
 4924|       |                     */
 4925|      0|                    ih264_buf_mgr_release((buf_mgr_t *) ps_dec->pv_pic_buf_mgr, free_id,
 4926|      0|                                          BUF_MGR_IO);
  ------------------
  |  |   53|      0|#define BUF_MGR_IO           (1 << 3)
  ------------------
 4927|      0|                    break;
 4928|      0|                }
 4929|      0|            }
 4930|      0|        }
 4931|      0|    }
 4932|       |
 4933|  20.3k|    if(ps_dec->u1_enable_mb_info && (ps_dec->i4_header_decoded & DECODED_SPS_MASK))
  ------------------
  |  |  125|      0|#define DECODED_SPS_MASK 1
  ------------------
  |  Branch (4933:8): [True: 0, False: 20.3k]
  |  Branch (4933:37): [True: 0, False: 0]
  ------------------
 4934|      0|    {
 4935|      0|        UWORD32 blk_qp_map_size = ps_h264d_dec_ip->u4_8x8_blk_qp_map_size;
 4936|      0|        UWORD32 blk_type_map_size = ps_h264d_dec_ip->u4_8x8_blk_type_map_size;
 4937|      0|        UWORD32 blk_8x8_map_size = ps_dec->u4_total_mbs << 2;
 4938|      0|        if((ps_h264d_dec_ip->pu1_8x8_blk_qp_map && blk_qp_map_size < blk_8x8_map_size) ||
  ------------------
  |  Branch (4938:13): [True: 0, False: 0]
  |  Branch (4938:52): [True: 0, False: 0]
  ------------------
 4939|      0|           (ps_h264d_dec_ip->pu1_8x8_blk_type_map && blk_type_map_size < blk_8x8_map_size))
  ------------------
  |  Branch (4939:13): [True: 0, False: 0]
  |  Branch (4939:54): [True: 0, False: 0]
  ------------------
 4940|      0|        {
 4941|      0|            ps_dec_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
 4942|      0|            ps_dec_op->u4_error_code |= IH264D_INSUFFICIENT_METADATA_BUFFER;
 4943|      0|            return IV_FAIL;
 4944|      0|        }
 4945|      0|    }
 4946|       |
 4947|  20.3k|    if(ps_dec->u1_flushfrm && (1 == ps_svcd_ctxt->u1_pre_parse_in_flush))
  ------------------
  |  Branch (4947:8): [True: 0, False: 20.3k]
  |  Branch (4947:31): [True: 0, False: 0]
  ------------------
 4948|      0|    {
 4949|      0|        if(ps_dec->u1_init_dec_flag == 0)
  ------------------
  |  Branch (4949:12): [True: 0, False: 0]
  ------------------
 4950|      0|        {
 4951|      0|            ps_dec->u1_flushfrm = 0;
 4952|      0|            return (IV_FAIL);
 4953|      0|        }
 4954|       |
 4955|      0|        ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[ps_svcd_ctxt->s_vcl_nal.i4_num_res_lyrs - 1];
 4956|      0|        ps_dec = &ps_svc_lyr_dec->s_dec;
 4957|      0|        ps_dec->u4_fmt_conv_cur_row = 0;
 4958|      0|        ps_dec->u4_output_present = 0;
 4959|      0|        ps_dec->s_disp_op.u4_error_code = 1;
 4960|       |
 4961|      0|        ps_dec->ps_out_buffer = NULL;
 4962|      0|        if(ps_dec_ip->u4_size >= offsetof(ivd_video_decode_ip_t, s_out_buffer))
  ------------------
  |  Branch (4962:12): [True: 0, False: 0]
  ------------------
 4963|      0|        {
 4964|      0|            ps_dec->ps_out_buffer = &ps_dec_ip->s_out_buffer;
 4965|      0|        }
 4966|      0|        ih264d_get_next_display_field(ps_dec, ps_dec->ps_out_buffer, &(ps_dec->s_disp_op));
 4967|      0|        if(0 == ps_dec->s_disp_op.u4_error_code)
  ------------------
  |  Branch (4967:12): [True: 0, False: 0]
  ------------------
 4968|      0|        {
 4969|       |            /* check output buffer size given by the application */
 4970|      0|            if(check_app_out_buf_size(ps_dec) != IV_SUCCESS)
  ------------------
  |  Branch (4970:16): [True: 0, False: 0]
  ------------------
 4971|      0|            {
 4972|      0|                ps_dec_op->u4_error_code = IVD_DISP_FRM_ZERO_OP_BUF_SIZE;
 4973|      0|                return (IV_FAIL);
 4974|      0|            }
 4975|       |
 4976|      0|            ps_dec->u4_fmt_conv_cur_row = 0;
 4977|      0|            ps_dec->u4_fmt_conv_num_rows = ps_dec->s_disp_frame_info.u4_y_ht;
 4978|      0|            ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op), ps_dec->u4_fmt_conv_cur_row,
 4979|      0|                                  ps_dec->u4_fmt_conv_num_rows);
 4980|      0|            ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
 4981|      0|            ps_dec->u4_output_present = 1;
 4982|      0|            if(ps_dec->u1_enable_mb_info)
  ------------------
  |  Branch (4982:16): [True: 0, False: 0]
  ------------------
 4983|      0|            {
 4984|      0|                UWORD32 disp_buf_id = ps_dec->s_disp_op.u4_disp_buf_id;
 4985|      0|                if(ps_h264d_dec_ip->pu1_8x8_blk_qp_map)
  ------------------
  |  Branch (4985:20): [True: 0, False: 0]
  ------------------
 4986|      0|                {
 4987|      0|                    ps_h264d_dec_op->pu1_8x8_blk_qp_map = ps_h264d_dec_ip->pu1_8x8_blk_qp_map;
 4988|      0|                    ps_h264d_dec_op->u4_8x8_blk_qp_map_size = ps_dec->u4_total_mbs << 2;
 4989|      0|                    memcpy(ps_h264d_dec_op->pu1_8x8_blk_qp_map,
 4990|      0|                                 ps_dec->as_buf_id_info_map[disp_buf_id].pu1_qp_map,
 4991|      0|                                 ps_dec->u4_total_mbs << 2);
 4992|      0|                }
 4993|      0|                if(ps_h264d_dec_ip->pu1_8x8_blk_type_map)
  ------------------
  |  Branch (4993:20): [True: 0, False: 0]
  ------------------
 4994|      0|                {
 4995|      0|                    ps_h264d_dec_op->pu1_8x8_blk_type_map = ps_h264d_dec_ip->pu1_8x8_blk_type_map;
 4996|      0|                    ps_h264d_dec_op->u4_8x8_blk_type_map_size = ps_dec->u4_total_mbs << 2;
 4997|      0|                    memcpy(ps_h264d_dec_op->pu1_8x8_blk_type_map,
 4998|      0|                                 ps_dec->as_buf_id_info_map[disp_buf_id].pu1_mb_type_map,
 4999|      0|                                 ps_dec->u4_total_mbs << 2);
 5000|      0|                }
 5001|      0|            }
 5002|      0|        }
 5003|      0|        ih264d_export_sei_params(&ps_dec_op->s_sei_decode_op, ps_dec);
 5004|       |
 5005|      0|        ih264d_release_display_field(ps_dec, &(ps_dec->s_disp_op));
 5006|       |
 5007|      0|        ps_dec_op->u4_pic_wd = (UWORD32) ps_dec->u2_disp_width;
 5008|      0|        ps_dec_op->u4_pic_ht = (UWORD32) ps_dec->u2_disp_height;
 5009|      0|        ps_dec_op->i4_reorder_depth = ps_dec->i4_reorder_depth;
 5010|      0|        ps_dec_op->i4_display_index = ps_dec->i4_display_index;
 5011|      0|        ps_dec_op->u4_new_seq = 0;
 5012|       |
 5013|      0|        ps_dec_op->u4_output_present = ps_dec->u4_output_present;
 5014|      0|        ps_dec_op->u4_progressive_frame_flag = ps_dec->s_disp_op.u4_progressive_frame_flag;
 5015|      0|        ps_dec_op->e_output_format = ps_dec->s_disp_op.e_output_format;
 5016|      0|        ps_dec_op->s_disp_frm_buf = ps_dec->s_disp_op.s_disp_frm_buf;
 5017|      0|        ps_dec_op->e4_fld_type = ps_dec->s_disp_op.e4_fld_type;
 5018|      0|        ps_dec_op->u4_ts = ps_dec->s_disp_op.u4_ts;
 5019|      0|        ps_dec_op->u4_disp_buf_id = ps_dec->s_disp_op.u4_disp_buf_id;
 5020|       |
 5021|       |        /*In the case of flush ,since no frame is decoded set pic type as invalid*/
 5022|      0|        ps_dec_op->u4_is_ref_flag = UINT32_MAX;
 5023|      0|        ps_dec_op->e_pic_type = IV_NA_FRAME;
 5024|      0|        ps_dec_op->u4_frame_decoded_flag = 0;
 5025|       |
 5026|      0|        if(0 == ps_dec->s_disp_op.u4_error_code)
  ------------------
  |  Branch (5026:12): [True: 0, False: 0]
  ------------------
 5027|      0|        {
 5028|      0|            return (IV_SUCCESS);
 5029|      0|        }
 5030|      0|        else
 5031|      0|            return (IV_FAIL);
 5032|      0|    }
 5033|       |
 5034|  20.3k|    if(ps_dec->u1_res_changed == 1)
  ------------------
  |  Branch (5034:8): [True: 363, False: 20.0k]
  ------------------
 5035|    363|    {
 5036|       |        /*if resolution has changed and all buffers have been flushed, reset
 5037|       |         * decoder*/
 5038|    363|        if(((buf_mgr_t *) ps_dec->pv_pic_buf_mgr)->pv_mutex != NULL)
  ------------------
  |  Branch (5038:12): [True: 18, False: 345]
  ------------------
 5039|     18|            ih264_buf_mgr_free(ps_dec->pv_pic_buf_mgr);
 5040|    363|        if(((buf_mgr_t *) ps_dec->pv_mv_buf_mgr)->pv_mutex != NULL)
  ------------------
  |  Branch (5040:12): [True: 18, False: 345]
  ------------------
 5041|     18|            ih264_buf_mgr_free(ps_dec->pv_mv_buf_mgr);
 5042|       |
 5043|    363|        isvcd_init_decoder(ps_svc_lyr_dec);
 5044|    363|    }
 5045|       |
 5046|  20.3k|    DEBUG_THREADS_PRINTF(" Starting process call\n");
 5047|       |
 5048|  20.3k|    {
 5049|  20.3k|        vcl_node_t *ps_cur_node;
 5050|  20.3k|        UWORD8 u1_num_res_lyrs;
 5051|  20.3k|        vcl_buf_hdr_t *ps_vcl_buf;
 5052|  20.3k|        UWORD8 flush_decode = 1;
 5053|  20.3k|        ps_svcd_ctxt->u1_pre_parse_in_flush = 0;
 5054|       |
 5055|  20.3k|        ret = isvcd_pre_parse_refine_au(ps_svcd_ctxt, ps_dec_ip, &ps_dec_op->u4_num_bytes_consumed);
 5056|  20.3k|        ps_svcd_ctxt->u1_pre_parse_in_flush = (ret == FLUSH);
  ------------------
  |  |   50|  20.3k|#define FLUSH 2
  ------------------
 5057|       |
 5058|  20.3k|        if(ret != OK)
  ------------------
  |  |  114|  20.3k|#define OK        0
  ------------------
  |  Branch (5058:12): [True: 4.23k, False: 16.1k]
  ------------------
 5059|  4.23k|        {
 5060|  4.23k|            UWORD32 error = ih264d_map_error((UWORD32) ret);
 5061|  4.23k|            if(ret != NOT_OK)
  ------------------
  |  |  116|  4.23k|#define NOT_OK    -1
  ------------------
  |  Branch (5061:16): [True: 959, False: 3.27k]
  ------------------
 5062|    959|            {
 5063|    959|                ps_dec_op->u4_error_code = error | ret;
 5064|    959|            }
 5065|  4.23k|            if((ps_dec_op->u4_error_code >> IVD_FATALERROR) & 1)
  ------------------
  |  Branch (5065:16): [True: 48, False: 4.18k]
  ------------------
 5066|     48|            {
 5067|     48|                ps_svcd_ctxt->u1_exit_till_next_IDR = 1;
 5068|     48|            }
 5069|  4.23k|            api_ret_value = IV_FAIL;
 5070|  4.23k|            if((ret == IVD_RES_CHANGED) || (ret == IVD_MEM_ALLOC_FAILED) ||
  ------------------
  |  Branch (5070:16): [True: 702, False: 3.52k]
  |  Branch (5070:44): [True: 0, False: 3.52k]
  ------------------
 5071|  3.52k|               (ret == ERROR_UNAVAIL_PICBUF_T) || (ret == ERROR_UNAVAIL_MVBUF_T) ||
  ------------------
  |  Branch (5071:16): [True: 0, False: 3.52k]
  |  Branch (5071:51): [True: 0, False: 3.52k]
  ------------------
 5072|  3.52k|               (ret == ERROR_INV_SPS_PPS_T) || (ret == ERROR_FEATURE_UNAVAIL) ||
  ------------------
  |  Branch (5072:16): [True: 39, False: 3.48k]
  |  Branch (5072:48): [True: 35, False: 3.45k]
  ------------------
 5073|  3.45k|               (ret == IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED) ||
  ------------------
  |  Branch (5073:16): [True: 13, False: 3.44k]
  ------------------
 5074|  3.44k|               (ret == IVD_DISP_FRM_ZERO_OP_BUF_SIZE))
  ------------------
  |  Branch (5074:16): [True: 0, False: 3.44k]
  ------------------
 5075|    789|            {
 5076|    789|                ps_dec->u4_slice_start_code_found = 0;
 5077|    789|            }
 5078|  4.23k|            if((ret == ERROR_INCOMPLETE_FRAME) || (ret == ERROR_DANGLING_FIELD_IN_PIC))
  ------------------
  |  Branch (5078:16): [True: 0, False: 4.23k]
  |  Branch (5078:51): [True: 0, False: 4.23k]
  ------------------
 5079|      0|            {
 5080|      0|                api_ret_value = IV_FAIL;
 5081|      0|            }
 5082|       |
 5083|  4.23k|            if(ret == ERROR_IN_LAST_SLICE_OF_PIC)
  ------------------
  |  Branch (5083:16): [True: 0, False: 4.23k]
  ------------------
 5084|      0|            {
 5085|      0|                api_ret_value = IV_FAIL;
 5086|      0|            }
 5087|  4.23k|        }
 5088|       |
 5089|  20.3k|        if(NOT_OK == ret)
  ------------------
  |  |  116|  20.3k|#define NOT_OK    -1
  ------------------
  |  Branch (5089:12): [True: 3.27k, False: 17.1k]
  ------------------
 5090|  3.27k|        {
 5091|  3.27k|            if(ps_dec->u4_pic_buf_got == 0)
  ------------------
  |  Branch (5091:16): [True: 2.69k, False: 578]
  ------------------
 5092|  2.69k|            {
 5093|  2.69k|                ps_dec->i4_error_code = ERROR_START_CODE_NOT_FOUND;
 5094|  2.69k|                ps_dec_op->u4_error_code |= 1 << IVD_INSUFFICIENTDATA;
 5095|       |
 5096|  2.69k|                isvcd_fill_output_struct_from_context(ps_svc_lyr_dec, ps_dec_op);
 5097|       |
 5098|  2.69k|                ps_dec_op->u4_error_code = ps_dec->i4_error_code;
 5099|  2.69k|                ps_dec_op->u4_frame_decoded_flag = 0;
 5100|  2.69k|                return (IV_FAIL);
 5101|  2.69k|            }
 5102|    578|            return (IV_SUCCESS);
 5103|  3.27k|        }
 5104|       |
 5105|  17.1k|        u1_num_res_lyrs = ps_svcd_ctxt->s_vcl_nal.i4_num_res_lyrs;
 5106|       |
 5107|       |        /* error concelment: exit till next IDR if any of Non Target layers are
 5108|       |         * corrupted */
 5109|  17.1k|        {
 5110|  17.1k|            ps_cur_node = ps_svcd_ctxt->s_vcl_nal.ps_bot_node;
 5111|       |
 5112|  17.1k|            if(NULL != ps_cur_node)
  ------------------
  |  Branch (5112:16): [True: 5.80k, False: 11.3k]
  ------------------
 5113|  5.80k|            {
 5114|  5.80k|                if(!ps_cur_node->i4_idr_pic_flag)
  ------------------
  |  Branch (5114:20): [True: 1.30k, False: 4.49k]
  ------------------
 5115|  1.30k|                {
 5116|  1.30k|                    if(u1_num_res_lyrs != ps_svcd_ctxt->u1_prev_num_res_layers)
  ------------------
  |  Branch (5116:24): [True: 135, False: 1.17k]
  ------------------
 5117|    135|                    {
 5118|    135|                        ps_svcd_ctxt->u1_exit_till_next_IDR = 1;
 5119|    135|                        ps_dec_op->u4_error_code = ERROR_UNKNOWN_NAL;
 5120|    135|                        return IV_FAIL;
 5121|    135|                    }
 5122|  1.30k|                }
 5123|  4.49k|                else
 5124|  4.49k|                {
 5125|  4.49k|                    if(u1_num_res_lyrs != ps_svcd_ctxt->u1_prev_num_res_layers)
  ------------------
  |  Branch (5125:24): [True: 1.10k, False: 3.39k]
  ------------------
 5126|  1.10k|                    {
 5127|  1.10k|                        ps_svcd_ctxt->u1_prev_num_res_layers = u1_num_res_lyrs;
 5128|  1.10k|                    }
 5129|  4.49k|                }
 5130|  5.80k|            }
 5131|  17.1k|        }
 5132|  16.9k|        if(ps_svcd_ctxt->u1_prev_num_res_layers != u1_num_res_lyrs && (u1_num_res_lyrs != 0))
  ------------------
  |  Branch (5132:12): [True: 11.3k, False: 5.67k]
  |  Branch (5132:71): [True: 0, False: 11.3k]
  ------------------
 5133|      0|        {
 5134|      0|            ps_svc_lyr_dec = ps_svcd_ctxt->ps_svc_dec_lyr + u1_num_res_lyrs - 1;
 5135|      0|            ps_dec = &ps_svc_lyr_dec->s_dec;
 5136|       |
 5137|      0|            if(ps_dec->u1_init_dec_flag == 1)
  ------------------
  |  Branch (5137:16): [True: 0, False: 0]
  ------------------
 5138|      0|            {
 5139|      0|                ih264d_release_pics_in_dpb((void *) ps_dec, ps_dec->u1_pic_bufs);
 5140|      0|                ih264d_release_display_bufs(ps_dec);
 5141|      0|                ih264_disp_mgr_init((disp_mgr_t *) ps_dec->pv_disp_buf_mgr);
 5142|       |
 5143|      0|                ih264_buf_mgr_reset(ps_dec->pv_pic_buf_mgr);
 5144|      0|                ih264_buf_mgr_reset(ps_dec->pv_mv_buf_mgr);
 5145|      0|                ih264d_init_ref_bufs(ps_dec->ps_dpb_mgr);
 5146|      0|            }
 5147|       |
 5148|       |            // ps_svcd_ctxt->u1_prev_num_res_layers = u1_num_res_lyrs;
 5149|      0|        }
 5150|  16.9k|        ps_svcd_ctxt->u1_parse_nal_unit_error = 0;
 5151|       |
 5152|  16.9k|        if((1 == ps_svcd_ctxt->u1_exit_till_next_IDR) &&
  ------------------
  |  Branch (5152:12): [True: 2.54k, False: 14.4k]
  ------------------
 5153|  2.54k|           (ps_svcd_ctxt->s_vcl_nal.ps_bot_node != NULL))
  ------------------
  |  Branch (5153:12): [True: 2.54k, False: 0]
  ------------------
 5154|  2.54k|        {
 5155|  2.54k|            if(1 == ps_svcd_ctxt->s_vcl_nal.ps_bot_node->i4_idr_pic_flag)
  ------------------
  |  Branch (5155:16): [True: 2.08k, False: 454]
  ------------------
 5156|  2.08k|            {
 5157|  2.08k|                ps_svcd_ctxt->u1_exit_till_next_IDR = 0;
 5158|       |
 5159|  5.47k|                for(u1_res_id = 0; u1_res_id < u1_num_res_lyrs; u1_res_id++)
  ------------------
  |  Branch (5159:36): [True: 3.38k, False: 2.08k]
  ------------------
 5160|  3.38k|                {
 5161|  3.38k|                    ps_svc_lyr_dec = ps_svcd_ctxt->ps_svc_dec_lyr + u1_res_id;
 5162|  3.38k|                    ps_dec = &ps_svc_lyr_dec->s_dec;
 5163|  3.38k|                    ih264_buf_mgr_reset(ps_dec->pv_pic_buf_mgr);
 5164|  3.38k|                    ih264_buf_mgr_reset(ps_dec->pv_mv_buf_mgr);
 5165|  3.38k|                }
 5166|  2.08k|            }
 5167|    454|            else
 5168|    454|            {
 5169|    454|                ps_dec_op->u4_error_code = ERROR_UNKNOWN_NAL;
 5170|    454|                return IV_FAIL;
 5171|    454|            }
 5172|  2.54k|        }
 5173|       |
 5174|  16.5k|        if((0 == ps_dec->i4_decode_header) && (OK == ret))
  ------------------
  |  |  114|  5.21k|#define OK        0
  ------------------
  |  Branch (5174:12): [True: 5.21k, False: 11.3k]
  |  Branch (5174:47): [True: 4.36k, False: 854]
  ------------------
 5175|  4.36k|        {
 5176|  4.36k|            flush_decode = 0;
 5177|  4.36k|            ps_cur_node = ps_svcd_ctxt->s_vcl_nal.ps_bot_node;
 5178|  4.36k|            ps_svc_lyr_zero_dec = ps_svcd_ctxt->ps_svc_dec_lyr;
 5179|  4.36k|            ps_dec_zero_lyr = &ps_svc_lyr_zero_dec->s_dec;
 5180|       |            /* master loop */
 5181|       |
 5182|  7.78k|            for(u1_res_id = 0; u1_res_id < u1_num_res_lyrs; u1_res_id++)
  ------------------
  |  Branch (5182:32): [True: 5.48k, False: 2.29k]
  ------------------
 5183|  5.48k|            {
 5184|  5.48k|                UWORD8 u1_layer_nal_data_present = 0;
 5185|  5.48k|                ps_svcd_ctxt->u1_cur_layer_id = u1_res_id;
 5186|  5.48k|                ps_svc_lyr_dec = ps_svcd_ctxt->ps_svc_dec_lyr + u1_res_id;
 5187|  5.48k|                ps_svc_lyr_dec->u1_res_init_done = 0;
 5188|  5.48k|                ps_dec = &ps_svc_lyr_dec->s_dec;
 5189|       |
 5190|  5.48k|                ps_dec->i4_decode_header = ps_dec_zero_lyr->i4_decode_header;
 5191|  5.48k|                ps_dec->i4_header_decoded = ps_dec_zero_lyr->i4_header_decoded;
 5192|  5.48k|                ps_dec->u1_pic_decode_done = 0;
 5193|  5.48k|                ps_dec->u4_fmt_conv_cur_row = 0;
 5194|       |
 5195|  5.48k|                ps_dec->u4_output_present = 0;
 5196|  5.48k|                ps_dec->s_disp_op.u4_error_code = 1;
 5197|  5.48k|                ps_dec->u4_fmt_conv_num_rows = FMT_CONV_NUM_ROWS;
  ------------------
  |  |   46|  5.48k|#define FMT_CONV_NUM_ROWS       16
  ------------------
 5198|  5.48k|                ps_dec->u4_ts = ps_dec_ip->u4_ts;
 5199|  5.48k|                ps_dec->i4_frametype = IV_NA_FRAME;
 5200|  5.48k|                ps_dec->i4_content_type = IV_CONTENTTYPE_NA;
 5201|       |
 5202|  5.48k|                ps_dec->u4_slice_start_code_found = 0;
 5203|  5.48k|                ps_dec->u4_cur_mb_addr = 0;
 5204|  5.48k|                ps_dec->u4_total_mbs_coded = 0;
 5205|  5.48k|                ps_dec->u2_cur_slice_num = 0;
 5206|  5.48k|                ps_dec->cur_dec_mb_num = 0;
 5207|  5.48k|                ps_dec->cur_recon_mb_num = 0;
 5208|  5.48k|                ps_dec->u4_first_slice_in_pic = 1;
 5209|  5.48k|                ps_dec->u1_slice_header_done = 0;
 5210|  5.48k|                ps_dec->u1_dangling_field = 0;
 5211|       |
 5212|  5.48k|                ps_dec->u4_dec_thread_created = 0;
 5213|  5.48k|                ps_dec->u4_bs_deblk_thread_created = 0;
 5214|  5.48k|                ps_dec->u4_cur_bs_mb_num = 0;
 5215|  5.48k|                ps_dec->u4_cur_deblk_mb_num = 0;
 5216|  5.48k|                ps_dec->u4_start_recon_deblk = 0;
 5217|  5.48k|                ps_dec->u4_sps_cnt_in_process = 0;
 5218|  5.48k|                ps_dec->u4_pic_buf_got = 0;
 5219|  5.48k|                ps_dec->pv_dec_out = ps_dec_op;
 5220|       |
 5221|  5.48k|                if(ps_dec_ip->u4_size >= offsetof(ivd_video_decode_ip_t, s_out_buffer))
  ------------------
  |  Branch (5221:20): [True: 5.48k, False: 0]
  ------------------
 5222|  5.48k|                    ps_dec->ps_out_buffer = &ps_dec_ip->s_out_buffer;
 5223|       |
 5224|  5.48k|                ps_dec->u1_nal_unit_type = ps_cur_node->i4_nal_unit_type;
 5225|  5.48k|                ps_dec->u1_separate_parse = 0;
 5226|  5.48k|                if(u1_res_id == (u1_num_res_lyrs - 1))
  ------------------
  |  Branch (5226:20): [True: 3.60k, False: 1.88k]
  ------------------
 5227|  3.60k|                {
 5228|  3.60k|                    ps_svc_lyr_dec->u1_layer_identifier = TARGET_LAYER;
  ------------------
  |  |  110|  3.60k|#define TARGET_LAYER 2
  ------------------
 5229|  3.60k|                    if(ps_dec->u4_num_cores >= 2)
  ------------------
  |  Branch (5229:24): [True: 1.09k, False: 2.51k]
  ------------------
 5230|  1.09k|                    {
 5231|  1.09k|                        ps_dec->u4_num_cores = 2;
 5232|  1.09k|                        ps_dec->u1_separate_parse = 1;
 5233|  1.09k|                    }
 5234|  3.60k|                }
 5235|  1.88k|                else if(u1_res_id == 0)
  ------------------
  |  Branch (5235:25): [True: 1.88k, False: 0]
  ------------------
 5236|  1.88k|                {
 5237|  1.88k|                    ps_svc_lyr_dec->u1_layer_identifier = BASE_LAYER;
  ------------------
  |  |  108|  1.88k|#define BASE_LAYER 0
  ------------------
 5238|  1.88k|                    ps_dec->u1_separate_parse = 0;
 5239|  1.88k|                    ps_dec->u4_num_cores = 1;
 5240|  1.88k|                }
 5241|      0|                else if(u1_res_id != 0)
  ------------------
  |  Branch (5241:25): [True: 0, False: 0]
  ------------------
 5242|      0|                {
 5243|      0|                    ps_svc_lyr_dec->u1_layer_identifier = MEDIAL_ENHANCEMENT_LAYER;
  ------------------
  |  |  109|      0|#define MEDIAL_ENHANCEMENT_LAYER 1
  ------------------
 5244|      0|                    ps_dec->u1_separate_parse = 0;
 5245|      0|                    ps_dec->u4_num_cores = 1;
 5246|      0|                }
 5247|      0|                else
 5248|      0|                {
 5249|      0|                    return IV_FAIL;
 5250|      0|                }
 5251|       |
 5252|  5.48k|                ps_svc_lyr_dec->u1_base_res_flag = (0 == u1_res_id);
 5253|  5.48k|                ps_svc_lyr_dec->ps_nal_svc_ext->u1_idr_flag = ps_cur_node->i4_idr_pic_flag;
 5254|  5.48k|                ps_svc_lyr_dec->ps_nal_svc_ext->u1_dependency_id = ps_cur_node->i4_dependency_id;
 5255|  5.48k|                ps_svc_lyr_dec->ps_nal_svc_ext->u1_priority_id = ps_cur_node->i4_priority_id;
 5256|  5.48k|                ps_svc_lyr_dec->ps_nal_svc_ext->u1_no_inter_layer_pred_flag =
 5257|  5.48k|                    ps_cur_node->u1_acc_no_int_pred;
 5258|       |
 5259|  5.48k|                ps_svc_lyr_dec->ps_nal_svc_ext->u1_quality_id = ps_cur_node->i4_quality_id;
 5260|  5.48k|                ps_svc_lyr_dec->ps_nal_svc_ext->u1_temporal_id = ps_cur_node->i4_temporal_id;
 5261|       |
 5262|  5.48k|                ps_svc_lyr_dec->ps_nal_svc_ext->u1_use_ref_base_pic_flag =
 5263|  5.48k|                    ps_cur_node->i4_use_ref_base;
 5264|  5.48k|                ps_svc_lyr_dec->ps_nal_svc_ext->u1_discardable_flag = 0;
 5265|  5.48k|                ps_svc_lyr_dec->ps_nal_svc_ext->u1_svc_ext_flag = (u1_res_id > 1);
 5266|  5.48k|                ps_svc_lyr_dec->u4_pps_id_for_layer = UINT32_MAX;
 5267|  5.48k|                ps_vcl_buf = ps_cur_node->ps_first_vcl_nal;
 5268|  5.48k|                ps_svc_lyr_dec->u1_error_in_cur_frame = 0;
 5269|       |
 5270|       |                /* Only for Non target Layers*/
 5271|  5.48k|                if(NULL != ps_cur_node->ps_top_node)
  ------------------
  |  Branch (5271:20): [True: 2.79k, False: 2.69k]
  ------------------
 5272|  2.79k|                {
 5273|  2.79k|                    ps_svc_lyr_dec->u1_inter_lyr_disable_dblk_filter_idc =
 5274|  2.79k|                        ps_cur_node->ps_top_node->i4_inter_lyr_dblk_idc;
 5275|  2.79k|                    ps_svc_lyr_dec->i1_inter_lyr_slice_alpha_c0_offset =
 5276|  2.79k|                        ps_cur_node->ps_top_node->i4_inter_lyr_alpha_c0_offset;
 5277|  2.79k|                    ps_svc_lyr_dec->i1_inter_lyr_slice_beta_offset =
 5278|  2.79k|                        ps_cur_node->ps_top_node->i4_inter_lyr_beta_offset;
 5279|  2.79k|                }
 5280|       |
 5281|  7.83k|                while(NULL != ps_vcl_buf)
  ------------------
  |  Branch (5281:23): [True: 5.91k, False: 1.92k]
  ------------------
 5282|  5.91k|                {
 5283|  5.91k|                    u1_layer_nal_data_present = 1;
 5284|  5.91k|                    ps_dec->ps_bitstrm->u4_ofst = 0;
 5285|  5.91k|                    ps_dec->ps_bitstrm->pu4_buffer =
 5286|  5.91k|                        (UWORD32 *) ((UWORD8 *) ps_vcl_buf + ps_vcl_buf->i4_buf_offset +
 5287|  5.91k|                                     ps_vcl_buf->i4_slice_offset);
 5288|       |
 5289|  5.91k|                    ps_dec->ps_bitstrm->u4_max_ofst = ps_vcl_buf->u4_max_bits;
 5290|       |
 5291|  5.91k|                    ps_dec_op->u4_frame_decoded_flag = 0;
 5292|  5.91k|                    ret = isvcd_parse_nal_unit(ps_svc_lyr_dec, ps_cur_node->i4_nal_ref_idc);
 5293|  5.91k|                    if(ret != OK)
  ------------------
  |  |  114|  5.91k|#define OK        0
  ------------------
  |  Branch (5293:24): [True: 3.56k, False: 2.34k]
  ------------------
 5294|  3.56k|                    {
 5295|  3.56k|                        ps_svcd_ctxt->u1_parse_nal_unit_error = 1;
 5296|  3.56k|                        break;
 5297|  3.56k|                    }
 5298|       |
 5299|       |                    /* go to the next slice */
 5300|  2.34k|                    ps_vcl_buf = ps_vcl_buf->ps_next;
 5301|  2.34k|                }
 5302|       |                /* error concelment: exit till next IDR if a Layer data is missing */
 5303|  5.48k|                if(0 == u1_layer_nal_data_present)
  ------------------
  |  Branch (5303:20): [True: 216, False: 5.27k]
  ------------------
 5304|    216|                {
 5305|    216|                    ps_svcd_ctxt->u1_exit_till_next_IDR = 1;
 5306|    216|                    ps_dec_op->u4_error_code = ERROR_UNKNOWN_NAL;
 5307|    216|                    return IV_FAIL;
 5308|    216|                }
 5309|       |                /* error concelment: exit till next IDR if any of Non Target layers are
 5310|       |                 * corrupted */
 5311|  5.27k|                if((ret != OK) && (u1_res_id != (u1_num_res_lyrs - 1)))
  ------------------
  |  |  114|  5.27k|#define OK        0
  ------------------
  |  Branch (5311:20): [True: 3.56k, False: 1.70k]
  |  Branch (5311:35): [True: 751, False: 2.81k]
  ------------------
 5312|    751|                {
 5313|    751|                    ps_svcd_ctxt->u1_exit_till_next_IDR = 1;
 5314|    751|                    ps_dec_op->u4_error_code = ERROR_UNKNOWN_NAL;
 5315|    751|                    return IV_FAIL;
 5316|    751|                }
 5317|       |
 5318|  4.51k|                if((ret != OK) && (u1_res_id == (u1_num_res_lyrs - 1)))
  ------------------
  |  |  114|  4.51k|#define OK        0
  ------------------
  |  Branch (5318:20): [True: 2.81k, False: 1.70k]
  |  Branch (5318:35): [True: 2.81k, False: 0]
  ------------------
 5319|  2.81k|                {
 5320|  2.81k|                    ps_svc_lyr_dec = ps_svcd_ctxt->ps_svc_dec_lyr + u1_num_res_lyrs - 1;
 5321|  2.81k|                    ps_dec = &ps_svc_lyr_dec->s_dec;
 5322|       |
 5323|  2.81k|                    if((0 == ps_svcd_ctxt->u4_num_sps_ctr) || (0 == ps_svcd_ctxt->u4_num_pps_ctr) ||
  ------------------
  |  Branch (5323:24): [True: 0, False: 2.81k]
  |  Branch (5323:63): [True: 0, False: 2.81k]
  ------------------
 5324|  2.81k|                       (NULL == ps_dec->ps_cur_pps) || (ps_svc_lyr_dec->u1_res_init_done == 0))
  ------------------
  |  Branch (5324:24): [True: 211, False: 2.60k]
  |  Branch (5324:56): [True: 864, False: 1.74k]
  ------------------
 5325|  1.07k|                    {
 5326|  1.07k|                        ps_svcd_ctxt->u1_exit_till_next_IDR = 1;
 5327|  1.07k|                        ps_dec_op->u4_error_code = ERROR_UNKNOWN_NAL;
 5328|  1.07k|                        ih264d_signal_decode_thread(ps_dec);
 5329|  1.07k|                        return IV_FAIL;
 5330|  1.07k|                    }
 5331|  2.81k|                }
 5332|  3.44k|                ps_cur_node = ps_cur_node->ps_top_node;
 5333|       |
 5334|  3.44k|                if((ps_dec->u4_pic_buf_got == 1) && (ret != IVD_MEM_ALLOC_FAILED) &&
  ------------------
  |  Branch (5334:20): [True: 3.44k, False: 0]
  |  Branch (5334:53): [True: 3.44k, False: 0]
  ------------------
 5335|  3.44k|                   ps_dec->u4_total_mbs_coded < ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs)
  ------------------
  |  Branch (5335:20): [True: 2.03k, False: 1.41k]
  ------------------
 5336|  2.03k|                {
 5337|       |                    // last slice - missing/corruption
 5338|  2.03k|                    WORD32 num_mb_skipped;
 5339|  2.03k|                    WORD32 prev_slice_err;
 5340|  2.03k|                    pocstruct_t temp_poc;
 5341|  2.03k|                    WORD32 ret1;
 5342|  2.03k|                    WORD32 ht_in_mbs;
 5343|  2.03k|                    ht_in_mbs = ps_dec->u2_pic_ht >> (4 + ps_dec->ps_cur_slice->u1_field_pic_flag);
 5344|  2.03k|                    num_mb_skipped =
 5345|  2.03k|                        (ht_in_mbs * ps_dec->u2_frm_wd_in_mbs) - ps_dec->u4_total_mbs_coded;
 5346|       |
 5347|  2.03k|                    if(ps_dec->u4_first_slice_in_pic && (ps_dec->u4_pic_buf_got == 0))
  ------------------
  |  Branch (5347:24): [True: 0, False: 2.03k]
  |  Branch (5347:57): [True: 0, False: 0]
  ------------------
 5348|      0|                        prev_slice_err = 1;
 5349|  2.03k|                    else
 5350|  2.03k|                        prev_slice_err = 2;
 5351|       |
 5352|  2.03k|                    if(ps_dec->u4_total_mbs_coded == 0)
  ------------------
  |  Branch (5352:24): [True: 1.08k, False: 947]
  ------------------
 5353|  1.08k|                    {
 5354|  1.08k|                        prev_slice_err = 1;
 5355|  1.08k|                    }
 5356|  2.03k|                    ret1 = isvcd_mark_err_slice_skip(
 5357|  2.03k|                        ps_svc_lyr_dec, num_mb_skipped, ps_dec->u1_nal_unit_type == IDR_SLICE_NAL,
  ------------------
  |  |  328|  2.03k|#define IDR_SLICE_NAL                   5
  ------------------
 5358|  2.03k|                        ps_dec->ps_cur_slice->u2_frame_num, &temp_poc, prev_slice_err);
 5359|       |
 5360|  2.03k|                    if((ret1 == ERROR_UNAVAIL_PICBUF_T) || (ret1 == ERROR_UNAVAIL_MVBUF_T) ||
  ------------------
  |  Branch (5360:24): [True: 0, False: 2.03k]
  |  Branch (5360:60): [True: 0, False: 2.03k]
  ------------------
 5361|  2.03k|                       (ret1 == ERROR_INV_SPS_PPS_T) || (ret1 == ERROR_CORRUPTED_SLICE) ||
  ------------------
  |  Branch (5361:24): [True: 0, False: 2.03k]
  |  Branch (5361:57): [True: 0, False: 2.03k]
  ------------------
 5362|  2.03k|                       (ret == NOT_OK))
  ------------------
  |  |  116|  2.03k|#define NOT_OK    -1
  ------------------
  |  Branch (5362:24): [True: 2, False: 2.03k]
  ------------------
 5363|      2|                    {
 5364|      2|                        ret = ret1;
 5365|      2|                    }
 5366|  2.03k|                }
 5367|       |
 5368|  3.44k|                if((ret == IVD_RES_CHANGED) || (ret == IVD_MEM_ALLOC_FAILED) ||
  ------------------
  |  Branch (5368:20): [True: 0, False: 3.44k]
  |  Branch (5368:48): [True: 0, False: 3.44k]
  ------------------
 5369|  3.44k|                   (ret == ERROR_UNAVAIL_PICBUF_T) || (ret == ERROR_UNAVAIL_MVBUF_T) ||
  ------------------
  |  Branch (5369:20): [True: 0, False: 3.44k]
  |  Branch (5369:55): [True: 0, False: 3.44k]
  ------------------
 5370|  3.44k|                   (ret == ERROR_INV_SPS_PPS_T) || (ret == ERROR_CORRUPTED_SLICE) ||
  ------------------
  |  Branch (5370:20): [True: 0, False: 3.44k]
  |  Branch (5370:52): [True: 23, False: 3.42k]
  ------------------
 5371|  3.42k|                   (ret == IVD_DISP_FRM_ZERO_OP_BUF_SIZE) || (ret == NOT_OK))
  ------------------
  |  |  116|  3.42k|#define NOT_OK    -1
  ------------------
  |  Branch (5371:20): [True: 0, False: 3.42k]
  |  Branch (5371:62): [True: 0, False: 3.42k]
  ------------------
 5372|     23|                {
 5373|     23|                    ps_svcd_ctxt->u1_exit_till_next_IDR = 1;
 5374|       |                    /* signal the decode thread */
 5375|     23|                    ih264d_signal_decode_thread(ps_dec);
 5376|       |                    /* dont consume bitstream for change in resolution case */
 5377|     23|                    if(ret == IVD_RES_CHANGED)
  ------------------
  |  Branch (5377:24): [True: 0, False: 23]
  ------------------
 5378|      0|                    {
 5379|      0|                        ps_dec_op->u4_num_bytes_consumed -= bytes_consumed;
 5380|      0|                    }
 5381|     23|                    return IV_FAIL;
 5382|     23|                }
 5383|       |
 5384|       |                /* Multi thread - for target Layer decoding*/
 5385|  3.42k|                if((ps_dec->u1_separate_parse) &&
  ------------------
  |  Branch (5385:20): [True: 835, False: 2.58k]
  ------------------
 5386|    835|                   (ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER) &&
  ------------------
  |  |  110|    835|#define TARGET_LAYER 2
  ------------------
  |  Branch (5386:20): [True: 835, False: 0]
  ------------------
 5387|    835|                   (0 == ps_svc_lyr_dec->u1_error_in_cur_frame))
  ------------------
  |  Branch (5387:20): [True: 258, False: 577]
  ------------------
 5388|    258|                {
 5389|       |                    /* If Format conversion is not complete,
 5390|       |                     complete it here */
 5391|    258|                    if(ps_dec->u4_num_cores == 2)
  ------------------
  |  Branch (5391:24): [True: 258, False: 0]
  ------------------
 5392|    258|                    {
 5393|       |                        /*do deblocking of all mbs*/
 5394|    258|                        if((ps_dec->u4_nmb_deblk == 0) && (ps_dec->u4_start_recon_deblk == 1) &&
  ------------------
  |  Branch (5394:28): [True: 258, False: 0]
  |  Branch (5394:59): [True: 258, False: 0]
  ------------------
 5395|    258|                           (ps_dec->ps_cur_sps->u1_mb_aff_flag == 0))
  ------------------
  |  Branch (5395:28): [True: 258, False: 0]
  ------------------
 5396|    258|                        {
 5397|    258|                            UWORD8 u1_end_of_row = 0;
 5398|    258|                            UWORD32 u4_max_addr;
 5399|    258|                            tfr_ctxt_t s_tfr_ctxt = {0};
 5400|    258|                            tfr_ctxt_t *ps_tfr_cxt = &s_tfr_ctxt;
 5401|    258|                            pad_mgr_t *ps_pad_mgr = &ps_dec->s_pad_mgr;
 5402|    258|                            UWORD32 u4_slice_end = 0;
 5403|       |
 5404|       |                            /*BS is done for all mbs while parsing*/
 5405|    258|                            u4_max_addr = (ps_dec->u2_frm_wd_in_mbs * ps_dec->u2_frm_ht_in_mbs) - 1;
 5406|       |                            /* BS is moved post recon gen in SVC ext*/
 5407|       |
 5408|    258|                            ih264d_init_deblk_tfr_ctxt(ps_dec, ps_pad_mgr, ps_tfr_cxt,
 5409|    258|                                                       ps_dec->u2_frm_wd_in_mbs, 0);
 5410|       |
 5411|    258|                            {
 5412|   464k|                                while(u4_slice_end != 1)
  ------------------
  |  Branch (5412:39): [True: 464k, False: 258]
  ------------------
 5413|   464k|                                {
 5414|   464k|                                    dec_mb_info_t *p_cur_mb;
 5415|   464k|                                    WORD32 i, bs_mb_grp;
 5416|   464k|                                    bs_mb_grp = ps_dec->cur_dec_mb_num - ps_dec->u4_cur_bs_mb_num;
 5417|       |
 5418|   477k|                                    for(i = 0; i < bs_mb_grp; i++)
  ------------------
  |  Branch (5418:48): [True: 13.1k, False: 464k]
  ------------------
 5419|  13.1k|                                    {
 5420|  13.1k|                                        p_cur_mb =
 5421|  13.1k|                                            &ps_dec->ps_frm_mb_info[ps_dec->u4_cur_bs_mb_num];
 5422|       |
 5423|  13.1k|                                        DEBUG_THREADS_PRINTF("ps_dec->u4_cur_bs_mb_num = %d\n",
 5424|  13.1k|                                                             ps_dec->u4_cur_bs_mb_num);
 5425|  13.1k|                                        isvcd_compute_bs_non_mbaff_thread(ps_svc_lyr_dec, p_cur_mb,
 5426|  13.1k|                                                                          ps_dec->u4_cur_bs_mb_num);
 5427|       |
 5428|  13.1k|                                        ps_dec->u4_cur_bs_mb_num++;
 5429|  13.1k|                                        ps_dec->u4_bs_cur_slice_num_mbs++;
 5430|  13.1k|                                    }
 5431|   464k|                                    if(ps_dec->u4_cur_bs_mb_num > u4_max_addr)
  ------------------
  |  Branch (5431:40): [True: 258, False: 463k]
  ------------------
 5432|    258|                                    {
 5433|    258|                                        u4_slice_end = 1;
 5434|    258|                                        u1_end_of_row = 1;
 5435|    258|                                    }
 5436|       |                                    /*deblock MB group*/
 5437|   464k|                                    {
 5438|   464k|                                        UWORD32 u4_num_mbs;
 5439|       |
 5440|   464k|                                        if(ps_dec->u4_cur_bs_mb_num > ps_dec->u4_cur_deblk_mb_num)
  ------------------
  |  Branch (5440:44): [True: 321k, False: 142k]
  ------------------
 5441|   321k|                                        {
 5442|   321k|                                            if(u1_end_of_row)
  ------------------
  |  Branch (5442:48): [True: 258, False: 321k]
  ------------------
 5443|    258|                                            {
 5444|    258|                                                u4_num_mbs = ps_dec->u4_cur_bs_mb_num -
 5445|    258|                                                             ps_dec->u4_cur_deblk_mb_num;
 5446|    258|                                            }
 5447|   321k|                                            else
 5448|   321k|                                            {
 5449|   321k|                                                u4_num_mbs = ps_dec->u4_cur_bs_mb_num -
 5450|   321k|                                                             ps_dec->u4_cur_deblk_mb_num - 1;
 5451|   321k|                                            }
 5452|   321k|                                        }
 5453|   142k|                                        else
 5454|   142k|                                            u4_num_mbs = 0;
 5455|       |
 5456|   464k|                                        ih264d_check_mb_map_deblk(ps_dec, u4_num_mbs, ps_tfr_cxt,
 5457|   464k|                                                                  0);
 5458|   464k|                                    }
 5459|   464k|                                }
 5460|    258|                            }
 5461|    258|                        }
 5462|    258|                    }
 5463|       |
 5464|       |                    /*signal the decode thread*/
 5465|    258|                    ih264d_signal_decode_thread(ps_dec);
 5466|    258|                }
 5467|  3.16k|                else if((ps_dec->u1_separate_parse) &&
  ------------------
  |  Branch (5467:25): [True: 577, False: 2.58k]
  ------------------
 5468|    577|                        (ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER))
  ------------------
  |  |  110|    577|#define TARGET_LAYER 2
  ------------------
  |  Branch (5468:25): [True: 577, False: 0]
  ------------------
 5469|    577|                {
 5470|       |                    /*signal the decode thread*/
 5471|    577|                    ih264d_signal_decode_thread(ps_dec);
 5472|    577|                }
 5473|       |
 5474|  3.42k|                DATA_SYNC();
  ------------------
  |  |  116|  3.42k|#define DATA_SYNC()  __sync_synchronize()
  ------------------
 5475|       |
 5476|  3.42k|                if((ps_dec_op->u4_error_code & 0xff) != ERROR_DYNAMIC_RESOLUTION_NOT_SUPPORTED)
  ------------------
  |  Branch (5476:20): [True: 3.42k, False: 0]
  ------------------
 5477|  3.42k|                {
 5478|  3.42k|                    ps_dec_op->u4_pic_wd = (UWORD32) ps_dec->u2_disp_width;
 5479|  3.42k|                    ps_dec_op->u4_pic_ht = (UWORD32) ps_dec->u2_disp_height;
 5480|  3.42k|                    ps_dec_op->i4_reorder_depth = ps_dec->i4_reorder_depth;
 5481|  3.42k|                }
 5482|       |
 5483|       |                // Report if header (sps and pps) has not been decoded yet
 5484|  3.42k|                if(ps_dec->i4_decode_header == 1 && ps_dec->i4_header_decoded != 3)
  ------------------
  |  Branch (5484:20): [True: 0, False: 3.42k]
  |  Branch (5484:53): [True: 0, False: 0]
  ------------------
 5485|      0|                {
 5486|      0|                    ps_dec_op->u4_error_code |= (1 << IVD_INSUFFICIENTDATA);
 5487|      0|                    api_ret_value = IV_FAIL;
 5488|      0|                }
 5489|       |
 5490|  3.42k|                if((ps_dec->u4_pic_buf_got == 1) && (ERROR_DANGLING_FIELD_IN_PIC != i4_err_status))
  ------------------
  |  Branch (5490:20): [True: 3.42k, False: 0]
  |  Branch (5490:53): [True: 3.42k, False: 0]
  ------------------
 5491|  3.42k|                {
 5492|       |                    /* For field pictures, set bottom and top picture decoded u4_flag correctly */
 5493|       |
 5494|  3.42k|                    if(ps_dec->ps_cur_slice->u1_field_pic_flag)
  ------------------
  |  Branch (5494:24): [True: 0, False: 3.42k]
  ------------------
 5495|      0|                    {
 5496|      0|                        if(1 == ps_dec->ps_cur_slice->u1_bottom_field_flag)
  ------------------
  |  Branch (5496:28): [True: 0, False: 0]
  ------------------
 5497|      0|                        {
 5498|      0|                            ps_dec->u1_top_bottom_decoded |= BOT_FIELD_ONLY;
  ------------------
  |  |   65|      0|#define BOT_FIELD_ONLY      0x01
  ------------------
 5499|      0|                        }
 5500|      0|                        else
 5501|      0|                        {
 5502|      0|                            ps_dec->u1_top_bottom_decoded |= TOP_FIELD_ONLY;
  ------------------
  |  |   64|      0|#define TOP_FIELD_ONLY      0x02
  ------------------
 5503|      0|                        }
 5504|      0|                    }
 5505|  3.42k|                    else
 5506|  3.42k|                    {
 5507|  3.42k|                        ps_dec->u1_top_bottom_decoded = TOP_FIELD_ONLY | BOT_FIELD_ONLY;
  ------------------
  |  |   64|  3.42k|#define TOP_FIELD_ONLY      0x02
  ------------------
                                      ps_dec->u1_top_bottom_decoded = TOP_FIELD_ONLY | BOT_FIELD_ONLY;
  ------------------
  |  |   65|  3.42k|#define BOT_FIELD_ONLY      0x01
  ------------------
 5508|  3.42k|                    }
 5509|       |
 5510|       |                    /* if new frame in not found (if we are still getting slices from
 5511|       |                     * previous frame) ih264d_deblock_display is not called. Such frames
 5512|       |                     * will not be added to reference /display
 5513|       |                     */
 5514|  3.42k|                    if((ps_dec->ps_dec_err_status->u1_err_flag & REJECT_CUR_PIC) == 0)
  ------------------
  |  |  601|  3.42k|#define REJECT_CUR_PIC    (0x01)
  ------------------
  |  Branch (5514:24): [True: 3.42k, False: 0]
  ------------------
 5515|  3.42k|                    {
 5516|       |                        /* Calling Function to deblock Picture and Display */
 5517|  3.42k|                        ret = ih264d_deblock_display(ps_dec);
 5518|  3.42k|                    }
 5519|       |
 5520|       |                    /*set to complete ,as we dont support partial frame decode*/
 5521|  3.42k|                    if(ps_dec->i4_header_decoded == 3)
  ------------------
  |  Branch (5521:24): [True: 3.42k, False: 0]
  ------------------
 5522|  3.42k|                    {
 5523|  3.42k|                        ps_dec->u4_total_mbs_coded = ps_dec->ps_cur_sps->u4_max_mb_addr + 1;
 5524|  3.42k|                    }
 5525|       |
 5526|       |                    /*Update the i4_frametype at the end of picture*/
 5527|  3.42k|                    if(ps_dec->ps_cur_slice->u1_nal_unit_type == IDR_SLICE_NAL)
  ------------------
  |  |  328|  3.42k|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (5527:24): [True: 2.87k, False: 543]
  ------------------
 5528|  2.87k|                    {
 5529|  2.87k|                        ps_dec->i4_frametype = IV_IDR_FRAME;
 5530|  2.87k|                    }
 5531|    543|                    else if(ps_dec->i4_pic_type == B_SLICE)
  ------------------
  |  |  369|    543|#define B_SLICE  1
  ------------------
  |  Branch (5531:29): [True: 473, False: 70]
  ------------------
 5532|    473|                    {
 5533|    473|                        ps_dec->i4_frametype = IV_B_FRAME;
 5534|    473|                    }
 5535|     70|                    else if(ps_dec->i4_pic_type == P_SLICE)
  ------------------
  |  |  368|     70|#define P_SLICE  0
  ------------------
  |  Branch (5535:29): [True: 70, False: 0]
  ------------------
 5536|     70|                    {
 5537|     70|                        ps_dec->i4_frametype = IV_P_FRAME;
 5538|     70|                    }
 5539|      0|                    else if(ps_dec->i4_pic_type == I_SLICE)
  ------------------
  |  |  370|      0|#define I_SLICE  2
  ------------------
  |  Branch (5539:29): [True: 0, False: 0]
  ------------------
 5540|      0|                    {
 5541|      0|                        ps_dec->i4_frametype = IV_I_FRAME;
 5542|      0|                    }
 5543|      0|                    else
 5544|      0|                    {
 5545|      0|                        H264_DEC_DEBUG_PRINT("Shouldn't come here\n");
  ------------------
  |  |   39|      0|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
 5546|      0|                    }
 5547|       |
 5548|       |                    // Update the content type
 5549|  3.42k|                    ps_dec->i4_content_type = ps_dec->ps_cur_slice->u1_field_pic_flag;
 5550|       |
 5551|  3.42k|                    ps_dec->u4_total_frames_decoded = ps_dec->u4_total_frames_decoded + 2;
 5552|  3.42k|                    ps_dec->u4_total_frames_decoded =
 5553|  3.42k|                        ps_dec->u4_total_frames_decoded - ps_dec->ps_cur_slice->u1_field_pic_flag;
 5554|  3.42k|                }
 5555|       |
 5556|       |                /* In case the decoder is configured to run in low delay mode,
 5557|       |                 * then get display buffer and then format convert.
 5558|       |                 * Note in this mode, format conversion does not run paralelly in a
 5559|       |                 * thread and adds to the codec cycles
 5560|       |                 */
 5561|  3.42k|                if((IVD_DECODE_FRAME_OUT == ps_dec->e_frm_out_mode) && ps_dec->u1_init_dec_flag)
  ------------------
  |  Branch (5561:20): [True: 0, False: 3.42k]
  |  Branch (5561:72): [True: 0, False: 0]
  ------------------
 5562|      0|                {
 5563|      0|                    ih264d_get_next_display_field(ps_dec, ps_dec->ps_out_buffer,
 5564|      0|                                                  &(ps_dec->s_disp_op));
 5565|       |
 5566|      0|                    if(0 == ps_dec->s_disp_op.u4_error_code)
  ------------------
  |  Branch (5566:24): [True: 0, False: 0]
  ------------------
 5567|      0|                    {
 5568|      0|                        ps_dec->u4_fmt_conv_cur_row = 0;
 5569|      0|                        ps_dec->u4_output_present = 1;
 5570|      0|                    }
 5571|      0|                    else
 5572|      0|                    {
 5573|      0|                        ps_dec->u4_output_present = 0;
 5574|      0|                    }
 5575|      0|                }
 5576|       |
 5577|  3.42k|                isvcd_fill_output_struct_from_context(ps_svc_lyr_dec, ps_dec_op);
 5578|       |
 5579|       |                /* If Format conversion is not complete,
 5580|       |                 complete it here */
 5581|       |                /* For Non -target Layers , Buffers are retrived but not displayed*/
 5582|       |
 5583|  3.42k|                if((ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER) &&
  ------------------
  |  |  110|  3.42k|#define TARGET_LAYER 2
  ------------------
  |  Branch (5583:20): [True: 2.29k, False: 1.12k]
  ------------------
 5584|  2.29k|                   ps_dec->u4_output_present &&
  ------------------
  |  Branch (5584:20): [True: 1.04k, False: 1.25k]
  ------------------
 5585|  1.04k|                   (ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht))
  ------------------
  |  Branch (5585:20): [True: 538, False: 508]
  ------------------
 5586|    538|                {
 5587|    538|                    ps_dec->u4_fmt_conv_num_rows =
 5588|    538|                        ps_dec->s_disp_frame_info.u4_y_ht - ps_dec->u4_fmt_conv_cur_row;
 5589|    538|                    ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op), ps_dec->u4_fmt_conv_cur_row,
 5590|    538|                                          ps_dec->u4_fmt_conv_num_rows);
 5591|    538|                    ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
 5592|    538|                }
 5593|       |
 5594|  3.42k|                ih264d_release_display_field(ps_dec, &(ps_dec->s_disp_op));
 5595|       |
 5596|  3.42k|                if(ps_dec->i4_decode_header == 1 && (ps_dec->i4_header_decoded & 1) == 1)
  ------------------
  |  Branch (5596:20): [True: 0, False: 3.42k]
  |  Branch (5596:53): [True: 0, False: 0]
  ------------------
 5597|      0|                {
 5598|      0|                    ps_dec_op->u4_progressive_frame_flag = 1;
 5599|      0|                    if((NULL != ps_dec->ps_cur_sps) && (1 == (ps_dec->ps_cur_sps->u1_is_valid)))
  ------------------
  |  Branch (5599:24): [True: 0, False: 0]
  |  Branch (5599:56): [True: 0, False: 0]
  ------------------
 5600|      0|                    {
 5601|      0|                        if((0 == ps_dec->ps_sps->u1_frame_mbs_only_flag) &&
  ------------------
  |  Branch (5601:28): [True: 0, False: 0]
  ------------------
 5602|      0|                           (0 == ps_dec->ps_sps->u1_mb_aff_flag))
  ------------------
  |  Branch (5602:28): [True: 0, False: 0]
  ------------------
 5603|      0|                            ps_dec_op->u4_progressive_frame_flag = 0;
 5604|      0|                    }
 5605|      0|                }
 5606|       |
 5607|  3.42k|                if((TOP_FIELD_ONLY | BOT_FIELD_ONLY) == ps_dec->u1_top_bottom_decoded)
  ------------------
  |  |   64|  3.42k|#define TOP_FIELD_ONLY      0x02
  ------------------
                              if((TOP_FIELD_ONLY | BOT_FIELD_ONLY) == ps_dec->u1_top_bottom_decoded)
  ------------------
  |  |   65|  3.42k|#define BOT_FIELD_ONLY      0x01
  ------------------
  |  Branch (5607:20): [True: 3.42k, False: 0]
  ------------------
 5608|  3.42k|                {
 5609|  3.42k|                    ps_dec->u1_top_bottom_decoded = 0;
 5610|  3.42k|                }
 5611|       |                /*--------------------------------------------------------------------*/
 5612|       |                /* Do End of Pic processing.                                          */
 5613|       |                /* Should be called only if frame was decoded in previous process call*/
 5614|       |                /*--------------------------------------------------------------------*/
 5615|  3.42k|                if(ps_dec->u4_pic_buf_got == 1)
  ------------------
  |  Branch (5615:20): [True: 3.42k, False: 0]
  ------------------
 5616|  3.42k|                {
 5617|  3.42k|                    if(1 == ps_dec->u1_last_pic_not_decoded)
  ------------------
  |  Branch (5617:24): [True: 0, False: 3.42k]
  ------------------
 5618|      0|                    {
 5619|      0|                        ret = ih264d_end_of_pic_dispbuf_mgr(ps_dec);
 5620|       |
 5621|      0|                        if(ret != OK) return ret;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (5621:28): [True: 0, False: 0]
  ------------------
 5622|       |
 5623|      0|                        ret = ih264d_end_of_pic(ps_dec);
 5624|      0|                        if(ret != OK) return ret;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (5624:28): [True: 0, False: 0]
  ------------------
 5625|      0|                    }
 5626|  3.42k|                    else
 5627|  3.42k|                    {
 5628|  3.42k|                        ret = ih264d_end_of_pic(ps_dec);
 5629|  3.42k|                        if(ret != OK) return ret;
  ------------------
  |  |  114|  3.42k|#define OK        0
  ------------------
  |  Branch (5629:28): [True: 0, False: 3.42k]
  ------------------
 5630|  3.42k|                    }
 5631|  3.42k|                }
 5632|       |
 5633|  3.42k|                if(ps_dec->u1_enable_mb_info && ps_dec->u4_output_present)
  ------------------
  |  Branch (5633:20): [True: 0, False: 3.42k]
  |  Branch (5633:49): [True: 0, False: 0]
  ------------------
 5634|      0|                {
 5635|      0|                    UWORD32 disp_buf_id = ps_dec->s_disp_op.u4_disp_buf_id;
 5636|      0|                    if(ps_h264d_dec_ip->pu1_8x8_blk_qp_map)
  ------------------
  |  Branch (5636:24): [True: 0, False: 0]
  ------------------
 5637|      0|                    {
 5638|      0|                        ps_h264d_dec_op->pu1_8x8_blk_qp_map = ps_h264d_dec_ip->pu1_8x8_blk_qp_map;
 5639|      0|                        ps_h264d_dec_op->u4_8x8_blk_qp_map_size = ps_dec->u4_total_mbs << 2;
 5640|      0|                        memcpy(ps_h264d_dec_op->pu1_8x8_blk_qp_map,
 5641|      0|                                     ps_dec->as_buf_id_info_map[disp_buf_id].pu1_qp_map,
 5642|      0|                                     ps_dec->u4_total_mbs << 2);
 5643|      0|                    }
 5644|      0|                    if(ps_h264d_dec_ip->pu1_8x8_blk_type_map)
  ------------------
  |  Branch (5644:24): [True: 0, False: 0]
  ------------------
 5645|      0|                    {
 5646|      0|                        ps_h264d_dec_op->pu1_8x8_blk_type_map =
 5647|      0|                            ps_h264d_dec_ip->pu1_8x8_blk_type_map;
 5648|      0|                        ps_h264d_dec_op->u4_8x8_blk_type_map_size = ps_dec->u4_total_mbs << 2;
 5649|      0|                        memcpy(ps_h264d_dec_op->pu1_8x8_blk_type_map,
 5650|      0|                                     ps_dec->as_buf_id_info_map[disp_buf_id].pu1_mb_type_map,
 5651|      0|                                     ps_dec->u4_total_mbs << 2);
 5652|      0|                    }
 5653|      0|                }
 5654|       |                /*Data memory barrier instruction,so that yuv write by the library is
 5655|       |                 * complete*/
 5656|  3.42k|                DATA_SYNC();
  ------------------
  |  |  116|  3.42k|#define DATA_SYNC()  __sync_synchronize()
  ------------------
 5657|       |
 5658|  3.42k|                H264_DEC_DEBUG_PRINT("The num bytes consumed: %d\n",
  ------------------
  |  |   39|  3.42k|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
 5659|  3.42k|                                     ps_dec_op->u4_num_bytes_consumed);
 5660|  3.42k|            }
 5661|  4.36k|        }
 5662|       |        /* highest layer for flush validation */
 5663|       |
 5664|  14.4k|        if((ps_dec->u1_flushfrm) && (1 == flush_decode))
  ------------------
  |  Branch (5664:12): [True: 0, False: 14.4k]
  |  Branch (5664:37): [True: 0, False: 0]
  ------------------
 5665|      0|        {
 5666|      0|            u1_res_id = u1_num_res_lyrs - 1;
 5667|      0|            ps_svc_lyr_dec = ps_svcd_ctxt->ps_svc_dec_lyr + u1_res_id;
 5668|      0|            ps_dec = &ps_svc_lyr_dec->s_dec;
 5669|       |
 5670|      0|            ih264d_get_next_display_field(ps_dec, ps_dec->ps_out_buffer, &(ps_dec->s_disp_op));
 5671|      0|            if(0 == ps_dec->s_disp_op.u4_error_code)
  ------------------
  |  Branch (5671:16): [True: 0, False: 0]
  ------------------
 5672|      0|            {
 5673|       |                /* check output buffer size given by the application */
 5674|      0|                if(check_app_out_buf_size(ps_dec) != IV_SUCCESS)
  ------------------
  |  Branch (5674:20): [True: 0, False: 0]
  ------------------
 5675|      0|                {
 5676|      0|                    ps_dec_op->u4_error_code = IVD_DISP_FRM_ZERO_OP_BUF_SIZE;
 5677|      0|                    return (IV_FAIL);
 5678|      0|                }
 5679|       |
 5680|      0|                ps_dec->u4_fmt_conv_cur_row = 0;
 5681|      0|                ps_dec->u4_fmt_conv_num_rows = ps_dec->s_disp_frame_info.u4_y_ht;
 5682|      0|                ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op), ps_dec->u4_fmt_conv_cur_row,
 5683|      0|                                      ps_dec->u4_fmt_conv_num_rows);
 5684|      0|                ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
 5685|      0|                ps_dec->u4_output_present = 1;
 5686|      0|            }
 5687|      0|            else
 5688|      0|            {
 5689|      0|                ps_dec->u4_output_present = 0;
 5690|      0|            }
 5691|      0|            ih264d_export_sei_params(&ps_dec_op->s_sei_decode_op, ps_dec);
 5692|       |
 5693|      0|            ih264d_release_display_field(ps_dec, &(ps_dec->s_disp_op));
 5694|       |
 5695|      0|            ps_dec_op->u4_pic_wd = (UWORD32) ps_dec->u2_disp_width;
 5696|      0|            ps_dec_op->u4_pic_ht = (UWORD32) ps_dec->u2_disp_height;
 5697|      0|            ps_dec_op->i4_reorder_depth = ps_dec->i4_reorder_depth;
 5698|      0|            ps_dec_op->i4_display_index = ps_dec->i4_display_index;
 5699|       |
 5700|      0|            ps_dec_op->u4_new_seq = 0;
 5701|      0|            ps_dec_op->u4_output_present = (ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER)
  ------------------
  |  |  110|      0|#define TARGET_LAYER 2
  ------------------
  |  Branch (5701:44): [True: 0, False: 0]
  ------------------
 5702|      0|                                               ? ps_dec->u4_output_present
 5703|      0|                                               : 0;
 5704|      0|            ps_dec_op->u4_progressive_frame_flag = ps_dec->s_disp_op.u4_progressive_frame_flag;
 5705|      0|            ps_dec_op->e_output_format = ps_dec->s_disp_op.e_output_format;
 5706|      0|            ps_dec_op->s_disp_frm_buf = ps_dec->s_disp_op.s_disp_frm_buf;
 5707|      0|            ps_dec_op->e4_fld_type = ps_dec->s_disp_op.e4_fld_type;
 5708|      0|            ps_dec_op->u4_ts = ps_dec->s_disp_op.u4_ts;
 5709|      0|            ps_dec_op->u4_disp_buf_id = ps_dec->s_disp_op.u4_disp_buf_id;
 5710|       |
 5711|       |            /*In the case of flush ,since no frame is decoded set pic type as invalid*/
 5712|      0|            ps_dec_op->u4_is_ref_flag = UINT32_MAX;
 5713|      0|            ps_dec_op->e_pic_type = IV_NA_FRAME;
 5714|      0|            ps_dec_op->u4_frame_decoded_flag = 0;
 5715|       |
 5716|      0|            if(0 == ps_dec->s_disp_op.u4_error_code)
  ------------------
  |  Branch (5716:16): [True: 0, False: 0]
  ------------------
 5717|      0|            {
 5718|      0|                return (IV_SUCCESS);
 5719|      0|            }
 5720|      0|            else
 5721|      0|                return (IV_FAIL);
 5722|      0|        }
 5723|  14.4k|    }
 5724|       |
 5725|  14.4k|    if((ps_dec_op->u4_error_code & 0xff) != ERROR_DYNAMIC_RESOLUTION_NOT_SUPPORTED)
  ------------------
  |  Branch (5725:8): [True: 14.4k, False: 0]
  ------------------
 5726|  14.4k|    {
 5727|  14.4k|        ps_dec_op->u4_pic_wd = (UWORD32) ps_dec->u2_disp_width;
 5728|  14.4k|        ps_dec_op->u4_pic_ht = (UWORD32) ps_dec->u2_disp_height;
 5729|  14.4k|        ps_dec_op->i4_reorder_depth = ps_dec->i4_reorder_depth;
 5730|  14.4k|    }
 5731|  14.4k|    return api_ret_value;
 5732|  14.4k|}
isvcd_set_params:
 6163|    308|{
 6164|    308|    dec_struct_t *ps_dec;
 6165|    308|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 6166|    308|    WORD32 ret = IV_SUCCESS;
 6167|    308|    svc_dec_ctxt_t *ps_svcd_ctxt;
 6168|    308|    WORD32 u1_layer_id;
 6169|       |
 6170|    308|    ps_svcd_ctxt = (svc_dec_ctxt_t *) dec_hdl->pv_codec_handle;
 6171|    308|    ps_svcd_ctxt->i4_eos_flag = 0;
 6172|  1.23k|    for(u1_layer_id = 0; u1_layer_id < MAX_NUM_RES_LYRS; u1_layer_id++)
  ------------------
  |  |   94|  1.23k|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (6172:26): [True: 924, False: 308]
  ------------------
 6173|    924|    {
 6174|    924|        isvcd_ctl_set_config_ip_t *ps_h264d_ctl_ip = (isvcd_ctl_set_config_ip_t *) pv_api_ip;
 6175|    924|        isvcd_ctl_set_config_op_t *ps_h264d_ctl_op = (isvcd_ctl_set_config_op_t *) pv_api_op;
 6176|    924|        ivd_ctl_set_config_ip_t *ps_ctl_ip = &ps_h264d_ctl_ip->s_ivd_ctl_set_config_ip_t;
 6177|    924|        ivd_ctl_set_config_op_t *ps_ctl_op = &ps_h264d_ctl_op->s_ivd_ctl_set_config_op_t;
 6178|       |
 6179|    924|        ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[u1_layer_id];
 6180|    924|        ps_dec = &ps_svc_lyr_dec->s_dec;
 6181|       |
 6182|    924|        ps_dec->u1_flushfrm = 0;
 6183|    924|        ps_dec->u4_skip_frm_mask = 0;
 6184|    924|        ps_ctl_op->u4_error_code = 0;
 6185|       |
 6186|    924|        if(ps_ctl_ip->e_frm_skip_mode != IVD_SKIP_NONE)
  ------------------
  |  Branch (6186:12): [True: 0, False: 924]
  ------------------
 6187|      0|        {
 6188|      0|            ps_ctl_op->u4_error_code = (1 << IVD_UNSUPPORTEDPARAM);
 6189|      0|            ret = IV_FAIL;
 6190|      0|        }
 6191|       |
 6192|    924|        if(ps_ctl_ip->u4_disp_wd >= ps_dec->u2_disp_width)
  ------------------
  |  Branch (6192:12): [True: 924, False: 0]
  ------------------
 6193|    924|        {
 6194|    924|            ps_dec->u4_app_disp_width = ps_ctl_ip->u4_disp_wd;
 6195|    924|        }
 6196|      0|        else if(0 == ps_dec->i4_header_decoded)
  ------------------
  |  Branch (6196:17): [True: 0, False: 0]
  ------------------
 6197|      0|        {
 6198|      0|            ps_dec->u4_app_disp_width = ps_ctl_ip->u4_disp_wd;
 6199|      0|        }
 6200|      0|        else if(ps_ctl_ip->u4_disp_wd == 0)
  ------------------
  |  Branch (6200:17): [True: 0, False: 0]
  ------------------
 6201|      0|        {
 6202|      0|            ps_dec->u4_app_disp_width = 0;
 6203|      0|        }
 6204|      0|        else
 6205|      0|        {
 6206|       |            /*
 6207|       |             * Set the display width to zero. This will ensure that the wrong value we
 6208|       |             * had stored (0xFFFFFFFF) does not propogate.
 6209|       |             */
 6210|      0|            ps_dec->u4_app_disp_width = 0;
 6211|      0|            ps_ctl_op->u4_error_code |= (1 << IVD_UNSUPPORTEDPARAM);
 6212|      0|            ps_ctl_op->u4_error_code |= ERROR_DISP_WIDTH_INVALID;
 6213|      0|            ret = IV_FAIL;
 6214|      0|        }
 6215|       |
 6216|    924|        if(ps_ctl_ip->e_vid_dec_mode == IVD_DECODE_FRAME)
  ------------------
  |  Branch (6216:12): [True: 462, False: 462]
  ------------------
 6217|    462|            ps_dec->i4_decode_header = 0;
 6218|    462|        else if(ps_ctl_ip->e_vid_dec_mode == IVD_DECODE_HEADER)
  ------------------
  |  Branch (6218:17): [True: 462, False: 0]
  ------------------
 6219|    462|            ps_dec->i4_decode_header = 1;
 6220|      0|        else
 6221|      0|        {
 6222|      0|            ps_ctl_op->u4_error_code = (1 << IVD_UNSUPPORTEDPARAM);
 6223|      0|            ps_dec->i4_decode_header = 1;
 6224|      0|            ret = IV_FAIL;
 6225|      0|        }
 6226|    924|        ps_dec->e_frm_out_mode = IVD_DISPLAY_FRAME_OUT;
 6227|       |
 6228|    924|        if((ps_ctl_ip->e_frm_out_mode != IVD_DECODE_FRAME_OUT) &&
  ------------------
  |  Branch (6228:12): [True: 924, False: 0]
  ------------------
 6229|    924|           (ps_ctl_ip->e_frm_out_mode != IVD_DISPLAY_FRAME_OUT))
  ------------------
  |  Branch (6229:12): [True: 0, False: 924]
  ------------------
 6230|      0|        {
 6231|      0|            ps_ctl_op->u4_error_code = (1 << IVD_UNSUPPORTEDPARAM);
 6232|      0|            ret = IV_FAIL;
 6233|      0|        }
 6234|    924|        ps_dec->e_frm_out_mode = ps_ctl_ip->e_frm_out_mode;
 6235|    924|    }
 6236|    308|    return ret;
 6237|    308|}
isvcd_set_target_layer:
 6260|    154|{
 6261|    154|    WORD32 ret = IV_SUCCESS;
 6262|       |
 6263|    154|    isvcd_set_target_layer_ip_t *ps_ip;
 6264|    154|    isvcd_set_target_layer_op_t *ps_op;
 6265|    154|    svc_dec_ctxt_t *ps_svcd_ctxt;
 6266|    154|    ps_svcd_ctxt = (svc_dec_ctxt_t *) dec_hdl->pv_codec_handle;
 6267|       |
 6268|    154|    ps_ip = (isvcd_set_target_layer_ip_t *) pv_api_ip;
 6269|    154|    ps_op = (isvcd_set_target_layer_op_t *) pv_api_op;
 6270|       |
 6271|    154|    ps_svcd_ctxt->u1_tgt_dep_id = ps_ip->u1_tgt_dep_id;
 6272|    154|    ps_svcd_ctxt->u1_tgt_quality_id = ps_ip->u1_tgt_quality_id;
 6273|    154|    ps_svcd_ctxt->u1_tgt_temp_id = ps_ip->u1_tgt_temp_id;
 6274|    154|    ps_svcd_ctxt->u1_tgt_priority_id = ps_ip->u1_tgt_priority_id;
 6275|       |
 6276|    154|    ret = isvcd_nal_parse_set_target_attr(ps_ip->u1_tgt_quality_id, ps_ip->u1_tgt_dep_id,
 6277|    154|                                          ps_ip->u1_tgt_temp_id, ps_ip->u1_tgt_priority_id,
 6278|    154|                                          ps_svcd_ctxt->pv_nal_parse_ctxt);
 6279|    154|    ps_op->u4_error_code = 0;
 6280|       |
 6281|    154|    return ret;
 6282|    154|}
isvcd_delete:
 6351|    154|{
 6352|    154|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 6353|    154|    isvcd_delete_ip_t *ps_ip = (isvcd_delete_ip_t *) pv_api_ip;
 6354|    154|    isvcd_delete_op_t *ps_op = (isvcd_delete_op_t *) pv_api_op;
 6355|       |
 6356|    154|    UWORD8 u1_layer_id;
 6357|    154|    svc_dec_ctxt_t *ps_svcd_ctxt;
 6358|    154|    ps_svcd_ctxt = (svc_dec_ctxt_t *) dec_hdl->pv_codec_handle;
 6359|    154|    UNUSED(ps_ip);
  ------------------
  |  |   45|    154|#define UNUSED(x) ((void)(x))
  ------------------
 6360|       |
 6361|    616|    for(u1_layer_id = 0; u1_layer_id < MAX_NUM_RES_LYRS; u1_layer_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (6361:26): [True: 462, False: 154]
  ------------------
 6362|    462|    {
 6363|    462|        ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[u1_layer_id];
 6364|    462|        isvcd_free_dynamic_bufs(ps_svc_lyr_dec);
 6365|    462|    }
 6366|    154|    isvcd_free_static_bufs(dec_hdl);
 6367|    154|    ps_op->s_ivd_delete_op_t.u4_error_code = 0;
 6368|       |
 6369|    154|    return IV_SUCCESS;
 6370|    154|}
isvcd_reset:
 6393|    354|{
 6394|    354|    dec_struct_t *ps_dec;
 6395|    354|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 6396|    354|    ivd_ctl_reset_op_t *ps_ctl_op = (ivd_ctl_reset_op_t *) pv_api_op;
 6397|    354|    UWORD8 u1_layer_id;
 6398|    354|    svc_dec_ctxt_t *ps_svcd_ctxt;
 6399|    354|    ps_svcd_ctxt = (svc_dec_ctxt_t *) dec_hdl->pv_codec_handle;
 6400|    354|    UNUSED(pv_api_ip);
  ------------------
  |  |   45|    354|#define UNUSED(x) ((void)(x))
  ------------------
 6401|    354|    ps_ctl_op->u4_error_code = 0;
 6402|       |
 6403|    354|    ps_svcd_ctxt->i4_eos_flag = 0;
 6404|    354|    ps_svcd_ctxt->u4_num_sps_ctr = 0;
 6405|    354|    ps_svcd_ctxt->u4_num_pps_ctr = 0;
 6406|    354|    ps_svcd_ctxt->u1_pre_parse_in_flush = 1;
 6407|  1.41k|    for(u1_layer_id = 0; u1_layer_id < MAX_NUM_RES_LYRS; u1_layer_id++)
  ------------------
  |  |   94|  1.41k|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (6407:26): [True: 1.06k, False: 354]
  ------------------
 6408|  1.06k|    {
 6409|  1.06k|        ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[u1_layer_id];
 6410|  1.06k|        ps_dec = &ps_svc_lyr_dec->s_dec;
 6411|  1.06k|        if(ps_dec != NULL)
  ------------------
  |  Branch (6411:12): [True: 1.06k, False: 0]
  ------------------
 6412|  1.06k|        {
 6413|  1.06k|            if(((buf_mgr_t *) ps_dec->pv_pic_buf_mgr)->pv_mutex != NULL)
  ------------------
  |  Branch (6413:16): [True: 37, False: 1.02k]
  ------------------
 6414|     37|                ih264_buf_mgr_free(ps_dec->pv_pic_buf_mgr);
 6415|  1.06k|            if(((buf_mgr_t *) ps_dec->pv_mv_buf_mgr)->pv_mutex != NULL)
  ------------------
  |  Branch (6415:16): [True: 37, False: 1.02k]
  ------------------
 6416|     37|                ih264_buf_mgr_free(ps_dec->pv_mv_buf_mgr);
 6417|       |
 6418|  1.06k|            isvcd_init_decoder(ps_svc_lyr_dec);
 6419|  1.06k|            ps_dec->u1_flushfrm = 0;
 6420|  1.06k|        }
 6421|      0|        else
 6422|      0|        {
 6423|      0|            H264_DEC_DEBUG_PRINT("\nReset called without Initializing the decoder\n");
  ------------------
  |  |   39|      0|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
 6424|      0|            ps_ctl_op->u4_error_code = ERROR_INIT_NOT_DONE;
 6425|      0|        }
 6426|  1.06k|    }
 6427|    354|    return IV_SUCCESS;
 6428|    354|}
isvcd_ctl:
 6451|  1.12k|{
 6452|  1.12k|    ivd_ctl_set_config_ip_t *ps_ctl_ip;
 6453|  1.12k|    ivd_ctl_set_config_op_t *ps_ctl_op;
 6454|  1.12k|    WORD32 ret = IV_SUCCESS;
 6455|  1.12k|    UWORD32 subcommand;
 6456|  1.12k|    dec_struct_t *ps_dec;
 6457|  1.12k|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 6458|  1.12k|    svc_dec_ctxt_t *ps_svcd_ctxt;
 6459|  1.12k|    ps_svcd_ctxt = (svc_dec_ctxt_t *) dec_hdl->pv_codec_handle;
 6460|  1.12k|    ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[ps_svcd_ctxt->u1_target_layer_id];
 6461|  1.12k|    ps_dec = &ps_svc_lyr_dec->s_dec;
 6462|  1.12k|    if(ps_dec->init_done != 1)
  ------------------
  |  Branch (6462:8): [True: 0, False: 1.12k]
  ------------------
 6463|      0|    {
 6464|      0|        return IV_FAIL;
 6465|      0|    }
 6466|  1.12k|    ps_ctl_ip = (ivd_ctl_set_config_ip_t *) pv_api_ip;
 6467|  1.12k|    ps_ctl_op = (ivd_ctl_set_config_op_t *) pv_api_op;
 6468|  1.12k|    ps_ctl_op->u4_error_code = 0;
 6469|  1.12k|    subcommand = ps_ctl_ip->e_sub_cmd;
 6470|       |
 6471|  1.12k|    switch(subcommand)
 6472|  1.12k|    {
 6473|      0|        case IVD_CMD_CTL_GETPARAMS:
  ------------------
  |  Branch (6473:9): [True: 0, False: 1.12k]
  ------------------
 6474|      0|            ret = isvcd_get_status(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6475|      0|            break;
 6476|    308|        case IVD_CMD_CTL_SETPARAMS:
  ------------------
  |  Branch (6476:9): [True: 308, False: 816]
  ------------------
 6477|    308|            ret = isvcd_set_params(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6478|    308|            break;
 6479|    354|        case IVD_CMD_CTL_RESET:
  ------------------
  |  Branch (6479:9): [True: 354, False: 770]
  ------------------
 6480|    354|            ret = isvcd_reset(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6481|    354|            break;
 6482|      0|        case IVD_CMD_CTL_SETDEFAULT:
  ------------------
  |  Branch (6482:9): [True: 0, False: 1.12k]
  ------------------
 6483|      0|            ret = isvcd_set_default_params(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6484|      0|            break;
 6485|      0|        case IVD_CMD_CTL_FLUSH:
  ------------------
  |  Branch (6485:9): [True: 0, False: 1.12k]
  ------------------
 6486|      0|            ret = isvcd_set_flush_mode(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6487|      0|            break;
 6488|      0|        case IVD_CMD_CTL_GETBUFINFO:
  ------------------
  |  Branch (6488:9): [True: 0, False: 1.12k]
  ------------------
 6489|      0|            ret = isvcd_get_buf_info(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6490|      0|            break;
 6491|      0|        case IVD_CMD_CTL_GETVERSION:
  ------------------
  |  Branch (6491:9): [True: 0, False: 1.12k]
  ------------------
 6492|      0|            ret = ih264d_get_version(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6493|      0|            break;
 6494|      0|        case IH264D_CMD_CTL_DEGRADE:
  ------------------
  |  Branch (6494:9): [True: 0, False: 1.12k]
  ------------------
 6495|      0|            ret = isvcd_set_degrade(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6496|      0|            break;
 6497|       |
 6498|    154|        case IH264D_CMD_CTL_SET_NUM_CORES:
  ------------------
  |  Branch (6498:9): [True: 154, False: 970]
  ------------------
 6499|    154|            ret = isvcd_set_num_cores(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6500|    154|            break;
 6501|      0|        case IH264D_CMD_CTL_GET_BUFFER_DIMENSIONS:
  ------------------
  |  Branch (6501:9): [True: 0, False: 1.12k]
  ------------------
 6502|      0|            ret = isvcd_get_frame_dimensions(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6503|      0|            break;
 6504|      0|        case IH264D_CMD_CTL_GET_VUI_PARAMS:
  ------------------
  |  Branch (6504:9): [True: 0, False: 1.12k]
  ------------------
 6505|      0|            ret = isvcd_get_vui_params(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6506|      0|            break;
 6507|      0|        case IH264D_CMD_CTL_GET_SEI_MDCV_PARAMS:
  ------------------
  |  Branch (6507:9): [True: 0, False: 1.12k]
  ------------------
 6508|      0|            ret = isvcd_get_sei_mdcv_params(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6509|      0|            break;
 6510|      0|        case IH264D_CMD_CTL_GET_SEI_CLL_PARAMS:
  ------------------
  |  Branch (6510:9): [True: 0, False: 1.12k]
  ------------------
 6511|      0|            ret = isvcd_get_sei_cll_params(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6512|      0|            break;
 6513|      0|        case IH264D_CMD_CTL_GET_SEI_AVE_PARAMS:
  ------------------
  |  Branch (6513:9): [True: 0, False: 1.12k]
  ------------------
 6514|      0|            ret = isvcd_get_sei_ave_params(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6515|      0|            break;
 6516|      0|        case IH264D_CMD_CTL_GET_SEI_CCV_PARAMS:
  ------------------
  |  Branch (6516:9): [True: 0, False: 1.12k]
  ------------------
 6517|      0|            ret = isvcd_get_sei_ccv_params(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6518|      0|            break;
 6519|    154|        case IH264D_CMD_CTL_SET_PROCESSOR:
  ------------------
  |  Branch (6519:9): [True: 154, False: 970]
  ------------------
 6520|    154|            ret = isvcd_set_processor(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6521|    154|            break;
 6522|    154|        case ISVCD_CMD_CTL_SET_TGT_LAYER:
  ------------------
  |  Branch (6522:9): [True: 154, False: 970]
  ------------------
 6523|    154|            ret = isvcd_set_target_layer(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 6524|    154|            break;
 6525|      0|        default:
  ------------------
  |  Branch (6525:9): [True: 0, False: 1.12k]
  ------------------
 6526|      0|            H264_DEC_DEBUG_PRINT("\ndo nothing\n");
  ------------------
  |  |   39|      0|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
 6527|      0|            break;
 6528|  1.12k|    }
 6529|       |
 6530|  1.12k|    return ret;
 6531|  1.12k|}
isvcd_set_num_cores:
 7120|    154|{
 7121|    154|    UWORD8 u1_layer_id;
 7122|    154|    isvcd_ctl_set_num_cores_ip_t *ps_ip;
 7123|    154|    isvcd_ctl_set_num_cores_op_t *ps_op;
 7124|    154|    dec_struct_t *ps_dec;
 7125|    154|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 7126|    154|    svc_dec_ctxt_t *ps_svcd_ctxt;
 7127|    154|    ps_svcd_ctxt = (svc_dec_ctxt_t *) dec_hdl->pv_codec_handle;
 7128|       |
 7129|    154|    ps_ip = (isvcd_ctl_set_num_cores_ip_t *) pv_api_ip;
 7130|    154|    ps_op = (isvcd_ctl_set_num_cores_op_t *) pv_api_op;
 7131|    154|    ps_op->u4_error_code = 0;
 7132|    616|    for(u1_layer_id = 0; u1_layer_id < MAX_NUM_RES_LYRS; u1_layer_id++)
  ------------------
  |  |   94|    616|#define MAX_NUM_RES_LYRS 3
  ------------------
  |  Branch (7132:26): [True: 462, False: 154]
  ------------------
 7133|    462|    {
 7134|    462|        ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[u1_layer_id];
 7135|    462|        ps_dec = &ps_svc_lyr_dec->s_dec;
 7136|    462|        ps_dec->u4_num_cores = ps_ip->u4_num_cores;
 7137|       |
 7138|    462|        if(ps_dec->u4_num_cores == 1)
  ------------------
  |  Branch (7138:12): [True: 273, False: 189]
  ------------------
 7139|    273|        {
 7140|    273|            ps_dec->u1_separate_parse = 0;
 7141|    273|        }
 7142|    189|        else
 7143|    189|        {
 7144|    189|            ps_dec->u1_separate_parse = 1;
 7145|    189|        }
 7146|       |
 7147|       |        /*using only upto three threads currently*/
 7148|    462|        if(ps_dec->u4_num_cores > 3) ps_dec->u4_num_cores = 3;
  ------------------
  |  Branch (7148:12): [True: 72, False: 390]
  ------------------
 7149|    462|    }
 7150|    154|    return IV_SUCCESS;
 7151|    154|}
isvcd_fill_output_struct_from_context:
 7175|  6.11k|{
 7176|  6.11k|    dec_struct_t *ps_dec;
 7177|  6.11k|    ps_dec = &ps_svc_lyr_dec->s_dec;
 7178|  6.11k|    if((ps_dec_op->u4_error_code & 0xff) != ERROR_DYNAMIC_RESOLUTION_NOT_SUPPORTED)
  ------------------
  |  Branch (7178:8): [True: 6.11k, False: 0]
  ------------------
 7179|  6.11k|    {
 7180|  6.11k|        ps_dec_op->u4_pic_wd = (UWORD32) ps_dec->u2_disp_width;
 7181|  6.11k|        ps_dec_op->u4_pic_ht = (UWORD32) ps_dec->u2_disp_height;
 7182|  6.11k|    }
 7183|  6.11k|    ps_dec_op->i4_reorder_depth = ps_dec->i4_reorder_depth;
 7184|  6.11k|    ps_dec_op->i4_display_index = ps_dec->i4_display_index;
 7185|  6.11k|    ps_dec_op->e_pic_type = ps_dec->i4_frametype;
 7186|       |
 7187|  6.11k|    ps_dec_op->u4_new_seq = 0;
 7188|  6.11k|    ps_dec_op->u4_output_present =
 7189|  6.11k|        (ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER) ? ps_dec->u4_output_present : 0;
  ------------------
  |  |  110|  6.11k|#define TARGET_LAYER 2
  ------------------
  |  Branch (7189:9): [True: 2.37k, False: 3.74k]
  ------------------
 7190|  6.11k|    ps_dec_op->u4_progressive_frame_flag = ps_dec->s_disp_op.u4_progressive_frame_flag;
 7191|       |
 7192|  6.11k|    ps_dec_op->u4_is_ref_flag = 1;
 7193|  6.11k|    if(ps_dec_op->u4_frame_decoded_flag)
  ------------------
  |  Branch (7193:8): [True: 3.42k, False: 2.69k]
  ------------------
 7194|  3.42k|    {
 7195|  3.42k|        if(ps_dec->ps_cur_slice->u1_nal_ref_idc == 0) ps_dec_op->u4_is_ref_flag = 0;
  ------------------
  |  Branch (7195:12): [True: 530, False: 2.89k]
  ------------------
 7196|  3.42k|    }
 7197|       |
 7198|  6.11k|    ps_dec_op->e_output_format = ps_dec->s_disp_op.e_output_format;
 7199|  6.11k|    ps_dec_op->s_disp_frm_buf = ps_dec->s_disp_op.s_disp_frm_buf;
 7200|  6.11k|    ps_dec_op->e4_fld_type = ps_dec->s_disp_op.e4_fld_type;
 7201|  6.11k|    ps_dec_op->u4_ts = ps_dec->s_disp_op.u4_ts;
 7202|  6.11k|    ps_dec_op->u4_disp_buf_id = ps_dec->s_disp_op.u4_disp_buf_id;
 7203|       |
 7204|  6.11k|    ih264d_export_sei_params(&ps_dec_op->s_sei_decode_op, ps_dec);
 7205|  6.11k|}
isvcd_api_function:
 7228|  22.1k|{
 7229|  22.1k|    UWORD32 command;
 7230|  22.1k|    UWORD32 *pu2_ptr_cmd;
 7231|  22.1k|    UWORD32 u4_api_ret;
 7232|  22.1k|    IV_API_CALL_STATUS_T e_status;
 7233|  22.1k|    e_status = api_check_struct_sanity(dec_hdl, pv_api_ip, pv_api_op);
 7234|       |
 7235|  22.1k|    if(e_status != IV_SUCCESS)
  ------------------
  |  Branch (7235:8): [True: 206, False: 21.9k]
  ------------------
 7236|    206|    {
 7237|    206|        UWORD32 *ptr_err;
 7238|       |
 7239|    206|        ptr_err = (UWORD32 *) pv_api_op;
 7240|    206|        UNUSED(ptr_err);
  ------------------
  |  |   45|    206|#define UNUSED(x) ((void)(x))
  ------------------
 7241|    206|        H264_DEC_DEBUG_PRINT("error code = %d\n", *(ptr_err + 1));
  ------------------
  |  |   39|    206|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
 7242|    206|        return IV_FAIL;
 7243|    206|    }
 7244|       |
 7245|  21.9k|    pu2_ptr_cmd = (UWORD32 *) pv_api_ip;
 7246|  21.9k|    pu2_ptr_cmd++;
 7247|       |
 7248|  21.9k|    command = *pu2_ptr_cmd;
 7249|  21.9k|    switch(command)
 7250|  21.9k|    {
 7251|    155|        case IVD_CMD_CREATE:
  ------------------
  |  Branch (7251:9): [True: 155, False: 21.7k]
  ------------------
 7252|    155|            u4_api_ret = isvcd_create(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 7253|    155|            break;
 7254|    154|        case IVD_CMD_DELETE:
  ------------------
  |  Branch (7254:9): [True: 154, False: 21.7k]
  ------------------
 7255|    154|            u4_api_ret = isvcd_delete(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 7256|    154|            break;
 7257|       |
 7258|  20.5k|        case IVD_CMD_VIDEO_DECODE:
  ------------------
  |  Branch (7258:9): [True: 20.5k, False: 1.43k]
  ------------------
 7259|  20.5k|            u4_api_ret = isvcd_video_decode(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 7260|  20.5k|            break;
 7261|       |
 7262|      0|        case IVD_CMD_GET_DISPLAY_FRAME:
  ------------------
  |  Branch (7262:9): [True: 0, False: 21.9k]
  ------------------
 7263|      0|            u4_api_ret = ih264d_get_display_frame(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 7264|       |
 7265|      0|            break;
 7266|       |
 7267|      0|        case IVD_CMD_SET_DISPLAY_FRAME:
  ------------------
  |  Branch (7267:9): [True: 0, False: 21.9k]
  ------------------
 7268|      0|            u4_api_ret = isvcd_set_display_frame(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 7269|       |
 7270|      0|            break;
 7271|       |
 7272|      0|        case IVD_CMD_REL_DISPLAY_FRAME:
  ------------------
  |  Branch (7272:9): [True: 0, False: 21.9k]
  ------------------
 7273|      0|            u4_api_ret = isvcd_rel_display_frame(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 7274|      0|            break;
 7275|       |
 7276|  1.12k|        case IVD_CMD_VIDEO_CTL:
  ------------------
  |  Branch (7276:9): [True: 1.12k, False: 20.8k]
  ------------------
 7277|  1.12k|            u4_api_ret = isvcd_ctl(dec_hdl, (void *) pv_api_ip, (void *) pv_api_op);
 7278|  1.12k|            break;
 7279|      0|        default:
  ------------------
  |  Branch (7279:9): [True: 0, False: 21.9k]
  ------------------
 7280|      0|            u4_api_ret = IV_FAIL;
 7281|      0|            break;
 7282|  21.9k|    }
 7283|       |
 7284|  21.9k|    return u4_api_ret;
 7285|  21.9k|}
isvcd_api.c:api_check_struct_sanity:
  188|  22.1k|{
  189|  22.1k|    IVD_API_COMMAND_TYPE_T e_cmd;
  190|  22.1k|    UWORD32 *pu4_api_ip;
  191|  22.1k|    UWORD32 *pu4_api_op;
  192|  22.1k|    UWORD32 i;
  193|       |
  194|  22.1k|    if(NULL == pv_api_op) return (IV_FAIL);
  ------------------
  |  Branch (194:8): [True: 0, False: 22.1k]
  ------------------
  195|       |
  196|  22.1k|    if(NULL == pv_api_ip) return (IV_FAIL);
  ------------------
  |  Branch (196:8): [True: 0, False: 22.1k]
  ------------------
  197|       |
  198|  22.1k|    pu4_api_ip = (UWORD32 *) pv_api_ip;
  199|  22.1k|    pu4_api_op = (UWORD32 *) pv_api_op;
  200|  22.1k|    e_cmd = *(pu4_api_ip + 1);
  201|       |
  202|       |    /* error checks on handle */
  203|  22.1k|    switch((WORD32) e_cmd)
  204|  22.1k|    {
  205|    155|        case IVD_CMD_CREATE:
  ------------------
  |  Branch (205:9): [True: 155, False: 22.0k]
  ------------------
  206|    155|            break;
  207|       |
  208|      0|        case IVD_CMD_REL_DISPLAY_FRAME:
  ------------------
  |  Branch (208:9): [True: 0, False: 22.1k]
  ------------------
  209|      0|        case IVD_CMD_SET_DISPLAY_FRAME:
  ------------------
  |  Branch (209:9): [True: 0, False: 22.1k]
  ------------------
  210|      0|        case IVD_CMD_GET_DISPLAY_FRAME:
  ------------------
  |  Branch (210:9): [True: 0, False: 22.1k]
  ------------------
  211|  20.7k|        case IVD_CMD_VIDEO_DECODE:
  ------------------
  |  Branch (211:9): [True: 20.7k, False: 1.43k]
  ------------------
  212|  20.8k|        case IVD_CMD_DELETE:
  ------------------
  |  Branch (212:9): [True: 155, False: 22.0k]
  ------------------
  213|  22.0k|        case IVD_CMD_VIDEO_CTL:
  ------------------
  |  Branch (213:9): [True: 1.12k, False: 21.0k]
  ------------------
  214|  22.0k|            if(ps_handle == NULL)
  ------------------
  |  Branch (214:16): [True: 206, False: 21.7k]
  ------------------
  215|    206|            {
  216|    206|                *(pu4_api_op + 1) |= 1 << IVD_UNSUPPORTEDPARAM;
  217|    206|                *(pu4_api_op + 1) |= IVD_HANDLE_NULL;
  218|    206|                return IV_FAIL;
  219|    206|            }
  220|       |
  221|  21.7k|            if(ps_handle->u4_size != sizeof(iv_obj_t))
  ------------------
  |  Branch (221:16): [True: 0, False: 21.7k]
  ------------------
  222|      0|            {
  223|      0|                *(pu4_api_op + 1) |= 1 << IVD_UNSUPPORTEDPARAM;
  224|      0|                *(pu4_api_op + 1) |= IVD_HANDLE_STRUCT_SIZE_INCORRECT;
  225|      0|                return IV_FAIL;
  226|      0|            }
  227|       |
  228|  21.7k|            if(ps_handle->pv_fxns != isvcd_api_function)
  ------------------
  |  Branch (228:16): [True: 0, False: 21.7k]
  ------------------
  229|      0|            {
  230|      0|                *(pu4_api_op + 1) |= 1 << IVD_UNSUPPORTEDPARAM;
  231|      0|                *(pu4_api_op + 1) |= IVD_INVALID_HANDLE_NULL;
  232|      0|                return IV_FAIL;
  233|      0|            }
  234|       |
  235|  21.7k|            if(ps_handle->pv_codec_handle == NULL)
  ------------------
  |  Branch (235:16): [True: 0, False: 21.7k]
  ------------------
  236|      0|            {
  237|      0|                *(pu4_api_op + 1) |= 1 << IVD_UNSUPPORTEDPARAM;
  238|      0|                *(pu4_api_op + 1) |= IVD_INVALID_HANDLE_NULL;
  239|      0|                return IV_FAIL;
  240|      0|            }
  241|  21.7k|            break;
  242|  21.7k|        default:
  ------------------
  |  Branch (242:9): [True: 0, False: 22.1k]
  ------------------
  243|      0|            *(pu4_api_op + 1) |= 1 << IVD_UNSUPPORTEDPARAM;
  244|      0|            *(pu4_api_op + 1) |= IVD_INVALID_API_CMD;
  245|      0|            return IV_FAIL;
  246|  22.1k|    }
  247|       |
  248|  21.9k|    switch((WORD32) e_cmd)
  ------------------
  |  Branch (248:12): [True: 21.9k, False: 0]
  ------------------
  249|  21.9k|    {
  250|    155|        case IVD_CMD_CREATE:
  ------------------
  |  Branch (250:9): [True: 155, False: 21.7k]
  ------------------
  251|    155|        {
  252|    155|            isvcd_create_ip_t *ps_ip = (isvcd_create_ip_t *) pv_api_ip;
  253|    155|            isvcd_create_op_t *ps_op = (isvcd_create_op_t *) pv_api_op;
  254|       |
  255|    155|            ps_op->s_ivd_create_op_t.u4_error_code = 0;
  256|       |
  257|    155|            if((ps_ip->s_ivd_create_ip_t.u4_size > sizeof(isvcd_create_ip_t)) ||
  ------------------
  |  Branch (257:16): [True: 0, False: 155]
  ------------------
  258|    155|               (ps_ip->s_ivd_create_ip_t.u4_size < sizeof(ivd_create_ip_t)))
  ------------------
  |  Branch (258:16): [True: 0, False: 155]
  ------------------
  259|      0|            {
  260|      0|                ps_op->s_ivd_create_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  261|      0|                ps_op->s_ivd_create_op_t.u4_error_code |= IVD_IP_API_STRUCT_SIZE_INCORRECT;
  262|      0|                H264_DEC_DEBUG_PRINT("\n");
  ------------------
  |  |   39|      0|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
  263|      0|                return (IV_FAIL);
  264|      0|            }
  265|       |
  266|    155|            if((ps_op->s_ivd_create_op_t.u4_size != sizeof(isvcd_create_op_t)) &&
  ------------------
  |  Branch (266:16): [True: 0, False: 155]
  ------------------
  267|      0|               (ps_op->s_ivd_create_op_t.u4_size != sizeof(ivd_create_op_t)))
  ------------------
  |  Branch (267:16): [True: 0, False: 0]
  ------------------
  268|      0|            {
  269|      0|                ps_op->s_ivd_create_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  270|      0|                ps_op->s_ivd_create_op_t.u4_error_code |= IVD_OP_API_STRUCT_SIZE_INCORRECT;
  271|      0|                H264_DEC_DEBUG_PRINT("\n");
  ------------------
  |  |   39|      0|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
  272|      0|                return (IV_FAIL);
  273|      0|            }
  274|       |
  275|    155|            if((ps_ip->s_ivd_create_ip_t.e_output_format != IV_YUV_420P) &&
  ------------------
  |  Branch (275:16): [True: 74, False: 81]
  ------------------
  276|     74|               (ps_ip->s_ivd_create_ip_t.e_output_format != IV_YUV_422ILE) &&
  ------------------
  |  Branch (276:16): [True: 74, False: 0]
  ------------------
  277|     74|               (ps_ip->s_ivd_create_ip_t.e_output_format != IV_RGB_565) &&
  ------------------
  |  Branch (277:16): [True: 73, False: 1]
  ------------------
  278|     73|               (ps_ip->s_ivd_create_ip_t.e_output_format != IV_YUV_420SP_UV) &&
  ------------------
  |  Branch (278:16): [True: 34, False: 39]
  ------------------
  279|     34|               (ps_ip->s_ivd_create_ip_t.e_output_format != IV_YUV_420SP_VU))
  ------------------
  |  Branch (279:16): [True: 0, False: 34]
  ------------------
  280|      0|            {
  281|      0|                ps_op->s_ivd_create_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  282|      0|                ps_op->s_ivd_create_op_t.u4_error_code |= IVD_INIT_DEC_COL_FMT_NOT_SUPPORTED;
  283|      0|                H264_DEC_DEBUG_PRINT("\n");
  ------------------
  |  |   39|      0|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
  284|      0|                return (IV_FAIL);
  285|      0|            }
  286|    155|        }
  287|    155|        break;
  288|       |
  289|    155|        case IVD_CMD_GET_DISPLAY_FRAME:
  ------------------
  |  Branch (289:9): [True: 0, False: 21.9k]
  ------------------
  290|      0|        {
  291|      0|            isvcd_get_display_frame_ip_t *ps_ip = (isvcd_get_display_frame_ip_t *) pv_api_ip;
  292|      0|            isvcd_get_display_frame_op_t *ps_op = (isvcd_get_display_frame_op_t *) pv_api_op;
  293|       |
  294|      0|            ps_op->s_ivd_get_display_frame_op_t.u4_error_code = 0;
  295|       |
  296|      0|            if((ps_ip->s_ivd_get_display_frame_ip_t.u4_size !=
  ------------------
  |  Branch (296:16): [True: 0, False: 0]
  ------------------
  297|      0|                sizeof(isvcd_get_display_frame_ip_t)) &&
  298|      0|               (ps_ip->s_ivd_get_display_frame_ip_t.u4_size != sizeof(ivd_get_display_frame_ip_t)))
  ------------------
  |  Branch (298:16): [True: 0, False: 0]
  ------------------
  299|      0|            {
  300|      0|                ps_op->s_ivd_get_display_frame_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  301|      0|                ps_op->s_ivd_get_display_frame_op_t.u4_error_code |=
  302|      0|                    IVD_IP_API_STRUCT_SIZE_INCORRECT;
  303|      0|                return (IV_FAIL);
  304|      0|            }
  305|       |
  306|      0|            if((ps_op->s_ivd_get_display_frame_op_t.u4_size !=
  ------------------
  |  Branch (306:16): [True: 0, False: 0]
  ------------------
  307|      0|                sizeof(isvcd_get_display_frame_op_t)) &&
  308|      0|               (ps_op->s_ivd_get_display_frame_op_t.u4_size != sizeof(ivd_get_display_frame_op_t)))
  ------------------
  |  Branch (308:16): [True: 0, False: 0]
  ------------------
  309|      0|            {
  310|      0|                ps_op->s_ivd_get_display_frame_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  311|      0|                ps_op->s_ivd_get_display_frame_op_t.u4_error_code |=
  312|      0|                    IVD_OP_API_STRUCT_SIZE_INCORRECT;
  313|      0|                return (IV_FAIL);
  314|      0|            }
  315|      0|        }
  316|      0|        break;
  317|       |
  318|      0|        case IVD_CMD_REL_DISPLAY_FRAME:
  ------------------
  |  Branch (318:9): [True: 0, False: 21.9k]
  ------------------
  319|      0|        {
  320|      0|            isvcd_rel_display_frame_ip_t *ps_ip = (isvcd_rel_display_frame_ip_t *) pv_api_ip;
  321|      0|            isvcd_rel_display_frame_op_t *ps_op = (isvcd_rel_display_frame_op_t *) pv_api_op;
  322|       |
  323|      0|            ps_op->s_ivd_rel_display_frame_op_t.u4_error_code = 0;
  324|       |
  325|      0|            if((ps_ip->s_ivd_rel_display_frame_ip_t.u4_size !=
  ------------------
  |  Branch (325:16): [True: 0, False: 0]
  ------------------
  326|      0|                sizeof(isvcd_rel_display_frame_ip_t)) &&
  327|      0|               (ps_ip->s_ivd_rel_display_frame_ip_t.u4_size != sizeof(ivd_rel_display_frame_ip_t)))
  ------------------
  |  Branch (327:16): [True: 0, False: 0]
  ------------------
  328|      0|            {
  329|      0|                ps_op->s_ivd_rel_display_frame_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  330|      0|                ps_op->s_ivd_rel_display_frame_op_t.u4_error_code |=
  331|      0|                    IVD_IP_API_STRUCT_SIZE_INCORRECT;
  332|      0|                return (IV_FAIL);
  333|      0|            }
  334|       |
  335|      0|            if((ps_op->s_ivd_rel_display_frame_op_t.u4_size !=
  ------------------
  |  Branch (335:16): [True: 0, False: 0]
  ------------------
  336|      0|                sizeof(isvcd_rel_display_frame_op_t)) &&
  337|      0|               (ps_op->s_ivd_rel_display_frame_op_t.u4_size != sizeof(ivd_rel_display_frame_op_t)))
  ------------------
  |  Branch (337:16): [True: 0, False: 0]
  ------------------
  338|      0|            {
  339|      0|                ps_op->s_ivd_rel_display_frame_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  340|      0|                ps_op->s_ivd_rel_display_frame_op_t.u4_error_code |=
  341|      0|                    IVD_OP_API_STRUCT_SIZE_INCORRECT;
  342|      0|                return (IV_FAIL);
  343|      0|            }
  344|      0|        }
  345|      0|        break;
  346|       |
  347|      0|        case IVD_CMD_SET_DISPLAY_FRAME:
  ------------------
  |  Branch (347:9): [True: 0, False: 21.9k]
  ------------------
  348|      0|        {
  349|      0|            isvcd_set_display_frame_ip_t *ps_ip = (isvcd_set_display_frame_ip_t *) pv_api_ip;
  350|      0|            isvcd_set_display_frame_op_t *ps_op = (isvcd_set_display_frame_op_t *) pv_api_op;
  351|      0|            UWORD32 j;
  352|       |
  353|      0|            ps_op->s_ivd_set_display_frame_op_t.u4_error_code = 0;
  354|       |
  355|      0|            if((ps_ip->s_ivd_set_display_frame_ip_t.u4_size !=
  ------------------
  |  Branch (355:16): [True: 0, False: 0]
  ------------------
  356|      0|                sizeof(isvcd_set_display_frame_ip_t)) &&
  357|      0|               (ps_ip->s_ivd_set_display_frame_ip_t.u4_size != sizeof(ivd_set_display_frame_ip_t)))
  ------------------
  |  Branch (357:16): [True: 0, False: 0]
  ------------------
  358|      0|            {
  359|      0|                ps_op->s_ivd_set_display_frame_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  360|      0|                ps_op->s_ivd_set_display_frame_op_t.u4_error_code |=
  361|      0|                    IVD_IP_API_STRUCT_SIZE_INCORRECT;
  362|      0|                return (IV_FAIL);
  363|      0|            }
  364|       |
  365|      0|            if((ps_op->s_ivd_set_display_frame_op_t.u4_size !=
  ------------------
  |  Branch (365:16): [True: 0, False: 0]
  ------------------
  366|      0|                sizeof(isvcd_set_display_frame_op_t)) &&
  367|      0|               (ps_op->s_ivd_set_display_frame_op_t.u4_size != sizeof(ivd_set_display_frame_op_t)))
  ------------------
  |  Branch (367:16): [True: 0, False: 0]
  ------------------
  368|      0|            {
  369|      0|                ps_op->s_ivd_set_display_frame_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  370|      0|                ps_op->s_ivd_set_display_frame_op_t.u4_error_code |=
  371|      0|                    IVD_OP_API_STRUCT_SIZE_INCORRECT;
  372|      0|                return (IV_FAIL);
  373|      0|            }
  374|       |
  375|      0|            if(ps_ip->s_ivd_set_display_frame_ip_t.num_disp_bufs == 0)
  ------------------
  |  Branch (375:16): [True: 0, False: 0]
  ------------------
  376|      0|            {
  377|      0|                ps_op->s_ivd_set_display_frame_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  378|      0|                ps_op->s_ivd_set_display_frame_op_t.u4_error_code |= IVD_DISP_FRM_ZERO_OP_BUFS;
  379|      0|                return IV_FAIL;
  380|      0|            }
  381|       |
  382|      0|            for(j = 0; j < ps_ip->s_ivd_set_display_frame_ip_t.num_disp_bufs; j++)
  ------------------
  |  Branch (382:24): [True: 0, False: 0]
  ------------------
  383|      0|            {
  384|      0|                if(ps_ip->s_ivd_set_display_frame_ip_t.s_disp_buffer[j].u4_num_bufs == 0)
  ------------------
  |  Branch (384:20): [True: 0, False: 0]
  ------------------
  385|      0|                {
  386|      0|                    ps_op->s_ivd_set_display_frame_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  387|      0|                    ps_op->s_ivd_set_display_frame_op_t.u4_error_code |= IVD_DISP_FRM_ZERO_OP_BUFS;
  388|      0|                    return IV_FAIL;
  389|      0|                }
  390|       |
  391|      0|                for(i = 0; i < ps_ip->s_ivd_set_display_frame_ip_t.s_disp_buffer[j].u4_num_bufs;
  ------------------
  |  Branch (391:28): [True: 0, False: 0]
  ------------------
  392|      0|                    i++)
  393|      0|                {
  394|      0|                    if(ps_ip->s_ivd_set_display_frame_ip_t.s_disp_buffer[j].pu1_bufs[i] == NULL)
  ------------------
  |  Branch (394:24): [True: 0, False: 0]
  ------------------
  395|      0|                    {
  396|      0|                        ps_op->s_ivd_set_display_frame_op_t.u4_error_code |=
  397|      0|                            1 << IVD_UNSUPPORTEDPARAM;
  398|      0|                        ps_op->s_ivd_set_display_frame_op_t.u4_error_code |=
  399|      0|                            IVD_DISP_FRM_OP_BUF_NULL;
  400|      0|                        return IV_FAIL;
  401|      0|                    }
  402|       |
  403|      0|                    if(ps_ip->s_ivd_set_display_frame_ip_t.s_disp_buffer[j]
  ------------------
  |  Branch (403:24): [True: 0, False: 0]
  ------------------
  404|      0|                           .u4_min_out_buf_size[i] == 0)
  405|      0|                    {
  406|      0|                        ps_op->s_ivd_set_display_frame_op_t.u4_error_code |=
  407|      0|                            1 << IVD_UNSUPPORTEDPARAM;
  408|      0|                        ps_op->s_ivd_set_display_frame_op_t.u4_error_code |=
  409|      0|                            IVD_DISP_FRM_ZERO_OP_BUF_SIZE;
  410|      0|                        return IV_FAIL;
  411|      0|                    }
  412|      0|                }
  413|      0|            }
  414|      0|        }
  415|      0|        break;
  416|       |
  417|  20.5k|        case IVD_CMD_VIDEO_DECODE:
  ------------------
  |  Branch (417:9): [True: 20.5k, False: 1.43k]
  ------------------
  418|  20.5k|        {
  419|  20.5k|            isvcd_video_decode_ip_t *ps_ip = (isvcd_video_decode_ip_t *) pv_api_ip;
  420|  20.5k|            isvcd_video_decode_op_t *ps_op = (isvcd_video_decode_op_t *) pv_api_op;
  421|       |
  422|  20.5k|            H264_DEC_DEBUG_PRINT("The input bytes is: %d",
  ------------------
  |  |   39|  20.5k|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
  423|  20.5k|                                 ps_ip->s_ivd_video_decode_ip_t.u4_num_Bytes);
  424|  20.5k|            ps_op->s_ivd_video_decode_op_t.u4_error_code = 0;
  425|       |
  426|  20.5k|            if(ps_ip->s_ivd_video_decode_ip_t.u4_size != sizeof(isvcd_video_decode_ip_t) &&
  ------------------
  |  Branch (426:16): [True: 0, False: 20.5k]
  ------------------
  427|      0|               ps_ip->s_ivd_video_decode_ip_t.u4_size !=
  ------------------
  |  Branch (427:16): [True: 0, False: 0]
  ------------------
  428|      0|                   offsetof(ivd_video_decode_ip_t, s_out_buffer))
  429|      0|            {
  430|      0|                ps_op->s_ivd_video_decode_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  431|      0|                ps_op->s_ivd_video_decode_op_t.u4_error_code |= IVD_IP_API_STRUCT_SIZE_INCORRECT;
  432|      0|                return (IV_FAIL);
  433|      0|            }
  434|       |
  435|  20.5k|            if(ps_op->s_ivd_video_decode_op_t.u4_size != sizeof(isvcd_video_decode_op_t) &&
  ------------------
  |  Branch (435:16): [True: 0, False: 20.5k]
  ------------------
  436|      0|               ps_op->s_ivd_video_decode_op_t.u4_size !=
  ------------------
  |  Branch (436:16): [True: 0, False: 0]
  ------------------
  437|      0|                   offsetof(ivd_video_decode_op_t, u4_output_present))
  438|      0|            {
  439|      0|                ps_op->s_ivd_video_decode_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  440|      0|                ps_op->s_ivd_video_decode_op_t.u4_error_code |= IVD_OP_API_STRUCT_SIZE_INCORRECT;
  441|      0|                return (IV_FAIL);
  442|      0|            }
  443|  20.5k|            {
  444|  20.5k|                svc_dec_ctxt_t *ps_svcd_ctxt;
  445|  20.5k|                svc_dec_lyr_struct_t *ps_svc_lyr_dec;
  446|  20.5k|                dec_struct_t *ps_dec;
  447|  20.5k|                ps_svcd_ctxt = (svc_dec_ctxt_t *) (ps_handle->pv_codec_handle);
  448|  20.5k|                ps_svc_lyr_dec = &ps_svcd_ctxt->ps_svc_dec_lyr[0];
  449|  20.5k|                ps_dec = &ps_svc_lyr_dec->s_dec;
  450|  20.5k|                if(ps_dec->u1_enable_mb_info)
  ------------------
  |  Branch (450:20): [True: 0, False: 20.5k]
  ------------------
  451|      0|                {
  452|      0|                    if(!ps_ip->pu1_8x8_blk_qp_map && !ps_ip->pu1_8x8_blk_type_map)
  ------------------
  |  Branch (452:24): [True: 0, False: 0]
  |  Branch (452:54): [True: 0, False: 0]
  ------------------
  453|      0|                    {
  454|      0|                        ps_op->s_ivd_video_decode_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  455|      0|                        ps_op->s_ivd_video_decode_op_t.u4_error_code |=
  456|      0|                            IH264D_FRAME_INFO_OP_BUF_NULL;
  457|      0|                        return IV_FAIL;
  458|      0|                    }
  459|      0|                }
  460|  20.5k|            }
  461|  20.5k|        }
  462|  20.5k|        break;
  463|       |
  464|  20.5k|        case IVD_CMD_DELETE:
  ------------------
  |  Branch (464:9): [True: 154, False: 21.7k]
  ------------------
  465|    154|        {
  466|    154|            isvcd_delete_ip_t *ps_ip = (isvcd_delete_ip_t *) pv_api_ip;
  467|    154|            isvcd_delete_op_t *ps_op = (isvcd_delete_op_t *) pv_api_op;
  468|       |
  469|    154|            ps_op->s_ivd_delete_op_t.u4_error_code = 0;
  470|       |
  471|    154|            if(ps_ip->s_ivd_delete_ip_t.u4_size != sizeof(isvcd_delete_ip_t))
  ------------------
  |  Branch (471:16): [True: 0, False: 154]
  ------------------
  472|      0|            {
  473|      0|                ps_op->s_ivd_delete_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  474|      0|                ps_op->s_ivd_delete_op_t.u4_error_code |= IVD_IP_API_STRUCT_SIZE_INCORRECT;
  475|      0|                return (IV_FAIL);
  476|      0|            }
  477|       |
  478|    154|            if(ps_op->s_ivd_delete_op_t.u4_size != sizeof(isvcd_delete_op_t))
  ------------------
  |  Branch (478:16): [True: 0, False: 154]
  ------------------
  479|      0|            {
  480|      0|                ps_op->s_ivd_delete_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  481|      0|                ps_op->s_ivd_delete_op_t.u4_error_code |= IVD_OP_API_STRUCT_SIZE_INCORRECT;
  482|      0|                return (IV_FAIL);
  483|      0|            }
  484|    154|        }
  485|    154|        break;
  486|       |
  487|  1.12k|        case IVD_CMD_VIDEO_CTL:
  ------------------
  |  Branch (487:9): [True: 1.12k, False: 20.8k]
  ------------------
  488|  1.12k|        {
  489|  1.12k|            UWORD32 *pu4_ptr_cmd;
  490|  1.12k|            UWORD32 sub_command;
  491|       |
  492|  1.12k|            pu4_ptr_cmd = (UWORD32 *) pv_api_ip;
  493|  1.12k|            pu4_ptr_cmd += 2;
  494|  1.12k|            sub_command = *pu4_ptr_cmd;
  495|       |
  496|  1.12k|            switch(sub_command)
  497|  1.12k|            {
  498|    308|                case IVD_CMD_CTL_SETPARAMS:
  ------------------
  |  Branch (498:17): [True: 308, False: 816]
  ------------------
  499|    308|                {
  500|    308|                    isvcd_ctl_set_config_ip_t *ps_ip;
  501|    308|                    isvcd_ctl_set_config_op_t *ps_op;
  502|    308|                    ps_ip = (isvcd_ctl_set_config_ip_t *) pv_api_ip;
  503|    308|                    ps_op = (isvcd_ctl_set_config_op_t *) pv_api_op;
  504|       |
  505|    308|                    if(ps_ip->s_ivd_ctl_set_config_ip_t.u4_size !=
  ------------------
  |  Branch (505:24): [True: 0, False: 308]
  ------------------
  506|    308|                       sizeof(isvcd_ctl_set_config_ip_t))
  507|      0|                    {
  508|      0|                        ps_op->s_ivd_ctl_set_config_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  509|      0|                        ps_op->s_ivd_ctl_set_config_op_t.u4_error_code |=
  510|      0|                            IVD_IP_API_STRUCT_SIZE_INCORRECT;
  511|      0|                        return IV_FAIL;
  512|      0|                    }
  513|    308|                }
  514|    308|                break;
  515|       |
  516|    308|                case IVD_CMD_CTL_SETDEFAULT:
  ------------------
  |  Branch (516:17): [True: 0, False: 1.12k]
  ------------------
  517|      0|                {
  518|      0|                    isvcd_ctl_set_config_op_t *ps_op;
  519|      0|                    ps_op = (isvcd_ctl_set_config_op_t *) pv_api_op;
  520|      0|                    if(ps_op->s_ivd_ctl_set_config_op_t.u4_size !=
  ------------------
  |  Branch (520:24): [True: 0, False: 0]
  ------------------
  521|      0|                       sizeof(isvcd_ctl_set_config_op_t))
  522|      0|                    {
  523|      0|                        ps_op->s_ivd_ctl_set_config_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  524|      0|                        ps_op->s_ivd_ctl_set_config_op_t.u4_error_code |=
  525|      0|                            IVD_OP_API_STRUCT_SIZE_INCORRECT;
  526|      0|                        return IV_FAIL;
  527|      0|                    }
  528|      0|                }
  529|      0|                break;
  530|       |
  531|      0|                case IVD_CMD_CTL_GETPARAMS:
  ------------------
  |  Branch (531:17): [True: 0, False: 1.12k]
  ------------------
  532|      0|                {
  533|      0|                    isvcd_ctl_getstatus_ip_t *ps_ip;
  534|      0|                    isvcd_ctl_getstatus_op_t *ps_op;
  535|       |
  536|      0|                    ps_ip = (isvcd_ctl_getstatus_ip_t *) pv_api_ip;
  537|      0|                    ps_op = (isvcd_ctl_getstatus_op_t *) pv_api_op;
  538|      0|                    if(ps_ip->s_ivd_ctl_getstatus_ip_t.u4_size != sizeof(isvcd_ctl_getstatus_ip_t))
  ------------------
  |  Branch (538:24): [True: 0, False: 0]
  ------------------
  539|      0|                    {
  540|      0|                        ps_op->s_ivd_ctl_getstatus_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  541|      0|                        ps_op->s_ivd_ctl_getstatus_op_t.u4_error_code |=
  542|      0|                            IVD_IP_API_STRUCT_SIZE_INCORRECT;
  543|      0|                        return IV_FAIL;
  544|      0|                    }
  545|      0|                    if(ps_op->s_ivd_ctl_getstatus_op_t.u4_size != sizeof(isvcd_ctl_getstatus_op_t))
  ------------------
  |  Branch (545:24): [True: 0, False: 0]
  ------------------
  546|      0|                    {
  547|      0|                        ps_op->s_ivd_ctl_getstatus_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  548|      0|                        ps_op->s_ivd_ctl_getstatus_op_t.u4_error_code |=
  549|      0|                            IVD_OP_API_STRUCT_SIZE_INCORRECT;
  550|      0|                        return IV_FAIL;
  551|      0|                    }
  552|      0|                }
  553|      0|                break;
  554|       |
  555|      0|                case IVD_CMD_CTL_GETBUFINFO:
  ------------------
  |  Branch (555:17): [True: 0, False: 1.12k]
  ------------------
  556|      0|                {
  557|      0|                    isvcd_ctl_getbufinfo_ip_t *ps_ip;
  558|      0|                    isvcd_ctl_getbufinfo_op_t *ps_op;
  559|      0|                    ps_ip = (isvcd_ctl_getbufinfo_ip_t *) pv_api_ip;
  560|      0|                    ps_op = (isvcd_ctl_getbufinfo_op_t *) pv_api_op;
  561|       |
  562|      0|                    if(ps_ip->s_ivd_ctl_getbufinfo_ip_t.u4_size !=
  ------------------
  |  Branch (562:24): [True: 0, False: 0]
  ------------------
  563|      0|                       sizeof(isvcd_ctl_getbufinfo_ip_t))
  564|      0|                    {
  565|      0|                        ps_op->s_ivd_ctl_getbufinfo_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  566|      0|                        ps_op->s_ivd_ctl_getbufinfo_op_t.u4_error_code |=
  567|      0|                            IVD_IP_API_STRUCT_SIZE_INCORRECT;
  568|      0|                        return IV_FAIL;
  569|      0|                    }
  570|      0|                    if(ps_op->s_ivd_ctl_getbufinfo_op_t.u4_size !=
  ------------------
  |  Branch (570:24): [True: 0, False: 0]
  ------------------
  571|      0|                       sizeof(isvcd_ctl_getbufinfo_op_t))
  572|      0|                    {
  573|      0|                        ps_op->s_ivd_ctl_getbufinfo_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  574|      0|                        ps_op->s_ivd_ctl_getbufinfo_op_t.u4_error_code |=
  575|      0|                            IVD_OP_API_STRUCT_SIZE_INCORRECT;
  576|      0|                        return IV_FAIL;
  577|      0|                    }
  578|      0|                }
  579|      0|                break;
  580|       |
  581|      0|                case IVD_CMD_CTL_GETVERSION:
  ------------------
  |  Branch (581:17): [True: 0, False: 1.12k]
  ------------------
  582|      0|                {
  583|      0|                    isvcd_ctl_getversioninfo_ip_t *ps_ip;
  584|      0|                    isvcd_ctl_getversioninfo_op_t *ps_op;
  585|      0|                    ps_ip = (isvcd_ctl_getversioninfo_ip_t *) pv_api_ip;
  586|      0|                    ps_op = (isvcd_ctl_getversioninfo_op_t *) pv_api_op;
  587|      0|                    if(ps_ip->s_ivd_ctl_getversioninfo_ip_t.u4_size !=
  ------------------
  |  Branch (587:24): [True: 0, False: 0]
  ------------------
  588|      0|                       sizeof(isvcd_ctl_getversioninfo_ip_t))
  589|      0|                    {
  590|      0|                        ps_op->s_ivd_ctl_getversioninfo_op_t.u4_error_code |=
  591|      0|                            1 << IVD_UNSUPPORTEDPARAM;
  592|      0|                        ps_op->s_ivd_ctl_getversioninfo_op_t.u4_error_code |=
  593|      0|                            IVD_IP_API_STRUCT_SIZE_INCORRECT;
  594|      0|                        return IV_FAIL;
  595|      0|                    }
  596|      0|                    if(ps_op->s_ivd_ctl_getversioninfo_op_t.u4_size !=
  ------------------
  |  Branch (596:24): [True: 0, False: 0]
  ------------------
  597|      0|                       sizeof(isvcd_ctl_getversioninfo_op_t))
  598|      0|                    {
  599|      0|                        ps_op->s_ivd_ctl_getversioninfo_op_t.u4_error_code |=
  600|      0|                            1 << IVD_UNSUPPORTEDPARAM;
  601|      0|                        ps_op->s_ivd_ctl_getversioninfo_op_t.u4_error_code |=
  602|      0|                            IVD_OP_API_STRUCT_SIZE_INCORRECT;
  603|      0|                        return IV_FAIL;
  604|      0|                    }
  605|      0|                }
  606|      0|                break;
  607|       |
  608|      0|                case IVD_CMD_CTL_FLUSH:
  ------------------
  |  Branch (608:17): [True: 0, False: 1.12k]
  ------------------
  609|      0|                {
  610|      0|                    isvcd_ctl_flush_ip_t *ps_ip;
  611|      0|                    isvcd_ctl_flush_op_t *ps_op;
  612|      0|                    ps_ip = (isvcd_ctl_flush_ip_t *) pv_api_ip;
  613|      0|                    ps_op = (isvcd_ctl_flush_op_t *) pv_api_op;
  614|      0|                    if(ps_ip->s_ivd_ctl_flush_ip_t.u4_size != sizeof(isvcd_ctl_flush_ip_t))
  ------------------
  |  Branch (614:24): [True: 0, False: 0]
  ------------------
  615|      0|                    {
  616|      0|                        ps_op->s_ivd_ctl_flush_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  617|      0|                        ps_op->s_ivd_ctl_flush_op_t.u4_error_code |=
  618|      0|                            IVD_IP_API_STRUCT_SIZE_INCORRECT;
  619|      0|                        return IV_FAIL;
  620|      0|                    }
  621|      0|                    if(ps_op->s_ivd_ctl_flush_op_t.u4_size != sizeof(isvcd_ctl_flush_op_t))
  ------------------
  |  Branch (621:24): [True: 0, False: 0]
  ------------------
  622|      0|                    {
  623|      0|                        ps_op->s_ivd_ctl_flush_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  624|      0|                        ps_op->s_ivd_ctl_flush_op_t.u4_error_code |=
  625|      0|                            IVD_OP_API_STRUCT_SIZE_INCORRECT;
  626|      0|                        return IV_FAIL;
  627|      0|                    }
  628|      0|                }
  629|      0|                break;
  630|       |
  631|    354|                case IVD_CMD_CTL_RESET:
  ------------------
  |  Branch (631:17): [True: 354, False: 770]
  ------------------
  632|    354|                {
  633|    354|                    isvcd_ctl_reset_ip_t *ps_ip;
  634|    354|                    isvcd_ctl_reset_op_t *ps_op;
  635|    354|                    ps_ip = (isvcd_ctl_reset_ip_t *) pv_api_ip;
  636|    354|                    ps_op = (isvcd_ctl_reset_op_t *) pv_api_op;
  637|    354|                    if(ps_ip->s_ivd_ctl_reset_ip_t.u4_size != sizeof(isvcd_ctl_reset_ip_t))
  ------------------
  |  Branch (637:24): [True: 0, False: 354]
  ------------------
  638|      0|                    {
  639|      0|                        ps_op->s_ivd_ctl_reset_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  640|      0|                        ps_op->s_ivd_ctl_reset_op_t.u4_error_code |=
  641|      0|                            IVD_IP_API_STRUCT_SIZE_INCORRECT;
  642|      0|                        return IV_FAIL;
  643|      0|                    }
  644|    354|                    if(ps_op->s_ivd_ctl_reset_op_t.u4_size != sizeof(isvcd_ctl_reset_op_t))
  ------------------
  |  Branch (644:24): [True: 0, False: 354]
  ------------------
  645|      0|                    {
  646|      0|                        ps_op->s_ivd_ctl_reset_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  647|      0|                        ps_op->s_ivd_ctl_reset_op_t.u4_error_code |=
  648|      0|                            IVD_OP_API_STRUCT_SIZE_INCORRECT;
  649|      0|                        return IV_FAIL;
  650|      0|                    }
  651|    354|                }
  652|    354|                break;
  653|       |
  654|    354|                case IH264D_CMD_CTL_DEGRADE:
  ------------------
  |  Branch (654:17): [True: 0, False: 1.12k]
  ------------------
  655|      0|                {
  656|      0|                    isvcd_ctl_degrade_ip_t *ps_ip;
  657|      0|                    isvcd_ctl_degrade_op_t *ps_op;
  658|       |
  659|      0|                    ps_ip = (isvcd_ctl_degrade_ip_t *) pv_api_ip;
  660|      0|                    ps_op = (isvcd_ctl_degrade_op_t *) pv_api_op;
  661|       |
  662|      0|                    if(ps_ip->u4_size != sizeof(isvcd_ctl_degrade_ip_t))
  ------------------
  |  Branch (662:24): [True: 0, False: 0]
  ------------------
  663|      0|                    {
  664|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  665|      0|                        ps_op->u4_error_code |= IVD_IP_API_STRUCT_SIZE_INCORRECT;
  666|      0|                        return IV_FAIL;
  667|      0|                    }
  668|       |
  669|      0|                    if(ps_op->u4_size != sizeof(isvcd_ctl_degrade_op_t))
  ------------------
  |  Branch (669:24): [True: 0, False: 0]
  ------------------
  670|      0|                    {
  671|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  672|      0|                        ps_op->u4_error_code |= IVD_OP_API_STRUCT_SIZE_INCORRECT;
  673|      0|                        return IV_FAIL;
  674|      0|                    }
  675|       |
  676|      0|                    if((ps_ip->i4_degrade_pics < 0) || (ps_ip->i4_degrade_pics > 4) ||
  ------------------
  |  Branch (676:24): [True: 0, False: 0]
  |  Branch (676:56): [True: 0, False: 0]
  ------------------
  677|      0|                       (ps_ip->i4_nondegrade_interval < 0) || (ps_ip->i4_degrade_type < 0) ||
  ------------------
  |  Branch (677:24): [True: 0, False: 0]
  |  Branch (677:63): [True: 0, False: 0]
  ------------------
  678|      0|                       (ps_ip->i4_degrade_type > 15))
  ------------------
  |  Branch (678:24): [True: 0, False: 0]
  ------------------
  679|      0|                    {
  680|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  681|      0|                        return IV_FAIL;
  682|      0|                    }
  683|       |
  684|      0|                    break;
  685|      0|                }
  686|       |
  687|      0|                case IH264D_CMD_CTL_GET_BUFFER_DIMENSIONS:
  ------------------
  |  Branch (687:17): [True: 0, False: 1.12k]
  ------------------
  688|      0|                {
  689|      0|                    isvcd_ctl_get_frame_dimensions_ip_t *ps_ip;
  690|      0|                    isvcd_ctl_get_frame_dimensions_op_t *ps_op;
  691|       |
  692|      0|                    ps_ip = (isvcd_ctl_get_frame_dimensions_ip_t *) pv_api_ip;
  693|      0|                    ps_op = (isvcd_ctl_get_frame_dimensions_op_t *) pv_api_op;
  694|       |
  695|      0|                    if(ps_ip->u4_size != sizeof(isvcd_ctl_get_frame_dimensions_ip_t))
  ------------------
  |  Branch (695:24): [True: 0, False: 0]
  ------------------
  696|      0|                    {
  697|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  698|      0|                        ps_op->u4_error_code |= IVD_IP_API_STRUCT_SIZE_INCORRECT;
  699|      0|                        return IV_FAIL;
  700|      0|                    }
  701|       |
  702|      0|                    if(ps_op->u4_size != sizeof(isvcd_ctl_get_frame_dimensions_op_t))
  ------------------
  |  Branch (702:24): [True: 0, False: 0]
  ------------------
  703|      0|                    {
  704|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  705|      0|                        ps_op->u4_error_code |= IVD_OP_API_STRUCT_SIZE_INCORRECT;
  706|      0|                        return IV_FAIL;
  707|      0|                    }
  708|       |
  709|      0|                    break;
  710|      0|                }
  711|      0|                case IH264D_CMD_CTL_GET_VUI_PARAMS:
  ------------------
  |  Branch (711:17): [True: 0, False: 1.12k]
  ------------------
  712|      0|                {
  713|      0|                    isvcd_ctl_get_vui_params_ip_t *ps_ip;
  714|      0|                    isvcd_ctl_get_vui_params_op_t *ps_op;
  715|       |
  716|      0|                    ps_ip = (isvcd_ctl_get_vui_params_ip_t *) pv_api_ip;
  717|      0|                    ps_op = (isvcd_ctl_get_vui_params_op_t *) pv_api_op;
  718|       |
  719|      0|                    if(ps_ip->u4_size != sizeof(isvcd_ctl_get_vui_params_ip_t))
  ------------------
  |  Branch (719:24): [True: 0, False: 0]
  ------------------
  720|      0|                    {
  721|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  722|      0|                        ps_op->u4_error_code |= IVD_IP_API_STRUCT_SIZE_INCORRECT;
  723|      0|                        return IV_FAIL;
  724|      0|                    }
  725|       |
  726|      0|                    if(ps_op->u4_size != sizeof(isvcd_ctl_get_vui_params_op_t))
  ------------------
  |  Branch (726:24): [True: 0, False: 0]
  ------------------
  727|      0|                    {
  728|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  729|      0|                        ps_op->u4_error_code |= IVD_OP_API_STRUCT_SIZE_INCORRECT;
  730|      0|                        return IV_FAIL;
  731|      0|                    }
  732|       |
  733|      0|                    break;
  734|      0|                }
  735|      0|                case IH264D_CMD_CTL_GET_SEI_MDCV_PARAMS:
  ------------------
  |  Branch (735:17): [True: 0, False: 1.12k]
  ------------------
  736|      0|                {
  737|      0|                    isvcd_ctl_get_sei_mdcv_params_ip_t *ps_ip;
  738|      0|                    isvcd_ctl_get_sei_mdcv_params_op_t *ps_op;
  739|       |
  740|      0|                    ps_ip = (isvcd_ctl_get_sei_mdcv_params_ip_t *) pv_api_ip;
  741|      0|                    ps_op = (isvcd_ctl_get_sei_mdcv_params_op_t *) pv_api_op;
  742|       |
  743|      0|                    if(ps_ip->u4_size != sizeof(isvcd_ctl_get_sei_mdcv_params_ip_t))
  ------------------
  |  Branch (743:24): [True: 0, False: 0]
  ------------------
  744|      0|                    {
  745|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  746|      0|                        ps_op->u4_error_code |= IVD_IP_API_STRUCT_SIZE_INCORRECT;
  747|      0|                        return IV_FAIL;
  748|      0|                    }
  749|       |
  750|      0|                    if(ps_op->u4_size != sizeof(isvcd_ctl_get_sei_mdcv_params_op_t))
  ------------------
  |  Branch (750:24): [True: 0, False: 0]
  ------------------
  751|      0|                    {
  752|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  753|      0|                        ps_op->u4_error_code |= IVD_OP_API_STRUCT_SIZE_INCORRECT;
  754|      0|                        return IV_FAIL;
  755|      0|                    }
  756|       |
  757|      0|                    break;
  758|      0|                }
  759|       |
  760|      0|                case IH264D_CMD_CTL_GET_SEI_CLL_PARAMS:
  ------------------
  |  Branch (760:17): [True: 0, False: 1.12k]
  ------------------
  761|      0|                {
  762|      0|                    isvcd_ctl_get_sei_cll_params_ip_t *ps_ip;
  763|      0|                    isvcd_ctl_get_sei_cll_params_op_t *ps_op;
  764|       |
  765|      0|                    ps_ip = (isvcd_ctl_get_sei_cll_params_ip_t *) pv_api_ip;
  766|      0|                    ps_op = (isvcd_ctl_get_sei_cll_params_op_t *) pv_api_op;
  767|       |
  768|      0|                    if(ps_ip->u4_size != sizeof(isvcd_ctl_get_sei_cll_params_ip_t))
  ------------------
  |  Branch (768:24): [True: 0, False: 0]
  ------------------
  769|      0|                    {
  770|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  771|      0|                        ps_op->u4_error_code |= IVD_IP_API_STRUCT_SIZE_INCORRECT;
  772|      0|                        return IV_FAIL;
  773|      0|                    }
  774|       |
  775|      0|                    if(ps_op->u4_size != sizeof(isvcd_ctl_get_sei_cll_params_op_t))
  ------------------
  |  Branch (775:24): [True: 0, False: 0]
  ------------------
  776|      0|                    {
  777|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  778|      0|                        ps_op->u4_error_code |= IVD_OP_API_STRUCT_SIZE_INCORRECT;
  779|      0|                        return IV_FAIL;
  780|      0|                    }
  781|       |
  782|      0|                    break;
  783|      0|                }
  784|       |
  785|      0|                case IH264D_CMD_CTL_GET_SEI_AVE_PARAMS:
  ------------------
  |  Branch (785:17): [True: 0, False: 1.12k]
  ------------------
  786|      0|                {
  787|      0|                    isvcd_ctl_get_sei_ave_params_ip_t *ps_ip;
  788|      0|                    isvcd_ctl_get_sei_ave_params_op_t *ps_op;
  789|       |
  790|      0|                    ps_ip = (isvcd_ctl_get_sei_ave_params_ip_t *) pv_api_ip;
  791|      0|                    ps_op = (isvcd_ctl_get_sei_ave_params_op_t *) pv_api_op;
  792|       |
  793|      0|                    if(ps_ip->u4_size != sizeof(isvcd_ctl_get_sei_ave_params_ip_t))
  ------------------
  |  Branch (793:24): [True: 0, False: 0]
  ------------------
  794|      0|                    {
  795|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  796|      0|                        ps_op->u4_error_code |= IVD_IP_API_STRUCT_SIZE_INCORRECT;
  797|      0|                        return IV_FAIL;
  798|      0|                    }
  799|       |
  800|      0|                    if(ps_op->u4_size != sizeof(isvcd_ctl_get_sei_ave_params_op_t))
  ------------------
  |  Branch (800:24): [True: 0, False: 0]
  ------------------
  801|      0|                    {
  802|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  803|      0|                        ps_op->u4_error_code |= IVD_OP_API_STRUCT_SIZE_INCORRECT;
  804|      0|                        return IV_FAIL;
  805|      0|                    }
  806|       |
  807|      0|                    break;
  808|      0|                }
  809|       |
  810|      0|                case IH264D_CMD_CTL_GET_SEI_CCV_PARAMS:
  ------------------
  |  Branch (810:17): [True: 0, False: 1.12k]
  ------------------
  811|      0|                {
  812|      0|                    isvcd_ctl_get_sei_ccv_params_ip_t *ps_ip;
  813|      0|                    isvcd_ctl_get_sei_ccv_params_op_t *ps_op;
  814|       |
  815|      0|                    ps_ip = (isvcd_ctl_get_sei_ccv_params_ip_t *) pv_api_ip;
  816|      0|                    ps_op = (isvcd_ctl_get_sei_ccv_params_op_t *) pv_api_op;
  817|       |
  818|      0|                    if(ps_ip->u4_size != sizeof(isvcd_ctl_get_sei_ccv_params_ip_t))
  ------------------
  |  Branch (818:24): [True: 0, False: 0]
  ------------------
  819|      0|                    {
  820|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  821|      0|                        ps_op->u4_error_code |= IVD_IP_API_STRUCT_SIZE_INCORRECT;
  822|      0|                        return IV_FAIL;
  823|      0|                    }
  824|       |
  825|      0|                    if(ps_op->u4_size != sizeof(isvcd_ctl_get_sei_ccv_params_op_t))
  ------------------
  |  Branch (825:24): [True: 0, False: 0]
  ------------------
  826|      0|                    {
  827|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  828|      0|                        ps_op->u4_error_code |= IVD_OP_API_STRUCT_SIZE_INCORRECT;
  829|      0|                        return IV_FAIL;
  830|      0|                    }
  831|       |
  832|      0|                    break;
  833|      0|                }
  834|       |
  835|    154|                case IH264D_CMD_CTL_SET_NUM_CORES:
  ------------------
  |  Branch (835:17): [True: 154, False: 970]
  ------------------
  836|    154|                {
  837|    154|                    isvcd_ctl_set_num_cores_ip_t *ps_ip;
  838|    154|                    isvcd_ctl_set_num_cores_op_t *ps_op;
  839|       |
  840|    154|                    ps_ip = (isvcd_ctl_set_num_cores_ip_t *) pv_api_ip;
  841|    154|                    ps_op = (isvcd_ctl_set_num_cores_op_t *) pv_api_op;
  842|       |
  843|    154|                    if(ps_ip->u4_size != sizeof(isvcd_ctl_set_num_cores_ip_t))
  ------------------
  |  Branch (843:24): [True: 0, False: 154]
  ------------------
  844|      0|                    {
  845|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  846|      0|                        ps_op->u4_error_code |= IVD_IP_API_STRUCT_SIZE_INCORRECT;
  847|      0|                        return IV_FAIL;
  848|      0|                    }
  849|       |
  850|    154|                    if(ps_op->u4_size != sizeof(isvcd_ctl_set_num_cores_op_t))
  ------------------
  |  Branch (850:24): [True: 0, False: 154]
  ------------------
  851|      0|                    {
  852|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  853|      0|                        ps_op->u4_error_code |= IVD_OP_API_STRUCT_SIZE_INCORRECT;
  854|      0|                        return IV_FAIL;
  855|      0|                    }
  856|       |
  857|    154|                    if((ps_ip->u4_num_cores != 1) && (ps_ip->u4_num_cores != 2) &&
  ------------------
  |  Branch (857:24): [True: 63, False: 91]
  |  Branch (857:54): [True: 36, False: 27]
  ------------------
  858|     36|                       (ps_ip->u4_num_cores != 3) && (ps_ip->u4_num_cores != 4))
  ------------------
  |  Branch (858:24): [True: 24, False: 12]
  |  Branch (858:54): [True: 0, False: 24]
  ------------------
  859|      0|                    {
  860|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  861|      0|                        return IV_FAIL;
  862|      0|                    }
  863|    154|                    break;
  864|    154|                }
  865|    154|                case IH264D_CMD_CTL_SET_PROCESSOR:
  ------------------
  |  Branch (865:17): [True: 154, False: 970]
  ------------------
  866|    154|                {
  867|    154|                    isvcd_ctl_set_processor_ip_t *ps_ip;
  868|    154|                    isvcd_ctl_set_processor_op_t *ps_op;
  869|       |
  870|    154|                    ps_ip = (isvcd_ctl_set_processor_ip_t *) pv_api_ip;
  871|    154|                    ps_op = (isvcd_ctl_set_processor_op_t *) pv_api_op;
  872|       |
  873|    154|                    if(ps_ip->u4_size != sizeof(isvcd_ctl_set_processor_ip_t))
  ------------------
  |  Branch (873:24): [True: 0, False: 154]
  ------------------
  874|      0|                    {
  875|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  876|      0|                        ps_op->u4_error_code |= IVD_IP_API_STRUCT_SIZE_INCORRECT;
  877|      0|                        return IV_FAIL;
  878|      0|                    }
  879|       |
  880|    154|                    if(ps_op->u4_size != sizeof(isvcd_ctl_set_processor_op_t))
  ------------------
  |  Branch (880:24): [True: 0, False: 154]
  ------------------
  881|      0|                    {
  882|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  883|      0|                        ps_op->u4_error_code |= IVD_OP_API_STRUCT_SIZE_INCORRECT;
  884|      0|                        return IV_FAIL;
  885|      0|                    }
  886|       |
  887|    154|                    break;
  888|    154|                }
  889|       |
  890|    154|                case ISVCD_CMD_CTL_SET_TGT_LAYER:
  ------------------
  |  Branch (890:17): [True: 154, False: 970]
  ------------------
  891|    154|                {
  892|    154|                    isvcd_set_target_layer_ip_t *ps_ip;
  893|    154|                    isvcd_set_target_layer_op_t *ps_op;
  894|       |
  895|    154|                    ps_ip = (isvcd_set_target_layer_ip_t *) pv_api_ip;
  896|    154|                    ps_op = (isvcd_set_target_layer_op_t *) pv_api_op;
  897|       |
  898|    154|                    if(ps_ip->u4_size != sizeof(isvcd_set_target_layer_ip_t))
  ------------------
  |  Branch (898:24): [True: 0, False: 154]
  ------------------
  899|      0|                    {
  900|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  901|      0|                        ps_op->u4_error_code |= IVD_IP_API_STRUCT_SIZE_INCORRECT;
  902|      0|                        return IV_FAIL;
  903|      0|                    }
  904|       |
  905|    154|                    if(ps_ip->u1_tgt_dep_id > MAX_DEPENDENCY_ID)
  ------------------
  |  |  103|    154|#define MAX_DEPENDENCY_ID 4
  ------------------
  |  Branch (905:24): [True: 0, False: 154]
  ------------------
  906|      0|                    {
  907|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  908|      0|                        return IV_FAIL;
  909|      0|                    }
  910|       |
  911|    154|                    if(ps_ip->u1_tgt_temp_id > MAX_TEMPORAL_ID)
  ------------------
  |  |  104|    154|#define MAX_TEMPORAL_ID 7
  ------------------
  |  Branch (911:24): [True: 0, False: 154]
  ------------------
  912|      0|                    {
  913|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  914|      0|                        return IV_FAIL;
  915|      0|                    }
  916|       |
  917|    154|                    if(ps_ip->u1_tgt_quality_id > MAX_QUALITY_ID)
  ------------------
  |  |  102|    154|#define MAX_QUALITY_ID 0
  ------------------
  |  Branch (917:24): [True: 0, False: 154]
  ------------------
  918|      0|                    {
  919|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  920|      0|                        return IV_FAIL;
  921|      0|                    }
  922|       |
  923|    154|                    if(ps_ip->u1_tgt_priority_id > MAX_PRIORITY_ID)
  ------------------
  |  |  105|    154|#define MAX_PRIORITY_ID 63
  ------------------
  |  Branch (923:24): [True: 0, False: 154]
  ------------------
  924|      0|                    {
  925|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  926|      0|                        return IV_FAIL;
  927|      0|                    }
  928|       |
  929|    154|                    if(ps_op->u4_size != sizeof(isvcd_set_target_layer_op_t))
  ------------------
  |  Branch (929:24): [True: 0, False: 154]
  ------------------
  930|      0|                    {
  931|      0|                        ps_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM;
  932|      0|                        ps_op->u4_error_code |= IVD_OP_API_STRUCT_SIZE_INCORRECT;
  933|      0|                        return IV_FAIL;
  934|      0|                    }
  935|       |
  936|    154|                    break;
  937|    154|                }
  938|       |
  939|    154|                default:
  ------------------
  |  Branch (939:17): [True: 0, False: 1.12k]
  ------------------
  940|      0|                    *(pu4_api_op + 1) |= 1 << IVD_UNSUPPORTEDPARAM;
  941|      0|                    *(pu4_api_op + 1) |= IVD_UNSUPPORTED_API_CMD;
  942|      0|                    return IV_FAIL;
  943|      0|                    break;
  944|  1.12k|            }
  945|  1.12k|        }
  946|  1.12k|        break;
  947|  21.9k|    }
  948|       |
  949|  21.9k|    return IV_SUCCESS;
  950|  21.9k|}

isvcd_init_cabac_contexts:
   77|    609|{
   78|    609|    bin_ctxt_model_t *p_cabac_ctxt_table_t = ps_dec->p_cabac_ctxt_table_t;
   79|    609|    UWORD8 u1_qp_y = ps_dec->ps_cur_slice->u1_slice_qp;
   80|    609|    UWORD8 u1_cabac_init_Idc = 0;
   81|       |
   82|    609|    if(I_SLICE != u1_slice_type)
  ------------------
  |  |  370|    609|#define I_SLICE  2
  ------------------
  |  Branch (82:8): [True: 609, False: 0]
  ------------------
   83|    609|    {
   84|    609|        u1_cabac_init_Idc = ps_dec->ps_cur_slice->u1_cabac_init_idc;
   85|    609|    }
   86|       |
   87|    609|    {
   88|       |        /* MAKING ps_dec->p_ctxt_inc_mb_map a scratch buffer */
   89|       |        /* 0th entry of CtxtIncMbMap will be always be containing default values
   90|       |         for CABAC context representing MB not available */
   91|    609|        ctxt_inc_mb_info_t *p_DefCtxt = ps_dec->p_ctxt_inc_mb_map - 1;
   92|    609|        UWORD8 *pu1_temp;
   93|    609|        WORD8 i;
   94|    609|        p_DefCtxt->u1_mb_type = CAB_SKIP;
  ------------------
  |  |  402|    609|#define CAB_SKIP          0x10 /* 0001 0000 */
  ------------------
   95|    609|        p_DefCtxt->u1_cbp = 0x0f;
   96|    609|        p_DefCtxt->u1_intra_chroma_pred_mode = 0;
   97|    609|        p_DefCtxt->u1_yuv_dc_csbp = 0x7;
   98|    609|        p_DefCtxt->u1_transform8x8_ctxt = 0;
   99|       |
  100|    609|        pu1_temp = (UWORD8 *) p_DefCtxt->i1_ref_idx;
  101|  3.04k|        for(i = 0; i < 4; i++, pu1_temp++) (*pu1_temp) = 0;
  ------------------
  |  Branch (101:20): [True: 2.43k, False: 609]
  ------------------
  102|    609|        pu1_temp = (UWORD8 *) p_DefCtxt->u1_mv;
  103|  10.3k|        for(i = 0; i < 16; i++, pu1_temp++) (*pu1_temp) = 0;
  ------------------
  |  Branch (103:20): [True: 9.74k, False: 609]
  ------------------
  104|    609|        ps_dec->ps_def_ctxt_mb_info = p_DefCtxt;
  105|    609|    }
  106|       |
  107|    609|    if(u1_slice_type == I_SLICE)
  ------------------
  |  |  370|    609|#define I_SLICE  2
  ------------------
  |  Branch (107:8): [True: 0, False: 609]
  ------------------
  108|      0|    {
  109|      0|        u1_cabac_init_Idc = 3;
  110|      0|        ps_dec->p_mb_type_t = p_cabac_ctxt_table_t + MB_TYPE_I_SLICE;
  111|      0|    }
  112|    609|    else if(u1_slice_type == P_SLICE)
  ------------------
  |  |  368|    609|#define P_SLICE  0
  ------------------
  |  Branch (112:13): [True: 549, False: 60]
  ------------------
  113|    549|    {
  114|    549|        ps_dec->p_mb_type_t = p_cabac_ctxt_table_t + MB_TYPE_P_SLICE;
  115|    549|        ps_dec->p_mb_skip_flag_t = p_cabac_ctxt_table_t + MB_SKIP_FLAG_P_SLICE;
  116|    549|        ps_dec->p_sub_mb_type_t = p_cabac_ctxt_table_t + SUB_MB_TYPE_P_SLICE;
  117|    549|    }
  118|     60|    else if(u1_slice_type == B_SLICE)
  ------------------
  |  |  369|     60|#define B_SLICE  1
  ------------------
  |  Branch (118:13): [True: 60, False: 0]
  ------------------
  119|     60|    {
  120|     60|        ps_dec->p_mb_type_t = p_cabac_ctxt_table_t + MB_TYPE_B_SLICE;
  121|     60|        ps_dec->p_mb_skip_flag_t = p_cabac_ctxt_table_t + MB_SKIP_FLAG_B_SLICE;
  122|     60|        ps_dec->p_sub_mb_type_t = p_cabac_ctxt_table_t + SUB_MB_TYPE_B_SLICE;
  123|     60|    }
  124|    609|    {
  125|    609|        bin_ctxt_model_t *p_cabac_ctxt_table_t_tmp = p_cabac_ctxt_table_t;
  126|    609|        if(ps_dec->ps_cur_slice->u1_field_pic_flag)
  ------------------
  |  Branch (126:12): [True: 0, False: 609]
  ------------------
  127|      0|        {
  128|      0|            p_cabac_ctxt_table_t_tmp += SIGNIFICANT_COEFF_FLAG_FLD;
  129|      0|        }
  130|    609|        else
  131|    609|        {
  132|    609|            p_cabac_ctxt_table_t_tmp += SIGNIFICANT_COEFF_FLAG_FRAME;
  133|    609|        }
  134|    609|        {
  135|    609|            bin_ctxt_model_t **p_significant_coeff_flag_t = ps_dec->p_significant_coeff_flag_t;
  136|    609|            p_significant_coeff_flag_t[0] = p_cabac_ctxt_table_t_tmp + SIG_COEFF_CTXT_CAT_0_OFFSET;
  137|    609|            p_significant_coeff_flag_t[1] = p_cabac_ctxt_table_t_tmp + SIG_COEFF_CTXT_CAT_1_OFFSET;
  138|    609|            p_significant_coeff_flag_t[2] = p_cabac_ctxt_table_t_tmp + SIG_COEFF_CTXT_CAT_2_OFFSET;
  139|    609|            p_significant_coeff_flag_t[3] = p_cabac_ctxt_table_t_tmp + SIG_COEFF_CTXT_CAT_3_OFFSET;
  140|    609|            p_significant_coeff_flag_t[4] = p_cabac_ctxt_table_t_tmp + SIG_COEFF_CTXT_CAT_4_OFFSET;
  141|       |
  142|    609|            p_significant_coeff_flag_t[5] = p_cabac_ctxt_table_t_tmp + SIG_COEFF_CTXT_CAT_5_OFFSET;
  143|    609|        }
  144|    609|    }
  145|       |
  146|    609|    memcpy(p_cabac_ctxt_table_t, gau1_isvcd_cabac_ctxt_init_table[u1_cabac_init_Idc][u1_qp_y],
  147|    609|           NUM_CABAC_CTXTS_SVC * sizeof(bin_ctxt_model_t));
  ------------------
  |  |   46|    609|#define NUM_CABAC_CTXTS_SVC 467
  ------------------
  148|    609|}

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

isvcd_init_function_ptr_generic:
   85|  2.50k|{
   86|  2.50k|    residual_sampling_ctxt_t *ps_resd_samp_ctx;
   87|  2.50k|    intra_sampling_ctxt_t *ps_intra_samp_ctxt;
   88|  2.50k|    dec_struct_t *ps_codec = &ps_svc_lyr_dec->s_dec;
   89|       |
   90|       |    /* call the ih264 init ptr generic fn*/
   91|  2.50k|    ih264d_init_function_ptr_generic(ps_codec);
   92|       |
   93|  2.50k|    ps_resd_samp_ctx = (residual_sampling_ctxt_t *) ps_svc_lyr_dec->pv_residual_sample_ctxt;
   94|  2.50k|    ps_intra_samp_ctxt = (intra_sampling_ctxt_t *) ps_svc_lyr_dec->pv_intra_sample_ctxt;
   95|       |
   96|  2.50k|    ps_svc_lyr_dec->pf_pred_residual_recon_luma_4x4 = isvcd_pred_residual_recon_4x4;
   97|  2.50k|    ps_svc_lyr_dec->pf_pred_residual_recon_luma_8x8 = isvcd_pred_residual_recon_8x8;
   98|  2.50k|    ps_svc_lyr_dec->pf_pred_residual_recon_luma_16x16 = isvcd_pred_residual_recon_16x16;
   99|  2.50k|    ps_svc_lyr_dec->pf_pred_residual_recon_chroma_4x4 = isvcd_pred_residual_recon_chroma_4x4;
  100|  2.50k|    ps_svc_lyr_dec->pf_pred_residual_recon_chroma_8x8 = isvcd_pred_residual_recon_chroma_8x8;
  101|       |
  102|  2.50k|    ps_svc_lyr_dec->pf_residual_luma_4x4 = isvcd_residual_luma_4x4;
  103|  2.50k|    ps_svc_lyr_dec->pf_residual_luma_8x8 = isvcd_residual_luma_8x8;
  104|  2.50k|    ps_svc_lyr_dec->pf_residual_luma_16x16 = isvcd_residual_luma_16x16;
  105|  2.50k|    ps_svc_lyr_dec->pf_residual_chroma_cb_cr_8x8 = isvcd_residual_chroma_cb_cr_8x8;
  106|       |
  107|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_4x4 =
  108|  2.50k|        isvcd_iquant_itrans_residual_recon_4x4;
  109|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_4x4_dc =
  110|  2.50k|        isvcd_iquant_itrans_residual_recon_4x4_dc;
  111|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_8x8 =
  112|  2.50k|        isvcd_iquant_itrans_residual_recon_8x8;
  113|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_8x8_dc =
  114|  2.50k|        isvcd_iquant_itrans_residual_recon_8x8_dc;
  115|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_chroma_4x4 =
  116|  2.50k|        isvcd_iquant_itrans_residual_recon_chroma_4x4;
  117|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_chroma_4x4_dc =
  118|  2.50k|        isvcd_iquant_itrans_residual_recon_chroma_4x4_dc;
  119|       |
  120|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_luma_4x4 = isvcd_iquant_itrans_residual_4x4;
  121|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_luma_4x4_dc = isvcd_iquant_itrans_residual_4x4_dc;
  122|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_luma_8x8 = isvcd_iquant_itrans_residual_8x8;
  123|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_luma_8x8_dc = isvcd_iquant_itrans_residual_8x8_dc;
  124|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_chroma_4x4 = isvcd_iquant_itrans_residual_chroma_4x4;
  125|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_chroma_4x4_dc =
  126|  2.50k|        isvcd_iquant_itrans_residual_chroma_4x4_dc;
  127|       |
  128|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_luma_4x4 = isvcd_iquant_itrans_4x4;
  129|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_luma_4x4_dc = isvcd_iquant_itrans_4x4_dc;
  130|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_luma_8x8 = isvcd_iquant_itrans_8x8;
  131|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_luma_8x8_dc = isvcd_iquant_itrans_8x8_dc;
  132|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_chroma_4x4 = isvcd_iquant_itrans_chroma_4x4;
  133|  2.50k|    ps_svc_lyr_dec->pf_iquant_itrans_chroma_4x4_dc = isvcd_iquant_itrans_chroma_4x4_dc;
  134|       |
  135|  2.50k|    ps_intra_samp_ctxt->pf_interpolate_base_luma_dyadic = isvcd_interpolate_base_luma_dyadic;
  136|  2.50k|    ps_intra_samp_ctxt->pf_interpolate_intra_base = isvcd_interpolate_intra_base;
  137|  2.50k|    ps_intra_samp_ctxt->pf_vert_chroma_interpol[0] = isvcd_vert_interpol_chroma_dyadic_1;
  138|  2.50k|    ps_intra_samp_ctxt->pf_vert_chroma_interpol[1] = isvcd_vert_interpol_chroma_dyadic_2;
  139|  2.50k|    ps_intra_samp_ctxt->pf_vert_chroma_interpol[2] = isvcd_vert_interpol_chroma_dyadic_3;
  140|       |
  141|  2.50k|    ps_intra_samp_ctxt->pf_horz_chroma_interpol[0] = isvcd_horz_interpol_chroma_dyadic_1;
  142|  2.50k|    ps_intra_samp_ctxt->pf_horz_chroma_interpol[1] = isvcd_horz_interpol_chroma_dyadic_2;
  143|       |
  144|       |    /*Dyadic Residual Resampling*/
  145|  2.50k|    ps_resd_samp_ctx->pf_residual_luma_dyadic = isvcd_residual_luma_dyadic;
  146|  2.50k|    ps_resd_samp_ctx->pf_residual_chroma_dyadic = isvcd_residual_chroma_dyadic;
  147|  2.50k|    ps_resd_samp_ctx->pf_residual_chroma_dyadic_alt = isvcd_residual_chroma_dyadic_alt;
  148|       |
  149|       |    /*Non-dyadic Residual Resampling*/
  150|  2.50k|    ps_resd_samp_ctx->pf_interpolate_residual = isvcd_interpolate_residual;
  151|       |
  152|  2.50k|    ps_resd_samp_ctx->pf_residual_reflayer_const_non_boundary_mb =
  153|  2.50k|        isvcd_residual_reflayer_const_non_boundary_mb;
  154|  2.50k|    ps_resd_samp_ctx->pf_residual_reflayer_const_boundary_mb =
  155|  2.50k|        isvcd_residual_reflayer_const_boundary_mb;
  156|       |
  157|  2.50k|    return;
  158|  2.50k|}

isvcd_ii_pred_res_init:
  100|  4.09k|{
  101|       |    /* local vaiables */
  102|  4.09k|    intra_inter_pred_ctxt_t *ps_ii_pred_ctxt;
  103|  4.09k|    mode_motion_ctxt_t *ps_ctxt;
  104|  4.09k|    mode_motion_lyr_ctxt *ps_lyr_mem;
  105|  4.09k|    WORD32 i4_base_res_flag;
  106|  4.09k|    svc_dec_lyr_struct_t *ps_svc_lyr_dec = (svc_dec_lyr_struct_t *) pv_svc_dec;
  107|       |
  108|  4.09k|    res_prms_t *ps_res_prms = &ps_svc_lyr_dec->s_res_prms;
  109|  4.09k|    ps_ii_pred_ctxt = (intra_inter_pred_ctxt_t *) ps_svc_lyr_dec->pv_ii_pred_ctxt;
  110|  4.09k|    ps_ctxt = (mode_motion_ctxt_t *) ps_svc_lyr_dec->pv_mode_mv_sample_ctxt;
  111|  4.09k|    i4_base_res_flag = ps_svc_lyr_dec->u1_base_res_flag;
  112|       |
  113|  4.09k|    if((0 != ps_svc_lyr_dec->u1_layer_id) && (SVCD_FALSE == i4_base_res_flag))
  ------------------
  |  |   45|    720|#define SVCD_FALSE 0
  ------------------
  |  Branch (113:8): [True: 720, False: 3.37k]
  |  Branch (113:46): [True: 720, False: 0]
  ------------------
  114|    720|    {
  115|       |        /* if not first resolution layer */
  116|    720|        ps_ii_pred_ctxt->i4_ref_res_lyr_wd = ps_ii_pred_ctxt->i4_cur_res_lyr_wd;
  117|    720|        ps_ii_pred_ctxt->i4_ref_res_lyr_ht = ps_ii_pred_ctxt->i4_cur_res_lyr_ht;
  118|    720|    }
  119|       |
  120|  4.09k|    if ((ps_ctxt->i4_res_id >= 0) && (ps_ctxt->i4_res_id <= 2))
  ------------------
  |  Branch (120:9): [True: 720, False: 3.37k]
  |  Branch (120:38): [True: 720, False: 0]
  ------------------
  121|    720|    {
  122|    720|        ps_lyr_mem = &ps_ctxt->as_res_lyr_mem[ps_ctxt->i4_res_id];
  123|       |
  124|    720|        ps_ii_pred_ctxt->pi2_ref_loc_x = ps_lyr_mem->pi2_ref_loc_x;
  125|    720|        ps_ii_pred_ctxt->pi2_ref_loc_y = ps_lyr_mem->pi2_ref_loc_y;
  126|    720|    }
  127|       |    /* Store the dimensions */
  128|  4.09k|    ps_ii_pred_ctxt->i4_cur_res_lyr_wd = ps_res_prms->i4_res_width;
  129|  4.09k|    ps_ii_pred_ctxt->i4_cur_res_lyr_ht = ps_res_prms->i4_res_height;
  130|       |
  131|  4.09k|    return (OK);
  ------------------
  |  |  114|  4.09k|#define OK        0
  ------------------
  132|  4.09k|}
isvcd_ii_get_ref_mb_mode:
  161|  3.93k|{
  162|  3.93k|    WORD32 i4_mb_x, i4_mb_y;
  163|  3.93k|    inter_lyr_mb_prms_t *ps_inter_lyr_mb_prms;
  164|  3.93k|    WORD8 i1_mb_mode;
  165|       |
  166|  3.93k|    i4_mb_x = (i4_x_ref >> MB_WIDTH_SHIFT);
  ------------------
  |  |   70|  3.93k|#define MB_WIDTH_SHIFT 4
  ------------------
  167|  3.93k|    i4_mb_y = (i4_y_ref >> MB_HEIGHT_SHIFT);
  ------------------
  |  |   71|  3.93k|#define MB_HEIGHT_SHIFT 4
  ------------------
  168|       |
  169|       |    /* get the location of the byte which has the current mb mode */
  170|  3.93k|    pi1_ref_mb_modes += (i4_mb_y * i4_ref_mode_stride * i4_ref_mode_size);
  171|  3.93k|    pi1_ref_mb_modes += (i4_mb_x * i4_ref_mode_size);
  172|  3.93k|    ps_inter_lyr_mb_prms = (inter_lyr_mb_prms_t *) pi1_ref_mb_modes;
  173|  3.93k|    i1_mb_mode = ps_inter_lyr_mb_prms->i1_mb_mode;
  174|       |
  175|  3.93k|    if(i1_mb_mode <= SVC_INTER_MB)
  ------------------
  |  |  114|  3.93k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (175:8): [True: 3.34k, False: 595]
  ------------------
  176|  3.34k|    {
  177|       |        /* INTER */
  178|  3.34k|        return (SVCD_FALSE);
  ------------------
  |  |   45|  3.34k|#define SVCD_FALSE 0
  ------------------
  179|  3.34k|    }
  180|    595|    else
  181|    595|    {
  182|       |        /* INTRA */
  183|    595|        return (SVCD_TRUE);
  ------------------
  |  |   46|    595|#define SVCD_TRUE 1
  ------------------
  184|    595|    }
  185|  3.93k|}
isvcd_ii_get_ref_projections:
  216|    984|{
  217|    984|    WORD16 *pi2_ref_loc_x;
  218|    984|    WORD16 *pi2_ref_loc_y;
  219|    984|    WORD8 *pi1_ref_mb_mode;
  220|    984|    WORD32 i4_ref_mode_stride;
  221|    984|    WORD32 i4_element_size;
  222|    984|    WORD32 i4_ref_x, i4_ref_y;
  223|    984|    WORD32 i4_frame_x, i4_frame_y;
  224|    984|    WORD32 i4_flag;
  225|       |
  226|    984|    pi2_ref_loc_x = ps_ctxt->pi2_ref_loc_x;
  227|    984|    pi2_ref_loc_y = ps_ctxt->pi2_ref_loc_y;
  228|       |
  229|    984|    pi1_ref_mb_mode = (WORD8 *) ps_ref_mb_mode->pv_buffer;
  230|    984|    i4_ref_mode_stride = ps_ref_mb_mode->i4_num_element_stride;
  231|    984|    i4_element_size = ps_ref_mb_mode->i4_element_size;
  232|       |
  233|       |    /* get the current MB frame positions */
  234|    984|    i4_frame_x = i4_mb_x << 4;
  235|    984|    i4_frame_y = i4_mb_y << 4;
  236|       |
  237|       |    /* reset the flag */
  238|    984|    i4_flag = SVCD_FALSE;
  ------------------
  |  |   45|    984|#define SVCD_FALSE 0
  ------------------
  239|       |
  240|       |    /* project the (0,0) of current MB and get the ref MB mode */
  241|    984|    i4_ref_x = pi2_ref_loc_x[i4_frame_x];
  242|    984|    i4_ref_y = pi2_ref_loc_y[i4_frame_y];
  243|       |
  244|    984|    if((i4_ref_x < ps_ctxt->i4_ref_res_lyr_wd) && (i4_ref_y < ps_ctxt->i4_ref_res_lyr_ht))
  ------------------
  |  Branch (244:8): [True: 984, False: 0]
  |  Branch (244:51): [True: 984, False: 0]
  ------------------
  245|    984|    {
  246|    984|        ps_ii_mb_ctxt->u1_top_left_intra_flag = isvcd_ii_get_ref_mb_mode(
  247|    984|            pi1_ref_mb_mode, i4_ref_mode_stride, i4_element_size, i4_ref_x, i4_ref_y);
  248|    984|    }
  249|      0|    else
  250|      0|    {
  251|       |        /* If projection is outside the picture boundary */
  252|      0|        ps_ii_mb_ctxt->u1_top_left_intra_flag = SVCD_FALSE;
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
  253|      0|    }
  254|       |    /* project the (15,0) of current MB and get the ref MB mode */
  255|    984|    i4_ref_x = pi2_ref_loc_x[i4_frame_x + 15];
  256|    984|    i4_ref_y = pi2_ref_loc_y[i4_frame_y];
  257|       |
  258|    984|    if((i4_ref_x < ps_ctxt->i4_ref_res_lyr_wd) && (i4_ref_y < ps_ctxt->i4_ref_res_lyr_ht))
  ------------------
  |  Branch (258:8): [True: 984, False: 0]
  |  Branch (258:51): [True: 984, False: 0]
  ------------------
  259|    984|    {
  260|    984|        ps_ii_mb_ctxt->u1_top_rt_intra_flag = isvcd_ii_get_ref_mb_mode(
  261|    984|            pi1_ref_mb_mode, i4_ref_mode_stride, i4_element_size, i4_ref_x, i4_ref_y);
  262|    984|    }
  263|      0|    else
  264|      0|    {
  265|      0|        ps_ii_mb_ctxt->u1_top_rt_intra_flag = SVCD_FALSE;
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
  266|      0|    }
  267|       |
  268|       |    /* project the (0,15) of current MB and get the ref MB mode */
  269|    984|    i4_ref_x = pi2_ref_loc_x[i4_frame_x];
  270|    984|    i4_ref_y = pi2_ref_loc_y[i4_frame_y + 15];
  271|       |
  272|    984|    if((i4_ref_x < ps_ctxt->i4_ref_res_lyr_wd) && (i4_ref_y < ps_ctxt->i4_ref_res_lyr_ht))
  ------------------
  |  Branch (272:8): [True: 984, False: 0]
  |  Branch (272:51): [True: 984, False: 0]
  ------------------
  273|    984|    {
  274|    984|        ps_ii_mb_ctxt->u1_bot_left_intra_flag = isvcd_ii_get_ref_mb_mode(
  275|    984|            pi1_ref_mb_mode, i4_ref_mode_stride, i4_element_size, i4_ref_x, i4_ref_y);
  276|    984|    }
  277|      0|    else
  278|      0|    {
  279|      0|        ps_ii_mb_ctxt->u1_bot_left_intra_flag = SVCD_FALSE;
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
  280|      0|    }
  281|       |
  282|       |    /* project the (15,15) of current MB and get the ref MB mode */
  283|    984|    i4_ref_x = pi2_ref_loc_x[i4_frame_x + 15];
  284|    984|    i4_ref_y = pi2_ref_loc_y[i4_frame_y + 15];
  285|       |
  286|    984|    if((i4_ref_x < ps_ctxt->i4_ref_res_lyr_wd) && (i4_ref_y < ps_ctxt->i4_ref_res_lyr_ht))
  ------------------
  |  Branch (286:8): [True: 984, False: 0]
  |  Branch (286:51): [True: 984, False: 0]
  ------------------
  287|    984|    {
  288|    984|        ps_ii_mb_ctxt->u1_bot_rt_intra_flag = isvcd_ii_get_ref_mb_mode(
  289|    984|            pi1_ref_mb_mode, i4_ref_mode_stride, i4_element_size, i4_ref_x, i4_ref_y);
  290|    984|    }
  291|      0|    else
  292|      0|    {
  293|      0|        ps_ii_mb_ctxt->u1_bot_rt_intra_flag = SVCD_FALSE;
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
  294|      0|    }
  295|       |
  296|       |    /* if any of the 4 cormers are falling into intra region
  297|       |      set the INTRA INTER Flag */
  298|    984|    if((SVCD_TRUE == ps_ii_mb_ctxt->u1_top_left_intra_flag) ||
  ------------------
  |  |   46|    984|#define SVCD_TRUE 1
  ------------------
  |  Branch (298:8): [True: 202, False: 782]
  ------------------
  299|    782|       (SVCD_TRUE == ps_ii_mb_ctxt->u1_top_rt_intra_flag) ||
  ------------------
  |  |   46|    782|#define SVCD_TRUE 1
  ------------------
  |  Branch (299:8): [True: 57, False: 725]
  ------------------
  300|    725|       (SVCD_TRUE == ps_ii_mb_ctxt->u1_bot_left_intra_flag) ||
  ------------------
  |  |   46|    725|#define SVCD_TRUE 1
  ------------------
  |  Branch (300:8): [True: 39, False: 686]
  ------------------
  301|    686|       (SVCD_TRUE == ps_ii_mb_ctxt->u1_bot_rt_intra_flag))
  ------------------
  |  |   46|    686|#define SVCD_TRUE 1
  ------------------
  |  Branch (301:8): [True: 0, False: 686]
  ------------------
  302|    298|    {
  303|    298|        i4_flag = SVCD_TRUE;
  ------------------
  |  |   46|    298|#define SVCD_TRUE 1
  ------------------
  304|    298|    }
  305|       |
  306|       |    /* derive the intersection point of MB boundaries */
  307|    984|    if(SVCD_TRUE == i4_flag)
  ------------------
  |  |   46|    984|#define SVCD_TRUE 1
  ------------------
  |  Branch (307:8): [True: 298, False: 686]
  ------------------
  308|    298|    {
  309|    298|        WORD32 i4_intr_x, i4_intr_y;
  310|    298|        WORD32 i4_ref_mb_init_x, i4_ref_mb_init_y;
  311|    298|        WORD32 i4_ctr;
  312|       |
  313|       |        /* set the variables to initial values */
  314|    298|        i4_intr_x = 0;
  315|    298|        i4_intr_y = 0;
  316|    298|        i4_ref_mb_init_x = pi2_ref_loc_x[i4_frame_x] >> MB_WIDTH_SHIFT;
  ------------------
  |  |   70|    298|#define MB_WIDTH_SHIFT 4
  ------------------
  317|    298|        i4_ref_mb_init_y = pi2_ref_loc_y[i4_frame_y] >> MB_HEIGHT_SHIFT;
  ------------------
  |  |   71|    298|#define MB_HEIGHT_SHIFT 4
  ------------------
  318|       |
  319|       |        /* loop until an Mb boundary is found in horizontal direction */
  320|  3.45k|        for(i4_ctr = 0; i4_ctr < MB_WIDTH; i4_ctr++)
  ------------------
  |  |   67|  3.45k|#define MB_WIDTH 16
  ------------------
  |  Branch (320:25): [True: 3.36k, False: 97]
  ------------------
  321|  3.36k|        {
  322|  3.36k|            i4_ref_x = pi2_ref_loc_x[i4_frame_x + i4_ctr];
  323|  3.36k|            i4_ref_x >>= MB_WIDTH_SHIFT;
  ------------------
  |  |   70|  3.36k|#define MB_WIDTH_SHIFT 4
  ------------------
  324|       |
  325|       |            /* check if the locations are falling into same MB */
  326|  3.36k|            if(i4_ref_x != i4_ref_mb_init_x)
  ------------------
  |  Branch (326:16): [True: 201, False: 3.16k]
  ------------------
  327|    201|            {
  328|    201|                break;
  329|    201|            }
  330|       |            /* increment the position */
  331|  3.16k|            i4_intr_x++;
  332|  3.16k|        }
  333|       |
  334|       |        /* loop until an Mb boundary is found in vertical direction */
  335|  3.71k|        for(i4_ctr = 0; i4_ctr < MB_HEIGHT; i4_ctr++)
  ------------------
  |  |   68|  3.71k|#define MB_HEIGHT 16
  ------------------
  |  Branch (335:25): [True: 3.58k, False: 129]
  ------------------
  336|  3.58k|        {
  337|  3.58k|            i4_ref_y = pi2_ref_loc_y[i4_frame_y + i4_ctr];
  338|  3.58k|            i4_ref_y >>= MB_HEIGHT_SHIFT;
  ------------------
  |  |   71|  3.58k|#define MB_HEIGHT_SHIFT 4
  ------------------
  339|       |
  340|       |            /* check if the locations are falling into same MB */
  341|  3.58k|            if(i4_ref_y != i4_ref_mb_init_y)
  ------------------
  |  Branch (341:16): [True: 169, False: 3.41k]
  ------------------
  342|    169|            {
  343|    169|                break;
  344|    169|            }
  345|       |            /* increment the position */
  346|  3.41k|            i4_intr_y++;
  347|  3.41k|        }
  348|       |        /* store the intersection points */
  349|    298|        ps_ii_mb_ctxt->u1_intersection_x = i4_intr_x;
  350|    298|        ps_ii_mb_ctxt->u1_intersection_y = i4_intr_y;
  351|    298|    }
  352|    686|    else
  353|    686|    {
  354|       |        /* set to default value */
  355|    686|        ps_ii_mb_ctxt->u1_intersection_x = 0;
  356|    686|        ps_ii_mb_ctxt->u1_intersection_y = 0;
  357|    686|    }
  358|       |
  359|    984|    return (i4_flag);
  360|    984|}
isvcd_ii_pred_compute_flags_mb:
  386|  1.03k|{
  387|  1.03k|    intra_inter_pred_ctxt_t *ps_ctxt;
  388|  1.03k|    WORD32 i4_mb_x, i4_mb_y;
  389|  1.03k|    dec_svc_mb_info_t *ps_svc_mb_prms;
  390|  1.03k|    UNUSED(pv_mb_prms);
  ------------------
  |  |   45|  1.03k|#define UNUSED(x) ((void)(x))
  ------------------
  391|       |
  392|  1.03k|    if((NULL == pv_ii_pred_ctxt) || (NULL == ps_ref_mb_mode) || (NULL == ps_coord) ||
  ------------------
  |  Branch (392:8): [True: 0, False: 1.03k]
  |  Branch (392:37): [True: 0, False: 1.03k]
  |  Branch (392:65): [True: 0, False: 1.03k]
  ------------------
  393|  1.03k|       (NULL == pu1_ii_mb_mode))
  ------------------
  |  Branch (393:8): [True: 0, False: 1.03k]
  ------------------
  394|      0|    {
  395|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  396|      0|    }
  397|       |
  398|  1.03k|    ps_ctxt = (intra_inter_pred_ctxt_t *) pv_ii_pred_ctxt;
  399|  1.03k|    ps_svc_mb_prms = (dec_svc_mb_info_t *) pv_svc_mb_prms;
  400|       |
  401|       |    /* get mb co-ordinates */
  402|  1.03k|    i4_mb_x = ps_coord->u2_mb_x;
  403|  1.03k|    i4_mb_y = ps_coord->u2_mb_y;
  404|       |
  405|  1.03k|    {
  406|  1.03k|        intra_inter_mb_t *ps_ii_mb_ctxt;
  407|  1.03k|        WORD32 i4_ii_flag;
  408|       |
  409|       |        /* get the current MB strcuture pointer */
  410|  1.03k|        ps_ii_mb_ctxt = &ps_ctxt->s_intra_inter_mb_prms;
  411|       |
  412|       |        /* reset the Intra Inter qualified flag for current MB */
  413|  1.03k|        i4_ii_flag = SVCD_FALSE;
  ------------------
  |  |   45|  1.03k|#define SVCD_FALSE 0
  ------------------
  414|       |
  415|       |        /* check for base mode flag and Inter MB status */
  416|  1.03k|        if(1 == ps_svc_mb_prms->u1_base_mode_flag)
  ------------------
  |  Branch (416:12): [True: 984, False: 54]
  ------------------
  417|    984|        {
  418|       |            /* call the function which calculates the projections
  419|       |               and returns whether current MB has to under go
  420|       |               Inter Intra Prediction */
  421|    984|            i4_ii_flag = isvcd_ii_get_ref_projections(ps_ctxt, ps_ii_mb_ctxt, ps_ref_mb_mode,
  422|    984|                                                      i4_mb_x, i4_mb_y);
  423|    984|        }
  424|       |
  425|       |        /* If the current MB requires Intra Inter prediction */
  426|  1.03k|        if(SVCD_TRUE == i4_ii_flag)
  ------------------
  |  |   46|  1.03k|#define SVCD_TRUE 1
  ------------------
  |  Branch (426:12): [True: 298, False: 740]
  ------------------
  427|    298|        {
  428|       |            /* set the mb mode */
  429|    298|            *pu1_ii_mb_mode = SVC_INTRA_INTER_MB;
  ------------------
  |  |  118|    298|#define SVC_INTRA_INTER_MB (1 << 4) /*!< Intra Inter MB */
  ------------------
  430|    298|        }
  431|    740|        else
  432|    740|        {
  433|       |            /* set all MB params to default values */
  434|    740|            ps_ii_mb_ctxt->u1_bot_left_intra_flag = SVCD_FALSE;
  ------------------
  |  |   45|    740|#define SVCD_FALSE 0
  ------------------
  435|    740|            ps_ii_mb_ctxt->u1_bot_rt_intra_flag = SVCD_FALSE;
  ------------------
  |  |   45|    740|#define SVCD_FALSE 0
  ------------------
  436|    740|            ps_ii_mb_ctxt->u1_top_left_intra_flag = SVCD_FALSE;
  ------------------
  |  |   45|    740|#define SVCD_FALSE 0
  ------------------
  437|    740|            ps_ii_mb_ctxt->u1_top_rt_intra_flag = SVCD_FALSE;
  ------------------
  |  |   45|    740|#define SVCD_FALSE 0
  ------------------
  438|    740|            ps_ii_mb_ctxt->u1_intersection_x = 0;
  439|    740|            ps_ii_mb_ctxt->u1_intersection_y = 0;
  440|       |
  441|       |            /* set the mb mode to 0 (which has no interpretation) */
  442|    740|            *pu1_ii_mb_mode = 0;
  443|    740|        }
  444|  1.03k|    }
  445|  1.03k|    return (OK);
  ------------------
  |  |  114|  1.03k|#define OK        0
  ------------------
  446|  1.03k|}
isvcd_ii_pred_mb:
  472|    298|{
  473|    298|    intra_inter_mb_t *ps_mb_ctxt;
  474|    298|    UWORD8 *pu1_rec_y, *pu1_rec_uv;
  475|    298|    UWORD8 *pu1_recon_luma;
  476|    298|    WORD32 i4_recon_luma_stride;
  477|    298|    UWORD8 *pu1_recon_chroma;
  478|    298|    WORD32 i4_recon_chroma_stride;
  479|    298|    UWORD8 *pu1_pred_luma;
  480|    298|    UWORD8 *pu1_pred_chroma;
  481|    298|    WORD32 i4_pred_luma_stride;
  482|    298|    WORD32 i4_pred_chroma_stride;
  483|    298|    WORD32 i4_intr_x, i4_intr_y;
  484|    298|    intra_inter_pred_ctxt_t *ps_ctxt;
  485|    298|    pic_buffer_t *ps_frame_buf;
  486|    298|    svc_dec_lyr_struct_t *ps_svc_lyr_dec = (svc_dec_lyr_struct_t *) pv_svc_dec;
  487|    298|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  488|       |
  489|    298|    ps_ctxt = (intra_inter_pred_ctxt_t *) ps_svc_lyr_dec->pv_ii_pred_ctxt;
  490|    298|    ps_mb_ctxt = &ps_ctxt->s_intra_inter_mb_prms;
  491|    298|    ps_frame_buf = ps_dec->ps_cur_pic;
  492|    298|    i4_recon_luma_stride = ps_dec->u2_frm_wd_y;
  493|    298|    i4_recon_chroma_stride = ps_dec->u2_frm_wd_uv;
  494|       |
  495|       |    /* derive the intersection point */
  496|    298|    i4_intr_x = ps_mb_ctxt->u1_intersection_x;
  497|    298|    i4_intr_y = ps_mb_ctxt->u1_intersection_y;
  498|       |
  499|    298|    pu1_rec_y = ps_frame_buf->pu1_buf1 + (ps_cur_mb_info->u2_mbx << 4) +
  500|    298|                (i4_recon_luma_stride * (ps_cur_mb_info->u2_mby << 4));
  501|       |
  502|    298|    pu1_rec_uv = ps_frame_buf->pu1_buf2 + (ps_cur_mb_info->u2_mbx << 3) * YUV420SP_FACTOR +
  ------------------
  |  |  119|    298|#define YUV420SP_FACTOR 2
  ------------------
  503|    298|                 (i4_recon_chroma_stride * (ps_cur_mb_info->u2_mby << 3));
  504|       |
  505|    298|    pu1_pred_luma = ps_svc_lyr_dec->pu1_ii_resamp_buffer_luma;
  506|    298|    pu1_pred_chroma = ps_svc_lyr_dec->pu1_ii_resamp_buffer_chroma;
  507|    298|    i4_pred_luma_stride = MB_SIZE;
  ------------------
  |  |  554|    298|#define MB_SIZE             16
  ------------------
  508|    298|    i4_pred_chroma_stride = MB_SIZE;
  ------------------
  |  |  554|    298|#define MB_SIZE             16
  ------------------
  509|       |
  510|       |    /* get the recon and residual buffer pointer */
  511|    298|    pu1_recon_luma = pu1_rec_y;
  512|    298|    pu1_recon_chroma = pu1_rec_uv;
  513|       |
  514|       |    /*-----------------------------------------------------------------------*/
  515|       |    /* Reconstruct TOP_LEFT Partition                                        */
  516|       |    /*-----------------------------------------------------------------------*/
  517|    298|    {
  518|    298|        WORD32 i4_width, i4_height;
  519|       |
  520|       |        /* assign the appropriate buffer params based on Intra status */
  521|    298|        if(SVCD_TRUE == ps_mb_ctxt->u1_top_left_intra_flag)
  ------------------
  |  |   46|    298|#define SVCD_TRUE 1
  ------------------
  |  Branch (521:12): [True: 202, False: 96]
  ------------------
  522|    202|        {
  523|       |            /* Luma Processing */
  524|    202|            isvcd_copy_data(pu1_pred_luma, i4_pred_luma_stride, pu1_recon_luma,
  525|    202|                            i4_recon_luma_stride, i4_intr_x, i4_intr_y);
  526|       |
  527|       |            /* assign appropriate width and height for chroma */
  528|    202|            i4_width = (((i4_intr_x + 1) >> 1) << 1);
  529|    202|            i4_height = ((i4_intr_y + 1) & ~1);
  530|    202|            i4_height >>= 1;
  531|       |            /* Chroma Processing (cb and cr interleaved) */
  532|    202|            isvcd_copy_data(pu1_pred_chroma, i4_pred_chroma_stride, pu1_recon_chroma,
  533|    202|                            i4_recon_chroma_stride, i4_width, i4_height);
  534|    202|        }
  535|    298|    }
  536|       |
  537|       |    /*-----------------------------------------------------------------------*/
  538|       |    /* Reconstruct TOP_RIGHT Partition                                       */
  539|       |    /*-----------------------------------------------------------------------*/
  540|    298|    {
  541|    298|        WORD32 i4_width, i4_height;
  542|       |
  543|       |        /* assign the appropriate buffer params based on Intra status */
  544|    298|        if(SVCD_TRUE == ps_mb_ctxt->u1_top_rt_intra_flag)
  ------------------
  |  |   46|    298|#define SVCD_TRUE 1
  ------------------
  |  Branch (544:12): [True: 117, False: 181]
  ------------------
  545|    117|        {
  546|    117|            pu1_pred_luma += i4_intr_x;
  547|    117|            pu1_pred_chroma += (((i4_intr_x + 1) >> 1) << 1);
  548|       |
  549|       |            /* ----------------------- Luma ------------------------ */
  550|       |            /* get the recon and residual buffer pointer */
  551|    117|            pu1_recon_luma = pu1_rec_y + i4_intr_x;
  552|       |
  553|       |            /* assign appropriate width and height for luma */
  554|    117|            i4_width = MB_WIDTH - i4_intr_x;
  ------------------
  |  |   67|    117|#define MB_WIDTH 16
  ------------------
  555|    117|            i4_height = i4_intr_y;
  556|       |
  557|       |            /* Luma Processing */
  558|       |            /* Luma Processing */
  559|    117|            isvcd_copy_data(pu1_pred_luma, i4_pred_luma_stride, pu1_recon_luma,
  560|    117|                            i4_recon_luma_stride, i4_width, i4_height);
  561|       |
  562|       |            /* ----------------------- Chroma ----------------------- */
  563|       |            /* assign appropriate width and height for luma */
  564|    117|            i4_width = (BLOCK_WIDTH - ((i4_intr_x + 1) >> 1)) << 1;
  ------------------
  |  |   64|    117|#define BLOCK_WIDTH 8
  ------------------
  565|       |
  566|       |            /* Height includes for both Cb & Cr */
  567|    117|            i4_height = ((i4_intr_y + 1) & ~1);
  568|    117|            i4_height >>= 1;
  569|       |            /* get the recon and residual buffer pointer */
  570|    117|            pu1_recon_chroma = pu1_rec_uv;
  571|    117|            {
  572|    117|                WORD32 i4_temp;
  573|    117|                i4_temp = (((i4_intr_x + 1) >> 1) << 1);
  574|    117|                pu1_recon_chroma += i4_temp;
  575|    117|            }
  576|       |
  577|       |            /* Chroma Processing (cb and cr  interleaved) */
  578|    117|            isvcd_copy_data(pu1_pred_chroma, i4_pred_chroma_stride, pu1_recon_chroma,
  579|    117|                            i4_recon_chroma_stride, i4_width, i4_height);
  580|    117|        }
  581|    298|    }
  582|       |
  583|       |    /*-----------------------------------------------------------------------*/
  584|       |    /* Reconstruct BOTTOM_LEFT Partition                                     */
  585|       |    /*-----------------------------------------------------------------------*/
  586|    298|    {
  587|    298|        WORD32 i4_width, i4_height;
  588|       |
  589|       |        /* assign the appropriate buffer params based on Intra status */
  590|    298|        if(SVCD_TRUE == ps_mb_ctxt->u1_bot_left_intra_flag)
  ------------------
  |  |   46|    298|#define SVCD_TRUE 1
  ------------------
  |  Branch (590:12): [True: 111, False: 187]
  ------------------
  591|    111|        {
  592|    111|            pu1_pred_luma = ps_svc_lyr_dec->pu1_ii_resamp_buffer_luma;
  593|    111|            pu1_pred_chroma = ps_svc_lyr_dec->pu1_ii_resamp_buffer_chroma;
  594|       |
  595|       |            /* increment to current vertical offset */
  596|    111|            pu1_pred_luma += i4_intr_y * i4_pred_luma_stride;
  597|    111|            pu1_pred_chroma += (((i4_intr_y + 1) & ~1) >> 1) * i4_pred_chroma_stride;
  598|       |
  599|       |            /* ----------------------- Luma ----------------------- */
  600|       |            /* get the recon and residual buffer pointer */
  601|    111|            pu1_recon_luma = pu1_rec_y;
  602|    111|            pu1_recon_luma += i4_intr_y * i4_recon_luma_stride;
  603|       |
  604|       |            /* assign appropriate width and height */
  605|    111|            i4_width = i4_intr_x;
  606|    111|            i4_height = MB_HEIGHT - i4_intr_y;
  ------------------
  |  |   68|    111|#define MB_HEIGHT 16
  ------------------
  607|       |
  608|       |            /* Luma Processing */
  609|    111|            isvcd_copy_data(pu1_pred_luma, i4_pred_luma_stride, pu1_recon_luma,
  610|    111|                            i4_recon_luma_stride, i4_width, i4_height);
  611|       |
  612|       |            /* ----------------------- Chroma ----------------------- */
  613|    111|            pu1_recon_chroma = pu1_rec_uv;
  614|    111|            {
  615|    111|                WORD32 i4_temp;
  616|    111|                i4_temp = ((i4_intr_y + 1) & ~1) >> 1;
  617|    111|                pu1_recon_chroma += (i4_temp * i4_recon_chroma_stride);
  618|    111|            }
  619|       |            /* assign appropriate width and height */
  620|    111|            i4_width = ((i4_intr_x + 1) >> 1) << 1;
  621|    111|            i4_height = MB_HEIGHT - (i4_intr_y & ~1);
  ------------------
  |  |   68|    111|#define MB_HEIGHT 16
  ------------------
  622|    111|            i4_height >>= 1;
  623|       |            /* Chroma Processing (cb and cr interleaved) */
  624|    111|            isvcd_copy_data(pu1_pred_chroma, i4_pred_chroma_stride, pu1_recon_chroma,
  625|    111|                            i4_recon_chroma_stride, i4_width, i4_height);
  626|    111|        }
  627|    298|    }
  628|       |
  629|       |    /*-----------------------------------------------------------------------*/
  630|       |    /* Reconstruct BOTTOM_RIGHT Partition                                    */
  631|       |    /*-----------------------------------------------------------------------*/
  632|    298|    {
  633|    298|        WORD32 i4_width, i4_height;
  634|       |
  635|       |        /* assign the appropriate buffer params based on Intra status */
  636|    298|        if(SVCD_TRUE == ps_mb_ctxt->u1_bot_rt_intra_flag)
  ------------------
  |  |   46|    298|#define SVCD_TRUE 1
  ------------------
  |  Branch (636:12): [True: 165, False: 133]
  ------------------
  637|    165|        {
  638|    165|            pu1_pred_luma = ps_svc_lyr_dec->pu1_ii_resamp_buffer_luma;
  639|    165|            pu1_pred_chroma = ps_svc_lyr_dec->pu1_ii_resamp_buffer_chroma;
  640|       |
  641|       |            /* increment to current vertical offset */
  642|    165|            pu1_pred_luma += i4_intr_x;
  643|    165|            pu1_pred_luma += i4_intr_y * i4_pred_luma_stride;
  644|    165|            pu1_pred_chroma += (((i4_intr_y + 1) & ~1) >> 1) * i4_pred_chroma_stride;
  645|    165|            pu1_pred_chroma += ((i4_intr_x + 1) >> 1) << 1;
  646|       |
  647|       |            /* ----------------------- Luma ----------------------- */
  648|       |            /* get the recon and residual buffer pointer horz */
  649|    165|            pu1_recon_luma = pu1_rec_y + i4_intr_x;
  650|       |
  651|       |            /* get the recon and residual buffer pointer vertical */
  652|    165|            pu1_recon_luma += (i4_intr_y * i4_recon_luma_stride);
  653|       |
  654|       |            /* assign appropriate width and height */
  655|    165|            i4_width = MB_WIDTH - i4_intr_x;
  ------------------
  |  |   67|    165|#define MB_WIDTH 16
  ------------------
  656|    165|            i4_height = MB_HEIGHT - i4_intr_y;
  ------------------
  |  |   68|    165|#define MB_HEIGHT 16
  ------------------
  657|       |
  658|       |            /* Luma Processing */
  659|    165|            isvcd_copy_data(pu1_pred_luma, i4_pred_luma_stride, pu1_recon_luma,
  660|    165|                            i4_recon_luma_stride, i4_width, i4_height);
  661|       |
  662|       |            /* ----------------------- Chroma ----------------------- */
  663|       |            /* get the recon and residual buffer pointer horz */
  664|    165|            pu1_recon_chroma = pu1_rec_uv;
  665|    165|            {
  666|    165|                WORD32 i4_temp;
  667|    165|                i4_temp = ((i4_intr_y + 1) & ~1) >> 1;
  668|    165|                i4_temp *= i4_recon_chroma_stride;
  669|    165|                i4_temp += (((i4_intr_x + 1) >> 1) << 1);
  670|    165|                pu1_recon_chroma += i4_temp;
  671|    165|            }
  672|       |
  673|       |            /* assign appropriate width and height */
  674|    165|            i4_width = (BLOCK_WIDTH - ((i4_intr_x + 1) >> 1)) << 1;
  ------------------
  |  |   64|    165|#define BLOCK_WIDTH 8
  ------------------
  675|    165|            i4_height = MB_HEIGHT - (i4_intr_y & ~1);
  ------------------
  |  |   68|    165|#define MB_HEIGHT 16
  ------------------
  676|    165|            i4_height >>= 1;
  677|       |            /* Chroma Processing (cb and cr interleaved) */
  678|    165|            isvcd_copy_data(pu1_pred_chroma, i4_pred_chroma_stride, pu1_recon_chroma,
  679|    165|                            i4_recon_chroma_stride, i4_width, i4_height);
  680|    165|        }
  681|    298|    }
  682|    298|    return;
  683|    298|}

isvcd_copy_data:
  350|  1.61k|{
  351|  1.61k|    WORD32 i4_vert_lines;
  352|       |
  353|       |    /* loop for copy all the lines requried */
  354|  17.2k|    for(i4_vert_lines = 0; i4_vert_lines < i4_num_lines; i4_vert_lines++)
  ------------------
  |  Branch (354:28): [True: 15.6k, False: 1.61k]
  ------------------
  355|  15.6k|    {
  356|  15.6k|        memcpy(pu1_dst, pu1_src, i4_num_bytes);
  357|  15.6k|        pu1_src += i4_src_stride;
  358|  15.6k|        pu1_dst += i4_dst_stride;
  359|  15.6k|    }
  360|  1.61k|    return;
  361|  1.61k|}
isvcd_copy_data_semiplanr:
  393|    421|{
  394|    421|    WORD32 i4_vert_lines, u4_i;
  395|       |
  396|       |    /* loop for copy all the lines requried */
  397|  6.87k|    for(i4_vert_lines = 0; i4_vert_lines < i4_num_lines; i4_vert_lines++)
  ------------------
  |  Branch (397:28): [True: 6.45k, False: 421]
  ------------------
  398|  6.45k|    {
  399|  96.0k|        for(u4_i = 0; u4_i < i4_num_bytes; u4_i++)
  ------------------
  |  Branch (399:23): [True: 89.6k, False: 6.45k]
  ------------------
  400|  89.6k|        {
  401|  89.6k|            *(pu1_dst1 + u4_i) = *(pu1_src + (2 * u4_i));
  402|  89.6k|            *(pu1_dst2 + u4_i) = *(pu1_src + (2 * u4_i) + 1);
  403|  89.6k|        }
  404|       |
  405|  6.45k|        pu1_src += i4_src_stride;
  406|  6.45k|        pu1_dst1 += i4_dst_stride;
  407|  6.45k|        pu1_dst2 += i4_dst_stride;
  408|  6.45k|    }
  409|    421|    return;
  410|    421|}
isvcd_left_right_padding:
  584|    395|{
  585|    395|    WORD32 i4_idx_i;
  586|    395|    UWORD8 *pu1_src, *pu1_dst;
  587|       |
  588|    395|    UNUSED(i1_yd_index);
  ------------------
  |  |   45|    395|#define UNUSED(x) ((void)(x))
  ------------------
  589|    395|    UNUSED(pu1_refarray_2);
  ------------------
  |  |   45|    395|#define UNUSED(x) ((void)(x))
  ------------------
  590|    395|    UNUSED(i4_mb_adjoin_x);
  ------------------
  |  |   45|    395|#define UNUSED(x) ((void)(x))
  ------------------
  591|    395|    UNUSED(i4_mb_adjoin_y);
  ------------------
  |  |   45|    395|#define UNUSED(x) ((void)(x))
  ------------------
  592|    395|    UNUSED(i4_corner_pixel_available);
  ------------------
  |  |   45|    395|#define UNUSED(x) ((void)(x))
  ------------------
  593|       |
  594|    395|    pu1_dst = pu1_refarray_1 + i4_x + (i4_y * i4_refarray_stride);
  595|    395|    pu1_src = pu1_dst + i1_xd_index;
  596|    395|    i1_xd_index = MIN(i1_xd_index, MAX_PIX_FILL_LUMA);
  ------------------
  |  |   61|    395|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 371, False: 24]
  |  |  ------------------
  ------------------
  597|    395|    u1_seg_wd = MIN(u1_seg_wd, MAX_PIX_FILL_LUMA);
  ------------------
  |  |   61|    395|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 343, False: 52]
  |  |  ------------------
  ------------------
  598|    395|    pu1_dst = pu1_src - i1_xd_index;
  599|       |
  600|  3.06k|    for(i4_idx_i = 0; i4_idx_i < u1_seg_ht; i4_idx_i++)
  ------------------
  |  Branch (600:23): [True: 2.66k, False: 395]
  ------------------
  601|  2.66k|    {
  602|  2.66k|        memset(pu1_dst, *pu1_src, u1_seg_wd);
  603|  2.66k|        pu1_dst += i4_refarray_stride;
  604|  2.66k|        pu1_src += i4_refarray_stride;
  605|  2.66k|    }
  606|    395|}
isvcd_left_right_padding_chroma:
  629|    395|{
  630|    395|    WORD32 i4_idx_i;
  631|    395|    UWORD8 *pu1_src_cb, *pu1_dst_cb;
  632|    395|    UWORD8 *pu1_src_cr, *pu1_dst_cr;
  633|    395|    WORD32 i4_tmp;
  634|       |
  635|    395|    UNUSED(i1_yd_index);
  ------------------
  |  |   45|    395|#define UNUSED(x) ((void)(x))
  ------------------
  636|    395|    UNUSED(i4_mb_adjoin_x);
  ------------------
  |  |   45|    395|#define UNUSED(x) ((void)(x))
  ------------------
  637|    395|    UNUSED(i4_mb_adjoin_y);
  ------------------
  |  |   45|    395|#define UNUSED(x) ((void)(x))
  ------------------
  638|    395|    UNUSED(i4_corner_pixel_available);
  ------------------
  |  |   45|    395|#define UNUSED(x) ((void)(x))
  ------------------
  639|       |
  640|    395|    i4_tmp = i4_x + (i4_y * i4_refarray_stride);
  641|    395|    pu1_dst_cb = pu1_refarray_1 + i4_tmp;
  642|    395|    pu1_src_cb = pu1_dst_cb + i1_xd_index;
  643|    395|    pu1_dst_cr = pu1_refarray_2 + i4_tmp;
  644|    395|    pu1_src_cr = pu1_dst_cr + i1_xd_index;
  645|       |
  646|    395|    i1_xd_index = MIN(i1_xd_index, MAX_PIX_FILL_CHROMA);
  ------------------
  |  |   61|    395|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 157, False: 238]
  |  |  ------------------
  ------------------
  647|    395|    u1_seg_wd = MIN(u1_seg_wd, MAX_PIX_FILL_CHROMA);
  ------------------
  |  |   61|    395|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 129, False: 266]
  |  |  ------------------
  ------------------
  648|    395|    pu1_dst_cb = pu1_src_cb - i1_xd_index;
  649|    395|    pu1_dst_cr = pu1_src_cr - i1_xd_index;
  650|       |
  651|  1.77k|    for(i4_idx_i = 0; i4_idx_i < u1_seg_ht; i4_idx_i++)
  ------------------
  |  Branch (651:23): [True: 1.37k, False: 395]
  ------------------
  652|  1.37k|    {
  653|  1.37k|        memset(pu1_dst_cb, *pu1_src_cb, u1_seg_wd);
  654|  1.37k|        pu1_dst_cb += i4_refarray_stride;
  655|  1.37k|        pu1_src_cb += i4_refarray_stride;
  656|  1.37k|        memset(pu1_dst_cr, *pu1_src_cr, u1_seg_wd);
  657|  1.37k|        pu1_dst_cr += i4_refarray_stride;
  658|  1.37k|        pu1_src_cr += i4_refarray_stride;
  659|  1.37k|    }
  660|    395|}
isvcd_top_bot_padding:
  683|    310|{
  684|    310|    WORD32 i4_idx_i;
  685|    310|    UWORD8 *pu1_src, *pu1_dst;
  686|       |
  687|    310|    UNUSED(i1_xd_index);
  ------------------
  |  |   45|    310|#define UNUSED(x) ((void)(x))
  ------------------
  688|    310|    UNUSED(pu1_refarray_2);
  ------------------
  |  |   45|    310|#define UNUSED(x) ((void)(x))
  ------------------
  689|    310|    UNUSED(i4_mb_adjoin_x);
  ------------------
  |  |   45|    310|#define UNUSED(x) ((void)(x))
  ------------------
  690|    310|    UNUSED(i4_mb_adjoin_y);
  ------------------
  |  |   45|    310|#define UNUSED(x) ((void)(x))
  ------------------
  691|    310|    UNUSED(i4_corner_pixel_available);
  ------------------
  |  |   45|    310|#define UNUSED(x) ((void)(x))
  ------------------
  692|       |
  693|    310|    pu1_dst = pu1_refarray_1 + i4_x + (i4_y * i4_refarray_stride);
  694|    310|    pu1_src = pu1_dst + (i1_yd_index * i4_refarray_stride);
  695|    310|    i1_yd_index = MIN(i1_yd_index, MAX_PIX_FILL_LUMA);
  ------------------
  |  |   61|    310|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 268, False: 42]
  |  |  ------------------
  ------------------
  696|    310|    u1_seg_ht = MIN(u1_seg_ht, MAX_PIX_FILL_LUMA);
  ------------------
  |  |   61|    310|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 208, False: 102]
  |  |  ------------------
  ------------------
  697|    310|    pu1_dst = pu1_src - (i1_yd_index * i4_refarray_stride);
  698|       |
  699|  1.25k|    for(i4_idx_i = 0; i4_idx_i < u1_seg_ht; i4_idx_i++)
  ------------------
  |  Branch (699:23): [True: 946, False: 310]
  ------------------
  700|    946|    {
  701|    946|        memcpy(pu1_dst, pu1_src, u1_seg_wd);
  702|    946|        pu1_dst += i4_refarray_stride;
  703|    946|    }
  704|    310|}
isvcd_top_bot_padding_chroma:
  728|    310|{
  729|    310|    WORD32 i4_idx_i;
  730|    310|    UWORD8 *pu1_src_cb, *pu1_dst_cb;
  731|    310|    UWORD8 *pu1_src_cr, *pu1_dst_cr;
  732|    310|    WORD32 i4_tmp;
  733|       |
  734|    310|    UNUSED(i1_xd_index);
  ------------------
  |  |   45|    310|#define UNUSED(x) ((void)(x))
  ------------------
  735|    310|    UNUSED(pu1_refarray_2);
  ------------------
  |  |   45|    310|#define UNUSED(x) ((void)(x))
  ------------------
  736|    310|    UNUSED(i4_mb_adjoin_x);
  ------------------
  |  |   45|    310|#define UNUSED(x) ((void)(x))
  ------------------
  737|    310|    UNUSED(i4_mb_adjoin_y);
  ------------------
  |  |   45|    310|#define UNUSED(x) ((void)(x))
  ------------------
  738|    310|    UNUSED(i4_corner_pixel_available);
  ------------------
  |  |   45|    310|#define UNUSED(x) ((void)(x))
  ------------------
  739|       |
  740|    310|    i4_tmp = i4_x + (i4_y * i4_refarray_stride);
  741|    310|    pu1_dst_cb = pu1_refarray_1 + i4_tmp;
  742|    310|    pu1_dst_cr = pu1_refarray_2 + i4_tmp;
  743|       |
  744|    310|    i4_tmp = (i1_yd_index * i4_refarray_stride);
  745|    310|    pu1_src_cb = pu1_dst_cb + i4_tmp;
  746|    310|    pu1_src_cr = pu1_dst_cr + i4_tmp;
  747|    310|    i1_yd_index = MIN(i1_yd_index, MAX_PIX_FILL_CHROMA);
  ------------------
  |  |   61|    310|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 146, False: 164]
  |  |  ------------------
  ------------------
  748|    310|    u1_seg_ht = MIN(u1_seg_ht, MAX_PIX_FILL_CHROMA);
  ------------------
  |  |   61|    310|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 86, False: 224]
  |  |  ------------------
  ------------------
  749|       |
  750|    310|    i4_tmp = (i1_yd_index * i4_refarray_stride);
  751|    310|    pu1_dst_cb = pu1_src_cb - i4_tmp;
  752|    310|    pu1_dst_cr = pu1_src_cr - i4_tmp;
  753|       |
  754|    844|    for(i4_idx_i = 0; i4_idx_i < u1_seg_ht; i4_idx_i++)
  ------------------
  |  Branch (754:23): [True: 534, False: 310]
  ------------------
  755|    534|    {
  756|    534|        memcpy(pu1_dst_cb, pu1_src_cb, u1_seg_wd);
  757|    534|        pu1_dst_cb += i4_refarray_stride;
  758|    534|        memcpy(pu1_dst_cr, pu1_src_cr, u1_seg_wd);
  759|    534|        pu1_dst_cr += i4_refarray_stride;
  760|    534|    }
  761|    310|}
isvcd_diag_reconstruction:
  785|    603|{
  786|    603|    WORD32 i4_i;
  787|    603|    UWORD8 *pu1_src_1, *pu1_src_2, *pu1_dst;
  788|    603|    UWORD8 u1_filter_delay_buf[18] = {0};
  789|    603|    UWORD8 u1_out_buf[16] = {0};
  790|    603|    WORD32 i4_width, i4_height;
  791|    603|    WORD32 i4_x_off, i4_y_off;
  792|    603|    WORD32 i4_block_size = BLOCK_WIDTH;
  ------------------
  |  |   64|    603|#define BLOCK_WIDTH 8
  ------------------
  793|       |
  794|    603|    UNUSED(pu1_refarray_2);
  ------------------
  |  |   45|    603|#define UNUSED(x) ((void)(x))
  ------------------
  795|       |
  796|    603|    pu1_dst = pu1_refarray_1 + i4_x + (i4_y * i4_refarray_stride);
  797|    603|    pu1_src_1 = pu1_dst + i1_xd_index;
  798|    603|    pu1_src_2 = pu1_dst + (i1_yd_index * i4_refarray_stride);
  799|       |
  800|    603|    i4_width = MAX(u1_seg_wd, (((i4_mb_adjoin_x >> 3) ^ 1) * i4_block_size));
  ------------------
  |  |   60|    603|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 426, False: 177]
  |  |  ------------------
  ------------------
  801|    603|    i4_height = MAX(u1_seg_ht, (((i4_mb_adjoin_y >> 4) ^ 1) * i4_block_size));
  ------------------
  |  |   60|    603|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 475, False: 128]
  |  |  ------------------
  ------------------
  802|    603|    i4_x_off = (i4_width - u1_seg_wd);
  803|    603|    i4_y_off = (i4_height - u1_seg_ht);
  804|       |
  805|    603|    if(i1_xd_index < 0 && i1_yd_index > 0)
  ------------------
  |  Branch (805:8): [True: 291, False: 312]
  |  Branch (805:27): [True: 176, False: 115]
  ------------------
  806|    176|    {
  807|       |        /* Quadrant 1 Processing load the pixel in the filter delay buffer */
  808|  1.76k|        for(i4_i = 0; i4_i < (i4_height + 1); i4_i++)
  ------------------
  |  Branch (808:23): [True: 1.58k, False: 176]
  ------------------
  809|  1.58k|        {
  810|  1.58k|            u1_filter_delay_buf[i4_i] = *pu1_src_1;
  811|  1.58k|            pu1_src_1 += i4_refarray_stride;
  812|  1.58k|        }
  813|       |
  814|    176|        pu1_src_2 -= i4_x_off;
  815|    176|        memcpy(&u1_filter_delay_buf[i4_i], pu1_src_2, i4_width);
  816|       |
  817|    176|        if(0 == i4_corner_pixel_available)
  ------------------
  |  Branch (817:12): [True: 176, False: 0]
  ------------------
  818|    176|        {
  819|       |            /* interpolate the unavailable corner pixel */
  820|    176|            u1_filter_delay_buf[i4_i - 1] =
  821|    176|                (u1_filter_delay_buf[i4_i] + u1_filter_delay_buf[i4_i - 2] + 1) >> 1;
  822|    176|        }
  823|       |
  824|  2.67k|        for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++)
  ------------------
  |  Branch (824:23): [True: 2.49k, False: 176]
  ------------------
  825|  2.49k|        {
  826|       |            /* get the filtered output */
  827|  2.49k|            u1_out_buf[i4_i] = ((u1_filter_delay_buf[i4_i]) + (u1_filter_delay_buf[i4_i + 1] * 2) +
  828|  2.49k|                                (u1_filter_delay_buf[i4_i + 2]) + 2) >>
  829|  2.49k|                               2;
  830|  2.49k|        }
  831|       |
  832|       |        /* fill the segment with diagonal reconstructed output */
  833|  1.30k|        for(i4_i = 0; i4_i < u1_seg_ht; i4_i++)
  ------------------
  |  Branch (833:23): [True: 1.12k, False: 176]
  ------------------
  834|  1.12k|        {
  835|  1.12k|            memcpy(pu1_dst, &u1_out_buf[i4_x_off + i4_i], u1_seg_wd);
  836|  1.12k|            pu1_dst += i4_refarray_stride;
  837|  1.12k|        }
  838|    176|    }
  839|    427|    else if(i1_xd_index > 0 && i1_yd_index > 0)
  ------------------
  |  Branch (839:13): [True: 312, False: 115]
  |  Branch (839:32): [True: 125, False: 187]
  ------------------
  840|    125|    {
  841|       |        /* Quadrant 2 Processing */
  842|       |        /* load the pixel in the filter delay buffer  */
  843|    125|        memcpy(&u1_filter_delay_buf[0], pu1_src_2, (i4_width + 1));
  844|    665|        for(i4_i = i4_height; i4_i > 0; i4_i--)
  ------------------
  |  Branch (844:31): [True: 540, False: 125]
  ------------------
  845|    540|        {
  846|    540|            u1_filter_delay_buf[i4_width + i4_i] = *pu1_src_1;
  847|    540|            pu1_src_1 += i4_refarray_stride;
  848|    540|        }
  849|       |
  850|    125|        if(0 == i4_corner_pixel_available)
  ------------------
  |  Branch (850:12): [True: 125, False: 0]
  ------------------
  851|    125|        {
  852|       |            /* interpolate the unavailable corner pixel */
  853|    125|            u1_filter_delay_buf[i4_width] =
  854|    125|                (u1_filter_delay_buf[i4_width - 1] + u1_filter_delay_buf[i4_width + 1] + 1) >> 1;
  855|    125|        }
  856|       |
  857|  1.54k|        for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++)
  ------------------
  |  Branch (857:23): [True: 1.41k, False: 125]
  ------------------
  858|  1.41k|        {
  859|       |            /* get the filtered output */
  860|  1.41k|            u1_out_buf[i4_i] = ((u1_filter_delay_buf[i4_i]) + (u1_filter_delay_buf[i4_i + 1] * 2) +
  861|  1.41k|                                (u1_filter_delay_buf[i4_i + 2]) + 2) >>
  862|  1.41k|                               2;
  863|  1.41k|        }
  864|       |
  865|       |        /* fill the segment with diagonal reconstructed output */
  866|    665|        for(i4_i = 1; i4_i <= u1_seg_ht; i4_i++)
  ------------------
  |  Branch (866:23): [True: 540, False: 125]
  ------------------
  867|    540|        {
  868|    540|            memcpy(pu1_dst, &u1_out_buf[i4_height - i4_i], u1_seg_wd);
  869|    540|            pu1_dst += i4_refarray_stride;
  870|    540|        }
  871|    125|    }
  872|    302|    else if(i1_xd_index > 0 && i1_yd_index < 0)
  ------------------
  |  Branch (872:13): [True: 187, False: 115]
  |  Branch (872:32): [True: 187, False: 0]
  ------------------
  873|    187|    {
  874|       |        /* Quadrant 3 Processing */
  875|       |        /* load the pixel in the filter delay buffer  */
  876|    187|        memcpy(&u1_filter_delay_buf[0], pu1_src_2, (i4_width + 1));
  877|       |
  878|    187|        pu1_src_1 -= (i4_y_off * i4_refarray_stride);
  879|  1.55k|        for(i4_i = 1; i4_i <= i4_height; i4_i++)
  ------------------
  |  Branch (879:23): [True: 1.36k, False: 187]
  ------------------
  880|  1.36k|        {
  881|  1.36k|            u1_filter_delay_buf[i4_width + i4_i] = *pu1_src_1;
  882|  1.36k|            pu1_src_1 += i4_refarray_stride;
  883|  1.36k|        }
  884|       |
  885|    187|        if(0 == i4_corner_pixel_available)
  ------------------
  |  Branch (885:12): [True: 187, False: 0]
  ------------------
  886|    187|        {
  887|       |            /* interpolate the unavailable corner pixel */
  888|    187|            u1_filter_delay_buf[i4_width] =
  889|    187|                (u1_filter_delay_buf[i4_width - 1] + u1_filter_delay_buf[i4_width + 1] + 1) >> 1;
  890|    187|        }
  891|       |
  892|  2.86k|        for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++)
  ------------------
  |  Branch (892:23): [True: 2.67k, False: 187]
  ------------------
  893|  2.67k|        {
  894|       |            /* get the filtered output */
  895|  2.67k|            u1_out_buf[i4_i] = ((u1_filter_delay_buf[i4_i]) + (u1_filter_delay_buf[i4_i + 1] * 2) +
  896|  2.67k|                                (u1_filter_delay_buf[i4_i + 2]) + 2) >>
  897|  2.67k|                               2;
  898|  2.67k|        }
  899|       |
  900|       |        /* fill the segment with diagonal reconstructed output */
  901|  1.38k|        for(i4_i = 0; i4_i < u1_seg_ht; i4_i++)
  ------------------
  |  Branch (901:23): [True: 1.19k, False: 187]
  ------------------
  902|  1.19k|        {
  903|  1.19k|            memcpy(pu1_dst, &u1_out_buf[i4_y_off + i4_i], u1_seg_wd);
  904|  1.19k|            pu1_dst += i4_refarray_stride;
  905|  1.19k|        }
  906|    187|    }
  907|    115|    else
  908|    115|    {
  909|       |        /* Quadrant 4 Processing */
  910|       |        /* load the pixel in the filter delay buffer  */
  911|    115|        pu1_src_1 += ((u1_seg_ht - 1) * i4_refarray_stride);
  912|    736|        for(i4_i = 0; i4_i <= i4_height; i4_i++)
  ------------------
  |  Branch (912:23): [True: 621, False: 115]
  ------------------
  913|    621|        {
  914|    621|            u1_filter_delay_buf[i4_i] = *pu1_src_1;
  915|    621|            pu1_src_1 -= i4_refarray_stride;
  916|    621|        }
  917|       |
  918|    115|        pu1_src_2 -= i4_x_off;
  919|    115|        memcpy(&u1_filter_delay_buf[i4_i], pu1_src_2, i4_width);
  920|       |
  921|    115|        if(0 == i4_corner_pixel_available)
  ------------------
  |  Branch (921:12): [True: 112, False: 3]
  ------------------
  922|    112|        {
  923|       |            /* interpolate the unavailable corner pixel */
  924|    112|            u1_filter_delay_buf[i4_i - 1] =
  925|    112|                (u1_filter_delay_buf[i4_i] + u1_filter_delay_buf[i4_i - 2] + 1) >> 1;
  926|    112|        }
  927|       |
  928|  1.34k|        for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++)
  ------------------
  |  Branch (928:23): [True: 1.23k, False: 115]
  ------------------
  929|  1.23k|        {
  930|       |            /* get the filtered output */
  931|  1.23k|            u1_out_buf[i4_i] = ((u1_filter_delay_buf[i4_i]) + (u1_filter_delay_buf[i4_i + 1] * 2) +
  932|  1.23k|                                (u1_filter_delay_buf[i4_i + 2]) + 2) >>
  933|  1.23k|                               2;
  934|  1.23k|        }
  935|       |
  936|       |        /* fill the segment with diagonal reconstructed output */
  937|    621|        for(i4_i = 1; i4_i <= u1_seg_ht; i4_i++)
  ------------------
  |  Branch (937:23): [True: 506, False: 115]
  ------------------
  938|    506|        {
  939|    506|            memcpy(pu1_dst, &u1_out_buf[(u1_seg_ht + i4_x_off) - i4_i], u1_seg_wd);
  940|    506|            pu1_dst += i4_refarray_stride;
  941|    506|        }
  942|    115|    }
  943|    603|}
isvcd_diag_reconstruction_chroma:
  966|    603|{
  967|    603|    WORD32 i4_i;
  968|    603|    UWORD8 u1_filter_delay_buf_cb[18] = {0};
  969|    603|    UWORD8 u1_filter_delay_buf_cr[18] = {0};
  970|    603|    UWORD8 u1_out_buf_cb[16] = {0};
  971|    603|    UWORD8 u1_out_buf_cr[16] = {0};
  972|    603|    WORD32 i4_width, i4_height;
  973|    603|    WORD32 i4_x_off, i4_y_off;
  974|    603|    WORD32 i4_block_size = BLOCK_WIDTH >> 1;
  ------------------
  |  |   64|    603|#define BLOCK_WIDTH 8
  ------------------
  975|    603|    UWORD8 *pu1_src_1_cb, *pu1_src_2_cb, *pu1_dst_cb;
  976|    603|    UWORD8 *pu1_src_1_cr, *pu1_src_2_cr, *pu1_dst_cr;
  977|    603|    WORD32 i4_tmp;
  978|       |
  979|    603|    i4_tmp = i4_x + (i4_y * i4_refarray_stride);
  980|    603|    pu1_dst_cb = pu1_refarray_1 + i4_tmp;
  981|    603|    pu1_dst_cr = pu1_refarray_2 + i4_tmp;
  982|       |
  983|    603|    pu1_src_1_cb = pu1_dst_cb + i1_xd_index;
  984|    603|    pu1_src_1_cr = pu1_dst_cr + i1_xd_index;
  985|    603|    i4_tmp = (i1_yd_index * i4_refarray_stride);
  986|    603|    pu1_src_2_cb = pu1_dst_cb + i4_tmp;
  987|    603|    pu1_src_2_cr = pu1_dst_cr + i4_tmp;
  988|       |
  989|    603|    i4_width = MAX(u1_seg_wd, (((i4_mb_adjoin_x >> 3) ^ 1) * i4_block_size));
  ------------------
  |  |   60|    603|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 426, False: 177]
  |  |  ------------------
  ------------------
  990|    603|    i4_height = MAX(u1_seg_ht, (((i4_mb_adjoin_y >> 4) ^ 1) * i4_block_size));
  ------------------
  |  |   60|    603|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 475, False: 128]
  |  |  ------------------
  ------------------
  991|    603|    i4_x_off = (i4_width - u1_seg_wd);
  992|    603|    i4_y_off = (i4_height - u1_seg_ht);
  993|       |
  994|    603|    if(i1_xd_index < 0 && i1_yd_index > 0)
  ------------------
  |  Branch (994:8): [True: 291, False: 312]
  |  Branch (994:27): [True: 176, False: 115]
  ------------------
  995|    176|    {
  996|       |        /* Quadrant 1 Processing load the pixel in the filter delay buffer */
  997|  1.05k|        for(i4_i = 0; i4_i < (i4_height + 1); i4_i++)
  ------------------
  |  Branch (997:23): [True: 880, False: 176]
  ------------------
  998|    880|        {
  999|    880|            u1_filter_delay_buf_cb[i4_i] = *pu1_src_1_cb;
 1000|    880|            pu1_src_1_cb += i4_refarray_stride;
 1001|    880|            u1_filter_delay_buf_cr[i4_i] = *pu1_src_1_cr;
 1002|    880|            pu1_src_1_cr += i4_refarray_stride;
 1003|    880|        }
 1004|       |
 1005|    176|        pu1_src_2_cb -= i4_x_off;
 1006|    176|        pu1_src_2_cr -= i4_x_off;
 1007|    176|        memcpy(&u1_filter_delay_buf_cb[i4_i], pu1_src_2_cb, i4_width);
 1008|    176|        memcpy(&u1_filter_delay_buf_cr[i4_i], pu1_src_2_cr, i4_width);
 1009|       |
 1010|    176|        if(0 == i4_corner_pixel_available)
  ------------------
  |  Branch (1010:12): [True: 176, False: 0]
  ------------------
 1011|    176|        {
 1012|       |            /* interpolate the unavailable corner pixel */
 1013|    176|            u1_filter_delay_buf_cb[i4_i - 1] =
 1014|    176|                (u1_filter_delay_buf_cb[i4_i] + u1_filter_delay_buf_cb[i4_i - 2] + 1) >> 1;
 1015|       |
 1016|    176|            u1_filter_delay_buf_cr[i4_i - 1] =
 1017|    176|                (u1_filter_delay_buf_cr[i4_i] + u1_filter_delay_buf_cr[i4_i - 2] + 1) >> 1;
 1018|    176|        }
 1019|       |
 1020|  1.40k|        for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++)
  ------------------
  |  Branch (1020:23): [True: 1.23k, False: 176]
  ------------------
 1021|  1.23k|        {
 1022|       |            /* get the filtered output */
 1023|  1.23k|            u1_out_buf_cb[i4_i] =
 1024|  1.23k|                ((u1_filter_delay_buf_cb[i4_i]) + (u1_filter_delay_buf_cb[i4_i + 1] * 2) +
 1025|  1.23k|                 (u1_filter_delay_buf_cb[i4_i + 2]) + 2) >>
 1026|  1.23k|                2;
 1027|       |
 1028|  1.23k|            u1_out_buf_cr[i4_i] =
 1029|  1.23k|                ((u1_filter_delay_buf_cr[i4_i]) + (u1_filter_delay_buf_cr[i4_i + 1] * 2) +
 1030|  1.23k|                 (u1_filter_delay_buf_cr[i4_i + 2]) + 2) >>
 1031|  1.23k|                2;
 1032|  1.23k|        }
 1033|       |
 1034|       |        /* fill the segment with diagonal reconstructed output */
 1035|    738|        for(i4_i = 0; i4_i < u1_seg_ht; i4_i++)
  ------------------
  |  Branch (1035:23): [True: 562, False: 176]
  ------------------
 1036|    562|        {
 1037|    562|            memcpy(pu1_dst_cb, &u1_out_buf_cb[i4_x_off + i4_i], u1_seg_wd);
 1038|    562|            pu1_dst_cb += i4_refarray_stride;
 1039|    562|            memcpy(pu1_dst_cr, &u1_out_buf_cr[i4_x_off + i4_i], u1_seg_wd);
 1040|    562|            pu1_dst_cr += i4_refarray_stride;
 1041|    562|        }
 1042|    176|    }
 1043|    427|    else if(i1_xd_index > 0 && i1_yd_index > 0)
  ------------------
  |  Branch (1043:13): [True: 312, False: 115]
  |  Branch (1043:32): [True: 125, False: 187]
  ------------------
 1044|    125|    {
 1045|       |        /* Quadrant 2 Processing load the pixel in the filter delay buffer  */
 1046|    125|        memcpy(&u1_filter_delay_buf_cb[0], pu1_src_2_cb, (i4_width + 1));
 1047|    125|        memcpy(&u1_filter_delay_buf_cr[0], pu1_src_2_cr, (i4_width + 1));
 1048|       |
 1049|    441|        for(i4_i = i4_height; i4_i > 0; i4_i--)
  ------------------
  |  Branch (1049:31): [True: 316, False: 125]
  ------------------
 1050|    316|        {
 1051|    316|            u1_filter_delay_buf_cb[i4_width + i4_i] = *pu1_src_1_cb;
 1052|    316|            pu1_src_1_cb += i4_refarray_stride;
 1053|       |
 1054|    316|            u1_filter_delay_buf_cr[i4_width + i4_i] = *pu1_src_1_cr;
 1055|    316|            pu1_src_1_cr += i4_refarray_stride;
 1056|    316|        }
 1057|       |
 1058|    125|        if(0 == i4_corner_pixel_available)
  ------------------
  |  Branch (1058:12): [True: 125, False: 0]
  ------------------
 1059|    125|        {
 1060|       |            /* interpolate the unavailable corner pixel */
 1061|    125|            u1_filter_delay_buf_cb[i4_width] =
 1062|    125|                (u1_filter_delay_buf_cb[i4_width - 1] + u1_filter_delay_buf_cb[i4_width + 1] + 1) >>
 1063|    125|                1;
 1064|       |
 1065|    125|            u1_filter_delay_buf_cr[i4_width] =
 1066|    125|                (u1_filter_delay_buf_cr[i4_width - 1] + u1_filter_delay_buf_cr[i4_width + 1] + 1) >>
 1067|    125|                1;
 1068|    125|        }
 1069|       |
 1070|    816|        for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++)
  ------------------
  |  Branch (1070:23): [True: 691, False: 125]
  ------------------
 1071|    691|        {
 1072|       |            /* get the filtered output */
 1073|    691|            u1_out_buf_cb[i4_i] =
 1074|    691|                ((u1_filter_delay_buf_cb[i4_i]) + (u1_filter_delay_buf_cb[i4_i + 1] * 2) +
 1075|    691|                 (u1_filter_delay_buf_cb[i4_i + 2]) + 2) >>
 1076|    691|                2;
 1077|       |
 1078|    691|            u1_out_buf_cr[i4_i] =
 1079|    691|                ((u1_filter_delay_buf_cr[i4_i]) + (u1_filter_delay_buf_cr[i4_i + 1] * 2) +
 1080|    691|                 (u1_filter_delay_buf_cr[i4_i + 2]) + 2) >>
 1081|    691|                2;
 1082|    691|        }
 1083|       |
 1084|       |        /* fill the segment with diagonal reconstructed output */
 1085|    441|        for(i4_i = 1; i4_i <= u1_seg_ht; i4_i++)
  ------------------
  |  Branch (1085:23): [True: 316, False: 125]
  ------------------
 1086|    316|        {
 1087|    316|            memcpy(pu1_dst_cb, &u1_out_buf_cb[i4_height - i4_i], u1_seg_wd);
 1088|    316|            pu1_dst_cb += i4_refarray_stride;
 1089|       |
 1090|    316|            memcpy(pu1_dst_cr, &u1_out_buf_cr[i4_height - i4_i], u1_seg_wd);
 1091|    316|            pu1_dst_cr += i4_refarray_stride;
 1092|    316|        }
 1093|    125|    }
 1094|    302|    else if(i1_xd_index > 0 && i1_yd_index < 0)
  ------------------
  |  Branch (1094:13): [True: 187, False: 115]
  |  Branch (1094:32): [True: 187, False: 0]
  ------------------
 1095|    187|    {
 1096|       |        /* Quadrant 3 Processing load the pixel in the filter delay buffer  */
 1097|    187|        memcpy(&u1_filter_delay_buf_cb[0], pu1_src_2_cb, (i4_width + 1));
 1098|    187|        memcpy(&u1_filter_delay_buf_cr[0], pu1_src_2_cr, (i4_width + 1));
 1099|       |
 1100|    187|        i4_tmp = (i4_y_off * i4_refarray_stride);
 1101|    187|        pu1_src_1_cb -= i4_tmp;
 1102|    187|        pu1_src_1_cr -= i4_tmp;
 1103|    935|        for(i4_i = 1; i4_i <= i4_height; i4_i++)
  ------------------
  |  Branch (1103:23): [True: 748, False: 187]
  ------------------
 1104|    748|        {
 1105|    748|            u1_filter_delay_buf_cb[i4_width + i4_i] = *pu1_src_1_cb;
 1106|    748|            pu1_src_1_cb += i4_refarray_stride;
 1107|       |
 1108|    748|            u1_filter_delay_buf_cr[i4_width + i4_i] = *pu1_src_1_cr;
 1109|    748|            pu1_src_1_cr += i4_refarray_stride;
 1110|    748|        }
 1111|       |
 1112|    187|        if(0 == i4_corner_pixel_available)
  ------------------
  |  Branch (1112:12): [True: 187, False: 0]
  ------------------
 1113|    187|        {
 1114|       |            /* interpolate the unavailable corner pixel */
 1115|    187|            u1_filter_delay_buf_cb[i4_width] =
 1116|    187|                (u1_filter_delay_buf_cb[i4_width - 1] + u1_filter_delay_buf_cb[i4_width + 1] + 1) >>
 1117|    187|                1;
 1118|       |
 1119|    187|            u1_filter_delay_buf_cr[i4_width] =
 1120|    187|                (u1_filter_delay_buf_cr[i4_width - 1] + u1_filter_delay_buf_cr[i4_width + 1] + 1) >>
 1121|    187|                1;
 1122|    187|        }
 1123|       |
 1124|  1.49k|        for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++)
  ------------------
  |  Branch (1124:23): [True: 1.30k, False: 187]
  ------------------
 1125|  1.30k|        {
 1126|       |            /* get the filtered output */
 1127|  1.30k|            u1_out_buf_cb[i4_i] =
 1128|  1.30k|                ((u1_filter_delay_buf_cb[i4_i]) + (u1_filter_delay_buf_cb[i4_i + 1] * 2) +
 1129|  1.30k|                 (u1_filter_delay_buf_cb[i4_i + 2]) + 2) >>
 1130|  1.30k|                2;
 1131|       |
 1132|  1.30k|            u1_out_buf_cr[i4_i] =
 1133|  1.30k|                ((u1_filter_delay_buf_cr[i4_i]) + (u1_filter_delay_buf_cr[i4_i + 1] * 2) +
 1134|  1.30k|                 (u1_filter_delay_buf_cr[i4_i + 2]) + 2) >>
 1135|  1.30k|                2;
 1136|  1.30k|        }
 1137|       |
 1138|       |        /* fill the segment with diagonal reconstructed output */
 1139|    878|        for(i4_i = 0; i4_i < u1_seg_ht; i4_i++)
  ------------------
  |  Branch (1139:23): [True: 691, False: 187]
  ------------------
 1140|    691|        {
 1141|    691|            memcpy(pu1_dst_cb, &u1_out_buf_cb[i4_y_off + i4_i], u1_seg_wd);
 1142|    691|            pu1_dst_cb += i4_refarray_stride;
 1143|    691|            memcpy(pu1_dst_cr, &u1_out_buf_cr[i4_y_off + i4_i], u1_seg_wd);
 1144|    691|            pu1_dst_cr += i4_refarray_stride;
 1145|    691|        }
 1146|    187|    }
 1147|    115|    else
 1148|    115|    {
 1149|       |        /* Quadrant 4 Processing load the pixel in the filter delay buffer  */
 1150|    115|        i4_tmp = ((u1_seg_ht - 1) * i4_refarray_stride);
 1151|    115|        pu1_src_1_cb += i4_tmp;
 1152|    115|        pu1_src_1_cr += i4_tmp;
 1153|       |
 1154|    483|        for(i4_i = 0; i4_i <= i4_height; i4_i++)
  ------------------
  |  Branch (1154:23): [True: 368, False: 115]
  ------------------
 1155|    368|        {
 1156|    368|            u1_filter_delay_buf_cb[i4_i] = *pu1_src_1_cb;
 1157|    368|            pu1_src_1_cb -= i4_refarray_stride;
 1158|       |
 1159|    368|            u1_filter_delay_buf_cr[i4_i] = *pu1_src_1_cr;
 1160|    368|            pu1_src_1_cr -= i4_refarray_stride;
 1161|    368|        }
 1162|       |
 1163|    115|        pu1_src_2_cb -= i4_x_off;
 1164|    115|        pu1_src_2_cr -= i4_x_off;
 1165|    115|        memcpy(&u1_filter_delay_buf_cb[i4_i], pu1_src_2_cb, i4_width);
 1166|    115|        memcpy(&u1_filter_delay_buf_cr[i4_i], pu1_src_2_cr, i4_width);
 1167|       |
 1168|    115|        if(0 == i4_corner_pixel_available)
  ------------------
  |  Branch (1168:12): [True: 112, False: 3]
  ------------------
 1169|    112|        {
 1170|       |            /* interpolate the unavailable corner pixel */
 1171|    112|            u1_filter_delay_buf_cb[i4_i - 1] =
 1172|    112|                (u1_filter_delay_buf_cb[i4_i] + u1_filter_delay_buf_cb[i4_i - 2] + 1) >> 1;
 1173|       |
 1174|    112|            u1_filter_delay_buf_cr[i4_i - 1] =
 1175|    112|                (u1_filter_delay_buf_cr[i4_i] + u1_filter_delay_buf_cr[i4_i - 2] + 1) >> 1;
 1176|    112|        }
 1177|       |
 1178|    713|        for(i4_i = 0; i4_i < (i4_width + i4_height - 1); i4_i++)
  ------------------
  |  Branch (1178:23): [True: 598, False: 115]
  ------------------
 1179|    598|        {
 1180|       |            /* get the filtered output */
 1181|    598|            u1_out_buf_cb[i4_i] =
 1182|    598|                ((u1_filter_delay_buf_cb[i4_i]) + (u1_filter_delay_buf_cb[i4_i + 1] * 2) +
 1183|    598|                 (u1_filter_delay_buf_cb[i4_i + 2]) + 2) >>
 1184|    598|                2;
 1185|       |
 1186|    598|            u1_out_buf_cr[i4_i] =
 1187|    598|                ((u1_filter_delay_buf_cr[i4_i]) + (u1_filter_delay_buf_cr[i4_i + 1] * 2) +
 1188|    598|                 (u1_filter_delay_buf_cr[i4_i + 2]) + 2) >>
 1189|    598|                2;
 1190|    598|        }
 1191|       |
 1192|       |        /* fill the segment with diagonal reconstructed output */
 1193|    368|        for(i4_i = 1; i4_i <= u1_seg_ht; i4_i++)
  ------------------
  |  Branch (1193:23): [True: 253, False: 115]
  ------------------
 1194|    253|        {
 1195|    253|            memcpy(pu1_dst_cb, &u1_out_buf_cb[(u1_seg_ht + i4_x_off) - i4_i], u1_seg_wd);
 1196|    253|            pu1_dst_cb += i4_refarray_stride;
 1197|    253|            memcpy(pu1_dst_cr, &u1_out_buf_cr[(u1_seg_ht + i4_x_off) - i4_i], u1_seg_wd);
 1198|    253|            pu1_dst_cr += i4_refarray_stride;
 1199|    253|        }
 1200|    115|    }
 1201|    603|}
isvcd_diag_padding:
 1224|    268|{
 1225|    268|    WORD32 i4_idx_i;
 1226|    268|    UWORD8 *pu1_src, *pu1_dst;
 1227|       |
 1228|    268|    UNUSED(pu1_refarray_2);
  ------------------
  |  |   45|    268|#define UNUSED(x) ((void)(x))
  ------------------
 1229|    268|    UNUSED(i4_mb_adjoin_x);
  ------------------
  |  |   45|    268|#define UNUSED(x) ((void)(x))
  ------------------
 1230|    268|    UNUSED(i4_mb_adjoin_y);
  ------------------
  |  |   45|    268|#define UNUSED(x) ((void)(x))
  ------------------
 1231|    268|    UNUSED(i4_corner_pixel_available);
  ------------------
  |  |   45|    268|#define UNUSED(x) ((void)(x))
  ------------------
 1232|       |
 1233|    268|    pu1_dst = pu1_refarray_1 + i4_x + (i4_y * i4_refarray_stride);
 1234|    268|    pu1_src = pu1_dst + i1_xd_index + (i1_yd_index * i4_refarray_stride);
 1235|    268|    i1_xd_index = MIN(i1_xd_index, MAX_PIX_FILL_LUMA);
  ------------------
  |  |   61|    268|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 244, False: 24]
  |  |  ------------------
  ------------------
 1236|    268|    u1_seg_wd = MIN(u1_seg_wd, MAX_PIX_FILL_LUMA);
  ------------------
  |  |   61|    268|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 217, False: 51]
  |  |  ------------------
  ------------------
 1237|    268|    i1_yd_index = MIN(i1_yd_index, MAX_PIX_FILL_LUMA);
  ------------------
  |  |   61|    268|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 230, False: 38]
  |  |  ------------------
  ------------------
 1238|    268|    u1_seg_ht = MIN(u1_seg_ht, MAX_PIX_FILL_LUMA);
  ------------------
  |  |   61|    268|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 170, False: 98]
  |  |  ------------------
  ------------------
 1239|    268|    pu1_dst = pu1_src - i1_xd_index - (i1_yd_index * i4_refarray_stride);
 1240|       |
 1241|  1.09k|    for(i4_idx_i = 0; i4_idx_i < u1_seg_ht; i4_idx_i++)
  ------------------
  |  Branch (1241:23): [True: 829, False: 268]
  ------------------
 1242|    829|    {
 1243|    829|        memset(pu1_dst, *pu1_src, u1_seg_wd);
 1244|    829|        pu1_dst += i4_refarray_stride;
 1245|    829|    }
 1246|    268|}
isvcd_diag_padding_chroma:
 1271|    268|{
 1272|    268|    WORD32 i4_idx_i;
 1273|    268|    UWORD8 *pu1_src_cb, *pu1_dst_cb;
 1274|    268|    UWORD8 *pu1_src_cr, *pu1_dst_cr;
 1275|    268|    WORD32 i4_tmp;
 1276|       |
 1277|    268|    UNUSED(i4_mb_adjoin_x);
  ------------------
  |  |   45|    268|#define UNUSED(x) ((void)(x))
  ------------------
 1278|    268|    UNUSED(i4_mb_adjoin_y);
  ------------------
  |  |   45|    268|#define UNUSED(x) ((void)(x))
  ------------------
 1279|    268|    UNUSED(i4_corner_pixel_available);
  ------------------
  |  |   45|    268|#define UNUSED(x) ((void)(x))
  ------------------
 1280|       |
 1281|    268|    i4_tmp = i4_x + (i4_y * i4_refarray_stride);
 1282|    268|    pu1_dst_cb = pu1_refarray_1 + i4_tmp;
 1283|    268|    pu1_dst_cr = pu1_refarray_2 + i4_tmp;
 1284|    268|    i4_tmp = i1_xd_index + (i1_yd_index * i4_refarray_stride);
 1285|    268|    pu1_src_cb = pu1_dst_cb + i4_tmp;
 1286|    268|    pu1_src_cr = pu1_dst_cr + i4_tmp;
 1287|       |
 1288|    268|    i1_xd_index = MIN(i1_xd_index, MAX_PIX_FILL_LUMA);
  ------------------
  |  |   61|    268|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 244, False: 24]
  |  |  ------------------
  ------------------
 1289|    268|    u1_seg_wd = MIN(u1_seg_wd, MAX_PIX_FILL_LUMA);
  ------------------
  |  |   61|    268|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 217, False: 51]
  |  |  ------------------
  ------------------
 1290|    268|    i1_yd_index = MIN(i1_yd_index, MAX_PIX_FILL_LUMA);
  ------------------
  |  |   61|    268|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 230, False: 38]
  |  |  ------------------
  ------------------
 1291|    268|    u1_seg_ht = MIN(u1_seg_ht, MAX_PIX_FILL_LUMA);
  ------------------
  |  |   61|    268|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 170, False: 98]
  |  |  ------------------
  ------------------
 1292|       |
 1293|    268|    i4_tmp = (i1_xd_index + (i1_yd_index * i4_refarray_stride));
 1294|    268|    pu1_dst_cb = pu1_src_cb - i4_tmp;
 1295|    268|    pu1_dst_cr = pu1_src_cr - i4_tmp;
 1296|       |
 1297|    927|    for(i4_idx_i = 0; i4_idx_i < u1_seg_ht; i4_idx_i++)
  ------------------
  |  Branch (1297:23): [True: 659, False: 268]
  ------------------
 1298|    659|    {
 1299|    659|        memset(pu1_dst_cb, *pu1_src_cb, u1_seg_wd);
 1300|    659|        pu1_dst_cb += i4_refarray_stride;
 1301|    659|        memset(pu1_dst_cr, *pu1_src_cr, u1_seg_wd);
 1302|    659|        pu1_dst_cr += i4_refarray_stride;
 1303|    659|    }
 1304|    268|}
isvcd_fill_non_avail_pixel:
 1408|    842|{
 1409|       |    /* --------------------------------------------------------------------- */
 1410|       |    /* Index Variables                                                         */
 1411|       |    /* --------------------------------------------------------------------- */
 1412|    842|    intra_samp_map_ctxt_t *ps_map_ctxt;
 1413|    842|    ref_mb_map_t *ps_x_off_len;
 1414|    842|    ref_mb_map_t *ps_y_off_len;
 1415|    842|    WORD32 i4_x, i4_y;
 1416|    842|    WORD32 i4_corner_pixel_available;
 1417|       |
 1418|       |    /* --------------------------------------------------------------------- */
 1419|       |    /* Local Pointer Declaration for Segment lookup                             */
 1420|       |    /* --------------------------------------------------------------------- */
 1421|    842|    seg_lookup_desc_t *ps_segments_x;
 1422|    842|    seg_lookup_desc_t *ps_segments_y;
 1423|    842|    seg_description_t *ps_seg_desc_x, *ps_seg_desc_y;
 1424|    842|    seg_description_t *ps_seg_x_tmp, *ps_seg_y_tmp;
 1425|    842|    UWORD8 u1_num_sgmts_x, u1_num_sgmts_y;
 1426|       |
 1427|       |    /* --------------------------------------------------------------------- */
 1428|       |    /* Temp Variables for Mapping context                                     */
 1429|       |    /* --------------------------------------------------------------------- */
 1430|    842|    WORD32 i4_x_offset;
 1431|    842|    WORD32 i4_y_offset;
 1432|    842|    WORD32 i4_refmb_wd;
 1433|    842|    WORD32 i4_refmb_ht;
 1434|    842|    WORD32 i4_mbaddr_x;
 1435|    842|    WORD32 i4_mbaddr_y;
 1436|    842|    WORD32 i4_xr_index, i4_yr_index;
 1437|    842|    WORD32 i4_j, i4_i;
 1438|    842|    WORD32 i4_cur_x;
 1439|    842|    UWORD32 u4_lookup_4bit, u4_lookup_5bit, u4_4thbit;
 1440|    842|    WORD32 i4_pad_size;
 1441|    842|    WORD32 i4_x_min;
 1442|    842|    WORD32 i4_y_min;
 1443|    842|    WORD32 i4_x_start_pos, i4_y_start_pos;
 1444|    842|    ref_min_max_map_t *ps_x_min_max;
 1445|    842|    ref_min_max_map_t *ps_y_min_max;
 1446|    842|    UWORD8 *pu1_ref_idx_x, *pu1_ref_idx_y;
 1447|    842|    ftype_intra_samp_padding *pf_intra_samp_padding;
 1448|    842|    ftype_intra_samp_padding **pf_intra_samp_lookup;
 1449|       |
 1450|    842|    ps_map_ctxt = (intra_samp_map_ctxt_t *) pv_map_ctxt;
 1451|    842|    ps_x_min_max = ps_map_ctxt->ps_x_min_max;
 1452|    842|    ps_y_min_max = ps_map_ctxt->ps_y_min_max;
 1453|    842|    ps_x_off_len = ps_map_ctxt->ps_x_offset_length;
 1454|    842|    ps_y_off_len = ps_map_ctxt->ps_y_offset_length;
 1455|    842|    i4_mbaddr_y = ps_mb_coord->u2_mb_y;
 1456|    842|    i4_mbaddr_x = ps_mb_coord->u2_mb_x;
 1457|    842|    i4_x_offset = ps_x_off_len[i4_mbaddr_x].i2_offset;
 1458|    842|    i4_y_offset = ps_y_off_len[i4_mbaddr_y].i2_offset;
 1459|    842|    i4_refmb_wd = (MB_WIDTH >> i4_chroma_flag) - 1;
  ------------------
  |  |   67|    842|#define MB_WIDTH 16
  ------------------
 1460|    842|    i4_refmb_ht = (MB_HEIGHT >> i4_chroma_flag) - 1;
  ------------------
  |  |   68|    842|#define MB_HEIGHT 16
  ------------------
 1461|       |
 1462|    842|    if(0 == i4_chroma_flag)
  ------------------
  |  Branch (1462:8): [True: 421, False: 421]
  ------------------
 1463|    421|    {
 1464|    421|        pf_intra_samp_lookup = gpf_lookup_fxns_luma;
 1465|    421|    }
 1466|    421|    else
 1467|    421|    {
 1468|    421|        pf_intra_samp_lookup = gpf_lookup_fxns_chroma;
 1469|    421|    }
 1470|       |
 1471|       |    /* get the min and max positions */
 1472|    842|    i4_x_min = ps_x_min_max[i4_mbaddr_x].i2_min_pos;
 1473|    842|    i4_y_min = ps_y_min_max[i4_mbaddr_y].i2_min_pos;
 1474|       |
 1475|       |    /* get the start position of the MB in reference layer */
 1476|    842|    i4_pad_size = 2 >> i4_chroma_flag;
 1477|    842|    i4_x_start_pos = (i4_x_min - i4_pad_size);
 1478|    842|    i4_y_start_pos = (i4_y_min - i4_pad_size);
 1479|    842|    i4_xr_index = (i4_x_start_pos + i4_x_offset) & i4_refmb_wd;
 1480|    842|    i4_yr_index = (i4_y_start_pos + i4_y_offset) & i4_refmb_ht;
 1481|       |
 1482|       |    /* Find the number of segments in x and y direction */
 1483|    842|    ps_segments_x = (ps_map_ctxt->ps_seg_lookup_horz + i4_xr_index);
 1484|    842|    ps_segments_y = (ps_map_ctxt->ps_seg_lookup_vert + i4_yr_index);
 1485|    842|    u1_num_sgmts_x = ps_segments_x->u1_num_segments;
 1486|    842|    u1_num_sgmts_y = ps_segments_y->u1_num_segments;
 1487|    842|    ps_seg_desc_x = ps_segments_x->s_segments;
 1488|    842|    ps_seg_desc_y = ps_segments_y->s_segments;
 1489|    842|    pu1_ref_idx_x = ps_map_ctxt->pu1_refarray_x_idx;
 1490|    842|    pu1_ref_idx_y = ps_map_ctxt->pu1_refarray_y_idx;
 1491|    842|    i4_cur_x = pu1_ref_idx_x[i4_x_start_pos];
 1492|    842|    u4_4thbit = ps_segments_x->u4_start_pos;
 1493|       |
 1494|  3.03k|    for(i4_j = 0; i4_j < u1_num_sgmts_y; i4_j++)
  ------------------
  |  Branch (1494:19): [True: 2.18k, False: 842]
  ------------------
 1495|  2.18k|    {
 1496|  2.18k|        UWORD8 i4_idx_a, i4_idx_b;
 1497|  2.18k|        UWORD8 u1_seg_ht, u1_seg_wd;
 1498|  2.18k|        UWORD8 u1_mb_adjoin_x, u1_mb_adjoin_y;
 1499|  2.18k|        WORD8 i1_nearst_mb_bdry_x, i1_nearst_mb_bdry_y;
 1500|  2.18k|        UWORD32 u4_num_valid_segs;
 1501|  2.18k|        WORD32 i4_idx_a_plus_ny, i4_idx_b_plus_nx, i4_index;
 1502|  2.18k|        WORD8 i1_yd_index, i1_xd_index;
 1503|       |
 1504|  2.18k|        ps_seg_y_tmp = &ps_seg_desc_y[i4_j];
 1505|  2.18k|        i4_y = i4_y_start_pos + ps_seg_y_tmp->u1_seg_off;
 1506|  2.18k|        u1_seg_ht = ps_seg_y_tmp->u1_seg_dim;
 1507|  2.18k|        i1_yd_index = ps_seg_y_tmp->i1_dist_idx;
 1508|  2.18k|        i1_nearst_mb_bdry_y = ps_seg_y_tmp->i1_nearst_mb_bdry;
 1509|  2.18k|        u1_mb_adjoin_y = ps_seg_y_tmp->u1_mb_adjoin;
 1510|  2.18k|        i4_idx_a = pu1_ref_idx_y[i4_y];
 1511|  2.18k|        i4_idx_a_plus_ny = (i4_idx_a + i1_nearst_mb_bdry_y);
 1512|       |
 1513|       |        /* Pack the availabilities of the next three horizontal MBs in 3bit
 1514|       |           format and 4th bit indicating if the start position is greater than the mb_width/2 */
 1515|  2.18k|        u4_lookup_4bit = u4_4thbit | u1_avail_map[i4_idx_a][i4_cur_x + 2] << 2 |
 1516|  2.18k|                         u1_avail_map[i4_idx_a][i4_cur_x + 1] << 1 |
 1517|  2.18k|                         u1_avail_map[i4_idx_a][i4_cur_x];
 1518|       |
 1519|  2.18k|        u4_num_valid_segs = gu4_valid_segs_lookup[u4_lookup_4bit];
 1520|  2.18k|        i4_i = isvcd_left_most_bit_detect(u4_num_valid_segs);
 1521|  2.18k|        u4_num_valid_segs <<= (i4_i + 1);
 1522|       |
 1523|  5.34k|        for(; i4_i < u1_num_sgmts_x; i4_i++)
  ------------------
  |  Branch (1523:15): [True: 3.15k, False: 2.18k]
  ------------------
 1524|  3.15k|        {
 1525|  3.15k|            ps_seg_x_tmp = &ps_seg_desc_x[i4_i];
 1526|  3.15k|            i4_x = i4_x_start_pos + ps_seg_x_tmp->u1_seg_off;
 1527|  3.15k|            i4_idx_b = pu1_ref_idx_x[i4_x];
 1528|  3.15k|            u1_seg_wd = ps_seg_x_tmp->u1_seg_dim;
 1529|  3.15k|            i1_xd_index = ps_seg_x_tmp->i1_dist_idx;
 1530|  3.15k|            i1_nearst_mb_bdry_x = ps_seg_x_tmp->i1_nearst_mb_bdry;
 1531|  3.15k|            u1_mb_adjoin_x = ps_seg_x_tmp->u1_mb_adjoin;
 1532|  3.15k|            i4_idx_b_plus_nx = (i4_idx_b + i1_nearst_mb_bdry_x);
 1533|       |
 1534|       |            /* Find the avalability of (x,y-Yd),(x-Xd,y),(x-Xd,y-Yd) and pack it to 3 bits */
 1535|  3.15k|            u4_lookup_5bit = u1_avail_map[i4_idx_a_plus_ny][i4_idx_b_plus_nx] << 2 |
 1536|  3.15k|                             u1_avail_map[i4_idx_a_plus_ny][i4_idx_b] << 1 |
 1537|  3.15k|                             u1_avail_map[i4_idx_a][i4_idx_b_plus_nx] | u1_mb_adjoin_x |
 1538|  3.15k|                             u1_mb_adjoin_y;
 1539|       |
 1540|  3.15k|            i4_corner_pixel_available = u1_avail_map[i4_idx_a_plus_ny][i4_idx_b_plus_nx];
 1541|       |
 1542|       |            /* Function pointer table from lookup to get Left,Top,Bottom,Right,Diagonal padding */
 1543|  3.15k|            if(u4_lookup_5bit > 31)
  ------------------
  |  Branch (1543:16): [True: 0, False: 3.15k]
  ------------------
 1544|      0|            {
 1545|      0|                u4_lookup_5bit = 0;
 1546|      0|            }
 1547|  3.15k|            pf_intra_samp_padding = pf_intra_samp_lookup[u4_lookup_5bit];
 1548|       |
 1549|  3.15k|            if(pf_intra_samp_padding != NULL)
  ------------------
  |  Branch (1549:16): [True: 3.15k, False: 0]
  ------------------
 1550|  3.15k|            {
 1551|  3.15k|                pf_intra_samp_padding(i4_x, i4_y, i1_xd_index, i1_yd_index, u1_seg_wd, u1_seg_ht,
 1552|  3.15k|                                      pu1_refarray_1, pu1_refarray_2, i4_refarray_stride,
 1553|  3.15k|                                      u1_mb_adjoin_x, u1_mb_adjoin_y, i4_corner_pixel_available);
 1554|  3.15k|            }
 1555|       |
 1556|       |            /* increment to the next unavailable segment */
 1557|  3.15k|            i4_index = isvcd_left_most_bit_detect(u4_num_valid_segs);
 1558|  3.15k|            u4_num_valid_segs <<= (i4_index + 1);
 1559|  3.15k|            i4_i += i4_index;
 1560|       |
 1561|  3.15k|        } /* end of loop over ref array width */
 1562|       |
 1563|  2.18k|    }     /* end of loop over ref array height */
 1564|    842|    return;
 1565|    842|}
isvcd_get_ref_layer_mbtype:
 1597|  7.72k|{
 1598|  7.72k|    WORD8 i1_intra_slice_id;
 1599|  7.72k|    inter_lyr_mb_prms_t *ps_inter_lyr_mb_prms;
 1600|  7.72k|    WORD8 i1_mb_mode;
 1601|       |
 1602|  7.72k|    ps_inter_lyr_mb_prms = (inter_lyr_mb_prms_t *) pi1_ref_mb_modes;
 1603|  7.72k|    i1_mb_mode = ps_inter_lyr_mb_prms->i1_mb_mode;
 1604|       |
 1605|  7.72k|    if(i1_mb_mode <= SVC_INTER_MB)
  ------------------
  |  |  114|  7.72k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (1605:8): [True: 5.49k, False: 2.22k]
  ------------------
 1606|  5.49k|    {
 1607|       |        /* INTER */
 1608|  5.49k|        *pi4_mb_type = SVC_INTER_MB;
  ------------------
  |  |  114|  5.49k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
 1609|  5.49k|        i1_intra_slice_id = -1;
 1610|  5.49k|    }
 1611|  2.22k|    else
 1612|  2.22k|    {
 1613|       |        /* INTRA */
 1614|  2.22k|        *pi4_mb_type = SVC_INTRA_MB;
  ------------------
  |  |  115|  2.22k|#define SVC_INTRA_MB (1 << 1)       /*!< P or B MBs decoded or inferred*/
  ------------------
 1615|  2.22k|        i1_intra_slice_id = ps_inter_lyr_mb_prms->i1_slice_id;
 1616|       |
 1617|  2.22k|        if(1 == i1_cons_intr_samp_flag)
  ------------------
  |  Branch (1617:12): [True: 0, False: 2.22k]
  ------------------
 1618|      0|        {
 1619|       |            /* check for different slice idc */
 1620|      0|            if(ps_inter_lyr_mb_prms->i1_slice_id != i1_curr_slice_id)
  ------------------
  |  Branch (1620:16): [True: 0, False: 0]
  ------------------
 1621|      0|            {
 1622|       |                /* store the mode as INTER (not available for upsampling) */
 1623|      0|                *pi4_mb_type = SVC_INTER_MB;
  ------------------
  |  |  114|      0|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
 1624|      0|            }
 1625|      0|        }
 1626|  2.22k|    }
 1627|       |
 1628|       |    /* if contarained intra flag is 1 then check for same mb mode */
 1629|  7.72k|    return (i1_intra_slice_id);
 1630|  7.72k|}
isvcd_reflayer_construction:
 1666|    842|{
 1667|    842|    WORD32 i4_x, i4_y;
 1668|       |
 1669|       |    /* --------------------------------------------------------------------- */
 1670|       |    /* Context and reference layer realted varaibles                         */
 1671|       |    /* --------------------------------------------------------------------- */
 1672|    842|    intra_sampling_ctxt_t *ps_ctxt;
 1673|    842|    intra_samp_map_ctxt_t *ps_map_ctxt;
 1674|    842|    intra_samp_lyr_ctxt *ps_lyr_ctxt;
 1675|    842|    WORD8 *pi1_ref_mb_modes, *pi1_ref_mb_modes_bkp_1;
 1676|    842|    WORD32 i4_ref_mode_stride;
 1677|    842|    WORD32 i4_element_size;
 1678|    842|    ref_mb_map_t *ps_x_off_len;
 1679|    842|    ref_mb_map_t *ps_y_off_len;
 1680|    842|    WORD32 i4_mbaddr_y;
 1681|    842|    WORD32 i4_mbaddr_x;
 1682|    842|    WORD32 i4_mb_ht, i4_mb_wd;
 1683|    842|    UWORD8 u1_map_buf[4][4] = {0}; /*!< 4x4 mb grid buffer to store the mb availablity */
 1684|       |    /* --------------------------------------------------------------------- */
 1685|       |    /* Temp Variables for Mapping context                                     */
 1686|       |    /* --------------------------------------------------------------------- */
 1687|    842|    WORD32 i4_ref_wd;
 1688|    842|    WORD32 i4_ref_ht;
 1689|    842|    WORD32 i4_x_offset;
 1690|    842|    WORD32 i4_y_offset;
 1691|    842|    WORD32 i4_refarray_wd;
 1692|    842|    WORD32 i4_refarray_ht;
 1693|    842|    WORD32 i4_mb_type;
 1694|    842|    WORD8 i1_cons_intr_samp_flag;
 1695|    842|    WORD8 i1_slice_id = 0;
 1696|    842|    WORD32 i4_mb_wd_sft, i4_mb_ht_sft;
 1697|       |
 1698|       |    /* --------------------------------------------------------------------- */
 1699|       |    /* Local Pointer Declaration for arrays in Mapping context                 */
 1700|       |    /* --------------------------------------------------------------------- */
 1701|       |
 1702|    842|    WORD32 i4_unfill_check;
 1703|    842|    UWORD8 *pu1_refarray_1, *pu1_refarray_2;
 1704|       |
 1705|    842|    UNUSED(pu1_inp_2);
  ------------------
  |  |   45|    842|#define UNUSED(x) ((void)(x))
  ------------------
 1706|       |
 1707|    842|    ps_ctxt = (intra_sampling_ctxt_t *) pv_intra_samp_ctxt;
 1708|    842|    ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_ctxt->i4_res_lyr_id];
 1709|    842|    pi1_ref_mb_modes = (WORD8 *) ps_ref_mb_mode_map->pv_buffer;
 1710|    842|    i4_ref_mode_stride = ps_ref_mb_mode_map->i4_num_element_stride;
 1711|    842|    i4_element_size = ps_ref_mb_mode_map->i4_element_size;
 1712|       |
 1713|       |    /* get the condtrained intra sampling flag */
 1714|    842|    i1_cons_intr_samp_flag = ps_lyr_ctxt->i1_constrained_intra_rsmpl_flag;
 1715|       |
 1716|    842|    if(NULL == pi1_ref_mb_modes)
  ------------------
  |  Branch (1716:8): [True: 0, False: 842]
  ------------------
 1717|      0|    {
 1718|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1719|      0|    }
 1720|       |
 1721|       |    /* --------------------------------------------------------------------- */
 1722|       |    /* Based on Chroma and Luma, extracting the context information struct     */
 1723|       |    /* --------------------------------------------------------------------- */
 1724|    842|    if(1 == i4_chroma_flag)
  ------------------
  |  Branch (1724:8): [True: 421, False: 421]
  ------------------
 1725|    421|        ps_map_ctxt = &ps_lyr_ctxt->s_chroma_map_ctxt;
 1726|    421|    else
 1727|    421|        ps_map_ctxt = &ps_lyr_ctxt->s_luma_map_ctxt;
 1728|       |
 1729|    842|    ps_x_off_len = ps_map_ctxt->ps_x_offset_length;
 1730|    842|    ps_y_off_len = ps_map_ctxt->ps_y_offset_length;
 1731|       |
 1732|       |    /* --------------------------------------------------------------------- */
 1733|       |    /* Deriving the parameters required for further processing                 */
 1734|       |    /* --------------------------------------------------------------------- */
 1735|    842|    {
 1736|    842|        WORD32 i4_base_width = ps_lyr_ctxt->i4_ref_width;
 1737|    842|        WORD32 i4_base_height = ps_lyr_ctxt->i4_ref_height;
 1738|       |
 1739|    842|        i4_ref_wd = i4_base_width >> i4_chroma_flag;
 1740|    842|        i4_ref_ht = i4_base_height >> i4_chroma_flag;
 1741|    842|        i4_mb_wd_sft = (MB_WIDTH_SHIFT - i4_chroma_flag);
  ------------------
  |  |   70|    842|#define MB_WIDTH_SHIFT 4
  ------------------
 1742|    842|        i4_mb_ht_sft = (MB_HEIGHT_SHIFT - i4_chroma_flag);
  ------------------
  |  |   71|    842|#define MB_HEIGHT_SHIFT 4
  ------------------
 1743|    842|    }
 1744|       |
 1745|       |    /* --------------------------------------------------------------------- */
 1746|       |    /* Local variables based on the MB address                                 */
 1747|       |    /* --------------------------------------------------------------------- */
 1748|    842|    i4_mbaddr_y = ps_coord->u2_mb_y;
 1749|    842|    i4_mbaddr_x = ps_coord->u2_mb_x;
 1750|    842|    i4_x_offset = ps_x_off_len[i4_mbaddr_x].i2_offset;
 1751|    842|    i4_y_offset = ps_y_off_len[i4_mbaddr_y].i2_offset;
 1752|    842|    i4_refarray_wd = ps_x_off_len[i4_mbaddr_x].i2_length;
 1753|    842|    i4_refarray_ht = ps_y_off_len[i4_mbaddr_y].i2_length;
 1754|    842|    i4_mb_wd = (MB_WIDTH >> i4_chroma_flag);
  ------------------
  |  |   67|    842|#define MB_WIDTH 16
  ------------------
 1755|    842|    i4_mb_ht = (MB_HEIGHT >> i4_chroma_flag);
  ------------------
  |  |   68|    842|#define MB_HEIGHT 16
  ------------------
 1756|       |
 1757|       |    /* --------------------------------------------------------------------- */
 1758|       |    /* Derivation of ref slice MB idc                                         */
 1759|       |    /* --------------------------------------------------------------------- */
 1760|    842|    if(1 == i1_cons_intr_samp_flag)
  ------------------
  |  Branch (1760:8): [True: 0, False: 842]
  ------------------
 1761|      0|    {
 1762|      0|        WORD32 i4_x_min, i4_x_max;
 1763|      0|        WORD32 i4_y_min, i4_y_max;
 1764|      0|        ref_min_max_map_t *ps_x_min_max;
 1765|      0|        ref_min_max_map_t *ps_y_min_max;
 1766|       |
 1767|      0|        ps_x_min_max = ps_map_ctxt->ps_x_min_max;
 1768|      0|        ps_y_min_max = ps_map_ctxt->ps_y_min_max;
 1769|       |
 1770|       |        /* get the min and max positions */
 1771|      0|        i4_x_min = ps_x_min_max[i4_mbaddr_x].i2_min_pos;
 1772|      0|        i4_x_max = ps_x_min_max[i4_mbaddr_x].i2_max_pos;
 1773|      0|        i4_y_min = ps_y_min_max[i4_mbaddr_y].i2_min_pos;
 1774|      0|        i4_y_max = ps_y_min_max[i4_mbaddr_y].i2_max_pos;
 1775|       |
 1776|       |        /* default initialization */
 1777|      0|        i4_mb_type = SVC_INTER_MB;
  ------------------
  |  |  114|      0|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
 1778|       |
 1779|      0|        {
 1780|      0|            WORD32 i4_x_ref;
 1781|      0|            WORD32 i4_y_ref;
 1782|      0|            WORD32 i4_mb_x, i4_mb_y;
 1783|       |
 1784|      0|            i4_y_ref = (i4_y_min + 1) + i4_y_offset;
 1785|      0|            i4_x_ref = (i4_x_min + 1) + i4_x_offset;
 1786|      0|            i4_mb_x = (i4_x_ref >> i4_mb_wd_sft);
 1787|      0|            i4_mb_y = (i4_y_ref >> i4_mb_ht_sft);
 1788|      0|            pi1_ref_mb_modes = (WORD8 *) ps_ref_mb_mode_map->pv_buffer;
 1789|       |
 1790|       |            /* get the location of the byte which has the current mb mode */
 1791|      0|            pi1_ref_mb_modes += (i4_mb_y * i4_ref_mode_stride * i4_element_size);
 1792|      0|            pi1_ref_mb_modes += (i4_mb_x * i4_element_size);
 1793|      0|        }
 1794|       |
 1795|      0|        for(i4_y = (i4_y_min + 1); i4_y <= (i4_y_max - 1);)
  ------------------
  |  Branch (1795:36): [True: 0, False: 0]
  ------------------
 1796|      0|        {
 1797|      0|            WORD32 i4_x_ref;
 1798|      0|            WORD32 i4_y_ref;
 1799|      0|            WORD32 i4_distleftX, i4_rangeX;
 1800|      0|            WORD32 i4_disttopY, i4_rangeY;
 1801|       |
 1802|      0|            i4_y_ref = (i4_y + i4_y_offset);
 1803|      0|            i4_disttopY = (i4_y_ref) & (i4_mb_ht - 1);
 1804|      0|            i4_rangeY = (i4_mb_ht - i4_disttopY);
 1805|       |
 1806|      0|            pi1_ref_mb_modes_bkp_1 = pi1_ref_mb_modes;
 1807|       |
 1808|      0|            for(i4_x = (i4_x_min + 1); i4_x <= (i4_x_max - 1);)
  ------------------
  |  Branch (1808:40): [True: 0, False: 0]
  ------------------
 1809|      0|            {
 1810|      0|                i4_x_ref = (i4_x + i4_x_offset);
 1811|      0|                i4_distleftX = (i4_x_ref) & (i4_mb_wd - 1);
 1812|      0|                i4_rangeX = (i4_mb_wd - i4_distleftX);
 1813|       |
 1814|       |                /* get the referecne layer mb type */
 1815|      0|                i1_slice_id =
 1816|      0|                    isvcd_get_ref_layer_mbtype(pi1_ref_mb_modes_bkp_1, &i4_mb_type, i1_slice_id, 0);
 1817|      0|                if(SVC_INTRA_MB == i4_mb_type)
  ------------------
  |  |  115|      0|#define SVC_INTRA_MB (1 << 1)       /*!< P or B MBs decoded or inferred*/
  ------------------
  |  Branch (1817:20): [True: 0, False: 0]
  ------------------
 1818|      0|                {
 1819|       |                    /* if an Intra MB is returned then break the loop */
 1820|      0|                    break;
 1821|      0|                }
 1822|       |
 1823|      0|                i4_x += i4_rangeX;
 1824|      0|                pi1_ref_mb_modes_bkp_1 += i4_element_size;
 1825|      0|            } /* end of loop in horizontal direction */
 1826|       |
 1827|      0|            if(SVC_INTRA_MB == i4_mb_type)
  ------------------
  |  |  115|      0|#define SVC_INTRA_MB (1 << 1)       /*!< P or B MBs decoded or inferred*/
  ------------------
  |  Branch (1827:16): [True: 0, False: 0]
  ------------------
 1828|      0|            {
 1829|       |                /* if an Intra MB is returned then break the loop */
 1830|      0|                break;
 1831|      0|            }
 1832|       |
 1833|      0|            i4_y += i4_rangeY;
 1834|      0|            pi1_ref_mb_modes += (i4_ref_mode_stride * i4_element_size);
 1835|       |
 1836|      0|        } /* end of loop in vertical direction */
 1837|      0|    }
 1838|    842|    else
 1839|    842|    {
 1840|       |        /* set to non valid value */
 1841|    842|        i1_slice_id = -1;
 1842|    842|    }
 1843|       |
 1844|    842|    i4_unfill_check = 0;
 1845|       |
 1846|       |    /* --------------------------------------------------------------------- */
 1847|       |    /* Copying the data from recon buffer to refSample Array.                */
 1848|       |    /* NOTE: The copying of the data from recon buffer to refSample Array    */
 1849|       |    /*       can be optimized by bring in data at N-MB level,thus taking     */
 1850|       |    /*       advantage of the overlapping data which now gets copied every MB*/
 1851|       |    /* --------------------------------------------------------------------- */
 1852|    842|    {
 1853|    842|        WORD32 i4_x_ref_start, i4_x_ref_end;
 1854|    842|        WORD32 i4_y_ref_start, i4_y_ref_end;
 1855|    842|        WORD32 i4_rangeW, i4_rangeH;
 1856|    842|        WORD32 i4_offset;
 1857|    842|        UWORD8 *pu1_src, *pu1_dst;
 1858|    842|        UWORD8 *pu1_dst1, *pu1_dst2;
 1859|       |
 1860|       |        /* Copy (refW x refH) dimension into reference sample array */
 1861|    842|        i4_x_ref_start = MAX(0, MIN((i4_ref_wd - 1), i4_x_offset));
  ------------------
  |  |   60|  1.68k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 476, False: 366]
  |  |  |  Branch (60:24): [True: 0, False: 842]
  |  |  |  Branch (60:32): [True: 0, False: 366]
  |  |  ------------------
  ------------------
 1862|    842|        i4_x_ref_end = MAX(0, MIN((i4_ref_wd - 1), (i4_refarray_wd - 1) + i4_x_offset));
  ------------------
  |  |   60|  1.68k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 842]
  |  |  |  Branch (60:24): [True: 366, False: 476]
  |  |  |  Branch (60:32): [True: 366, False: 476]
  |  |  ------------------
  ------------------
 1863|    842|        i4_y_ref_start = MAX(0, MIN((i4_ref_ht - 1), i4_y_offset));
  ------------------
  |  |   60|  1.68k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 149, False: 693]
  |  |  |  Branch (60:24): [True: 0, False: 842]
  |  |  |  Branch (60:32): [True: 0, False: 693]
  |  |  ------------------
  ------------------
 1864|    842|        i4_y_ref_end = MAX(0, MIN((i4_ref_ht - 1), (i4_refarray_ht - 1) + i4_y_offset));
  ------------------
  |  |   60|  1.68k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 842]
  |  |  |  Branch (60:24): [True: 138, False: 704]
  |  |  |  Branch (60:32): [True: 138, False: 704]
  |  |  ------------------
  ------------------
 1865|       |
 1866|       |        /* find the actual data to be copied */
 1867|    842|        i4_rangeW = (i4_x_ref_end - i4_x_ref_start + 1);
 1868|    842|        i4_rangeH = (i4_y_ref_end - i4_y_ref_start + 1);
 1869|       |
 1870|       |        /* get the reconbuffer pointer and ref sample array pointer */
 1871|    842|        i4_offset =
 1872|    842|            (i4_x_ref_start - i4_x_offset) + ((i4_y_ref_start - i4_y_offset) * i4_refarray_stride);
 1873|       |
 1874|    842|        if(0 == i4_chroma_flag)
  ------------------
  |  Branch (1874:12): [True: 421, False: 421]
  ------------------
 1875|    421|        {
 1876|    421|            pu1_refarray_1 = ps_ctxt->pu1_refarray_buffer;
 1877|    421|            pu1_refarray_2 = NULL;
 1878|    421|            pu1_src = pu1_inp_1;
 1879|    421|            pu1_dst = pu1_refarray_1 + i4_offset;
 1880|       |
 1881|       |            /* Copy luma data into refsample array */
 1882|    421|            isvcd_copy_data(pu1_src, i4_inp_stride, pu1_dst, i4_refarray_stride, i4_rangeW,
 1883|    421|                            i4_rangeH);
 1884|    421|        }
 1885|    421|        else
 1886|    421|        {
 1887|    421|            pu1_refarray_1 = ps_ctxt->pu1_refarray_buffer;
 1888|    421|            pu1_refarray_2 = ps_ctxt->pu1_refarray_cb;
 1889|    421|            pu1_src = pu1_inp_1;
 1890|    421|            pu1_dst1 = pu1_refarray_1 + i4_offset;
 1891|    421|            pu1_dst2 = pu1_refarray_2 + i4_offset;
 1892|    421|            isvcd_copy_data_semiplanr(pu1_src, i4_inp_stride, pu1_dst1, pu1_dst2,
 1893|    421|                                      i4_refarray_stride, i4_rangeW, i4_rangeH);
 1894|    421|        }
 1895|    842|    }
 1896|       |
 1897|       |    /* --------------------------------------------------------------------- */
 1898|       |    /* Loop to fill ref sample array and corresponding map for interpolation */
 1899|       |    /* --------------------------------------------------------------------- */
 1900|    842|    {
 1901|    842|        WORD32 i4_i, i4_j;
 1902|    842|        UWORD8 *pu1_ref_idx_x, *pu1_ref_idx_y;
 1903|    842|        WORD32 i4_x_ref;
 1904|    842|        WORD32 i4_y_ref;
 1905|    842|        WORD32 i4_mb_x, i4_mb_y;
 1906|       |
 1907|    842|        i4_y_ref = i4_y_offset;
 1908|    842|        i4_x_ref = i4_x_offset;
 1909|    842|        i4_mb_x = (i4_x_ref >> i4_mb_wd_sft);
 1910|    842|        i4_mb_y = (i4_y_ref >> i4_mb_ht_sft);
 1911|    842|        pi1_ref_mb_modes = (WORD8 *) ps_ref_mb_mode_map->pv_buffer;
 1912|       |
 1913|       |        /* get the location of the byte which has the current mb mode */
 1914|    842|        pi1_ref_mb_modes += (i4_mb_y * i4_ref_mode_stride * i4_element_size);
 1915|    842|        pi1_ref_mb_modes += (i4_mb_x * i4_element_size);
 1916|    842|        pu1_ref_idx_x = ps_map_ctxt->pu1_refarray_x_idx;
 1917|    842|        pu1_ref_idx_y = ps_map_ctxt->pu1_refarray_y_idx;
 1918|       |
 1919|    842|        i4_j = 0;
 1920|  3.36k|        for(i4_y = 0; i4_y < i4_refarray_ht;)
  ------------------
  |  Branch (1920:23): [True: 2.52k, False: 842]
  ------------------
 1921|  2.52k|        {
 1922|  2.52k|            WORD32 i4_x_ref;
 1923|  2.52k|            WORD32 i4_y_ref;
 1924|  2.52k|            WORD32 i4_distleftX, i4_rangeX;
 1925|  2.52k|            WORD32 i4_disttopY, i4_rangeY;
 1926|       |
 1927|  2.52k|            i4_y_ref = i4_y + i4_y_offset;
 1928|  2.52k|            i4_disttopY = (i4_y_ref) & (i4_mb_ht - 1);
 1929|  2.52k|            i4_rangeY = (i4_mb_ht - i4_disttopY);
 1930|       |
 1931|       |            /* find the y-index lookup */
 1932|  2.52k|            memset(pu1_ref_idx_y, i4_j, i4_rangeY);
 1933|  2.52k|            pu1_ref_idx_y += i4_rangeY;
 1934|       |
 1935|  2.52k|            i4_i = 0;
 1936|  2.52k|            pi1_ref_mb_modes_bkp_1 = pi1_ref_mb_modes;
 1937|  10.2k|            for(i4_x = 0; i4_x < i4_refarray_wd;)
  ------------------
  |  Branch (1937:27): [True: 7.72k, False: 2.52k]
  ------------------
 1938|  7.72k|            {
 1939|  7.72k|                i4_x_ref = i4_x + i4_x_offset;
 1940|  7.72k|                i4_distleftX = (i4_x_ref) & (i4_mb_wd - 1);
 1941|  7.72k|                i4_rangeX = (i4_mb_wd - i4_distleftX);
 1942|       |
 1943|  7.72k|                if(0 == i4_j)
  ------------------
  |  Branch (1943:20): [True: 2.52k, False: 5.19k]
  ------------------
 1944|  2.52k|                {
 1945|       |                    /* find the x-index lookup */
 1946|  2.52k|                    memset(pu1_ref_idx_x, i4_i, i4_rangeX);
 1947|  2.52k|                    pu1_ref_idx_x += i4_rangeX;
 1948|  2.52k|                }
 1949|       |
 1950|       |                /* get the referecne layer mb type */
 1951|  7.72k|                isvcd_get_ref_layer_mbtype(pi1_ref_mb_modes_bkp_1, &i4_mb_type, i1_slice_id,
 1952|  7.72k|                                           i1_cons_intr_samp_flag);
 1953|       |
 1954|  7.72k|                if(SVC_INTRA_MB == i4_mb_type)
  ------------------
  |  |  115|  7.72k|#define SVC_INTRA_MB (1 << 1)       /*!< P or B MBs decoded or inferred*/
  ------------------
  |  Branch (1954:20): [True: 2.22k, False: 5.49k]
  ------------------
 1955|  2.22k|                {
 1956|  2.22k|                    u1_map_buf[i4_j][i4_i] = 1;
 1957|  2.22k|                }
 1958|  5.49k|                else
 1959|  5.49k|                {
 1960|  5.49k|                    i4_unfill_check = 1;
 1961|  5.49k|                }
 1962|       |
 1963|  7.72k|                i4_x = i4_x + i4_rangeX;
 1964|  7.72k|                i4_i++;
 1965|  7.72k|                pi1_ref_mb_modes_bkp_1 += i4_element_size;
 1966|       |
 1967|  7.72k|            } /* end of loop over ref array width */
 1968|       |
 1969|  2.52k|            i4_j++;
 1970|  2.52k|            i4_y = i4_y + i4_rangeY;
 1971|  2.52k|            pi1_ref_mb_modes += (i4_ref_mode_stride * i4_element_size);
 1972|  2.52k|        } /* end of loop over ref array height */
 1973|    842|    }
 1974|       |
 1975|       |    /* --------------------------------------------------------------------- */
 1976|       |    /* Calling boundary extension algorithm to fill unfilled pixels             */
 1977|       |    /* --------------------------------------------------------------------- */
 1978|    842|    if(i4_unfill_check == 1)
  ------------------
  |  Branch (1978:8): [True: 842, False: 0]
  ------------------
 1979|    842|    {
 1980|    842|        isvcd_fill_non_avail_pixel(ps_map_ctxt, pu1_refarray_1, pu1_refarray_2, i4_refarray_stride,
 1981|    842|                                   ps_coord, i4_chroma_flag, u1_map_buf);
 1982|    842|    }
 1983|    842|    return OK;
  ------------------
  |  |  114|    842|#define OK        0
  ------------------
 1984|    842|}
isvcd_interpolate_intra_base:
 3680|  1.26k|{
 3681|       |    /* --------------------------------------------------------------------- */
 3682|       |    /* Index Parameters                                                         */
 3683|       |    /* --------------------------------------------------------------------- */
 3684|  1.26k|    intra_sampling_ctxt_t *ps_ctxt;
 3685|  1.26k|    intra_samp_map_ctxt_t *ps_map_ctxt;
 3686|  1.26k|    intra_samp_lyr_ctxt *ps_lyr_ctxt;
 3687|  1.26k|    WORD32 i4_x, i4_y;
 3688|  1.26k|    WORD32 i4_frm_mb_x, i4_frm_mb_y;
 3689|  1.26k|    ref_pixel_map_t *ps_x_pos_phase;
 3690|  1.26k|    ref_pixel_map_t *ps_y_pos_phase;
 3691|       |
 3692|  1.26k|    WORD32 i4_temp_array_ht;
 3693|  1.26k|    WORD32 *pi4_interp_buff;
 3694|  1.26k|    WORD32 *pi4_interp_buff_temp;
 3695|  1.26k|    WORD32 i4_mb_wd;
 3696|  1.26k|    WORD32 i4_mb_ht;
 3697|  1.26k|    WORD32 i4_x_min, i4_x_max;
 3698|  1.26k|    ref_min_max_map_t *ps_x_min_max;
 3699|  1.26k|    UWORD8 *pu1_refarray = NULL;
 3700|       |
 3701|       |    /* --------------------------------------------------------------------- */
 3702|       |    /* Extracting pointers from the  context                                  */
 3703|       |    /* --------------------------------------------------------------------- */
 3704|  1.26k|    ps_ctxt = (intra_sampling_ctxt_t *) pv_intra_samp_ctxt;
 3705|  1.26k|    ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_ctxt->i4_res_lyr_id];
 3706|       |
 3707|  1.26k|    if(0 == i4_refarray_flag)
  ------------------
  |  Branch (3707:8): [True: 842, False: 421]
  ------------------
 3708|    842|    {
 3709|    842|        pu1_refarray = ps_ctxt->pu1_refarray_buffer;
 3710|    842|    }
 3711|    421|    else if(1 == i4_refarray_flag)
  ------------------
  |  Branch (3711:13): [True: 421, False: 0]
  ------------------
 3712|    421|    {
 3713|    421|        pu1_refarray = ps_ctxt->pu1_refarray_cb;
 3714|    421|    }
 3715|       |
 3716|       |    /* --------------------------------------------------------------------- */
 3717|       |    /* LUMA    or CHROMA */
 3718|       |    /* --------------------------------------------------------------------- */
 3719|  1.26k|    if(1 == i4_chroma_flag)
  ------------------
  |  Branch (3719:8): [True: 842, False: 421]
  ------------------
 3720|    842|        ps_map_ctxt = &(ps_lyr_ctxt->s_chroma_map_ctxt);
 3721|    421|    else
 3722|    421|        ps_map_ctxt = &(ps_lyr_ctxt->s_luma_map_ctxt);
 3723|       |
 3724|  1.26k|    i4_mb_wd = MB_WIDTH >> i4_chroma_flag;
  ------------------
  |  |   67|  1.26k|#define MB_WIDTH 16
  ------------------
 3725|  1.26k|    i4_mb_ht = MB_HEIGHT >> i4_chroma_flag;
  ------------------
  |  |   68|  1.26k|#define MB_HEIGHT 16
  ------------------
 3726|  1.26k|    ps_x_min_max = ps_map_ctxt->ps_x_min_max;
 3727|  1.26k|    i4_frm_mb_y = i4_mb_y * i4_mb_ht;
 3728|  1.26k|    i4_frm_mb_x = i4_mb_x * i4_mb_wd;
 3729|       |
 3730|       |    /* get the min and max positions */
 3731|  1.26k|    i4_x_min = ps_x_min_max[i4_mb_x].i2_min_pos;
 3732|  1.26k|    i4_x_max = ps_x_min_max[i4_mb_x].i2_max_pos;
 3733|       |
 3734|       |    /* --------------------------------------------------------------------- */
 3735|       |    /* Projected frame level pointers                                        */
 3736|       |    /* --------------------------------------------------------------------- */
 3737|  1.26k|    ps_x_pos_phase = ps_map_ctxt->ps_x_pos_phase;
 3738|  1.26k|    ps_y_pos_phase = ps_map_ctxt->ps_y_pos_phase;
 3739|       |
 3740|       |    /* --------------------------------------------------------------------- */
 3741|       |    /* Pointers and Dimenstion of the temporary buffer                         */
 3742|       |    /* --------------------------------------------------------------------- */
 3743|  1.26k|    i4_temp_array_ht = i4_mb_ht;
 3744|  1.26k|    pi4_interp_buff = ps_ctxt->pi4_temp_interpolation_buffer;
 3745|  1.26k|    pi4_interp_buff_temp = pi4_interp_buff;
 3746|       |
 3747|       |    /* --------------------------------------------------------------------- */
 3748|       |    /* Loop for interpolation in vertical direction                             */
 3749|       |    /* --------------------------------------------------------------------- */
 3750|  14.7k|    for(i4_y = 0; i4_y < (i4_temp_array_ht); i4_y++)
  ------------------
  |  Branch (3750:19): [True: 13.4k, False: 1.26k]
  ------------------
 3751|  13.4k|    {
 3752|   178k|        for(i4_x = (i4_x_min - 1); i4_x <= (i4_x_max + 2); i4_x++)
  ------------------
  |  Branch (3752:36): [True: 165k, False: 13.4k]
  ------------------
 3753|   165k|        {
 3754|   165k|            UWORD8 *pu1_refarray_temp;
 3755|   165k|            WORD32 i4_y_ref;
 3756|   165k|            WORD32 i4_y_phase;
 3757|       |            /* ------------------------------------------------------------ */
 3758|       |            /* Finding the offset                                            */
 3759|       |            /* ------------------------------------------------------------ */
 3760|   165k|            i4_y_ref = ps_y_pos_phase[i4_y + i4_frm_mb_y].i2_ref_pos;
 3761|   165k|            i4_y_phase = ps_y_pos_phase[i4_y + i4_frm_mb_y].i2_phase;
 3762|   165k|            pu1_refarray_temp = pu1_refarray + i4_x + (i4_y_ref * i4_refarray_wd);
 3763|       |
 3764|       |            /* ------------------------------------------------------------ */
 3765|       |            /* Check for Luma/Chroma Processing                                */
 3766|       |            /* ------------------------------------------------------------ */
 3767|   165k|            if(0 == i4_chroma_flag)
  ------------------
  |  Branch (3767:16): [True: 101k, False: 64.1k]
  ------------------
 3768|   101k|            {
 3769|   101k|                *(pi4_interp_buff + i4_x) =
 3770|   101k|                    (g_ai1_interp_filter_luma[i4_y_phase]) *
 3771|   101k|                        (*(pu1_refarray_temp - i4_refarray_wd)) +
 3772|       |
 3773|   101k|                    (g_ai1_interp_filter_luma[16 + i4_y_phase]) * (*(pu1_refarray_temp)) +
 3774|       |
 3775|   101k|                    (g_ai1_interp_filter_luma[32 + i4_y_phase]) *
 3776|   101k|                        (*(pu1_refarray_temp + i4_refarray_wd)) +
 3777|       |
 3778|   101k|                    (g_ai1_interp_filter_luma[48 + i4_y_phase]) *
 3779|   101k|                        (*(pu1_refarray_temp + (2 * i4_refarray_wd)));
 3780|   101k|            }
 3781|  64.1k|            else
 3782|  64.1k|            {
 3783|  64.1k|                *(pi4_interp_buff + i4_x) =
 3784|  64.1k|                    (g_au1_interp_filter_chroma[i4_y_phase]) * (*(pu1_refarray_temp)) +
 3785|       |
 3786|  64.1k|                    (g_au1_interp_filter_chroma[16 + i4_y_phase]) *
 3787|  64.1k|                        (*(pu1_refarray_temp + i4_refarray_wd));
 3788|  64.1k|            }
 3789|       |
 3790|   165k|        } /* end of loop over array  width */
 3791|  13.4k|        pi4_interp_buff = pi4_interp_buff + i4_refarray_wd;
 3792|  13.4k|    }     /* end of loop over temp array height*/
 3793|       |
 3794|  1.26k|    pi4_interp_buff = pi4_interp_buff_temp;
 3795|       |
 3796|       |    /* --------------------------------------------------------------------- */
 3797|       |    /* Loop for interpolation in horizontal direction                         */
 3798|       |    /* --------------------------------------------------------------------- */
 3799|  14.7k|    for(i4_y = 0; i4_y < i4_temp_array_ht; i4_y++)
  ------------------
  |  Branch (3799:19): [True: 13.4k, False: 1.26k]
  ------------------
 3800|  13.4k|    {
 3801|   175k|        for(i4_x = 0; i4_x < i4_mb_wd; i4_x++)
  ------------------
  |  Branch (3801:23): [True: 161k, False: 13.4k]
  ------------------
 3802|   161k|        {
 3803|   161k|            WORD32 i4_x_ref;
 3804|   161k|            WORD32 i4_x_phase;
 3805|       |            /* ------------------------------------------------------------- */
 3806|       |            /* Finding the offset                                             */
 3807|       |            /* ------------------------------------------------------------- */
 3808|   161k|            i4_x_ref = ps_x_pos_phase[i4_x + i4_frm_mb_x].i2_ref_pos;
 3809|   161k|            i4_x_phase = ps_x_pos_phase[i4_x + i4_frm_mb_x].i2_phase;
 3810|   161k|            pi4_interp_buff_temp = pi4_interp_buff + i4_x_ref;
 3811|       |
 3812|       |            /* ------------------------------------------------------------- */
 3813|       |            /* Check for Luma/Chroma Processing                                 */
 3814|       |            /* ------------------------------------------------------------- */
 3815|   161k|            if(0 == i4_chroma_flag)
  ------------------
  |  Branch (3815:16): [True: 107k, False: 53.8k]
  ------------------
 3816|   107k|            {
 3817|   107k|                *(pu1_out + i4_x + (i4_y * i4_out_stride)) =
 3818|       |
 3819|   107k|                    CLIPUCHAR(
  ------------------
  |  |   69|   107k|#define CLIPUCHAR(x) CLIP3(0, 255, (x))
  |  |  ------------------
  |  |  |  |   77|   107k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 157, False: 107k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 107k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3820|   107k|                        ((g_ai1_interp_filter_luma[i4_x_phase]) * (*(pi4_interp_buff_temp - 1)) +
 3821|   107k|                         (g_ai1_interp_filter_luma[16 + i4_x_phase]) * (*(pi4_interp_buff_temp)) +
 3822|   107k|                         (g_ai1_interp_filter_luma[32 + i4_x_phase]) *
 3823|   107k|                             (*(pi4_interp_buff_temp + 1)) +
 3824|   107k|                         (g_ai1_interp_filter_luma[48 + i4_x_phase]) *
 3825|   107k|                             (*(pi4_interp_buff_temp + 2)) +
 3826|   107k|                         512) >>
 3827|   107k|                        10);
 3828|   107k|            }
 3829|  53.8k|            else
 3830|  53.8k|            {
 3831|  53.8k|                *(pu1_out + (2 * i4_x) + (i4_y * i4_out_stride)) = CLIPUCHAR(
  ------------------
  |  |   69|  53.8k|#define CLIPUCHAR(x) CLIP3(0, 255, (x))
  |  |  ------------------
  |  |  |  |   77|  53.8k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 53.8k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 53.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3832|  53.8k|                    ((g_au1_interp_filter_chroma[i4_x_phase]) * (*(pi4_interp_buff_temp)) +
 3833|  53.8k|                     (g_au1_interp_filter_chroma[16 + i4_x_phase]) * (*(pi4_interp_buff_temp + 1)) +
 3834|  53.8k|                     512) >>
 3835|  53.8k|                    10);
 3836|  53.8k|            }
 3837|       |
 3838|   161k|        } /* end of loop over array width */
 3839|  13.4k|        pi4_interp_buff = pi4_interp_buff + i4_refarray_wd;
 3840|  13.4k|    }     /* end of loop over MB height */
 3841|       |
 3842|  1.26k|    return;
 3843|  1.26k|} /* End of Interpolation Function */
isvcd_intra_resamp_mb:
 3876|    421|{
 3877|       |    /* --------------------------------------------------------------------- */
 3878|       |    /* I/O buffer params                                                     */
 3879|       |    /* --------------------------------------------------------------------- */
 3880|    421|    intra_sampling_ctxt_t *ps_ctxt;
 3881|    421|    UWORD8 *pu1_inp_luma, *pu1_inp_cb, *pu1_inp_cr;
 3882|    421|    UWORD8 *pu1_out_luma, *pu1_out_cb, *pu1_out_cr;
 3883|    421|    WORD32 i4_inp_stride;
 3884|    421|    WORD32 i4_out_stride;
 3885|    421|    WORD32 i4_refarray_stride;
 3886|       |
 3887|       |    /* --------------------------------------------------------------------- */
 3888|       |    /* ref sample array and corresponding parametrs                             */
 3889|       |    /* --------------------------------------------------------------------- */
 3890|    421|    WORD32 i4_chroma_flag, ret;
 3891|       |
 3892|    421|    ps_ctxt = (intra_sampling_ctxt_t *) pv_intra_samp_ctxt;
 3893|       |    /* needs to be populated at proper place */
 3894|    421|    i4_refarray_stride = ps_ctxt->i4_refarray_stride;
 3895|       |
 3896|       |    /* --------------------------------------------------------------------- */
 3897|       |    /* LUMA PROCESSING                                                        */
 3898|       |    /* --------------------------------------------------------------------- */
 3899|    421|    pu1_inp_luma = (UWORD8 *) ps_ref_luma->pv_buffer;
 3900|    421|    pu1_out_luma = (UWORD8 *) ps_curr_luma->pv_buffer;
 3901|    421|    i4_inp_stride = ps_ref_luma->i4_num_element_stride;
 3902|    421|    i4_out_stride = ps_curr_luma->i4_num_element_stride;
 3903|    421|    i4_chroma_flag = 0;
 3904|       |
 3905|       |    /* ------- Constructing refSampleArray ----------------------- */
 3906|    421|    ret = isvcd_reflayer_construction(pv_intra_samp_ctxt, pu1_inp_luma, NULL, i4_inp_stride,
 3907|    421|                                      i4_refarray_stride, ps_ref_mb_mode_map, ps_mb_coord,
 3908|    421|                                      i4_chroma_flag);
 3909|       |
 3910|    421|    if(ret != OK)
  ------------------
  |  |  114|    421|#define OK        0
  ------------------
  |  Branch (3910:8): [True: 0, False: 421]
  ------------------
 3911|      0|    {
 3912|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 3913|      0|    }
 3914|       |    /* ---- Interpolation process for Intra_Base prediction     ------ */
 3915|    421|    ps_ctxt->pf_interpolate_intra_base(pv_intra_samp_ctxt, pu1_out_luma, i4_out_stride,
 3916|    421|                                       i4_refarray_stride, ps_mb_coord->u2_mb_x,
 3917|    421|                                       ps_mb_coord->u2_mb_y, i4_chroma_flag, 0);
 3918|       |
 3919|       |    /* --------------------------------------------------------------------- */
 3920|       |    /* CHROMA PROCESSING                                                       */
 3921|       |    /* --------------------------------------------------------------------- */
 3922|       |    /* CB */
 3923|    421|    i4_inp_stride = ps_ref_chroma->i4_num_element_stride;
 3924|    421|    pu1_inp_cb = (UWORD8 *) ps_ref_chroma->pv_buffer;
 3925|    421|    pu1_inp_cr = pu1_inp_cb + 1;
 3926|    421|    i4_chroma_flag = 1;
 3927|       |
 3928|       |    /* ------- Constructing refSampleArray ----------------------- */
 3929|    421|    ret = isvcd_reflayer_construction(pv_intra_samp_ctxt, pu1_inp_cb, pu1_inp_cr, i4_inp_stride,
 3930|    421|                                      i4_refarray_stride, ps_ref_mb_mode_map, ps_mb_coord,
 3931|    421|                                      i4_chroma_flag);
 3932|       |
 3933|    421|    if(ret != OK)
  ------------------
  |  |  114|    421|#define OK        0
  ------------------
  |  Branch (3933:8): [True: 0, False: 421]
  ------------------
 3934|      0|    {
 3935|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 3936|      0|    }
 3937|    421|    i4_out_stride = ps_curr_chroma->i4_num_element_stride;
 3938|    421|    pu1_out_cb = (UWORD8 *) ps_curr_chroma->pv_buffer;
 3939|    421|    pu1_out_cr = pu1_out_cb + 1;
 3940|       |
 3941|       |    /* ---- Cb Interpolation process for Intra_Base prediction     ------ */
 3942|    421|    ps_ctxt->pf_interpolate_intra_base(pv_intra_samp_ctxt, pu1_out_cb, i4_out_stride,
 3943|    421|                                       i4_refarray_stride, ps_mb_coord->u2_mb_x,
 3944|    421|                                       ps_mb_coord->u2_mb_y, i4_chroma_flag, 0);
 3945|       |
 3946|       |    /* ---- Cr Interpolation process for Intra_Base prediction     ------ */
 3947|    421|    ps_ctxt->pf_interpolate_intra_base(pv_intra_samp_ctxt, pu1_out_cr, i4_out_stride,
 3948|    421|                                       i4_refarray_stride, ps_mb_coord->u2_mb_x,
 3949|    421|                                       ps_mb_coord->u2_mb_y, i4_chroma_flag, 1);
 3950|    421|    return OK;
  ------------------
  |  |  114|    421|#define OK        0
  ------------------
 3951|    421|}
isvcd_intra_resamp_generate_segment_lookup:
 3981|    320|{
 3982|    320|    WORD32 i4_x;
 3983|    320|    WORD32 i4_position, i4_dist_prev_mb, i4_dist_next_mb;
 3984|    320|    UWORD8 u1_seg_dim;
 3985|    320|    UWORD8 u1_num_sgmts;
 3986|    320|    WORD32 i4_block_size = i4_mb_size >> 1;
 3987|    320|    UWORD8 u1_offset = 0;
 3988|    320|    seg_lookup_desc_t *ps_segments;
 3989|    320|    seg_description_t *ps_seg_desc;
 3990|       |
 3991|    320|    memset(ps_seg_lookup_table, 0, i4_mb_size * sizeof(seg_lookup_desc_t));
 3992|       |
 3993|  4.16k|    for(i4_x = 0; i4_x < i4_mb_size; i4_x++)
  ------------------
  |  Branch (3993:19): [True: 3.84k, False: 320]
  ------------------
 3994|  3.84k|    {
 3995|  3.84k|        ps_segments = &ps_seg_lookup_table[i4_x];
 3996|  3.84k|        ps_seg_desc = ps_segments->s_segments;
 3997|  3.84k|        i4_position = i4_x;
 3998|       |
 3999|  3.84k|        if(i4_x >= i4_block_size)
  ------------------
  |  Branch (3999:12): [True: 1.92k, False: 1.92k]
  ------------------
 4000|  1.92k|        {
 4001|       |            /* set the fourth bit so that later it can be directly OR ed */
 4002|  1.92k|            ps_segments->u4_start_pos = 8;
 4003|  1.92k|        }
 4004|  1.92k|        else
 4005|  1.92k|        {
 4006|  1.92k|            ps_segments->u4_start_pos = 0;
 4007|  1.92k|        }
 4008|       |
 4009|  3.84k|        u1_num_sgmts = 0;
 4010|  3.84k|        u1_offset = 0;
 4011|       |
 4012|  14.4k|        while(i4_position < (i4_x + i4_dimension))
  ------------------
  |  Branch (4012:15): [True: 10.5k, False: 3.84k]
  ------------------
 4013|  10.5k|        {
 4014|       |            /* check and fill the nearest mb boundry flag */
 4015|  10.5k|            if((i4_position & (i4_mb_size - 1)) < i4_block_size)
  ------------------
  |  Branch (4015:16): [True: 5.28k, False: 5.28k]
  ------------------
 4016|  5.28k|            {
 4017|  5.28k|                ps_seg_desc->i1_nearst_mb_bdry = -1;
 4018|  5.28k|            }
 4019|  5.28k|            else
 4020|  5.28k|            {
 4021|  5.28k|                ps_seg_desc->i1_nearst_mb_bdry = 1;
 4022|  5.28k|            }
 4023|       |
 4024|       |            /* find the distance from the previous MB for start of segment*/
 4025|  10.5k|            i4_dist_prev_mb = (i4_position & (i4_mb_size - 1));
 4026|       |
 4027|  10.5k|            ps_seg_desc->i1_dist_idx =
 4028|  10.5k|                ((i4_dist_prev_mb >= i4_mb_size >> 1) ? (i4_mb_size - i4_dist_prev_mb)
  ------------------
  |  Branch (4028:18): [True: 5.28k, False: 5.28k]
  ------------------
 4029|  10.5k|                                                      : -(i4_dist_prev_mb + 1));
 4030|       |
 4031|       |            /* find the size of the segment */
 4032|  10.5k|            u1_seg_dim = (i4_block_size - (i4_position & (i4_block_size - 1)));
 4033|  10.5k|            i4_position += u1_seg_dim;
 4034|  10.5k|            if(i4_position > (i4_x + i4_dimension))
  ------------------
  |  Branch (4034:16): [True: 3.20k, False: 7.36k]
  ------------------
 4035|  3.20k|            {
 4036|  3.20k|                i4_position = (i4_x + i4_dimension);
 4037|  3.20k|                u1_seg_dim = (i4_position & (i4_block_size - 1));
 4038|  3.20k|            }
 4039|       |
 4040|       |            /* find the distance from the next MB for end of segment */
 4041|  10.5k|            i4_dist_next_mb = (i4_position & (i4_mb_size - 1));
 4042|  10.5k|            ps_seg_desc->u1_seg_dim = u1_seg_dim;
 4043|  10.5k|            ps_seg_desc->u1_seg_off = u1_offset;
 4044|       |
 4045|       |            /* check if the segment has a adjoining MB edge */
 4046|  10.5k|            if(i4_dist_prev_mb == 0)
  ------------------
  |  Branch (4046:16): [True: 3.68k, False: 6.88k]
  ------------------
 4047|  3.68k|            {
 4048|  3.68k|                if(0 == u1_num_sgmts)
  ------------------
  |  Branch (4048:20): [True: 320, False: 3.36k]
  ------------------
 4049|    320|                {
 4050|    320|                    ps_seg_desc->u1_mb_adjoin = 0;
 4051|    320|                }
 4052|  3.36k|                else
 4053|  3.36k|                {
 4054|  3.36k|                    ps_seg_desc->u1_mb_adjoin = 1 << i4_shift_val;
 4055|  3.36k|                }
 4056|  3.68k|            }
 4057|  6.88k|            else if(i4_dist_next_mb == 0)
  ------------------
  |  Branch (4057:21): [True: 3.68k, False: 3.20k]
  ------------------
 4058|  3.68k|            {
 4059|  3.68k|                if(i4_position == (i4_x + i4_dimension))
  ------------------
  |  Branch (4059:20): [True: 320, False: 3.36k]
  ------------------
 4060|    320|                {
 4061|    320|                    ps_seg_desc->u1_mb_adjoin = 0;
 4062|    320|                }
 4063|  3.36k|                else
 4064|  3.36k|                {
 4065|  3.36k|                    ps_seg_desc->u1_mb_adjoin = 1 << i4_shift_val;
 4066|  3.36k|                }
 4067|  3.68k|            }
 4068|  3.20k|            else
 4069|  3.20k|            {
 4070|  3.20k|                ps_seg_desc->u1_mb_adjoin = 0;
 4071|  3.20k|            }
 4072|       |
 4073|       |            /* Updations */
 4074|  10.5k|            u1_offset += u1_seg_dim;
 4075|  10.5k|            u1_num_sgmts++;
 4076|  10.5k|            ps_seg_desc++;
 4077|  10.5k|        }
 4078|       |
 4079|       |        /* fill the number of segments for this position */
 4080|  3.84k|        ps_segments->u1_num_segments = u1_num_sgmts;
 4081|  3.84k|    }
 4082|    320|}
isvcd_intra_resamp_populate_list:
 4109|  1.44k|{
 4110|       |    /* --------------------------------------------------------------------- */
 4111|       |    /* Local variables required for finding the mapping between the layers     */
 4112|       |    /* --------------------------------------------------------------------- */
 4113|  1.44k|    UWORD32 i4_shift_x, i4_shift_y, i4_scale_x, i4_scale_y;
 4114|  1.44k|    WORD32 i4_offset_x, i4_offset_y;
 4115|  1.44k|    WORD32 i4_add_x, i4_add_y, i4_delta_x, i4_delta_y, i4_refphase_x, i4_refphase_y;
 4116|  1.44k|    WORD32 i4_phase_x, i4_phase_y, i4_sub_wd, i4_sub_ht, i4_mb_wd, i4_mb_ht;
 4117|  1.44k|    WORD32 i4_horz_dim, i4_vert_dim, i4_tmp;
 4118|  1.44k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 4119|       |    /* --------------------------------------------------------------------- */
 4120|       |    /* Local Pointer Declaration for arrays in Mapping context                 */
 4121|       |    /* --------------------------------------------------------------------- */
 4122|  1.44k|    ref_mb_map_t *ps_x_off_len, *ps_y_off_len;
 4123|  1.44k|    UWORD32 i4_ref_wd, i4_ref_ht, i4_scaled_wd, i4_scaled_ht, i4_curr_lyr_width, i4_curr_lyr_height;
 4124|       |
 4125|       |    /* --------------------------------------------------------------------- */
 4126|       |    /* Local Flag Declaration                                                 */
 4127|       |    /* --------------------------------------------------------------------- */
 4128|  1.44k|    WORD32 i4_ref_layer_field_pic_flag, i4_field_pic_flag, i4_frame_mbs_only_flag;
 4129|  1.44k|    WORD32 i4_ref_layer_frame_Mbs_only_flag, i4_field_Mb_flag, i4_bot_field_flag;
 4130|       |
 4131|       |    /* --------------------------------------------------------------------- */
 4132|       |    /* Cropping Parameters Declaration                                         */
 4133|       |    /* --------------------------------------------------------------------- */
 4134|  1.44k|    WORD32 i4_scaled_ref_layer_left_offset, i4_scaled_ref_layer_top_offset;
 4135|  1.44k|    WORD32 i4_scaled_ref_layer_right_offset, i4_scaled_ref_layer_bottom_offset;
 4136|  1.44k|    dec_seq_params_t *ps_sps;
 4137|  1.44k|    dec_svc_seq_params_t *ps_subset_sps;
 4138|  1.44k|    ps_sps = ps_dec->ps_cur_sps;
 4139|  1.44k|    ps_subset_sps = ps_svc_lyr_dec->ps_cur_subset_sps;
 4140|       |
 4141|       |    /* --------------------------------------------------------------------- */
 4142|       |    /* Hardcoding flag information    (assuming no field support) */
 4143|       |    /* --------------------------------------------------------------------- */
 4144|  1.44k|    i4_ref_layer_field_pic_flag = SVCD_FALSE;
  ------------------
  |  |   45|  1.44k|#define SVCD_FALSE 0
  ------------------
 4145|  1.44k|    i4_field_pic_flag = SVCD_FALSE;
  ------------------
  |  |   45|  1.44k|#define SVCD_FALSE 0
  ------------------
 4146|  1.44k|    i4_frame_mbs_only_flag = SVCD_TRUE;
  ------------------
  |  |   46|  1.44k|#define SVCD_TRUE 1
  ------------------
 4147|  1.44k|    i4_field_Mb_flag = SVCD_FALSE;
  ------------------
  |  |   45|  1.44k|#define SVCD_FALSE 0
  ------------------
 4148|  1.44k|    i4_bot_field_flag = SVCD_FALSE;
  ------------------
  |  |   45|  1.44k|#define SVCD_FALSE 0
  ------------------
 4149|  1.44k|    i4_ref_layer_frame_Mbs_only_flag = SVCD_TRUE;
  ------------------
  |  |   46|  1.44k|#define SVCD_TRUE 1
  ------------------
 4150|  1.44k|    i4_horz_dim = 0;
 4151|  1.44k|    i4_vert_dim = 0;
 4152|       |
 4153|       |    /* --------------------------------------------------------------------- */
 4154|       |    /* Pointer and Paramater are intialized    - Chroma and Luma */
 4155|       |    /* --------------------------------------------------------------------- */
 4156|  1.44k|    {
 4157|  1.44k|        WORD32 i4_base_width;
 4158|  1.44k|        WORD32 i4_base_height;
 4159|  1.44k|        WORD32 i4_ref_layer_chroma_phase_x_plus1_flag;
 4160|  1.44k|        WORD32 i4_ref_layer_chroma_phase_y_plus1;
 4161|  1.44k|        WORD32 i4_chroma_phase_x_plus1_flag;
 4162|  1.44k|        WORD32 i4_chroma_phase_y_plus1;
 4163|       |
 4164|       |        /* ------------------------------------------------------------- */
 4165|       |        /* HARD CODED FOR 420                                             */
 4166|       |        /* ------------------------------------------------------------- */
 4167|  1.44k|        WORD32 i4_sub_wd_chroma = 2;
 4168|  1.44k|        WORD32 i4_sub_ht_chroma = 2;
 4169|       |
 4170|  1.44k|        i4_base_width = ps_ref_res_prms->i4_res_width;
 4171|  1.44k|        i4_base_height = ps_ref_res_prms->i4_res_height;
 4172|       |
 4173|  1.44k|        i4_ref_layer_chroma_phase_x_plus1_flag =
 4174|  1.44k|            ps_curr_res_prms->i1_ref_lyr_chroma_phase_x_plus1_flag;
 4175|       |
 4176|  1.44k|        i4_ref_layer_chroma_phase_y_plus1 = ps_curr_res_prms->i1_ref_lyr_chroma_phase_y_plus1;
 4177|  1.44k|        i4_chroma_phase_x_plus1_flag = ps_subset_sps->s_sps_svc_ext.u1_chroma_phase_x_plus1_flag;
 4178|  1.44k|        i4_chroma_phase_y_plus1 = ps_subset_sps->s_sps_svc_ext.u1_chroma_phase_y_plus1;
 4179|  1.44k|        i4_scaled_ref_layer_bottom_offset = ps_curr_res_prms->s_ref_lyr_scaled_offset.i2_bot;
 4180|  1.44k|        i4_scaled_ref_layer_left_offset = ps_curr_res_prms->s_ref_lyr_scaled_offset.i2_left;
 4181|  1.44k|        i4_scaled_ref_layer_top_offset = ps_curr_res_prms->s_ref_lyr_scaled_offset.i2_top;
 4182|  1.44k|        i4_scaled_ref_layer_right_offset = ps_curr_res_prms->s_ref_lyr_scaled_offset.i2_rt;
 4183|       |
 4184|       |        /* ----------------------------------------------------------------- */
 4185|       |        /* Computing Effective Frame Dimensions                                 */
 4186|       |        /* ------------------------------------------------------------------*/
 4187|  1.44k|        i4_ref_wd = (i4_base_width >> i4_chroma_flag);
 4188|  1.44k|        i4_ref_ht = (i4_base_height >> i4_chroma_flag) * (1 + i4_ref_layer_field_pic_flag);
 4189|       |
 4190|  1.44k|        i4_scaled_wd = ps_curr_res_prms->u2_scaled_ref_width;
 4191|  1.44k|        i4_scaled_ht = ps_curr_res_prms->u2_scaled_ref_height;
 4192|  1.44k|        i4_scaled_wd = (i4_scaled_wd >> i4_chroma_flag);
 4193|  1.44k|        i4_scaled_ht = (i4_scaled_ht >> i4_chroma_flag) * (1 + i4_field_pic_flag);
 4194|       |
 4195|  1.44k|        if(1 == i4_chroma_flag)
  ------------------
  |  Branch (4195:12): [True: 720, False: 720]
  ------------------
 4196|    720|        {
 4197|    720|            i4_refphase_x = i4_ref_layer_chroma_phase_x_plus1_flag - 1;
 4198|    720|            i4_refphase_y = i4_ref_layer_chroma_phase_y_plus1 - 1;
 4199|    720|            i4_phase_x = i4_chroma_phase_x_plus1_flag - 1;
 4200|    720|            i4_phase_y = i4_chroma_phase_y_plus1 - 1;
 4201|    720|            i4_sub_wd = i4_sub_wd_chroma;
 4202|    720|            i4_sub_ht = i4_sub_ht_chroma;
 4203|    720|            i4_mb_wd = MB_WIDTH >> 1;
  ------------------
  |  |   67|    720|#define MB_WIDTH 16
  ------------------
 4204|    720|            i4_mb_ht = MB_HEIGHT >> 1;
  ------------------
  |  |   68|    720|#define MB_HEIGHT 16
  ------------------
 4205|    720|        }
 4206|    720|        else
 4207|    720|        {
 4208|    720|            i4_refphase_x = 0;
 4209|    720|            i4_refphase_y = 0;
 4210|    720|            i4_phase_x = 0;
 4211|    720|            i4_phase_y = 0;
 4212|    720|            i4_sub_wd = 1;
 4213|    720|            i4_sub_ht = 1;
 4214|    720|            i4_mb_wd = MB_WIDTH;
  ------------------
  |  |   67|    720|#define MB_WIDTH 16
  ------------------
 4215|    720|            i4_mb_ht = MB_HEIGHT;
  ------------------
  |  |   68|    720|#define MB_HEIGHT 16
  ------------------
 4216|    720|        }
 4217|  1.44k|    }
 4218|       |
 4219|       |    /* --------------------------------------------------------------------- */
 4220|       |    /* Derive shift x and y based on level idd                               */
 4221|       |    /* --------------------------------------------------------------------- */
 4222|  1.44k|    if(ps_sps->u1_level_idc <= 30)
  ------------------
  |  Branch (4222:8): [True: 1.44k, False: 0]
  ------------------
 4223|  1.44k|    {
 4224|  1.44k|        i4_shift_x = 16;
 4225|  1.44k|        i4_shift_y = 16;
 4226|  1.44k|    }
 4227|      0|    else
 4228|      0|    {
 4229|      0|        i4_shift_x = 31 - isvcd_get_ceil_log2(i4_ref_wd);
 4230|      0|        i4_shift_y = 31 - isvcd_get_ceil_log2(i4_ref_ht);
 4231|      0|    }
 4232|       |
 4233|       |    /* --------------------------------------------------------------------- */
 4234|       |    /* The following condition is not true in our case for time being         */
 4235|       |    /* --------------------------------------------------------------------- */
 4236|  1.44k|    if((SVCD_FALSE == i4_frame_mbs_only_flag) || (SVCD_FALSE == i4_ref_layer_frame_Mbs_only_flag))
  ------------------
  |  |   45|  1.44k|#define SVCD_FALSE 0
  ------------------
                  if((SVCD_FALSE == i4_frame_mbs_only_flag) || (SVCD_FALSE == i4_ref_layer_frame_Mbs_only_flag))
  ------------------
  |  |   45|  1.44k|#define SVCD_FALSE 0
  ------------------
  |  Branch (4236:8): [True: 0, False: 1.44k]
  |  Branch (4236:50): [True: 0, False: 1.44k]
  ------------------
 4237|      0|    {
 4238|      0|        i4_phase_y = i4_phase_y + 4 * i4_bot_field_flag;
 4239|       |
 4240|      0|        if(1 == i4_ref_layer_frame_Mbs_only_flag)
  ------------------
  |  Branch (4240:12): [True: 0, False: 0]
  ------------------
 4241|      0|            i4_refphase_y = (2 * i4_refphase_y) + 2;
 4242|      0|        else
 4243|      0|            i4_refphase_y = i4_refphase_y + (4 * i4_bot_field_flag);
 4244|      0|    }
 4245|       |
 4246|       |    /* --------------------------------------------------------------------- */
 4247|       |    /* Dx and Dy Computation - Ratio of the base and enhance layer width     */
 4248|       |    /* --------------------------------------------------------------------- */
 4249|  1.44k|    i4_scale_x = ((i4_ref_wd << i4_shift_x) + (i4_scaled_wd >> 1)) / (i4_scaled_wd);
 4250|  1.44k|    i4_scale_y = ((i4_ref_ht << i4_shift_y) + (i4_scaled_ht >> 1)) / (i4_scaled_ht);
 4251|       |
 4252|  1.44k|    i4_offset_x = i4_scaled_ref_layer_left_offset / i4_sub_wd;
 4253|  1.44k|    i4_add_x = (((i4_ref_wd * (2 + i4_phase_x)) << (i4_shift_x - 2)) + (i4_scaled_wd >> 1)) /
 4254|  1.44k|                   i4_scaled_wd +
 4255|  1.44k|               (1 << (i4_shift_x - 5));
 4256|  1.44k|    i4_delta_x = 4 * (2 + i4_refphase_x);
 4257|       |
 4258|  1.44k|    if((SVCD_TRUE == i4_frame_mbs_only_flag) && (SVCD_TRUE == i4_ref_layer_frame_Mbs_only_flag))
  ------------------
  |  |   46|  1.44k|#define SVCD_TRUE 1
  ------------------
                  if((SVCD_TRUE == i4_frame_mbs_only_flag) && (SVCD_TRUE == i4_ref_layer_frame_Mbs_only_flag))
  ------------------
  |  |   46|  1.44k|#define SVCD_TRUE 1
  ------------------
  |  Branch (4258:8): [True: 1.44k, False: 0]
  |  Branch (4258:49): [True: 1.44k, False: 0]
  ------------------
 4259|  1.44k|    {
 4260|  1.44k|        i4_offset_y = i4_scaled_ref_layer_top_offset / i4_sub_ht;
 4261|  1.44k|        i4_add_y = (((i4_ref_ht * (2 + i4_phase_y)) << (i4_shift_y - 2)) + (i4_scaled_ht >> 1)) /
 4262|  1.44k|                       i4_scaled_ht +
 4263|  1.44k|                   (1 << (i4_shift_y - 5));
 4264|  1.44k|        i4_delta_y = 4 * (2 + i4_refphase_y);
 4265|  1.44k|    }
 4266|      0|    else
 4267|      0|    {
 4268|      0|        i4_offset_y = i4_scaled_ref_layer_top_offset / (2 * i4_sub_ht);
 4269|      0|        i4_add_y = (((i4_ref_ht * (2 + i4_phase_y)) << (i4_shift_y - 3)) + (i4_scaled_ht >> 1)) /
 4270|      0|                       i4_scaled_ht +
 4271|      0|                   (1 << (i4_shift_y - 5));
 4272|      0|        i4_delta_y = 2 * (2 + i4_refphase_y);
 4273|      0|    }
 4274|       |
 4275|       |    /* --------------------------------------------------------------------- */
 4276|       |    /* Intializing Local Pointers    - Chroma and Luma                         */
 4277|       |    /* --------------------------------------------------------------------- */
 4278|  1.44k|    ps_x_off_len = ps_map_ctxt->ps_x_offset_length;
 4279|  1.44k|    ps_y_off_len = ps_map_ctxt->ps_y_offset_length;
 4280|  1.44k|    i4_curr_lyr_width = ps_curr_res_prms->i4_res_width >> i4_chroma_flag;
 4281|  1.44k|    i4_curr_lyr_height = ps_curr_res_prms->i4_res_height >> i4_chroma_flag;
 4282|       |
 4283|       |    /* --------------------------------------------------------------------- */
 4284|       |    /* Dyadic Scaling Ratios Handling                                         */
 4285|       |    /* --------------------------------------------------------------------- */
 4286|  1.44k|    if(1 == ps_curr_res_prms->u1_dyadic_flag)
  ------------------
  |  Branch (4286:8): [True: 1.28k, False: 160]
  ------------------
 4287|  1.28k|    {
 4288|  1.28k|        WORD32 i4_refarray_wd, i4_x_offset;
 4289|  1.28k|        WORD32 i4_refarray_ht, i4_y_offset;
 4290|  1.28k|        WORD32 i4_crp_wd_lt, i4_crp_ht_top;
 4291|  1.28k|        WORD32 i4_crp_wd_rt, i4_crp_ht_bot;
 4292|  1.28k|        WORD32 i4_ref_lyr_wd, i4_ref_lyr_ht;
 4293|  1.28k|        WORD32 i4_ref_x, i4_ref_y;
 4294|  1.28k|        WORD32 i4_ofst;
 4295|  1.28k|        WORD32 i4_i, i4_j;
 4296|       |
 4297|       |        /* Hard coded for dyadic case */
 4298|  1.28k|        i4_refarray_wd = 20 >> i4_chroma_flag;
 4299|  1.28k|        i4_ofst = -2 >> i4_chroma_flag;
 4300|  1.28k|        i4_crp_wd_lt = i4_scaled_ref_layer_left_offset >> i4_chroma_flag;
 4301|  1.28k|        i4_crp_wd_rt = i4_scaled_ref_layer_right_offset >> i4_chroma_flag;
 4302|  1.28k|        i4_ref_lyr_wd = (i4_curr_lyr_width >> 1);
 4303|       |
 4304|  1.28k|        i4_ref_x = 0;
 4305|  3.84k|        for(i4_i = 0; i4_i < (WORD32) i4_curr_lyr_width; i4_i += (i4_mb_wd << 1))
  ------------------
  |  Branch (4305:23): [True: 2.56k, False: 1.28k]
  ------------------
 4306|  2.56k|        {
 4307|  2.56k|            i4_x_offset = MAX(i4_ofst, (i4_ref_x + i4_ofst));
  ------------------
  |  |   60|  2.56k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 2.56k]
  |  |  ------------------
  ------------------
 4308|  2.56k|            i4_x_offset = MIN(i4_x_offset, (i4_ref_lyr_wd - i4_ofst));
  ------------------
  |  |   61|  2.56k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 2.56k, False: 0]
  |  |  ------------------
  ------------------
 4309|  2.56k|            ps_x_off_len->i2_offset = i4_x_offset;
 4310|  2.56k|            ps_x_off_len->i2_length = i4_refarray_wd;
 4311|  2.56k|            ps_x_off_len++;
 4312|  2.56k|            ps_x_off_len->i2_offset = i4_x_offset;
 4313|  2.56k|            ps_x_off_len->i2_length = i4_refarray_wd;
 4314|  2.56k|            ps_x_off_len++;
 4315|  2.56k|            if(i4_i >= i4_crp_wd_lt)
  ------------------
  |  Branch (4315:16): [True: 2.56k, False: 0]
  ------------------
 4316|  2.56k|            {
 4317|  2.56k|                if(i4_i <= (WORD32) (i4_curr_lyr_width - i4_crp_wd_rt))
  ------------------
  |  Branch (4317:20): [True: 2.56k, False: 0]
  ------------------
 4318|  2.56k|                {
 4319|  2.56k|                    i4_ref_x += i4_mb_wd;
 4320|  2.56k|                }
 4321|  2.56k|            }
 4322|  2.56k|        }
 4323|       |
 4324|  1.28k|        i4_refarray_ht = 20 >> i4_chroma_flag;
 4325|  1.28k|        i4_crp_ht_top = i4_scaled_ref_layer_top_offset >> i4_chroma_flag;
 4326|  1.28k|        i4_crp_ht_bot = i4_scaled_ref_layer_bottom_offset >> i4_chroma_flag;
 4327|  1.28k|        i4_ref_lyr_ht = (i4_curr_lyr_height >> 1);
 4328|       |
 4329|  1.28k|        i4_ref_y = 0;
 4330|  8.78k|        for(i4_j = 0; i4_j < (WORD32) i4_curr_lyr_height; i4_j += (i4_mb_ht << 1))
  ------------------
  |  Branch (4330:23): [True: 7.50k, False: 1.28k]
  ------------------
 4331|  7.50k|        {
 4332|  7.50k|            i4_y_offset = MAX(i4_ofst, (i4_ref_y + i4_ofst));
  ------------------
  |  |   60|  7.50k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 7.50k]
  |  |  ------------------
  ------------------
 4333|  7.50k|            i4_y_offset = MIN(i4_y_offset, (i4_ref_lyr_ht - i4_ofst));
  ------------------
  |  |   61|  7.50k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 7.50k, False: 0]
  |  |  ------------------
  ------------------
 4334|  7.50k|            ps_y_off_len->i2_offset = i4_y_offset;
 4335|  7.50k|            ps_y_off_len->i2_length = i4_refarray_ht;
 4336|  7.50k|            ps_y_off_len++;
 4337|  7.50k|            ps_y_off_len->i2_offset = i4_y_offset;
 4338|  7.50k|            ps_y_off_len->i2_length = i4_refarray_ht;
 4339|  7.50k|            ps_y_off_len++;
 4340|  7.50k|            if(i4_j >= i4_crp_ht_top)
  ------------------
  |  Branch (4340:16): [True: 7.50k, False: 0]
  ------------------
 4341|  7.50k|            {
 4342|  7.50k|                if(i4_j <= (WORD32) (i4_curr_lyr_height - i4_crp_ht_bot))
  ------------------
  |  Branch (4342:20): [True: 7.50k, False: 0]
  ------------------
 4343|  7.50k|                {
 4344|  7.50k|                    i4_ref_y += i4_mb_ht;
 4345|  7.50k|                }
 4346|  7.50k|            }
 4347|  7.50k|        }
 4348|       |        /* No need to process further, return */
 4349|  1.28k|        return;
 4350|  1.28k|    } /* If dyadic path */
 4351|       |
 4352|       |    /* Proposed Algo for Optimization */
 4353|    160|    {
 4354|    160|        WORD32 i4_max, i4_min;
 4355|    160|        ref_min_max_map_t *ps_x_min_max;
 4356|    160|        ref_min_max_map_t *ps_y_min_max;
 4357|    160|        WORD32 i4_i, i4_j;
 4358|       |
 4359|    160|        ps_x_min_max = ps_map_ctxt->ps_x_min_max;
 4360|    160|        ps_y_min_max = ps_map_ctxt->ps_y_min_max;
 4361|       |        /* ----------------------------------------------------------------- */
 4362|       |        /* Computation of offsetX refArrayW Xmin and Xmax Lists                 */
 4363|       |        /* ----------------------------------------------------------------- */
 4364|    640|        for(i4_i = 0; i4_i < (WORD32) i4_curr_lyr_width; i4_i = i4_i + i4_mb_wd)
  ------------------
  |  Branch (4364:23): [True: 480, False: 160]
  ------------------
 4365|    480|        {
 4366|    480|            WORD32 i4_refarray_wd, i4_xr_index;
 4367|    480|            WORD32 i4_x_refmin16;
 4368|    480|            WORD32 i4_x_refmax16;
 4369|    480|            WORD32 i4_x_offset;
 4370|       |
 4371|    480|            i4_x_refmin16 = (WORD64) (((WORD64) (i4_i - i4_offset_x) * i4_scale_x + i4_add_x) >>
 4372|    480|                                      ((WORD32) (i4_shift_x - 4))) -
 4373|    480|                            i4_delta_x;
 4374|       |
 4375|    480|            i4_x_refmax16 =
 4376|    480|                (WORD64) (((WORD64) (i4_i + i4_mb_wd - 1 - i4_offset_x) * i4_scale_x + i4_add_x) >>
 4377|    480|                          ((WORD32) (i4_shift_x - 4))) -
 4378|    480|                i4_delta_x;
 4379|       |
 4380|       |            /* ------------------------------------------------------------- */
 4381|       |            /* Modified AC205                                                 */
 4382|       |            /* Minimum width required - So adding 2 pixels on each side         */
 4383|       |            /* ------------------------------------------------------------- */
 4384|    480|            i4_refarray_wd = ((i4_x_refmax16 + 15) >> 4) - (i4_x_refmin16 >> 4) + 1 + 4;
 4385|       |
 4386|       |            /* ------------------------------------------------------------- */
 4387|       |            /* Setting the offset 2 pixels before                             */
 4388|       |            /* ------------------------------------------------------------- */
 4389|    480|            i4_x_offset = (i4_x_refmin16 >> 4) - 2;
 4390|       |
 4391|       |            /* ------------------------------------------------------------- */
 4392|       |            /* Modifying the values based on the location                     */
 4393|       |            /* ------------------------------------------------------------- */
 4394|    480|            i4_min = i4_x_offset;
 4395|    480|            i4_xr_index = i4_min - ((i4_min / i4_mb_wd) * i4_mb_wd);
 4396|       |
 4397|    480|            if(i4_xr_index < (i4_mb_wd >> 1))
  ------------------
  |  Branch (4397:16): [True: 400, False: 80]
  ------------------
 4398|    400|            {
 4399|    400|                i4_refarray_wd = i4_refarray_wd + (i4_mb_wd >> 1);
 4400|    400|                i4_x_offset = i4_x_offset - (i4_mb_wd >> 1);
 4401|    400|            }
 4402|       |
 4403|    480|            i4_max = ((i4_x_refmax16 + 15) >> 4) + 2;
 4404|    480|            i4_xr_index = i4_max - ((i4_max / i4_mb_wd) * i4_mb_wd);
 4405|       |
 4406|    480|            if(i4_xr_index >= (i4_mb_wd >> 1)) i4_refarray_wd = i4_refarray_wd + (i4_mb_wd >> 1);
  ------------------
  |  Branch (4406:16): [True: 240, False: 240]
  ------------------
 4407|       |
 4408|       |            /* ------------------------------------------------------------- */
 4409|       |            /* Filling the arrays with offset, min, max and refArray dim     */
 4410|       |            /* ------------------------------------------------------------- */
 4411|    480|            ps_x_off_len->i2_offset = i4_x_offset;
 4412|    480|            ps_x_off_len->i2_length = i4_refarray_wd;
 4413|       |
 4414|    480|            ps_x_min_max->i2_min_pos = (i4_x_refmin16 >> 4) - i4_x_offset;
 4415|    480|            ps_x_min_max->i2_max_pos = ((i4_x_refmax16 + 15) >> 4) - i4_x_offset;
 4416|       |
 4417|    480|            i4_tmp = (WORD32) (ps_x_min_max->i2_max_pos - ps_x_min_max->i2_min_pos) +
 4418|    480|                     (4 >> i4_chroma_flag);
 4419|    480|            if(i4_tmp > i4_horz_dim)
  ------------------
  |  Branch (4419:16): [True: 160, False: 320]
  ------------------
 4420|    160|            {
 4421|    160|                i4_horz_dim = i4_tmp;
 4422|    160|            }
 4423|       |
 4424|       |            /* increment the pointer */
 4425|    480|            ps_x_off_len++;
 4426|    480|            ps_x_min_max++;
 4427|    480|        } /* end of loop over scaled width */
 4428|       |
 4429|       |        /* ----------------------------------------------------------------- */
 4430|       |        /* Computation of offsetY refArrayH Ymin and Ymax Lists                 */
 4431|       |        /* ----------------------------------------------------------------- */
 4432|  1.60k|        for(i4_j = 0; i4_j < (WORD32) i4_curr_lyr_height; i4_j = i4_j + i4_mb_ht)
  ------------------
  |  Branch (4432:23): [True: 1.44k, False: 160]
  ------------------
 4433|  1.44k|        {
 4434|  1.44k|            WORD32 i4_refarray_ht, i4_yr_index;
 4435|  1.44k|            WORD32 i4_y_refmin16;
 4436|  1.44k|            WORD32 i4_y_refmax16;
 4437|  1.44k|            WORD32 i4_y_offset;
 4438|       |
 4439|  1.44k|            i4_y_refmin16 = (WORD64) (((WORD64) (i4_j - i4_offset_y) * i4_scale_y + i4_add_y) >>
 4440|  1.44k|                                      ((WORD32) (i4_shift_y - 4))) -
 4441|  1.44k|                            i4_delta_y;
 4442|       |
 4443|  1.44k|            i4_y_refmax16 =
 4444|  1.44k|                (WORD64) (((WORD64) (i4_j + i4_mb_ht - 1 - i4_offset_y) * i4_scale_y + i4_add_y) >>
 4445|  1.44k|                          ((WORD32) (i4_shift_y - 4))) -
 4446|  1.44k|                i4_delta_y;
 4447|       |
 4448|       |            /* ------------------------------------------------------------- */
 4449|       |            /* Modified AC205                                                 */
 4450|       |            /* Minimum width required - So adding 2 pixels on each side            */
 4451|       |            /* ------------------------------------------------------------- */
 4452|  1.44k|            i4_refarray_ht = ((i4_y_refmax16 + 15) >> 4) - (i4_y_refmin16 >> 4) + 1 + 4;
 4453|       |
 4454|       |            /* ------------------------------------------------------------- */
 4455|       |            /* Setting the offset 2 pixels before                             */
 4456|       |            /* ------------------------------------------------------------- */
 4457|  1.44k|            i4_y_offset = (i4_y_refmin16 >> 4) - 2;
 4458|       |
 4459|       |            /* ------------------------------------------------------------- */
 4460|       |            /* Modifying the values based on the location                     */
 4461|       |            /* ------------------------------------------------------------- */
 4462|  1.44k|            i4_min = i4_y_offset;
 4463|  1.44k|            i4_yr_index = i4_min - ((i4_min / i4_mb_ht) * i4_mb_ht);
 4464|  1.44k|            if(i4_yr_index < (i4_mb_ht >> 1))
  ------------------
  |  Branch (4464:16): [True: 880, False: 560]
  ------------------
 4465|    880|            {
 4466|    880|                i4_refarray_ht = i4_refarray_ht + (i4_mb_ht >> 1);
 4467|    880|                i4_y_offset = i4_y_offset - (i4_mb_ht >> 1);
 4468|    880|            }
 4469|       |
 4470|  1.44k|            i4_max = ((i4_y_refmax16 + 15) >> 4) + 2;
 4471|  1.44k|            i4_yr_index = i4_max - ((i4_max / i4_mb_ht) * i4_mb_ht);
 4472|  1.44k|            if(i4_yr_index >= (i4_mb_ht >> 1)) i4_refarray_ht = i4_refarray_ht + (i4_mb_ht >> 1);
  ------------------
  |  Branch (4472:16): [True: 720, False: 720]
  ------------------
 4473|       |
 4474|       |            /* ------------------------------------------------------------- */
 4475|       |            /* Filling the arrays with offset, min, max and refArray dim     */
 4476|       |            /* ------------------------------------------------------------- */
 4477|  1.44k|            ps_y_off_len->i2_offset = i4_y_offset;
 4478|  1.44k|            ps_y_off_len->i2_length = i4_refarray_ht;
 4479|  1.44k|            ps_y_min_max->i2_min_pos = (i4_y_refmin16 >> 4) - i4_y_offset;
 4480|  1.44k|            ps_y_min_max->i2_max_pos = ((i4_y_refmax16 + 15) >> 4) - i4_y_offset;
 4481|       |
 4482|  1.44k|            i4_tmp = (WORD32) (ps_y_min_max->i2_max_pos - ps_y_min_max->i2_min_pos) +
 4483|  1.44k|                     (4 >> i4_chroma_flag);
 4484|  1.44k|            if(i4_tmp > i4_vert_dim)
  ------------------
  |  Branch (4484:16): [True: 160, False: 1.28k]
  ------------------
 4485|    160|            {
 4486|    160|                i4_vert_dim = i4_tmp;
 4487|    160|            }
 4488|       |
 4489|       |            /* increment the pointer */
 4490|  1.44k|            ps_y_off_len++;
 4491|  1.44k|            ps_y_min_max++;
 4492|  1.44k|        } /* end of loop over scaled height */
 4493|    160|    }
 4494|       |
 4495|       |    /* --------------------------------------------------------------------- */
 4496|       |    /* Computation of Xref and Xphase List as per standard                     */
 4497|       |    /* --------------------------------------------------------------------- */
 4498|    160|    ps_x_off_len = ps_map_ctxt->ps_x_offset_length;
 4499|    160|    ps_y_off_len = ps_map_ctxt->ps_y_offset_length;
 4500|       |
 4501|    160|    {
 4502|    160|        ref_pixel_map_t *ps_x_pos_phase;
 4503|    160|        WORD32 i4_xc;
 4504|    160|        WORD32 i4_offset_x_index;
 4505|       |
 4506|    160|        ps_x_pos_phase = ps_map_ctxt->ps_x_pos_phase;
 4507|       |
 4508|  5.92k|        for(i4_xc = 0; i4_xc < (WORD32) i4_curr_lyr_width; i4_xc++)
  ------------------
  |  Branch (4508:24): [True: 5.76k, False: 160]
  ------------------
 4509|  5.76k|        {
 4510|  5.76k|            WORD32 i4_x_offset;
 4511|  5.76k|            WORD32 i4_x_ref16;
 4512|       |
 4513|  5.76k|            i4_offset_x_index = i4_xc / i4_mb_wd;
 4514|       |
 4515|  5.76k|            i4_x_offset = ps_x_off_len[i4_offset_x_index].i2_offset;
 4516|       |
 4517|  5.76k|            i4_x_ref16 = (WORD64) (((WORD64) (i4_xc - i4_offset_x) * i4_scale_x + i4_add_x) >>
 4518|  5.76k|                                   ((WORD32) (i4_shift_x - 4))) -
 4519|  5.76k|                         i4_delta_x;
 4520|       |
 4521|       |            /* store the values */
 4522|  5.76k|            ps_x_pos_phase->i2_ref_pos = (i4_x_ref16 >> 4) - i4_x_offset;
 4523|  5.76k|            ps_x_pos_phase->i2_phase = i4_x_ref16 & 15;
 4524|       |
 4525|       |            /* increment the pointer */
 4526|  5.76k|            ps_x_pos_phase++;
 4527|       |
 4528|  5.76k|        } /* end of loop over scaled width */
 4529|    160|    }
 4530|       |
 4531|       |    /* --------------------------------------------------------------------- */
 4532|       |    /* Computation of Yref and Yphase List as per standard                     */
 4533|       |    /* --------------------------------------------------------------------- */
 4534|    160|    {
 4535|    160|        WORD32 i4_yc;
 4536|    160|        ref_pixel_map_t *ps_y_pos_phase;
 4537|       |
 4538|    160|        ps_y_pos_phase = ps_map_ctxt->ps_y_pos_phase;
 4539|       |
 4540|  17.4k|        for(i4_yc = 0; i4_yc < (WORD32) i4_curr_lyr_height; i4_yc++)
  ------------------
  |  Branch (4540:24): [True: 17.2k, False: 160]
  ------------------
 4541|  17.2k|        {
 4542|  17.2k|            WORD32 i4_y_offset;
 4543|  17.2k|            WORD32 i4_y_ref16;
 4544|  17.2k|            WORD32 i4_offset_y_index;
 4545|       |
 4546|  17.2k|            i4_offset_y_index = i4_yc / i4_mb_ht;
 4547|       |
 4548|  17.2k|            i4_y_offset = ps_y_off_len[i4_offset_y_index].i2_offset;
 4549|       |
 4550|  17.2k|            if((SVCD_FALSE == i4_frame_mbs_only_flag) ||
  ------------------
  |  |   45|  17.2k|#define SVCD_FALSE 0
  ------------------
  |  Branch (4550:16): [True: 0, False: 17.2k]
  ------------------
 4551|  17.2k|               (SVCD_FALSE == i4_ref_layer_frame_Mbs_only_flag))
  ------------------
  |  |   45|  17.2k|#define SVCD_FALSE 0
  ------------------
  |  Branch (4551:16): [True: 0, False: 17.2k]
  ------------------
 4552|      0|            {
 4553|      0|                i4_yc = i4_yc >> (1 - i4_field_Mb_flag);
 4554|      0|            }
 4555|       |
 4556|  17.2k|            i4_y_ref16 = (WORD64) (((WORD64) (i4_yc - i4_offset_y) * i4_scale_y + i4_add_y) >>
 4557|  17.2k|                                   ((WORD32) (i4_shift_y - 4))) -
 4558|  17.2k|                         i4_delta_y;
 4559|  17.2k|            ps_y_pos_phase->i2_ref_pos = (i4_y_ref16 >> 4) - i4_y_offset;
 4560|  17.2k|            ps_y_pos_phase->i2_phase = i4_y_ref16 & 15;
 4561|       |
 4562|       |            /* increment the pointer */
 4563|  17.2k|            ps_y_pos_phase++;
 4564|       |
 4565|  17.2k|        } /* end of loop over scaled height */
 4566|    160|    }
 4567|       |
 4568|       |    /* --------------------------------------------------------------------- */
 4569|       |    /* Computation of Corresponding Diagonal Location                         */
 4570|       |    /* --------------------------------------------------------------------- */
 4571|    160|    {
 4572|    160|        WORD16 *pi2_xd_index;
 4573|    160|        WORD16 *pi2_yd_index;
 4574|    160|        WORD16 *pi2_ya_index;
 4575|    160|        WORD32 i4_i, i4_j;
 4576|       |
 4577|    160|        pi2_xd_index = ps_map_ctxt->pi2_xd_index;
 4578|    160|        pi2_yd_index = ps_map_ctxt->pi2_yd_index;
 4579|    160|        pi2_ya_index = ps_map_ctxt->pi2_ya_index;
 4580|       |
 4581|  2.08k|        for(i4_i = 0; i4_i < i4_mb_wd; i4_i++)
  ------------------
  |  Branch (4581:23): [True: 1.92k, False: 160]
  ------------------
 4582|  1.92k|        {
 4583|  1.92k|            *(pi2_xd_index + i4_i) = ((i4_i >= i4_mb_wd >> 1) ? (i4_i - i4_mb_wd) : (i4_i + 1));
  ------------------
  |  Branch (4583:39): [True: 960, False: 960]
  ------------------
 4584|       |
 4585|  1.92k|        } /* end of loop over MB width */
 4586|       |
 4587|  2.08k|        for(i4_j = 0; i4_j < i4_mb_ht; i4_j++)
  ------------------
  |  Branch (4587:23): [True: 1.92k, False: 160]
  ------------------
 4588|  1.92k|        {
 4589|  1.92k|            *(pi2_yd_index + i4_j) = ((i4_j >= i4_mb_ht >> 1) ? (i4_j - i4_mb_ht) : (i4_j + 1));
  ------------------
  |  Branch (4589:39): [True: 960, False: 960]
  ------------------
 4590|       |
 4591|  1.92k|            *(pi2_ya_index + i4_j) =
 4592|  1.92k|                *(pi2_yd_index + i4_j) - (((i4_mb_ht >> 1) + 1) * (SIGN(*(pi2_yd_index + i4_j))));
  ------------------
  |  |  103|  1.92k|#define SIGN(x)     (((x) >= 0) ? (((x) > 0) ? 1 : 0) : -1)
  |  |  ------------------
  |  |  |  Branch (103:22): [True: 960, False: 960]
  |  |  |  Branch (103:36): [True: 960, False: 0]
  |  |  ------------------
  ------------------
 4593|       |
 4594|  1.92k|        } /* end of loop over MB height */
 4595|    160|    }
 4596|       |
 4597|       |    /* generate the lookup to generate horizontal segments */
 4598|    160|    isvcd_intra_resamp_generate_segment_lookup(ps_map_ctxt->ps_seg_lookup_horz, i4_horz_dim,
 4599|    160|                                               i4_mb_wd, 3);
 4600|       |
 4601|       |    /* generate the lookup to generate vertical segments */
 4602|    160|    isvcd_intra_resamp_generate_segment_lookup(ps_map_ctxt->ps_seg_lookup_vert, i4_vert_dim,
 4603|    160|                                               i4_mb_ht, 4);
 4604|       |
 4605|    160|    return;
 4606|  1.44k|} /* end of function "isvcd_intra_resamp_populate_list"*/
isvcd_populate_res_prms:
 4631|  4.09k|{
 4632|  4.09k|    svc_dec_lyr_struct_t *ps_svc_lyr_dec = (svc_dec_lyr_struct_t *) pv_svc_dec;
 4633|  4.09k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 4634|  4.09k|    res_prms_t *ps_curr_lyr_res_prms;
 4635|  4.09k|    svc_dec_lyr_struct_t *ps_svc_ref_lyr_dec;
 4636|  4.09k|    ps_svc_ref_lyr_dec = ps_svc_lyr_dec->ps_dec_svc_ref_layer;
 4637|  4.09k|    ps_curr_lyr_res_prms = &ps_svc_lyr_dec->s_res_prms;
 4638|       |
 4639|  4.09k|    ps_curr_lyr_res_prms->i4_res_width = ps_dec->u2_pic_wd;
 4640|  4.09k|    ps_curr_lyr_res_prms->i4_res_height = ps_dec->u2_pic_ht;
 4641|  4.09k|    ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_left =
 4642|  4.09k|        ps_svc_lyr_dec->ps_cur_subset_sps->s_sps_svc_ext.i4_seq_scaled_ref_layer_left_offset << 1;
 4643|  4.09k|    ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_top =
 4644|  4.09k|        ps_svc_lyr_dec->ps_cur_subset_sps->s_sps_svc_ext.i4_seq_scaled_ref_layer_top_offset << 1;
 4645|  4.09k|    ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_rt =
 4646|  4.09k|        ps_svc_lyr_dec->ps_cur_subset_sps->s_sps_svc_ext.i4_seq_scaled_ref_layer_right_offset << 1;
 4647|  4.09k|    ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_bot =
 4648|  4.09k|        ps_svc_lyr_dec->ps_cur_subset_sps->s_sps_svc_ext.i4_seq_scaled_ref_layer_bottom_offset << 1;
 4649|  4.09k|    ps_curr_lyr_res_prms->u2_scaled_ref_width =
 4650|  4.09k|        (ps_dec->u2_frm_wd_in_mbs << 4) - (ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_left +
 4651|  4.09k|                                           ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_rt);
 4652|       |
 4653|  4.09k|    ps_curr_lyr_res_prms->u2_scaled_ref_height =
 4654|  4.09k|        (ps_dec->u2_frm_ht_in_mbs << 4) - (ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_top +
 4655|  4.09k|                                           ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_bot);
 4656|       |
 4657|  4.09k|    ps_curr_lyr_res_prms->u1_cropping_change_flag = 0;
 4658|  4.09k|    if(2 == ps_svc_lyr_dec->ps_cur_subset_sps->s_sps_svc_ext.u1_extended_spatial_scalability_idc)
  ------------------
  |  Branch (4658:8): [True: 0, False: 4.09k]
  ------------------
 4659|      0|    {
 4660|      0|        ps_curr_lyr_res_prms->u1_cropping_change_flag = 1;
 4661|       |
 4662|      0|        ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_left =
 4663|      0|            ps_svc_lyr_dec->s_svc_slice_params.i4_scaled_ref_layer_left_offset << 1;
 4664|       |
 4665|      0|        ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_top =
 4666|      0|            ps_svc_lyr_dec->s_svc_slice_params.i4_scaled_ref_layer_top_offset << 1;
 4667|      0|        ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_rt =
 4668|      0|            ps_svc_lyr_dec->s_svc_slice_params.i4_scaled_ref_layer_right_offset << 1;
 4669|      0|        ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_bot =
 4670|      0|            ps_svc_lyr_dec->s_svc_slice_params.i4_scaled_ref_layer_bottom_offset << 1;
 4671|      0|        ps_curr_lyr_res_prms->u2_scaled_ref_width =
 4672|      0|            (ps_dec->u2_frm_wd_in_mbs << 4) -
 4673|      0|            (ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_left +
 4674|      0|             ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_rt);
 4675|       |
 4676|      0|        ps_curr_lyr_res_prms->u2_scaled_ref_height =
 4677|      0|            (ps_dec->u2_frm_ht_in_mbs << 4) -
 4678|      0|            (ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_top +
 4679|      0|             ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_bot);
 4680|       |
 4681|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 4682|      0|    }
 4683|       |
 4684|  4.09k|    ps_curr_lyr_res_prms->u1_rstrct_res_change_flag = SVCD_TRUE;
  ------------------
  |  |   46|  4.09k|#define SVCD_TRUE 1
  ------------------
 4685|       |
 4686|  4.09k|    ps_curr_lyr_res_prms->u1_disable_inter_lyr_dblk_filter_idc =
 4687|  4.09k|        ps_svc_lyr_dec->s_svc_slice_params.u4_disable_inter_layer_deblk_filter_idc;
 4688|  4.09k|    ps_curr_lyr_res_prms->i1_inter_lyr_alpha_c0_offset =
 4689|  4.09k|        ps_svc_lyr_dec->s_svc_slice_params.i4_inter_layer_slice_alpha_c0_offset_div2;
 4690|  4.09k|    ps_curr_lyr_res_prms->i1_inter_lyr_beta_offset =
 4691|  4.09k|        ps_svc_lyr_dec->s_svc_slice_params.i4_inter_layer_slice_beta_offset_div2;
 4692|  4.09k|    ps_curr_lyr_res_prms->i1_constrained_intra_rsmpl_flag =
 4693|  4.09k|        ps_svc_lyr_dec->s_svc_slice_params.u1_constrained_intra_resampling_flag;
 4694|  4.09k|    ps_curr_lyr_res_prms->i1_ref_lyr_chroma_phase_x_plus1_flag =
 4695|  4.09k|        ps_svc_lyr_dec->ps_cur_subset_sps->s_sps_svc_ext.u1_seq_ref_layer_chroma_phase_x_plus1_flag;
 4696|  4.09k|    ps_curr_lyr_res_prms->i1_ref_lyr_chroma_phase_y_plus1 =
 4697|  4.09k|        ps_svc_lyr_dec->ps_cur_subset_sps->s_sps_svc_ext.u1_seq_ref_layer_chroma_phase_y_plus1;
 4698|  4.09k|    ps_curr_lyr_res_prms->u1_direct_8x8_inference_flag =
 4699|  4.09k|        ps_dec->ps_cur_sps->u1_direct_8x8_inference_flag;
 4700|       |
 4701|  4.09k|    ps_curr_lyr_res_prms->u1_remap_req_flag = 1;
 4702|  4.09k|    ps_curr_lyr_res_prms->u1_dyadic_flag = ps_svc_lyr_dec->u1_dyadic_flag;
 4703|       |
 4704|       |    /* Derive the reference layer width and height */
 4705|       |
 4706|  4.09k|    if(SVCD_TRUE != ps_svc_lyr_dec->u1_base_res_flag)
  ------------------
  |  |   46|  4.09k|#define SVCD_TRUE 1
  ------------------
  |  Branch (4706:8): [True: 720, False: 3.37k]
  ------------------
 4707|    720|    {
 4708|    720|        WORD32 i4_ref_lyr_width;
 4709|    720|        WORD32 i4_ref_lyr_ht;
 4710|    720|        WORD32 i4_dyadic_flag = SVCD_FALSE;
  ------------------
  |  |   45|    720|#define SVCD_FALSE 0
  ------------------
 4711|    720|        i4_ref_lyr_width = ps_svc_ref_lyr_dec->s_res_prms.i4_res_width;
 4712|    720|        i4_ref_lyr_ht = ps_svc_ref_lyr_dec->s_res_prms.i4_res_height;
 4713|       |
 4714|       |        /* set the Restricted Spatial Resolution change flag */
 4715|    720|        ps_curr_lyr_res_prms->u1_rstrct_res_change_flag = SVCD_TRUE;
  ------------------
  |  |   46|    720|#define SVCD_TRUE 1
  ------------------
 4716|       |
 4717|    720|        if(0 == ((ps_curr_lyr_res_prms->u2_scaled_ref_width == i4_ref_lyr_width) ||
  ------------------
  |  Branch (4717:12): [True: 80, False: 640]
  |  Branch (4717:18): [True: 0, False: 720]
  ------------------
 4718|    720|                 (ps_curr_lyr_res_prms->u2_scaled_ref_width == (i4_ref_lyr_width << 1))))
  ------------------
  |  Branch (4718:18): [True: 640, False: 80]
  ------------------
 4719|     80|        {
 4720|     80|            ps_curr_lyr_res_prms->u1_rstrct_res_change_flag = SVCD_FALSE;
  ------------------
  |  |   45|     80|#define SVCD_FALSE 0
  ------------------
 4721|     80|        }
 4722|       |
 4723|    720|        if(0 == ((ps_curr_lyr_res_prms->u2_scaled_ref_height == i4_ref_lyr_ht) ||
  ------------------
  |  Branch (4723:12): [True: 80, False: 640]
  |  Branch (4723:18): [True: 0, False: 720]
  ------------------
 4724|    720|                 (ps_curr_lyr_res_prms->u2_scaled_ref_height == (i4_ref_lyr_ht << 1))))
  ------------------
  |  Branch (4724:18): [True: 640, False: 80]
  ------------------
 4725|     80|        {
 4726|     80|            ps_curr_lyr_res_prms->u1_rstrct_res_change_flag = SVCD_FALSE;
  ------------------
  |  |   45|     80|#define SVCD_FALSE 0
  ------------------
 4727|     80|        }
 4728|       |
 4729|    720|        if(0 != (ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_left & 15))
  ------------------
  |  Branch (4729:12): [True: 0, False: 720]
  ------------------
 4730|      0|        {
 4731|      0|            ps_curr_lyr_res_prms->u1_rstrct_res_change_flag = SVCD_FALSE;
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
 4732|      0|        }
 4733|       |
 4734|    720|        if(0 != (ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_top & 15))
  ------------------
  |  Branch (4734:12): [True: 0, False: 720]
  ------------------
 4735|      0|        {
 4736|      0|            ps_curr_lyr_res_prms->u1_rstrct_res_change_flag = SVCD_FALSE;
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
 4737|      0|        }
 4738|       |
 4739|       |        /* populate the dyadic status */
 4740|       |
 4741|    720|        if((ps_curr_lyr_res_prms->u2_scaled_ref_width == (i4_ref_lyr_width << 1)) &&
  ------------------
  |  Branch (4741:12): [True: 640, False: 80]
  ------------------
 4742|    640|           (ps_curr_lyr_res_prms->u2_scaled_ref_height == (i4_ref_lyr_ht << 1)))
  ------------------
  |  Branch (4742:12): [True: 640, False: 0]
  ------------------
 4743|    640|        {
 4744|    640|            i4_dyadic_flag = SVCD_TRUE;
  ------------------
  |  |   46|    640|#define SVCD_TRUE 1
  ------------------
 4745|    640|        }
 4746|     80|        else if((ps_curr_lyr_res_prms->u2_scaled_ref_width != ((i4_ref_lyr_width * 3) >> 1)) ||
  ------------------
  |  Branch (4746:17): [True: 0, False: 80]
  ------------------
 4747|     80|                (ps_curr_lyr_res_prms->u2_scaled_ref_height != ((i4_ref_lyr_ht * 3) >> 1)))
  ------------------
  |  Branch (4747:17): [True: 0, False: 80]
  ------------------
 4748|      0|        {
 4749|      0|            ps_curr_lyr_res_prms->u1_dyadic_flag = i4_dyadic_flag;
 4750|      0|            ps_svc_lyr_dec->u1_dyadic_flag = ps_curr_lyr_res_prms->u1_dyadic_flag;
 4751|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 4752|      0|        }
 4753|       |
 4754|       |        /* check if cropping is MB aligned */
 4755|    720|        if(SVCD_TRUE == i4_dyadic_flag)
  ------------------
  |  |   46|    720|#define SVCD_TRUE 1
  ------------------
  |  Branch (4755:12): [True: 640, False: 80]
  ------------------
 4756|    640|        {
 4757|    640|            if((0 != (ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_left & 15)) ||
  ------------------
  |  Branch (4757:16): [True: 0, False: 640]
  ------------------
 4758|    640|               (0 != (ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_top & 15)))
  ------------------
  |  Branch (4758:16): [True: 0, False: 640]
  ------------------
 4759|      0|            {
 4760|      0|                i4_dyadic_flag = SVCD_FALSE;
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
 4761|      0|            }
 4762|    640|        }
 4763|       |
 4764|    720|        ps_curr_lyr_res_prms->u1_dyadic_flag = i4_dyadic_flag;
 4765|    720|        ps_svc_lyr_dec->u1_dyadic_flag = ps_curr_lyr_res_prms->u1_dyadic_flag;
 4766|    720|    }
 4767|       |
 4768|  4.09k|    {
 4769|  4.09k|        inter_lyr_mb_prms_t *ps_tmp_prms, *ps_tmp_prms_2;
 4770|  4.09k|        inter_lyr_mb_prms_t *ps_ref_mb_prms;
 4771|  4.09k|        WORD32 i4_stride;
 4772|  4.09k|        WORD32 i4_ht_in_mbs, i4_wd_in_mbs;
 4773|  4.09k|        WORD32 i4_i;
 4774|       |
 4775|       |        /* Derive the reference mb mode map */
 4776|       |
 4777|  4.09k|        ps_ref_mb_prms = ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start;
 4778|  4.09k|        i4_stride = ps_svc_lyr_dec->u2_inter_lyr_mb_prms_stride;
 4779|       |
 4780|  4.09k|        i4_ht_in_mbs = ps_dec->u2_frm_ht_in_mbs;
 4781|  4.09k|        i4_wd_in_mbs = ps_dec->u2_frm_wd_in_mbs;
 4782|       |
 4783|       |        /* Set the first border row to 0xFF */
 4784|  4.09k|        ps_tmp_prms = (ps_ref_mb_prms - 1 - i4_stride);
 4785|       |
 4786|  4.09k|        memset(ps_svc_lyr_dec->ps_inter_lyr_mb_prms_base, -1,
 4787|  4.09k|               ps_svc_lyr_dec->u4_inter_lyr_mb_prms_size);
 4788|  4.09k|        memset(ps_svc_lyr_dec->pu1_svc_base_mode_flag, 0,
 4789|  4.09k|               ps_svc_lyr_dec->i4_frm_svc_base_mode_cabac_size);
 4790|       |
 4791|  39.0k|        for(i4_i = 0; i4_i < (i4_wd_in_mbs + 2); i4_i++)
  ------------------
  |  Branch (4791:23): [True: 35.0k, False: 4.09k]
  ------------------
 4792|  35.0k|        {
 4793|  35.0k|            ps_tmp_prms->i1_mb_mode = (WORD8) 0xFF;
 4794|  35.0k|            ps_tmp_prms += 1;
 4795|  35.0k|        }
 4796|       |
 4797|       |        /* Set the left and right border pixels of each row to 0 */
 4798|  4.09k|        ps_tmp_prms = ps_ref_mb_prms - 1;
 4799|       |
 4800|   147k|        for(i4_i = 0; i4_i < i4_ht_in_mbs; i4_i++)
  ------------------
  |  Branch (4800:23): [True: 143k, False: 4.09k]
  ------------------
 4801|   143k|        {
 4802|   143k|            ps_tmp_prms->i1_mb_mode = (WORD8) 0xFF;
 4803|   143k|            ps_tmp_prms_2 = ps_tmp_prms + (i4_wd_in_mbs + 1);
 4804|   143k|            ps_tmp_prms_2->i1_mb_mode = (WORD8) 0xFF;
 4805|   143k|            ps_tmp_prms += i4_stride;
 4806|   143k|        }
 4807|       |
 4808|       |        /* Set the last border row to 0xFF */
 4809|  39.0k|        for(i4_i = 0; i4_i < (i4_wd_in_mbs + 2); i4_i++)
  ------------------
  |  Branch (4809:23): [True: 35.0k, False: 4.09k]
  ------------------
 4810|  35.0k|        {
 4811|  35.0k|            ps_tmp_prms->i1_mb_mode = (WORD8) 0xFF;
 4812|  35.0k|            ps_tmp_prms += 1;
 4813|  35.0k|        }
 4814|  4.09k|    }
 4815|       |
 4816|       |    /* reset residual luma, chroma buffer*/
 4817|  4.09k|    memset(ps_svc_lyr_dec->pi2_il_residual_resample_luma_base, 0,
 4818|  4.09k|           ps_svc_lyr_dec->u4_residual_resample_luma_size);
 4819|  4.09k|    memset(ps_svc_lyr_dec->pi2_il_residual_resample_chroma_base, 0,
 4820|  4.09k|           ps_svc_lyr_dec->u4_residual_resample_chroma_size);
 4821|       |
 4822|  4.09k|    return OK;
  ------------------
  |  |  114|  4.09k|#define OK        0
  ------------------
 4823|  4.09k|}
isvcd_crop_wnd_flag_res_int:
 4850|  4.09k|{
 4851|  4.09k|    UWORD8 *pu1_crop_wnd_flag;
 4852|  4.09k|    WORD32 i4_num_mbs;
 4853|  4.09k|    WORD32 i4_crop_mbs_x;
 4854|  4.09k|    WORD32 i4_crop_mbs_y;
 4855|  4.09k|    WORD32 i4_cnt;
 4856|  4.09k|    WORD32 i4_left_offset, i4_rt_offset;
 4857|  4.09k|    WORD32 i4_top_offset, i4_bot_offset;
 4858|  4.09k|    WORD32 i4_frm_wd_in_mbs;
 4859|  4.09k|    WORD32 i4_frm_ht_in_mbs;
 4860|  4.09k|    dec_struct_t *ps_dec;
 4861|  4.09k|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
 4862|  4.09k|    res_prms_t *ps_res_prms;
 4863|       |
 4864|  4.09k|    ps_svc_lyr_dec = (svc_dec_lyr_struct_t *) pv_svc_dec;
 4865|  4.09k|    ps_dec = &ps_svc_lyr_dec->s_dec;
 4866|  4.09k|    ps_res_prms = &ps_svc_lyr_dec->s_res_prms;
 4867|  4.09k|    i4_frm_wd_in_mbs = ps_dec->u2_frm_wd_in_mbs;
 4868|  4.09k|    i4_frm_ht_in_mbs = ps_dec->u2_frm_ht_in_mbs;
 4869|       |
 4870|       |    /* Initializations */
 4871|  4.09k|    pu1_crop_wnd_flag = ps_svc_lyr_dec->pu1_crop_wnd_flag;
 4872|  4.09k|    i4_num_mbs = i4_frm_wd_in_mbs * i4_frm_ht_in_mbs;
 4873|       |
 4874|       |    /* bottom most layer in a resolution */
 4875|  4.09k|    if(ps_res_prms->s_ref_lyr_scaled_offset.i2_left >= 0)
  ------------------
  |  Branch (4875:8): [True: 4.09k, False: 0]
  ------------------
 4876|  4.09k|    {
 4877|       |        /* check for offset greater than 0 */
 4878|  4.09k|        i4_left_offset = (ps_res_prms->s_ref_lyr_scaled_offset.i2_left + 15) >> 4;
 4879|  4.09k|    }
 4880|      0|    else
 4881|      0|    {
 4882|       |        /* if negative set it to 0*/
 4883|      0|        i4_left_offset = 0;
 4884|      0|    }
 4885|       |
 4886|  4.09k|    if(ps_res_prms->s_ref_lyr_scaled_offset.i2_rt >= 0)
  ------------------
  |  Branch (4886:8): [True: 4.09k, False: 0]
  ------------------
 4887|  4.09k|    {
 4888|       |        /* check for offset greater than 0 */
 4889|  4.09k|        i4_rt_offset =
 4890|  4.09k|            (ps_res_prms->i4_res_width - ps_res_prms->s_ref_lyr_scaled_offset.i2_rt) >> 4;
 4891|  4.09k|    }
 4892|      0|    else
 4893|      0|    {
 4894|       |        /* if negative set it to framewidth in MBs */
 4895|      0|        i4_rt_offset = (ps_res_prms->i4_res_width >> 4);
 4896|      0|    }
 4897|       |
 4898|  4.09k|    if(ps_res_prms->s_ref_lyr_scaled_offset.i2_top >= 0)
  ------------------
  |  Branch (4898:8): [True: 4.09k, False: 0]
  ------------------
 4899|  4.09k|    {
 4900|       |        /* check for offset greater than 0 */
 4901|  4.09k|        i4_top_offset = (ps_res_prms->s_ref_lyr_scaled_offset.i2_top + 15) >> 4;
 4902|  4.09k|    }
 4903|      0|    else
 4904|      0|    {
 4905|       |        /* if negative set it to 0 */
 4906|      0|        i4_top_offset = 0;
 4907|      0|    }
 4908|       |
 4909|  4.09k|    if(ps_res_prms->s_ref_lyr_scaled_offset.i2_bot >= 0)
  ------------------
  |  Branch (4909:8): [True: 4.09k, False: 0]
  ------------------
 4910|  4.09k|    {
 4911|       |        /* check for offset greater than 0 */
 4912|  4.09k|        i4_bot_offset =
 4913|  4.09k|            (ps_res_prms->i4_res_height - ps_res_prms->s_ref_lyr_scaled_offset.i2_bot) >> 4;
 4914|  4.09k|    }
 4915|      0|    else
 4916|      0|    {
 4917|       |        /* if negative set it to frameheight in MBs */
 4918|      0|        i4_bot_offset = (ps_res_prms->i4_res_height >> 4);
 4919|      0|    }
 4920|       |
 4921|  4.09k|    i4_crop_mbs_x = i4_rt_offset - i4_left_offset;
 4922|  4.09k|    i4_crop_mbs_y = i4_bot_offset - i4_top_offset;
 4923|       |
 4924|       |    /* Set crop window flag to 0 for all mbs */
 4925|  4.09k|    memset(pu1_crop_wnd_flag, 0, i4_num_mbs);
 4926|       |
 4927|  4.09k|    pu1_crop_wnd_flag += (i4_frm_wd_in_mbs * i4_top_offset);
 4928|  4.09k|    pu1_crop_wnd_flag += i4_left_offset;
 4929|       |    /* Loop over MBs in crop window */
 4930|   147k|    for(i4_cnt = 0; i4_cnt < i4_crop_mbs_y; i4_cnt++)
  ------------------
  |  Branch (4930:21): [True: 143k, False: 4.09k]
  ------------------
 4931|   143k|    {
 4932|   143k|        memset(pu1_crop_wnd_flag, 1, i4_crop_mbs_x);
 4933|   143k|        pu1_crop_wnd_flag += i4_frm_wd_in_mbs;
 4934|   143k|    }
 4935|  4.09k|}
isvcd_intra_resamp_res_init_update_flags:
 4963|    674|{
 4964|    674|    intra_sampling_ctxt_t *ps_ctxt;
 4965|    674|    intra_samp_lyr_ctxt *ps_lyr_ctxt;
 4966|    674|    svc_dec_lyr_struct_t *ps_svc_lyr_dec = (svc_dec_lyr_struct_t *) pv_svc_dec;
 4967|       |
 4968|    674|    ps_ctxt = (intra_sampling_ctxt_t *) ps_svc_lyr_dec->pv_intra_sample_ctxt;;
 4969|       |    /* get the current layer ctxt */
 4970|    674|    ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_svc_lyr_dec->u1_layer_id - 1];
 4971|       |
 4972|    674|    ps_lyr_ctxt->i1_constrained_intra_rsmpl_flag =
 4973|    674|        ps_svc_lyr_dec->s_svc_slice_params.u1_constrained_intra_resampling_flag;
 4974|    674|}
isvcd_intra_resamp_res_init:
 5002|  4.09k|{
 5003|  4.09k|    intra_sampling_ctxt_t *ps_ctxt;
 5004|  4.09k|    intra_samp_lyr_ctxt *ps_lyr_ctxt;
 5005|  4.09k|    dec_svc_seq_params_t *ps_cur_subset_sps;
 5006|  4.09k|    svc_dec_lyr_struct_t *ps_svc_lyr_dec = (svc_dec_lyr_struct_t *) pv_svc_dec;
 5007|  4.09k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 5008|  4.09k|    dec_slice_svc_ext_params_t *ps_svc_slice_params = NULL;
 5009|       |
 5010|  4.09k|    void *pv_intra_samp_ctxt = ps_svc_lyr_dec->pv_intra_sample_ctxt;
 5011|  4.09k|    res_prms_t *ps_curr_lyr_res_prms = &ps_svc_lyr_dec->s_res_prms;
 5012|  4.09k|    ref_mb_map_t **pps_luma_map_horz = &ps_svc_lyr_dec->ps_intsam_luma_map_horz;
 5013|  4.09k|    ref_mb_map_t **pps_chroma_map_horz = &ps_svc_lyr_dec->ps_intsam_chroma_map_horz;
 5014|  4.09k|    ref_mb_map_t **pps_luma_map_vert = &ps_svc_lyr_dec->ps_intsam_luma_map_vert;
 5015|  4.09k|    ref_mb_map_t **pps_chroma_map_vert = &ps_svc_lyr_dec->ps_intsam_chroma_map_vert;
 5016|       |
 5017|  4.09k|    ps_svc_slice_params = &ps_svc_lyr_dec->s_svc_slice_params;
 5018|  4.09k|    ps_cur_subset_sps = ps_svc_lyr_dec->ps_cur_subset_sps;
 5019|       |
 5020|  4.09k|    ps_ctxt = (intra_sampling_ctxt_t *) pv_intra_samp_ctxt;
 5021|       |
 5022|       |    /* if called for base resolution store default values */
 5023|  4.09k|    if(SVCD_TRUE == ps_svc_lyr_dec->u1_base_res_flag)
  ------------------
  |  |   46|  4.09k|#define SVCD_TRUE 1
  ------------------
  |  Branch (5023:8): [True: 3.37k, False: 720]
  ------------------
 5024|  3.37k|    {
 5025|  3.37k|        *pps_luma_map_horz = NULL;
 5026|  3.37k|        *pps_chroma_map_horz = NULL;
 5027|  3.37k|        *pps_luma_map_vert = NULL;
 5028|  3.37k|        *pps_chroma_map_vert = NULL;
 5029|  3.37k|        ps_ctxt->i4_res_lyr_id = -1;
 5030|  3.37k|        ps_ctxt->i4_ref_width = ps_dec->u2_pic_wd;
 5031|  3.37k|        ps_ctxt->i4_ref_height = ps_dec->u2_pic_ht;
 5032|       |
 5033|       |        /* Note: The stride option is provided for bringing in data at NMB */
 5034|       |        /* level. Hence to set a NMB level stride refSample array buffer   */
 5035|       |        /* have to be increased                                            */
 5036|  3.37k|        ps_ctxt->i4_refarray_stride = REF_ARRAY_WIDTH;
  ------------------
  |  |   73|  3.37k|#define REF_ARRAY_WIDTH 48
  ------------------
 5037|  3.37k|        return OK;
  ------------------
  |  |  114|  3.37k|#define OK        0
  ------------------
 5038|  3.37k|    }
 5039|       |
 5040|       |    /* derive the current sps */
 5041|       |    /* store the res id appropriately */
 5042|    720|    ps_ctxt->i4_res_lyr_id = ps_svc_lyr_dec->u1_layer_id - 1;
 5043|       |
 5044|       |    /* store the resolution params */
 5045|    720|    ps_ctxt->ps_res_prms = ps_curr_lyr_res_prms;
 5046|       |
 5047|       |    /* get the current layer ctxt */
 5048|    720|    ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_svc_lyr_dec->u1_layer_id - 1];
 5049|       |
 5050|    720|    ps_ctxt->i4_res_lyr_id = ps_svc_lyr_dec->u1_layer_id - 1;
 5051|       |    /* get the width and heights */
 5052|    720|    ps_lyr_ctxt->i4_curr_width = ps_dec->u2_pic_wd;
 5053|    720|    ps_lyr_ctxt->i4_curr_height = ps_dec->u2_pic_ht;
 5054|    720|    ps_lyr_ctxt->i4_ref_width = ps_ctxt->i4_ref_width;
 5055|    720|    ps_lyr_ctxt->i4_ref_height = ps_ctxt->i4_ref_height;
 5056|    720|    ps_lyr_ctxt->i1_constrained_intra_rsmpl_flag =
 5057|    720|        ps_svc_slice_params->u1_constrained_intra_resampling_flag;
 5058|       |
 5059|       |    /* store the structure pointer containing projected locations */
 5060|    720|    *pps_luma_map_horz = ps_lyr_ctxt->s_luma_map_ctxt.ps_x_offset_length;
 5061|    720|    *pps_chroma_map_horz = ps_lyr_ctxt->s_chroma_map_ctxt.ps_x_offset_length;
 5062|    720|    *pps_luma_map_vert = ps_lyr_ctxt->s_luma_map_ctxt.ps_y_offset_length;
 5063|    720|    *pps_chroma_map_vert = ps_lyr_ctxt->s_chroma_map_ctxt.ps_y_offset_length;
 5064|       |
 5065|       |    /* check for recomputation of mapping required */
 5066|    720|    if(SVCD_TRUE == ps_curr_lyr_res_prms->u1_remap_req_flag)
  ------------------
  |  |   46|    720|#define SVCD_TRUE 1
  ------------------
  |  Branch (5066:8): [True: 720, False: 0]
  ------------------
 5067|    720|    {
 5068|    720|        res_prms_t s_ref_res_prms = {0};
 5069|    720|        WORD32 i4_chroma_x_phase, i4_chroma_y_phase;
 5070|    720|        WORD32 i4_ref_chroma_x_phase, i4_ref_chroma_y_phase;
 5071|    720|        WORD32 i4_x_phase_0, i4_x_phase_1;
 5072|    720|        WORD32 i4_y_phase_0, i4_y_phase_1;
 5073|    720|        WORD32 i4_vert_flag;
 5074|       |
 5075|       |        /* store the reference layer resolution width and height */
 5076|    720|        s_ref_res_prms.i4_res_width = ps_ctxt->i4_ref_width;
 5077|    720|        s_ref_res_prms.i4_res_height = ps_ctxt->i4_ref_height;
 5078|       |
 5079|       |        /* call the frame level projections calculation function */
 5080|    720|        isvcd_intra_resamp_populate_list(&ps_lyr_ctxt->s_luma_map_ctxt, ps_curr_lyr_res_prms,
 5081|    720|                                         &s_ref_res_prms, 0, ps_svc_lyr_dec);
 5082|       |
 5083|    720|        isvcd_intra_resamp_populate_list(&ps_lyr_ctxt->s_chroma_map_ctxt, ps_curr_lyr_res_prms,
 5084|    720|                                         &s_ref_res_prms, 1, ps_svc_lyr_dec);
 5085|       |
 5086|       |        /* Compute the chroma xPhase and yPhase values */
 5087|    720|        if(1 == ps_curr_lyr_res_prms->u1_dyadic_flag)
  ------------------
  |  Branch (5087:12): [True: 640, False: 80]
  ------------------
 5088|    640|        {
 5089|    640|            i4_ref_chroma_x_phase = ps_curr_lyr_res_prms->i1_ref_lyr_chroma_phase_x_plus1_flag;
 5090|    640|            i4_ref_chroma_y_phase = ps_curr_lyr_res_prms->i1_ref_lyr_chroma_phase_y_plus1;
 5091|    640|            i4_chroma_x_phase = ps_cur_subset_sps->s_sps_svc_ext.u1_chroma_phase_x_plus1_flag;
 5092|    640|            i4_chroma_y_phase = ps_cur_subset_sps->s_sps_svc_ext.u1_chroma_phase_y_plus1;
 5093|       |
 5094|    640|            i4_x_phase_0 = i4_chroma_x_phase - (i4_ref_chroma_x_phase << 1);
 5095|    640|            i4_x_phase_1 = (3 + i4_x_phase_0) & 0x7;
 5096|    640|            i4_x_phase_0 += 7;
 5097|    640|            i4_x_phase_0 &= 0x7;
 5098|    640|            i4_y_phase_0 = i4_chroma_y_phase - (i4_ref_chroma_y_phase << 1);
 5099|    640|            i4_y_phase_1 = (3 + i4_y_phase_0) & 0x7;
 5100|    640|            i4_y_phase_0 += 7;
 5101|    640|            i4_y_phase_0 &= 0x7;
 5102|       |
 5103|    640|            ps_lyr_ctxt->i4_x_phase_0 = i4_x_phase_0;
 5104|    640|            ps_lyr_ctxt->i4_x_phase_1 = i4_x_phase_1;
 5105|    640|            ps_lyr_ctxt->i4_y_phase_0 = i4_y_phase_0;
 5106|    640|            ps_lyr_ctxt->i4_y_phase_1 = i4_y_phase_1;
 5107|       |
 5108|       |            /* Choose the appropriate chroma interpolation functions */
 5109|    640|            if((0 == i4_ref_chroma_x_phase) && (1 == i4_chroma_x_phase))
  ------------------
  |  Branch (5109:16): [True: 596, False: 44]
  |  Branch (5109:48): [True: 0, False: 596]
  ------------------
 5110|      0|            {
 5111|      0|                ps_lyr_ctxt->pf_horz_chroma_interpol = ps_ctxt->pf_horz_chroma_interpol[1];
 5112|      0|            }
 5113|    640|            else
 5114|    640|            {
 5115|    640|                ps_lyr_ctxt->pf_horz_chroma_interpol = ps_ctxt->pf_horz_chroma_interpol[0];
 5116|    640|            }
 5117|       |
 5118|    640|            i4_vert_flag = 0;
 5119|    640|            if(0 == i4_ref_chroma_y_phase)
  ------------------
  |  Branch (5119:16): [True: 289, False: 351]
  ------------------
 5120|    289|            {
 5121|    289|                if((1 == i4_chroma_y_phase) || (2 == i4_chroma_y_phase))
  ------------------
  |  Branch (5121:20): [True: 0, False: 289]
  |  Branch (5121:48): [True: 0, False: 289]
  ------------------
 5122|      0|                {
 5123|      0|                    i4_vert_flag = 1;
 5124|      0|                }
 5125|    289|            }
 5126|    351|            else if((2 == i4_ref_chroma_y_phase) && (0 == i4_chroma_y_phase))
  ------------------
  |  Branch (5126:21): [True: 52, False: 299]
  |  Branch (5126:53): [True: 0, False: 52]
  ------------------
 5127|      0|            {
 5128|      0|                i4_vert_flag = 2;
 5129|      0|            }
 5130|       |
 5131|    640|            if(1 == i4_vert_flag)
  ------------------
  |  Branch (5131:16): [True: 0, False: 640]
  ------------------
 5132|      0|            {
 5133|      0|                ps_lyr_ctxt->pf_vert_chroma_interpol = ps_ctxt->pf_vert_chroma_interpol[1];
 5134|      0|            }
 5135|    640|            else if(2 == i4_vert_flag)
  ------------------
  |  Branch (5135:21): [True: 0, False: 640]
  ------------------
 5136|      0|            {
 5137|      0|                ps_lyr_ctxt->pf_vert_chroma_interpol = ps_ctxt->pf_vert_chroma_interpol[2];
 5138|      0|            }
 5139|    640|            else
 5140|    640|            {
 5141|    640|                ps_lyr_ctxt->pf_vert_chroma_interpol = ps_ctxt->pf_vert_chroma_interpol[0];
 5142|    640|            }
 5143|    640|        }
 5144|    720|    }
 5145|      0|    else
 5146|      0|    {
 5147|       |        /* should take false value */
 5148|      0|        if(SVCD_FALSE != ps_curr_lyr_res_prms->u1_remap_req_flag)
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
  |  Branch (5148:12): [True: 0, False: 0]
  ------------------
 5149|      0|        {
 5150|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 5151|      0|        }
 5152|      0|    }
 5153|       |
 5154|       |    /* store the current layer width and height to context */
 5155|    720|    ps_ctxt->i4_ref_width = ps_curr_lyr_res_prms->i4_res_width;
 5156|    720|    ps_ctxt->i4_ref_height = ps_curr_lyr_res_prms->i4_res_height;
 5157|       |
 5158|    720|    return OK;
  ------------------
  |  |  114|    720|#define OK        0
  ------------------
 5159|    720|}

isvcd_intra_resamp.c:isvcd_left_most_bit_detect:
   98|  5.34k|{
   99|  5.34k|    WORD32 i4_number = 0;
  100|  5.34k|    if(0xff == u4_num)
  ------------------
  |  Branch (100:8): [True: 0, False: 5.34k]
  ------------------
  101|      0|    {
  102|      0|        return 32;
  103|      0|    }
  104|       |
  105|  5.34k|    do
  106|  9.26k|    {
  107|  9.26k|        if(0 == (u4_num & 0x80000000))
  ------------------
  |  Branch (107:12): [True: 5.34k, False: 3.92k]
  ------------------
  108|  5.34k|        {
  109|  5.34k|            return i4_number;
  110|  5.34k|        }
  111|  3.92k|        u4_num <<= 1;
  112|  3.92k|        i4_number++;
  113|  3.92k|    } while(1);
  ------------------
  |  Branch (113:13): [True: 3.92k, Folded]
  ------------------
  114|  5.34k|}

isvcd_iquant_itrans_4x4:
   87|  19.1k|{
   88|  19.1k|    WORD16 *pi2_src_ptr = pi2_src;
   89|  19.1k|    WORD16 *pi2_tmp_ptr = pi2_tmp;
   90|  19.1k|    WORD16 *pi2_out_ptr = pi2_out;
   91|  19.1k|    WORD16 x0, x1, x2, x3, i;
   92|  19.1k|    WORD32 q0, q1, q2, q3;
   93|  19.1k|    WORD16 i_macro;
   94|  19.1k|    WORD16 rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
  ------------------
  |  Branch (94:23): [True: 7.14k, False: 12.0k]
  ------------------
   95|       |
   96|       |    /* inverse quant */
   97|       |    /*horizontal inverse transform */
   98|  95.9k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|  95.9k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (98:16): [True: 76.7k, False: 19.1k]
  ------------------
   99|  76.7k|    {
  100|  76.7k|        q0 = pi2_src_ptr[0];
  101|  76.7k|        INV_QUANT(q0, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  76.7k|                {\
  |  |  104|  76.7k|                    i4_value *= quant_scale;\
  |  |  105|  76.7k|                    i4_value *= weight_scale;\
  |  |  106|  76.7k|                    i4_value += rndfactor;\
  |  |  107|  76.7k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  76.7k|                    i4_value >>= qbits;\
  |  |  109|  76.7k|                }
  ------------------
  102|  76.7k|        if(i == 0 && iq_start_idx == 1)
  ------------------
  |  Branch (102:12): [True: 19.1k, False: 57.5k]
  |  Branch (102:22): [True: 0, False: 19.1k]
  ------------------
  103|      0|            q0 = pi2_dc_ld_addr[0];  // Restoring dc value for intra case
  104|       |
  105|  76.7k|        q2 = pi2_src_ptr[2];
  106|  76.7k|        INV_QUANT(q2, pu2_iscal_mat[2], pu2_weigh_mat[2], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  76.7k|                {\
  |  |  104|  76.7k|                    i4_value *= quant_scale;\
  |  |  105|  76.7k|                    i4_value *= weight_scale;\
  |  |  106|  76.7k|                    i4_value += rndfactor;\
  |  |  107|  76.7k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  76.7k|                    i4_value >>= qbits;\
  |  |  109|  76.7k|                }
  ------------------
  107|       |
  108|  76.7k|        x0 = q0 + q2;
  109|  76.7k|        x1 = q0 - q2;
  110|       |
  111|  76.7k|        q1 = pi2_src_ptr[1];
  112|  76.7k|        INV_QUANT(q1, pu2_iscal_mat[1], pu2_weigh_mat[1], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  76.7k|                {\
  |  |  104|  76.7k|                    i4_value *= quant_scale;\
  |  |  105|  76.7k|                    i4_value *= weight_scale;\
  |  |  106|  76.7k|                    i4_value += rndfactor;\
  |  |  107|  76.7k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  76.7k|                    i4_value >>= qbits;\
  |  |  109|  76.7k|                }
  ------------------
  113|       |
  114|  76.7k|        q3 = pi2_src_ptr[3];
  115|  76.7k|        INV_QUANT(q3, pu2_iscal_mat[3], pu2_weigh_mat[3], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  76.7k|                {\
  |  |  104|  76.7k|                    i4_value *= quant_scale;\
  |  |  105|  76.7k|                    i4_value *= weight_scale;\
  |  |  106|  76.7k|                    i4_value += rndfactor;\
  |  |  107|  76.7k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  76.7k|                    i4_value >>= qbits;\
  |  |  109|  76.7k|                }
  ------------------
  116|       |
  117|  76.7k|        x2 = (q1 >> 1) - q3;
  118|  76.7k|        x3 = q1 + (q3 >> 1);
  119|       |
  120|  76.7k|        pi2_tmp_ptr[0] = x0 + x3;
  121|  76.7k|        pi2_tmp_ptr[1] = x1 + x2;
  122|  76.7k|        pi2_tmp_ptr[2] = x1 - x2;
  123|  76.7k|        pi2_tmp_ptr[3] = x0 - x3;
  124|       |
  125|  76.7k|        pi2_src_ptr += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  76.7k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  126|  76.7k|        pi2_tmp_ptr += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  76.7k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  127|  76.7k|        pu2_iscal_mat += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  76.7k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  128|  76.7k|        pu2_weigh_mat += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  76.7k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  129|  76.7k|    }
  130|       |
  131|       |    /* vertical inverse transform */
  132|  19.1k|    pi2_tmp_ptr = pi2_tmp;
  133|  95.9k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|  95.9k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (133:16): [True: 76.7k, False: 19.1k]
  ------------------
  134|  76.7k|    {
  135|  76.7k|        pi2_out = pi2_out_ptr;
  136|       |
  137|  76.7k|        x0 = (pi2_tmp_ptr[0] + pi2_tmp_ptr[8]);
  138|  76.7k|        x1 = (pi2_tmp_ptr[0] - pi2_tmp_ptr[8]);
  139|  76.7k|        x2 = (pi2_tmp_ptr[4] >> 1) - pi2_tmp_ptr[12];
  140|  76.7k|        x3 = pi2_tmp_ptr[4] + (pi2_tmp_ptr[12] >> 1);
  141|       |
  142|       |        /* inverse prediction */
  143|  76.7k|        i_macro = x0 + x3;
  144|  76.7k|        *pi2_out = CLIP_RSD((i_macro + 32) >> 6);
  ------------------
  |  |  774|  76.7k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  76.7k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 4.80k, False: 71.9k]
  |  |  |  |  |  Branch (77:54): [True: 4.90k, False: 67.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  145|  76.7k|        pi2_out += out_strd;
  146|       |
  147|  76.7k|        i_macro = x1 + x2;
  148|  76.7k|        *pi2_out = CLIP_RSD((i_macro + 32) >> 6);
  ------------------
  |  |  774|  76.7k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  76.7k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 4.70k, False: 72.0k]
  |  |  |  |  |  Branch (77:54): [True: 5.08k, False: 66.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  149|  76.7k|        pi2_out += out_strd;
  150|       |
  151|  76.7k|        i_macro = x1 - x2;
  152|  76.7k|        *pi2_out = CLIP_RSD((i_macro + 32) >> 6);
  ------------------
  |  |  774|  76.7k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  76.7k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 5.11k, False: 71.6k]
  |  |  |  |  |  Branch (77:54): [True: 4.86k, False: 66.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  153|  76.7k|        pi2_out += out_strd;
  154|       |
  155|  76.7k|        i_macro = x0 - x3;
  156|  76.7k|        *pi2_out = CLIP_RSD((i_macro + 32) >> 6);
  ------------------
  |  |  774|  76.7k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  76.7k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 4.91k, False: 71.8k]
  |  |  |  |  |  Branch (77:54): [True: 4.85k, False: 67.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  157|  76.7k|        pi2_tmp_ptr++;
  158|  76.7k|        pi2_out_ptr++;
  159|  76.7k|    }
  160|  19.1k|}
isvcd_iquant_itrans_4x4_dc:
  188|  1.26k|{
  189|  1.26k|    WORD16 *pi2_out_ptr = pi2_out;
  190|  1.26k|    WORD32 q0;
  191|  1.26k|    WORD16 i_macro, i;
  192|  1.26k|    WORD16 rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
  ------------------
  |  Branch (192:23): [True: 195, False: 1.06k]
  ------------------
  193|  1.26k|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|  1.26k|#define UNUSED(x) ((void)(x))
  ------------------
  194|       |
  195|  1.26k|    if(iq_start_idx == 0)
  ------------------
  |  Branch (195:8): [True: 1.26k, False: 0]
  ------------------
  196|  1.26k|    {
  197|  1.26k|        q0 = pi2_src[0];
  198|  1.26k|        INV_QUANT(q0, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  1.26k|                {\
  |  |  104|  1.26k|                    i4_value *= quant_scale;\
  |  |  105|  1.26k|                    i4_value *= weight_scale;\
  |  |  106|  1.26k|                    i4_value += rndfactor;\
  |  |  107|  1.26k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  1.26k|                    i4_value >>= qbits;\
  |  |  109|  1.26k|                }
  ------------------
  199|  1.26k|    }
  200|      0|    else
  201|      0|    {
  202|      0|        q0 = pi2_dc_ld_addr[0];  // Restoring dc value for intra case3
  203|      0|    }
  204|  1.26k|    i_macro = CLIP_RSD((q0 + 32) >> 6);
  ------------------
  |  |  774|  1.26k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.26k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 58, False: 1.20k]
  |  |  |  |  |  Branch (77:54): [True: 85, False: 1.11k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  205|  6.31k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|  6.31k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (205:16): [True: 5.04k, False: 1.26k]
  ------------------
  206|  5.04k|    {
  207|  5.04k|        pi2_out = pi2_out_ptr;
  208|       |
  209|       |        /* inverse prediction */
  210|  5.04k|        *pi2_out = i_macro;
  211|  5.04k|        pi2_out += out_strd;
  212|  5.04k|        *pi2_out = i_macro;
  213|  5.04k|        pi2_out += out_strd;
  214|  5.04k|        *pi2_out = i_macro;
  215|  5.04k|        pi2_out += out_strd;
  216|  5.04k|        *pi2_out = i_macro;
  217|  5.04k|        pi2_out_ptr++;
  218|  5.04k|    }
  219|  1.26k|}
isvcd_iquant_itrans_chroma_4x4:
  246|  1.86k|{
  247|  1.86k|    WORD16 *pi2_src_ptr = pi2_src;
  248|  1.86k|    WORD16 *pi2_tmp_ptr = pi2_tmp;
  249|  1.86k|    WORD16 *pi2_out_ptr = pi2_out;
  250|  1.86k|    WORD16 x0, x1, x2, x3, i;
  251|  1.86k|    WORD32 q0, q1, q2, q3;
  252|  1.86k|    WORD16 i_macro;
  253|  1.86k|    WORD16 rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
  ------------------
  |  Branch (253:23): [True: 727, False: 1.14k]
  ------------------
  254|       |
  255|       |    /* inverse quant */
  256|       |    /*horizontal inverse transform */
  257|  9.34k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|  9.34k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (257:16): [True: 7.47k, False: 1.86k]
  ------------------
  258|  7.47k|    {
  259|  7.47k|        if(i == 0)
  ------------------
  |  Branch (259:12): [True: 1.86k, False: 5.60k]
  ------------------
  260|  1.86k|        {
  261|  1.86k|            q0 = pi2_dc_src[0];
  262|  1.86k|        }
  263|  5.60k|        else
  264|  5.60k|        {
  265|  5.60k|            q0 = pi2_src_ptr[0];
  266|  5.60k|            INV_QUANT(q0, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  5.60k|                {\
  |  |  104|  5.60k|                    i4_value *= quant_scale;\
  |  |  105|  5.60k|                    i4_value *= weight_scale;\
  |  |  106|  5.60k|                    i4_value += rndfactor;\
  |  |  107|  5.60k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  5.60k|                    i4_value >>= qbits;\
  |  |  109|  5.60k|                }
  ------------------
  267|  5.60k|        }
  268|       |
  269|  7.47k|        q2 = pi2_src_ptr[2];
  270|  7.47k|        INV_QUANT(q2, pu2_iscal_mat[2], pu2_weigh_mat[2], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  7.47k|                {\
  |  |  104|  7.47k|                    i4_value *= quant_scale;\
  |  |  105|  7.47k|                    i4_value *= weight_scale;\
  |  |  106|  7.47k|                    i4_value += rndfactor;\
  |  |  107|  7.47k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  7.47k|                    i4_value >>= qbits;\
  |  |  109|  7.47k|                }
  ------------------
  271|       |
  272|  7.47k|        x0 = q0 + q2;
  273|  7.47k|        x1 = q0 - q2;
  274|       |
  275|  7.47k|        q1 = pi2_src_ptr[1];
  276|  7.47k|        INV_QUANT(q1, pu2_iscal_mat[1], pu2_weigh_mat[1], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  7.47k|                {\
  |  |  104|  7.47k|                    i4_value *= quant_scale;\
  |  |  105|  7.47k|                    i4_value *= weight_scale;\
  |  |  106|  7.47k|                    i4_value += rndfactor;\
  |  |  107|  7.47k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  7.47k|                    i4_value >>= qbits;\
  |  |  109|  7.47k|                }
  ------------------
  277|       |
  278|  7.47k|        q3 = pi2_src_ptr[3];
  279|  7.47k|        INV_QUANT(q3, pu2_iscal_mat[3], pu2_weigh_mat[3], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  7.47k|                {\
  |  |  104|  7.47k|                    i4_value *= quant_scale;\
  |  |  105|  7.47k|                    i4_value *= weight_scale;\
  |  |  106|  7.47k|                    i4_value += rndfactor;\
  |  |  107|  7.47k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  7.47k|                    i4_value >>= qbits;\
  |  |  109|  7.47k|                }
  ------------------
  280|       |
  281|  7.47k|        x2 = (q1 >> 1) - q3;
  282|  7.47k|        x3 = q1 + (q3 >> 1);
  283|       |
  284|  7.47k|        pi2_tmp_ptr[0] = x0 + x3;
  285|  7.47k|        pi2_tmp_ptr[1] = x1 + x2;
  286|  7.47k|        pi2_tmp_ptr[2] = x1 - x2;
  287|  7.47k|        pi2_tmp_ptr[3] = x0 - x3;
  288|       |
  289|  7.47k|        pi2_src_ptr += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  7.47k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  290|  7.47k|        pi2_tmp_ptr += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  7.47k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  291|  7.47k|        pu2_iscal_mat += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  7.47k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  292|  7.47k|        pu2_weigh_mat += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  7.47k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  293|  7.47k|    }
  294|       |
  295|       |    /* vertical inverse transform */
  296|  1.86k|    pi2_tmp_ptr = pi2_tmp;
  297|  9.34k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|  9.34k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (297:16): [True: 7.47k, False: 1.86k]
  ------------------
  298|  7.47k|    {
  299|  7.47k|        pi2_out = pi2_out_ptr;
  300|       |
  301|  7.47k|        x0 = (pi2_tmp_ptr[0] + pi2_tmp_ptr[8]);
  302|  7.47k|        x1 = (pi2_tmp_ptr[0] - pi2_tmp_ptr[8]);
  303|  7.47k|        x2 = (pi2_tmp_ptr[4] >> 1) - pi2_tmp_ptr[12];
  304|  7.47k|        x3 = pi2_tmp_ptr[4] + (pi2_tmp_ptr[12] >> 1);
  305|       |
  306|       |        /* inverse prediction */
  307|  7.47k|        i_macro = x0 + x3;
  308|  7.47k|        *pi2_out = CLIP_RSD((i_macro + 32) >> 6);
  ------------------
  |  |  774|  7.47k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  7.47k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 450, False: 7.02k]
  |  |  |  |  |  Branch (77:54): [True: 437, False: 6.58k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  309|  7.47k|        pi2_out += out_strd;
  310|       |
  311|  7.47k|        i_macro = x1 + x2;
  312|  7.47k|        *pi2_out = CLIP_RSD((i_macro + 32) >> 6);
  ------------------
  |  |  774|  7.47k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  7.47k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 401, False: 7.07k]
  |  |  |  |  |  Branch (77:54): [True: 309, False: 6.76k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  313|  7.47k|        pi2_out += out_strd;
  314|       |
  315|  7.47k|        i_macro = x1 - x2;
  316|  7.47k|        *pi2_out = CLIP_RSD((i_macro + 32) >> 6);
  ------------------
  |  |  774|  7.47k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  7.47k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 368, False: 7.10k]
  |  |  |  |  |  Branch (77:54): [True: 425, False: 6.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  317|  7.47k|        pi2_out += out_strd;
  318|       |
  319|  7.47k|        i_macro = x0 - x3;
  320|  7.47k|        *pi2_out = CLIP_RSD((i_macro + 32) >> 6);
  ------------------
  |  |  774|  7.47k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  7.47k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 464, False: 7.01k]
  |  |  |  |  |  Branch (77:54): [True: 470, False: 6.54k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  321|  7.47k|        pi2_tmp_ptr++;
  322|  7.47k|        pi2_out_ptr += 2;  // Interleaved store for output
  323|  7.47k|    }
  324|  1.86k|}
isvcd_iquant_itrans_chroma_4x4_dc:
  351|  4.98k|{
  352|  4.98k|    WORD16 *pi2_out_ptr = pi2_out;
  353|  4.98k|    WORD32 q0;
  354|  4.98k|    WORD16 i_macro, i;
  355|  4.98k|    UNUSED(pi2_src);
  ------------------
  |  |   45|  4.98k|#define UNUSED(x) ((void)(x))
  ------------------
  356|  4.98k|    UNUSED(pu2_iscal_mat);
  ------------------
  |  |   45|  4.98k|#define UNUSED(x) ((void)(x))
  ------------------
  357|  4.98k|    UNUSED(pu2_weigh_mat);
  ------------------
  |  |   45|  4.98k|#define UNUSED(x) ((void)(x))
  ------------------
  358|  4.98k|    UNUSED(u4_qp_div_6);
  ------------------
  |  |   45|  4.98k|#define UNUSED(x) ((void)(x))
  ------------------
  359|  4.98k|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|  4.98k|#define UNUSED(x) ((void)(x))
  ------------------
  360|       |
  361|  4.98k|    q0 = pi2_dc_src[0];  // Restoring dc value for intra case3
  362|  4.98k|    i_macro = CLIP_RSD((q0 + 32) >> 6);
  ------------------
  |  |  774|  4.98k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  4.98k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 73, False: 4.90k]
  |  |  |  |  |  Branch (77:54): [True: 53, False: 4.85k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  363|       |
  364|  24.9k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|  24.9k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (364:16): [True: 19.9k, False: 4.98k]
  ------------------
  365|  19.9k|    {
  366|  19.9k|        pi2_out = pi2_out_ptr;
  367|       |
  368|       |        /* inverse prediction */
  369|  19.9k|        *pi2_out = i_macro;
  370|  19.9k|        pi2_out += out_strd;
  371|       |
  372|  19.9k|        *pi2_out = i_macro;
  373|  19.9k|        pi2_out += out_strd;
  374|       |
  375|  19.9k|        *pi2_out = i_macro;
  376|  19.9k|        pi2_out += out_strd;
  377|       |
  378|  19.9k|        *pi2_out = i_macro;
  379|       |
  380|  19.9k|        pi2_out_ptr += 2;
  381|  19.9k|    }
  382|  4.98k|}
isvcd_iquant_itrans_8x8_dc:
  440|    522|{
  441|    522|    WORD16 *pi2_out_ptr = pi2_out;
  442|    522|    WORD16 i, i_macro;
  443|    522|    WORD32 q;
  444|    522|    WORD32 rnd_fact = (qp_div < 6) ? (1 << (5 - qp_div)) : 0;
  ------------------
  |  Branch (444:23): [True: 386, False: 136]
  ------------------
  445|    522|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|    522|#define UNUSED(x) ((void)(x))
  ------------------
  446|    522|    UNUSED(iq_start_idx);
  ------------------
  |  |   45|    522|#define UNUSED(x) ((void)(x))
  ------------------
  447|    522|    UNUSED(pi2_dc_ld_addr);
  ------------------
  |  |   45|    522|#define UNUSED(x) ((void)(x))
  ------------------
  448|       |    /*************************************************************/
  449|       |    /* Dequantization of coefficients. Will be replaced by SIMD  */
  450|       |    /* operations on platform. Note : DC coeff is not scaled     */
  451|       |    /*************************************************************/
  452|    522|    q = pi2_src[0];
  453|    522|    INV_QUANT(q, pu2_iscale_mat[0], pu2_weigh_mat[0], qp_div, rnd_fact, 6);
  ------------------
  |  |  103|    522|                {\
  |  |  104|    522|                    i4_value *= quant_scale;\
  |  |  105|    522|                    i4_value *= weight_scale;\
  |  |  106|    522|                    i4_value += rndfactor;\
  |  |  107|    522|                    i4_value <<= u4_qp_div_6;\
  |  |  108|    522|                    i4_value >>= qbits;\
  |  |  109|    522|                }
  ------------------
  454|    522|    i_macro = CLIP_RSD((q + 32) >> 6);
  ------------------
  |  |  774|    522|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|    522|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 24, False: 498]
  |  |  |  |  |  Branch (77:54): [True: 21, False: 477]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  455|       |    /* Perform Inverse transform */
  456|       |    /*--------------------------------------------------------------------*/
  457|       |    /* IDCT [ Horizontal transformation ]                                 */
  458|       |    /*--------------------------------------------------------------------*/
  459|       |    /*--------------------------------------------------------------------*/
  460|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6            */
  461|       |    /*                                                                    */
  462|       |    /* Add the prediction and store it back to reconstructed frame buffer */
  463|       |    /* [Prediction buffer itself in this case]                            */
  464|       |    /*--------------------------------------------------------------------*/
  465|  4.69k|    for(i = 0; i < SUB_BLK_WIDTH_8x8; i++)
  ------------------
  |  |   53|  4.69k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  |  Branch (465:16): [True: 4.17k, False: 522]
  ------------------
  466|  4.17k|    {
  467|  4.17k|        pi2_out = pi2_out_ptr;
  468|       |
  469|  4.17k|        *pi2_out = i_macro;
  470|       |        /* Change uc_recBuffer to Point to next element in the same column*/
  471|  4.17k|        pi2_out += out_strd;
  472|       |
  473|  4.17k|        *pi2_out = i_macro;
  474|  4.17k|        pi2_out += out_strd;
  475|       |
  476|  4.17k|        *pi2_out = i_macro;
  477|  4.17k|        pi2_out += out_strd;
  478|       |
  479|  4.17k|        *pi2_out = i_macro;
  480|  4.17k|        pi2_out += out_strd;
  481|       |
  482|  4.17k|        *pi2_out = i_macro;
  483|  4.17k|        pi2_out += out_strd;
  484|       |
  485|  4.17k|        *pi2_out = i_macro;
  486|  4.17k|        pi2_out += out_strd;
  487|       |
  488|  4.17k|        *pi2_out = i_macro;
  489|  4.17k|        pi2_out += out_strd;
  490|       |
  491|  4.17k|        *pi2_out = i_macro;
  492|       |
  493|  4.17k|        pi2_out_ptr++;
  494|  4.17k|    }
  495|    522|}
isvcd_iquant_itrans_8x8:
  523|  6.64k|{
  524|  6.64k|    WORD32 i;
  525|  6.64k|    WORD16 *pi2_tmp_ptr = pi2_tmp;
  526|  6.64k|    WORD16 *pi2_out_ptr = pi2_out;
  527|  6.64k|    WORD16 i_z0, i_z1, i_z2, i_z3, i_z4, i_z5, i_z6, i_z7;
  528|  6.64k|    WORD16 i_y0, i_y1, i_y2, i_y3, i_y4, i_y5, i_y6, i_y7;
  529|  6.64k|    WORD32 q;
  530|  6.64k|    WORD32 rnd_fact = (qp_div < 6) ? (1 << (5 - qp_div)) : 0;
  ------------------
  |  Branch (530:23): [True: 5.59k, False: 1.05k]
  ------------------
  531|  6.64k|    UNUSED(iq_start_idx);
  ------------------
  |  |   45|  6.64k|#define UNUSED(x) ((void)(x))
  ------------------
  532|  6.64k|    UNUSED(pi2_dc_ld_addr);
  ------------------
  |  |   45|  6.64k|#define UNUSED(x) ((void)(x))
  ------------------
  533|       |    /*************************************************************/
  534|       |    /* De quantization of coefficients. Will be replaced by SIMD */
  535|       |    /* operations on platform. Note : DC coeff is not scaled     */
  536|       |    /*************************************************************/
  537|   432k|    for(i = 0; i < (SUB_BLK_WIDTH_8x8 * SUB_BLK_WIDTH_8x8); i++)
  ------------------
  |  |   53|   432k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
                  for(i = 0; i < (SUB_BLK_WIDTH_8x8 * SUB_BLK_WIDTH_8x8); i++)
  ------------------
  |  |   53|   432k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  |  Branch (537:16): [True: 425k, False: 6.64k]
  ------------------
  538|   425k|    {
  539|   425k|        q = pi2_src[i];
  540|   425k|        INV_QUANT(q, pu2_iscale_mat[i], pu2_weigh_mat[i], qp_div, rnd_fact, 6);
  ------------------
  |  |  103|   425k|                {\
  |  |  104|   425k|                    i4_value *= quant_scale;\
  |  |  105|   425k|                    i4_value *= weight_scale;\
  |  |  106|   425k|                    i4_value += rndfactor;\
  |  |  107|   425k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|   425k|                    i4_value >>= qbits;\
  |  |  109|   425k|                }
  ------------------
  541|   425k|        pi2_tmp_ptr[i] = q;
  542|   425k|    }
  543|       |    /* Perform Inverse transform */
  544|       |    /*--------------------------------------------------------------------*/
  545|       |    /* IDCT [ Horizontal transformation ]                                 */
  546|       |    /*--------------------------------------------------------------------*/
  547|  59.8k|    for(i = 0; i < SUB_BLK_WIDTH_8x8; i++)
  ------------------
  |  |   53|  59.8k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  |  Branch (547:16): [True: 53.1k, False: 6.64k]
  ------------------
  548|  53.1k|    {
  549|       |        /*------------------------------------------------------------------*/
  550|       |        /* y0 = w0 + w4                                                     */
  551|       |        /* y1 = -w3 + w5 - w7 - (w7 >> 1)                                   */
  552|       |        /* y2 = w0 - w4                                                     */
  553|       |        /* y3 = w1 + w7 - w3 - (w3 >> 1)                                    */
  554|       |        /* y4 = (w2 >> 1) - w6                                              */
  555|       |        /* y5 = -w1 + w7 + w5 + (w5 >> 1)                                   */
  556|       |        /* y6 = w2 + (w6 >> 1)                                              */
  557|       |        /* y7 = w3 + w5 + w1 + (w1 >> 1)                                    */
  558|       |        /*------------------------------------------------------------------*/
  559|  53.1k|        i_y0 = (pi2_tmp_ptr[0] + pi2_tmp_ptr[4]);
  560|       |
  561|  53.1k|        i_y1 =
  562|  53.1k|            ((WORD32) (-pi2_tmp_ptr[3]) + pi2_tmp_ptr[5] - pi2_tmp_ptr[7] - (pi2_tmp_ptr[7] >> 1));
  563|       |
  564|  53.1k|        i_y2 = (pi2_tmp_ptr[0] - pi2_tmp_ptr[4]);
  565|       |
  566|  53.1k|        i_y3 = ((WORD32) pi2_tmp_ptr[1] + pi2_tmp_ptr[7] - pi2_tmp_ptr[3] - (pi2_tmp_ptr[3] >> 1));
  567|       |
  568|  53.1k|        i_y4 = ((pi2_tmp_ptr[2] >> 1) - pi2_tmp_ptr[6]);
  569|       |
  570|  53.1k|        i_y5 =
  571|  53.1k|            ((WORD32) (-pi2_tmp_ptr[1]) + pi2_tmp_ptr[7] + pi2_tmp_ptr[5] + (pi2_tmp_ptr[5] >> 1));
  572|       |
  573|  53.1k|        i_y6 = (pi2_tmp_ptr[2] + (pi2_tmp_ptr[6] >> 1));
  574|       |
  575|  53.1k|        i_y7 = ((WORD32) pi2_tmp_ptr[3] + pi2_tmp_ptr[5] + pi2_tmp_ptr[1] + (pi2_tmp_ptr[1] >> 1));
  576|       |
  577|       |        /*------------------------------------------------------------------*/
  578|       |        /* z0 = y0 + y6                                                     */
  579|       |        /* z1 = y1 + (y7 >> 2)                                              */
  580|       |        /* z2 = y2 + y4                                                     */
  581|       |        /* z3 = y3 + (y5 >> 2)                                              */
  582|       |        /* z4 = y2 - y4                                                     */
  583|       |        /* z5 = (y3 >> 2) - y5                                              */
  584|       |        /* z6 = y0 - y6                                                     */
  585|       |        /* z7 = y7 - (y1 >> 2)                                              */
  586|       |        /*------------------------------------------------------------------*/
  587|  53.1k|        i_z0 = i_y0 + i_y6;
  588|  53.1k|        i_z1 = i_y1 + (i_y7 >> 2);
  589|  53.1k|        i_z2 = i_y2 + i_y4;
  590|  53.1k|        i_z3 = i_y3 + (i_y5 >> 2);
  591|  53.1k|        i_z4 = i_y2 - i_y4;
  592|  53.1k|        i_z5 = (i_y3 >> 2) - i_y5;
  593|  53.1k|        i_z6 = i_y0 - i_y6;
  594|  53.1k|        i_z7 = i_y7 - (i_y1 >> 2);
  595|       |
  596|       |        /*------------------------------------------------------------------*/
  597|       |        /* x0 = z0 + z7                                                     */
  598|       |        /* x1 = z2 + z5                                                     */
  599|       |        /* x2 = z4 + z3                                                     */
  600|       |        /* x3 = z6 + z1                                                     */
  601|       |        /* x4 = z6 - z1                                                     */
  602|       |        /* x5 = z4 - z3                                                     */
  603|       |        /* x6 = z2 - z5                                                     */
  604|       |        /* x7 = z0 - z7                                                     */
  605|       |        /*------------------------------------------------------------------*/
  606|  53.1k|        pi2_tmp_ptr[0] = i_z0 + i_z7;
  607|  53.1k|        pi2_tmp_ptr[1] = i_z2 + i_z5;
  608|  53.1k|        pi2_tmp_ptr[2] = i_z4 + i_z3;
  609|  53.1k|        pi2_tmp_ptr[3] = i_z6 + i_z1;
  610|  53.1k|        pi2_tmp_ptr[4] = i_z6 - i_z1;
  611|  53.1k|        pi2_tmp_ptr[5] = i_z4 - i_z3;
  612|  53.1k|        pi2_tmp_ptr[6] = i_z2 - i_z5;
  613|  53.1k|        pi2_tmp_ptr[7] = i_z0 - i_z7;
  614|       |
  615|       |        /* move to the next row */
  616|       |        // pi2_src_ptr += SUB_BLK_WIDTH_8x8;
  617|  53.1k|        pi2_tmp_ptr += SUB_BLK_WIDTH_8x8;
  ------------------
  |  |   53|  53.1k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  618|  53.1k|    }
  619|       |    /*--------------------------------------------------------------------*/
  620|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6            */
  621|       |    /*                                                                    */
  622|       |    /* Add the prediction and store it back to reconstructed frame buffer */
  623|       |    /* [Prediction buffer itself in this case]                            */
  624|       |    /*--------------------------------------------------------------------*/
  625|       |
  626|  6.64k|    pi2_tmp_ptr = pi2_tmp;
  627|  59.8k|    for(i = 0; i < SUB_BLK_WIDTH_8x8; i++)
  ------------------
  |  |   53|  59.8k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  |  Branch (627:16): [True: 53.1k, False: 6.64k]
  ------------------
  628|  53.1k|    {
  629|  53.1k|        pi2_out = pi2_out_ptr;
  630|       |        /*------------------------------------------------------------------*/
  631|       |        /* y0j = w0j + w4j                                                  */
  632|       |        /* y1j = -w3j + w5j -w7j -(w7j >> 1)                                */
  633|       |        /* y2j = w0j -w4j                                                   */
  634|       |        /* y3j = w1j + w7j -w3j -(w3j >> 1)                                 */
  635|       |        /* y4j = ( w2j >> 1 ) -w6j                                          */
  636|       |        /* y5j = -w1j + w7j + w5j + (w5j >> 1)                              */
  637|       |        /* y6j = w2j + ( w6j >> 1 )                                         */
  638|       |        /* y7j = w3j + w5j + w1j + (w1j >> 1)                               */
  639|       |        /*------------------------------------------------------------------*/
  640|  53.1k|        i_y0 = pi2_tmp_ptr[0] + pi2_tmp_ptr[32];
  641|       |
  642|  53.1k|        i_y1 = (WORD32) (-pi2_tmp_ptr[24]) + pi2_tmp_ptr[40] - pi2_tmp_ptr[56] -
  643|  53.1k|               (pi2_tmp_ptr[56] >> 1);
  644|       |
  645|  53.1k|        i_y2 = pi2_tmp_ptr[0] - pi2_tmp_ptr[32];
  646|       |
  647|  53.1k|        i_y3 = (WORD32) pi2_tmp_ptr[8] + pi2_tmp_ptr[56] - pi2_tmp_ptr[24] - (pi2_tmp_ptr[24] >> 1);
  648|       |
  649|  53.1k|        i_y4 = (pi2_tmp_ptr[16] >> 1) - pi2_tmp_ptr[48];
  650|       |
  651|  53.1k|        i_y5 =
  652|  53.1k|            (WORD32) (-pi2_tmp_ptr[8]) + pi2_tmp_ptr[56] + pi2_tmp_ptr[40] + (pi2_tmp_ptr[40] >> 1);
  653|       |
  654|  53.1k|        i_y6 = pi2_tmp_ptr[16] + (pi2_tmp_ptr[48] >> 1);
  655|       |
  656|  53.1k|        i_y7 = (WORD32) pi2_tmp_ptr[24] + pi2_tmp_ptr[40] + pi2_tmp_ptr[8] + (pi2_tmp_ptr[8] >> 1);
  657|       |
  658|       |        /*------------------------------------------------------------------*/
  659|       |        /* z0j = y0j + y6j                                                  */
  660|       |        /* z1j = y1j + (y7j >> 2)                                           */
  661|       |        /* z2j = y2j + y4j                                                  */
  662|       |        /* z3j = y3j + (y5j >> 2)                                           */
  663|       |        /* z4j = y2j -y4j                                                   */
  664|       |        /* z5j = (y3j >> 2) -y5j                                            */
  665|       |        /* z6j = y0j -y6j                                                   */
  666|       |        /* z7j = y7j -(y1j >> 2)                                            */
  667|       |        /*------------------------------------------------------------------*/
  668|  53.1k|        i_z0 = i_y0 + i_y6;
  669|  53.1k|        i_z1 = i_y1 + (i_y7 >> 2);
  670|  53.1k|        i_z2 = i_y2 + i_y4;
  671|  53.1k|        i_z3 = i_y3 + (i_y5 >> 2);
  672|  53.1k|        i_z4 = i_y2 - i_y4;
  673|  53.1k|        i_z5 = (i_y3 >> 2) - i_y5;
  674|  53.1k|        i_z6 = i_y0 - i_y6;
  675|  53.1k|        i_z7 = i_y7 - (i_y1 >> 2);
  676|       |
  677|       |        /*------------------------------------------------------------------*/
  678|       |        /* x0j = z0j + z7j                                                  */
  679|       |        /* x1j = z2j + z5j                                                  */
  680|       |        /* x2j = z4j + z3j                                                  */
  681|       |        /* x3j = z6j + z1j                                                  */
  682|       |        /* x4j = z6j -z1j                                                   */
  683|       |        /* x5j = z4j -z3j                                                   */
  684|       |        /* x6j = z2j -z5j                                                   */
  685|       |        /* x7j = z0j -z7j                                                   */
  686|       |        /*------------------------------------------------------------------*/
  687|  53.1k|        *pi2_out = CLIP_RSD((i_z0 + i_z7 + 32) >> 6);
  ------------------
  |  |  774|  53.1k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  53.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 4.84k, False: 48.3k]
  |  |  |  |  |  Branch (77:54): [True: 4.97k, False: 43.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  688|       |        /* Change uc_recBuffer to Point to next element in the same column*/
  689|  53.1k|        pi2_out += out_strd;
  690|       |
  691|  53.1k|        *pi2_out = CLIP_RSD((i_z2 + i_z5 + 32) >> 6);
  ------------------
  |  |  774|  53.1k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  53.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 3.83k, False: 49.3k]
  |  |  |  |  |  Branch (77:54): [True: 4.34k, False: 45.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  692|  53.1k|        pi2_out += out_strd;
  693|       |
  694|  53.1k|        *pi2_out = CLIP_RSD((i_z4 + i_z3 + 32) >> 6);
  ------------------
  |  |  774|  53.1k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  53.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 4.18k, False: 49.0k]
  |  |  |  |  |  Branch (77:54): [True: 4.21k, False: 44.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  695|  53.1k|        pi2_out += out_strd;
  696|       |
  697|  53.1k|        *pi2_out = CLIP_RSD((i_z6 + i_z1 + 32) >> 6);
  ------------------
  |  |  774|  53.1k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  53.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 4.07k, False: 49.1k]
  |  |  |  |  |  Branch (77:54): [True: 3.86k, False: 45.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  698|  53.1k|        pi2_out += out_strd;
  699|       |
  700|  53.1k|        *pi2_out = CLIP_RSD((i_z6 - i_z1 + 32) >> 6);
  ------------------
  |  |  774|  53.1k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  53.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 3.99k, False: 49.1k]
  |  |  |  |  |  Branch (77:54): [True: 3.71k, False: 45.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  701|  53.1k|        pi2_out += out_strd;
  702|       |
  703|  53.1k|        *pi2_out = CLIP_RSD((i_z4 - i_z3 + 32) >> 6);
  ------------------
  |  |  774|  53.1k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  53.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 4.09k, False: 49.0k]
  |  |  |  |  |  Branch (77:54): [True: 4.05k, False: 45.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  704|  53.1k|        pi2_out += out_strd;
  705|       |
  706|  53.1k|        *pi2_out = CLIP_RSD((i_z2 - i_z5 + 32) >> 6);
  ------------------
  |  |  774|  53.1k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  53.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 4.37k, False: 48.8k]
  |  |  |  |  |  Branch (77:54): [True: 3.86k, False: 44.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  707|  53.1k|        pi2_out += out_strd;
  708|       |
  709|  53.1k|        *pi2_out = CLIP_RSD((i_z0 - i_z7 + 32) >> 6);
  ------------------
  |  |  774|  53.1k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  53.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 5.01k, False: 48.1k]
  |  |  |  |  |  Branch (77:54): [True: 4.72k, False: 43.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  710|       |
  711|  53.1k|        pi2_tmp_ptr++;
  712|  53.1k|        pi2_out_ptr++;
  713|  53.1k|    }
  714|  6.64k|}

isvcd_iquant_itrans_residual_recon_4x4:
   86|  22.5k|{
   87|  22.5k|    WORD32 i4_nnz = 0;
   88|  22.5k|    WORD16 *pi2_src_ptr = pi2_src;
   89|  22.5k|    WORD16 *pi2_tmp_ptr = pi2_tmp;
   90|  22.5k|    UWORD8 *pu1_pred_ptr = pu1_pred;
   91|  22.5k|    WORD16 *pi2_rsd_ptr = pi2_rsd;
   92|  22.5k|    UWORD8 *pu1_out_ptr = pu1_out;
   93|  22.5k|    WORD16 x0, x1, x2, x3, i;
   94|  22.5k|    WORD32 q0, q1, q2, q3;
   95|  22.5k|    WORD16 i_macro;
   96|  22.5k|    WORD16 rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
  ------------------
  |  Branch (96:23): [True: 17.9k, False: 4.55k]
  ------------------
   97|       |
   98|       |    /* inverse quant */
   99|       |    /*horizontal inverse transform */
  100|   112k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|   112k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (100:16): [True: 90.1k, False: 22.5k]
  ------------------
  101|  90.1k|    {
  102|  90.1k|        q0 = pi2_src_ptr[0];
  103|  90.1k|        INV_QUANT(q0, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  90.1k|                {\
  |  |  104|  90.1k|                    i4_value *= quant_scale;\
  |  |  105|  90.1k|                    i4_value *= weight_scale;\
  |  |  106|  90.1k|                    i4_value += rndfactor;\
  |  |  107|  90.1k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  90.1k|                    i4_value >>= qbits;\
  |  |  109|  90.1k|                }
  ------------------
  104|  90.1k|        if(i == 0 && iq_start_idx == 1)
  ------------------
  |  Branch (104:12): [True: 22.5k, False: 67.5k]
  |  Branch (104:22): [True: 0, False: 22.5k]
  ------------------
  105|      0|            q0 = pi2_dc_ld_addr[0];  // Restoring dc value for intra case
  106|       |
  107|  90.1k|        q2 = pi2_src_ptr[2];
  108|  90.1k|        INV_QUANT(q2, pu2_iscal_mat[2], pu2_weigh_mat[2], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  90.1k|                {\
  |  |  104|  90.1k|                    i4_value *= quant_scale;\
  |  |  105|  90.1k|                    i4_value *= weight_scale;\
  |  |  106|  90.1k|                    i4_value += rndfactor;\
  |  |  107|  90.1k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  90.1k|                    i4_value >>= qbits;\
  |  |  109|  90.1k|                }
  ------------------
  109|       |
  110|  90.1k|        x0 = q0 + q2;
  111|  90.1k|        x1 = q0 - q2;
  112|       |
  113|  90.1k|        q1 = pi2_src_ptr[1];
  114|  90.1k|        INV_QUANT(q1, pu2_iscal_mat[1], pu2_weigh_mat[1], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  90.1k|                {\
  |  |  104|  90.1k|                    i4_value *= quant_scale;\
  |  |  105|  90.1k|                    i4_value *= weight_scale;\
  |  |  106|  90.1k|                    i4_value += rndfactor;\
  |  |  107|  90.1k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  90.1k|                    i4_value >>= qbits;\
  |  |  109|  90.1k|                }
  ------------------
  115|       |
  116|  90.1k|        q3 = pi2_src_ptr[3];
  117|  90.1k|        INV_QUANT(q3, pu2_iscal_mat[3], pu2_weigh_mat[3], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  90.1k|                {\
  |  |  104|  90.1k|                    i4_value *= quant_scale;\
  |  |  105|  90.1k|                    i4_value *= weight_scale;\
  |  |  106|  90.1k|                    i4_value += rndfactor;\
  |  |  107|  90.1k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  90.1k|                    i4_value >>= qbits;\
  |  |  109|  90.1k|                }
  ------------------
  118|       |
  119|  90.1k|        x2 = (q1 >> 1) - q3;
  120|  90.1k|        x3 = q1 + (q3 >> 1);
  121|       |
  122|  90.1k|        pi2_tmp_ptr[0] = x0 + x3;
  123|  90.1k|        pi2_tmp_ptr[1] = x1 + x2;
  124|  90.1k|        pi2_tmp_ptr[2] = x1 - x2;
  125|  90.1k|        pi2_tmp_ptr[3] = x0 - x3;
  126|       |
  127|  90.1k|        pi2_src_ptr += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  90.1k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  128|  90.1k|        pi2_tmp_ptr += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  90.1k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  129|  90.1k|        pu2_iscal_mat += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  90.1k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  130|  90.1k|        pu2_weigh_mat += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  90.1k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  131|  90.1k|    }
  132|       |
  133|       |    /* vertical inverse transform */
  134|  22.5k|    pi2_tmp_ptr = pi2_tmp;
  135|   112k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|   112k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (135:16): [True: 90.1k, False: 22.5k]
  ------------------
  136|  90.1k|    {
  137|  90.1k|        pu1_pred_ptr = pu1_pred;
  138|  90.1k|        pi2_rsd_ptr = pi2_rsd;
  139|  90.1k|        pu1_out = pu1_out_ptr;
  140|       |
  141|  90.1k|        x0 = (pi2_tmp_ptr[0] + pi2_tmp_ptr[8]);
  142|  90.1k|        x1 = (pi2_tmp_ptr[0] - pi2_tmp_ptr[8]);
  143|  90.1k|        x2 = (pi2_tmp_ptr[4] >> 1) - pi2_tmp_ptr[12];
  144|  90.1k|        x3 = pi2_tmp_ptr[4] + (pi2_tmp_ptr[12] >> 1);
  145|       |
  146|       |        /* inverse prediction */
  147|  90.1k|        i_macro = x0 + x3;
  148|  90.1k|        i_macro = ((i_macro + 32) >> 6);
  149|  90.1k|        i_macro = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  90.1k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  90.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 67, False: 90.0k]
  |  |  |  |  |  Branch (77:54): [True: 114, False: 89.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  150|  90.1k|        i4_nnz |= !!i_macro;
  151|  90.1k|        i_macro += *pu1_pred_ptr;
  152|  90.1k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|  90.1k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  90.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 33.8k, False: 56.2k]
  |  |  |  |  |  Branch (77:54): [True: 134, False: 56.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  153|  90.1k|        pu1_pred_ptr += pred_strd;
  154|  90.1k|        pi2_rsd_ptr += rsd_strd;
  155|  90.1k|        pu1_out += out_strd;
  156|       |
  157|  90.1k|        i_macro = x1 + x2;
  158|  90.1k|        i_macro = ((i_macro + 32) >> 6);
  159|  90.1k|        i_macro = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  90.1k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  90.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 99, False: 90.0k]
  |  |  |  |  |  Branch (77:54): [True: 157, False: 89.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  160|  90.1k|        i4_nnz |= !!i_macro;
  161|  90.1k|        i_macro += *pu1_pred_ptr;
  162|  90.1k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|  90.1k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  90.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 35.4k, False: 54.6k]
  |  |  |  |  |  Branch (77:54): [True: 155, False: 54.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  163|  90.1k|        pu1_pred_ptr += pred_strd;
  164|  90.1k|        pi2_rsd_ptr += rsd_strd;
  165|  90.1k|        pu1_out += out_strd;
  166|       |
  167|  90.1k|        i_macro = x1 - x2;
  168|  90.1k|        i_macro = ((i_macro + 32) >> 6);
  169|  90.1k|        i_macro = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  90.1k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  90.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 133, False: 89.9k]
  |  |  |  |  |  Branch (77:54): [True: 112, False: 89.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  170|  90.1k|        i4_nnz |= !!i_macro;
  171|  90.1k|        i_macro += *pu1_pred_ptr;
  172|  90.1k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|  90.1k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  90.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 34.8k, False: 55.2k]
  |  |  |  |  |  Branch (77:54): [True: 112, False: 55.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  173|  90.1k|        pu1_pred_ptr += pred_strd;
  174|  90.1k|        pi2_rsd_ptr += rsd_strd;
  175|  90.1k|        pu1_out += out_strd;
  176|       |
  177|  90.1k|        i_macro = x0 - x3;
  178|  90.1k|        i_macro = ((i_macro + 32) >> 6);
  179|  90.1k|        i4_nnz |= !!i_macro;
  180|  90.1k|        i_macro = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  90.1k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  90.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 99, False: 90.0k]
  |  |  |  |  |  Branch (77:54): [True: 124, False: 89.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  181|  90.1k|        i_macro += *pu1_pred_ptr;
  182|  90.1k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|  90.1k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  90.1k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 34.5k, False: 55.6k]
  |  |  |  |  |  Branch (77:54): [True: 133, False: 55.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  183|       |
  184|  90.1k|        pi2_tmp_ptr++;
  185|  90.1k|        pu1_out_ptr++;
  186|  90.1k|        pi2_rsd++;
  187|  90.1k|        pu1_pred++;
  188|  90.1k|    }
  189|  22.5k|    return i4_nnz;
  190|  22.5k|}
isvcd_iquant_itrans_residual_recon_4x4_dc:
  221|    144|{
  222|    144|    WORD32 i4_nnz = 0;
  223|    144|    UWORD8 *pu1_pred_ptr = pu1_pred;
  224|    144|    WORD16 *pi2_rsd_ptr = pi2_rsd;
  225|    144|    UWORD8 *pu1_out_ptr = pu1_out;
  226|    144|    WORD32 q0;
  227|    144|    WORD16 x, i_macro, i;
  228|    144|    WORD16 rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
  ------------------
  |  Branch (228:23): [True: 70, False: 74]
  ------------------
  229|    144|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|    144|#define UNUSED(x) ((void)(x))
  ------------------
  230|       |
  231|    144|    if(iq_start_idx == 0)
  ------------------
  |  Branch (231:8): [True: 144, False: 0]
  ------------------
  232|    144|    {
  233|    144|        q0 = pi2_src[0];
  234|    144|        INV_QUANT(q0, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|    144|                {\
  |  |  104|    144|                    i4_value *= quant_scale;\
  |  |  105|    144|                    i4_value *= weight_scale;\
  |  |  106|    144|                    i4_value += rndfactor;\
  |  |  107|    144|                    i4_value <<= u4_qp_div_6;\
  |  |  108|    144|                    i4_value >>= qbits;\
  |  |  109|    144|                }
  ------------------
  235|    144|    }
  236|      0|    else
  237|      0|    {
  238|      0|        q0 = pi2_dc_ld_addr[0];  // Restoring dc value for intra case3
  239|      0|    }
  240|    144|    i_macro = ((q0 + 32) >> 6);
  241|    720|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|    720|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (241:16): [True: 576, False: 144]
  ------------------
  242|    576|    {
  243|    576|        pu1_pred_ptr = pu1_pred;
  244|    576|        pi2_rsd_ptr = pi2_rsd;
  245|    576|        pu1_out = pu1_out_ptr;
  246|       |
  247|       |        /* inverse prediction */
  248|    576|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|    576|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|    576|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 576]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 576]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  249|    576|        i4_nnz |= !!x;
  250|    576|        x += *pu1_pred_ptr;
  251|    576|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|    576|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|    576|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 175, False: 401]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 401]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  252|    576|        pu1_pred_ptr += pred_strd;
  253|    576|        pi2_rsd_ptr += rsd_strd;
  254|    576|        pu1_out += out_strd;
  255|       |
  256|    576|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|    576|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|    576|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 576]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 576]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  257|    576|        i4_nnz |= !!x;
  258|    576|        x += *pu1_pred_ptr;
  259|    576|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|    576|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|    576|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 175, False: 401]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 401]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  260|    576|        pu1_pred_ptr += pred_strd;
  261|    576|        pi2_rsd_ptr += rsd_strd;
  262|    576|        pu1_out += out_strd;
  263|       |
  264|    576|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|    576|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|    576|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 576]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 576]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  265|    576|        i4_nnz |= !!x;
  266|    576|        x += *pu1_pred_ptr;
  267|    576|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|    576|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|    576|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 177, False: 399]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 399]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  268|    576|        pu1_pred_ptr += pred_strd;
  269|    576|        pi2_rsd_ptr += rsd_strd;
  270|    576|        pu1_out += out_strd;
  271|       |
  272|    576|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|    576|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|    576|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 576]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 576]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  273|    576|        i4_nnz |= !!x;
  274|    576|        x += *pu1_pred_ptr;
  275|    576|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|    576|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|    576|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 169, False: 407]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 407]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  276|       |
  277|    576|        pu1_out_ptr++;
  278|    576|        pu1_pred++;
  279|    576|        pi2_rsd++;
  280|    576|    }
  281|    144|    return i4_nnz;
  282|    144|}
isvcd_iquant_itrans_residual_recon_chroma_4x4:
  311|  2.21k|{
  312|  2.21k|    WORD16 *pi2_src_ptr = pi2_src;
  313|  2.21k|    WORD16 *pi2_tmp_ptr = pi2_tmp;
  314|  2.21k|    UWORD8 *pu1_pred_ptr = pu1_pred;
  315|  2.21k|    WORD16 *pi2_rsd_ptr = pi2_rsd;
  316|  2.21k|    UWORD8 *pu1_out_ptr = pu1_out;
  317|  2.21k|    WORD16 x0, x1, x2, x3, i;
  318|  2.21k|    WORD32 q0, q1, q2, q3;
  319|  2.21k|    WORD16 i_macro;
  320|  2.21k|    WORD16 rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
  ------------------
  |  Branch (320:23): [True: 1.65k, False: 561]
  ------------------
  321|       |
  322|       |    /* inverse quant */
  323|       |    /*horizontal inverse transform */
  324|  11.0k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|  11.0k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (324:16): [True: 8.84k, False: 2.21k]
  ------------------
  325|  8.84k|    {
  326|  8.84k|        if(i == 0)
  ------------------
  |  Branch (326:12): [True: 2.21k, False: 6.63k]
  ------------------
  327|  2.21k|        {
  328|  2.21k|            q0 = pi2_dc_src[0];
  329|  2.21k|        }
  330|  6.63k|        else
  331|  6.63k|        {
  332|  6.63k|            q0 = pi2_src_ptr[0];
  333|  6.63k|            INV_QUANT(q0, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  6.63k|                {\
  |  |  104|  6.63k|                    i4_value *= quant_scale;\
  |  |  105|  6.63k|                    i4_value *= weight_scale;\
  |  |  106|  6.63k|                    i4_value += rndfactor;\
  |  |  107|  6.63k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  6.63k|                    i4_value >>= qbits;\
  |  |  109|  6.63k|                }
  ------------------
  334|  6.63k|        }
  335|       |
  336|  8.84k|        q2 = pi2_src_ptr[2];
  337|  8.84k|        INV_QUANT(q2, pu2_iscal_mat[2], pu2_weigh_mat[2], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  8.84k|                {\
  |  |  104|  8.84k|                    i4_value *= quant_scale;\
  |  |  105|  8.84k|                    i4_value *= weight_scale;\
  |  |  106|  8.84k|                    i4_value += rndfactor;\
  |  |  107|  8.84k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  8.84k|                    i4_value >>= qbits;\
  |  |  109|  8.84k|                }
  ------------------
  338|       |
  339|  8.84k|        x0 = q0 + q2;
  340|  8.84k|        x1 = q0 - q2;
  341|       |
  342|  8.84k|        q1 = pi2_src_ptr[1];
  343|  8.84k|        INV_QUANT(q1, pu2_iscal_mat[1], pu2_weigh_mat[1], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  8.84k|                {\
  |  |  104|  8.84k|                    i4_value *= quant_scale;\
  |  |  105|  8.84k|                    i4_value *= weight_scale;\
  |  |  106|  8.84k|                    i4_value += rndfactor;\
  |  |  107|  8.84k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  8.84k|                    i4_value >>= qbits;\
  |  |  109|  8.84k|                }
  ------------------
  344|       |
  345|  8.84k|        q3 = pi2_src_ptr[3];
  346|  8.84k|        INV_QUANT(q3, pu2_iscal_mat[3], pu2_weigh_mat[3], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|  8.84k|                {\
  |  |  104|  8.84k|                    i4_value *= quant_scale;\
  |  |  105|  8.84k|                    i4_value *= weight_scale;\
  |  |  106|  8.84k|                    i4_value += rndfactor;\
  |  |  107|  8.84k|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  8.84k|                    i4_value >>= qbits;\
  |  |  109|  8.84k|                }
  ------------------
  347|       |
  348|  8.84k|        x2 = (q1 >> 1) - q3;
  349|  8.84k|        x3 = q1 + (q3 >> 1);
  350|       |
  351|  8.84k|        pi2_tmp_ptr[0] = x0 + x3;
  352|  8.84k|        pi2_tmp_ptr[1] = x1 + x2;
  353|  8.84k|        pi2_tmp_ptr[2] = x1 - x2;
  354|  8.84k|        pi2_tmp_ptr[3] = x0 - x3;
  355|       |
  356|  8.84k|        pi2_src_ptr += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  8.84k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  357|  8.84k|        pi2_tmp_ptr += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  8.84k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  358|  8.84k|        pu2_iscal_mat += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  8.84k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  359|  8.84k|        pu2_weigh_mat += SUB_BLK_WIDTH_4x4;
  ------------------
  |  |   48|  8.84k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  360|  8.84k|    }
  361|       |
  362|       |    /* vertical inverse transform */
  363|  2.21k|    pi2_tmp_ptr = pi2_tmp;
  364|  11.0k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|  11.0k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (364:16): [True: 8.84k, False: 2.21k]
  ------------------
  365|  8.84k|    {
  366|  8.84k|        pu1_pred_ptr = pu1_pred;
  367|  8.84k|        pi2_rsd_ptr = pi2_rsd;
  368|  8.84k|        pu1_out = pu1_out_ptr;
  369|       |
  370|  8.84k|        x0 = (pi2_tmp_ptr[0] + pi2_tmp_ptr[8]);
  371|  8.84k|        x1 = (pi2_tmp_ptr[0] - pi2_tmp_ptr[8]);
  372|  8.84k|        x2 = (pi2_tmp_ptr[4] >> 1) - pi2_tmp_ptr[12];
  373|  8.84k|        x3 = pi2_tmp_ptr[4] + (pi2_tmp_ptr[12] >> 1);
  374|       |
  375|       |        /* inverse prediction */
  376|  8.84k|        i_macro = x0 + x3;
  377|  8.84k|        i_macro = ((i_macro + 32) >> 6);
  378|  8.84k|        i_macro = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  8.84k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  8.84k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 8.84k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 8.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  379|  8.84k|        i_macro += *pu1_pred_ptr;
  380|  8.84k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|  8.84k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  8.84k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 468, False: 8.37k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 8.37k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  381|  8.84k|        pu1_pred_ptr += pred_strd;
  382|  8.84k|        pi2_rsd_ptr += rsd_strd;
  383|  8.84k|        pu1_out += out_strd;
  384|       |
  385|  8.84k|        i_macro = x1 + x2;
  386|  8.84k|        i_macro = ((i_macro + 32) >> 6);
  387|  8.84k|        i_macro = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  8.84k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  8.84k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 8.84k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 8.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  388|  8.84k|        i_macro += *pu1_pred_ptr;
  389|  8.84k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|  8.84k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  8.84k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 458, False: 8.38k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 8.38k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  390|  8.84k|        pu1_pred_ptr += pred_strd;
  391|  8.84k|        pi2_rsd_ptr += rsd_strd;
  392|  8.84k|        pu1_out += out_strd;
  393|       |
  394|  8.84k|        i_macro = x1 - x2;
  395|  8.84k|        i_macro = ((i_macro + 32) >> 6);
  396|  8.84k|        i_macro = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  8.84k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  8.84k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 8.84k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 8.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  397|  8.84k|        i_macro += *pu1_pred_ptr;
  398|  8.84k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|  8.84k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  8.84k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 497, False: 8.34k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 8.34k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  399|  8.84k|        pu1_pred_ptr += pred_strd;
  400|  8.84k|        pi2_rsd_ptr += rsd_strd;
  401|  8.84k|        pu1_out += out_strd;
  402|       |
  403|  8.84k|        i_macro = x0 - x3;
  404|  8.84k|        i_macro = ((i_macro + 32) >> 6);
  405|  8.84k|        i_macro = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  8.84k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  8.84k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 8.84k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 8.84k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  406|  8.84k|        i_macro += *pu1_pred_ptr;
  407|  8.84k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|  8.84k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  8.84k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 499, False: 8.34k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 8.34k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  408|       |
  409|  8.84k|        pi2_tmp_ptr++;
  410|  8.84k|        pu1_out_ptr += 2;  // Interleaved store for output
  411|  8.84k|        pu1_pred += 2;     // Interleaved load for pred buffer
  412|  8.84k|        pi2_rsd += 2;
  413|  8.84k|    }
  414|  2.21k|}
isvcd_iquant_itrans_residual_recon_chroma_4x4_dc:
  443|  23.6k|{
  444|  23.6k|    UWORD8 *pu1_pred_ptr = pu1_pred;
  445|  23.6k|    WORD16 *pi2_rsd_ptr = pi2_rsd;
  446|  23.6k|    UWORD8 *pu1_out_ptr = pu1_out;
  447|  23.6k|    WORD32 q0;
  448|  23.6k|    WORD16 x, i_macro, i;
  449|  23.6k|    UNUSED(pi2_src);
  ------------------
  |  |   45|  23.6k|#define UNUSED(x) ((void)(x))
  ------------------
  450|  23.6k|    UNUSED(pu2_iscal_mat);
  ------------------
  |  |   45|  23.6k|#define UNUSED(x) ((void)(x))
  ------------------
  451|  23.6k|    UNUSED(pu2_weigh_mat);
  ------------------
  |  |   45|  23.6k|#define UNUSED(x) ((void)(x))
  ------------------
  452|  23.6k|    UNUSED(u4_qp_div_6);
  ------------------
  |  |   45|  23.6k|#define UNUSED(x) ((void)(x))
  ------------------
  453|  23.6k|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|  23.6k|#define UNUSED(x) ((void)(x))
  ------------------
  454|       |
  455|  23.6k|    q0 = pi2_dc_src[0];  // Restoring dc value for intra case3
  456|  23.6k|    i_macro = ((q0 + 32) >> 6);
  457|       |
  458|   118k|    for(i = 0; i < SUB_BLK_WIDTH_4x4; i++)
  ------------------
  |  |   48|   118k|#define SUB_BLK_WIDTH_4x4                   4
  ------------------
  |  Branch (458:16): [True: 94.4k, False: 23.6k]
  ------------------
  459|  94.4k|    {
  460|  94.4k|        pu1_pred_ptr = pu1_pred;
  461|  94.4k|        pi2_rsd_ptr = pi2_rsd;
  462|  94.4k|        pu1_out = pu1_out_ptr;
  463|       |
  464|       |        /* inverse prediction */
  465|  94.4k|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  94.4k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  94.4k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 94.4k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 94.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  466|  94.4k|        x += *pu1_pred_ptr;
  467|  94.4k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  94.4k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  94.4k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 1.61k, False: 92.7k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 92.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  468|  94.4k|        pu1_pred_ptr += pred_strd;
  469|  94.4k|        pi2_rsd_ptr += rsd_strd;
  470|  94.4k|        pu1_out += out_strd;
  471|       |
  472|  94.4k|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  94.4k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  94.4k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 94.4k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 94.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  473|  94.4k|        x += *pu1_pred_ptr;
  474|  94.4k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  94.4k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  94.4k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 1.60k, False: 92.8k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 92.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  475|  94.4k|        pu1_pred_ptr += pred_strd;
  476|  94.4k|        pi2_rsd_ptr += rsd_strd;
  477|  94.4k|        pu1_out += out_strd;
  478|       |
  479|  94.4k|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  94.4k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  94.4k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 94.4k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 94.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  480|  94.4k|        x += *pu1_pred_ptr;
  481|  94.4k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  94.4k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  94.4k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 1.63k, False: 92.7k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 92.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  482|  94.4k|        pu1_pred_ptr += pred_strd;
  483|  94.4k|        pi2_rsd_ptr += rsd_strd;
  484|  94.4k|        pu1_out += out_strd;
  485|       |
  486|  94.4k|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  94.4k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  94.4k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 94.4k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 94.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  487|  94.4k|        x += *pu1_pred_ptr;
  488|  94.4k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  94.4k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  94.4k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 1.61k, False: 92.7k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 92.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  489|       |
  490|  94.4k|        pu1_out_ptr += 2;
  491|  94.4k|        pu1_pred += 2;
  492|  94.4k|        pi2_rsd += 2;
  493|  94.4k|    }
  494|  23.6k|}
isvcd_iquant_itrans_residual_recon_8x8:
  525|  16.9k|{
  526|  16.9k|    WORD32 i4_nnz = 0, i4_nnz_H = 0, i4_nnz_L = 0;
  527|  16.9k|    WORD32 i;
  528|  16.9k|    WORD16 *pi2_tmp_ptr = pi2_tmp;
  529|  16.9k|    UWORD8 *pu1_pred_ptr = pu1_pred;
  530|  16.9k|    WORD16 *pi2_rsd_ptr = pi2_rsd;
  531|  16.9k|    UWORD8 *pu1_out_ptr = pu1_out;
  532|  16.9k|    WORD16 i_z0, i_z1, i_z2, i_z3, i_z4, i_z5, i_z6, i_z7;
  533|  16.9k|    WORD16 i_y0, i_y1, i_y2, i_y3, i_y4, i_y5, i_y6, i_y7;
  534|  16.9k|    WORD16 i_macro;
  535|  16.9k|    WORD32 q;
  536|  16.9k|    WORD32 rnd_fact = (qp_div < 6) ? (1 << (5 - qp_div)) : 0;
  ------------------
  |  Branch (536:23): [True: 12.5k, False: 4.43k]
  ------------------
  537|  16.9k|    UNUSED(iq_start_idx);
  ------------------
  |  |   45|  16.9k|#define UNUSED(x) ((void)(x))
  ------------------
  538|  16.9k|    UNUSED(pi2_dc_ld_addr);
  ------------------
  |  |   45|  16.9k|#define UNUSED(x) ((void)(x))
  ------------------
  539|       |    /*************************************************************/
  540|       |    /* De quantization of coefficients. Will be replaced by SIMD */
  541|       |    /* operations on platform. Note : DC coeff is not scaled     */
  542|       |    /*************************************************************/
  543|  1.10M|    for(i = 0; i < (SUB_BLK_WIDTH_8x8 * SUB_BLK_WIDTH_8x8); i++)
  ------------------
  |  |   53|  1.10M|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
                  for(i = 0; i < (SUB_BLK_WIDTH_8x8 * SUB_BLK_WIDTH_8x8); i++)
  ------------------
  |  |   53|  1.10M|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  |  Branch (543:16): [True: 1.08M, False: 16.9k]
  ------------------
  544|  1.08M|    {
  545|  1.08M|        q = pi2_src[i];
  546|  1.08M|        INV_QUANT(q, pu2_iscale_mat[i], pu2_weigh_mat[i], qp_div, rnd_fact, 6);
  ------------------
  |  |  103|  1.08M|                {\
  |  |  104|  1.08M|                    i4_value *= quant_scale;\
  |  |  105|  1.08M|                    i4_value *= weight_scale;\
  |  |  106|  1.08M|                    i4_value += rndfactor;\
  |  |  107|  1.08M|                    i4_value <<= u4_qp_div_6;\
  |  |  108|  1.08M|                    i4_value >>= qbits;\
  |  |  109|  1.08M|                }
  ------------------
  547|  1.08M|        pi2_tmp_ptr[i] = q;
  548|  1.08M|    }
  549|       |    /* Perform Inverse transform */
  550|       |    /*--------------------------------------------------------------------*/
  551|       |    /* IDCT [ Horizontal transformation ]                                 */
  552|       |    /*--------------------------------------------------------------------*/
  553|   152k|    for(i = 0; i < SUB_BLK_WIDTH_8x8; i++)
  ------------------
  |  |   53|   152k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  |  Branch (553:16): [True: 135k, False: 16.9k]
  ------------------
  554|   135k|    {
  555|       |        /*------------------------------------------------------------------*/
  556|       |        /* y0 = w0 + w4                                                     */
  557|       |        /* y1 = -w3 + w5 - w7 - (w7 >> 1)                                   */
  558|       |        /* y2 = w0 - w4                                                     */
  559|       |        /* y3 = w1 + w7 - w3 - (w3 >> 1)                                    */
  560|       |        /* y4 = (w2 >> 1) - w6                                              */
  561|       |        /* y5 = -w1 + w7 + w5 + (w5 >> 1)                                   */
  562|       |        /* y6 = w2 + (w6 >> 1)                                              */
  563|       |        /* y7 = w3 + w5 + w1 + (w1 >> 1)                                    */
  564|       |        /*------------------------------------------------------------------*/
  565|   135k|        i_y0 = (pi2_tmp_ptr[0] + pi2_tmp_ptr[4]);
  566|       |
  567|   135k|        i_y1 =
  568|   135k|            ((WORD32) (-pi2_tmp_ptr[3]) + pi2_tmp_ptr[5] - pi2_tmp_ptr[7] - (pi2_tmp_ptr[7] >> 1));
  569|       |
  570|   135k|        i_y2 = (pi2_tmp_ptr[0] - pi2_tmp_ptr[4]);
  571|       |
  572|   135k|        i_y3 = ((WORD32) pi2_tmp_ptr[1] + pi2_tmp_ptr[7] - pi2_tmp_ptr[3] - (pi2_tmp_ptr[3] >> 1));
  573|       |
  574|   135k|        i_y4 = ((pi2_tmp_ptr[2] >> 1) - pi2_tmp_ptr[6]);
  575|       |
  576|   135k|        i_y5 =
  577|   135k|            ((WORD32) (-pi2_tmp_ptr[1]) + pi2_tmp_ptr[7] + pi2_tmp_ptr[5] + (pi2_tmp_ptr[5] >> 1));
  578|       |
  579|   135k|        i_y6 = (pi2_tmp_ptr[2] + (pi2_tmp_ptr[6] >> 1));
  580|       |
  581|   135k|        i_y7 = ((WORD32) pi2_tmp_ptr[3] + pi2_tmp_ptr[5] + pi2_tmp_ptr[1] + (pi2_tmp_ptr[1] >> 1));
  582|       |
  583|       |        /*------------------------------------------------------------------*/
  584|       |        /* z0 = y0 + y6                                                     */
  585|       |        /* z1 = y1 + (y7 >> 2)                                              */
  586|       |        /* z2 = y2 + y4                                                     */
  587|       |        /* z3 = y3 + (y5 >> 2)                                              */
  588|       |        /* z4 = y2 - y4                                                     */
  589|       |        /* z5 = (y3 >> 2) - y5                                              */
  590|       |        /* z6 = y0 - y6                                                     */
  591|       |        /* z7 = y7 - (y1 >> 2)                                              */
  592|       |        /*------------------------------------------------------------------*/
  593|   135k|        i_z0 = i_y0 + i_y6;
  594|   135k|        i_z1 = i_y1 + (i_y7 >> 2);
  595|   135k|        i_z2 = i_y2 + i_y4;
  596|   135k|        i_z3 = i_y3 + (i_y5 >> 2);
  597|   135k|        i_z4 = i_y2 - i_y4;
  598|   135k|        i_z5 = (i_y3 >> 2) - i_y5;
  599|   135k|        i_z6 = i_y0 - i_y6;
  600|   135k|        i_z7 = i_y7 - (i_y1 >> 2);
  601|       |
  602|       |        /*------------------------------------------------------------------*/
  603|       |        /* x0 = z0 + z7                                                     */
  604|       |        /* x1 = z2 + z5                                                     */
  605|       |        /* x2 = z4 + z3                                                     */
  606|       |        /* x3 = z6 + z1                                                     */
  607|       |        /* x4 = z6 - z1                                                     */
  608|       |        /* x5 = z4 - z3                                                     */
  609|       |        /* x6 = z2 - z5                                                     */
  610|       |        /* x7 = z0 - z7                                                     */
  611|       |        /*------------------------------------------------------------------*/
  612|   135k|        pi2_tmp_ptr[0] = i_z0 + i_z7;
  613|   135k|        pi2_tmp_ptr[1] = i_z2 + i_z5;
  614|   135k|        pi2_tmp_ptr[2] = i_z4 + i_z3;
  615|   135k|        pi2_tmp_ptr[3] = i_z6 + i_z1;
  616|   135k|        pi2_tmp_ptr[4] = i_z6 - i_z1;
  617|   135k|        pi2_tmp_ptr[5] = i_z4 - i_z3;
  618|   135k|        pi2_tmp_ptr[6] = i_z2 - i_z5;
  619|   135k|        pi2_tmp_ptr[7] = i_z0 - i_z7;
  620|       |
  621|       |        /* move to the next row */
  622|   135k|        pi2_tmp_ptr += SUB_BLK_WIDTH_8x8;
  ------------------
  |  |   53|   135k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  623|   135k|    }
  624|       |    /*--------------------------------------------------------------------*/
  625|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6            */
  626|       |    /*                                                                    */
  627|       |    /* Add the prediction and store it back to reconstructed frame buffer */
  628|       |    /* [Prediction buffer itself in this case]                            */
  629|       |    /*--------------------------------------------------------------------*/
  630|       |
  631|  16.9k|    pi2_tmp_ptr = pi2_tmp;
  632|   152k|    for(i = 0; i < SUB_BLK_WIDTH_8x8; i++)
  ------------------
  |  |   53|   152k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  |  Branch (632:16): [True: 135k, False: 16.9k]
  ------------------
  633|   135k|    {
  634|   135k|        pu1_pred_ptr = pu1_pred;
  635|   135k|        pi2_rsd_ptr = pi2_rsd;
  636|   135k|        pu1_out = pu1_out_ptr;
  637|       |        /*------------------------------------------------------------------*/
  638|       |        /* y0j = w0j + w4j                                                  */
  639|       |        /* y1j = -w3j + w5j -w7j -(w7j >> 1)                                */
  640|       |        /* y2j = w0j -w4j                                                   */
  641|       |        /* y3j = w1j + w7j -w3j -(w3j >> 1)                                 */
  642|       |        /* y4j = ( w2j >> 1 ) -w6j                                          */
  643|       |        /* y5j = -w1j + w7j + w5j + (w5j >> 1)                              */
  644|       |        /* y6j = w2j + ( w6j >> 1 )                                         */
  645|       |        /* y7j = w3j + w5j + w1j + (w1j >> 1)                               */
  646|       |        /*------------------------------------------------------------------*/
  647|   135k|        i_y0 = pi2_tmp_ptr[0] + pi2_tmp_ptr[32];
  648|       |
  649|   135k|        i_y1 = (WORD32) (-pi2_tmp_ptr[24]) + pi2_tmp_ptr[40] - pi2_tmp_ptr[56] -
  650|   135k|               (pi2_tmp_ptr[56] >> 1);
  651|       |
  652|   135k|        i_y2 = pi2_tmp_ptr[0] - pi2_tmp_ptr[32];
  653|       |
  654|   135k|        i_y3 = (WORD32) pi2_tmp_ptr[8] + pi2_tmp_ptr[56] - pi2_tmp_ptr[24] - (pi2_tmp_ptr[24] >> 1);
  655|       |
  656|   135k|        i_y4 = (pi2_tmp_ptr[16] >> 1) - pi2_tmp_ptr[48];
  657|       |
  658|   135k|        i_y5 =
  659|   135k|            (WORD32) (-pi2_tmp_ptr[8]) + pi2_tmp_ptr[56] + pi2_tmp_ptr[40] + (pi2_tmp_ptr[40] >> 1);
  660|       |
  661|   135k|        i_y6 = pi2_tmp_ptr[16] + (pi2_tmp_ptr[48] >> 1);
  662|       |
  663|   135k|        i_y7 = (WORD32) pi2_tmp_ptr[24] + pi2_tmp_ptr[40] + pi2_tmp_ptr[8] + (pi2_tmp_ptr[8] >> 1);
  664|       |
  665|       |        /*------------------------------------------------------------------*/
  666|       |        /* z0j = y0j + y6j                                                  */
  667|       |        /* z1j = y1j + (y7j >> 2)                                           */
  668|       |        /* z2j = y2j + y4j                                                  */
  669|       |        /* z3j = y3j + (y5j >> 2)                                           */
  670|       |        /* z4j = y2j -y4j                                                   */
  671|       |        /* z5j = (y3j >> 2) -y5j                                            */
  672|       |        /* z6j = y0j -y6j                                                   */
  673|       |        /* z7j = y7j -(y1j >> 2)                                            */
  674|       |        /*------------------------------------------------------------------*/
  675|   135k|        i_z0 = i_y0 + i_y6;
  676|   135k|        i_z1 = i_y1 + (i_y7 >> 2);
  677|   135k|        i_z2 = i_y2 + i_y4;
  678|   135k|        i_z3 = i_y3 + (i_y5 >> 2);
  679|   135k|        i_z4 = i_y2 - i_y4;
  680|   135k|        i_z5 = (i_y3 >> 2) - i_y5;
  681|   135k|        i_z6 = i_y0 - i_y6;
  682|   135k|        i_z7 = i_y7 - (i_y1 >> 2);
  683|       |
  684|       |        /*------------------------------------------------------------------*/
  685|       |        /* x0j = z0j + z7j                                                  */
  686|       |        /* x1j = z2j + z5j                                                  */
  687|       |        /* x2j = z4j + z3j                                                  */
  688|       |        /* x3j = z6j + z1j                                                  */
  689|       |        /* x4j = z6j -z1j                                                   */
  690|       |        /* x5j = z4j -z3j                                                   */
  691|       |        /* x6j = z2j -z5j                                                   */
  692|       |        /* x7j = z0j -z7j                                                   */
  693|       |        /*------------------------------------------------------------------*/
  694|   135k|        i_macro = CLIP_RSD(((i_z0 + i_z7 + 32) >> 6) + (*pi2_rsd_ptr));
  ------------------
  |  |  774|   135k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 6, False: 135k]
  |  |  |  |  |  Branch (77:54): [True: 25, False: 135k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  695|   135k|        i4_nnz_H |= !!i_macro;
  696|   135k|        i_macro += *pu1_pred_ptr;
  697|   135k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   135k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 7.75k, False: 128k]
  |  |  |  |  |  Branch (77:54): [True: 46, False: 128k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  698|       |        /* Change uc_recBuffer to Point to next element in the same column*/
  699|   135k|        pu1_pred_ptr += pred_strd;
  700|   135k|        pi2_rsd_ptr += rsd_strd;
  701|   135k|        pu1_out += out_strd;
  702|       |
  703|   135k|        i_macro = CLIP_RSD(((i_z2 + i_z5 + 32) >> 6) + (*pi2_rsd_ptr));
  ------------------
  |  |  774|   135k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 3, False: 135k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 135k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  704|   135k|        i4_nnz_H |= !!i_macro;
  705|   135k|        i_macro += *pu1_pred_ptr;
  706|   135k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   135k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 12.0k, False: 123k]
  |  |  |  |  |  Branch (77:54): [True: 14, False: 123k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  707|   135k|        pu1_pred_ptr += pred_strd;
  708|   135k|        pi2_rsd_ptr += rsd_strd;
  709|   135k|        pu1_out += out_strd;
  710|       |
  711|   135k|        i_macro = CLIP_RSD(((i_z4 + i_z3 + 32) >> 6) + (*pi2_rsd_ptr));
  ------------------
  |  |  774|   135k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 135k]
  |  |  |  |  |  Branch (77:54): [True: 27, False: 135k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  712|   135k|        i4_nnz_H |= !!i_macro;
  713|   135k|        i_macro += *pu1_pred_ptr;
  714|   135k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   135k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 17.7k, False: 118k]
  |  |  |  |  |  Branch (77:54): [True: 38, False: 118k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  715|   135k|        pu1_pred_ptr += pred_strd;
  716|   135k|        pi2_rsd_ptr += rsd_strd;
  717|   135k|        pu1_out += out_strd;
  718|       |
  719|   135k|        i_macro = CLIP_RSD(((i_z6 + i_z1 + 32) >> 6) + (*pi2_rsd_ptr));
  ------------------
  |  |  774|   135k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 135k]
  |  |  |  |  |  Branch (77:54): [True: 6, False: 135k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  720|   135k|        i4_nnz_H |= !!i_macro;
  721|   135k|        i_macro += *pu1_pred_ptr;
  722|   135k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   135k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 19.0k, False: 116k]
  |  |  |  |  |  Branch (77:54): [True: 34, False: 116k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  723|   135k|        pu1_pred_ptr += pred_strd;
  724|   135k|        pi2_rsd_ptr += rsd_strd;
  725|   135k|        pu1_out += out_strd;
  726|       |
  727|   135k|        i_macro = CLIP_RSD(((i_z6 - i_z1 + 32) >> 6) + (*pi2_rsd_ptr));
  ------------------
  |  |  774|   135k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 3, False: 135k]
  |  |  |  |  |  Branch (77:54): [True: 6, False: 135k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  728|   135k|        i4_nnz_L |= !!i_macro;
  729|   135k|        i_macro += *pu1_pred_ptr;
  730|   135k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   135k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 20.0k, False: 115k]
  |  |  |  |  |  Branch (77:54): [True: 71, False: 115k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  731|   135k|        pu1_pred_ptr += pred_strd;
  732|   135k|        pi2_rsd_ptr += rsd_strd;
  733|   135k|        pu1_out += out_strd;
  734|       |
  735|   135k|        i_macro = CLIP_RSD(((i_z4 - i_z3 + 32) >> 6) + (*pi2_rsd_ptr));
  ------------------
  |  |  774|   135k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 135k]
  |  |  |  |  |  Branch (77:54): [True: 27, False: 135k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  736|   135k|        i4_nnz_L |= !!i_macro;
  737|   135k|        i_macro += *pu1_pred_ptr;
  738|   135k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   135k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 17.1k, False: 118k]
  |  |  |  |  |  Branch (77:54): [True: 35, False: 118k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  739|   135k|        pu1_pred_ptr += pred_strd;
  740|   135k|        pi2_rsd_ptr += rsd_strd;
  741|   135k|        pu1_out += out_strd;
  742|       |
  743|   135k|        i_macro = CLIP_RSD(((i_z2 - i_z5 + 32) >> 6) + (*pi2_rsd_ptr));
  ------------------
  |  |  774|   135k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 3, False: 135k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 135k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  744|   135k|        i4_nnz_L |= !!i_macro;
  745|   135k|        i_macro += *pu1_pred_ptr;
  746|   135k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   135k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 13.2k, False: 122k]
  |  |  |  |  |  Branch (77:54): [True: 17, False: 122k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  747|   135k|        pu1_pred_ptr += pred_strd;
  748|   135k|        pi2_rsd_ptr += rsd_strd;
  749|   135k|        pu1_out += out_strd;
  750|       |
  751|   135k|        i_macro = CLIP_RSD(((i_z0 - i_z7 + 32) >> 6) + (*pi2_rsd_ptr));
  ------------------
  |  |  774|   135k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 6, False: 135k]
  |  |  |  |  |  Branch (77:54): [True: 24, False: 135k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  752|   135k|        i4_nnz_L |= !!i_macro;
  753|   135k|        i_macro += *pu1_pred_ptr;
  754|   135k|        *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   135k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   135k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 7.93k, False: 127k]
  |  |  |  |  |  Branch (77:54): [True: 29, False: 127k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  755|       |
  756|   135k|        pi2_tmp_ptr++;
  757|   135k|        pu1_out_ptr++;
  758|   135k|        pi2_rsd++;
  759|   135k|        pu1_pred++;
  760|   135k|        if(i == 3)
  ------------------
  |  Branch (760:12): [True: 16.9k, False: 118k]
  ------------------
  761|  16.9k|        {
  762|  16.9k|            i4_nnz = i4_nnz_H | (i4_nnz_L << 4);
  763|  16.9k|            i4_nnz_L = 0;
  764|  16.9k|            i4_nnz_H = 0;
  765|  16.9k|        }
  766|   135k|    }
  767|  16.9k|    i4_nnz |= (i4_nnz_H << 1) | (i4_nnz_L << 5);
  768|  16.9k|    return i4_nnz;
  769|  16.9k|}
isvcd_iquant_itrans_residual_recon_8x8_dc:
  800|    175|{
  801|    175|    WORD32 i4_nnz = 0, i4_nnz_H = 0, i4_nnz_L = 0;
  802|    175|    UWORD8 *pu1_pred_ptr = pu1_pred;
  803|    175|    WORD16 *pi2_rsd_ptr = pi2_rsd;
  804|    175|    UWORD8 *pu1_out_ptr = pu1_out;
  805|    175|    WORD16 x, i, i_macro;
  806|    175|    WORD32 q;
  807|    175|    WORD32 rnd_fact = (qp_div < 6) ? (1 << (5 - qp_div)) : 0;
  ------------------
  |  Branch (807:23): [True: 129, False: 46]
  ------------------
  808|    175|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|    175|#define UNUSED(x) ((void)(x))
  ------------------
  809|    175|    UNUSED(iq_start_idx);
  ------------------
  |  |   45|    175|#define UNUSED(x) ((void)(x))
  ------------------
  810|    175|    UNUSED(pi2_dc_ld_addr);
  ------------------
  |  |   45|    175|#define UNUSED(x) ((void)(x))
  ------------------
  811|       |    /*************************************************************/
  812|       |    /* Dequantization of coefficients. Will be replaced by SIMD  */
  813|       |    /* operations on platform. Note : DC coeff is not scaled     */
  814|       |    /*************************************************************/
  815|    175|    q = pi2_src[0];
  816|    175|    INV_QUANT(q, pu2_iscale_mat[0], pu2_weigh_mat[0], qp_div, rnd_fact, 6);
  ------------------
  |  |  103|    175|                {\
  |  |  104|    175|                    i4_value *= quant_scale;\
  |  |  105|    175|                    i4_value *= weight_scale;\
  |  |  106|    175|                    i4_value += rndfactor;\
  |  |  107|    175|                    i4_value <<= u4_qp_div_6;\
  |  |  108|    175|                    i4_value >>= qbits;\
  |  |  109|    175|                }
  ------------------
  817|    175|    i_macro = (q + 32) >> 6;
  818|       |    /* Perform Inverse transform */
  819|       |    /*--------------------------------------------------------------------*/
  820|       |    /* IDCT [ Horizontal transformation ]                                 */
  821|       |    /*--------------------------------------------------------------------*/
  822|       |    /*--------------------------------------------------------------------*/
  823|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6            */
  824|       |    /*                                                                    */
  825|       |    /* Add the prediction and store it back to reconstructed frame buffer */
  826|       |    /* [Prediction buffer itself in this case]                            */
  827|       |    /*--------------------------------------------------------------------*/
  828|  1.57k|    for(i = 0; i < SUB_BLK_WIDTH_8x8; i++)
  ------------------
  |  |   53|  1.57k|#define SUB_BLK_WIDTH_8x8                   8
  ------------------
  |  Branch (828:16): [True: 1.40k, False: 175]
  ------------------
  829|  1.40k|    {
  830|  1.40k|        pu1_pred_ptr = pu1_pred;
  831|  1.40k|        pi2_rsd_ptr = pi2_rsd;
  832|  1.40k|        pu1_out = pu1_out_ptr;
  833|       |
  834|  1.40k|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  1.40k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 1.40k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  835|  1.40k|        i4_nnz_H |= !!x;
  836|  1.40k|        x += *pu1_pred_ptr;
  837|  1.40k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  1.40k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 204, False: 1.19k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.19k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  838|       |        /* Change uc_recBuffer to Point to next element in the same column*/
  839|  1.40k|        pu1_pred_ptr += pred_strd;
  840|  1.40k|        pi2_rsd_ptr += rsd_strd;
  841|  1.40k|        pu1_out += out_strd;
  842|       |
  843|  1.40k|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  1.40k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 1.40k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  844|  1.40k|        i4_nnz_H |= !!x;
  845|  1.40k|        x += *pu1_pred_ptr;
  846|  1.40k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  1.40k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 191, False: 1.20k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  847|  1.40k|        pu1_pred_ptr += pred_strd;
  848|  1.40k|        pi2_rsd_ptr += rsd_strd;
  849|  1.40k|        pu1_out += out_strd;
  850|       |
  851|  1.40k|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  1.40k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 1.40k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  852|  1.40k|        i4_nnz_H |= !!x;
  853|  1.40k|        x += *pu1_pred_ptr;
  854|  1.40k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  1.40k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 223, False: 1.17k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.17k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  855|  1.40k|        pu1_pred_ptr += pred_strd;
  856|  1.40k|        pi2_rsd_ptr += rsd_strd;
  857|  1.40k|        pu1_out += out_strd;
  858|       |
  859|  1.40k|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  1.40k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 1.40k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  860|  1.40k|        i4_nnz_H |= !!x;
  861|  1.40k|        x += *pu1_pred_ptr;
  862|  1.40k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  1.40k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 213, False: 1.18k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  863|  1.40k|        pu1_pred_ptr += pred_strd;
  864|  1.40k|        pi2_rsd_ptr += rsd_strd;
  865|  1.40k|        pu1_out += out_strd;
  866|       |
  867|  1.40k|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  1.40k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 1.40k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  868|  1.40k|        i4_nnz_L |= !!x;
  869|  1.40k|        x += *pu1_pred_ptr;
  870|  1.40k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  1.40k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 202, False: 1.19k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.19k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  871|  1.40k|        pu1_pred_ptr += pred_strd;
  872|  1.40k|        pi2_rsd_ptr += rsd_strd;
  873|  1.40k|        pu1_out += out_strd;
  874|       |
  875|  1.40k|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  1.40k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 1.40k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  876|  1.40k|        i4_nnz_L |= !!x;
  877|  1.40k|        x += *pu1_pred_ptr;
  878|  1.40k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  1.40k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 194, False: 1.20k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  879|  1.40k|        pu1_pred_ptr += pred_strd;
  880|  1.40k|        pi2_rsd_ptr += rsd_strd;
  881|  1.40k|        pu1_out += out_strd;
  882|       |
  883|  1.40k|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  1.40k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 1.40k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  884|  1.40k|        i4_nnz_L |= !!x;
  885|  1.40k|        x += *pu1_pred_ptr;
  886|  1.40k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  1.40k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 189, False: 1.21k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.21k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  887|  1.40k|        pu1_pred_ptr += pred_strd;
  888|  1.40k|        pi2_rsd_ptr += rsd_strd;
  889|  1.40k|        pu1_out += out_strd;
  890|       |
  891|  1.40k|        x = CLIP_RSD(i_macro + (*pi2_rsd_ptr));
  ------------------
  |  |  774|  1.40k|#define CLIP_RSD(x) CLIP3(RSD_MIN, RSD_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 1.40k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.40k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  892|  1.40k|        i4_nnz_L |= !!x;
  893|  1.40k|        x += *pu1_pred_ptr;
  894|  1.40k|        *pu1_out = CLIP_U8(x);
  ------------------
  |  |   58|  1.40k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  1.40k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 180, False: 1.22k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 1.22k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  895|       |
  896|  1.40k|        pu1_out_ptr++;
  897|  1.40k|        pu1_pred++;
  898|  1.40k|        pi2_rsd++;
  899|  1.40k|        if(i == 3)
  ------------------
  |  Branch (899:12): [True: 175, False: 1.22k]
  ------------------
  900|    175|        {
  901|    175|            i4_nnz = i4_nnz_H | (i4_nnz_L << 4);
  902|    175|            i4_nnz_L = 0;
  903|    175|            i4_nnz_H = 0;
  904|    175|        }
  905|  1.40k|    }
  906|    175|    i4_nnz |= (i4_nnz_H << 1) | (i4_nnz_L << 5);
  907|    175|    return i4_nnz;
  908|    175|}

isvcd_get_mb_info_cabac_nonmbaff:
   91|  88.7k|{
   92|  88.7k|    WORD32 mb_x;
   93|  88.7k|    WORD32 mb_y;
   94|  88.7k|    UWORD32 u1_mb_ngbr_avail = 0;
   95|  88.7k|    UWORD32 u2_frm_width_in_mb = ps_dec->u2_frm_wd_in_mbs;
   96|  88.7k|    UWORD32 u1_top_mb = 1;
   97|  88.7k|    WORD32 i2_prev_slice_mbx = ps_dec->i2_prev_slice_mbx;
   98|  88.7k|    UWORD32 u2_top_right_mask = TOP_RIGHT_DEFAULT_AVAILABLE;
  ------------------
  |  |   60|  88.7k|#define TOP_RIGHT_DEFAULT_AVAILABLE            0x5750
  ------------------
   99|  88.7k|    UWORD32 u2_top_left_mask = TOP_LEFT_DEFAULT_AVAILABLE;
  ------------------
  |  |   64|  88.7k|#define TOP_LEFT_DEFAULT_AVAILABLE            0xEEE0
  ------------------
  100|  88.7k|    ctxt_inc_mb_info_t *const p_ctx_inc_mb_map = ps_dec->p_ctxt_inc_mb_map;
  101|       |
  102|       |    /*--------------------------------------------------------------------*/
  103|       |    /* Calculate values of mb_x and mb_y                                  */
  104|       |    /*--------------------------------------------------------------------*/
  105|  88.7k|    mb_x = (WORD16) ps_dec->u2_mbx;
  106|  88.7k|    mb_y = (WORD16) ps_dec->u2_mby;
  107|  88.7k|    ps_dec->u4_cur_mb_addr = u2_cur_mb_address;
  108|       |
  109|  88.7k|    mb_x++;
  110|  88.7k|    if((UWORD32) mb_x == u2_frm_width_in_mb)
  ------------------
  |  Branch (110:8): [True: 21.6k, False: 67.0k]
  ------------------
  111|  21.6k|    {
  112|  21.6k|        mb_x = 0;
  113|  21.6k|        mb_y++;
  114|  21.6k|        if(mb_y >= ps_dec->u2_frm_ht_in_mbs)
  ------------------
  |  Branch (114:12): [True: 0, False: 21.6k]
  ------------------
  115|      0|        {
  116|      0|            mb_y = ps_dec->u2_frm_ht_in_mbs - 1;
  117|      0|        }
  118|  21.6k|    }
  119|       |    /*********************************************************************/
  120|       |    /* Cabac Context Initialisations                                     */
  121|       |    /*********************************************************************/
  122|  88.7k|    ps_dec->ps_curr_ctxt_mb_info = p_ctx_inc_mb_map + mb_x;
  123|  88.7k|    ps_dec->p_left_ctxt_mb_info = p_ctx_inc_mb_map - 1;
  124|  88.7k|    ps_dec->p_top_ctxt_mb_info = p_ctx_inc_mb_map - 1;
  125|       |
  126|       |    /********************************************************************/
  127|       |    /* neighbour availablility                                          */
  128|       |    /********************************************************************/
  129|  88.7k|    if(mb_y > ps_dec->i2_prev_slice_mby)
  ------------------
  |  Branch (129:8): [True: 76.1k, False: 12.5k]
  ------------------
  130|  76.1k|    {
  131|       |        /* if not in the immemdiate row of prev slice end then top will be available */
  132|  76.1k|        if(mb_y > (ps_dec->i2_prev_slice_mby + 1)) i2_prev_slice_mbx = -1;
  ------------------
  |  Branch (132:12): [True: 62.9k, False: 13.1k]
  ------------------
  133|       |
  134|  76.1k|        if(mb_x > i2_prev_slice_mbx)
  ------------------
  |  Branch (134:12): [True: 73.3k, False: 2.75k]
  ------------------
  135|  73.3k|        {
  136|  73.3k|            u1_mb_ngbr_avail |= TOP_MB_AVAILABLE_MASK;
  ------------------
  |  |   55|  73.3k|#define TOP_MB_AVAILABLE_MASK       0x04
  ------------------
  137|  73.3k|            u2_top_right_mask |= TOP_RIGHT_TOP_AVAILABLE;
  ------------------
  |  |   62|  73.3k|#define TOP_RIGHT_TOP_AVAILABLE                0x0007
  ------------------
  138|  73.3k|            u2_top_left_mask |= TOP_LEFT_TOP_AVAILABLE;
  ------------------
  |  |   66|  73.3k|#define TOP_LEFT_TOP_AVAILABLE                0x000E
  ------------------
  139|  73.3k|            ps_dec->p_top_ctxt_mb_info = ps_dec->ps_curr_ctxt_mb_info;
  140|  73.3k|        }
  141|  76.1k|        if((mb_x > (i2_prev_slice_mbx - 1)) && ((UWORD32) mb_x != (u2_frm_width_in_mb - 1)))
  ------------------
  |  Branch (141:12): [True: 73.8k, False: 2.24k]
  |  Branch (141:48): [True: 53.2k, False: 20.5k]
  ------------------
  142|  53.2k|        {
  143|  53.2k|            u1_mb_ngbr_avail |= TOP_RIGHT_MB_AVAILABLE_MASK;
  ------------------
  |  |   56|  53.2k|#define TOP_RIGHT_MB_AVAILABLE_MASK 0x08
  ------------------
  144|  53.2k|            u2_top_right_mask |= TOP_RIGHT_TOPR_AVAILABLE;
  ------------------
  |  |   61|  53.2k|#define TOP_RIGHT_TOPR_AVAILABLE               0x0008
  ------------------
  145|  53.2k|        }
  146|       |
  147|  76.1k|        if(mb_x > (i2_prev_slice_mbx + 1))
  ------------------
  |  Branch (147:12): [True: 51.7k, False: 24.4k]
  ------------------
  148|  51.7k|        {
  149|  51.7k|            u1_mb_ngbr_avail |= TOP_LEFT_MB_AVAILABLE_MASK;
  ------------------
  |  |   54|  51.7k|#define TOP_LEFT_MB_AVAILABLE_MASK  0x02
  ------------------
  150|  51.7k|            u2_top_left_mask |= TOP_LEFT_TOPL_AVAILABLE;
  ------------------
  |  |   65|  51.7k|#define TOP_LEFT_TOPL_AVAILABLE               0x0001
  ------------------
  151|  51.7k|        }
  152|       |        /* Next row */
  153|  76.1k|        i2_prev_slice_mbx = -1;
  154|  76.1k|    }
  155|       |    /* Same row */
  156|  88.7k|    if(mb_x > (i2_prev_slice_mbx + 1))
  ------------------
  |  Branch (156:8): [True: 63.7k, False: 24.9k]
  ------------------
  157|  63.7k|    {
  158|  63.7k|        u1_mb_ngbr_avail |= LEFT_MB_AVAILABLE_MASK;
  ------------------
  |  |   53|  63.7k|#define LEFT_MB_AVAILABLE_MASK      0x01
  ------------------
  159|  63.7k|        u2_top_left_mask |= TOP_LEFT_LEFT_AVAILABLE;
  ------------------
  |  |   67|  63.7k|#define TOP_LEFT_LEFT_AVAILABLE               0x1110
  ------------------
  160|  63.7k|        ps_dec->p_left_ctxt_mb_info = ps_dec->ps_curr_ctxt_mb_info - 1;
  161|  63.7k|    }
  162|  88.7k|    {
  163|  88.7k|        mb_neigbour_params_t *ps_cur_mb_row = ps_dec->ps_cur_mb_row;
  164|  88.7k|        mb_neigbour_params_t *ps_top_mb_row = ps_dec->ps_top_mb_row;
  165|       |        /* copy the parameters of topleft Mb */
  166|  88.7k|        ps_cur_mb_info->u1_topleft_mbtype = ps_dec->u1_topleft_mbtype;
  167|       |        /* Neighbour pointer assignments*/
  168|  88.7k|        ps_cur_mb_info->ps_curmb = ps_cur_mb_row + mb_x;
  169|  88.7k|        ps_cur_mb_info->ps_left_mb = ps_cur_mb_row + mb_x - 1;
  170|  88.7k|        ps_cur_mb_info->ps_top_mb = ps_top_mb_row + mb_x;
  171|  88.7k|        ps_cur_mb_info->ps_top_right_mb = ps_top_mb_row + mb_x + 1;
  172|       |
  173|       |        /* Update the parameters of topleftmb*/
  174|  88.7k|        ps_dec->u1_topleft_mbtype = ps_cur_mb_info->ps_top_mb->u1_mb_type;
  175|  88.7k|    }
  176|       |
  177|  88.7k|    ps_dec->u2_mby = mb_y;
  178|  88.7k|    ps_dec->u2_mbx = mb_x;
  179|  88.7k|    ps_cur_mb_info->u2_mbx = mb_x;
  180|  88.7k|    ps_cur_mb_info->u2_mby = mb_y;
  181|  88.7k|    ps_cur_mb_info->u1_topmb = u1_top_mb;
  182|  88.7k|    ps_dec->i4_submb_ofst += SUB_BLK_SIZE;
  ------------------
  |  |  562|  88.7k|#define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|  88.7k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  |  |               #define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|  88.7k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  ------------------
  183|  88.7k|    ps_dec->u1_mb_ngbr_availablity = u1_mb_ngbr_avail;
  184|  88.7k|    ps_cur_mb_info->u1_mb_ngbr_availablity = u1_mb_ngbr_avail;
  185|  88.7k|    ps_cur_mb_info->ps_curmb->u1_mb_fld = ps_dec->u1_cur_mb_fld_dec_flag;
  186|  88.7k|    ps_cur_mb_info->u1_mb_field_decodingflag = ps_dec->u1_cur_mb_fld_dec_flag;
  187|  88.7k|    ps_cur_mb_info->u2_top_left_avail_mask = u2_top_left_mask;
  188|  88.7k|    ps_cur_mb_info->u2_top_right_avail_mask = u2_top_right_mask;
  189|       |
  190|       |    /*********************************************************************/
  191|       |    /*                  Assign the neigbours                             */
  192|       |    /*********************************************************************/
  193|  88.7k|    if(u4_mbskip)
  ------------------
  |  Branch (193:8): [True: 81.7k, False: 6.96k]
  ------------------
  194|  81.7k|    {
  195|  81.7k|        UWORD8 u1_a, u1_b;
  196|  81.7k|        UWORD32 u4_ctx_inc;
  197|       |
  198|  81.7k|        u1_a = (ps_dec->p_top_ctxt_mb_info->u1_mb_type != CAB_INFERRED)
  ------------------
  |  |   74|  81.7k|#define CAB_INFERRED 0xFF
  ------------------
  |  Branch (198:16): [True: 78.8k, False: 2.91k]
  ------------------
  199|  81.7k|                   ? (!!(ps_dec->p_top_ctxt_mb_info->u1_mb_type & CAB_SKIP_MASK))
  ------------------
  |  |  401|  78.8k|#define CAB_SKIP_MASK     0x10 /* 0001 0000 */
  ------------------
  200|  81.7k|                   : 0;
  201|  81.7k|        u1_b = (ps_dec->p_left_ctxt_mb_info->u1_mb_type != CAB_INFERRED)
  ------------------
  |  |   74|  81.7k|#define CAB_INFERRED 0xFF
  ------------------
  |  Branch (201:16): [True: 79.5k, False: 2.22k]
  ------------------
  202|  81.7k|                   ? (!!(ps_dec->p_left_ctxt_mb_info->u1_mb_type & CAB_SKIP_MASK))
  ------------------
  |  |  401|  79.5k|#define CAB_SKIP_MASK     0x10 /* 0001 0000 */
  ------------------
  203|  81.7k|                   : 0;
  204|  81.7k|        u4_ctx_inc = 2 - (u1_a + u1_b);
  205|       |
  206|  81.7k|        u4_mbskip = ih264d_decode_bin(u4_ctx_inc, ps_dec->p_mb_skip_flag_t, ps_dec->ps_bitstrm,
  207|  81.7k|                                      &ps_dec->s_cab_dec_env);
  208|       |
  209|  81.7k|        if(!u4_mbskip)
  ------------------
  |  Branch (209:12): [True: 60.8k, False: 20.9k]
  ------------------
  210|  60.8k|        {
  211|  60.8k|            if(!(u1_mb_ngbr_avail & LEFT_MB_AVAILABLE_MASK))
  ------------------
  |  |   53|  60.8k|#define LEFT_MB_AVAILABLE_MASK      0x01
  ------------------
  |  Branch (211:16): [True: 14.3k, False: 46.4k]
  ------------------
  212|  14.3k|            {
  213|  14.3k|                UWORD32 *pu4_buf;
  214|  14.3k|                UWORD8 *pu1_buf;
  215|       |
  216|  14.3k|                pu1_buf = ps_dec->pu1_left_nnz_y;
  217|  14.3k|                pu4_buf = (UWORD32 *) pu1_buf;
  218|  14.3k|                *pu4_buf = 0;
  219|  14.3k|                pu1_buf = ps_dec->pu1_left_nnz_uv;
  220|  14.3k|                pu4_buf = (UWORD32 *) pu1_buf;
  221|  14.3k|                *pu4_buf = 0;
  222|       |
  223|  14.3k|                *(ps_dec->pu1_left_yuv_dc_csbp) = 0;
  224|  14.3k|                MEMSET_16BYTES(&ps_dec->pu1_left_mv_ctxt_inc[0][0], 0);
  ------------------
  |  |  652|  14.3k|#define MEMSET_16BYTES(pu4_start,value)                         \
  |  |  653|  14.3k|{                                                               \
  |  |  654|  14.3k|    memset(pu4_start,value,16);                                 \
  |  |  655|  14.3k|}
  ------------------
  225|  14.3k|                *(UWORD32 *) ps_dec->pi1_left_ref_idx_ctxt_inc = 0;
  226|  14.3k|            }
  227|  60.8k|            if(!(u1_mb_ngbr_avail & TOP_MB_AVAILABLE_MASK))
  ------------------
  |  |   55|  60.8k|#define TOP_MB_AVAILABLE_MASK       0x04
  ------------------
  |  Branch (227:16): [True: 9.48k, False: 51.3k]
  ------------------
  228|  9.48k|            {
  229|  9.48k|                MEMSET_16BYTES(ps_dec->ps_curr_ctxt_mb_info->u1_mv, 0);
  ------------------
  |  |  652|  9.48k|#define MEMSET_16BYTES(pu4_start,value)                         \
  |  |  653|  9.48k|{                                                               \
  |  |  654|  9.48k|    memset(pu4_start,value,16);                                 \
  |  |  655|  9.48k|}
  ------------------
  230|  9.48k|                memset(ps_dec->ps_curr_ctxt_mb_info->i1_ref_idx, 0, 4);
  231|  9.48k|            }
  232|  60.8k|        }
  233|  81.7k|    }
  234|  88.7k|    return (u4_mbskip);
  235|  88.7k|}
isvcd_get_mb_info_cavlc_nonmbaff:
  271|   541k|{
  272|   541k|    WORD32 mb_x;
  273|   541k|    WORD32 mb_y;
  274|   541k|    UWORD8 u1_mb_ngbr_avail = 0;
  275|   541k|    UWORD16 u2_frm_width_in_mb = ps_dec->u2_frm_wd_in_mbs;
  276|   541k|    WORD16 i2_prev_slice_mbx = ps_dec->i2_prev_slice_mbx;
  277|   541k|    UWORD16 u2_top_right_mask = TOP_RIGHT_DEFAULT_AVAILABLE;
  ------------------
  |  |   60|   541k|#define TOP_RIGHT_DEFAULT_AVAILABLE            0x5750
  ------------------
  278|   541k|    UWORD16 u2_top_left_mask = TOP_LEFT_DEFAULT_AVAILABLE;
  ------------------
  |  |   64|   541k|#define TOP_LEFT_DEFAULT_AVAILABLE            0xEEE0
  ------------------
  279|   541k|    UNUSED(u4_mbskip_run);
  ------------------
  |  |   45|   541k|#define UNUSED(x) ((void)(x))
  ------------------
  280|       |    /*--------------------------------------------------------------------*/
  281|       |    /* Calculate values of mb_x and mb_y                                  */
  282|       |    /*--------------------------------------------------------------------*/
  283|   541k|    mb_x = (WORD16) ps_dec->u2_mbx;
  284|   541k|    mb_y = (WORD16) ps_dec->u2_mby;
  285|       |
  286|   541k|    ps_dec->u4_cur_mb_addr = u2_cur_mb_address;
  287|       |
  288|   541k|    mb_x++;
  289|       |
  290|   541k|    if(mb_x == u2_frm_width_in_mb)
  ------------------
  |  Branch (290:8): [True: 91.8k, False: 449k]
  ------------------
  291|  91.8k|    {
  292|  91.8k|        mb_x = 0;
  293|  91.8k|        mb_y++;
  294|  91.8k|        if(mb_y >= ps_dec->u2_frm_ht_in_mbs)
  ------------------
  |  Branch (294:12): [True: 0, False: 91.8k]
  ------------------
  295|      0|        {
  296|      0|            mb_y = ps_dec->u2_frm_ht_in_mbs - 1;
  297|      0|        }
  298|  91.8k|    }
  299|   541k|    if(mb_y > ps_dec->i2_prev_slice_mby)
  ------------------
  |  Branch (299:8): [True: 518k, False: 23.6k]
  ------------------
  300|   518k|    {
  301|       |        /* if not in the immemdiate row of prev slice end then top
  302|       |         will be available */
  303|   518k|        if(mb_y > (ps_dec->i2_prev_slice_mby + 1)) i2_prev_slice_mbx = -1;
  ------------------
  |  Branch (303:12): [True: 495k, False: 22.2k]
  ------------------
  304|       |
  305|   518k|        if(mb_x > i2_prev_slice_mbx)
  ------------------
  |  Branch (305:12): [True: 514k, False: 3.08k]
  ------------------
  306|   514k|        {
  307|   514k|            u1_mb_ngbr_avail |= TOP_MB_AVAILABLE_MASK;
  ------------------
  |  |   55|   514k|#define TOP_MB_AVAILABLE_MASK       0x04
  ------------------
  308|   514k|            u2_top_right_mask |= TOP_RIGHT_TOP_AVAILABLE;
  ------------------
  |  |   62|   514k|#define TOP_RIGHT_TOP_AVAILABLE                0x0007
  ------------------
  309|   514k|            u2_top_left_mask |= TOP_LEFT_TOP_AVAILABLE;
  ------------------
  |  |   66|   514k|#define TOP_LEFT_TOP_AVAILABLE                0x000E
  ------------------
  310|   514k|        }
  311|       |
  312|   518k|        if((mb_x > (i2_prev_slice_mbx - 1)) && (mb_x != (u2_frm_width_in_mb - 1)))
  ------------------
  |  Branch (312:12): [True: 515k, False: 2.25k]
  |  Branch (312:48): [True: 424k, False: 91.6k]
  ------------------
  313|   424k|        {
  314|   424k|            u1_mb_ngbr_avail |= TOP_RIGHT_MB_AVAILABLE_MASK;
  ------------------
  |  |   56|   424k|#define TOP_RIGHT_MB_AVAILABLE_MASK 0x08
  ------------------
  315|   424k|            u2_top_right_mask |= TOP_RIGHT_TOPR_AVAILABLE;
  ------------------
  |  |   61|   424k|#define TOP_RIGHT_TOPR_AVAILABLE               0x0008
  ------------------
  316|   424k|        }
  317|       |
  318|   518k|        if(mb_x > (i2_prev_slice_mbx + 1))
  ------------------
  |  Branch (318:12): [True: 423k, False: 94.7k]
  ------------------
  319|   423k|        {
  320|   423k|            u1_mb_ngbr_avail |= TOP_LEFT_MB_AVAILABLE_MASK;
  ------------------
  |  |   54|   423k|#define TOP_LEFT_MB_AVAILABLE_MASK  0x02
  ------------------
  321|   423k|            u2_top_left_mask |= TOP_LEFT_TOPL_AVAILABLE;
  ------------------
  |  |   65|   423k|#define TOP_LEFT_TOPL_AVAILABLE               0x0001
  ------------------
  322|   423k|        }
  323|       |
  324|       |        /* Next row  Left will be available*/
  325|   518k|        i2_prev_slice_mbx = -1;
  326|   518k|    }
  327|       |
  328|       |    /* Same row */
  329|   541k|    if(mb_x > (i2_prev_slice_mbx + 1))
  ------------------
  |  Branch (329:8): [True: 446k, False: 94.7k]
  ------------------
  330|   446k|    {
  331|   446k|        u1_mb_ngbr_avail |= LEFT_MB_AVAILABLE_MASK;
  ------------------
  |  |   53|   446k|#define LEFT_MB_AVAILABLE_MASK      0x01
  ------------------
  332|   446k|        u2_top_left_mask |= TOP_LEFT_LEFT_AVAILABLE;
  ------------------
  |  |   67|   446k|#define TOP_LEFT_LEFT_AVAILABLE               0x1110
  ------------------
  333|   446k|    }
  334|       |
  335|   541k|    {
  336|   541k|        mb_neigbour_params_t *ps_cur_mb_row = ps_dec->ps_cur_mb_row;
  337|   541k|        mb_neigbour_params_t *ps_top_mb_row = ps_dec->ps_top_mb_row;
  338|       |
  339|       |        /* copy the parameters of topleft Mb */
  340|   541k|        ps_cur_mb_info->u1_topleft_mbtype = ps_dec->u1_topleft_mbtype;
  341|       |        /* Neighbour pointer assignments*/
  342|   541k|        ps_cur_mb_info->ps_curmb = ps_cur_mb_row + mb_x;
  343|   541k|        ps_cur_mb_info->ps_left_mb = ps_cur_mb_row + mb_x - 1;
  344|   541k|        ps_cur_mb_info->ps_top_mb = ps_top_mb_row + mb_x;
  345|   541k|        ps_cur_mb_info->ps_top_right_mb = ps_top_mb_row + mb_x + 1;
  346|       |
  347|       |        /* Update the parameters of topleftmb*/
  348|   541k|        ps_dec->u1_topleft_mbtype = ps_cur_mb_info->ps_top_mb->u1_mb_type;
  349|   541k|    }
  350|       |
  351|   541k|    ps_dec->u2_mby = mb_y;
  352|   541k|    ps_dec->u2_mbx = mb_x;
  353|   541k|    ps_cur_mb_info->u2_mbx = mb_x;
  354|   541k|    ps_cur_mb_info->u2_mby = mb_y;
  355|   541k|    ps_cur_mb_info->u1_topmb = 1;
  356|   541k|    ps_dec->i4_submb_ofst += SUB_BLK_SIZE;
  ------------------
  |  |  562|   541k|#define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|   541k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  |  |               #define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|   541k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  ------------------
  357|   541k|    ps_dec->u1_mb_ngbr_availablity = u1_mb_ngbr_avail;
  358|   541k|    ps_cur_mb_info->u1_mb_ngbr_availablity = u1_mb_ngbr_avail;
  359|   541k|    ps_cur_mb_info->ps_curmb->u1_mb_fld = ps_dec->u1_cur_mb_fld_dec_flag;
  360|   541k|    ps_cur_mb_info->u1_mb_field_decodingflag = ps_dec->u1_cur_mb_fld_dec_flag;
  361|   541k|    ps_cur_mb_info->u2_top_left_avail_mask = u2_top_left_mask;
  362|   541k|    ps_cur_mb_info->u2_top_right_avail_mask = u2_top_right_mask;
  363|   541k|    return (OK);
  ------------------
  |  |  114|   541k|#define OK        0
  ------------------
  364|   541k|}

isvcd_ref_lyr_part_idc:
  783|  1.15k|{
  784|       |    /*! Flow of the module is as follows                                   */
  785|       |    /*! 1. runs loops over the 16 4x4 blocks and gets teh reference layer
  786|       |    patition information by projecting the 1,1 locations of
  787|       |    each block                                                      */
  788|       |    /*! 2. if the projected partition is in INTRA MB then its stores -1
  789|       |    to the partition idc array                                      */
  790|       |    /*! 3. if projected partition is in INTER MB then it packs and stores
  791|       |    the offsets form the starting pointer in the part_idc array     */
  792|       |    /*! 4. IN non dyaydic cases. the part idc having -1 are replaced by
  793|       |    neighbours if the current MB projected is not INTRA             */
  794|       |    /*! 5. the -1 values are replaced first on a 4x4 inside an 8x8 basis   */
  795|       |    /*! 6. in second iteration -1 are replaced at an 8x8 basis             */
  796|       |    /*! 7. stores the intra MB status in the location given                */
  797|       |
  798|  1.15k|    mode_motion_ctxt_t *ps_ctxt;
  799|  1.15k|    mode_motion_lyr_ctxt *ps_lyr_mem;
  800|  1.15k|    inter_lyr_mb_prms_t *ps_inter_lyr_mb_prms;
  801|  1.15k|    WORD32 i4_blk_y, i4_blk_x;
  802|  1.15k|    WORD32 i4_mb_x, i4_mb_y;
  803|  1.15k|    WORD32 i4_intra_mb_flag;
  804|  1.15k|    WORD32 i4_inter_lyr_mb_prms_stride;
  805|  1.15k|    dec_mb_info_t *ps_mb_params;
  806|       |
  807|  1.15k|    ps_mb_params = (dec_mb_info_t *) pv_mb_params;
  808|  1.15k|    ps_ctxt = (mode_motion_ctxt_t *) pv_comp_mode_mv_ctxt;
  809|       |
  810|       |    /* get the current layer ctxt */
  811|  1.15k|    ps_lyr_mem = &ps_ctxt->as_res_lyr_mem[ps_ctxt->i4_res_id];
  812|       |
  813|       |    /* ref layer mb mode */
  814|  1.15k|    ps_inter_lyr_mb_prms = (inter_lyr_mb_prms_t *) ps_lyr_mem->s_ref_mb_mode.pv_buffer;
  815|  1.15k|    i4_inter_lyr_mb_prms_stride = ps_lyr_mem->s_ref_mb_mode.i4_num_element_stride;
  816|       |
  817|       |    /* derive the MB_X and MB_Y for the current MB */
  818|  1.15k|    i4_mb_x = ps_mb_params->u2_mbx;
  819|  1.15k|    i4_mb_y = ps_mb_params->u2_mby;
  820|       |
  821|       |    /* set the intra MB flag to default TRUE */
  822|  1.15k|    i4_intra_mb_flag = SVCD_TRUE;
  ------------------
  |  |   46|  1.15k|#define SVCD_TRUE 1
  ------------------
  823|       |
  824|       |    /*-----------------------------------------------------------------------*/
  825|       |    /* derive the reference layer part idc for all 16 partitions             */
  826|       |    /*-----------------------------------------------------------------------*/
  827|  5.79k|    for(i4_blk_y = 0; i4_blk_y < NUM_SUB_MB_PARTS; i4_blk_y++)
  ------------------
  |  |   60|  5.79k|#define NUM_SUB_MB_PARTS 4
  ------------------
  |  Branch (827:23): [True: 4.63k, False: 1.15k]
  ------------------
  828|  4.63k|    {
  829|  23.1k|        for(i4_blk_x = 0; i4_blk_x < NUM_SUB_MB_PARTS; i4_blk_x++)
  ------------------
  |  |   60|  23.1k|#define NUM_SUB_MB_PARTS 4
  ------------------
  |  Branch (829:27): [True: 18.5k, False: 4.63k]
  ------------------
  830|  18.5k|        {
  831|  18.5k|            WORD32 i4_curr_x, i4_curr_y;
  832|  18.5k|            WORD32 i4_ref_x, i4_ref_y;
  833|  18.5k|            WORD32 i4_ref_mb_x, i4_ref_mb_y;
  834|  18.5k|            WORD8 i1_ref_mb_mode;
  835|  18.5k|            inter_lyr_mb_prms_t *ps_inter_lyr_mb_prms_temp;
  836|       |
  837|  18.5k|            i4_curr_x = (i4_mb_x << 4) + (i4_blk_x << 2) + 1;
  838|  18.5k|            i4_curr_y = (i4_mb_y << 4) + (i4_blk_y << 2) + 1;
  839|       |
  840|       |            /* get the colocated position in the refernce layer */
  841|  18.5k|            i4_ref_x = ps_lyr_mem->pi2_ref_loc_x[i4_curr_x];
  842|  18.5k|            i4_ref_y = ps_lyr_mem->pi2_ref_loc_y[i4_curr_y];
  843|       |
  844|  18.5k|            i4_ref_x = CLIP3(0, ((ps_lyr_mem->i4_ref_width) - 1), i4_ref_x);
  ------------------
  |  |   77|  18.5k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 0, False: 18.5k]
  |  |  |  Branch (77:54): [True: 0, False: 18.5k]
  |  |  ------------------
  ------------------
  845|       |
  846|  18.5k|            i4_ref_y = CLIP3(0, ((ps_lyr_mem->i4_ref_height) - 1), i4_ref_y);
  ------------------
  |  |   77|  18.5k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 0, False: 18.5k]
  |  |  |  Branch (77:54): [True: 0, False: 18.5k]
  |  |  ------------------
  ------------------
  847|       |
  848|       |            /* get the reference mb x and y */
  849|  18.5k|            i4_ref_mb_x = (i4_ref_x >> 4);
  850|  18.5k|            i4_ref_mb_y = (i4_ref_y >> 4);
  851|       |
  852|       |            /* get the appropriate mb params in reference layer */
  853|  18.5k|            ps_inter_lyr_mb_prms_temp = ps_inter_lyr_mb_prms + i4_ref_mb_x;
  854|  18.5k|            ps_inter_lyr_mb_prms_temp += i4_ref_mb_y * i4_inter_lyr_mb_prms_stride;
  855|       |
  856|  18.5k|            i1_ref_mb_mode = ps_inter_lyr_mb_prms_temp->i1_mb_mode;
  857|       |
  858|       |            /* check if the MB mode of the refernce MB is Intra*/
  859|  18.5k|            if(i1_ref_mb_mode > SVC_INTER_MB)
  ------------------
  |  |  114|  18.5k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (859:16): [True: 4.57k, False: 13.9k]
  ------------------
  860|  4.57k|            {
  861|       |                /* store the -1 value */
  862|  4.57k|                ai4_ref_part_idc[i4_blk_y][i4_blk_x] = -1;
  863|  4.57k|            }
  864|  13.9k|            else
  865|  13.9k|            {
  866|       |                /* pack and store the reference x and y */
  867|  13.9k|                ai4_ref_part_idc[i4_blk_y][i4_blk_x] = (i4_ref_y << 16) + i4_ref_x;
  868|  13.9k|                i4_intra_mb_flag = SVCD_FALSE;
  ------------------
  |  |   45|  13.9k|#define SVCD_FALSE 0
  ------------------
  869|  13.9k|            }
  870|       |
  871|  18.5k|        } /* end of block x loop */
  872|       |
  873|  4.63k|    }     /* end of block y loop */
  874|       |
  875|       |    /*************************************************************************/
  876|       |    /* if the restricted spatial resolution change flag is 0                 */
  877|       |    /* modify the part_idc for all the partitions                            */
  878|       |    /*************************************************************************/
  879|  1.15k|    if(SVCD_FALSE == (ps_lyr_mem->ps_curr_lyr_res_prms->u1_rstrct_res_change_flag) &&
  ------------------
  |  |   45|  1.15k|#define SVCD_FALSE 0
  ------------------
  |  Branch (879:8): [True: 1.15k, False: 0]
  ------------------
  880|  1.15k|       (SVCD_FALSE == i4_intra_mb_flag))
  ------------------
  |  |   45|  1.15k|#define SVCD_FALSE 0
  ------------------
  |  Branch (880:8): [True: 1.03k, False: 124]
  ------------------
  881|  1.03k|    {
  882|       |        /* replace values of "-1" on a 4x4 block basis */
  883|  1.03k|        WORD32 i4_xp, i4_yp;
  884|  1.03k|        WORD32 i4_indx_x, i4_indx_y;
  885|  1.03k|        WORD32 ai4_flag_8x8[2][2] = {SVCD_FALSE};
  ------------------
  |  |   45|  1.03k|#define SVCD_FALSE 0
  ------------------
  886|       |
  887|       |        /* loop over (4) 8x8 partitions */
  888|  3.10k|        for(i4_yp = 0; i4_yp < 2; i4_yp++)
  ------------------
  |  Branch (888:24): [True: 2.06k, False: 1.03k]
  ------------------
  889|  2.06k|        {
  890|  6.20k|            for(i4_xp = 0; i4_xp < 2; i4_xp++)
  ------------------
  |  Branch (890:28): [True: 4.13k, False: 2.06k]
  ------------------
  891|  4.13k|            {
  892|  4.13k|                WORD32 i4_xs, i4_ys;
  893|  4.13k|                WORD32 ai4_flag_4x4[2][2] = {SVCD_FALSE};
  ------------------
  |  |   45|  4.13k|#define SVCD_FALSE 0
  ------------------
  894|       |
  895|       |                /* loop over (4) 4x4 partitions */
  896|  12.4k|                for(i4_ys = 0; i4_ys < 2; i4_ys++)
  ------------------
  |  Branch (896:32): [True: 8.27k, False: 4.13k]
  ------------------
  897|  8.27k|                {
  898|  24.8k|                    for(i4_xs = 0; i4_xs < 2; i4_xs++)
  ------------------
  |  Branch (898:36): [True: 16.5k, False: 8.27k]
  ------------------
  899|  16.5k|                    {
  900|       |                        /* index to the exact 4x4 block */
  901|  16.5k|                        i4_indx_y = (i4_yp << 1) + i4_ys;
  902|  16.5k|                        i4_indx_x = (i4_xp << 1) + i4_xs;
  903|       |
  904|       |                        /* check if the current part idc is -1*/
  905|  16.5k|                        if(ai4_ref_part_idc[i4_indx_y][i4_indx_x] == -1)
  ------------------
  |  Branch (905:28): [True: 2.58k, False: 13.9k]
  ------------------
  906|  2.58k|                        {
  907|  2.58k|                            WORD32 i4_temp_x = 1 - i4_xs;
  908|  2.58k|                            WORD32 i4_temp_y = 1 - i4_ys;
  909|  2.58k|                            WORD32 i4_temp_part_y = (i4_yp << 1) + i4_temp_y;
  910|       |
  911|  2.58k|                            WORD32 i4_temp_part_x = (i4_xp << 1) + i4_temp_x;
  912|       |
  913|  2.58k|                            ai4_flag_4x4[i4_ys][i4_xs] = SVCD_TRUE;
  ------------------
  |  |   46|  2.58k|#define SVCD_TRUE 1
  ------------------
  914|       |
  915|       |                            /* replace with appropriate values */
  916|  2.58k|                            if((SVCD_FALSE == ai4_flag_4x4[i4_ys][i4_temp_x]) &&
  ------------------
  |  |   45|  2.58k|#define SVCD_FALSE 0
  ------------------
  |  Branch (916:32): [True: 1.29k, False: 1.29k]
  ------------------
  917|  1.29k|                               (ai4_ref_part_idc[i4_indx_y][i4_temp_part_x] != -1))
  ------------------
  |  Branch (917:32): [True: 0, False: 1.29k]
  ------------------
  918|      0|                            {
  919|      0|                                ai4_ref_part_idc[i4_indx_y][i4_indx_x] =
  920|      0|                                    ai4_ref_part_idc[i4_indx_y][i4_temp_part_x];
  921|      0|                            }
  922|  2.58k|                            else if((SVCD_FALSE == ai4_flag_4x4[i4_temp_y][i4_xs]) &&
  ------------------
  |  |   45|  2.58k|#define SVCD_FALSE 0
  ------------------
  |  Branch (922:37): [True: 1.29k, False: 1.29k]
  ------------------
  923|  1.29k|                                    (ai4_ref_part_idc[i4_temp_part_y][i4_indx_x] != -1))
  ------------------
  |  Branch (923:37): [True: 0, False: 1.29k]
  ------------------
  924|      0|                            {
  925|      0|                                ai4_ref_part_idc[i4_indx_y][i4_indx_x] =
  926|      0|                                    ai4_ref_part_idc[i4_temp_part_y][i4_indx_x];
  927|      0|                            }
  928|  2.58k|                            else if((SVCD_FALSE == ai4_flag_4x4[i4_temp_y][i4_temp_x]) &&
  ------------------
  |  |   45|  2.58k|#define SVCD_FALSE 0
  ------------------
  |  Branch (928:37): [True: 1.29k, False: 1.29k]
  ------------------
  929|  1.29k|                                    (ai4_ref_part_idc[i4_temp_part_y][i4_temp_part_x] != -1))
  ------------------
  |  Branch (929:37): [True: 0, False: 1.29k]
  ------------------
  930|      0|                            {
  931|      0|                                ai4_ref_part_idc[i4_indx_y][i4_indx_x] =
  932|      0|                                    ai4_ref_part_idc[i4_temp_part_y][i4_temp_part_x];
  933|      0|                            }
  934|  2.58k|                        } /* end of part idc equal to -1 check */
  935|       |
  936|  16.5k|                    }     /* end of sub partition xs loop */
  937|       |
  938|  8.27k|                }         /* end of sub partition ys loop */
  939|       |
  940|  4.13k|            }             /* end of partition xp loop */
  941|       |
  942|  2.06k|        }                 /* end of partition yp loop */
  943|       |
  944|       |        /* replace values of "-1" on an 8x8 block basis */
  945|       |
  946|       |        /* loop over (4) 8x8 partitions */
  947|  3.10k|        for(i4_yp = 0; i4_yp < 2; i4_yp++)
  ------------------
  |  Branch (947:24): [True: 2.06k, False: 1.03k]
  ------------------
  948|  2.06k|        {
  949|  6.20k|            for(i4_xp = 0; i4_xp < 2; i4_xp++)
  ------------------
  |  Branch (949:28): [True: 4.13k, False: 2.06k]
  ------------------
  950|  4.13k|            {
  951|  4.13k|                WORD32 i4_yp_inv = 1 - i4_yp;
  952|  4.13k|                WORD32 i4_xp_inv = 1 - i4_xp;
  953|  4.13k|                WORD32 i4_xo_inv = (2 - i4_xp);
  954|  4.13k|                WORD32 i4_yo_inv = (2 - i4_yp);
  955|  4.13k|                i4_indx_x = (i4_xp << 1);
  956|  4.13k|                i4_indx_y = (i4_yp << 1);
  957|       |
  958|       |                /* check if the current part idc is -1*/
  959|  4.13k|                if(ai4_ref_part_idc[i4_indx_y][i4_indx_x] == -1)
  ------------------
  |  Branch (959:20): [True: 647, False: 3.48k]
  ------------------
  960|    647|                {
  961|    647|                    ai4_flag_8x8[i4_yp][i4_xp] = SVCD_TRUE;
  ------------------
  |  |   46|    647|#define SVCD_TRUE 1
  ------------------
  962|       |
  963|       |                    /* replace the -1 with appropriate values */
  964|    647|                    if(SVCD_FALSE == ai4_flag_8x8[i4_yp][i4_xp_inv] &&
  ------------------
  |  |   45|    647|#define SVCD_FALSE 0
  ------------------
  |  Branch (964:24): [True: 523, False: 124]
  ------------------
  965|    523|                       ai4_ref_part_idc[i4_indx_y][i4_xo_inv] != -1)
  ------------------
  |  Branch (965:24): [True: 399, False: 124]
  ------------------
  966|    399|                    {
  967|    399|                        ai4_ref_part_idc[i4_indx_y][i4_indx_x] =
  968|    399|                            ai4_ref_part_idc[i4_indx_y][i4_xo_inv];
  969|       |
  970|    399|                        ai4_ref_part_idc[i4_indx_y + 1][i4_indx_x] =
  971|    399|                            ai4_ref_part_idc[i4_indx_y + 1][i4_xo_inv];
  972|       |
  973|    399|                        ai4_ref_part_idc[i4_indx_y][i4_indx_x + 1] =
  974|    399|                            ai4_ref_part_idc[i4_indx_y][i4_xo_inv];
  975|       |
  976|    399|                        ai4_ref_part_idc[i4_indx_y + 1][i4_indx_x + 1] =
  977|    399|                            ai4_ref_part_idc[i4_indx_y + 1][i4_xo_inv];
  978|    399|                    }
  979|    248|                    else if(SVCD_FALSE == ai4_flag_8x8[i4_yp_inv][i4_xp] &&
  ------------------
  |  |   45|    248|#define SVCD_FALSE 0
  ------------------
  |  Branch (979:29): [True: 248, False: 0]
  ------------------
  980|    248|                            ai4_ref_part_idc[i4_yo_inv][i4_indx_x] != -1)
  ------------------
  |  Branch (980:29): [True: 248, False: 0]
  ------------------
  981|    248|                    {
  982|    248|                        ai4_ref_part_idc[i4_indx_y][i4_indx_x] =
  983|    248|                            ai4_ref_part_idc[i4_yo_inv][i4_indx_x];
  984|       |
  985|    248|                        ai4_ref_part_idc[i4_indx_y + 1][i4_indx_x] =
  986|    248|                            ai4_ref_part_idc[i4_yo_inv][i4_indx_x];
  987|       |
  988|    248|                        ai4_ref_part_idc[i4_indx_y][i4_indx_x + 1] =
  989|    248|                            ai4_ref_part_idc[i4_yo_inv][i4_indx_x + 1];
  990|       |
  991|    248|                        ai4_ref_part_idc[i4_indx_y + 1][i4_indx_x + 1] =
  992|    248|                            ai4_ref_part_idc[i4_yo_inv][i4_indx_x + 1];
  993|    248|                    }
  994|      0|                    else if(SVCD_FALSE == ai4_flag_8x8[i4_yp_inv][i4_xp_inv] &&
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
  |  Branch (994:29): [True: 0, False: 0]
  ------------------
  995|      0|                            ai4_ref_part_idc[i4_yo_inv][i4_xo_inv] != -1)
  ------------------
  |  Branch (995:29): [True: 0, False: 0]
  ------------------
  996|      0|                    {
  997|      0|                        ai4_ref_part_idc[i4_indx_y][i4_indx_x] =
  998|      0|                            ai4_ref_part_idc[i4_yo_inv][i4_xo_inv];
  999|       |
 1000|      0|                        ai4_ref_part_idc[i4_indx_y + 1][i4_indx_x] =
 1001|      0|                            ai4_ref_part_idc[i4_yo_inv][i4_xo_inv];
 1002|       |
 1003|      0|                        ai4_ref_part_idc[i4_indx_y][i4_indx_x + 1] =
 1004|      0|                            ai4_ref_part_idc[i4_yo_inv][i4_xo_inv];
 1005|       |
 1006|      0|                        ai4_ref_part_idc[i4_indx_y + 1][i4_indx_x + 1] =
 1007|      0|                            ai4_ref_part_idc[i4_yo_inv][i4_xo_inv];
 1008|      0|                    }
 1009|    647|                } /* end of part idc equal to -1 check */
 1010|       |
 1011|  4.13k|            }     /* end of partition xp loop */
 1012|       |
 1013|  2.06k|        }         /* end of partition yp loop */
 1014|       |
 1015|  1.03k|    }             /* end of refinement of part idc for non dyadic case*/
 1016|       |
 1017|       |    /* store the intra flag in the location provided */
 1018|  1.15k|    *pi4_intra_flag = i4_intra_mb_flag;
 1019|       |
 1020|  1.15k|    return;
 1021|  1.15k|}
isvcd_check_motion:
 1049|  14.8k|{
 1050|  14.8k|    mv_pred_t *ps_part_a;
 1051|  14.8k|    mv_pred_t *ps_part_b;
 1052|  14.8k|    WORD32 i4_cntr;
 1053|  14.8k|    WORD32 i4_mv_treshold;
 1054|  14.8k|    WORD32 i4_flag = 0;
 1055|       |
 1056|  14.8k|    ps_part_a = (mv_pred_t *) pv_motion_prm_mb_part_a;
 1057|  14.8k|    ps_part_b = (mv_pred_t *) pv_motion_prm_mb_part_b;
 1058|       |
 1059|  31.0k|    for(i4_cntr = 0; i4_cntr < i4_listx; i4_cntr++)
  ------------------
  |  Branch (1059:22): [True: 16.6k, False: 14.4k]
  ------------------
 1060|  16.6k|    {
 1061|       |        /* calculate the absolute diff of both components */
 1062|  16.6k|        i4_mv_treshold = ABS((ps_part_a->i2_mv[2 * i4_cntr]) - (ps_part_b->i2_mv[2 * i4_cntr]));
  ------------------
  |  |  100|  16.6k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 125, False: 16.4k]
  |  |  ------------------
  ------------------
 1063|  16.6k|        i4_mv_treshold +=
 1064|  16.6k|            ABS((ps_part_a->i2_mv[1 + 2 * i4_cntr]) - (ps_part_b->i2_mv[1 + 2 * i4_cntr]));
  ------------------
  |  |  100|  16.6k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 48, False: 16.5k]
  |  |  ------------------
  ------------------
 1065|       |
 1066|  16.6k|        if((0 == i4_mv_treshold) &&
  ------------------
  |  Branch (1066:12): [True: 16.3k, False: 311]
  ------------------
 1067|  16.3k|           (ps_part_a->i1_ref_frame[i4_cntr] == ps_part_b->i1_ref_frame[i4_cntr]))
  ------------------
  |  Branch (1067:12): [True: 16.2k, False: 94]
  ------------------
 1068|  16.2k|        {
 1069|  16.2k|            i4_flag = 1;
 1070|  16.2k|        }
 1071|    405|        else
 1072|    405|        {
 1073|    405|            i4_flag = 0;
 1074|    405|            return (i4_flag);
 1075|    405|        }
 1076|       |
 1077|  16.6k|    } /* end of loop over lists */
 1078|       |
 1079|  14.4k|    return (i4_flag);
 1080|  14.8k|}
isvcd_get_min_positive:
 1104|  18.3k|{
 1105|  18.3k|    UWORD32 u4_x, u4_y;
 1106|  18.3k|    WORD32 i4_min_positive;
 1107|       |
 1108|       |    /* get positive values */
 1109|  18.3k|    u4_x = (UWORD32) i4_input_1;
 1110|  18.3k|    u4_y = (UWORD32) i4_input_2;
 1111|       |
 1112|       |    /* logic and desired output
 1113|       |
 1114|       |    u4_x     magnitude compare    u4_y           o/p
 1115|       |    +              >              +             u4_y
 1116|       |    +              <              +             u4_x
 1117|       |    +              =              +             u4_x
 1118|       |    -              >              -             u4_y
 1119|       |    -              <              -             u4_x
 1120|       |    -              =              -             u4_x
 1121|       |    0              =              0             u4_x
 1122|       |    -              n/a            +             u4_y
 1123|       |    +              n/a            -             u4_x
 1124|       |
 1125|       |    */
 1126|       |
 1127|  18.3k|    if((u4_y < u4_x) && (0 <= i4_input_2))
  ------------------
  |  Branch (1127:8): [True: 408, False: 17.9k]
  |  Branch (1127:25): [True: 408, False: 0]
  ------------------
 1128|    408|    {
 1129|    408|        i4_min_positive = i4_input_2;
 1130|    408|    }
 1131|  17.9k|    else
 1132|  17.9k|    {
 1133|  17.9k|        i4_min_positive = i4_input_1;
 1134|  17.9k|    }
 1135|  18.3k|    return (i4_min_positive);
 1136|  18.3k|}
isvcd_interlyr_motion_scale:
 1286|  35.4k|{
 1287|       |    /*! Flow of the module is as follows                                   */
 1288|       |    /*! 1. derive the offsets form part idc                                */
 1289|       |    /*! 2. takes the motion vector and scales it based on scale factor     */
 1290|       |    /*! 3. adds the correction factors for crop window change cases        */
 1291|       |    /*! 4. store the default motion params for intra projected blocks      */
 1292|       |
 1293|  35.4k|    mode_motion_ctxt_t *ps_ctxt;
 1294|  35.4k|    mode_motion_lyr_ctxt *ps_lyr_mem;
 1295|  35.4k|    mv_pred_t *ps_motion_pred;
 1296|  35.4k|    mv_pred_t *ps_ref_mv;
 1297|  35.4k|    WORD32 i4_lists;
 1298|  35.4k|    WORD32 i4_ref_16x16_flag = 0;
 1299|  35.4k|    WORD32 i4_scale_x, i4_scale_y;
 1300|  35.4k|    WORD16 i2_max_mv_x, i2_max_mv_y;
 1301|       |
 1302|  35.4k|    ps_ctxt = (mode_motion_ctxt_t *) pv_comp_mode_mv_ctxt;
 1303|       |
 1304|       |    /* get the current layer ctxt */
 1305|  35.4k|    ps_lyr_mem = &ps_ctxt->as_res_lyr_mem[ps_ctxt->i4_res_id];
 1306|       |
 1307|       |    /* ----------- Get the reference layer MV structure ---------- */
 1308|  35.4k|    {
 1309|  35.4k|        mv_pred_t *ps_ref_lyr_motion_prms;
 1310|  35.4k|        WORD32 i4_ref_x, i4_ref_y;
 1311|  35.4k|        WORD32 i4_ref_mb_x, i4_ref_mb_y;
 1312|  35.4k|        WORD32 i4_ref_width;
 1313|       |
 1314|  35.4k|        ps_ref_lyr_motion_prms = (mv_pred_t *) ps_lyr_mem->pv_ref_mv_bank_l0;
 1315|  35.4k|        i4_ref_width = ps_lyr_mem->i4_ref_width;
 1316|  35.4k|        i2_max_mv_x = i4_ref_width << 2;
 1317|  35.4k|        i2_max_mv_y = ps_lyr_mem->i4_ref_height << 2;
 1318|       |
 1319|       |        /* extract the reference x and y positions */
 1320|  35.4k|        i4_ref_x = (*pi4_ref_part_idc) & 0xFFFF;
 1321|  35.4k|        i4_ref_y = (*pi4_ref_part_idc) >> 16;
 1322|       |
 1323|       |        /* get the reference mb x and y */
 1324|  35.4k|        i4_ref_mb_x = (i4_ref_x >> 4);
 1325|  35.4k|        i4_ref_mb_y = (i4_ref_y >> 4);
 1326|       |
 1327|       |        /* get the reference layer motion struct pointing  */
 1328|       |        /* to first 4x4 partition of the refernce layer MB */
 1329|  35.4k|        ps_ref_mv = ps_ref_lyr_motion_prms + (i4_ref_mb_x << 4);
 1330|  35.4k|        ps_ref_mv += (i4_ref_mb_y * i4_ref_width);
 1331|       |
 1332|       |        /* if reference layer mb type is non 16x16 */
 1333|  35.4k|        if(0 == i4_ref_16x16_flag)
  ------------------
  |  Branch (1333:12): [True: 35.4k, False: 0]
  ------------------
 1334|  35.4k|        {
 1335|       |            /* increment the pointer to appropaite 4x4 */
 1336|  35.4k|            ps_ref_mv += ((i4_ref_x >> 2) & 0x03);
 1337|  35.4k|            ps_ref_mv += (((i4_ref_y >> 2) & 0x03) << 2);
 1338|  35.4k|        }
 1339|  35.4k|    }
 1340|       |
 1341|       |    /* motion pred structure */
 1342|  35.4k|    ps_motion_pred = pv_motion_pred;
 1343|       |
 1344|       |    /* retrive the scale factors */
 1345|  35.4k|    i4_scale_x = ps_lyr_mem->i4_scale_mv_x;
 1346|  35.4k|    i4_scale_y = ps_lyr_mem->i4_scale_mv_y;
 1347|       |
 1348|       |    /* loop on the lists given as input */
 1349|  74.2k|    for(i4_lists = 0; i4_lists < i4_listx; i4_lists++)
  ------------------
  |  Branch (1349:23): [True: 38.7k, False: 35.4k]
  ------------------
 1350|  38.7k|    {
 1351|  38.7k|        WORD32 i4_mv_x, i4_mv_y;
 1352|  38.7k|        WORD16 i2_mv_x, i2_mv_y;
 1353|       |
 1354|       |        /* if the refernce index is -1 set the default values */
 1355|  38.7k|        if(-1 == ps_ref_mv->i1_ref_frame[i4_lists])
  ------------------
  |  Branch (1355:12): [True: 2.17k, False: 36.5k]
  ------------------
 1356|  2.17k|        {
 1357|  2.17k|            ps_motion_pred->i1_ref_frame[i4_lists] = -1;
 1358|  2.17k|            ps_motion_pred->i2_mv[2 * i4_lists] = 0;
 1359|  2.17k|            ps_motion_pred->i2_mv[1 + 2 * i4_lists] = 0;
 1360|  2.17k|        }
 1361|  36.5k|        else
 1362|  36.5k|        {
 1363|       |            /* field MB and field pictures modification are present */
 1364|       |            /* currently not implemented */
 1365|  36.5k|            ps_motion_pred->i1_ref_frame[i4_lists] = ps_ref_mv->i1_ref_frame[i4_lists];
 1366|       |
 1367|  36.5k|            i2_mv_x = ps_ref_mv->i2_mv[2 * i4_lists];
 1368|  36.5k|            i2_mv_y = ps_ref_mv->i2_mv[1 + 2 * i4_lists];
 1369|  36.5k|            i2_mv_x = CLIP3(-i2_max_mv_x, i2_max_mv_x, i2_mv_x);
  ------------------
  |  |   77|  36.5k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 0, False: 36.5k]
  |  |  |  Branch (77:54): [True: 0, False: 36.5k]
  |  |  ------------------
  ------------------
 1370|  36.5k|            i2_mv_y = CLIP3(-i2_max_mv_y, i2_max_mv_y, i2_mv_y);
  ------------------
  |  |   77|  36.5k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 0, False: 36.5k]
  |  |  |  Branch (77:54): [True: 0, False: 36.5k]
  |  |  ------------------
  ------------------
 1371|       |            /* scale the motion vectors */
 1372|  36.5k|            i4_mv_x = (i2_mv_x * i4_scale_x + 32768) >> 16;
 1373|  36.5k|            i4_mv_y = (i2_mv_y * i4_scale_y + 32768) >> 16;
 1374|       |
 1375|       |            /* store the final motion vectors */
 1376|  36.5k|            ps_motion_pred->i2_mv[2 * i4_lists] = i4_mv_x;
 1377|  36.5k|            ps_motion_pred->i2_mv[1 + 2 * i4_lists] = i4_mv_y;
 1378|       |
 1379|       |            /* if cropping change flag is present */
 1380|  36.5k|            if(SVCD_TRUE == ps_lyr_mem->ps_curr_lyr_res_prms->u1_cropping_change_flag)
  ------------------
  |  |   46|  36.5k|#define SVCD_TRUE 1
  ------------------
  |  Branch (1380:16): [True: 0, False: 36.5k]
  ------------------
 1381|      0|            {
 1382|       |                /* over write the motion vectors x and y */
 1383|      0|                isvcd_motion_scale_crop_wdw_change(ps_ctxt, ps_lyr_mem, ps_mb_params, ps_ref_mv,
 1384|      0|                                                   ps_motion_pred, i4_listx, i4_part_frm_x,
 1385|      0|                                                   i4_part_frm_y, ppv_map_ref_idx_to_poc, i4_lists);
 1386|      0|            }
 1387|  36.5k|        }
 1388|  38.7k|    } /* end of lists loop */
 1389|       |
 1390|  35.4k|    return (i4_ref_16x16_flag);
 1391|  35.4k|}
isvcd_store_motion_map:
 1425|  18.9k|{
 1426|       |    /*! Flow of the module is as follows                                   */
 1427|       |    /*! 1. loops over part_width and part_height                           */
 1428|       |    /*! 2. copies the src params toi destination                           */
 1429|       |    /*! 3. updates the source pointer if src_update flag is set to 1       */
 1430|       |
 1431|  18.9k|    WORD32 i4_i, i4_j;
 1432|  18.9k|    mv_pred_t *ps_mv_pred_src;
 1433|  18.9k|    mv_pred_t *ps_mv_map_dst;
 1434|       |
 1435|  18.9k|    ps_mv_pred_src = (mv_pred_t *) pv_motion_pred;
 1436|  18.9k|    ps_mv_map_dst = (mv_pred_t *) pv_curr_lyr_motion_map;
 1437|       |
 1438|       |    /* store the current motion pred to all the motion map structures */
 1439|  56.7k|    for(i4_i = 0; i4_i < i4_part_height; i4_i++)
  ------------------
  |  Branch (1439:19): [True: 37.8k, False: 18.9k]
  ------------------
 1440|  37.8k|    {
 1441|   113k|        for(i4_j = 0; i4_j < i4_part_width; i4_j++)
  ------------------
  |  Branch (1441:23): [True: 75.7k, False: 37.8k]
  ------------------
 1442|  75.7k|        {
 1443|       |            /* copy form source to destination */
 1444|  75.7k|            *(ps_mv_map_dst + i4_j) = *(ps_mv_pred_src + (i4_src_update_flag * i4_j));
 1445|       |
 1446|  75.7k|        } /* end of loop over partition width */
 1447|       |
 1448|  37.8k|        ps_mv_map_dst += i4_dst_stride;
 1449|  37.8k|        ps_mv_pred_src += (i4_src_stride * i4_src_update_flag);
 1450|       |
 1451|  37.8k|    } /* end of loop over partition height */
 1452|  18.9k|    return;
 1453|  18.9k|}
isvcd_check_mv_diff:
 1482|  20.6k|{
 1483|  20.6k|    mv_pred_t *ps_part_a;
 1484|  20.6k|    mv_pred_t *ps_part_b;
 1485|  20.6k|    WORD32 i4_cntr;
 1486|  20.6k|    WORD32 i4_mv_treshold;
 1487|  20.6k|    WORD32 i4_flag;
 1488|       |
 1489|  20.6k|    ps_part_a = (mv_pred_t *) pv_motion_prm_a;
 1490|  20.6k|    ps_part_b = (mv_pred_t *) pv_motion_prm_b;
 1491|       |
 1492|  20.6k|    i4_flag = 1;
 1493|  41.4k|    for(i4_cntr = 0; i4_cntr < i4_listx; i4_cntr++)
  ------------------
  |  Branch (1493:22): [True: 22.9k, False: 18.5k]
  ------------------
 1494|  22.9k|    {
 1495|       |        /* calculate the absolute diff of both components */
 1496|  22.9k|        i4_mv_treshold = ABS((ps_part_a->i2_mv[2 * i4_cntr]) - (ps_part_b->i2_mv[2 * i4_cntr]));
  ------------------
  |  |  100|  22.9k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 2.52k, False: 20.4k]
  |  |  ------------------
  ------------------
 1497|  22.9k|        i4_mv_treshold +=
 1498|  22.9k|            ABS((ps_part_a->i2_mv[1 + (2 * i4_cntr)]) - (ps_part_b->i2_mv[1 + (2 * i4_cntr)]));
  ------------------
  |  |  100|  22.9k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 275, False: 22.6k]
  |  |  ------------------
  ------------------
 1499|       |
 1500|  22.9k|        if(i4_actual_threshold < i4_mv_treshold)
  ------------------
  |  Branch (1500:12): [True: 2.18k, False: 20.7k]
  ------------------
 1501|  2.18k|        {
 1502|  2.18k|            i4_flag = 0;
 1503|  2.18k|            break;
 1504|  2.18k|        }
 1505|       |
 1506|  22.9k|    } /* end of loop over lists */
 1507|  20.6k|    return (i4_flag);
 1508|  20.6k|}
isvcd_interlyr_motion_submbmode_pred:
 1541|  1.03k|{
 1542|       |    /*! Flow of the module is as follows                                   */
 1543|       |    /*! 1. if dyadic case it calculates the motion vectors based on dyadic
 1544|       |           scale factor and loop counts calculated at layer level          */
 1545|       |    /*! 2. if non dyadic then it calculates the motion vectors based on
 1546|       |            reference layer part idc                                        */
 1547|       |    /*! 3. does the motion vector modification for non dyayic cases, by
 1548|       |           calculating the minimum positive of reference indices of 4 4x4
 1549|       |           blocks and getiing a single reference index for 8x8             */
 1550|       |    /*! 4. if direct 8x8 inference is present and current slice is
 1551|       |           B OR EB, then it stores the corner motion vectors for each 8x8  */
 1552|       |    /*! 5. does the sub mb mode prediction and merging of motion vectors
 1553|       |           which are closely related by setting appropriate thresholds
 1554|       |           for MVs                                                         */
 1555|       |    /*! 6. stores the sub mb modes in the array given as input             */
 1556|       |
 1557|  1.03k|    mode_motion_ctxt_t *ps_ctxt;
 1558|  1.03k|    mode_motion_lyr_ctxt *ps_lyr_mem;
 1559|  1.03k|    mv_pred_t *ps_motion_pred;
 1560|  1.03k|    dec_mb_info_t *ps_mb_params;
 1561|  1.03k|    dec_svc_mb_info_t *ps_svc_mb_params;
 1562|  1.03k|    WORD32 i4_blk_y, i4_blk_x;
 1563|  1.03k|    WORD32 i4_i;
 1564|  1.03k|    WORD32 i4_listx;
 1565|  1.03k|    WORD32 i4_mv_treshold;
 1566|  1.03k|    WORD32 ai4_temp_ref_indx[NUM_REF_LISTS][NUM_MB_PARTS] = {0};
 1567|  1.03k|    WORD32 i4_mb_x, i4_mb_y;
 1568|  1.03k|    WORD32 i4_mb_pic_x, i4_mb_pic_y;
 1569|  1.03k|    dec_struct_t *ps_dec;
 1570|       |
 1571|  1.03k|    ps_dec = (dec_struct_t *) pv_dec;
 1572|  1.03k|    ps_ctxt = (mode_motion_ctxt_t *) pv_comp_mode_mv_ctxt;
 1573|       |
 1574|       |    /* get the current layer ctxt */
 1575|  1.03k|    ps_lyr_mem = &ps_ctxt->as_res_lyr_mem[ps_ctxt->i4_res_id];
 1576|       |
 1577|  1.03k|    ps_mb_params = (dec_mb_info_t *) pv_mb_params;
 1578|  1.03k|    ps_svc_mb_params = (dec_svc_mb_info_t *) pv_svc_mb_params;
 1579|  1.03k|    ps_motion_pred = ps_ctxt->ps_motion_pred_struct;
 1580|       |
 1581|  1.03k|    i4_listx = ps_ctxt->i4_listx;
 1582|       |
 1583|       |    /* derive the MB_X and MB_Y for the current MB */
 1584|  1.03k|    i4_mb_x = ps_mb_params->u2_mbx;
 1585|  1.03k|    i4_mb_y = ps_mb_params->u2_mby;
 1586|       |
 1587|       |    /* convert into picture units */
 1588|  1.03k|    i4_mb_pic_x = i4_mb_x << 4;
 1589|  1.03k|    i4_mb_pic_y = i4_mb_y << 4;
 1590|       |
 1591|       |    /* compute the motion vectors and reference indices of all part */
 1592|  5.17k|    for(i4_blk_y = 0; i4_blk_y < NUM_SUB_MB_PARTS; i4_blk_y++)
  ------------------
  |  |   60|  5.17k|#define NUM_SUB_MB_PARTS 4
  ------------------
  |  Branch (1592:23): [True: 4.13k, False: 1.03k]
  ------------------
 1593|  4.13k|    {
 1594|  20.6k|        for(i4_blk_x = 0; i4_blk_x < NUM_SUB_MB_PARTS; i4_blk_x++)
  ------------------
  |  |   60|  20.6k|#define NUM_SUB_MB_PARTS 4
  ------------------
  |  Branch (1594:27): [True: 16.5k, False: 4.13k]
  ------------------
 1595|  16.5k|        {
 1596|  16.5k|            isvcd_interlyr_motion_scale(pv_comp_mode_mv_ctxt, &ai4_ref_part_idc[i4_blk_y][i4_blk_x],
 1597|  16.5k|                                        ps_mb_params, (ps_motion_pred + (4 * i4_blk_y) + i4_blk_x),
 1598|  16.5k|                                        i4_listx, (i4_mb_pic_x + (i4_blk_x << 2) + 1),
 1599|  16.5k|                                        (i4_mb_pic_y + (i4_blk_y << 2) + 1),
 1600|  16.5k|                                        ps_dec->ppv_map_ref_idx_to_poc);
 1601|       |
 1602|  16.5k|        } /* end of blk x loop */
 1603|  4.13k|    }     /* end of blk y loop */
 1604|       |
 1605|       |    /********************************************************/
 1606|       |    /* get the final reference index into a temparory array */
 1607|       |    /********************************************************/
 1608|       |
 1609|       |    /* set reference indices */
 1610|  2.18k|    for(i4_i = 0; i4_i < i4_listx; i4_i++)
  ------------------
  |  Branch (1610:19): [True: 1.14k, False: 1.03k]
  ------------------
 1611|  1.14k|    {
 1612|  1.14k|        ai4_temp_ref_indx[i4_i][0] = ps_motion_pred[0].i1_ref_frame[i4_i];
 1613|  1.14k|        ai4_temp_ref_indx[i4_i][1] = ps_motion_pred[2].i1_ref_frame[i4_i];
 1614|  1.14k|        ai4_temp_ref_indx[i4_i][2] = ps_motion_pred[8].i1_ref_frame[i4_i];
 1615|  1.14k|        ai4_temp_ref_indx[i4_i][3] = ps_motion_pred[10].i1_ref_frame[i4_i];
 1616|       |
 1617|  1.14k|    } /* end of loop over lists */
 1618|       |
 1619|       |    /* if restricted spatial resolution change is not set */
 1620|  1.03k|    if(SVCD_FALSE == ps_lyr_mem->ps_curr_lyr_res_prms->u1_rstrct_res_change_flag)
  ------------------
  |  |   45|  1.03k|#define SVCD_FALSE 0
  ------------------
  |  Branch (1620:8): [True: 1.03k, False: 0]
  ------------------
 1621|  1.03k|    {
 1622|  1.03k|        WORD32 i4_xp, i4_yp;
 1623|  1.03k|        WORD32 i4_xs, i4_ys;
 1624|       |
 1625|       |        /* merge reference indices and modify the motion vectors */
 1626|  2.18k|        for(i4_i = 0; i4_i < i4_listx; i4_i++)
  ------------------
  |  Branch (1626:23): [True: 1.14k, False: 1.03k]
  ------------------
 1627|  1.14k|        {
 1628|  3.44k|            for(i4_yp = 0; i4_yp < 2; i4_yp++)
  ------------------
  |  Branch (1628:28): [True: 2.29k, False: 1.14k]
  ------------------
 1629|  2.29k|            {
 1630|  6.88k|                for(i4_xp = 0; i4_xp < 2; i4_xp++)
  ------------------
  |  Branch (1630:32): [True: 4.59k, False: 2.29k]
  ------------------
 1631|  4.59k|                {
 1632|       |                    /* get the minimum positive of the refernce index */
 1633|  13.7k|                    for(i4_ys = 0; i4_ys < 2; i4_ys++)
  ------------------
  |  Branch (1633:36): [True: 9.18k, False: 4.59k]
  ------------------
 1634|  9.18k|                    {
 1635|  27.5k|                        for(i4_xs = 0; i4_xs < 2; i4_xs++)
  ------------------
  |  Branch (1635:40): [True: 18.3k, False: 9.18k]
  ------------------
 1636|  18.3k|                        {
 1637|  18.3k|                            mv_pred_t *ps_temp;
 1638|  18.3k|                            ps_temp = ps_motion_pred + (i4_xp << 1) + i4_xs;
 1639|  18.3k|                            ps_temp += 4 * ((i4_yp << 1) + i4_ys);
 1640|       |
 1641|       |                            /* get the minimum positive */
 1642|  18.3k|                            ai4_temp_ref_indx[i4_i][2 * i4_yp + i4_xp] =
 1643|  18.3k|                                isvcd_get_min_positive(ai4_temp_ref_indx[i4_i][2 * i4_yp + i4_xp],
 1644|  18.3k|                                                       ps_temp->i1_ref_frame[i4_i]);
 1645|  18.3k|                        }
 1646|  9.18k|                    }
 1647|       |                    /* update motion vectors */
 1648|  13.7k|                    for(i4_ys = 0; i4_ys < 2; i4_ys++)
  ------------------
  |  Branch (1648:36): [True: 9.18k, False: 4.59k]
  ------------------
 1649|  9.18k|                    {
 1650|  27.5k|                        for(i4_xs = 0; i4_xs < 2; i4_xs++)
  ------------------
  |  Branch (1650:40): [True: 18.3k, False: 9.18k]
  ------------------
 1651|  18.3k|                        {
 1652|  18.3k|                            mv_pred_t *ps_temp;
 1653|  18.3k|                            ps_temp = ps_motion_pred + (i4_xp << 1) + i4_xs;
 1654|  18.3k|                            ps_temp += 4 * ((i4_yp << 1) + i4_ys);
 1655|       |
 1656|       |                            /* check if the current part reference index is */
 1657|       |                            /* not choosen as the final reference index */
 1658|       |                            /* if not copy the neighbours MV */
 1659|  18.3k|                            if(ai4_temp_ref_indx[i4_i][2 * i4_yp + i4_xp] !=
  ------------------
  |  Branch (1659:32): [True: 1.14k, False: 17.2k]
  ------------------
 1660|  18.3k|                               ps_temp->i1_ref_frame[i4_i])
 1661|  1.14k|                            {
 1662|  1.14k|                                mv_pred_t *ps_temp_1;
 1663|  1.14k|                                WORD32 i4_updated_flag = SVCD_FALSE;
  ------------------
  |  |   45|  1.14k|#define SVCD_FALSE 0
  ------------------
 1664|       |
 1665|  1.14k|                                ps_temp_1 = ps_motion_pred + (i4_xp << 1) + (1 - i4_xs);
 1666|  1.14k|                                ps_temp_1 += 4 * ((i4_yp << 1) + i4_ys);
 1667|       |
 1668|       |                                /* store the appropriate neighbours */
 1669|  1.14k|                                if(ai4_temp_ref_indx[i4_i][2 * i4_yp + i4_xp] ==
  ------------------
  |  Branch (1669:36): [True: 391, False: 750]
  ------------------
 1670|  1.14k|                                   ps_temp_1->i1_ref_frame[i4_i])
 1671|    391|                                {
 1672|    391|                                    ps_temp->i2_mv[2 * i4_i] = ps_temp_1->i2_mv[2 * i4_i];
 1673|       |
 1674|    391|                                    ps_temp->i2_mv[1 + (2 * i4_i)] =
 1675|    391|                                        ps_temp_1->i2_mv[1 + (2 * i4_i)];
 1676|    391|                                    i4_updated_flag = SVCD_TRUE;
  ------------------
  |  |   46|    391|#define SVCD_TRUE 1
  ------------------
 1677|    391|                                }
 1678|       |
 1679|  1.14k|                                if(SVCD_FALSE == i4_updated_flag)
  ------------------
  |  |   45|  1.14k|#define SVCD_FALSE 0
  ------------------
  |  Branch (1679:36): [True: 750, False: 391]
  ------------------
 1680|    750|                                {
 1681|    750|                                    ps_temp_1 = ps_motion_pred + (i4_xp << 1) + i4_xs;
 1682|       |
 1683|    750|                                    ps_temp_1 += 4 * ((i4_yp << 1) + 1 - i4_ys);
 1684|       |
 1685|    750|                                    if(ai4_temp_ref_indx[i4_i][2 * i4_yp + i4_xp] ==
  ------------------
  |  Branch (1685:40): [True: 615, False: 135]
  ------------------
 1686|    750|                                       ps_temp_1->i1_ref_frame[i4_i])
 1687|    615|                                    {
 1688|    615|                                        ps_temp->i2_mv[2 * i4_i] = ps_temp_1->i2_mv[2 * i4_i];
 1689|       |
 1690|    615|                                        ps_temp->i2_mv[1 + (2 * i4_i)] =
 1691|    615|                                            ps_temp_1->i2_mv[1 + (2 * i4_i)];
 1692|    615|                                        i4_updated_flag = SVCD_TRUE;
  ------------------
  |  |   46|    615|#define SVCD_TRUE 1
  ------------------
 1693|    615|                                    }
 1694|    750|                                }
 1695|  1.14k|                                if(SVCD_FALSE == i4_updated_flag)
  ------------------
  |  |   45|  1.14k|#define SVCD_FALSE 0
  ------------------
  |  Branch (1695:36): [True: 135, False: 1.00k]
  ------------------
 1696|    135|                                {
 1697|    135|                                    ps_temp_1 = ps_motion_pred + (i4_xp << 1) + (1 - i4_xs);
 1698|    135|                                    ps_temp_1 += 4 * ((i4_yp << 1) + 1 - i4_ys);
 1699|       |
 1700|    135|                                    ps_temp->i2_mv[2 * i4_i] = ps_temp_1->i2_mv[2 * i4_i];
 1701|       |
 1702|    135|                                    ps_temp->i2_mv[1 + (2 * i4_i)] =
 1703|    135|                                        ps_temp_1->i2_mv[1 + (2 * i4_i)];
 1704|       |
 1705|    135|                                    i4_updated_flag = SVCD_TRUE;
  ------------------
  |  |   46|    135|#define SVCD_TRUE 1
  ------------------
 1706|    135|                                }
 1707|  1.14k|                            } /* end of replacement of mv based on ref indx */
 1708|  18.3k|                        }     /* end of loop over sub partition xs */
 1709|  9.18k|                    }         /* end of loop over sub partition ys */
 1710|  4.59k|                }             /* end of loop over partition xp */
 1711|  2.29k|            }                 /* end of loop over partition yp */
 1712|  1.14k|        }                     /* end of loop over lists */
 1713|  1.03k|    }
 1714|       |
 1715|       |    /************************************************************************/
 1716|       |    /* if restircted saptial resolution change flag is 0                    */
 1717|       |    /* modify the reference indixes and motion vectors                      */
 1718|       |    /************************************************************************/
 1719|  1.03k|    if((SVCD_FALSE == ps_lyr_mem->ps_curr_lyr_res_prms->u1_rstrct_res_change_flag) &&
  ------------------
  |  |   45|  1.03k|#define SVCD_FALSE 0
  ------------------
  |  Branch (1719:8): [True: 1.03k, False: 0]
  ------------------
 1720|  1.03k|       (2 == i4_listx) && (SVCD_TRUE == ps_ctxt->u1_direct_8x8_inference_flag))
  ------------------
  |  |   46|    114|#define SVCD_TRUE 1
  ------------------
  |  Branch (1720:8): [True: 114, False: 920]
  |  Branch (1720:27): [True: 114, False: 0]
  ------------------
 1721|    114|    {
 1722|       |        /* only applicable for EB Slice */
 1723|       |        /* store the corner 4x4 motion vectors to the whole block */
 1724|       |        /* 2 lists and 4 partitions */
 1725|    114|        mot_vec_t s_temp_mv[2][4];
 1726|    114|        WORD32 i4_xp, i4_yp;
 1727|    114|        memset(&s_temp_mv[0][0], 0, sizeof(s_temp_mv));
 1728|       |
 1729|    342|        for(i4_i = 0; i4_i < i4_listx; i4_i++)
  ------------------
  |  Branch (1729:23): [True: 228, False: 114]
  ------------------
 1730|    228|        {
 1731|    228|            s_temp_mv[i4_i][0].i2_mv_x = ps_motion_pred[0].i2_mv[2 * i4_i];
 1732|    228|            s_temp_mv[i4_i][0].i2_mv_y = ps_motion_pred[0].i2_mv[1 + (2 * i4_i)];
 1733|       |
 1734|    228|            s_temp_mv[i4_i][1].i2_mv_x = ps_motion_pred[3].i2_mv[2 * i4_i];
 1735|    228|            s_temp_mv[i4_i][1].i2_mv_y = ps_motion_pred[3].i2_mv[1 + (2 * i4_i)];
 1736|       |
 1737|    228|            s_temp_mv[i4_i][2].i2_mv_x = ps_motion_pred[12].i2_mv[2 * i4_i];
 1738|    228|            s_temp_mv[i4_i][2].i2_mv_y = ps_motion_pred[12].i2_mv[1 + (2 * i4_i)];
 1739|       |
 1740|    228|            s_temp_mv[i4_i][3].i2_mv_x = ps_motion_pred[15].i2_mv[2 * i4_i];
 1741|    228|            s_temp_mv[i4_i][3].i2_mv_y = ps_motion_pred[15].i2_mv[1 + (2 * i4_i)];
 1742|       |
 1743|    228|        } /* end of loop over lists */
 1744|       |
 1745|       |        /* replace the motion vectors */
 1746|    342|        for(i4_i = 0; i4_i < i4_listx; i4_i++)
  ------------------
  |  Branch (1746:23): [True: 228, False: 114]
  ------------------
 1747|    228|        {
 1748|  1.14k|            for(i4_yp = 0; i4_yp < 4; i4_yp++)
  ------------------
  |  Branch (1748:28): [True: 912, False: 228]
  ------------------
 1749|    912|            {
 1750|  4.56k|                for(i4_xp = 0; i4_xp < 4; i4_xp++)
  ------------------
  |  Branch (1750:32): [True: 3.64k, False: 912]
  ------------------
 1751|  3.64k|                {
 1752|  3.64k|                    mv_pred_t *ps_temp;
 1753|  3.64k|                    ps_temp = ps_motion_pred + i4_xp;
 1754|  3.64k|                    ps_temp += 4 * i4_yp;
 1755|       |
 1756|  3.64k|                    ps_temp->i2_mv[2 * i4_i] =
 1757|  3.64k|                        s_temp_mv[i4_i][2 * (i4_yp >> 1) + (i4_xp >> 1)].i2_mv_x;
 1758|       |
 1759|  3.64k|                    ps_temp->i2_mv[1 + (2 * i4_i)] =
 1760|  3.64k|                        s_temp_mv[i4_i][2 * (i4_yp >> 1) + (i4_xp >> 1)].i2_mv_y;
 1761|       |
 1762|  3.64k|                } /* end of loop over sub partitions xp */
 1763|    912|            }     /* end of loop over sub partitions yp */
 1764|    228|        }         /* end of loop over lists */
 1765|    114|    }
 1766|       |
 1767|       |    /* store the final reference index for all sub partitions */
 1768|       |    /* approporiate reference index is stored for each 4x4 belonging to 8x8 */
 1769|  1.03k|    {
 1770|  1.03k|        WORD32 i4_xp, i4_yp;
 1771|       |
 1772|  2.18k|        for(i4_i = 0; i4_i < i4_listx; i4_i++)
  ------------------
  |  Branch (1772:23): [True: 1.14k, False: 1.03k]
  ------------------
 1773|  1.14k|        {
 1774|  5.74k|            for(i4_yp = 0; i4_yp < 4; i4_yp++)
  ------------------
  |  Branch (1774:28): [True: 4.59k, False: 1.14k]
  ------------------
 1775|  4.59k|            {
 1776|  22.9k|                for(i4_xp = 0; i4_xp < 4; i4_xp++)
  ------------------
  |  Branch (1776:32): [True: 18.3k, False: 4.59k]
  ------------------
 1777|  18.3k|                {
 1778|  18.3k|                    mv_pred_t *ps_temp;
 1779|  18.3k|                    ps_temp = ps_motion_pred + i4_xp;
 1780|  18.3k|                    ps_temp += 4 * i4_yp;
 1781|       |
 1782|  18.3k|                    ps_temp->i1_ref_frame[i4_i] =
 1783|  18.3k|                        ai4_temp_ref_indx[i4_i][2 * (i4_yp >> 1) + (i4_xp >> 1)];
 1784|       |
 1785|  18.3k|                } /* end of loop over partition xp */
 1786|  4.59k|            }     /* end of loop over partition yp */
 1787|  1.14k|        }         /* end of loop over lists */
 1788|  1.03k|    }
 1789|       |
 1790|       |    /********************************************************************/
 1791|       |    /* modify the motion vectors for non dyadic cases, set the mv       */
 1792|       |    /* threshold appropraitely to derive the sub MB type                */
 1793|       |    /********************************************************************/
 1794|  1.03k|    if(SVCD_FALSE == ps_lyr_mem->ps_curr_lyr_res_prms->u1_rstrct_res_change_flag)
  ------------------
  |  |   45|  1.03k|#define SVCD_FALSE 0
  ------------------
  |  Branch (1794:8): [True: 1.03k, False: 0]
  ------------------
 1795|  1.03k|    {
 1796|       |        /* non dyadic cases set the mv treshold to 1 */
 1797|  1.03k|        i4_mv_treshold = 1;
 1798|  1.03k|    }
 1799|      0|    else
 1800|      0|    {
 1801|       |        /* dyadic cases set the mv treshold to 0 */
 1802|      0|        i4_mv_treshold = 0;
 1803|      0|    }
 1804|       |
 1805|       |    /* modify the motion vectors and get sub mb mode if base mode flag is 1 */
 1806|  1.03k|    if((SVCD_FALSE == ps_lyr_mem->ps_curr_lyr_res_prms->u1_rstrct_res_change_flag) ||
  ------------------
  |  |   45|  1.03k|#define SVCD_FALSE 0
  ------------------
  |  Branch (1806:8): [True: 1.03k, False: 0]
  ------------------
 1807|      0|       (1 == ps_svc_mb_params->u1_base_mode_flag))
  ------------------
  |  Branch (1807:8): [True: 0, False: 0]
  ------------------
 1808|  1.03k|    {
 1809|  1.03k|        WORD32 i4_xp, i4_yp;
 1810|  3.10k|        for(i4_yp = 0; i4_yp < 2; i4_yp++)
  ------------------
  |  Branch (1810:24): [True: 2.06k, False: 1.03k]
  ------------------
 1811|  2.06k|        {
 1812|  6.20k|            for(i4_xp = 0; i4_xp < 2; i4_xp++)
  ------------------
  |  Branch (1812:28): [True: 4.13k, False: 2.06k]
  ------------------
 1813|  4.13k|            {
 1814|  4.13k|                mv_pred_t *ps_temp;
 1815|  4.13k|                WORD32 i4_part_size = 0;
 1816|  4.13k|                WORD32 i4_horz1_match, i4_vert1_match;
 1817|  4.13k|                WORD32 i4_horz2_match, i4_vert2_match;
 1818|  4.13k|                WORD32 i4_diag_match;
 1819|       |
 1820|  4.13k|                WORD32 i4_8x8_match, i4_horz_match, i4_vert_match;
 1821|  4.13k|                WORD32 i4_mv_x, i4_mv_y;
 1822|       |
 1823|  4.13k|                ps_temp = ps_motion_pred + (i4_xp << 1);
 1824|  4.13k|                ps_temp += 4 * ((i4_yp << 1));
 1825|       |
 1826|       |                /* default init */
 1827|  4.13k|                i4_8x8_match = i4_horz_match = i4_vert_match = SVCD_TRUE;
  ------------------
  |  |   46|  4.13k|#define SVCD_TRUE 1
  ------------------
 1828|       |
 1829|       |                /* check if the mv diff in horz direction is under threshold*/
 1830|  4.13k|                i4_horz1_match =
 1831|  4.13k|                    isvcd_check_mv_diff(ps_temp, (ps_temp + 1), i4_listx, i4_mv_treshold);
 1832|       |
 1833|  4.13k|                i4_horz2_match =
 1834|  4.13k|                    isvcd_check_mv_diff((ps_temp + 4), (ps_temp + 4 + 1), i4_listx, i4_mv_treshold);
 1835|       |
 1836|       |                /* check if the mv diff in horz direction is under threshold*/
 1837|  4.13k|                i4_vert1_match =
 1838|  4.13k|                    isvcd_check_mv_diff(ps_temp, (ps_temp + 4), i4_listx, i4_mv_treshold);
 1839|       |
 1840|  4.13k|                i4_vert2_match =
 1841|  4.13k|                    isvcd_check_mv_diff((ps_temp + 1), (ps_temp + 4 + 1), i4_listx, i4_mv_treshold);
 1842|       |
 1843|       |                /* check if in diagonal direction is under threshold*/
 1844|  4.13k|                i4_diag_match =
 1845|  4.13k|                    isvcd_check_mv_diff(ps_temp, (ps_temp + 4 + 1), i4_listx, i4_mv_treshold);
 1846|       |
 1847|       |                /* calculate the excat matching points*/
 1848|  4.13k|                i4_8x8_match = i4_8x8_match && i4_horz1_match && i4_vert1_match && i4_diag_match;
  ------------------
  |  Branch (1848:32): [True: 4.13k, False: 0]
  |  Branch (1848:48): [True: 3.74k, False: 388]
  |  Branch (1848:66): [True: 3.53k, False: 217]
  |  Branch (1848:84): [True: 3.44k, False: 84]
  ------------------
 1849|  4.13k|                i4_horz_match = i4_horz_match && i4_horz1_match && i4_horz2_match;
  ------------------
  |  Branch (1849:33): [True: 4.13k, False: 0]
  |  Branch (1849:50): [True: 3.74k, False: 388]
  |  Branch (1849:68): [True: 3.64k, False: 103]
  ------------------
 1850|  4.13k|                i4_vert_match = i4_vert_match && i4_vert1_match && i4_vert2_match;
  ------------------
  |  Branch (1850:33): [True: 4.13k, False: 0]
  |  Branch (1850:50): [True: 3.76k, False: 373]
  |  Branch (1850:68): [True: 3.65k, False: 108]
  ------------------
 1851|       |
 1852|       |                /* modify the motion vectors appropriately */
 1853|       |
 1854|  8.72k|                for(i4_i = 0; i4_i < i4_listx; i4_i++)
  ------------------
  |  Branch (1854:31): [True: 4.59k, False: 4.13k]
  ------------------
 1855|  4.59k|                {
 1856|       |                    /* 8x8 mode all the 4 blocks are under threshold */
 1857|  4.59k|                    if(SVCD_TRUE == i4_8x8_match)
  ------------------
  |  |   46|  4.59k|#define SVCD_TRUE 1
  ------------------
  |  Branch (1857:24): [True: 3.90k, False: 689]
  ------------------
 1858|  3.90k|                    {
 1859|       |                        /* calculate the avarage */
 1860|  3.90k|                        i4_mv_x =
 1861|  3.90k|                            ((ps_temp[0].i2_mv[2 * i4_i]) + (ps_temp[1].i2_mv[2 * i4_i]) +
 1862|  3.90k|                             (ps_temp[4].i2_mv[2 * i4_i]) + (ps_temp[5].i2_mv[2 * i4_i] + 2)) >>
 1863|  3.90k|                            2;
 1864|       |
 1865|  3.90k|                        i4_mv_y = ((ps_temp[0].i2_mv[1 + (2 * i4_i)]) +
 1866|  3.90k|                                   (ps_temp[1].i2_mv[1 + (2 * i4_i)]) +
 1867|  3.90k|                                   (ps_temp[4].i2_mv[1 + (2 * i4_i)]) +
 1868|  3.90k|                                   (ps_temp[5].i2_mv[1 + (2 * i4_i)] + 2)) >>
 1869|  3.90k|                                  2;
 1870|       |
 1871|       |                        /* store the modified motion vectors */
 1872|  3.90k|                        ps_temp[0].i2_mv[2 * i4_i] = (WORD16) i4_mv_x;
 1873|  3.90k|                        ps_temp[1].i2_mv[2 * i4_i] = (WORD16) i4_mv_x;
 1874|  3.90k|                        ps_temp[4].i2_mv[2 * i4_i] = (WORD16) i4_mv_x;
 1875|  3.90k|                        ps_temp[5].i2_mv[2 * i4_i] = (WORD16) i4_mv_x;
 1876|       |
 1877|  3.90k|                        ps_temp[0].i2_mv[1 + (2 * i4_i)] = (WORD16) i4_mv_y;
 1878|  3.90k|                        ps_temp[1].i2_mv[1 + (2 * i4_i)] = (WORD16) i4_mv_y;
 1879|  3.90k|                        ps_temp[4].i2_mv[1 + (2 * i4_i)] = (WORD16) i4_mv_y;
 1880|  3.90k|                        ps_temp[5].i2_mv[1 + (2 * i4_i)] = (WORD16) i4_mv_y;
 1881|       |
 1882|       |                        /* store the sub mb partition size */
 1883|  3.90k|                        i4_part_size = SUBMB_8x8;
  ------------------
  |  |  501|  3.90k|#define SUBMB_8x8    0
  ------------------
 1884|  3.90k|                    }
 1885|       |                    /* 8x4 mode  */
 1886|    689|                    else if(SVCD_TRUE == i4_horz_match)
  ------------------
  |  |   46|    689|#define SVCD_TRUE 1
  ------------------
  |  Branch (1886:29): [True: 198, False: 491]
  ------------------
 1887|    198|                    {
 1888|       |                        /* horizontal directional merging */
 1889|       |                        /* calculate the average of first two and store back*/
 1890|    198|                        i4_mv_x =
 1891|    198|                            ((ps_temp[0].i2_mv[2 * i4_i]) + (ps_temp[1].i2_mv[2 * i4_i] + 1)) >> 1;
 1892|       |
 1893|    198|                        i4_mv_y = ((ps_temp[0].i2_mv[1 + (2 * i4_i)]) +
 1894|    198|                                   (ps_temp[1].i2_mv[1 + (2 * i4_i)] + 1)) >>
 1895|    198|                                  1;
 1896|       |
 1897|    198|                        ps_temp[0].i2_mv[2 * i4_i] = (WORD16) i4_mv_x;
 1898|    198|                        ps_temp[1].i2_mv[2 * i4_i] = (WORD16) i4_mv_x;
 1899|       |
 1900|    198|                        ps_temp[0].i2_mv[1 + (2 * i4_i)] = (WORD16) i4_mv_y;
 1901|    198|                        ps_temp[1].i2_mv[1 + (2 * i4_i)] = (WORD16) i4_mv_y;
 1902|       |
 1903|       |                        /* calculate the average of next two and store back*/
 1904|    198|                        i4_mv_x =
 1905|    198|                            ((ps_temp[4].i2_mv[2 * i4_i]) + (ps_temp[5].i2_mv[2 * i4_i] + 1)) >> 1;
 1906|       |
 1907|    198|                        i4_mv_y = ((ps_temp[4].i2_mv[1 + (2 * i4_i)]) +
 1908|    198|                                   (ps_temp[5].i2_mv[1 + (2 * i4_i)] + 1)) >>
 1909|    198|                                  1;
 1910|       |
 1911|    198|                        ps_temp[4].i2_mv[2 * i4_i] = (WORD16) i4_mv_x;
 1912|    198|                        ps_temp[5].i2_mv[2 * i4_i] = (WORD16) i4_mv_x;
 1913|       |
 1914|    198|                        ps_temp[4].i2_mv[1 + (2 * i4_i)] = (WORD16) i4_mv_y;
 1915|    198|                        ps_temp[5].i2_mv[1 + (2 * i4_i)] = (WORD16) i4_mv_y;
 1916|       |                        /* store the sub mb partition size */
 1917|    198|                        i4_part_size = SUBMB_8x4;
  ------------------
  |  |  502|    198|#define SUBMB_8x4    1
  ------------------
 1918|    198|                    }
 1919|       |                    /* 4x8 mode all the 4 blocks are under threshold */
 1920|    491|                    else if(SVCD_TRUE == i4_vert_match)
  ------------------
  |  |   46|    491|#define SVCD_TRUE 1
  ------------------
  |  Branch (1920:29): [True: 220, False: 271]
  ------------------
 1921|    220|                    {
 1922|       |                        /* vertical directional merging */
 1923|    220|                        i4_mv_x =
 1924|    220|                            ((ps_temp[0].i2_mv[2 * i4_i]) + (ps_temp[4].i2_mv[2 * i4_i] + 1)) >> 1;
 1925|       |
 1926|    220|                        i4_mv_y = ((ps_temp[0].i2_mv[1 + (2 * i4_i)]) +
 1927|    220|                                   (ps_temp[4].i2_mv[1 + (2 * i4_i)] + 1)) >>
 1928|    220|                                  1;
 1929|       |
 1930|    220|                        ps_temp[0].i2_mv[2 * i4_i] = (WORD16) i4_mv_x;
 1931|    220|                        ps_temp[4].i2_mv[2 * i4_i] = (WORD16) i4_mv_x;
 1932|       |
 1933|    220|                        ps_temp[0].i2_mv[1 + (2 * i4_i)] = (WORD16) i4_mv_y;
 1934|    220|                        ps_temp[4].i2_mv[1 + (2 * i4_i)] = (WORD16) i4_mv_y;
 1935|       |
 1936|       |                        /* calculate the average of next two and store back*/
 1937|    220|                        i4_mv_x =
 1938|    220|                            ((ps_temp[1].i2_mv[2 * i4_i]) + (ps_temp[5].i2_mv[2 * i4_i] + 1)) >> 1;
 1939|       |
 1940|    220|                        i4_mv_y = ((ps_temp[1].i2_mv[1 + (2 * i4_i)]) +
 1941|    220|                                   (ps_temp[5].i2_mv[1 + (2 * i4_i)] + 1)) >>
 1942|    220|                                  1;
 1943|       |
 1944|    220|                        ps_temp[1].i2_mv[2 * i4_i] = (WORD16) i4_mv_x;
 1945|    220|                        ps_temp[5].i2_mv[2 * i4_i] = (WORD16) i4_mv_x;
 1946|       |
 1947|    220|                        ps_temp[1].i2_mv[1 + (2 * i4_i)] = (WORD16) i4_mv_y;
 1948|    220|                        ps_temp[5].i2_mv[1 + (2 * i4_i)] = (WORD16) i4_mv_y;
 1949|       |                        /* store the sub mb partition size */
 1950|    220|                        i4_part_size = SUBMB_4x8;
  ------------------
  |  |  503|    220|#define SUBMB_4x8    2
  ------------------
 1951|    220|                    }
 1952|    271|                    else
 1953|    271|                    {
 1954|       |                        /* store the sub mb partition size */
 1955|    271|                        i4_part_size = SUBMB_4x4;
  ------------------
  |  |  504|    271|#define SUBMB_4x4    3
  ------------------
 1956|    271|                    }
 1957|       |
 1958|  4.59k|                } /* end of loop over lists */
 1959|       |
 1960|       |                /* store the sub MB type B slice */
 1961|  4.13k|                if(2 == i4_listx)
  ------------------
  |  Branch (1961:20): [True: 456, False: 3.68k]
  ------------------
 1962|    456|                {
 1963|    456|                    WORD32 i4_part_mode_a;
 1964|    456|                    WORD32 i4_indx;
 1965|       |
 1966|    456|                    i4_part_mode_a = 0;
 1967|       |                    /* check the 0th partiton reference indices */
 1968|    456|                    if(0 <= ps_temp[0].i1_ref_frame[0])
  ------------------
  |  Branch (1968:24): [True: 182, False: 274]
  ------------------
 1969|    182|                    {
 1970|    182|                        i4_part_mode_a += 1;
 1971|    182|                    }
 1972|    456|                    if(0 <= ps_temp[0].i1_ref_frame[1])
  ------------------
  |  Branch (1972:24): [True: 406, False: 50]
  ------------------
 1973|    406|                    {
 1974|    406|                        i4_part_mode_a += 2;
 1975|    406|                    }
 1976|    456|                    i4_indx = 3 * i4_part_size + (i4_part_mode_a - 1);
 1977|       |
 1978|    456|                    pi4_sub_mb_mode[2 * i4_yp + i4_xp] = g_au1_eb_submb_type[i4_indx];
 1979|    456|                }
 1980|       |                /* P slice */
 1981|  3.68k|                else
 1982|  3.68k|                {
 1983|  3.68k|                    pi4_sub_mb_mode[2 * i4_yp + i4_xp] = g_au1_ep_submb_type[i4_part_size];
 1984|  3.68k|                }
 1985|  4.13k|            } /* end of loop over partition xp */
 1986|       |
 1987|  2.06k|        }     /* end of loop over partition yp */
 1988|  1.03k|    }
 1989|       |
 1990|  1.03k|    return;
 1991|  1.03k|}
isvcd_interlyr_mbmode_pred_bmb:
 2020|    464|{
 2021|    464|    WORD32 i4_part_mode_a, i4_part_mode_b;
 2022|    464|    WORD32 i4_idx;
 2023|    464|    dec_mb_info_t *ps_mb_params = (dec_mb_info_t *) pv_mb_params;
 2024|    464|    parse_part_params_t *ps_part = (parse_part_params_t *) pv_part;
 2025|       |
 2026|    464|    UNUSED(ps_ctxt);
  ------------------
  |  |   45|    464|#define UNUSED(x) ((void)(x))
  ------------------
 2027|       |
 2028|    464|    i4_part_mode_a = 0;
 2029|       |
 2030|       |    /* check the 0th partiton reference indices */
 2031|    464|    if(PRED_8x8 != i4_part_size)
  ------------------
  |  |  453|    464|#define PRED_8x8    3
  ------------------
  |  Branch (2031:8): [True: 442, False: 22]
  ------------------
 2032|    442|    {
 2033|    442|        if(0 <= ps_motion_pred[0].i1_ref_frame[0])
  ------------------
  |  Branch (2033:12): [True: 332, False: 110]
  ------------------
 2034|    332|        {
 2035|    332|            i4_part_mode_a += 1;
 2036|    332|        }
 2037|    442|        if(0 <= ps_motion_pred[0].i1_ref_frame[1])
  ------------------
  |  Branch (2037:12): [True: 297, False: 145]
  ------------------
 2038|    297|        {
 2039|    297|            i4_part_mode_a += 2;
 2040|    297|        }
 2041|    442|    }
 2042|       |
 2043|       |    /* check the 15th partiton reference indices */
 2044|       |    /* this done since all the reference indices will be replicated */
 2045|    464|    i4_part_mode_b = 0;
 2046|       |
 2047|    464|    if((PRED_16x8 == i4_part_size) || (PRED_8x16 == i4_part_size))
  ------------------
  |  |  451|    464|#define PRED_16x8   1
  ------------------
                  if((PRED_16x8 == i4_part_size) || (PRED_8x16 == i4_part_size))
  ------------------
  |  |  452|    438|#define PRED_8x16   2
  ------------------
  |  Branch (2047:8): [True: 26, False: 438]
  |  Branch (2047:39): [True: 20, False: 418]
  ------------------
 2048|     46|    {
 2049|     46|        ps_motion_pred += (3 * i4_cur_mot_stride) + 3;
 2050|       |
 2051|     46|        if(0 <= ps_motion_pred[0].i1_ref_frame[0])
  ------------------
  |  Branch (2051:12): [True: 12, False: 34]
  ------------------
 2052|     12|        {
 2053|     12|            i4_part_mode_b += 1;
 2054|     12|        }
 2055|     46|        if(0 <= ps_motion_pred[0].i1_ref_frame[1])
  ------------------
  |  Branch (2055:12): [True: 36, False: 10]
  ------------------
 2056|     36|        {
 2057|     36|            i4_part_mode_b += 2;
 2058|     36|        }
 2059|     46|    }
 2060|       |    /* update the pred modes for B cases */
 2061|       |    /* If partition size is not equal to 8x8 */
 2062|       |    /* then update the prediciton mode of    */
 2063|       |    /* partitions                            */
 2064|    464|    if(PRED_8x8 != i4_part_size)
  ------------------
  |  |  453|    464|#define PRED_8x8    3
  ------------------
  |  Branch (2064:8): [True: 442, False: 22]
  ------------------
 2065|    442|    {
 2066|    442|        UWORD8 u1_pred_mode_part0;
 2067|    442|        UWORD8 u1_pred_mode_part1;
 2068|       |
 2069|    442|        i4_idx = 3 * i4_part_size;
 2070|    442|        i4_idx += 3 * (i4_part_mode_a - 1);
 2071|    442|        i4_part_mode_b = (i4_part_mode_b > 0) ? i4_part_mode_b : 1;
  ------------------
  |  Branch (2071:26): [True: 46, False: 396]
  ------------------
 2072|    442|        i4_idx += (i4_part_mode_b - 1);
 2073|    442|        i4_idx = (i4_idx < 0) ? 0 : i4_idx;
  ------------------
  |  Branch (2073:18): [True: 0, False: 442]
  ------------------
 2074|       |        /* Get the mb type                     */
 2075|       |        /* From mb type - get prediciton modes */
 2076|       |        /*  of parttions                       */
 2077|       |        /* Update the prediciton mode parma of */
 2078|       |        /* mb param structure                  */
 2079|       |
 2080|    442|        ps_mb_params->u1_mb_type = g_au1_eb_mb_type[i4_idx + (6 * i4_part_size)];
 2081|    442|        u1_pred_mode_part0 = g_au1_mb_pred_mode[0][5 + ps_mb_params->u1_mb_type];
 2082|    442|        u1_pred_mode_part1 = g_au1_mb_pred_mode[1][5 + ps_mb_params->u1_mb_type];
 2083|    442|        ps_part[0].u1_pred_mode = u1_pred_mode_part0;
 2084|    442|        ps_part[1].u1_pred_mode = u1_pred_mode_part1;
 2085|    442|    }
 2086|     22|    else
 2087|     22|    {
 2088|     22|        WORD32 i4_i, i4_ctr, i4_num_submb_part;
 2089|     22|        UWORD8 u1_sub_mb_type, u1_sub_mb_mc_mode;
 2090|     22|        UWORD8 u1_pred_mode;
 2091|       |
 2092|     22|        ps_mb_params->u1_mb_type = B_8x8;
  ------------------
  |  |  480|     22|#define B_8x8    22
  ------------------
 2093|       |
 2094|    110|        for(i4_i = 0; i4_i < NUM_MB_PARTS; i4_i++)
  ------------------
  |  |   59|    110|#define NUM_MB_PARTS 4
  ------------------
  |  Branch (2094:23): [True: 88, False: 22]
  ------------------
 2095|     88|        {
 2096|     88|            u1_sub_mb_type = (UWORD8) pi4_sub_mb_mode[i4_i];
 2097|       |
 2098|     88|            u1_sub_mb_mc_mode = gau1_ih264d_submb_mc_mode[4 + u1_sub_mb_type];
 2099|     88|            i4_num_submb_part = g_au1_num_sub_mb_part[u1_sub_mb_mc_mode];
 2100|     88|            *pu1_col_info |= (u1_sub_mb_mc_mode << 4);
 2101|     88|            pu1_col_info++;
 2102|     88|            u1_pred_mode = g_au1_sub_mb_pred_mode[4 + u1_sub_mb_type];
 2103|    176|            for(i4_ctr = 0; i4_ctr < i4_num_submb_part; i4_ctr++)
  ------------------
  |  Branch (2103:29): [True: 88, False: 88]
  ------------------
 2104|     88|            {
 2105|     88|                ps_part->u1_pred_mode = u1_pred_mode;
 2106|     88|                ps_part++;
 2107|     88|            }
 2108|     88|        }
 2109|     22|    }
 2110|       |
 2111|    464|    return;
 2112|    464|}
isvcd_populate_ref_idx:
 2139|  1.71k|{
 2140|  1.71k|    UWORD8 u1_mot_pred_flag;
 2141|  1.71k|    WORD32 i4_lx;
 2142|       |
 2143|  3.44k|    for(i4_lx = 0; i4_lx < i4_listx; i4_lx++)
  ------------------
  |  Branch (2143:20): [True: 1.72k, False: 1.71k]
  ------------------
 2144|  1.72k|    {
 2145|  1.72k|        u1_mot_pred_flag = ps_svc_mb_params->au1_motion_pred_flag[i4_lx];
 2146|       |
 2147|  1.72k|        if((PRED_16x16 == ps_mb_params->u1_mb_mc_mode) && (u1_mot_pred_flag & 0x1))
  ------------------
  |  |  450|  1.72k|#define PRED_16x16  0
  ------------------
  |  Branch (2147:12): [True: 199, False: 1.52k]
  |  Branch (2147:59): [True: 199, False: 0]
  ------------------
 2148|    199|        {
 2149|    199|            ps_mb_part_info->i1_ref_idx[i4_lx][0] = ps_motion_pred[0].i1_ref_frame[i4_lx];
 2150|    199|        }
 2151|  1.52k|        else if((PRED_8x16 == ps_mb_params->u1_mb_mc_mode))
  ------------------
  |  |  452|  1.52k|#define PRED_8x16   2
  ------------------
  |  Branch (2151:17): [True: 68, False: 1.45k]
  ------------------
 2152|     68|        {
 2153|     68|            if(u1_mot_pred_flag & 0x01)
  ------------------
  |  Branch (2153:16): [True: 46, False: 22]
  ------------------
 2154|     46|            {
 2155|     46|                ps_mb_part_info->i1_ref_idx[i4_lx][0] = ps_motion_pred[0].i1_ref_frame[i4_lx];
 2156|     46|            }
 2157|     68|            if(u1_mot_pred_flag & 0x02)
  ------------------
  |  Branch (2157:16): [True: 43, False: 25]
  ------------------
 2158|     43|            {
 2159|     43|                ps_mb_part_info->i1_ref_idx[i4_lx][1] = ps_motion_pred[2].i1_ref_frame[i4_lx];
 2160|     43|            }
 2161|     68|        }
 2162|  1.45k|        else if((PRED_16x8 == ps_mb_params->u1_mb_mc_mode))
  ------------------
  |  |  451|  1.45k|#define PRED_16x8   1
  ------------------
  |  Branch (2162:17): [True: 63, False: 1.39k]
  ------------------
 2163|     63|        {
 2164|     63|            if(u1_mot_pred_flag & 0x01)
  ------------------
  |  Branch (2164:16): [True: 40, False: 23]
  ------------------
 2165|     40|            {
 2166|     40|                ps_mb_part_info->i1_ref_idx[i4_lx][0] = ps_motion_pred[0].i1_ref_frame[i4_lx];
 2167|     40|            }
 2168|     63|            if(u1_mot_pred_flag & 0x02)
  ------------------
  |  Branch (2168:16): [True: 45, False: 18]
  ------------------
 2169|     45|            {
 2170|     45|                ps_mb_part_info->i1_ref_idx[i4_lx][1] = ps_motion_pred[8].i1_ref_frame[i4_lx];
 2171|     45|            }
 2172|     63|        }
 2173|  1.39k|        else if((PRED_8x8 == ps_mb_params->u1_mb_mc_mode))
  ------------------
  |  |  453|  1.39k|#define PRED_8x8    3
  ------------------
  |  Branch (2173:17): [True: 1.39k, False: 0]
  ------------------
 2174|  1.39k|        {
 2175|  1.39k|            if(u1_mot_pred_flag & 0x01)
  ------------------
  |  Branch (2175:16): [True: 696, False: 699]
  ------------------
 2176|    696|            {
 2177|    696|                ps_mb_part_info->i1_ref_idx[i4_lx][0] = ps_motion_pred[0].i1_ref_frame[i4_lx];
 2178|    696|            }
 2179|  1.39k|            if(u1_mot_pred_flag & 0x02)
  ------------------
  |  Branch (2179:16): [True: 824, False: 571]
  ------------------
 2180|    824|            {
 2181|    824|                ps_mb_part_info->i1_ref_idx[i4_lx][1] = ps_motion_pred[2].i1_ref_frame[i4_lx];
 2182|    824|            }
 2183|  1.39k|            if(u1_mot_pred_flag & 0x04)
  ------------------
  |  Branch (2183:16): [True: 783, False: 612]
  ------------------
 2184|    783|            {
 2185|    783|                ps_mb_part_info->i1_ref_idx[i4_lx][2] = ps_motion_pred[8].i1_ref_frame[i4_lx];
 2186|    783|            }
 2187|  1.39k|            if(u1_mot_pred_flag & 0x08)
  ------------------
  |  Branch (2187:16): [True: 684, False: 711]
  ------------------
 2188|    684|            {
 2189|    684|                ps_mb_part_info->i1_ref_idx[i4_lx][3] = ps_motion_pred[10].i1_ref_frame[i4_lx];
 2190|    684|            }
 2191|  1.39k|        }
 2192|  1.72k|    }
 2193|  1.71k|}
isvcd_interlyr_mbmode_pred:
 2223|    992|{
 2224|       |    /*! Flow of the module is as follows                                   */
 2225|       |    /*! 1. it checks if all the sub mb modes are 8x8 modes                 */
 2226|       |    /*! 2. it matches the motion vectors at 8x8 level and computes the
 2227|       |           partiton size. store the same in the part type of mb params     */
 2228|       |    /*! 3. stores the pred modes based on slcie type and reference indices */
 2229|       |    /*! 4. stores the sub mb type in the mb params if teh part size is 8x8 */
 2230|    992|    mode_motion_ctxt_t *ps_ctxt;
 2231|    992|    mv_pred_t *ps_motion_pred;
 2232|    992|    dec_mb_info_t *ps_mb_params;
 2233|    992|    WORD32 i4_listx;
 2234|    992|    WORD32 i4_part_size;
 2235|    992|    WORD32 i4_mb_mode_flag;
 2236|    992|    WORD32 i4_i;
 2237|    992|    WORD32 i4_blk_mode;
 2238|    992|    parse_part_params_t *ps_part = (parse_part_params_t *) pv_part;
 2239|    992|    parse_pmbarams_t *ps_mb_part_info = (parse_pmbarams_t *) pv_mb_part_info;
 2240|    992|    UWORD8 *pu1_col_info = ps_mb_part_info->u1_col_info;
 2241|    992|    UNUSED(pv_dec);
  ------------------
  |  |   45|    992|#define UNUSED(x) ((void)(x))
  ------------------
 2242|       |
 2243|    992|    ps_ctxt = (mode_motion_ctxt_t *) pv_comp_mode_mv_ctxt;
 2244|    992|    ps_motion_pred = ps_ctxt->ps_motion_pred_struct;
 2245|    992|    ps_mb_params = (dec_mb_info_t *) pv_mb_params;
 2246|       |
 2247|       |    /*********** store the MB mode as inter *************************/
 2248|    992|    *pi4_mb_mode = SVC_INTER_MB;
  ------------------
  |  |  114|    992|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
 2249|       |
 2250|       |    /***********************************************************************/
 2251|       |    /* derivation of part type                                             */
 2252|       |    /***********************************************************************/
 2253|    992|    i4_listx = ps_ctxt->i4_listx;
 2254|       |
 2255|       |    /* set the mb mode derivation flag to false */
 2256|    992|    i4_mb_mode_flag = SVCD_FALSE;
  ------------------
  |  |   45|    992|#define SVCD_FALSE 0
  ------------------
 2257|       |
 2258|       |    /* for B and P slice different blk mod treshold */
 2259|    992|    if(2 == i4_listx)
  ------------------
  |  Branch (2259:8): [True: 114, False: 878]
  ------------------
 2260|    114|    {
 2261|    114|        i4_blk_mode = B_BI_8x8;
  ------------------
  |  |  468|    114|#define B_BI_8x8        3
  ------------------
 2262|    114|    }
 2263|    878|    else
 2264|    878|    {
 2265|    878|        i4_blk_mode = P_L0_8x8;
  ------------------
  |  |  459|    878|#define P_L0_8x8    0
  ------------------
 2266|    878|    }
 2267|       |
 2268|       |    /* set the mode derivation flag to true base on conditions */
 2269|    992|    if((i4_blk_mode >= pi4_sub_mb_mode[0]) && (i4_blk_mode >= pi4_sub_mb_mode[1]) &&
  ------------------
  |  Branch (2269:8): [True: 749, False: 243]
  |  Branch (2269:47): [True: 694, False: 55]
  ------------------
 2270|    694|       (i4_blk_mode >= pi4_sub_mb_mode[2]) && (i4_blk_mode >= pi4_sub_mb_mode[3]))
  ------------------
  |  Branch (2270:8): [True: 653, False: 41]
  |  Branch (2270:47): [True: 650, False: 3]
  ------------------
 2271|    650|    {
 2272|    650|        i4_mb_mode_flag = SVCD_TRUE;
  ------------------
  |  |   46|    650|#define SVCD_TRUE 1
  ------------------
 2273|    650|    }
 2274|       |
 2275|       |    /* store the default 8x8 mode */
 2276|    992|    ps_mb_part_info->u1_num_part = 4;
 2277|    992|    i4_part_size = PRED_8x8;
  ------------------
  |  |  453|    992|#define PRED_8x8    3
  ------------------
 2278|       |
 2279|       |    /* further check is present if all are 8x8 mode */
 2280|    992|    if(SVCD_TRUE == i4_mb_mode_flag)
  ------------------
  |  |   46|    992|#define SVCD_TRUE 1
  ------------------
  |  Branch (2280:8): [True: 650, False: 342]
  ------------------
 2281|    650|    {
 2282|    650|        WORD32 i4_horz_match, i4_vert_match;
 2283|       |
 2284|       |        /* check if the motion in horz direction are same*/
 2285|    650|        i4_horz_match = isvcd_check_motion(ps_motion_pred, (ps_motion_pred + 2), i4_listx);
 2286|    650|        i4_horz_match += isvcd_check_motion((ps_motion_pred + 8), (ps_motion_pred + 10), i4_listx);
 2287|       |
 2288|       |        /* check if the motion in vertical direction is same */
 2289|    650|        i4_vert_match = isvcd_check_motion(ps_motion_pred, (ps_motion_pred + 8), i4_listx);
 2290|    650|        i4_vert_match += isvcd_check_motion((ps_motion_pred + 2), (ps_motion_pred + 10), i4_listx);
 2291|       |
 2292|       |        /* decide the partition size based on the results of matching */
 2293|    650|        if((2 == i4_horz_match) && (2 == i4_vert_match))
  ------------------
  |  Branch (2293:12): [True: 515, False: 135]
  |  Branch (2293:36): [True: 489, False: 26]
  ------------------
 2294|    489|        {
 2295|    489|            ps_mb_params->u1_mb_type = P_L0_16x16;
 2296|    489|            i4_part_size = PRED_16x16;
  ------------------
  |  |  450|    489|#define PRED_16x16  0
  ------------------
 2297|    489|            ps_mb_part_info->u1_num_part = 1;
 2298|    489|            *pu1_col_info++ = (PRED_16x16 << 6);
  ------------------
  |  |  450|    489|#define PRED_16x16  0
  ------------------
 2299|    489|            ps_mb_part_info->i1_ref_idx[0][0] = ps_motion_pred->i1_ref_frame[0];
 2300|    489|            if(2 == i4_listx) ps_mb_part_info->i1_ref_idx[1][0] = ps_motion_pred->i1_ref_frame[1];
  ------------------
  |  Branch (2300:16): [True: 46, False: 443]
  ------------------
 2301|       |
 2302|    489|            ps_part->u1_partwidth = 4;  // interms of 4x4
 2303|    489|            ps_part->u1_partheight = 4;
 2304|    489|            ps_part->u1_pred_mode = PRED_L0;
  ------------------
  |  |  483|    489|#define PRED_L0   1
  ------------------
 2305|    489|            ps_part->u1_is_direct = 0;
 2306|    489|            ps_part->u1_sub_mb_num = 0;
 2307|    489|        }
 2308|    161|        else if(2 == i4_horz_match)
  ------------------
  |  Branch (2308:17): [True: 26, False: 135]
  ------------------
 2309|     26|        {
 2310|     26|            i4_part_size = PRED_16x8;
  ------------------
  |  |  451|     26|#define PRED_16x8   1
  ------------------
 2311|     26|            ps_mb_params->u1_mb_type = P_L0_L0_16x8;
 2312|     26|            ps_mb_part_info->u1_num_part = 2;
 2313|     26|            *pu1_col_info++ = (PRED_16x8 << 6);
  ------------------
  |  |  451|     26|#define PRED_16x8   1
  ------------------
 2314|     26|            *pu1_col_info++ = (PRED_16x8 << 6);
  ------------------
  |  |  451|     26|#define PRED_16x8   1
  ------------------
 2315|       |
 2316|     26|            ps_mb_part_info->i1_ref_idx[0][0] = ps_motion_pred->i1_ref_frame[0];
 2317|     26|            ps_mb_part_info->i1_ref_idx[0][1] = ps_motion_pred[8].i1_ref_frame[0];
 2318|     26|            if(2 == i4_listx)
  ------------------
  |  Branch (2318:16): [True: 26, False: 0]
  ------------------
 2319|     26|            {
 2320|     26|                ps_mb_part_info->i1_ref_idx[1][0] = ps_motion_pred->i1_ref_frame[1];
 2321|     26|                ps_mb_part_info->i1_ref_idx[1][1] = ps_motion_pred[8].i1_ref_frame[1];
 2322|     26|            }
 2323|     26|            ps_part->u1_partwidth = 4;  // interms of 4x4
 2324|     26|            ps_part->u1_partheight = 2;
 2325|     26|            ps_part->u1_pred_mode = PRED_L0;
  ------------------
  |  |  483|     26|#define PRED_L0   1
  ------------------
 2326|     26|            ps_part->u1_is_direct = 0;
 2327|     26|            ps_part->u1_sub_mb_num = 0;
 2328|       |
 2329|     26|            ps_part++;
 2330|     26|            ps_part->u1_partwidth = 4;
 2331|     26|            ps_part->u1_partheight = 2;
 2332|     26|            ps_part->u1_pred_mode = PRED_L0;
  ------------------
  |  |  483|     26|#define PRED_L0   1
  ------------------
 2333|     26|            ps_part->u1_is_direct = 0;
 2334|     26|            ps_part->u1_sub_mb_num = 8;
 2335|     26|        }
 2336|    135|        else if(2 == i4_vert_match)
  ------------------
  |  Branch (2336:17): [True: 54, False: 81]
  ------------------
 2337|     54|        {
 2338|     54|            ps_mb_params->u1_mb_type = P_L0_L0_8x16;
 2339|     54|            i4_part_size = PRED_8x16;
  ------------------
  |  |  452|     54|#define PRED_8x16   2
  ------------------
 2340|     54|            ps_mb_part_info->u1_num_part = 2;
 2341|     54|            *pu1_col_info++ = (PRED_8x16 << 6);
  ------------------
  |  |  452|     54|#define PRED_8x16   2
  ------------------
 2342|     54|            *pu1_col_info++ = (PRED_8x16 << 6);
  ------------------
  |  |  452|     54|#define PRED_8x16   2
  ------------------
 2343|       |
 2344|     54|            ps_mb_part_info->i1_ref_idx[0][0] = ps_motion_pred->i1_ref_frame[0];
 2345|     54|            ps_mb_part_info->i1_ref_idx[0][1] = ps_motion_pred[2].i1_ref_frame[0];
 2346|     54|            if(2 == i4_listx)
  ------------------
  |  Branch (2346:16): [True: 20, False: 34]
  ------------------
 2347|     20|            {
 2348|     20|                ps_mb_part_info->i1_ref_idx[1][0] = ps_motion_pred->i1_ref_frame[1];
 2349|     20|                ps_mb_part_info->i1_ref_idx[1][1] = ps_motion_pred[2].i1_ref_frame[1];
 2350|     20|            }
 2351|     54|            ps_part->u1_partwidth = 2;  // interms of 4x4
 2352|     54|            ps_part->u1_partheight = 4;
 2353|     54|            ps_part->u1_pred_mode = PRED_L0;
  ------------------
  |  |  483|     54|#define PRED_L0   1
  ------------------
 2354|     54|            ps_part->u1_is_direct = 0;
 2355|     54|            ps_part->u1_sub_mb_num = 0;
 2356|       |
 2357|     54|            ps_part++;
 2358|     54|            ps_part->u1_partwidth = 2;
 2359|     54|            ps_part->u1_partheight = 4;
 2360|     54|            ps_part->u1_pred_mode = PRED_L0;
  ------------------
  |  |  483|     54|#define PRED_L0   1
  ------------------
 2361|     54|            ps_part->u1_is_direct = 0;
 2362|     54|            ps_part->u1_sub_mb_num = 2;
 2363|     54|        }
 2364|    650|    }
 2365|       |
 2366|       |    /* store the part size to the mb params */
 2367|    992|    ps_mb_params->u1_mb_mc_mode = i4_part_size;
 2368|       |
 2369|       |    /* in case of slice derive the partition modes */
 2370|       |
 2371|    992|    {
 2372|       |        /* store the sub MB modes if 8x8 mode is choosen */
 2373|    992|        if(PRED_8x8 == i4_part_size)
  ------------------
  |  |  453|    992|#define PRED_8x8    3
  ------------------
  |  Branch (2373:12): [True: 423, False: 569]
  ------------------
 2374|    423|        {
 2375|    423|            UWORD8 u1_sub_mb_type, u1_sub_mb_mc_mode = 0;
 2376|       |
 2377|       |            /* for P_MB sub part type is same as sub mb type */
 2378|    423|            ps_mb_params->u1_mb_type = P_8x8;
 2379|    423|            ps_mb_part_info->i1_ref_idx[0][0] = ps_motion_pred[0].i1_ref_frame[0];
 2380|    423|            ps_mb_part_info->i1_ref_idx[0][1] = ps_motion_pred[2].i1_ref_frame[0];
 2381|    423|            ps_mb_part_info->i1_ref_idx[0][2] = ps_motion_pred[8].i1_ref_frame[0];
 2382|    423|            ps_mb_part_info->i1_ref_idx[0][3] = ps_motion_pred[10].i1_ref_frame[0];
 2383|    423|            if(2 == i4_listx)
  ------------------
  |  Branch (2383:16): [True: 22, False: 401]
  ------------------
 2384|     22|            {
 2385|     22|                ps_mb_part_info->i1_ref_idx[1][0] = ps_motion_pred[0].i1_ref_frame[1];
 2386|     22|                ps_mb_part_info->i1_ref_idx[1][1] = ps_motion_pred[2].i1_ref_frame[1];
 2387|     22|                ps_mb_part_info->i1_ref_idx[1][2] = ps_motion_pred[8].i1_ref_frame[1];
 2388|     22|                ps_mb_part_info->i1_ref_idx[1][3] = ps_motion_pred[10].i1_ref_frame[1];
 2389|     22|            }
 2390|       |
 2391|    423|            ps_mb_part_info->u1_num_part = 0;
 2392|  2.11k|            for(i4_i = 0; i4_i < NUM_MB_PARTS; i4_i++)
  ------------------
  |  |   59|  2.11k|#define NUM_MB_PARTS 4
  ------------------
  |  Branch (2392:27): [True: 1.69k, False: 423]
  ------------------
 2393|  1.69k|            {
 2394|  1.69k|                WORD32 i4_num_submb_part, i4_part_width, i4_part_height, i4_ctr;
 2395|  1.69k|                u1_sub_mb_type = (UWORD8) pi4_sub_mb_mode[i4_i];
 2396|       |
 2397|  1.69k|                if(1 == i4_listx)
  ------------------
  |  Branch (2397:20): [True: 1.60k, False: 88]
  ------------------
 2398|  1.60k|                {
 2399|  1.60k|                    u1_sub_mb_mc_mode = gau1_ih264d_submb_mc_mode[u1_sub_mb_type];
 2400|  1.60k|                }
 2401|     88|                else if(2 == i4_listx)
  ------------------
  |  Branch (2401:25): [True: 88, False: 0]
  ------------------
 2402|     88|                {
 2403|     88|                    u1_sub_mb_mc_mode = gau1_ih264d_submb_mc_mode[4 + u1_sub_mb_type];
 2404|     88|                }
 2405|  1.69k|                i4_num_submb_part = g_au1_num_sub_mb_part[u1_sub_mb_mc_mode];
 2406|       |
 2407|  1.69k|                ps_mb_part_info->u1_num_part += i4_num_submb_part;
 2408|       |
 2409|  1.69k|                i4_part_width = g_au1_sub_mb_part_wd[u1_sub_mb_mc_mode];
 2410|  1.69k|                i4_part_height = g_au1_sub_mb_part_ht[u1_sub_mb_mc_mode];
 2411|  1.69k|                *pu1_col_info++ = (PRED_8x8 << 6) | (u1_sub_mb_mc_mode << 4);
  ------------------
  |  |  453|  1.69k|#define PRED_8x8    3
  ------------------
 2412|  4.61k|                for(i4_ctr = 0; i4_ctr < i4_num_submb_part; i4_ctr++)
  ------------------
  |  Branch (2412:33): [True: 2.92k, False: 1.69k]
  ------------------
 2413|  2.92k|                {
 2414|  2.92k|                    ps_part->u1_partwidth = i4_part_width;  // interms of 4x4
 2415|  2.92k|                    ps_part->u1_partheight = i4_part_height;
 2416|  2.92k|                    ps_part->u1_pred_mode = PRED_L0;
  ------------------
  |  |  483|  2.92k|#define PRED_L0   1
  ------------------
 2417|  2.92k|                    ps_part->u1_is_direct = 0;
 2418|  2.92k|                    ps_part->u1_sub_mb_num = (i4_i & 0x01) * 2 + (i4_i >> 1) * 8;
 2419|  2.92k|                    if(i4_num_submb_part == 2)
  ------------------
  |  Branch (2419:24): [True: 836, False: 2.08k]
  ------------------
 2420|    836|                    {
 2421|    836|                        ps_part->u1_sub_mb_num +=
 2422|    836|                            i4_ctr ? (((i4_part_width - 1) << 2) + (i4_part_height - 1)) : 0;
  ------------------
  |  Branch (2422:29): [True: 418, False: 418]
  ------------------
 2423|    836|                    }
 2424|  2.08k|                    else if(i4_num_submb_part == 4)
  ------------------
  |  Branch (2424:29): [True: 1.08k, False: 1.00k]
  ------------------
 2425|  1.08k|                    {
 2426|  1.08k|                        ps_part->u1_sub_mb_num += ((i4_ctr >> 1) << 2) + (i4_ctr & 0x01);
 2427|  1.08k|                    }
 2428|       |
 2429|  2.92k|                    ps_part++;
 2430|  2.92k|                }
 2431|  1.69k|            }
 2432|    423|        }
 2433|    992|        if(2 == i4_listx)
  ------------------
  |  Branch (2433:12): [True: 114, False: 878]
  ------------------
 2434|    114|        {
 2435|    114|            ps_part = (parse_part_params_t *) pv_part;
 2436|    114|            pu1_col_info = ps_mb_part_info->u1_col_info;
 2437|       |            /* B_MBs */
 2438|    114|            isvcd_interlyr_mbmode_pred_bmb(ps_ctxt, ps_motion_pred, 4, i4_part_size,
 2439|    114|                                           pi4_sub_mb_mode, ps_mb_params, ps_part, pu1_col_info);
 2440|    114|        }
 2441|    992|    }
 2442|       |
 2443|    992|    return;
 2444|    992|}
isvcd_compute_interlyr_motion_mode:
 2474|  1.15k|{
 2475|       |    /*! Flow of the module is as follows                                   */
 2476|       |    /*! 1. if dyaydic case then it sets the sub mb mode to 8x8             */
 2477|       |    /*! 2. else it call the ref part idc comute fucntion                   */
 2478|       |    /*! 3. it calls the motion vectors and submb mode derive function.
 2479|       |           if the current mb is not inffered as INTRA                      */
 2480|       |    /*! 4. it calls the mode predcition module if base mode flag is 1      */
 2481|       |
 2482|  1.15k|    mode_motion_ctxt_t *ps_ctxt;
 2483|  1.15k|    WORD32 i4_intra_flag;
 2484|  1.15k|    WORD32 ai4_sub_mb_mode[NUM_MB_PARTS] = {0};
 2485|  1.15k|    dec_mb_info_t *ps_mb_params;
 2486|  1.15k|    dec_svc_mb_info_t *ps_svc_mb_params;
 2487|  1.15k|    dec_struct_t *ps_dec = (dec_struct_t *) pv_dec;
 2488|  1.15k|    WORD32 i4_mb_mode = -1;
 2489|  1.15k|    parse_pmbarams_t *ps_mb_part_info = (parse_pmbarams_t *) pv_mb_part_info;
 2490|  1.15k|    parse_part_params_t *ps_part = (parse_part_params_t *) pv_part;
 2491|       |
 2492|  1.15k|    ps_ctxt = (mode_motion_ctxt_t *) pv_comp_mode_mv_ctxt;
 2493|  1.15k|    ps_mb_params = (dec_mb_info_t *) pv_mb_params;
 2494|  1.15k|    ps_svc_mb_params = (dec_svc_mb_info_t *) pv_svc_mb_params;
 2495|       |
 2496|  1.15k|    i4_intra_flag = SVCD_FALSE;
  ------------------
  |  |   45|  1.15k|#define SVCD_FALSE 0
  ------------------
 2497|       |
 2498|  1.15k|    isvcd_ref_lyr_part_idc(pv_comp_mode_mv_ctxt, ps_ctxt->ai4_ref_part_idc, &i4_intra_flag,
 2499|  1.15k|                           pv_mb_params);
 2500|       |
 2501|       |    /* If base is Intra */
 2502|  1.15k|    if(SVCD_TRUE == i4_intra_flag)
  ------------------
  |  |   46|  1.15k|#define SVCD_TRUE 1
  ------------------
  |  Branch (2502:8): [True: 124, False: 1.03k]
  ------------------
 2503|    124|    {
 2504|    124|        if(1 == ps_svc_mb_params->u1_base_mode_flag)
  ------------------
  |  Branch (2504:12): [True: 123, False: 1]
  ------------------
 2505|    123|        {
 2506|    123|            i4_mb_mode = SVC_IBL_MB;
  ------------------
  |  |  117|    123|#define SVC_IBL_MB (1 << 3)         /*!< I_BL MB always inferred */
  ------------------
 2507|    123|            ps_svc_mb_params->u1_residual_prediction_flag = 0;
 2508|    123|        }
 2509|    124|    }
 2510|  1.03k|    else
 2511|  1.03k|    {
 2512|       |        /* derive the motion and reference index by inter layer predcition */
 2513|  1.03k|        isvcd_interlyr_motion_submbmode_pred(pv_comp_mode_mv_ctxt, ps_mb_params, ps_svc_mb_params,
 2514|  1.03k|                                             ps_ctxt->ai4_ref_part_idc, ai4_sub_mb_mode, pv_dec);
 2515|       |
 2516|       |        /* derive the MB mode */
 2517|  1.03k|        if(1 == ps_svc_mb_params->u1_base_mode_flag)
  ------------------
  |  Branch (2517:12): [True: 992, False: 42]
  ------------------
 2518|    992|        {
 2519|    992|            isvcd_interlyr_mbmode_pred(pv_comp_mode_mv_ctxt, pv_mb_params, ai4_sub_mb_mode,
 2520|    992|                                       &i4_mb_mode, ps_dec, ps_mb_part_info, ps_part);
 2521|    992|        }
 2522|     42|        else
 2523|     42|        {
 2524|     42|            isvcd_populate_ref_idx(ps_mb_params, ps_svc_mb_params, ps_ctxt->ps_motion_pred_struct,
 2525|     42|                                   ps_mb_part_info, ps_ctxt->i4_listx);
 2526|     42|        }
 2527|  1.03k|    }
 2528|       |
 2529|  1.15k|    return i4_mb_mode;
 2530|  1.15k|}
isvcd_interlyr_motion_mode_pred_dyadic:
 2564|  4.73k|{
 2565|  4.73k|    mode_motion_ctxt_t *ps_ctxt;
 2566|  4.73k|    mode_motion_lyr_ctxt *ps_lyr_mem;
 2567|  4.73k|    dec_mb_info_t *ps_mb_params;
 2568|  4.73k|    dec_svc_mb_info_t *ps_svc_mb_params;
 2569|  4.73k|    WORD32 i4_listx;
 2570|  4.73k|    WORD32 i4_mb_pic_x, i4_mb_pic_y;
 2571|  4.73k|    WORD32 i4_ref_x, i4_ref_y;
 2572|  4.73k|    UWORD8 u1_base_mode_flag;
 2573|  4.73k|    dec_struct_t *ps_dec = (dec_struct_t *) pv_dec;
 2574|  4.73k|    WORD32 i4_mb_mode = -1;
 2575|  4.73k|    parse_pmbarams_t *ps_mb_part_info = (parse_pmbarams_t *) pv_mb_part_info;
 2576|  4.73k|    UWORD8 *pu1_col_info = ps_mb_part_info->u1_col_info;
 2577|  4.73k|    parse_part_params_t *ps_part = (parse_part_params_t *) pv_part;
 2578|       |
 2579|  4.73k|    ps_ctxt = (mode_motion_ctxt_t *) pv_comp_mode_mv_ctxt;
 2580|       |
 2581|       |    /* get the current layer ctxt */
 2582|  4.73k|    ps_lyr_mem = &ps_ctxt->as_res_lyr_mem[ps_ctxt->i4_res_id];
 2583|       |
 2584|  4.73k|    ps_mb_params = (dec_mb_info_t *) pv_mb_params;
 2585|  4.73k|    ps_svc_mb_params = (dec_svc_mb_info_t *) pv_svc_mb_params;
 2586|  4.73k|    i4_listx = ps_ctxt->i4_listx;
 2587|       |
 2588|  4.73k|    {
 2589|  4.73k|        WORD32 i4_mb_x, i4_mb_y;
 2590|       |        /* derive the MB_X and MB_Y for the current MB */
 2591|  4.73k|        i4_mb_x = ps_mb_params->u2_mbx;
 2592|  4.73k|        i4_mb_y = ps_mb_params->u2_mby;
 2593|       |
 2594|       |        /* get the colocated position in the refernce layer */
 2595|  4.73k|        i4_ref_x = ps_lyr_mem->pi2_ref_loc_x[i4_mb_x << 4];
 2596|  4.73k|        i4_ref_y = ps_lyr_mem->pi2_ref_loc_y[i4_mb_y << 4];
 2597|  4.73k|        i4_ref_x = CLIP3(0, ((ps_lyr_mem->i4_ref_width) - 1), i4_ref_x);
  ------------------
  |  |   77|  4.73k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 0, False: 4.73k]
  |  |  |  Branch (77:54): [True: 0, False: 4.73k]
  |  |  ------------------
  ------------------
 2598|  4.73k|        i4_ref_y = CLIP3(0, ((ps_lyr_mem->i4_ref_height) - 1), i4_ref_y);
  ------------------
  |  |   77|  4.73k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 0, False: 4.73k]
  |  |  |  Branch (77:54): [True: 0, False: 4.73k]
  |  |  ------------------
  ------------------
 2599|       |
 2600|       |        /* convert into picture units */
 2601|  4.73k|        i4_mb_pic_x = i4_mb_x << 4;
 2602|  4.73k|        i4_mb_pic_y = i4_mb_y << 4;
 2603|  4.73k|    }
 2604|       |
 2605|       |    /* ref layer mb mode */
 2606|  4.73k|    {
 2607|  4.73k|        inter_lyr_mb_prms_t *ps_inter_lyr_mb_prms;
 2608|  4.73k|        WORD32 i4_inter_lyr_mb_prms_stride;
 2609|  4.73k|        WORD32 i4_ref_mb_x, i4_ref_mb_y;
 2610|  4.73k|        WORD8 i1_ref_mb_mode;
 2611|       |
 2612|  4.73k|        ps_inter_lyr_mb_prms = (inter_lyr_mb_prms_t *) ps_lyr_mem->s_ref_mb_mode.pv_buffer;
 2613|  4.73k|        i4_inter_lyr_mb_prms_stride = ps_lyr_mem->s_ref_mb_mode.i4_num_element_stride;
 2614|       |
 2615|       |        /* get the reference mb x and y */
 2616|  4.73k|        i4_ref_mb_x = (i4_ref_x >> 4);
 2617|  4.73k|        i4_ref_mb_y = (i4_ref_y >> 4);
 2618|       |
 2619|       |        /* get the appropriate mb params in reference layer */
 2620|  4.73k|        ps_inter_lyr_mb_prms += i4_ref_mb_x;
 2621|  4.73k|        ps_inter_lyr_mb_prms += i4_ref_mb_y * i4_inter_lyr_mb_prms_stride;
 2622|  4.73k|        i1_ref_mb_mode = ps_inter_lyr_mb_prms->i1_mb_mode;
 2623|  4.73k|        u1_base_mode_flag = ps_svc_mb_params->u1_base_mode_flag;
 2624|       |
 2625|       |        /* check if the MB mode of the refernce MB is Intra*/
 2626|  4.73k|        if(i1_ref_mb_mode > SVC_INTER_MB)
  ------------------
  |  |  114|  4.73k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (2626:12): [True: 0, False: 4.73k]
  ------------------
 2627|      0|        {
 2628|      0|            if(1 == u1_base_mode_flag)
  ------------------
  |  Branch (2628:16): [True: 0, False: 0]
  ------------------
 2629|      0|            {
 2630|      0|                i4_mb_mode = SVC_IBL_MB;
  ------------------
  |  |  117|      0|#define SVC_IBL_MB (1 << 3)         /*!< I_BL MB always inferred */
  ------------------
 2631|      0|                ps_svc_mb_params->u1_residual_prediction_flag = 0;
 2632|      0|            }
 2633|      0|            return i4_mb_mode;
 2634|      0|        }
 2635|  4.73k|    }
 2636|       |
 2637|       |    /*-----------------------------------------------------------------------*/
 2638|       |    /* Inter MB upsampling process                                           */
 2639|       |    /*-----------------------------------------------------------------------*/
 2640|  4.73k|    {
 2641|  4.73k|        mv_pred_t *ps_motion_pred;
 2642|  4.73k|        WORD32 i4_16x16_flag;
 2643|  4.73k|        WORD32 i4_part_idc;
 2644|  4.73k|        WORD32 i4_blk_idx;
 2645|  4.73k|        WORD32 i4_curr_mot_stride;
 2646|       |
 2647|       |        /* choose the appropriate mv bank pointer and stride */
 2648|  4.73k|        if(1 == u1_base_mode_flag)
  ------------------
  |  Branch (2648:12): [True: 3.05k, False: 1.67k]
  ------------------
 2649|  3.05k|        {
 2650|  3.05k|            i4_mb_mode = SVC_INTER_MB;
  ------------------
  |  |  114|  3.05k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
 2651|  3.05k|        }
 2652|       |
 2653|  4.73k|        ps_motion_pred = ps_ctxt->ps_motion_pred_struct;
 2654|  4.73k|        i4_curr_mot_stride = 4;
 2655|       |
 2656|       |        /* call the motion upsampling for 1st 4x4 */
 2657|  4.73k|        i4_part_idc = (i4_ref_y << 16) + i4_ref_x;
 2658|  4.73k|        i4_16x16_flag = isvcd_interlyr_motion_scale(
 2659|  4.73k|            pv_comp_mode_mv_ctxt, &i4_part_idc, ps_mb_params, ps_motion_pred, i4_listx,
 2660|  4.73k|            (i4_mb_pic_x + 1), (i4_mb_pic_y + 1), ps_dec->ppv_map_ref_idx_to_poc);
 2661|       |
 2662|       |        /* ---------- reference layer MB is 16x16 ------------------*/
 2663|  4.73k|        if(i4_16x16_flag)
  ------------------
  |  Branch (2663:12): [True: 0, False: 4.73k]
  ------------------
 2664|      0|        {
 2665|      0|            if(1 == u1_base_mode_flag)
  ------------------
  |  Branch (2665:16): [True: 0, False: 0]
  ------------------
 2666|      0|            {
 2667|      0|                ps_mb_params->u1_mb_type = P_L0_16x16;
 2668|      0|                ps_mb_params->u1_mb_mc_mode = PRED_16x16;
  ------------------
  |  |  450|      0|#define PRED_16x16  0
  ------------------
 2669|      0|                ps_mb_part_info->u1_num_part = 1;
 2670|      0|                *pu1_col_info++ = (PRED_16x16 << 6);
  ------------------
  |  |  450|      0|#define PRED_16x16  0
  ------------------
 2671|      0|                ps_mb_part_info->i1_ref_idx[0][0] = ps_motion_pred->i1_ref_frame[0];
 2672|       |
 2673|      0|                ps_part->u1_partwidth = 4;  // interms of 4x4
 2674|      0|                ps_part->u1_partheight = 4;
 2675|      0|                ps_part->u1_pred_mode = PRED_L0;
  ------------------
  |  |  483|      0|#define PRED_L0   1
  ------------------
 2676|      0|                ps_part->u1_is_direct = 0;
 2677|      0|                ps_part->u1_sub_mb_num = 0;
 2678|       |
 2679|      0|                if(2 == i4_listx)
  ------------------
  |  Branch (2679:20): [True: 0, False: 0]
  ------------------
 2680|      0|                {
 2681|      0|                    WORD32 i4_part_mode_a = 0;
 2682|      0|                    WORD32 i4_temp;
 2683|       |
 2684|      0|                    ps_mb_part_info->i1_ref_idx[1][0] = ps_motion_pred->i1_ref_frame[1];
 2685|      0|                    if(0 <= ps_motion_pred[0].i1_ref_frame[0])
  ------------------
  |  Branch (2685:24): [True: 0, False: 0]
  ------------------
 2686|      0|                    {
 2687|      0|                        i4_part_mode_a += 1;
 2688|      0|                    }
 2689|      0|                    if(0 <= ps_motion_pred[0].i1_ref_frame[1])
  ------------------
  |  Branch (2689:24): [True: 0, False: 0]
  ------------------
 2690|      0|                    {
 2691|      0|                        i4_part_mode_a += 2;
 2692|      0|                    }
 2693|       |
 2694|      0|                    i4_temp = 3 * PRED_16x16;
  ------------------
  |  |  450|      0|#define PRED_16x16  0
  ------------------
 2695|      0|                    i4_temp += (3 * (i4_part_mode_a - 1) - 1);
 2696|      0|                    i4_temp = (i4_temp < 0) ? 0 : i4_temp;
  ------------------
  |  Branch (2696:31): [True: 0, False: 0]
  ------------------
 2697|      0|                    i4_temp = g_au1_eb_mb_type[i4_temp];
 2698|      0|                    ps_mb_params->u1_mb_type = i4_temp;
 2699|      0|                    ps_part->u1_pred_mode = g_au1_mb_pred_mode[0][5 + i4_temp];
 2700|      0|                }
 2701|      0|            }
 2702|      0|            else
 2703|      0|            {
 2704|       |                /* motion prediction flag cases replicate the motion vectors for entire MB */
 2705|      0|                isvcd_store_motion_map(ps_motion_pred, (ps_motion_pred), 0, i4_curr_mot_stride,
 2706|      0|                                       NUM_MB_PARTS, NUM_MB_PARTS, SVCD_FALSE);
  ------------------
  |  |   59|      0|#define NUM_MB_PARTS 4
  ------------------
                                                     NUM_MB_PARTS, NUM_MB_PARTS, SVCD_FALSE);
  ------------------
  |  |   59|      0|#define NUM_MB_PARTS 4
  ------------------
                                                     NUM_MB_PARTS, NUM_MB_PARTS, SVCD_FALSE);
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
 2707|       |
 2708|      0|                isvcd_populate_ref_idx(ps_mb_params, ps_svc_mb_params, ps_motion_pred,
 2709|      0|                                       ps_mb_part_info, i4_listx);
 2710|      0|            }
 2711|      0|            return i4_mb_mode;
 2712|      0|        }
 2713|       |        /* ---------- reference layer MB is non 16x16 ------------------ */
 2714|  4.73k|        else
 2715|  4.73k|        {
 2716|  4.73k|            WORD32 ai4_sub_mb_mode[NUM_MB_PARTS] = {0};
 2717|       |
 2718|       |            /* replicate the motion vectors for 8x8 */
 2719|  4.73k|            isvcd_store_motion_map(ps_motion_pred, ps_motion_pred, 0, i4_curr_mot_stride, 2, 2,
 2720|  4.73k|                                   SVCD_FALSE);
  ------------------
  |  |   45|  4.73k|#define SVCD_FALSE 0
  ------------------
 2721|       |
 2722|  4.73k|            if(2 == i4_listx)
  ------------------
  |  Branch (2722:16): [True: 358, False: 4.37k]
  ------------------
 2723|    358|            {
 2724|    358|                WORD32 i4_indx = 0;
 2725|       |
 2726|       |                /* replicate the motion vectors for 8x8 */
 2727|       |                /* check the 0th partiton reference indices */
 2728|    358|                if(0 <= ps_motion_pred[0].i1_ref_frame[0])
  ------------------
  |  Branch (2728:20): [True: 304, False: 54]
  ------------------
 2729|    304|                {
 2730|    304|                    i4_indx += 1;
 2731|    304|                }
 2732|    358|                if(0 <= ps_motion_pred[0].i1_ref_frame[1])
  ------------------
  |  Branch (2732:20): [True: 211, False: 147]
  ------------------
 2733|    211|                {
 2734|    211|                    i4_indx += 2;
 2735|    211|                }
 2736|       |
 2737|    358|                i4_indx = 3 * PRED_8x8 + (i4_indx - 1);
  ------------------
  |  |  453|    358|#define PRED_8x8    3
  ------------------
 2738|    358|                ai4_sub_mb_mode[0] = g_au1_eb_submb_type[i4_indx];
 2739|    358|            }
 2740|       |
 2741|       |            /* derive the motion vectors and reference indices of 3 rem partitions */
 2742|  18.9k|            for(i4_blk_idx = 1; i4_blk_idx < NUM_MB_PARTS; i4_blk_idx++)
  ------------------
  |  |   59|  18.9k|#define NUM_MB_PARTS 4
  ------------------
  |  Branch (2742:33): [True: 14.1k, False: 4.73k]
  ------------------
 2743|  14.1k|            {
 2744|  14.1k|                WORD32 i4_blk_y, i4_blk_x;
 2745|  14.1k|                mv_pred_t *ps_temp;
 2746|       |
 2747|  14.1k|                i4_blk_x = i4_blk_idx & 1;
 2748|  14.1k|                i4_blk_y = i4_blk_idx >> 1;
 2749|       |
 2750|  14.1k|                ps_temp = ps_motion_pred + (i4_blk_x << 1);
 2751|  14.1k|                ps_temp += (i4_blk_y * i4_curr_mot_stride << 1);
 2752|       |
 2753|       |                /* store the reference layer positions */
 2754|  14.1k|                i4_part_idc = ((i4_ref_y + (i4_blk_y << 2)) << 16) + (i4_ref_x + (i4_blk_x << 2));
 2755|  14.1k|                isvcd_interlyr_motion_scale(pv_comp_mode_mv_ctxt, &i4_part_idc, ps_mb_params,
 2756|  14.1k|                                            ps_temp, i4_listx, (i4_mb_pic_x + (i4_blk_x << 2) + 1),
 2757|  14.1k|                                            (i4_mb_pic_y + (i4_blk_y << 2) + 1),
 2758|  14.1k|                                            ps_dec->ppv_map_ref_idx_to_poc);
 2759|       |
 2760|       |                /* replicate the motion vectors for 8x8 */
 2761|  14.1k|                isvcd_store_motion_map(ps_temp, ps_temp, 0, i4_curr_mot_stride, 2, 2, SVCD_FALSE);
  ------------------
  |  |   45|  14.1k|#define SVCD_FALSE 0
  ------------------
 2762|       |
 2763|  14.1k|                if(2 == i4_listx)
  ------------------
  |  Branch (2763:20): [True: 1.07k, False: 13.1k]
  ------------------
 2764|  1.07k|                {
 2765|  1.07k|                    WORD32 i4_indx = 0;
 2766|       |
 2767|       |                    /* check the 0th partiton reference indices */
 2768|  1.07k|                    if(0 <= ps_temp[0].i1_ref_frame[0])
  ------------------
  |  Branch (2768:24): [True: 912, False: 162]
  ------------------
 2769|    912|                    {
 2770|    912|                        i4_indx += 1;
 2771|    912|                    }
 2772|  1.07k|                    if(0 <= ps_temp[0].i1_ref_frame[1])
  ------------------
  |  Branch (2772:24): [True: 633, False: 441]
  ------------------
 2773|    633|                    {
 2774|    633|                        i4_indx += 2;
 2775|    633|                    }
 2776|       |
 2777|  1.07k|                    i4_indx = 3 * PRED_8x8 + (i4_indx - 1);
  ------------------
  |  |  453|  1.07k|#define PRED_8x8    3
  ------------------
 2778|       |
 2779|  1.07k|                    ai4_sub_mb_mode[i4_blk_idx] = g_au1_eb_submb_type[i4_indx];
 2780|  1.07k|                }
 2781|  14.1k|            }
 2782|       |
 2783|       |            /* if MB mode has to derivied */
 2784|  4.73k|            if(1 == u1_base_mode_flag)
  ------------------
  |  Branch (2784:16): [True: 3.05k, False: 1.67k]
  ------------------
 2785|  3.05k|            {
 2786|  3.05k|                WORD32 i4_horz_match, i4_vert_match;
 2787|  3.05k|                WORD32 i4_part_size = PRED_8x8;
  ------------------
  |  |  453|  3.05k|#define PRED_8x8    3
  ------------------
 2788|       |
 2789|  3.05k|                mv_pred_t *ps_motion_1;
 2790|  3.05k|                mv_pred_t *ps_motion_2;
 2791|  3.05k|                mv_pred_t *ps_motion_3;
 2792|       |
 2793|  3.05k|                ps_motion_1 = ps_motion_pred + 2;
 2794|  3.05k|                ps_motion_2 = ps_motion_pred + (i4_curr_mot_stride << 1);
 2795|  3.05k|                ps_motion_3 = ps_motion_2 + 2;
 2796|       |
 2797|       |                /* check if the motion in horz direction are same*/
 2798|  3.05k|                i4_horz_match = isvcd_check_motion(ps_motion_pred, ps_motion_1, i4_listx);
 2799|  3.05k|                i4_horz_match += isvcd_check_motion(ps_motion_2, ps_motion_3, i4_listx);
 2800|       |
 2801|       |                /* check if the motion in vertical direction is same */
 2802|  3.05k|                i4_vert_match = isvcd_check_motion(ps_motion_pred, ps_motion_2, i4_listx);
 2803|  3.05k|                i4_vert_match += isvcd_check_motion(ps_motion_1, ps_motion_3, i4_listx);
 2804|       |
 2805|  3.05k|                ps_mb_part_info->u1_num_part = 4;
 2806|       |
 2807|       |                /* decide the partition size based on the results of matching */
 2808|  3.05k|                if((2 == i4_horz_match) && (2 == i4_vert_match))
  ------------------
  |  Branch (2808:20): [True: 3.05k, False: 0]
  |  Branch (2808:44): [True: 3.05k, False: 0]
  ------------------
 2809|  3.05k|                {
 2810|  3.05k|                    ps_mb_params->u1_mb_type = P_L0_16x16;
 2811|  3.05k|                    i4_part_size = PRED_16x16;
  ------------------
  |  |  450|  3.05k|#define PRED_16x16  0
  ------------------
 2812|  3.05k|                    ps_mb_part_info->u1_num_part = 1;
 2813|  3.05k|                    *pu1_col_info++ = (PRED_16x16 << 6);
  ------------------
  |  |  450|  3.05k|#define PRED_16x16  0
  ------------------
 2814|       |
 2815|  3.05k|                    ps_mb_part_info->i1_ref_idx[0][0] = ps_motion_pred->i1_ref_frame[0];
 2816|  3.05k|                    if(2 == i4_listx)
  ------------------
  |  Branch (2816:24): [True: 350, False: 2.70k]
  ------------------
 2817|    350|                        ps_mb_part_info->i1_ref_idx[1][0] = ps_motion_pred->i1_ref_frame[1];
 2818|       |
 2819|  3.05k|                    ps_part->u1_partwidth = 4;  // interms of 4x4
 2820|  3.05k|                    ps_part->u1_partheight = 4;
 2821|  3.05k|                    ps_part->u1_pred_mode = PRED_L0;
  ------------------
  |  |  483|  3.05k|#define PRED_L0   1
  ------------------
 2822|  3.05k|                    ps_part->u1_is_direct = 0;
 2823|  3.05k|                    ps_part->u1_sub_mb_num = 0;
 2824|  3.05k|                }
 2825|      0|                else if(2 == i4_horz_match)
  ------------------
  |  Branch (2825:25): [True: 0, False: 0]
  ------------------
 2826|      0|                {
 2827|      0|                    ps_mb_params->u1_mb_type = P_L0_L0_16x8;
 2828|      0|                    i4_part_size = PRED_16x8;
  ------------------
  |  |  451|      0|#define PRED_16x8   1
  ------------------
 2829|      0|                    ps_mb_part_info->u1_num_part = 2;
 2830|      0|                    *pu1_col_info++ = (PRED_16x8 << 6);
  ------------------
  |  |  451|      0|#define PRED_16x8   1
  ------------------
 2831|      0|                    *pu1_col_info++ = (PRED_16x8 << 6);
  ------------------
  |  |  451|      0|#define PRED_16x8   1
  ------------------
 2832|       |
 2833|      0|                    ps_mb_part_info->i1_ref_idx[0][0] = ps_motion_pred->i1_ref_frame[0];
 2834|      0|                    ps_mb_part_info->i1_ref_idx[0][1] = ps_motion_pred[8].i1_ref_frame[0];
 2835|      0|                    if(2 == i4_listx)
  ------------------
  |  Branch (2835:24): [True: 0, False: 0]
  ------------------
 2836|      0|                    {
 2837|      0|                        ps_mb_part_info->i1_ref_idx[1][0] = ps_motion_pred->i1_ref_frame[1];
 2838|      0|                        ps_mb_part_info->i1_ref_idx[1][1] = ps_motion_pred[8].i1_ref_frame[1];
 2839|      0|                    }
 2840|      0|                    ps_part->u1_partwidth = 4;  // interms of 4x4
 2841|      0|                    ps_part->u1_partheight = 2;
 2842|      0|                    ps_part->u1_pred_mode = PRED_L0;
  ------------------
  |  |  483|      0|#define PRED_L0   1
  ------------------
 2843|      0|                    ps_part->u1_is_direct = 0;
 2844|      0|                    ps_part->u1_sub_mb_num = 0;
 2845|       |
 2846|      0|                    ps_part++;
 2847|      0|                    ps_part->u1_partwidth = 4;
 2848|      0|                    ps_part->u1_partheight = 2;
 2849|      0|                    ps_part->u1_pred_mode = PRED_L0;
  ------------------
  |  |  483|      0|#define PRED_L0   1
  ------------------
 2850|      0|                    ps_part->u1_is_direct = 0;
 2851|      0|                    ps_part->u1_sub_mb_num = 8;
 2852|      0|                }
 2853|      0|                else if(2 == i4_vert_match)
  ------------------
  |  Branch (2853:25): [True: 0, False: 0]
  ------------------
 2854|      0|                {
 2855|      0|                    ps_mb_params->u1_mb_type = P_L0_L0_8x16;
 2856|      0|                    i4_part_size = PRED_8x16;
  ------------------
  |  |  452|      0|#define PRED_8x16   2
  ------------------
 2857|      0|                    ps_mb_part_info->u1_num_part = 2;
 2858|      0|                    *pu1_col_info++ = (PRED_8x16 << 6);
  ------------------
  |  |  452|      0|#define PRED_8x16   2
  ------------------
 2859|      0|                    *pu1_col_info++ = (PRED_8x16 << 6);
  ------------------
  |  |  452|      0|#define PRED_8x16   2
  ------------------
 2860|       |
 2861|      0|                    ps_mb_part_info->i1_ref_idx[0][0] = ps_motion_pred->i1_ref_frame[0];
 2862|      0|                    ps_mb_part_info->i1_ref_idx[0][1] = ps_motion_pred[2].i1_ref_frame[0];
 2863|      0|                    if(2 == i4_listx)
  ------------------
  |  Branch (2863:24): [True: 0, False: 0]
  ------------------
 2864|      0|                    {
 2865|      0|                        ps_mb_part_info->i1_ref_idx[1][0] = ps_motion_pred->i1_ref_frame[1];
 2866|      0|                        ps_mb_part_info->i1_ref_idx[1][1] = ps_motion_pred[2].i1_ref_frame[1];
 2867|      0|                    }
 2868|      0|                    ps_part->u1_partwidth = 2;  // interms of 4x4
 2869|      0|                    ps_part->u1_partheight = 4;
 2870|      0|                    ps_part->u1_pred_mode = PRED_L0;
  ------------------
  |  |  483|      0|#define PRED_L0   1
  ------------------
 2871|      0|                    ps_part->u1_is_direct = 0;
 2872|      0|                    ps_part->u1_sub_mb_num = 0;
 2873|       |
 2874|      0|                    ps_part++;
 2875|      0|                    ps_part->u1_partwidth = 2;
 2876|      0|                    ps_part->u1_partheight = 4;
 2877|      0|                    ps_part->u1_pred_mode = PRED_L0;
  ------------------
  |  |  483|      0|#define PRED_L0   1
  ------------------
 2878|      0|                    ps_part->u1_is_direct = 0;
 2879|      0|                    ps_part->u1_sub_mb_num = 2;
 2880|      0|                }
 2881|       |
 2882|       |                /* store the part size to the mb params */
 2883|  3.05k|                ps_mb_params->u1_mb_mc_mode = i4_part_size;
 2884|       |
 2885|       |                /* store the sub partition size */
 2886|  3.05k|                if(PRED_8x8 == i4_part_size)
  ------------------
  |  |  453|  3.05k|#define PRED_8x8    3
  ------------------
  |  Branch (2886:20): [True: 0, False: 3.05k]
  ------------------
 2887|      0|                {
 2888|      0|                    UWORD8 u1_ctr;
 2889|       |                    /* for P_MB sub part type is P_L0_8x8*/
 2890|       |
 2891|      0|                    ps_mb_params->u1_mb_type = P_8x8;
 2892|      0|                    ps_mb_part_info->i1_ref_idx[0][0] = ps_motion_pred[0].i1_ref_frame[0];
 2893|      0|                    ps_mb_part_info->i1_ref_idx[0][1] = ps_motion_pred[2].i1_ref_frame[0];
 2894|      0|                    ps_mb_part_info->i1_ref_idx[0][2] = ps_motion_pred[8].i1_ref_frame[0];
 2895|      0|                    ps_mb_part_info->i1_ref_idx[0][3] = ps_motion_pred[10].i1_ref_frame[0];
 2896|      0|                    if(2 == i4_listx)
  ------------------
  |  Branch (2896:24): [True: 0, False: 0]
  ------------------
 2897|      0|                    {
 2898|      0|                        ps_mb_part_info->i1_ref_idx[1][0] = ps_motion_pred[0].i1_ref_frame[1];
 2899|      0|                        ps_mb_part_info->i1_ref_idx[1][1] = ps_motion_pred[2].i1_ref_frame[1];
 2900|      0|                        ps_mb_part_info->i1_ref_idx[1][2] = ps_motion_pred[8].i1_ref_frame[1];
 2901|      0|                        ps_mb_part_info->i1_ref_idx[1][3] = ps_motion_pred[10].i1_ref_frame[1];
 2902|      0|                    }
 2903|       |
 2904|      0|                    for(u1_ctr = 0; u1_ctr < 4; u1_ctr++)
  ------------------
  |  Branch (2904:37): [True: 0, False: 0]
  ------------------
 2905|      0|                    {
 2906|      0|                        *pu1_col_info++ = (PRED_8x8 << 6);
  ------------------
  |  |  453|      0|#define PRED_8x8    3
  ------------------
 2907|       |
 2908|      0|                        ps_part->u1_partwidth = 2;  // interms of 4x4
 2909|      0|                        ps_part->u1_partheight = 2;
 2910|      0|                        ps_part->u1_pred_mode = PRED_L0;
  ------------------
  |  |  483|      0|#define PRED_L0   1
  ------------------
 2911|      0|                        ps_part->u1_is_direct = 0;
 2912|      0|                        ps_part->u1_sub_mb_num = (u1_ctr & 0x01) * 2 + (u1_ctr >> 1) * 8;
 2913|      0|                        ps_part++;
 2914|      0|                    }
 2915|      0|                }
 2916|       |
 2917|  3.05k|                if(2 == i4_listx)
  ------------------
  |  Branch (2917:20): [True: 350, False: 2.70k]
  ------------------
 2918|    350|                {
 2919|    350|                    ps_part = (parse_part_params_t *) pv_part;
 2920|    350|                    pu1_col_info = ps_mb_part_info->u1_col_info;
 2921|    350|                    isvcd_interlyr_mbmode_pred_bmb(ps_ctxt, ps_motion_pred, i4_curr_mot_stride,
 2922|    350|                                                   i4_part_size, &ai4_sub_mb_mode[0], ps_mb_params,
 2923|    350|                                                   ps_part, pu1_col_info);
 2924|    350|                }
 2925|  3.05k|            } /* end of mode derivation */
 2926|  1.67k|            else
 2927|  1.67k|            {
 2928|  1.67k|                isvcd_populate_ref_idx(ps_mb_params, ps_svc_mb_params, ps_motion_pred,
 2929|  1.67k|                                       ps_mb_part_info, i4_listx);
 2930|       |
 2931|  1.67k|            } /* non 16x16 mv mode derivation */
 2932|  4.73k|        }
 2933|  4.73k|    }
 2934|  4.73k|    return i4_mb_mode;
 2935|  4.73k|}
isvcd_compute_scaled_offsets:
 2968|    720|{
 2969|    720|    WORD32 i4_offset_x, i4_offset_y;
 2970|    720|    UWORD32 i4_scaled_ref_lyr_width;
 2971|    720|    UWORD32 i4_scaled_ref_lyr_height;
 2972|    720|    UWORD32 i4_ref_lyr_width;
 2973|    720|    UWORD32 i4_ref_lyr_height;
 2974|    720|    UWORD32 i4_shift_x, i4_shift_y;
 2975|    720|    UWORD32 i4_scale_x, i4_scale_y;
 2976|    720|    WORD32 i4_cntr;
 2977|    720|    WORD32 i4_scale_add_x, i4_scale_add_y;
 2978|    720|    WORD32 i4_curr_lyr_width, i4_curr_lyr_height;
 2979|       |
 2980|    720|    if((NULL == ps_curr_res_prms) || (NULL == ps_ref_res_prms) || (NULL == pi2_offset_x) ||
  ------------------
  |  Branch (2980:8): [True: 0, False: 720]
  |  Branch (2980:38): [True: 0, False: 720]
  |  Branch (2980:67): [True: 0, False: 720]
  ------------------
 2981|    720|       (NULL == pi2_offset_y))
  ------------------
  |  Branch (2981:8): [True: 0, False: 720]
  ------------------
 2982|      0|    {
 2983|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 2984|      0|    }
 2985|       |    /* initial calculation */
 2986|    720|    i4_offset_x = ps_curr_res_prms->s_ref_lyr_scaled_offset.i2_left;
 2987|    720|    i4_offset_y = ps_curr_res_prms->s_ref_lyr_scaled_offset.i2_top;
 2988|       |
 2989|       |    /* get the width and height */
 2990|    720|    i4_scaled_ref_lyr_width = ps_curr_res_prms->u2_scaled_ref_width;
 2991|    720|    i4_scaled_ref_lyr_height = ps_curr_res_prms->u2_scaled_ref_height;
 2992|    720|    i4_ref_lyr_width = ps_ref_res_prms->i4_res_width;
 2993|    720|    i4_ref_lyr_height = ps_ref_res_prms->i4_res_height;
 2994|    720|    i4_curr_lyr_width = ps_curr_res_prms->i4_res_width;
 2995|    720|    i4_curr_lyr_height = ps_curr_res_prms->i4_res_height;
 2996|       |
 2997|       |    /* derive shift x and y based on level idd */
 2998|    720|    if(u1_level_idc <= 30)
  ------------------
  |  Branch (2998:8): [True: 720, False: 0]
  ------------------
 2999|    720|    {
 3000|    720|        i4_shift_x = 16;
 3001|    720|        i4_shift_y = 16;
 3002|    720|    }
 3003|      0|    else
 3004|      0|    {
 3005|      0|        i4_shift_x = 31 - isvcd_get_ceil_log2(i4_ref_lyr_width);
 3006|      0|        i4_shift_y = 31 - isvcd_get_ceil_log2(i4_ref_lyr_height);
 3007|      0|    }
 3008|       |
 3009|       |    /* assert on max ranges of width and shift values */
 3010|    720|    if((i4_ref_lyr_width > H264_MAX_FRAME_WIDTH) ||
  ------------------
  |  |   39|    720|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
  |  Branch (3010:8): [True: 0, False: 720]
  ------------------
 3011|    720|       (i4_scaled_ref_lyr_width > H264_MAX_FRAME_WIDTH) ||
  ------------------
  |  |   39|    720|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
  |  Branch (3011:8): [True: 0, False: 720]
  ------------------
 3012|    720|       (i4_ref_lyr_height > H264_MAX_FRAME_HEIGHT) ||
  ------------------
  |  |   40|    720|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
  |  Branch (3012:8): [True: 0, False: 720]
  ------------------
 3013|    720|       (i4_scaled_ref_lyr_height > H264_MAX_FRAME_HEIGHT) ||
  ------------------
  |  |   40|    720|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
  |  Branch (3013:8): [True: 0, False: 720]
  ------------------
 3014|    720|       (i4_curr_lyr_width > H264_MAX_FRAME_WIDTH) || (i4_curr_lyr_height > H264_MAX_FRAME_HEIGHT))
  ------------------
  |  |   39|    720|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
                     (i4_curr_lyr_width > H264_MAX_FRAME_WIDTH) || (i4_curr_lyr_height > H264_MAX_FRAME_HEIGHT))
  ------------------
  |  |   40|    720|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
  |  Branch (3014:8): [True: 0, False: 720]
  |  Branch (3014:54): [True: 0, False: 720]
  ------------------
 3015|      0|    {
 3016|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 3017|      0|    }
 3018|       |
 3019|       |    /* calculate scale factor x and y */
 3020|    720|    i4_scale_x = (((UWORD32) i4_ref_lyr_width << i4_shift_x) + (i4_scaled_ref_lyr_width >> 1)) /
 3021|    720|                 i4_scaled_ref_lyr_width;
 3022|       |
 3023|    720|    i4_scale_y = (((UWORD32) i4_ref_lyr_height << i4_shift_y) + (i4_scaled_ref_lyr_height >> 1)) /
 3024|    720|                 i4_scaled_ref_lyr_height;
 3025|       |
 3026|       |    /* calcualte the values to be added based on left and top offset */
 3027|    720|    i4_scale_add_x = (1 << (i4_shift_x - 1)) - (i4_offset_x * (WORD32) i4_scale_x);
 3028|    720|    i4_scale_add_y = (1 << (i4_shift_y - 1)) - (i4_offset_y * (WORD32) i4_scale_y);
 3029|       |
 3030|       |    /* derive the projected locations in the reference layer */
 3031|  45.5k|    for(i4_cntr = 0; i4_cntr < i4_curr_lyr_width; i4_cntr++)
  ------------------
  |  Branch (3031:22): [True: 44.8k, False: 720]
  ------------------
 3032|  44.8k|    {
 3033|  44.8k|        WORD32 i4_ref_x;
 3034|  44.8k|        i4_ref_x = (i4_cntr * i4_scale_x + i4_scale_add_x) >> i4_shift_x;
 3035|  44.8k|        *pi2_offset_x++ = (WORD16) i4_ref_x;
 3036|  44.8k|    }
 3037|       |
 3038|       |    /* derive the projected locations in the reference layer */
 3039|   132k|    for(i4_cntr = 0; i4_cntr < i4_curr_lyr_height; i4_cntr++)
  ------------------
  |  Branch (3039:22): [True: 131k, False: 720]
  ------------------
 3040|   131k|    {
 3041|   131k|        WORD32 i4_ref_y;
 3042|   131k|        i4_ref_y = (i4_cntr * i4_scale_y + i4_scale_add_y) >> i4_shift_y;
 3043|   131k|        *pi2_offset_y++ = (WORD16) i4_ref_y;
 3044|   131k|    }
 3045|    720|    return OK;
  ------------------
  |  |  114|    720|#define OK        0
  ------------------
 3046|    720|}
isvcd_comp_mode_mv_res_init:
 3077|  4.09k|{
 3078|       |    /*! Flow of the module is as follows                                   */
 3079|       |    /*! 1. calculates the scale factors for dyadic cases                   */
 3080|       |    /*! 2. calculaets the loop counts and part width and height based on
 3081|       |           dyadic scale factor                                             */
 3082|       |    /*! 2. calculate the MV scale factors                                  */
 3083|       |    /*! 3. initialises the default mv ped structure with deafult values    */
 3084|       |
 3085|  4.09k|    mode_motion_ctxt_t *ps_ctxt;
 3086|  4.09k|    mode_motion_lyr_ctxt *ps_lyr_mem;
 3087|  4.09k|    dec_seq_params_t *ps_sps;
 3088|  4.09k|    svc_dec_lyr_struct_t *ps_svc_lyr_dec = (svc_dec_lyr_struct_t *) pv_svc_dec;
 3089|  4.09k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 3090|  4.09k|    svc_dec_lyr_struct_t *ps_svc_dec_ref_layer;
 3091|  4.09k|    WORD32 ret;
 3092|  4.09k|    WORD32 i4_scaled_ref_lyr_width;
 3093|  4.09k|    WORD32 i4_scaled_ref_lyr_height;
 3094|  4.09k|    WORD32 i4_ref_lyr_width;
 3095|  4.09k|    WORD32 i4_ref_lyr_height;
 3096|  4.09k|    res_prms_t *ps_curr_lyr_res_prms = &ps_svc_lyr_dec->s_res_prms;
 3097|       |
 3098|  4.09k|    ps_svc_dec_ref_layer = ps_svc_lyr_dec->ps_dec_svc_ref_layer;
 3099|  4.09k|    if(NULL == ps_curr_lyr_res_prms)
  ------------------
  |  Branch (3099:8): [True: 0, False: 4.09k]
  ------------------
 3100|      0|    {
 3101|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 3102|      0|    }
 3103|       |
 3104|  4.09k|    ps_ctxt = (mode_motion_ctxt_t *) ps_svc_lyr_dec->pv_mode_mv_sample_ctxt;
 3105|  4.09k|    ps_ctxt->u1_direct_8x8_inference_flag = ps_curr_lyr_res_prms->u1_direct_8x8_inference_flag;
 3106|       |
 3107|       |    /* if called for base resolution store deafult values */
 3108|  4.09k|    if(SVCD_TRUE == ps_svc_lyr_dec->u1_base_res_flag)
  ------------------
  |  |   46|  4.09k|#define SVCD_TRUE 1
  ------------------
  |  Branch (3108:8): [True: 3.37k, False: 720]
  ------------------
 3109|  3.37k|    {
 3110|  3.37k|        ps_ctxt->i4_res_id = -1;
 3111|  3.37k|        ps_ctxt->i4_ref_width = ps_curr_lyr_res_prms->i4_res_width;
 3112|  3.37k|        ps_ctxt->i4_ref_height = ps_curr_lyr_res_prms->i4_res_height;
 3113|  3.37k|        return OK;
  ------------------
  |  |  114|  3.37k|#define OK        0
  ------------------
 3114|  3.37k|    }
 3115|       |
 3116|       |    /* call the function which populates the projected ref locations */
 3117|    720|    ps_sps = ps_dec->ps_cur_sps;
 3118|       |
 3119|       |    /* store the res id appropriately */
 3120|    720|    ps_ctxt->i4_res_id = ps_svc_lyr_dec->u1_layer_id - 1;
 3121|       |
 3122|       |    /* get the current layer ctxt */
 3123|    720|    ps_lyr_mem = &ps_ctxt->as_res_lyr_mem[ps_ctxt->i4_res_id];
 3124|       |
 3125|       |    /* store the current and reference res params to the context */
 3126|    720|    ps_lyr_mem->ps_curr_lyr_res_prms = ps_curr_lyr_res_prms;
 3127|       |
 3128|       |    /* store the reference layer mv bank pointer */
 3129|    720|    ps_lyr_mem->pv_ref_mv_bank_l0 = ps_svc_dec_ref_layer->s_dec.s_cur_pic.ps_mv;
 3130|       |
 3131|       |    /* store the reference layer mb mode pointer */
 3132|    720|    ps_lyr_mem->s_ref_mb_mode.pv_buffer = ps_svc_dec_ref_layer->ps_inter_lyr_mb_prms_frm_start;
 3133|    720|    ps_lyr_mem->s_ref_mb_mode.i4_num_element_stride =
 3134|    720|        ps_svc_dec_ref_layer->u2_inter_lyr_mb_prms_stride;
 3135|    720|    ps_lyr_mem->s_ref_mb_mode.i4_element_size = sizeof(inter_lyr_mb_prms_t);
 3136|       |
 3137|       |    /* check for recomputation of mapping required */
 3138|    720|    if(SVCD_TRUE == ps_curr_lyr_res_prms->u1_remap_req_flag)
  ------------------
  |  |   46|    720|#define SVCD_TRUE 1
  ------------------
  |  Branch (3138:8): [True: 720, False: 0]
  ------------------
 3139|    720|    {
 3140|    720|        res_prms_t s_ref_res_prms = {0};
 3141|       |
 3142|       |        /* store the reference layer resolution width and height */
 3143|    720|        s_ref_res_prms.i4_res_width = ps_ctxt->i4_ref_width;
 3144|    720|        s_ref_res_prms.i4_res_height = ps_ctxt->i4_ref_height;
 3145|       |
 3146|       |        /* call projection map calculation function */
 3147|    720|        ret = isvcd_compute_scaled_offsets(ps_curr_lyr_res_prms, &s_ref_res_prms,
 3148|    720|                                           ps_lyr_mem->pi2_ref_loc_x, ps_lyr_mem->pi2_ref_loc_y,
 3149|    720|                                           ps_sps->u1_level_idc);
 3150|    720|        if(OK != ret)
  ------------------
  |  |  114|    720|#define OK        0
  ------------------
  |  Branch (3150:12): [True: 0, False: 720]
  ------------------
 3151|      0|        {
 3152|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 3153|      0|        }
 3154|       |
 3155|       |        /* derive the scaling variables */
 3156|    720|        ps_lyr_mem->i4_offset_x = ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_left;
 3157|       |
 3158|    720|        ps_lyr_mem->i4_offset_y = ps_curr_lyr_res_prms->s_ref_lyr_scaled_offset.i2_top;
 3159|       |
 3160|       |        /* get the width and heights */
 3161|    720|        i4_scaled_ref_lyr_width = ps_curr_lyr_res_prms->u2_scaled_ref_width;
 3162|    720|        i4_scaled_ref_lyr_height = ps_curr_lyr_res_prms->u2_scaled_ref_height;
 3163|    720|        i4_ref_lyr_width = ps_ctxt->i4_ref_width;
 3164|    720|        i4_ref_lyr_height = ps_ctxt->i4_ref_height;
 3165|       |
 3166|       |        /*store the reference layer width adn height */
 3167|    720|        ps_lyr_mem->i4_ref_width = ps_ctxt->i4_ref_width;
 3168|    720|        ps_lyr_mem->i4_ref_height = ps_ctxt->i4_ref_height;
 3169|       |
 3170|    720|        if((i4_ref_lyr_width > H264_MAX_FRAME_WIDTH) || (i4_ref_lyr_width <= 0)) return NOT_OK;
  ------------------
  |  |   39|    720|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
                      if((i4_ref_lyr_width > H264_MAX_FRAME_WIDTH) || (i4_ref_lyr_width <= 0)) return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (3170:12): [True: 0, False: 720]
  |  Branch (3170:57): [True: 0, False: 720]
  ------------------
 3171|    720|        if((i4_scaled_ref_lyr_width > H264_MAX_FRAME_WIDTH) || (i4_scaled_ref_lyr_width <= 0))
  ------------------
  |  |   39|    720|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
  |  Branch (3171:12): [True: 0, False: 720]
  |  Branch (3171:64): [True: 0, False: 720]
  ------------------
 3172|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 3173|    720|        if((i4_ref_lyr_height > H264_MAX_FRAME_HEIGHT) || (i4_ref_lyr_height <= 0)) return NOT_OK;
  ------------------
  |  |   40|    720|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
                      if((i4_ref_lyr_height > H264_MAX_FRAME_HEIGHT) || (i4_ref_lyr_height <= 0)) return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (3173:12): [True: 0, False: 720]
  |  Branch (3173:59): [True: 0, False: 720]
  ------------------
 3174|    720|        if((i4_scaled_ref_lyr_height > H264_MAX_FRAME_HEIGHT) || (i4_scaled_ref_lyr_height <= 0))
  ------------------
  |  |   40|    720|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
  |  Branch (3174:12): [True: 0, False: 720]
  |  Branch (3174:66): [True: 0, False: 720]
  ------------------
 3175|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 3176|       |
 3177|       |        /* derivation of variables for dyadic cases cropping should be MB aligned */
 3178|       |        /* default values for flags */
 3179|    720|        ps_lyr_mem->pf_inter_lyr_pred = &isvcd_compute_interlyr_motion_mode;
 3180|       |
 3181|    720|        if(SVCD_TRUE == ps_curr_lyr_res_prms->u1_dyadic_flag)
  ------------------
  |  |   46|    720|#define SVCD_TRUE 1
  ------------------
  |  Branch (3181:12): [True: 640, False: 80]
  ------------------
 3182|    640|        {
 3183|    640|            ps_lyr_mem->pf_inter_lyr_pred = &isvcd_interlyr_motion_mode_pred_dyadic;
 3184|    640|        }
 3185|       |
 3186|       |        /* Store the Dyadic flag */
 3187|    720|        ps_lyr_mem->i4_dyadic_flag = ps_curr_lyr_res_prms->u1_dyadic_flag;
 3188|       |
 3189|       |        /* derive the scaling factors for motion upscaling */
 3190|       |        /* this is derived assuming no crop change flag is present */
 3191|    720|        ps_lyr_mem->i4_scale_mv_x =
 3192|    720|            ((i4_scaled_ref_lyr_width << 16) + (i4_ref_lyr_width >> 1)) / i4_ref_lyr_width;
 3193|       |
 3194|    720|        ps_lyr_mem->i4_scale_mv_y =
 3195|    720|            ((i4_scaled_ref_lyr_height << 16) + (i4_ref_lyr_height >> 1)) / i4_ref_lyr_height;
 3196|    720|    }
 3197|      0|    else
 3198|      0|    {
 3199|       |        /* should take false value */
 3200|      0|        if(SVCD_FALSE != ps_curr_lyr_res_prms->u1_remap_req_flag)
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
  |  Branch (3200:12): [True: 0, False: 0]
  ------------------
 3201|      0|        {
 3202|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 3203|      0|        }
 3204|      0|    }
 3205|       |
 3206|       |    /* store the current layer width and height to context */
 3207|    720|    ps_ctxt->i4_ref_width = ps_curr_lyr_res_prms->i4_res_width;
 3208|    720|    ps_ctxt->i4_ref_height = ps_curr_lyr_res_prms->i4_res_height;
 3209|       |
 3210|    720|    return OK;
  ------------------
  |  |  114|    720|#define OK        0
  ------------------
 3211|    720|}

isvcd_nal_buf_reset:
  146|  6.10M|{
  147|  6.10M|    nal_buf_t *ps_nal_buf = pv_nal_buf;
  148|       |
  149|  6.10M|    ps_nal_buf->i4_valid_flag = SVCD_FALSE;
  ------------------
  |  |   45|  6.10M|#define SVCD_FALSE 0
  ------------------
  150|  6.10M|    ps_nal_buf->i4_buf_size = 0;
  151|  6.10M|    ps_nal_buf->u4_max_bits = 0;
  152|       |    ps_nal_buf->pu1_buf = NULL;
  153|  6.10M|}
isvcd_nal_find_start_code:
  184|  3.05M|{
  185|  3.05M|    UWORD8 *pu1_buf = pu1_buf_start + i4_cur_pos;
  186|  3.05M|    WORD32 i4_i;
  187|       |
  188|   133M|    for(i4_i = 0; i4_i < (i4_max_num_bytes - i4_cur_pos); i4_i++)
  ------------------
  |  Branch (188:19): [True: 133M, False: 375]
  ------------------
  189|   133M|    {
  190|       |        /*-------------------------------------------------------------------*/
  191|       |        /* If zero increment the zero byte counter                           */
  192|       |        /*-------------------------------------------------------------------*/
  193|   133M|        if(0 == *pu1_buf)
  ------------------
  |  Branch (193:12): [True: 37.8M, False: 95.8M]
  ------------------
  194|  37.8M|        {
  195|  37.8M|            (*pi4_zero_cnt)++;
  196|  37.8M|        }
  197|       |
  198|       |        /*-------------------------------------------------------------------*/
  199|       |        /* If start code found then increment the byte consumed and return   */
  200|       |        /*-------------------------------------------------------------------*/
  201|  95.8M|        else if(0x01 == *pu1_buf && *pi4_zero_cnt >= NUM_OF_ZERO_BYTES_BEFORE_START_CODE)
  ------------------
  |  |   54|  37.7M|#define NUM_OF_ZERO_BYTES_BEFORE_START_CODE (2)
  ------------------
  |  Branch (201:17): [True: 37.7M, False: 58.1M]
  |  Branch (201:37): [True: 3.05M, False: 34.6M]
  ------------------
  202|  3.05M|        {
  203|  3.05M|            (*pu4_bytes_consumed)++;
  204|  3.05M|            return (SC_FOUND);
  ------------------
  |  |   52|  3.05M|#define SC_FOUND 1
  ------------------
  205|  3.05M|        }
  206|       |        /*-------------------------------------------------------------------*/
  207|       |        /* If non zero byte and value is not equal to 1 a then reset zero    */
  208|       |        /* byte counter                                                      */
  209|       |        /*-------------------------------------------------------------------*/
  210|  92.8M|        else
  211|  92.8M|        {
  212|  92.8M|            *pi4_zero_cnt = 0;
  213|  92.8M|        }
  214|       |
  215|   130M|        (*pu4_bytes_consumed)++;
  216|   130M|        pu1_buf++;
  217|   130M|    }
  218|       |
  219|    375|    return (SC_NOT_FOUND);
  ------------------
  |  |   51|    375|#define SC_NOT_FOUND (-1)
  ------------------
  220|  3.05M|}
isvcd_get_first_start_code:
  248|    157|{
  249|    157|    WORD32 i4_zero_cnt = 0, i4_status;
  250|    157|    UWORD32 u4_bytes_consumed_temp = 0;
  251|       |
  252|    157|    i4_status = isvcd_nal_find_start_code(pu1_stream_buffer, 0, *pu4_num_bytes, &i4_zero_cnt,
  253|    157|                                          &u4_bytes_consumed_temp);
  254|       |
  255|       |    /*-----------------------------------------------------------------------*/
  256|       |    /* If start code is not found then return and start searching for it     */
  257|       |    /* again in the next process call. This process is repeated till we      */
  258|       |    /* get a start code                                                      */
  259|       |    /*-----------------------------------------------------------------------*/
  260|    157|    if(SC_NOT_FOUND == i4_status)
  ------------------
  |  |   51|    157|#define SC_NOT_FOUND (-1)
  ------------------
  |  Branch (260:8): [True: 6, False: 151]
  ------------------
  261|      6|    {
  262|      6|        *pu4_bytes_consumed += u4_bytes_consumed_temp;
  263|      6|        return (i4_status);
  264|      6|    }
  265|    151|    else
  266|    151|    {
  267|       |        /*-------------------------------------------------------------------*/
  268|       |        /* If start code found then proceed with bitstream extraction        */
  269|       |        /*-------------------------------------------------------------------*/
  270|    151|        *pu4_bytes_consumed += u4_bytes_consumed_temp;
  271|    151|        return (i4_status);
  272|    151|    }
  273|    157|}
isvcd_get_annex_b_nal_unit:
  312|  3.05M|{
  313|  3.05M|    nal_unit_t *ps_nal_unit = (nal_unit_t *) pv_nal_unit;
  314|  3.05M|    WORD32 i4_status, i4_nal_start_flag = SVCD_FALSE;
  ------------------
  |  |   45|  3.05M|#define SVCD_FALSE 0
  ------------------
  315|       |
  316|       |    /*-----------------------------------------------------------------------*/
  317|       |    /* Initialization                                                        */
  318|       |    /*-----------------------------------------------------------------------*/
  319|  3.05M|    *pu4_bytes_consumed = 0;
  320|  3.05M|    *pi4_more_data_flag = SVCD_TRUE;
  ------------------
  |  |   46|  3.05M|#define SVCD_TRUE 1
  ------------------
  321|       |
  322|       |    /*------------------------ check ----------------------------------------*/
  323|       |    /* Assumptions is that this fucntion should not be called with this state*/
  324|       |    /* hence it is responsibility of the caller to reset the state after the */
  325|       |    /* NAL_END.                                                              */
  326|       |    /*-----------------------------------------------------------------------*/
  327|  3.05M|    if(NAL_END == *pi4_state)
  ------------------
  |  Branch (327:8): [True: 565, False: 3.05M]
  ------------------
  328|    565|    {
  329|    565|        return i4_nal_start_flag;
  330|    565|    }
  331|       |
  332|       |    /*-----------------------------------------------------------------------*/
  333|       |    /* ps_nal_unit->apu1_bufs[0] is expected to point to start of buffer of  */
  334|       |    /* current NAL unit of the current process call. If a NAL unit is frag-  */
  335|       |    /* -mented across multiple process call then this buffer should point to */
  336|       |    /* start address of buffers. But when start of NAL is present in the     */
  337|       |    /* buffer of current process call then ps_nal_unit->apu1_bufs[0] is      */
  338|       |    /* expected to point to start adress of NAL unit (should be pointing to) */
  339|       |    /* NAL header)                                                           */
  340|       |    /*-----------------------------------------------------------------------*/
  341|  3.05M|    ps_nal_unit->pu1_bufs = pu1_buf_start + i4_cur_pos;
  342|       |
  343|  3.05M|    if(NAL_START == *pi4_state)
  ------------------
  |  Branch (343:8): [True: 3.05M, False: 1]
  ------------------
  344|  3.05M|    {
  345|  3.05M|        if(0 != *pi4_zero_byte_cnt)
  ------------------
  |  Branch (345:12): [True: 0, False: 3.05M]
  ------------------
  346|      0|        {
  347|      0|            return i4_nal_start_flag;
  348|      0|        }
  349|  3.05M|        i4_nal_start_flag = SVCD_TRUE;
  ------------------
  |  |   46|  3.05M|#define SVCD_TRUE 1
  ------------------
  350|  3.05M|        ps_nal_unit->i4_num_bufs = 1;
  351|  3.05M|        ps_nal_unit->i4_buf_sizes = 0;
  352|  3.05M|        *pi4_state = FIND_NAL_END;
  353|  3.05M|    }
  354|       |
  355|  3.05M|    i4_status = isvcd_nal_find_start_code(pu1_buf_start, i4_cur_pos, i4_max_num_bytes,
  356|  3.05M|                                          pi4_zero_byte_cnt, pu4_bytes_consumed);
  357|       |
  358|  3.05M|    if(SC_NOT_FOUND == i4_status)
  ------------------
  |  |   51|  3.05M|#define SC_NOT_FOUND (-1)
  ------------------
  |  Branch (358:8): [True: 369, False: 3.05M]
  ------------------
  359|    369|    {
  360|       |        /*-------------------------------------------------------------------*/
  361|       |        /* If start code is not found then there are 2 possibilities         */
  362|       |        /* 1. We are in the middle of decoding the start code. This means    */
  363|       |        /*    that we might have decoded the one or 2 zeroes of the start    */
  364|       |        /*    code. In such cases, we should not consume these bytes. Though */
  365|       |        /*    doing so we might encounter spurious cases where 0's are not   */
  366|       |        /*    actually corresponds to start code but these will not harm us  */
  367|       |        /* 2. Not of above case. Straightforward one                         */
  368|       |        /*-------------------------------------------------------------------*/
  369|    369|        ps_nal_unit->i4_buf_sizes = *pu4_bytes_consumed;
  370|    369|        *pi4_more_data_flag = SVCD_FALSE;
  ------------------
  |  |   45|    369|#define SVCD_FALSE 0
  ------------------
  371|       |
  372|    369|        return (i4_nal_start_flag);
  373|    369|    }
  374|  3.05M|    else
  375|  3.05M|    {
  376|       |        /*-------------------------------------------------------------------*/
  377|       |        /* If NAL END is found then increment the bytes consumed appropriatly*/
  378|       |        /* reset the zero byte counter                                       */
  379|       |        /*-------------------------------------------------------------------*/
  380|  3.05M|        *pi4_state = NAL_END;
  381|  3.05M|        ps_nal_unit->i4_buf_sizes = *pu4_bytes_consumed - 1;
  382|  3.05M|        *pi4_zero_byte_cnt = 0;
  383|  3.05M|        return (i4_nal_start_flag);
  384|  3.05M|    }
  385|  3.05M|}
isvcd_nal_rbsp_to_sodb:
  413|   103k|{
  414|   103k|    UWORD32 u4_last_word_pos;
  415|   103k|    UWORD32 u4_word, u4_max_bit_offset;
  416|   103k|    UWORD8 i4_num_bits;
  417|   103k|    WORD32 i4_i;
  418|   103k|    WORD64 i8_nal_len;
  419|   103k|    UWORD32 *pu4_buf;
  420|       |
  421|   103k|    if(0 >= i4_nal_len_in_bytes)
  ------------------
  |  Branch (421:8): [True: 355, False: 103k]
  ------------------
  422|    355|    {
  423|    355|        return (0);
  424|    355|    }
  425|       |
  426|       |    /* Get offset in bits */
  427|   103k|    i8_nal_len = (WORD64) i4_nal_len_in_bytes << 3;
  428|   103k|    u4_max_bit_offset = (UWORD32) i8_nal_len;
  429|       |
  430|       |    /* If NAL is coded in CABAC then SODB */
  431|       |    /* length has to account for CABAC    */
  432|       |    /* ZERO WORDS also                    */
  433|   103k|    if(1 == u1_ecd_mode)
  ------------------
  |  Branch (433:8): [True: 5.73k, False: 97.5k]
  ------------------
  434|  5.73k|    {
  435|  5.73k|        return (u4_max_bit_offset);
  436|  5.73k|    }
  437|       |
  438|       |    /* Calculate the position of last word */
  439|  97.5k|    u4_last_word_pos = i4_nal_len_in_bytes >> 2;
  440|       |
  441|       |    /* Load the last word                 */
  442|  97.5k|    i4_i = i4_nal_len_in_bytes & 0x03;
  443|  97.5k|    if(0 != i4_i)
  ------------------
  |  Branch (443:8): [True: 46.7k, False: 50.7k]
  ------------------
  444|  46.7k|    {
  445|  46.7k|        pu4_buf = (UWORD32 *) pu1_buf;
  446|  46.7k|        pu4_buf += u4_last_word_pos;
  447|  46.7k|        u4_word = *pu4_buf;
  448|  46.7k|        i4_num_bits = i4_i << 3;
  449|  46.7k|        u4_word >>= (32 - i4_num_bits);
  450|  46.7k|    }
  451|  50.7k|    else
  452|  50.7k|    {
  453|  50.7k|        pu4_buf = (UWORD32 *) pu1_buf;
  454|  50.7k|        pu4_buf += (u4_last_word_pos - 1);
  455|  50.7k|        u4_word = *pu4_buf;
  456|  50.7k|        i4_num_bits = 32;
  457|  50.7k|    }
  458|       |
  459|       |    /* Search for RBSP stop bit          */
  460|  97.5k|    do
  461|   311k|    {
  462|  7.70M|        for(i4_i = 0; (i4_i < i4_num_bits) && !CHECKBIT(u4_word, i4_i); i4_i++)
  ------------------
  |  |   54|  7.48M|#define CHECKBIT(a,i) ((a) &  (1 << i))
  ------------------
  |  Branch (462:23): [True: 7.48M, False: 213k]
  |  Branch (462:47): [True: 7.38M, False: 97.5k]
  ------------------
  463|  7.38M|            ;
  464|       |
  465|   311k|        u4_max_bit_offset -= i4_i;
  466|       |
  467|       |        /* RBSP stop bit is found then   */
  468|       |        /* come out of the loop          */
  469|   311k|        if(0 != CHECKBIT(u4_word, i4_i))
  ------------------
  |  |   54|   311k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  ------------------
  |  Branch (469:12): [True: 97.5k, False: 213k]
  ------------------
  470|  97.5k|        {
  471|       |            /* Remove RBSP stop bit */
  472|  97.5k|            u4_max_bit_offset -= 1;
  473|  97.5k|            break;
  474|  97.5k|        }
  475|       |
  476|   213k|        pu4_buf -= 1;
  477|   213k|        u4_word = *pu4_buf;
  478|   213k|        i4_num_bits = 32;
  479|   213k|    } while(u4_max_bit_offset > 0);
  ------------------
  |  Branch (479:13): [True: 213k, False: 20]
  ------------------
  480|       |
  481|  97.5k|    return (u4_max_bit_offset);
  482|   103k|}
isvcd_reset_emulation_ctxt:
  510|  3.07M|{
  511|  3.07M|    emulation_prevent_ctxt_t *ps_emulation_ctxt = (emulation_prevent_ctxt_t *) pv_emulation_ctxt;
  512|       |
  513|       |    /*! Reset the emulation prevention context */
  514|  3.07M|    ps_emulation_ctxt->i4_state = NOT_STUFFED_BYTE;
  515|  3.07M|    ps_emulation_ctxt->i4_zeroes_cnt = 0;
  516|  3.07M|    ps_emulation_ctxt->u4_bytes_in_word = 0;
  517|  3.07M|    ps_emulation_ctxt->u4_word = 0;
  518|  3.07M|}
isvcd_nal_byte_swap_emulation:
  564|  3.03M|{
  565|  3.03M|    UWORD32 u4_i, u4_num_bytes, u4_offset;
  566|  3.03M|    UWORD8 u1_cur_byte;
  567|  3.03M|    emulation_prevent_ctxt_t *ps_emulation_ctxt = (emulation_prevent_ctxt_t *) pv_emulation_ctxt;
  568|       |
  569|  3.03M|    u4_offset = ps_emulation_ctxt->u4_bytes_in_word;
  570|  3.03M|    u4_num_bytes = ps_emulation_ctxt->u4_bytes_in_word;
  571|       |
  572|  60.7M|    for(u4_i = 0; u4_i < u4_in_len; u4_i++)
  ------------------
  |  Branch (572:19): [True: 57.6M, False: 3.03M]
  ------------------
  573|  57.6M|    {
  574|  57.6M|        UWORD8 u1_cur_byte_emu, u1_cur_byte_sc;
  575|  57.6M|        UWORD64 u8_sft_word;
  576|       |
  577|  57.6M|        u1_cur_byte = *pu1_in_stream++;
  578|  57.6M|        u1_cur_byte_emu = (EMULATION_PREVENTION_BYTE == u1_cur_byte);
  ------------------
  |  |   57|  57.6M|#define EMULATION_PREVENTION_BYTE (0x03)
  ------------------
  579|  57.6M|        u1_cur_byte_sc = (START_CODE_BYTE == u1_cur_byte);
  ------------------
  |  |   55|  57.6M|#define START_CODE_BYTE (0x01)
  ------------------
  580|       |
  581|  57.6M|        if((ps_emulation_ctxt->i4_zeroes_cnt >= i4_0s_bfr_sc) & (u1_cur_byte_emu | u1_cur_byte_sc) &
  ------------------
  |  Branch (581:12): [True: 5.72k, False: 57.6M]
  ------------------
  582|  57.6M|           (NOT_STUFFED_BYTE == ps_emulation_ctxt->i4_state))
  583|  5.72k|        {
  584|  5.72k|            if(u1_cur_byte_sc)
  ------------------
  |  Branch (584:16): [True: 3.55k, False: 2.17k]
  ------------------
  585|  3.55k|            {
  586|  3.55k|                break;
  587|  3.55k|            }
  588|  2.17k|            ps_emulation_ctxt->i4_zeroes_cnt = 0;
  589|  2.17k|            ps_emulation_ctxt->i4_state = STUFFED_BYTE;
  590|  2.17k|            continue;
  591|  5.72k|        }
  592|       |
  593|  57.6M|        u8_sft_word = (UWORD64) ps_emulation_ctxt->u4_word << 8;
  594|  57.6M|        ps_emulation_ctxt->u4_word = (UWORD32) (u8_sft_word | u1_cur_byte);
  595|  57.6M|        ps_emulation_ctxt->u4_bytes_in_word++;
  596|  57.6M|        u4_num_bytes++;
  597|  57.6M|        ps_emulation_ctxt->i4_zeroes_cnt++;
  598|  57.6M|        if(u1_cur_byte != 0x00)
  ------------------
  |  Branch (598:12): [True: 33.0M, False: 24.6M]
  ------------------
  599|  33.0M|        {
  600|  33.0M|            ps_emulation_ctxt->i4_zeroes_cnt = 0;
  601|  33.0M|        }
  602|       |
  603|  57.6M|        if((u4_num_bytes & 0x03) == 0x00)
  ------------------
  |  Branch (603:12): [True: 13.6M, False: 44.0M]
  ------------------
  604|  13.6M|        {
  605|  13.6M|            *pu4_out_stream = ps_emulation_ctxt->u4_word;
  606|  13.6M|            ps_emulation_ctxt->u4_bytes_in_word = 0;
  607|  13.6M|            pu4_out_stream++;
  608|  13.6M|        }
  609|       |
  610|  57.6M|        ps_emulation_ctxt->i4_state = NOT_STUFFED_BYTE;
  611|  57.6M|    }
  612|       |
  613|  3.03M|    if(ps_emulation_ctxt->u4_bytes_in_word)
  ------------------
  |  Branch (613:8): [True: 2.99M, False: 47.0k]
  ------------------
  614|  2.99M|    {
  615|  2.99M|        UWORD64 temp_out_stream = (UWORD64) ps_emulation_ctxt->u4_word
  616|  2.99M|                                  << ((4 - ps_emulation_ctxt->u4_bytes_in_word) << 3);
  617|  2.99M|        *pu4_out_stream = (UWORD32) temp_out_stream;
  618|  2.99M|    }
  619|       |
  620|  3.03M|    *pu4_out_len = (u4_num_bytes - u4_offset);
  621|  3.03M|    return ((u4_num_bytes & 0xFFFFFFFC));
  622|  3.03M|}
isvcd_set_default_nal_prms:
  650|  3.06M|{
  651|  3.06M|    nal_prms_t *ps_nal_prms;
  652|  3.06M|    ps_nal_prms = (nal_prms_t *) pv_nal_prms;
  653|       |
  654|       |    /* Set default values */
  655|  3.06M|    ps_nal_prms->i4_dependency_id = 0;
  656|  3.06M|    ps_nal_prms->i4_derived_nal_type = 0xFF;
  657|  3.06M|    ps_nal_prms->i4_idr_pic_flag = SVCD_FALSE;
  ------------------
  |  |   45|  3.06M|#define SVCD_FALSE 0
  ------------------
  658|  3.06M|    ps_nal_prms->i4_nal_header_len = 0;
  659|  3.06M|    ps_nal_prms->i4_nal_ref_idc = 0xFF;
  660|  3.06M|    ps_nal_prms->i4_nal_unit_type = 0xFF;
  661|  3.06M|    ps_nal_prms->i4_no_int_lyr_pred = 1;
  662|  3.06M|    ps_nal_prms->i4_priority_id = 0;
  663|  3.06M|    ps_nal_prms->i4_quality_id = 0;
  664|  3.06M|    ps_nal_prms->i4_discard_flag = 0;
  665|  3.06M|    ps_nal_prms->i4_dqid = 0;
  666|  3.06M|    ps_nal_prms->i4_use_ref_base_pic_flag = 0;
  667|  3.06M|    ps_nal_prms->i4_temporal_id = 0;
  668|  3.06M|    ps_nal_prms->i4_idr_pic_num = 0;
  669|  3.06M|    ps_nal_prms->u2_frm_num = 0;
  670|  3.06M|    ps_nal_prms->i4_poc_lsb = 0;
  671|  3.06M|    ps_nal_prms->i4_delta_poc_bot = 0;
  672|  3.06M|    ps_nal_prms->ai4_delta_poc[0] = 0;
  673|  3.06M|    ps_nal_prms->ai4_delta_poc[1] = 0;
  674|  3.06M|    ps_nal_prms->u1_pps_id = 0;
  675|  3.06M|}
isvcd_dec_nal_hdr:
  705|  3.06M|{
  706|  3.06M|    nal_prms_t *ps_nal_prms;
  707|  3.06M|    nal_prms_t *ps_prefix_nal_prms;
  708|  3.06M|    nal_buf_t *ps_prefix_nal_buf;
  709|  3.06M|    dec_bit_stream_t s_stream_ctxt = {0};
  710|  3.06M|    WORD32 i4_forbidden_zero_bit;
  711|       |
  712|       |    /* byte swapping */
  713|  3.06M|    UWORD8 *pu1_buf = (UWORD8 *) pv_nal_header_buf;
  714|  3.06M|    UWORD8 *pu1_src = (UWORD8 *) pv_buf_ptr;
  715|       |
  716|  3.06M|    ps_nal_prms = (nal_prms_t *) pv_nal_prms;
  717|  3.06M|    ps_prefix_nal_prms = (nal_prms_t *) pv_prefix_nal_prms;
  718|  3.06M|    ps_prefix_nal_buf = (nal_buf_t *) pv_prefix_nal_buf;
  719|       |
  720|       |    /* The NAL header syntax elements are read through bitstream fucntions.  */
  721|       |    /* Hence bitstream context structure initializaton is needed before      */
  722|       |    /* parsing from the bitstream                                            */
  723|       |    /* Also bitstream fucntions assume the buffer is byteswapped. Hence the  */
  724|       |    /* byte swapping is also done for 4 bytes                                */
  725|  3.06M|    s_stream_ctxt.u4_ofst = 0;
  726|  3.06M|    s_stream_ctxt.pu4_buffer = pv_nal_header_buf;
  727|  3.06M|    s_stream_ctxt.u4_max_ofst = (i4_buf_size << 3);
  728|       |
  729|  3.06M|    *pu4_err_code = 0;
  730|       |
  731|       |    /* Check the size of bitstream buffer */
  732|  3.06M|    if(s_stream_ctxt.u4_max_ofst < 8)
  ------------------
  |  Branch (732:8): [True: 4, False: 3.06M]
  ------------------
  733|      4|    {
  734|      4|        *pu4_err_code = (UWORD32) NAL_INSUFFICIENT_DATA;
  735|      4|        return;
  736|      4|    }
  737|       |
  738|  3.06M|    if(s_stream_ctxt.u4_max_ofst >= 32)
  ------------------
  |  Branch (738:8): [True: 193k, False: 2.86M]
  ------------------
  739|   193k|    {
  740|   193k|        *pu1_buf++ = *(pu1_src + 3);
  741|   193k|        *pu1_buf++ = *(pu1_src + 2);
  742|   193k|        *pu1_buf++ = *(pu1_src + 1);
  743|   193k|        *pu1_buf++ = *pu1_src;
  744|   193k|    }
  745|  2.86M|    else
  746|  2.86M|    {
  747|  2.86M|        *pu1_buf++ = *pu1_src;
  748|  2.86M|    }
  749|       |
  750|       |    /*-----------------------------------------------------------------------*/
  751|       |    /*! Parse the NAL header and update the NAL header structure members     */
  752|       |    /*-----------------------------------------------------------------------*/
  753|       |    /* Read forbidden 0 bit */
  754|  3.06M|    i4_forbidden_zero_bit = ih264d_get_bit_h264(&s_stream_ctxt);
  755|       |
  756|  3.06M|    if(0 != i4_forbidden_zero_bit)
  ------------------
  |  Branch (756:8): [True: 24.9k, False: 3.03M]
  ------------------
  757|  24.9k|    {
  758|  24.9k|        *pu4_err_code = (UWORD32) NAL_CORRUPT_DATA;
  759|  24.9k|        return;
  760|  24.9k|    }
  761|       |
  762|       |    /*---------------- Read NAL ref idc -----------------------------*/
  763|  3.03M|    ps_nal_prms->i4_nal_ref_idc = ih264d_get_bits_h264(&s_stream_ctxt, 2);
  764|       |
  765|       |    /*----------------- Read NAL type -------------------------------*/
  766|  3.03M|    ps_nal_prms->i4_nal_unit_type = ih264d_get_bits_h264(&s_stream_ctxt, 5);
  767|  3.03M|    if(ps_nal_prms->i4_nal_unit_type > CODED_SLICE_EXTENSION_NAL)
  ------------------
  |  |   66|  3.03M|#define CODED_SLICE_EXTENSION_NAL 20
  ------------------
  |  Branch (767:8): [True: 2.40k, False: 3.03M]
  ------------------
  768|  2.40k|    {
  769|  2.40k|        *pu4_err_code = (UWORD32) NAL_CORRUPT_DATA;
  770|  2.40k|        return;
  771|  2.40k|    }
  772|  3.03M|    if(ACCESS_UNIT_DELIMITER_RBSP == ps_nal_prms->i4_nal_unit_type)
  ------------------
  |  |  332|  3.03M|#define ACCESS_UNIT_DELIMITER_RBSP      9
  ------------------
  |  Branch (772:8): [True: 203, False: 3.03M]
  ------------------
  773|    203|    {
  774|    203|        ps_nal_prms->i4_derived_nal_type = NON_VCL_NAL;
  775|    203|        return;
  776|    203|    }
  777|       |
  778|       |    /* set idr pic flag */
  779|  3.03M|    if(IDR_SLICE_NAL == ps_nal_prms->i4_nal_unit_type)
  ------------------
  |  |  328|  3.03M|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (779:8): [True: 13.8k, False: 3.01M]
  ------------------
  780|  13.8k|    {
  781|  13.8k|        ps_nal_prms->i4_idr_pic_flag = SVCD_TRUE;
  ------------------
  |  |   46|  13.8k|#define SVCD_TRUE 1
  ------------------
  782|  13.8k|    }
  783|  3.01M|    else
  784|  3.01M|    {
  785|  3.01M|        ps_nal_prms->i4_idr_pic_flag = SVCD_FALSE;
  ------------------
  |  |   45|  3.01M|#define SVCD_FALSE 0
  ------------------
  786|  3.01M|    }
  787|       |
  788|       |    /*----------------- Read SVC extension NAL header ---------------*/
  789|  3.03M|    if(CODED_SLICE_EXTENSION_NAL == ps_nal_prms->i4_nal_unit_type ||
  ------------------
  |  |   66|  3.03M|#define CODED_SLICE_EXTENSION_NAL 20
  ------------------
  |  Branch (789:8): [True: 5.44k, False: 3.02M]
  ------------------
  790|  3.02M|       PREFIX_UNIT_NAL == ps_nal_prms->i4_nal_unit_type)
  ------------------
  |  |   64|  3.02M|#define PREFIX_UNIT_NAL 14
  ------------------
  |  Branch (790:8): [True: 731, False: 3.02M]
  ------------------
  791|  6.17k|    {
  792|  6.17k|        WORD32 i4_svc_extension_flag, i4_idr_flag;
  793|       |
  794|       |        /* check the size of the buffer */
  795|  6.17k|        if(s_stream_ctxt.u4_max_ofst < 32)
  ------------------
  |  Branch (795:12): [True: 788, False: 5.38k]
  ------------------
  796|    788|        {
  797|    788|            *pu4_err_code = (UWORD32) NAL_INSUFFICIENT_DATA;
  798|    788|            return;
  799|    788|        }
  800|       |
  801|  5.38k|        i4_svc_extension_flag = ih264d_get_bit_h264(&s_stream_ctxt);
  802|  5.38k|        UNUSED(i4_svc_extension_flag);
  ------------------
  |  |   45|  5.38k|#define UNUSED(x) ((void)(x))
  ------------------
  803|       |
  804|  5.38k|        i4_idr_flag = ih264d_get_bit_h264(&s_stream_ctxt);
  805|       |
  806|       |        /* Set idr pic flag based on idr flag */
  807|  5.38k|        if(1 == i4_idr_flag)
  ------------------
  |  Branch (807:12): [True: 4.73k, False: 652]
  ------------------
  808|  4.73k|        {
  809|  4.73k|            ps_nal_prms->i4_idr_pic_flag = SVCD_TRUE;
  ------------------
  |  |   46|  4.73k|#define SVCD_TRUE 1
  ------------------
  810|  4.73k|        }
  811|    652|        else
  812|    652|        {
  813|    652|            ps_nal_prms->i4_idr_pic_flag = SVCD_FALSE;
  ------------------
  |  |   45|    652|#define SVCD_FALSE 0
  ------------------
  814|    652|        }
  815|       |
  816|       |        /* parse priorit id */
  817|  5.38k|        ps_nal_prms->i4_priority_id = ih264d_get_bits_h264(&s_stream_ctxt, 6);
  818|       |
  819|       |        /* parse the no inter layer prediction flag */
  820|  5.38k|        ps_nal_prms->i4_no_int_lyr_pred = ih264d_get_bit_h264(&s_stream_ctxt);
  821|       |
  822|       |        /* parse dependency id */
  823|  5.38k|        ps_nal_prms->i4_dependency_id = ih264d_get_bits_h264(&s_stream_ctxt, 3);
  824|       |
  825|       |        /* parse quality id */
  826|  5.38k|        ps_nal_prms->i4_quality_id = ih264d_get_bits_h264(&s_stream_ctxt, 4);
  827|       |
  828|  5.38k|        if((ps_nal_prms->i4_quality_id > 0) || (ps_nal_prms->i4_dependency_id > 2))
  ------------------
  |  Branch (828:12): [True: 350, False: 5.03k]
  |  Branch (828:48): [True: 135, False: 4.89k]
  ------------------
  829|    485|        {
  830|    485|            *pu4_err_code = (UWORD32) NAL_CORRUPT_DATA;
  831|    485|            return;
  832|    485|        }
  833|       |        /* parse temporal id */
  834|  4.89k|        ps_nal_prms->i4_temporal_id = ih264d_get_bits_h264(&s_stream_ctxt, 3);
  835|       |
  836|       |        /* parse use ref base pic flag */
  837|  4.89k|        ps_nal_prms->i4_use_ref_base_pic_flag = ih264d_get_bit_h264(&s_stream_ctxt);
  838|       |
  839|  4.89k|        if(0 != ps_nal_prms->i4_use_ref_base_pic_flag)
  ------------------
  |  Branch (839:12): [True: 62, False: 4.83k]
  ------------------
  840|     62|        {
  841|     62|            *pu4_err_code = (UWORD32) NAL_CORRUPT_DATA;
  842|     62|            return;
  843|     62|        }
  844|       |        /* parse discrad flag */
  845|  4.83k|        ps_nal_prms->i4_discard_flag = ih264d_get_bit_h264(&s_stream_ctxt);
  846|       |
  847|       |        /* parse the reserved bits */
  848|  4.83k|        ih264d_get_bits_h264(&s_stream_ctxt, 3);
  849|  4.83k|    }
  850|       |
  851|       |    /* update NAL hedaer length in bytes */
  852|  3.03M|    ps_nal_prms->i4_nal_header_len = s_stream_ctxt.u4_ofst >> 3;
  853|       |
  854|       |    /*************************************************************************/
  855|       |    /* PREFIX NAL UNIT ASSOCIATION WITH ASSOCIATED NAL UNIT                  */
  856|       |    /*************************************************************************/
  857|       |
  858|       |    /* if current NAL is not a AVC NAL unit then */
  859|       |    /* discard the prefix NAL unit if present    */
  860|  3.03M|    if(CODED_SLICE_EXTENSION_NAL == ps_nal_prms->i4_nal_unit_type)
  ------------------
  |  |   66|  3.03M|#define CODED_SLICE_EXTENSION_NAL 20
  ------------------
  |  Branch (860:8): [True: 4.72k, False: 3.02M]
  ------------------
  861|  4.72k|    {
  862|  4.72k|        isvcd_nal_buf_reset(ps_prefix_nal_buf);
  863|  4.72k|    }
  864|       |
  865|  3.03M|    if(SVCD_TRUE == ps_prefix_nal_buf->i4_valid_flag)
  ------------------
  |  |   46|  3.03M|#define SVCD_TRUE 1
  ------------------
  |  Branch (865:8): [True: 105, False: 3.03M]
  ------------------
  866|    105|    {
  867|       |        /* Copy the required parameters from the prefix NAL unit */
  868|    105|        ps_nal_prms->i4_dependency_id = ps_prefix_nal_prms->i4_dependency_id;
  869|    105|        ps_nal_prms->i4_quality_id = ps_prefix_nal_prms->i4_quality_id;
  870|    105|        ps_nal_prms->i4_priority_id = ps_prefix_nal_prms->i4_priority_id;
  871|    105|        ps_nal_prms->i4_temporal_id = ps_prefix_nal_prms->i4_temporal_id;
  872|    105|        ps_nal_prms->i4_no_int_lyr_pred = ps_prefix_nal_prms->i4_no_int_lyr_pred;
  873|    105|        ps_nal_prms->i4_use_ref_base_pic_flag = ps_prefix_nal_prms->i4_use_ref_base_pic_flag;
  874|    105|        ps_nal_prms->i4_discard_flag = ps_prefix_nal_prms->i4_discard_flag;
  875|    105|    }
  876|       |
  877|       |    /*-----------------------------------------------------------------------*/
  878|       |    /* Set the derived NAL unit type and also update the DQID for VCL NAL    */
  879|       |    /*  units                                                                */
  880|       |    /*-----------------------------------------------------------------------*/
  881|  3.03M|    if(CODED_SLICE_EXTENSION_NAL == ps_nal_prms->i4_nal_unit_type ||
  ------------------
  |  |   66|  3.03M|#define CODED_SLICE_EXTENSION_NAL 20
  ------------------
  |  Branch (881:8): [True: 4.72k, False: 3.02M]
  ------------------
  882|  3.02M|       SLICE_NAL == ps_nal_prms->i4_nal_unit_type ||
  ------------------
  |  |  324|  3.02M|#define SLICE_NAL                       1
  ------------------
  |  Branch (882:8): [True: 6.20k, False: 3.02M]
  ------------------
  883|  3.02M|       IDR_SLICE_NAL == ps_nal_prms->i4_nal_unit_type ||
  ------------------
  |  |  328|  3.02M|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (883:8): [True: 13.8k, False: 3.00M]
  ------------------
  884|  3.00M|       PREFIX_UNIT_NAL == ps_nal_prms->i4_nal_unit_type)
  ------------------
  |  |   64|  3.00M|#define PREFIX_UNIT_NAL 14
  ------------------
  |  Branch (884:8): [True: 116, False: 3.00M]
  ------------------
  885|  24.8k|    {
  886|  24.8k|        ps_nal_prms->i4_derived_nal_type = VCL_NAL;
  887|       |
  888|       |        /* calculate the DQID and modified DQID */
  889|  24.8k|        ps_nal_prms->i4_dqid = (ps_nal_prms->i4_dependency_id << 4) + ps_nal_prms->i4_quality_id;
  890|  24.8k|    }
  891|  3.00M|    else
  892|  3.00M|    {
  893|  3.00M|        ps_nal_prms->i4_derived_nal_type = NON_VCL_NAL;
  894|  3.00M|    }
  895|  3.03M|}
isvcd_parse_part_slice_hdr:
  928|  22.8k|{
  929|  22.8k|    UWORD32 u4_slice_type;
  930|  22.8k|    dec_seq_params_t *ps_sps = (dec_seq_params_t *) pv_sps;
  931|  22.8k|    dec_pic_params_t *ps_pps = (dec_pic_params_t *) pv_pps;
  932|  22.8k|    dec_bit_stream_t s_stream_ctxt = {0};
  933|  22.8k|    dec_bit_stream_t *ps_stream_ctxt;
  934|  22.8k|    UWORD32 *pu4_bitstrm_buf;
  935|  22.8k|    UWORD32 *pu4_bitstrm_ofst;
  936|       |
  937|  22.8k|    *pi4_sps_pps_status = NAL_CORRUPT_DATA;
  938|       |    /* Perform the emulation prevention and byte swap */
  939|  22.8k|    {
  940|  22.8k|        emulation_prevent_ctxt_t s_emulation_ctxt = {0};
  941|  22.8k|        WORD32 i4_size, i4_temp;
  942|       |
  943|  22.8k|        isvcd_reset_emulation_ctxt((void *) &s_emulation_ctxt);
  944|  22.8k|        i4_size = MIN(i4_input_buf_size, HEADER_BUFFER_LEN_BEFORE_EP);
  ------------------
  |  |   61|  22.8k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 12.3k, False: 10.4k]
  |  |  ------------------
  ------------------
  945|       |
  946|  22.8k|        isvcd_nal_byte_swap_emulation((UWORD32 *) pu1_temp_buf, (UWORD32 *) &i4_temp, pu1_input_buf,
  947|  22.8k|                                      (UWORD32) i4_size, NUM_OF_ZERO_BYTES_BEFORE_START_CODE,
  ------------------
  |  |   54|  22.8k|#define NUM_OF_ZERO_BYTES_BEFORE_START_CODE (2)
  ------------------
  948|  22.8k|                                      &s_emulation_ctxt);
  949|       |
  950|       |        /* Initialize the stream context structure */
  951|  22.8k|        s_stream_ctxt.pu4_buffer = (UWORD32 *) pu1_temp_buf;
  952|  22.8k|        s_stream_ctxt.u4_ofst = 0;
  953|  22.8k|        s_stream_ctxt.u4_max_ofst = (i4_size << 3);
  954|  22.8k|    }
  955|       |
  956|  22.8k|    ps_stream_ctxt = &s_stream_ctxt;
  957|       |
  958|       |    /* Parse the first mb address in slice */
  959|  22.8k|    pu4_bitstrm_buf = ps_stream_ctxt->pu4_buffer;
  960|  22.8k|    pu4_bitstrm_ofst = &ps_stream_ctxt->u4_ofst;
  961|  22.8k|    ps_nal_prms->u4_first_mb_addr = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  962|  22.8k|    if(ps_nal_prms->u4_first_mb_addr >= (MAX_MBS_LEVEL_51))
  ------------------
  |  |  307|  22.8k|#define MAX_MBS_LEVEL_51 36864
  ------------------
  |  Branch (962:8): [True: 197, False: 22.6k]
  ------------------
  963|    197|    {
  964|    197|        return ERROR_CORRUPTED_SLICE;
  965|    197|    }
  966|       |    /* Parse slice type */
  967|  22.6k|    u4_slice_type = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  968|       |
  969|  22.6k|    if(u4_slice_type > 9) return ERROR_INV_SLC_TYPE_T;
  ------------------
  |  Branch (969:8): [True: 1.26k, False: 21.3k]
  ------------------
  970|       |
  971|       |    /* Check the validity of slice prms */
  972|  21.3k|    switch(u4_slice_type)
  973|  21.3k|    {
  974|  11.2k|        case 0:
  ------------------
  |  Branch (974:9): [True: 11.2k, False: 10.1k]
  ------------------
  975|  11.3k|        case 5:
  ------------------
  |  Branch (975:9): [True: 110, False: 21.2k]
  ------------------
  976|  11.3k|            u4_slice_type = P_SLICE;
  ------------------
  |  |  368|  11.3k|#define P_SLICE  0
  ------------------
  977|       |            /* P slice */
  978|  11.3k|            break;
  979|  6.54k|        case 1:
  ------------------
  |  Branch (979:9): [True: 6.54k, False: 14.8k]
  ------------------
  980|  6.64k|        case 6:
  ------------------
  |  Branch (980:9): [True: 102, False: 21.2k]
  ------------------
  981|  6.64k|            u4_slice_type = B_SLICE;
  ------------------
  |  |  369|  6.64k|#define B_SLICE  1
  ------------------
  982|       |            /* B slice */
  983|  6.64k|            break;
  984|  2.87k|        case 2:
  ------------------
  |  Branch (984:9): [True: 2.87k, False: 18.4k]
  ------------------
  985|  2.89k|        case 7:
  ------------------
  |  Branch (985:9): [True: 23, False: 21.3k]
  ------------------
  986|       |            /* I slice */
  987|  2.89k|            u4_slice_type = I_SLICE;
  ------------------
  |  |  370|  2.89k|#define I_SLICE  2
  ------------------
  988|  2.89k|            break;
  989|    500|        default:
  ------------------
  |  Branch (989:9): [True: 500, False: 20.8k]
  ------------------
  990|    500|            break;
  991|  21.3k|    }
  992|       |
  993|       |    /* Parse the pps id */
  994|  21.3k|    ps_nal_prms->u1_pps_id = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  995|  21.3k|    if(ps_nal_prms->u1_pps_id & MASK_ERR_PIC_SET_ID) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  |  527|  21.3k|#define MASK_ERR_PIC_SET_ID   (0xFFFFFF00)
  ------------------
  |  Branch (995:8): [True: 0, False: 21.3k]
  ------------------
  996|       |
  997|       |    /* validate pps id */
  998|  21.3k|    ps_pps += ps_nal_prms->u1_pps_id;
  999|  21.3k|    if(0 == ps_pps->u1_is_valid)
  ------------------
  |  Branch (999:8): [True: 4.36k, False: 16.9k]
  ------------------
 1000|  4.36k|    {
 1001|  4.36k|        return NOT_OK;
  ------------------
  |  |  116|  4.36k|#define NOT_OK    -1
  ------------------
 1002|  4.36k|    }
 1003|       |    /* Derive sps id */
 1004|  16.9k|    ps_sps = ps_pps->ps_sps;
 1005|       |
 1006|  16.9k|    ps_nal_prms->u1_sps_id = ps_sps->u1_seq_parameter_set_id;
 1007|  16.9k|    if(CODED_SLICE_EXTENSION_NAL == ps_nal_prms->i4_nal_unit_type)
  ------------------
  |  |   66|  16.9k|#define CODED_SLICE_EXTENSION_NAL 20
  ------------------
  |  Branch (1007:8): [True: 3.13k, False: 13.8k]
  ------------------
 1008|  3.13k|    {
 1009|  3.13k|        ps_sps += MAX_NUM_SEQ_PARAMS;
  ------------------
  |  |  521|  3.13k|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
 1010|  3.13k|        ps_nal_prms->u1_sps_id = ps_sps->u1_seq_parameter_set_id;
 1011|  3.13k|        ps_nal_prms->u1_sps_id += MAX_NUM_SEQ_PARAMS;
  ------------------
  |  |  521|  3.13k|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
 1012|  3.13k|    }
 1013|       |
 1014|  16.9k|    if(NULL == ps_sps)
  ------------------
  |  Branch (1014:8): [True: 0, False: 16.9k]
  ------------------
 1015|      0|    {
 1016|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1017|      0|    }
 1018|  16.9k|    if(FALSE == ps_sps->u1_is_valid)
  ------------------
  |  |  592|  16.9k|#define FALSE   0
  ------------------
  |  Branch (1018:8): [True: 422, False: 16.5k]
  ------------------
 1019|    422|    {
 1020|    422|        return ERROR_INV_SLICE_HDR_T;
 1021|    422|    }
 1022|  16.5k|    if(ps_nal_prms->u4_first_mb_addr > (ps_sps->u2_frm_ht_in_mbs * ps_sps->u2_frm_wd_in_mbs))
  ------------------
  |  Branch (1022:8): [True: 60, False: 16.5k]
  ------------------
 1023|     60|    {
 1024|     60|        return ERROR_CORRUPTED_SLICE;
 1025|     60|    }
 1026|  16.5k|    *pi4_sps_pps_status = 0;
 1027|       |
 1028|       |    /* Parse frame number */
 1029|  16.5k|    ps_nal_prms->u2_frm_num = ih264d_get_bits_h264(ps_stream_ctxt, ps_sps->u1_bits_in_frm_num);
 1030|       |
 1031|       |    /* IDR picture number */
 1032|  16.5k|    if(SVCD_TRUE == ps_nal_prms->i4_idr_pic_flag)
  ------------------
  |  |   46|  16.5k|#define SVCD_TRUE 1
  ------------------
  |  Branch (1032:8): [True: 13.0k, False: 3.43k]
  ------------------
 1033|  13.0k|    {
 1034|  13.0k|        ps_nal_prms->i4_idr_pic_num = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1035|       |
 1036|  13.0k|        if(ps_nal_prms->i4_idr_pic_num > 65535) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (1036:12): [True: 507, False: 12.5k]
  ------------------
 1037|  13.0k|    }
 1038|       |
 1039|       |    /* Poc lsb */
 1040|  16.0k|    if(0 == ps_sps->u1_pic_order_cnt_type)
  ------------------
  |  Branch (1040:8): [True: 14.8k, False: 1.19k]
  ------------------
 1041|  14.8k|    {
 1042|  14.8k|        ps_nal_prms->i4_poc_lsb =
 1043|  14.8k|            ih264d_get_bits_h264(ps_stream_ctxt, ps_sps->u1_log2_max_pic_order_cnt_lsb_minus);
 1044|       |
 1045|  14.8k|        if(ps_nal_prms->i4_poc_lsb < 0 ||
  ------------------
  |  Branch (1045:12): [True: 0, False: 14.8k]
  ------------------
 1046|  14.8k|           ps_nal_prms->i4_poc_lsb >= ps_sps->i4_max_pic_order_cntLsb)
  ------------------
  |  Branch (1046:12): [True: 0, False: 14.8k]
  ------------------
 1047|      0|            return ERROR_INV_SLICE_HDR_T;
 1048|  14.8k|        if(SVCD_TRUE == ps_pps->u1_pic_order_present_flag)
  ------------------
  |  |   46|  14.8k|#define SVCD_TRUE 1
  ------------------
  |  Branch (1048:12): [True: 4.61k, False: 10.1k]
  ------------------
 1049|  4.61k|        {
 1050|  4.61k|            ps_nal_prms->i4_delta_poc_bot = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1051|  4.61k|        }
 1052|  14.8k|    }
 1053|  1.19k|    else if((1 == ps_sps->u1_pic_order_cnt_type) && (!ps_sps->u1_delta_pic_order_always_zero_flag))
  ------------------
  |  Branch (1053:13): [True: 1.05k, False: 137]
  |  Branch (1053:53): [True: 1.04k, False: 11]
  ------------------
 1054|  1.04k|    {
 1055|  1.04k|        ps_nal_prms->ai4_delta_poc[0] = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1056|       |
 1057|  1.04k|        if(SVCD_TRUE == ps_pps->u1_pic_order_present_flag)
  ------------------
  |  |   46|  1.04k|#define SVCD_TRUE 1
  ------------------
  |  Branch (1057:12): [True: 639, False: 403]
  ------------------
 1058|    639|        {
 1059|    639|            ps_nal_prms->ai4_delta_poc[1] = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1060|    639|        }
 1061|  1.04k|    }
 1062|       |
 1063|  16.0k|    *pu4_err_code = 0;
 1064|  16.0k|    return (OK);
  ------------------
  |  |  114|  16.0k|#define OK        0
  ------------------
 1065|  16.0k|}
isvcd_get_int_tgt_lyr_attr:
 1093|  1.25M|{
 1094|  1.25M|    WORD32 i4_dep_id;
 1095|  1.25M|    WORD32 i4_quality_id;
 1096|  1.25M|    WORD32 i4_temp_id;
 1097|  1.25M|    WORD32 i4_prior_id;
 1098|       |
 1099|       |    /* sanity checks */
 1100|  1.25M|    if((NULL == ps_app_attr) || (NULL == ps_int_attr) || (NULL == ps_nal_prms))
  ------------------
  |  Branch (1100:8): [True: 0, False: 1.25M]
  |  Branch (1100:33): [True: 0, False: 1.25M]
  |  Branch (1100:58): [True: 0, False: 1.25M]
  ------------------
 1101|      0|    {
 1102|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1103|      0|    }
 1104|       |
 1105|  1.25M|    i4_dep_id = ps_int_attr->i4_dependency_id;
 1106|  1.25M|    i4_quality_id = ps_int_attr->i4_quality_id;
 1107|  1.25M|    i4_temp_id = ps_int_attr->i4_temporal_id;
 1108|  1.25M|    i4_prior_id = ps_int_attr->i4_priority_id;
 1109|       |
 1110|       |    /* check for idr pic flag                                  */
 1111|       |    /* dependency & temporal id is updated only for IDR picture */
 1112|  1.25M|    if(SVCD_TRUE == ps_nal_prms->i4_idr_pic_flag)
  ------------------
  |  |   46|  1.25M|#define SVCD_TRUE 1
  ------------------
  |  Branch (1112:8): [True: 12.9k, False: 1.23M]
  ------------------
 1113|  12.9k|    {
 1114|  12.9k|        if(ps_int_attr->i4_dependency_id < ps_app_attr->i4_dependency_id)
  ------------------
  |  Branch (1114:12): [True: 1.62k, False: 11.3k]
  ------------------
 1115|  1.62k|        {
 1116|       |            /* update the internal attributes only if             */
 1117|       |            /* current dep_id -1 == highest dep id decoded so far */
 1118|       |            /* and quality id is equal to 0                       */
 1119|  1.62k|            if((ps_nal_prms->i4_dependency_id - 1 == ps_int_attr->i4_dependency_id) &&
  ------------------
  |  Branch (1119:16): [True: 186, False: 1.43k]
  ------------------
 1120|    186|               (0 == ps_nal_prms->i4_quality_id))
  ------------------
  |  Branch (1120:16): [True: 186, False: 0]
  ------------------
 1121|    186|            {
 1122|       |                /* Set revised target dependency id */
 1123|    186|                i4_dep_id = ps_nal_prms->i4_dependency_id;
 1124|    186|                i4_temp_id = ps_app_attr->i4_temporal_id;
 1125|    186|                i4_prior_id = ps_app_attr->i4_priority_id;
 1126|    186|            }
 1127|  1.62k|        }
 1128|  11.3k|        else
 1129|  11.3k|        {
 1130|       |            /* cases when the curr dep is greater than or equal to app dep */
 1131|  11.3k|            i4_dep_id = ps_app_attr->i4_dependency_id;
 1132|  11.3k|            i4_temp_id = ps_app_attr->i4_temporal_id;
 1133|  11.3k|            i4_prior_id = ps_app_attr->i4_priority_id;
 1134|  11.3k|        }
 1135|  12.9k|    }
 1136|       |
 1137|       |    /* Set quality id */
 1138|  1.25M|    if(i4_dep_id == ps_app_attr->i4_dependency_id)
  ------------------
  |  Branch (1138:8): [True: 723k, False: 527k]
  ------------------
 1139|   723k|    {
 1140|   723k|        i4_quality_id = ps_app_attr->i4_quality_id;
 1141|   723k|    }
 1142|   527k|    else
 1143|   527k|    {
 1144|   527k|        i4_quality_id = MAX_QUALITY_ID;
  ------------------
  |  |  102|   527k|#define MAX_QUALITY_ID 0
  ------------------
 1145|   527k|    }
 1146|       |
 1147|       |    /* Update the internal attributes */
 1148|  1.25M|    ps_int_attr->i4_dependency_id = i4_dep_id;
 1149|  1.25M|    ps_int_attr->i4_quality_id = i4_quality_id;
 1150|  1.25M|    ps_int_attr->i4_temporal_id = i4_temp_id;
 1151|  1.25M|    ps_int_attr->i4_priority_id = i4_prior_id;
 1152|       |
 1153|  1.25M|    return (OK);
  ------------------
  |  |  114|  1.25M|#define OK        0
  ------------------
 1154|  1.25M|}
isvcd_discard_nal:
 1188|  3.03M|{
 1189|  3.03M|    WORD32 i4_discard_nal_flag;
 1190|  3.03M|    nal_prms_t *ps_nal_prms;
 1191|  3.03M|    target_lyr_attr_t *ps_app_attr;
 1192|  3.03M|    target_lyr_attr_t *ps_int_attr;
 1193|  3.03M|    WORD32 i4_status;
 1194|       |
 1195|  3.03M|    ps_nal_prms = (nal_prms_t *) pv_nal_prms;
 1196|  3.03M|    ps_app_attr = (target_lyr_attr_t *) pv_app_attr;
 1197|  3.03M|    ps_int_attr = (target_lyr_attr_t *) pv_int_attr;
 1198|       |
 1199|       |    /* Get the updated target layer attributes */
 1200|  3.03M|    if(SVCD_TRUE == i4_update_flag)
  ------------------
  |  |   46|  3.03M|#define SVCD_TRUE 1
  ------------------
  |  Branch (1200:8): [True: 1.25M, False: 1.78M]
  ------------------
 1201|  1.25M|    {
 1202|  1.25M|        i4_status = isvcd_get_int_tgt_lyr_attr(ps_app_attr, ps_int_attr, ps_nal_prms);
 1203|  1.25M|        if(OK != i4_status)
  ------------------
  |  |  114|  1.25M|#define OK        0
  ------------------
  |  Branch (1203:12): [True: 0, False: 1.25M]
  ------------------
 1204|      0|        {
 1205|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1206|      0|        }
 1207|  1.25M|    }
 1208|       |
 1209|  3.03M|    i4_discard_nal_flag = SVCD_FALSE;
  ------------------
  |  |   45|  3.03M|#define SVCD_FALSE 0
  ------------------
 1210|       |
 1211|  3.03M|    if(VCL_NAL == ps_nal_prms->i4_derived_nal_type)
  ------------------
  |  Branch (1211:8): [True: 24.8k, False: 3.00M]
  ------------------
 1212|  24.8k|    {
 1213|       |        /*-------------------------------------------------------------------*/
 1214|       |        /*!Discard VCL NAL if any of following is true                       */
 1215|       |        /*! - Dependency id is greater than target dependency id             */
 1216|       |        /*! - Dependency id is equal to target dependency id but quality id  */
 1217|       |        /*!   is greater than target quality id                              */
 1218|       |        /*! - priority id is greater than target priority id                 */
 1219|       |        /*! - Temporal id is greater than target temporal id                 */
 1220|       |        /*! - If dependency id is greater than a NAL unit for which discard  */
 1221|       |        /*!   flag of the NAL header is set                                  */
 1222|       |        /*-------------------------------------------------------------------*/
 1223|  24.8k|        if(PREFIX_UNIT_NAL != ps_nal_prms->i4_nal_unit_type)
  ------------------
  |  |   64|  24.8k|#define PREFIX_UNIT_NAL 14
  ------------------
  |  Branch (1223:12): [True: 24.7k, False: 116]
  ------------------
 1224|  24.7k|        {
 1225|  24.7k|            if(ps_nal_prms->i4_dependency_id > ps_int_attr->i4_dependency_id)
  ------------------
  |  Branch (1225:16): [True: 1.93k, False: 22.8k]
  ------------------
 1226|  1.93k|            {
 1227|  1.93k|                i4_discard_nal_flag = SVCD_TRUE;
  ------------------
  |  |   46|  1.93k|#define SVCD_TRUE 1
  ------------------
 1228|  1.93k|            }
 1229|       |
 1230|  24.7k|            if(ps_nal_prms->i4_dependency_id == ps_int_attr->i4_dependency_id &&
  ------------------
  |  Branch (1230:16): [True: 11.0k, False: 13.7k]
  ------------------
 1231|  11.0k|               ps_nal_prms->i4_quality_id > ps_int_attr->i4_quality_id)
  ------------------
  |  Branch (1231:16): [True: 0, False: 11.0k]
  ------------------
 1232|      0|            {
 1233|      0|                i4_discard_nal_flag = SVCD_TRUE;
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 1234|      0|            }
 1235|       |
 1236|  24.7k|            if(ps_nal_prms->i4_temporal_id > ps_int_attr->i4_temporal_id)
  ------------------
  |  Branch (1236:16): [True: 11, False: 24.7k]
  ------------------
 1237|     11|            {
 1238|     11|                i4_discard_nal_flag = SVCD_TRUE;
  ------------------
  |  |   46|     11|#define SVCD_TRUE 1
  ------------------
 1239|     11|            }
 1240|       |
 1241|  24.7k|            if(ps_nal_prms->i4_priority_id > ps_int_attr->i4_priority_id)
  ------------------
  |  Branch (1241:16): [True: 0, False: 24.7k]
  ------------------
 1242|      0|            {
 1243|      0|                i4_discard_nal_flag = SVCD_TRUE;
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 1244|      0|            }
 1245|  24.7k|        }
 1246|    116|        else
 1247|    116|        {
 1248|    116|            if(0 == ps_int_attr->i4_quality_id && 0 == ps_int_attr->i4_dependency_id)
  ------------------
  |  Branch (1248:16): [True: 116, False: 0]
  |  Branch (1248:51): [True: 25, False: 91]
  ------------------
 1249|     25|            {
 1250|     25|                i4_discard_nal_flag = SVCD_TRUE;
  ------------------
  |  |   46|     25|#define SVCD_TRUE 1
  ------------------
 1251|     25|            }
 1252|    116|        }
 1253|  24.8k|    }
 1254|       |
 1255|  3.03M|    return (i4_discard_nal_flag);
 1256|  3.03M|}

isvcd_get_nal_buf:
  108|  3.02M|{
  109|  3.02M|    nal_prms_t *ps_nal_prms;
  110|  3.02M|    nal_buf_t *ps_nal_buf;
  111|       |
  112|  3.02M|    ps_nal_prms = &ps_nal_parse_ctxt->s_nal_prms;
  113|       |
  114|       |    /* Get the NAL buffer structure */
  115|  3.02M|    if(PREFIX_UNIT_NAL == ps_nal_prms->i4_nal_unit_type)
  ------------------
  |  |   64|  3.02M|#define PREFIX_UNIT_NAL 14
  ------------------
  |  Branch (115:8): [True: 284, False: 3.02M]
  ------------------
  116|    284|    {
  117|    284|        ps_nal_buf = &ps_nal_parse_ctxt->s_prefix_nal_buf;
  118|       |
  119|       |        /* Note: This reset will cause a prefix NAL unit */
  120|       |        /* which is followed by another prefix NAL unit  */
  121|       |        /* to be ignored by the module. This is indeed   */
  122|       |        /* a desired behaviour                           */
  123|    284|        isvcd_nal_buf_reset(ps_nal_buf);
  124|    284|    }
  125|  3.02M|    else
  126|  3.02M|    {
  127|  3.02M|        ps_nal_buf = &ps_nal_parse_ctxt->s_nal_buf;
  128|  3.02M|    }
  129|       |
  130|       |    /* Initialize the buffer structure */
  131|  3.02M|    ps_nal_buf->i4_valid_flag = SVCD_TRUE;
  ------------------
  |  |   46|  3.02M|#define SVCD_TRUE 1
  ------------------
  132|  3.02M|    if(VCL_NAL == ps_nal_prms->i4_derived_nal_type)
  ------------------
  |  Branch (132:8): [True: 11.1k, False: 3.01M]
  ------------------
  133|  11.1k|    {
  134|  11.1k|        ps_nal_buf->pu1_buf = ps_nal_parse_ctxt->pu1_vcl_nal_buf;
  135|  11.1k|    }
  136|  3.01M|    else if(NON_VCL_NAL == ps_nal_prms->i4_derived_nal_type)
  ------------------
  |  Branch (136:13): [True: 3.00M, False: 12.2k]
  ------------------
  137|  3.00M|    {
  138|  3.00M|        ps_nal_buf->pu1_buf = ps_nal_parse_ctxt->pu1_non_vcl_nal_buf;
  139|  3.00M|    }
  140|  12.2k|    else
  141|  12.2k|    {
  142|  12.2k|        ps_nal_buf->pu1_buf = NULL;
  143|  12.2k|        return;
  144|  12.2k|    }
  145|       |
  146|  3.01M|    *pps_nal_buf = ps_nal_buf;
  147|  3.01M|}
isvcd_dqid_ctxt_reset:
  172|  8.72k|{
  173|  8.72k|    WORD32 i4_lyr_idx;
  174|  8.72k|    WORD32 i4_max_num_lyrs;
  175|  8.72k|    dqid_node_t *ps_dqid_node;
  176|       |
  177|       |    /* sanity checks */
  178|  8.72k|    if(NULL == ps_dqid_ctxt)
  ------------------
  |  Branch (178:8): [True: 0, False: 8.72k]
  ------------------
  179|      0|    {
  180|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  181|      0|    }
  182|       |
  183|  8.72k|    i4_max_num_lyrs = ps_dqid_ctxt->i4_max_num_lyrs;
  184|  8.72k|    ps_dqid_node = ps_dqid_ctxt->ps_dqid_node;
  185|       |
  186|       |    /* Loop over all the layers */
  187|  34.9k|    for(i4_lyr_idx = 0; i4_lyr_idx < i4_max_num_lyrs; i4_lyr_idx++)
  ------------------
  |  Branch (187:25): [True: 26.1k, False: 8.72k]
  ------------------
  188|  26.1k|    {
  189|       |        /* Reset the valid flag */
  190|  26.1k|        ps_dqid_node->u1_valid_flag = SVCD_FALSE;
  ------------------
  |  |   45|  26.1k|#define SVCD_FALSE 0
  ------------------
  191|       |
  192|       |        /* Loop updates */
  193|  26.1k|        ps_dqid_node += 1;
  194|  26.1k|    } /* loop over all the layers */
  195|       |
  196|  8.72k|    return (OK);
  ------------------
  |  |  114|  8.72k|#define OK        0
  ------------------
  197|  8.72k|}
isvcd_get_dqid_node:
  226|  37.4k|{
  227|  37.4k|    WORD32 i4_lyr_idx;
  228|  37.4k|    WORD32 i4_max_num_lyrs;
  229|  37.4k|    dqid_node_t *ps_dqid_node;
  230|  37.4k|    dqid_node_t *ps_rqrd_dqid_node;
  231|       |
  232|       |    /* sanity checks */
  233|  37.4k|    if((NULL == ps_dqid_ctxt) || (NULL == pps_dqid_node))
  ------------------
  |  Branch (233:8): [True: 0, False: 37.4k]
  |  Branch (233:34): [True: 0, False: 37.4k]
  ------------------
  234|      0|    {
  235|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  236|      0|    }
  237|       |
  238|  37.4k|    i4_max_num_lyrs = ps_dqid_ctxt->i4_max_num_lyrs;
  239|  37.4k|    ps_dqid_node = ps_dqid_ctxt->ps_dqid_node;
  240|       |
  241|       |    /*Initialization */
  242|  37.4k|    ps_rqrd_dqid_node = NULL;
  243|       |
  244|       |    /* Loop over all the buffer nodes */
  245|  88.3k|    for(i4_lyr_idx = 0; i4_lyr_idx < i4_max_num_lyrs; i4_lyr_idx++)
  ------------------
  |  Branch (245:25): [True: 72.5k, False: 15.8k]
  ------------------
  246|  72.5k|    {
  247|  72.5k|        if((SVCD_TRUE == ps_dqid_node->u1_valid_flag) && (u1_dqid == ps_dqid_node->u1_dqid))
  ------------------
  |  |   46|  72.5k|#define SVCD_TRUE 1
  ------------------
  |  Branch (247:12): [True: 28.9k, False: 43.6k]
  |  Branch (247:58): [True: 21.6k, False: 7.32k]
  ------------------
  248|  21.6k|        {
  249|  21.6k|            ps_rqrd_dqid_node = ps_dqid_node;
  250|  21.6k|            break;
  251|  21.6k|        }
  252|       |        /* Loop updates */
  253|  50.9k|        ps_dqid_node += 1;
  254|  50.9k|    } /* Loop over all the buffer nodes */
  255|       |
  256|  37.4k|    if(NULL == ps_rqrd_dqid_node)
  ------------------
  |  Branch (256:8): [True: 15.8k, False: 21.6k]
  ------------------
  257|  15.8k|    {
  258|       |        /* If vcl node is not allocated for the requested DQID then allocate buffer */
  259|  15.8k|        ps_dqid_node = ps_dqid_ctxt->ps_dqid_node;
  260|  19.6k|        for(i4_lyr_idx = 0; i4_lyr_idx < i4_max_num_lyrs; i4_lyr_idx++)
  ------------------
  |  Branch (260:29): [True: 19.6k, False: 0]
  ------------------
  261|  19.6k|        {
  262|  19.6k|            if(SVCD_FALSE == ps_dqid_node->u1_valid_flag)
  ------------------
  |  |   45|  19.6k|#define SVCD_FALSE 0
  ------------------
  |  Branch (262:16): [True: 15.8k, False: 3.83k]
  ------------------
  263|  15.8k|            {
  264|  15.8k|                break;
  265|  15.8k|            }
  266|       |            /* Loop updates */
  267|  3.83k|            ps_dqid_node += 1;
  268|  3.83k|        } /* Loop over all the nodes */
  269|       |        /* Update the node structure */
  270|  15.8k|        ps_rqrd_dqid_node = ps_dqid_node;
  271|  15.8k|    }
  272|       |
  273|       |    /* sanity checks */
  274|  37.4k|    if(NULL == ps_rqrd_dqid_node)
  ------------------
  |  Branch (274:8): [True: 0, False: 37.4k]
  ------------------
  275|      0|    {
  276|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  277|      0|    }
  278|  37.4k|    *pps_dqid_node = ps_rqrd_dqid_node;
  279|       |
  280|  37.4k|    return (OK);
  ------------------
  |  |  114|  37.4k|#define OK        0
  ------------------
  281|  37.4k|}
isvcd_nal_reset_ctxt:
  307|  3.05M|{
  308|  3.05M|    nal_unit_t *ps_nal_unit;
  309|       |
  310|  3.05M|    if(NULL == ps_nal_parse_ctxt)
  ------------------
  |  Branch (310:8): [True: 0, False: 3.05M]
  ------------------
  311|      0|    {
  312|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  313|      0|    }
  314|       |
  315|       |    /* Reset the NAL boundary detetction */
  316|  3.05M|    ps_nal_parse_ctxt->i4_find_nal_state = NAL_START;
  317|  3.05M|    ps_nal_parse_ctxt->i4_zero_byte_cnt = 0;
  318|  3.05M|    ps_nal_unit = ps_nal_parse_ctxt->pv_nal_unit;
  319|  3.05M|    ps_nal_unit->i4_num_bufs = 0;
  320|       |
  321|       |    /*Reset emulation prevention */
  322|  3.05M|    isvcd_reset_emulation_ctxt(&ps_nal_parse_ctxt->s_emulation_ctxt);
  323|       |
  324|       |    /*Reset the NAL header prms */
  325|  3.05M|    isvcd_set_default_nal_prms(&ps_nal_parse_ctxt->s_nal_prms);
  326|       |
  327|       |    /* Reset other NAL level tracking variables */
  328|  3.05M|    ps_nal_parse_ctxt->i4_discard_nal_flag = SVCD_FALSE;
  ------------------
  |  |   45|  3.05M|#define SVCD_FALSE 0
  ------------------
  329|       |
  330|       |    /*Reset NAL buffer structure*/
  331|  3.05M|    isvcd_nal_buf_reset(&ps_nal_parse_ctxt->s_nal_buf);
  332|       |
  333|  3.05M|    return (OK);
  ------------------
  |  |  114|  3.05M|#define OK        0
  ------------------
  334|  3.05M|}
isvcd_pic_reset_ctxt:
  361|  8.72k|{
  362|  8.72k|    WORD32 i4_status;
  363|       |
  364|       |    /*-----------------------------------------------------------------------*/
  365|       |    /*! Reset NAL boundary detetction logic                                  */
  366|       |    /*-----------------------------------------------------------------------*/
  367|  8.72k|    i4_status = isvcd_nal_reset_ctxt(ps_nal_parse_ctxt);
  368|       |
  369|  8.72k|    UNUSED(i4_status);
  ------------------
  |  |   45|  8.72k|#define UNUSED(x) ((void)(x))
  ------------------
  370|       |
  371|       |    /*-----------------------------------------------------------------------*/
  372|       |    /*! Reset picture boundary detctetion logic                              */
  373|       |    /*-----------------------------------------------------------------------*/
  374|  8.72k|    ps_nal_parse_ctxt->i4_is_frst_vcl_nal_in_au = SVCD_TRUE;
  ------------------
  |  |   46|  8.72k|#define SVCD_TRUE 1
  ------------------
  375|       |
  376|       |    /*-----------------------------------------------------------------------*/
  377|       |    /*! Reset VCL and non VCL NAL buffer tracking variables                  */
  378|       |    /*-----------------------------------------------------------------------*/
  379|  8.72k|    ps_nal_parse_ctxt->pu1_non_vcl_nal_buf = ps_nal_parse_ctxt->pv_non_vcl_nal_buf;
  380|  8.72k|    ps_nal_parse_ctxt->pu1_vcl_nal_buf = ps_nal_parse_ctxt->pv_vcl_nal_buf;
  381|       |
  382|       |    /* reset the bytes left to buffer size */
  383|  8.72k|    ps_nal_parse_ctxt->u4_bytes_left_vcl = MAX_VCL_NAL_BUFF_SIZE;
  ------------------
  |  |   69|  8.72k|#define MAX_VCL_NAL_BUFF_SIZE (1024 * 1024 * 2)
  ------------------
  384|       |
  385|  8.72k|    ps_nal_parse_ctxt->u4_bytes_left_non_vcl = MAX_NON_VCL_NAL_BUFF_SIZE;
  ------------------
  |  |   70|  8.72k|#define MAX_NON_VCL_NAL_BUFF_SIZE (1024 * 1024 * 2)
  ------------------
  386|       |
  387|       |    /* Offset the buffer to start of vcl data */
  388|  8.72k|    UPDATE_NAL_BUF_PTR(&ps_nal_parse_ctxt->pu1_non_vcl_nal_buf, NON_VCL_NAL,
  389|  8.72k|                       &ps_nal_parse_ctxt->u4_bytes_left_non_vcl);
  390|       |
  391|  8.72k|    UPDATE_NAL_BUF_PTR(&ps_nal_parse_ctxt->pu1_vcl_nal_buf, VCL_NAL,
  392|  8.72k|                       &ps_nal_parse_ctxt->u4_bytes_left_vcl);
  393|       |
  394|       |    /* Reset previous field */
  395|  8.72k|    ps_nal_parse_ctxt->ps_prev_non_vcl_buf = NULL;
  396|  8.72k|    ps_nal_parse_ctxt->i4_idr_pic_err_flag = 0;
  397|       |
  398|       |    /*-----------------------------------------------------------------------*/
  399|       |    /*! Reset other NAL related tracking variables                           */
  400|       |    /*-----------------------------------------------------------------------*/
  401|  8.72k|    ps_nal_parse_ctxt->i4_num_non_vcl_nals = 0;
  402|       |
  403|       |    /* Reset the vcl nal node buffer context */
  404|  8.72k|    i4_status = isvcd_dqid_ctxt_reset(&ps_nal_parse_ctxt->s_dqid_ctxt);
  405|       |
  406|       |    /* Reset target layer update flag */
  407|  8.72k|    ps_nal_parse_ctxt->i4_tgt_lyr_update = SVCD_TRUE;
  ------------------
  |  |   46|  8.72k|#define SVCD_TRUE 1
  ------------------
  408|  8.72k|}
isvcd_get_nal_prms:
  443|  3.06M|{
  444|  3.06M|    UWORD8 *pu1_input_buf;
  445|  3.06M|    WORD32 i4_status;
  446|  3.06M|    dec_seq_params_t *ps_sps;
  447|  3.06M|    dec_pic_params_t *ps_pps;
  448|       |
  449|  3.06M|    ps_sps = ps_nal_parse_ctxt->pv_seq_prms;
  450|  3.06M|    ps_pps = ps_nal_parse_ctxt->pv_pic_prms;
  451|       |
  452|  3.06M|    *pu4_err_code = 0;
  453|  3.06M|    *pi4_sps_pps_status = NAL_CORRUPT_DATA;
  454|       |
  455|       |    /* Decode the NAL header */
  456|  3.06M|    isvcd_dec_nal_hdr(pu1_buf, i4_buf_size, ps_nal_parse_ctxt->pv_nal_header_buf, ps_nal_prms,
  457|  3.06M|                      ps_prefix_nal_buf, ps_prefix_nal_prms, pu4_err_code);
  458|       |
  459|       |    /* If encountered with error return fail */
  460|  3.06M|    if(0 != *pu4_err_code)
  ------------------
  |  Branch (460:8): [True: 28.7k, False: 3.03M]
  ------------------
  461|  28.7k|    {
  462|  28.7k|        return (NOT_OK);
  ------------------
  |  |  116|  28.7k|#define NOT_OK    -1
  ------------------
  463|  28.7k|    }
  464|       |
  465|  3.03M|    if(ACCESS_UNIT_DELIMITER_RBSP == ps_nal_prms->i4_nal_unit_type)
  ------------------
  |  |  332|  3.03M|#define ACCESS_UNIT_DELIMITER_RBSP      9
  ------------------
  |  Branch (465:8): [True: 203, False: 3.03M]
  ------------------
  466|    203|    {
  467|    203|        *pi4_nal_discard_flag = 1;
  468|    203|        return OK;
  ------------------
  |  |  114|    203|#define OK        0
  ------------------
  469|    203|    }
  470|       |
  471|       |    /* Set the discard flag */
  472|  3.03M|    *pi4_nal_discard_flag = isvcd_discard_nal(
  473|  3.03M|        (void *) ps_nal_prms, (void *) &ps_nal_parse_ctxt->s_app_attr,
  474|  3.03M|        (void *) &ps_nal_parse_ctxt->s_int_attr, ps_nal_parse_ctxt->i4_tgt_lyr_update);
  475|       |
  476|       |    /* Parse the slice header if all the following */
  477|       |    /* conditions are true                         */
  478|       |    /* 1. NAL is a VCL NAL unit                    */
  479|       |    /* 2. NAL is not a prefix NAL unit             */
  480|       |    /* 3. NAL is not discarded                     */
  481|  3.03M|    if((NON_VCL_NAL == ps_nal_prms->i4_derived_nal_type) ||
  ------------------
  |  Branch (481:8): [True: 3.00M, False: 24.8k]
  ------------------
  482|  24.8k|       (PREFIX_UNIT_NAL == ps_nal_prms->i4_nal_unit_type) || (SVCD_TRUE == *pi4_nal_discard_flag))
  ------------------
  |  |   64|  24.8k|#define PREFIX_UNIT_NAL 14
  ------------------
                     (PREFIX_UNIT_NAL == ps_nal_prms->i4_nal_unit_type) || (SVCD_TRUE == *pi4_nal_discard_flag))
  ------------------
  |  |   46|  24.7k|#define SVCD_TRUE 1
  ------------------
  |  Branch (482:8): [True: 116, False: 24.7k]
  |  Branch (482:62): [True: 1.93k, False: 22.8k]
  ------------------
  483|  3.00M|    {
  484|  3.00M|        return (OK);
  ------------------
  |  |  114|  3.00M|#define OK        0
  ------------------
  485|  3.00M|    }
  486|       |
  487|  22.8k|    pu1_input_buf = pu1_buf;
  488|  22.8k|    pu1_input_buf += ps_nal_prms->i4_nal_header_len;
  489|  22.8k|    i4_buf_size -= ps_nal_prms->i4_nal_header_len;
  490|       |
  491|  22.8k|    i4_status =
  492|  22.8k|        isvcd_parse_part_slice_hdr(pu1_input_buf, i4_buf_size, ps_nal_parse_ctxt->pv_nal_header_buf,
  493|  22.8k|                                   ps_sps, ps_pps, ps_nal_prms, pu4_err_code, pi4_sps_pps_status);
  494|       |
  495|  22.8k|    return (i4_status);
  496|  3.03M|}
isvcd_compare_nal_prms:
  534|  18.8k|{
  535|  18.8k|    dqid_node_t *ps_dqid_node;
  536|  18.8k|    vcl_node_t *ps_vcl_node;
  537|  18.8k|    WORD32 i4_status;
  538|       |
  539|       |    /* If DQID is lesser than the DQID of the previous */
  540|       |    /* NAL then declare the picture boundary           */
  541|  18.8k|    *pi4_pic_bound_type = PIC_BOUND_DQID;
  542|  18.8k|    if(i4_prev_dqid > ps_nal_prms->i4_dqid)
  ------------------
  |  Branch (542:8): [True: 2.26k, False: 16.5k]
  ------------------
  543|  2.26k|    {
  544|  2.26k|        *pi4_pic_bound_status = PIC_BOUNDARY_TRUE;
  545|  2.26k|        return (OK);
  ------------------
  |  |  114|  2.26k|#define OK        0
  ------------------
  546|  2.26k|    }
  547|       |
  548|       |    /* Perform the picture boundary detection only for */
  549|       |    /* the layers with quality id equal to 0           */
  550|  16.5k|    if((FIRST_PASS == i4_pass) && (0 != (ps_nal_prms->i4_dqid & 0x0F)))
  ------------------
  |  |   61|  16.5k|#define FIRST_PASS 0
  ------------------
  |  Branch (550:8): [True: 12.5k, False: 4.05k]
  |  Branch (550:35): [True: 0, False: 12.5k]
  ------------------
  551|      0|    {
  552|      0|        *pi4_pic_bound_status = PIC_BOUNDARY_FALSE;
  553|      0|        return (OK);
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  554|      0|    }
  555|       |
  556|       |    /* Get the DQID node */
  557|  16.5k|    i4_status =
  558|  16.5k|        isvcd_get_dqid_node(&ps_nal_parse_ctxt->s_dqid_ctxt, (UWORD8) i4_prev_dqid, &ps_dqid_node);
  559|  16.5k|    if((OK != i4_status) || (NULL == ps_dqid_node))
  ------------------
  |  |  114|  16.5k|#define OK        0
  ------------------
  |  Branch (559:8): [True: 0, False: 16.5k]
  |  Branch (559:29): [True: 0, False: 16.5k]
  ------------------
  560|      0|    {
  561|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  562|      0|    }
  563|       |    /* If the current slice is first slice in the layer */
  564|       |    /* then do not compare                              */
  565|  16.5k|    if(SVCD_FALSE == ps_dqid_node->u1_valid_flag)
  ------------------
  |  |   45|  16.5k|#define SVCD_FALSE 0
  ------------------
  |  Branch (565:8): [True: 5.96k, False: 10.5k]
  ------------------
  566|  5.96k|    {
  567|  5.96k|        *pi4_pic_bound_status = PIC_BOUNDARY_FALSE;
  568|  5.96k|        return (OK);
  ------------------
  |  |  114|  5.96k|#define OK        0
  ------------------
  569|  5.96k|    }
  570|       |
  571|  10.5k|    *pi4_pic_bound_type = PIC_BOUND_SLICE_PRMS;
  572|  10.5k|    *pi4_pic_bound_status = PIC_BOUNDARY_TRUE;
  573|  10.5k|    ps_vcl_node = ps_dqid_node->ps_vcl_node;
  574|       |
  575|       |    /* Compare NAL ref idc */
  576|  10.5k|    {
  577|  10.5k|        WORD32 i4_prev_ref_pic_flag;
  578|  10.5k|        WORD32 i4_cur_ref_pic_flag;
  579|       |
  580|  10.5k|        i4_prev_ref_pic_flag = (0 != ps_vcl_node->i4_nal_ref_idc);
  581|  10.5k|        i4_cur_ref_pic_flag = (0 != ps_nal_prms->i4_nal_ref_idc);
  582|       |
  583|  10.5k|        if(i4_prev_ref_pic_flag != i4_cur_ref_pic_flag)
  ------------------
  |  Branch (583:12): [True: 1.81k, False: 8.77k]
  ------------------
  584|  1.81k|        {
  585|  1.81k|            return (OK);
  ------------------
  |  |  114|  1.81k|#define OK        0
  ------------------
  586|  1.81k|        }
  587|  10.5k|    }
  588|       |
  589|       |    /* Compare IDR picture flag */
  590|  8.77k|    if(ps_vcl_node->i4_idr_pic_flag != ps_nal_prms->i4_idr_pic_flag)
  ------------------
  |  Branch (590:8): [True: 344, False: 8.42k]
  ------------------
  591|    344|    {
  592|    344|        return (OK);
  ------------------
  |  |  114|    344|#define OK        0
  ------------------
  593|    344|    }
  594|       |
  595|       |    /* Compare PPS id */
  596|  8.42k|    if(ps_vcl_node->u1_pps_id != ps_nal_prms->u1_pps_id)
  ------------------
  |  Branch (596:8): [True: 1.89k, False: 6.53k]
  ------------------
  597|  1.89k|    {
  598|  1.89k|        return (OK);
  ------------------
  |  |  114|  1.89k|#define OK        0
  ------------------
  599|  1.89k|    }
  600|       |
  601|       |    /* Compare idr pic num */
  602|  6.53k|    if((SVCD_TRUE == ps_nal_prms->i4_idr_pic_flag) &&
  ------------------
  |  |   46|  6.53k|#define SVCD_TRUE 1
  ------------------
  |  Branch (602:8): [True: 3.62k, False: 2.91k]
  ------------------
  603|  3.62k|       (ps_vcl_node->i4_idr_pic_num != ps_nal_prms->i4_idr_pic_num))
  ------------------
  |  Branch (603:8): [True: 1.72k, False: 1.89k]
  ------------------
  604|  1.72k|    {
  605|  1.72k|        return (OK);
  ------------------
  |  |  114|  1.72k|#define OK        0
  ------------------
  606|  1.72k|    }
  607|       |
  608|       |    /* Compare frame number */
  609|  4.80k|    if(ps_vcl_node->u2_frm_num != ps_nal_prms->u2_frm_num)
  ------------------
  |  Branch (609:8): [True: 1.32k, False: 3.47k]
  ------------------
  610|  1.32k|    {
  611|  1.32k|        return (OK);
  ------------------
  |  |  114|  1.32k|#define OK        0
  ------------------
  612|  1.32k|    }
  613|       |
  614|       |    /* Compare poc lsb */
  615|  3.47k|    if(ps_dqid_node->i4_poc_lsb != ps_nal_prms->i4_poc_lsb)
  ------------------
  |  Branch (615:8): [True: 289, False: 3.19k]
  ------------------
  616|    289|    {
  617|    289|        return (OK);
  ------------------
  |  |  114|    289|#define OK        0
  ------------------
  618|    289|    }
  619|       |
  620|       |    /* Compare delta poc bottom */
  621|  3.19k|    if(ps_dqid_node->i4_delta_poc_bot != ps_nal_prms->i4_delta_poc_bot)
  ------------------
  |  Branch (621:8): [True: 19, False: 3.17k]
  ------------------
  622|     19|    {
  623|     19|        return (OK);
  ------------------
  |  |  114|     19|#define OK        0
  ------------------
  624|     19|    }
  625|       |
  626|       |    /* Compare delta poc [0] */
  627|  3.17k|    if(ps_dqid_node->ai4_delta_poc[0] != ps_nal_prms->ai4_delta_poc[0])
  ------------------
  |  Branch (627:8): [True: 12, False: 3.15k]
  ------------------
  628|     12|    {
  629|     12|        return (OK);
  ------------------
  |  |  114|     12|#define OK        0
  ------------------
  630|     12|    }
  631|       |
  632|       |    /* Compare delta poc [0] */
  633|  3.15k|    if(ps_dqid_node->ai4_delta_poc[1] != ps_nal_prms->ai4_delta_poc[1])
  ------------------
  |  Branch (633:8): [True: 8, False: 3.15k]
  ------------------
  634|      8|    {
  635|      8|        return (OK);
  ------------------
  |  |  114|      8|#define OK        0
  ------------------
  636|      8|    }
  637|       |
  638|  3.15k|    *pi4_pic_bound_status = PIC_BOUNDARY_FALSE;
  639|  3.15k|    return (OK);
  ------------------
  |  |  114|  3.15k|#define OK        0
  ------------------
  640|  3.15k|}
isvcd_detect_pic_boundary_annex_b:
  696|  16.9k|{
  697|  16.9k|    UWORD32 u4_err_code;
  698|  16.9k|    WORD32 i4_zero_cnt;
  699|  16.9k|    WORD32 i4_status;
  700|  16.9k|    nal_prms_t s_nal_prms = {0};
  701|  16.9k|    nal_prms_t s_prefix_nal_prms = {0};
  702|  16.9k|    nal_buf_t s_prefix_nal_buf = {0};
  703|  16.9k|    WORD32 i4_pic_bound_type;
  704|  16.9k|    WORD32 i4_pic_bound_status;
  705|  16.9k|    UWORD8 *pu1_buf;
  706|  16.9k|    WORD32 i4_buf_size;
  707|  16.9k|    WORD32 i4_more_data_flag;
  708|  16.9k|    WORD32 i4_new_lyr_flag;
  709|  16.9k|    WORD32 i4_prev_dqid;
  710|  16.9k|    WORD32 i4_nal_discard_flag;
  711|       |
  712|       |    /* Initializations */
  713|  16.9k|    i4_zero_cnt = 0;
  714|  16.9k|    s_prefix_nal_buf.i4_valid_flag = SVCD_FALSE;
  ------------------
  |  |   45|  16.9k|#define SVCD_FALSE 0
  ------------------
  715|  16.9k|    *pi4_pic_bound_status = PIC_BOUNDARY_FALSE;
  716|  16.9k|    i4_new_lyr_flag = SVCD_TRUE;
  ------------------
  |  |   46|  16.9k|#define SVCD_TRUE 1
  ------------------
  717|       |
  718|       |    /* Get the previous layer's DQID                    */
  719|  16.9k|    if(SVCD_TRUE == ps_nal_parse_ctxt->i4_is_frst_vcl_nal_in_au)
  ------------------
  |  |   46|  16.9k|#define SVCD_TRUE 1
  ------------------
  |  Branch (719:8): [True: 5.96k, False: 10.9k]
  ------------------
  720|  5.96k|    {
  721|  5.96k|        ps_nal_parse_ctxt->i4_prev_dq_id = ps_nal_prms->i4_dqid;
  722|  5.96k|        ps_nal_parse_ctxt->i4_is_frst_vcl_nal_in_au = SVCD_FALSE;
  ------------------
  |  |   45|  5.96k|#define SVCD_FALSE 0
  ------------------
  723|  5.96k|    }
  724|  16.9k|    i4_prev_dqid = ps_nal_parse_ctxt->i4_prev_dq_id;
  725|  16.9k|    ps_nal_parse_ctxt->i4_prev_dq_id = ps_nal_prms->i4_dqid;
  726|       |
  727|       |    /* Detect the picture boundary */
  728|  16.9k|    if(ps_nal_prms->i4_dqid <= i4_prev_dqid)
  ------------------
  |  Branch (728:8): [True: 14.7k, False: 2.20k]
  ------------------
  729|  14.7k|    {
  730|  14.7k|        i4_status =
  731|  14.7k|            isvcd_compare_nal_prms(ps_nal_prms, FIRST_PASS, i4_prev_dqid, &i4_pic_bound_type,
  ------------------
  |  |   61|  14.7k|#define FIRST_PASS 0
  ------------------
  732|  14.7k|                                   &i4_pic_bound_status, ps_nal_parse_ctxt);
  733|  14.7k|        if(OK != i4_status)
  ------------------
  |  |  114|  14.7k|#define OK        0
  ------------------
  |  Branch (733:12): [True: 0, False: 14.7k]
  ------------------
  734|      0|        {
  735|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  736|      0|        }
  737|  14.7k|        i4_new_lyr_flag = SVCD_FALSE;
  ------------------
  |  |   45|  14.7k|#define SVCD_FALSE 0
  ------------------
  738|       |
  739|       |        /* Check whether the picture boundary is detected */
  740|       |        /* or not */
  741|  14.7k|        if(PIC_BOUNDARY_FALSE == i4_pic_bound_status)
  ------------------
  |  Branch (741:12): [True: 8.54k, False: 6.19k]
  ------------------
  742|  8.54k|        {
  743|  8.54k|            return (OK);
  ------------------
  |  |  114|  8.54k|#define OK        0
  ------------------
  744|  8.54k|        }
  745|       |
  746|       |        /* Otherwise look for next nal and compare again */
  747|  6.19k|        *pi4_pic_bound_status = PIC_BOUNDARY_TRUE;
  748|  6.19k|    }
  749|       |
  750|  8.40k|    do
  751|  8.45k|    {
  752|  8.45k|        WORD32 i4_sps_pps_corrupt_status;
  753|  8.45k|        WORD32 i4_tgt_lyr_bckup;
  754|       |        /* If following conditions are true then there */
  755|       |        /* is no data left to decode next NAL and hence*/
  756|       |        /* no further processing is required           */
  757|  8.45k|        if((NAL_END != ps_nal_parse_ctxt->i4_find_nal_state) ||
  ------------------
  |  Branch (757:12): [True: 49, False: 8.40k]
  ------------------
  758|  8.40k|           ((WORD64) i4_cur_pos >= (WORD64) *pu4_num_bytes))
  ------------------
  |  Branch (758:12): [True: 0, False: 8.40k]
  ------------------
  759|     49|        {
  760|     49|            return (OK);
  ------------------
  |  |  114|     49|#define OK        0
  ------------------
  761|     49|        }
  762|       |
  763|       |        /* Otherwise fill the parameters */
  764|  8.40k|        pu1_buf = pu1_stream_buffer;
  765|  8.40k|        pu1_buf += i4_cur_pos;
  766|  8.40k|        i4_buf_size = *pu4_num_bytes - i4_cur_pos;
  767|       |
  768|       |        /* Get the NAL prms. This involves the following things*/
  769|       |        /* 1. Decode the NAL header                            */
  770|       |        /* 2. Set the discard flag                             */
  771|       |        /* 3. Decode the slice header if needed                */
  772|  8.40k|        isvcd_set_default_nal_prms(&s_nal_prms);
  773|       |
  774|       |        /* take a back up of tgt lyr update flag */
  775|  8.40k|        i4_tgt_lyr_bckup = ps_nal_parse_ctxt->i4_tgt_lyr_update;
  776|       |
  777|       |        /* the tgt attributes should not be  updaetd while pic boundary det*/
  778|  8.40k|        ps_nal_parse_ctxt->i4_tgt_lyr_update = SVCD_FALSE;
  ------------------
  |  |   45|  8.40k|#define SVCD_FALSE 0
  ------------------
  779|       |
  780|  8.40k|        i4_status = isvcd_get_nal_prms(pu1_buf, i4_buf_size, &s_nal_prms, &s_prefix_nal_prms,
  781|  8.40k|                                       &s_prefix_nal_buf, &u4_err_code, &i4_sps_pps_corrupt_status,
  782|  8.40k|                                       &i4_nal_discard_flag, ps_nal_parse_ctxt);
  783|       |        /* restore back the tgt lyr update flag */
  784|  8.40k|        ps_nal_parse_ctxt->i4_tgt_lyr_update = i4_tgt_lyr_bckup;
  785|       |        /* If the error code by the nal prms decoder then declare*/
  786|       |        /* picture boundary                                     */
  787|  8.40k|        if(0 != u4_err_code)
  ------------------
  |  Branch (787:12): [True: 369, False: 8.03k]
  ------------------
  788|    369|        {
  789|    369|            return (OK);
  ------------------
  |  |  114|    369|#define OK        0
  ------------------
  790|    369|        }
  791|       |
  792|  8.03k|        i4_more_data_flag = SVCD_FALSE;
  ------------------
  |  |   45|  8.03k|#define SVCD_FALSE 0
  ------------------
  793|       |
  794|       |        /* If prefix NAL unit comes then save the nal prms*/
  795|  8.03k|        if(PREFIX_UNIT_NAL == s_nal_prms.i4_nal_unit_type)
  ------------------
  |  |   64|  8.03k|#define PREFIX_UNIT_NAL 14
  ------------------
  |  Branch (795:12): [True: 49, False: 7.98k]
  ------------------
  796|     49|        {
  797|     49|            UWORD32 u4_bytes_consumed;
  798|     49|            WORD32 i4_status;
  799|       |
  800|       |            /* If prefix NAL is not discarded then set the varaibles */
  801|       |            /* appropriatly */
  802|     49|            if(SVCD_FALSE == i4_nal_discard_flag)
  ------------------
  |  |   45|     49|#define SVCD_FALSE 0
  ------------------
  |  Branch (802:16): [True: 38, False: 11]
  ------------------
  803|     38|            {
  804|     38|                s_prefix_nal_buf.i4_valid_flag = SVCD_TRUE;
  ------------------
  |  |   46|     38|#define SVCD_TRUE 1
  ------------------
  805|     38|                memcpy(&s_prefix_nal_prms, &s_nal_prms, sizeof(nal_prms_t));
  806|     38|            }
  807|       |
  808|       |            /* Go to next start code */
  809|     49|            i4_zero_cnt = 0;
  810|     49|            u4_bytes_consumed = 0;
  811|     49|            i4_status = isvcd_nal_find_start_code(pu1_stream_buffer, i4_cur_pos, *pu4_num_bytes,
  812|     49|                                                  &i4_zero_cnt, &u4_bytes_consumed);
  813|       |            /* If associated NAL unit is  not present then */
  814|     49|            if(SC_FOUND != i4_status)
  ------------------
  |  |   52|     49|#define SC_FOUND 1
  ------------------
  |  Branch (814:16): [True: 0, False: 49]
  ------------------
  815|      0|            {
  816|      0|                return (OK);
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  817|      0|            }
  818|     49|            i4_cur_pos += u4_bytes_consumed;
  819|     49|            i4_more_data_flag = SVCD_TRUE;
  ------------------
  |  |   46|     49|#define SVCD_TRUE 1
  ------------------
  820|     49|        }
  821|  8.03k|    } while(SVCD_TRUE == i4_more_data_flag);
  ------------------
  |  |   46|  8.03k|#define SVCD_TRUE 1
  ------------------
  |  Branch (821:13): [True: 49, False: 7.98k]
  ------------------
  822|       |
  823|       |    /* Do further picture boundary detection only for */
  824|       |    /* VCL NAL unit (excliding prefix NAL unit)       */
  825|  7.98k|    if((NON_VCL_NAL == s_nal_prms.i4_derived_nal_type) ||
  ------------------
  |  Branch (825:8): [True: 3.24k, False: 4.74k]
  ------------------
  826|  4.74k|       (PREFIX_UNIT_NAL == s_nal_prms.i4_nal_unit_type) || (SVCD_TRUE == i4_nal_discard_flag))
  ------------------
  |  |   64|  4.74k|#define PREFIX_UNIT_NAL 14
  ------------------
                     (PREFIX_UNIT_NAL == s_nal_prms.i4_nal_unit_type) || (SVCD_TRUE == i4_nal_discard_flag))
  ------------------
  |  |   46|  4.74k|#define SVCD_TRUE 1
  ------------------
  |  Branch (826:8): [True: 0, False: 4.74k]
  |  Branch (826:60): [True: 52, False: 4.69k]
  ------------------
  827|  3.29k|    {
  828|  3.29k|        return (OK);
  ------------------
  |  |  114|  3.29k|#define OK        0
  ------------------
  829|  3.29k|    }
  830|       |
  831|  4.69k|    if(SVCD_FALSE == i4_new_lyr_flag)
  ------------------
  |  |   45|  4.69k|#define SVCD_FALSE 0
  ------------------
  |  Branch (831:8): [True: 3.73k, False: 955]
  ------------------
  832|  3.73k|    {
  833|  3.73k|        if(PIC_BOUND_DQID == i4_pic_bound_type)
  ------------------
  |  Branch (833:12): [True: 925, False: 2.81k]
  ------------------
  834|    925|        {
  835|       |            /* If picture boundary was detetcted based on change*/
  836|       |            /* in DQID then declare picture boundary if DQID of the third slice is different */
  837|    925|            if(i4_prev_dqid != s_nal_prms.i4_dqid)
  ------------------
  |  Branch (837:16): [True: 535, False: 390]
  ------------------
  838|    535|            {
  839|    535|                return (OK);
  ------------------
  |  |  114|    535|#define OK        0
  ------------------
  840|    535|            }
  841|    925|        }
  842|  2.81k|        else
  843|  2.81k|        {
  844|       |            /* If picture boundary was detetcted based on change in DQID */
  845|       |            /* then declare picture boundary if dependency id of third slice is different */
  846|  2.81k|            if(PIC_BOUND_SLICE_PRMS != i4_pic_bound_type)
  ------------------
  |  Branch (846:16): [True: 0, False: 2.81k]
  ------------------
  847|      0|            {
  848|      0|                return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  849|      0|            }
  850|       |
  851|  2.81k|            if((i4_prev_dqid & 0xF) != (s_nal_prms.i4_dqid & 0xF))
  ------------------
  |  Branch (851:16): [True: 0, False: 2.81k]
  ------------------
  852|      0|            {
  853|      0|                return (OK);
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  854|      0|            }
  855|  2.81k|        }
  856|       |
  857|  3.20k|        isvcd_compare_nal_prms(&s_nal_prms, SECOND_PASS, i4_prev_dqid, &i4_pic_bound_type,
  ------------------
  |  |   62|  3.20k|#define SECOND_PASS 1
  ------------------
  858|  3.20k|                               &i4_pic_bound_status, ps_nal_parse_ctxt);
  859|  3.20k|        *pi4_pic_bound_status = i4_pic_bound_status;
  860|       |
  861|  3.20k|        if(PIC_BOUNDARY_FALSE == i4_pic_bound_status)
  ------------------
  |  Branch (861:12): [True: 351, False: 2.85k]
  ------------------
  862|    351|        {
  863|    351|            ps_nal_parse_ctxt->i4_prev_dq_id = i4_prev_dqid;
  864|    351|        }
  865|  3.20k|    }
  866|    955|    else
  867|    955|    {
  868|    955|        if(SVCD_TRUE != i4_new_lyr_flag)
  ------------------
  |  |   46|    955|#define SVCD_TRUE 1
  ------------------
  |  Branch (868:12): [True: 0, False: 955]
  ------------------
  869|      0|        {
  870|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  871|      0|        }
  872|       |        /* The NAL header is not corrupted only if any of the following conditions are true */
  873|       |        /* 1. The DQID of the first slice differs with DQID of the third slice */
  874|       |        /* 2. Picture boundary is detected between first slice and third slice */
  875|    955|        if(i4_prev_dqid == s_nal_prms.i4_dqid)
  ------------------
  |  Branch (875:12): [True: 872, False: 83]
  ------------------
  876|    872|        {
  877|    872|            isvcd_compare_nal_prms(&s_nal_prms, SECOND_PASS, i4_prev_dqid, &i4_pic_bound_type,
  ------------------
  |  |   62|    872|#define SECOND_PASS 1
  ------------------
  878|    872|                                   &i4_pic_bound_status, ps_nal_parse_ctxt);
  879|       |            /* NAL header is corrupted and hence correct it  */
  880|    872|            if(PIC_BOUNDARY_FALSE == i4_pic_bound_status)
  ------------------
  |  Branch (880:16): [True: 219, False: 653]
  ------------------
  881|    219|            {
  882|    219|                ps_nal_prms->i4_dqid = s_nal_prms.i4_dqid;
  883|    219|                ps_nal_prms->i4_dependency_id = s_nal_prms.i4_dependency_id;
  884|    219|                ps_nal_prms->i4_quality_id = s_nal_prms.i4_quality_id;
  885|    219|                ps_nal_parse_ctxt->i4_prev_dq_id = ps_nal_prms->i4_dqid;
  886|    219|            }
  887|    872|        }
  888|    955|        *pi4_pic_bound_status = PIC_BOUNDARY_FALSE;
  889|    955|    }
  890|  4.15k|    return (OK);
  ------------------
  |  |  114|  4.15k|#define OK        0
  ------------------
  891|  4.69k|}
isvcd_insert_vcl_node:
  917|  9.85k|{
  918|  9.85k|    vcl_node_t *ps_bot_node;
  919|  9.85k|    vcl_node_t *ps_top_node;
  920|  9.85k|    vcl_node_t *ps_node;
  921|  9.85k|    WORD32 i4_rqrd_dqid;
  922|       |
  923|       |    /* sanity checks */
  924|  9.85k|    if((NULL == ps_vcl_nal) || (NULL == ps_vcl_node))
  ------------------
  |  Branch (924:8): [True: 0, False: 9.85k]
  |  Branch (924:32): [True: 0, False: 9.85k]
  ------------------
  925|      0|    {
  926|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  927|      0|    }
  928|       |
  929|  9.85k|    i4_rqrd_dqid = (ps_vcl_node->i4_dependency_id << 4);
  930|  9.85k|    i4_rqrd_dqid += ps_vcl_node->i4_quality_id;
  931|  9.85k|    ps_node = ps_vcl_nal->ps_bot_node;
  932|       |
  933|       |    /* Search for node which has a DQID which is */
  934|       |    /* lesser than taht of the node to inserted  */
  935|  13.5k|    while(NULL != ps_node)
  ------------------
  |  Branch (935:11): [True: 3.83k, False: 9.74k]
  ------------------
  936|  3.83k|    {
  937|  3.83k|        WORD32 i4_dqid;
  938|       |
  939|  3.83k|        i4_dqid = (ps_node->i4_dependency_id << 4);
  940|  3.83k|        i4_dqid += ps_node->i4_quality_id;
  941|       |
  942|       |        /* If we get a DQID which is greater than*/
  943|       |        /* the DQID of the  node to be inserted  */
  944|       |        /* then break out of the loop and update */
  945|  3.83k|        if(i4_dqid > i4_rqrd_dqid)
  ------------------
  |  Branch (945:12): [True: 110, False: 3.72k]
  ------------------
  946|    110|        {
  947|    110|            ps_bot_node = ps_node->ps_bot_node;
  948|    110|            break;
  949|    110|        }
  950|       |
  951|  3.72k|        ps_node = ps_node->ps_top_node;
  952|  3.72k|    }
  953|       |
  954|       |    /* If none of the nodes in the list have DQId */
  955|       |    /* greater than the node to be inserted then  */
  956|       |    /* bottom node will be top most node          */
  957|  9.85k|    if(NULL == ps_node)
  ------------------
  |  Branch (957:8): [True: 9.74k, False: 110]
  ------------------
  958|  9.74k|    {
  959|  9.74k|        ps_bot_node = ps_vcl_nal->ps_top_node;
  960|  9.74k|    }
  961|       |
  962|       |    /* Insert the node into DQID list */
  963|  9.85k|    if(NULL != ps_bot_node)
  ------------------
  |  Branch (963:8): [True: 3.72k, False: 6.12k]
  ------------------
  964|  3.72k|    {
  965|  3.72k|        ps_top_node = ps_bot_node->ps_top_node;
  966|  3.72k|    }
  967|  6.12k|    else
  968|  6.12k|    {
  969|  6.12k|        ps_top_node = ps_vcl_nal->ps_bot_node;
  970|  6.12k|    }
  971|       |
  972|       |    /* Join previous node and specified node */
  973|  9.85k|    if(NULL != ps_bot_node)
  ------------------
  |  Branch (973:8): [True: 3.72k, False: 6.12k]
  ------------------
  974|  3.72k|    {
  975|  3.72k|        ps_bot_node->ps_top_node = ps_vcl_node;
  976|  3.72k|    }
  977|  6.12k|    else
  978|  6.12k|    {
  979|  6.12k|        ps_vcl_nal->ps_bot_node = ps_vcl_node;
  980|  6.12k|    }
  981|  9.85k|    ps_vcl_node->ps_bot_node = ps_bot_node;
  982|       |
  983|       |    /* Join next node and specified node */
  984|  9.85k|    if(NULL != ps_top_node)
  ------------------
  |  Branch (984:8): [True: 110, False: 9.74k]
  ------------------
  985|    110|    {
  986|    110|        ps_top_node->ps_bot_node = ps_vcl_node;
  987|    110|    }
  988|  9.74k|    else
  989|  9.74k|    {
  990|  9.74k|        ps_vcl_nal->ps_top_node = ps_vcl_node;
  991|  9.74k|    }
  992|  9.85k|    ps_vcl_node->ps_top_node = ps_top_node;
  993|       |
  994|  9.85k|    return (OK);
  ------------------
  |  |  114|  9.85k|#define OK        0
  ------------------
  995|  9.85k|}
isvcd_update_nal_ctxt:
 1024|  3.01M|{
 1025|       |    /*! If current NAL is VCL NAL then
 1026|       |          - Insert a VCL node into DQID list if neccessery
 1027|       |          - update the information part of NAL unit */
 1028|       |    /*! Otherwise, populate the buffer parameters into non vcl output
 1029|       |    structure */
 1030|  3.01M|    nal_prms_t *ps_nal_prms;
 1031|  3.01M|    nal_buf_t *ps_nal_buf, *ps_prefix_nal_buf;
 1032|       |
 1033|  3.01M|    ps_nal_prms = &ps_nal_parse_ctxt->s_nal_prms;
 1034|  3.01M|    ps_nal_prms = &ps_nal_parse_ctxt->s_nal_prms;
 1035|  3.01M|    ps_nal_buf = &ps_nal_parse_ctxt->s_nal_buf;
 1036|  3.01M|    ps_prefix_nal_buf = &ps_nal_parse_ctxt->s_prefix_nal_buf;
 1037|       |
 1038|       |    /* If prefix NAL unit then          */
 1039|       |    /* - calculate the SODB length      */
 1040|  3.01M|    if(PREFIX_UNIT_NAL == ps_nal_prms->i4_nal_unit_type)
  ------------------
  |  |   64|  3.01M|#define PREFIX_UNIT_NAL 14
  ------------------
  |  Branch (1040:8): [True: 51, False: 3.01M]
  ------------------
 1041|     51|    {
 1042|       |        /* Since we consume the zeroes in start code also */
 1043|       |        /* size has to reduced                            */
 1044|     51|        if(NAL_END == ps_nal_parse_ctxt->i4_find_nal_state)
  ------------------
  |  Branch (1044:12): [True: 51, False: 0]
  ------------------
 1045|     51|        {
 1046|     51|            ps_prefix_nal_buf->i4_buf_size -= 2;
 1047|     51|        }
 1048|       |
 1049|     51|        ps_prefix_nal_buf->u4_max_bits =
 1050|     51|            isvcd_nal_rbsp_to_sodb(ps_prefix_nal_buf->pu1_buf, ps_prefix_nal_buf->i4_buf_size, 0);
 1051|     51|        memcpy(&ps_nal_parse_ctxt->s_prefix_nal_prms, &ps_nal_parse_ctxt->s_nal_prms,
 1052|     51|               sizeof(nal_prms_t));
 1053|     51|        return;
 1054|     51|    }
 1055|       |
 1056|  3.01M|    if(ANNEX_B == ps_nal_parse_ctxt->i4_input_bitstream_mode)
  ------------------
  |  |   64|  3.01M|#define ANNEX_B 0     /*!< Annex B stream*/
  ------------------
  |  Branch (1056:8): [True: 3.01M, False: 0]
  ------------------
 1057|  3.01M|    {
 1058|       |        /* Since we consume the zeroes in start code also */
 1059|       |        /* size has to reduced                            */
 1060|  3.01M|        if(NAL_END == ps_nal_parse_ctxt->i4_find_nal_state)
  ------------------
  |  Branch (1060:12): [True: 3.01M, False: 0]
  ------------------
 1061|  3.01M|        {
 1062|  3.01M|            ps_nal_buf->i4_buf_size -= 2;
 1063|  3.01M|        }
 1064|  3.01M|    }
 1065|       |
 1066|  3.01M|    if(VCL_NAL == ps_nal_prms->i4_derived_nal_type)
  ------------------
  |  Branch (1066:8): [True: 11.0k, False: 3.00M]
  ------------------
 1067|  11.0k|    {
 1068|  11.0k|        dqid_node_t *ps_dqid_node;
 1069|  11.0k|        vcl_node_t *ps_node;
 1070|  11.0k|        WORD32 i4_status;
 1071|  11.0k|        dec_pic_params_t *ps_pps;
 1072|  11.0k|        dec_seq_params_t *ps_sps;
 1073|  11.0k|        vcl_buf_hdr_t *ps_vcl_hdr;
 1074|  11.0k|        vcl_buf_hdr_t *ps_prev_vcl_hdr;
 1075|  11.0k|        WORD32 i4_slice_offset;
 1076|       |
 1077|  11.0k|        ps_sps = ps_nal_parse_ctxt->pv_seq_prms;
 1078|  11.0k|        ps_sps += ps_nal_prms->u1_sps_id;
 1079|  11.0k|        ps_pps = ps_nal_parse_ctxt->pv_pic_prms;
 1080|  11.0k|        ps_pps += ps_nal_prms->u1_pps_id;
 1081|       |
 1082|       |        /* Get the VCL NAL node */
 1083|  11.0k|        i4_status = isvcd_get_dqid_node(&ps_nal_parse_ctxt->s_dqid_ctxt,
 1084|  11.0k|                                        (UWORD8) ps_nal_parse_ctxt->i4_prev_dq_id, &ps_dqid_node);
 1085|       |
 1086|  11.0k|        ps_node = ps_dqid_node->ps_vcl_node;
 1087|       |
 1088|  11.0k|        if(NULL == ps_node)
  ------------------
  |  Branch (1088:12): [True: 0, False: 11.0k]
  ------------------
 1089|      0|        {
 1090|       |            /* no active node has been acquired */
 1091|      0|            return;
 1092|      0|        }
 1093|       |
 1094|       |        /*-------------------------------------------------------------------*/
 1095|       |        /* The DQID list updation should happen only once in a               */
 1096|       |        /* layer. Hence a flag used to determine whether the                 */
 1097|       |        /* layer is already initialized or not.                              */
 1098|       |        /*-------------------------------------------------------------------*/
 1099|  11.0k|        if(SVCD_FALSE == ps_dqid_node->u1_valid_flag)
  ------------------
  |  |   45|  11.0k|#define SVCD_FALSE 0
  ------------------
  |  Branch (1099:12): [True: 7.91k, False: 3.14k]
  ------------------
 1100|  7.91k|        {
 1101|       |            /* Update the DQID node */
 1102|  7.91k|            ps_dqid_node->u1_valid_flag = SVCD_TRUE;
  ------------------
  |  |   46|  7.91k|#define SVCD_TRUE 1
  ------------------
 1103|  7.91k|            ps_dqid_node->u1_dqid = (ps_nal_prms->i4_dependency_id << 4);
 1104|  7.91k|            ps_dqid_node->u1_dqid += ps_nal_prms->i4_quality_id;
 1105|  7.91k|            ps_dqid_node->i4_poc_lsb = ps_nal_prms->i4_poc_lsb;
 1106|  7.91k|            ps_dqid_node->i4_delta_poc_bot = ps_nal_prms->i4_delta_poc_bot;
 1107|  7.91k|            ps_dqid_node->ai4_delta_poc[0] = ps_nal_prms->ai4_delta_poc[0];
 1108|  7.91k|            ps_dqid_node->ai4_delta_poc[1] = ps_nal_prms->ai4_delta_poc[1];
 1109|       |
 1110|       |            /* Update the VCL node */
 1111|  7.91k|            ps_node->i4_quality_id = ps_nal_prms->i4_quality_id;
 1112|  7.91k|            ps_node->i4_dependency_id = ps_nal_prms->i4_dependency_id;
 1113|  7.91k|            ps_node->i4_temporal_id = ps_nal_prms->i4_temporal_id;
 1114|  7.91k|            ps_node->i4_priority_id = ps_nal_prms->i4_priority_id;
 1115|  7.91k|            ps_node->i4_idr_pic_flag = ps_nal_prms->i4_idr_pic_flag;
 1116|  7.91k|            ps_node->i4_nal_ref_idc = ps_nal_prms->i4_nal_ref_idc;
 1117|  7.91k|            ps_node->i4_nal_unit_type = ps_nal_prms->i4_nal_unit_type;
 1118|  7.91k|            ps_node->i4_use_ref_base = ps_nal_prms->i4_use_ref_base_pic_flag;
 1119|  7.91k|            ps_node->i4_nal_ref_idc = ps_nal_prms->i4_nal_ref_idc;
 1120|  7.91k|            ps_node->u1_sps_id = ps_nal_prms->u1_sps_id;
 1121|  7.91k|            ps_node->u1_pps_id = ps_nal_prms->u1_pps_id;
 1122|  7.91k|            ps_node->u2_frm_num = ps_nal_prms->u2_frm_num;
 1123|  7.91k|            ps_node->i4_idr_pic_num = ps_nal_prms->i4_idr_pic_num;
 1124|  7.91k|            ps_node->i4_num_slices = 0;
 1125|  7.91k|            ps_node->u1_acc_no_int_pred = 1;
 1126|  7.91k|            if(0 == ps_sps->u1_pic_order_cnt_type)
  ------------------
  |  Branch (1126:16): [True: 7.44k, False: 466]
  ------------------
 1127|  7.44k|            {
 1128|  7.44k|                ps_node->i4_poc_syntax = ps_nal_prms->i4_poc_lsb;
 1129|  7.44k|            }
 1130|    466|            else
 1131|    466|            {
 1132|    466|                ps_node->i4_poc_syntax = ps_nal_prms->ai4_delta_poc[0];
 1133|    466|            }
 1134|       |
 1135|       |            /* Insert the node into DQID list */
 1136|  7.91k|            i4_status = isvcd_insert_vcl_node(ps_vcl_nal, ps_node);
 1137|  7.91k|            if(OK != i4_status)
  ------------------
  |  |  114|  7.91k|#define OK        0
  ------------------
  |  Branch (1137:16): [True: 0, False: 7.91k]
  ------------------
 1138|      0|            {
 1139|      0|                return;
 1140|      0|            }
 1141|       |
 1142|       |            /* Reset the previous field */
 1143|  7.91k|            ps_nal_parse_ctxt->ps_prev_vcl_buf = NULL;
 1144|  7.91k|            ps_node->ps_first_vcl_nal = NULL;
 1145|  7.91k|        }
 1146|       |
 1147|       |        /* Update accumulated no inter layer prediction */
 1148|  11.0k|        ps_node->u1_acc_no_int_pred &= (UWORD8) ps_nal_prms->i4_no_int_lyr_pred;
 1149|       |
 1150|       |        /****************** Fill VCL BUF header ************/
 1151|       |
 1152|       |        /* If prefix NAL unit is present then update  */
 1153|       |        /* the following                              */
 1154|       |        /* - Start of buffer header will be present in*/
 1155|       |        /*   before the start of prefix NAL unit's SODB*/
 1156|       |        /*   data.                                    */
 1157|       |        /*   Note: If memeory left for buffer header  */
 1158|       |        /*   of the prefix NAL unit will have junk    */
 1159|       |        /*   values                                   */
 1160|       |
 1161|  11.0k|        if(NULL == ps_nal_buf->pu1_buf)
  ------------------
  |  Branch (1161:12): [True: 0, False: 11.0k]
  ------------------
 1162|      0|        {
 1163|       |            /* no nal needs to be added into the list hence return */
 1164|      0|            return;
 1165|      0|        }
 1166|  11.0k|        else
 1167|  11.0k|        {
 1168|  11.0k|            ps_vcl_hdr = (vcl_buf_hdr_t *) (ps_nal_buf->pu1_buf - GET_NAL_BUF_INC(VCL_NAL));
 1169|  11.0k|        }
 1170|       |
 1171|  11.0k|        i4_slice_offset = 0;
 1172|  11.0k|        if(SVCD_TRUE == ps_prefix_nal_buf->i4_valid_flag)
  ------------------
  |  |   46|  11.0k|#define SVCD_TRUE 1
  ------------------
  |  Branch (1172:12): [True: 33, False: 11.0k]
  ------------------
 1173|     33|        {
 1174|     33|            ps_vcl_hdr = (vcl_buf_hdr_t *) (ps_prefix_nal_buf->pu1_buf - GET_NAL_BUF_INC(VCL_NAL));
 1175|     33|            i4_slice_offset = ps_nal_buf->pu1_buf - ps_prefix_nal_buf->pu1_buf;
 1176|     33|        }
 1177|       |
 1178|       |        /* Update the next field of the previous nal  */
 1179|       |        /* unit or if it is the first NAL then update */
 1180|       |        /* VCL node information                       */
 1181|  11.0k|        ps_prev_vcl_hdr = ps_nal_parse_ctxt->ps_prev_vcl_buf;
 1182|  11.0k|        if(NULL != ps_prev_vcl_hdr)
  ------------------
  |  Branch (1182:12): [True: 3.14k, False: 7.91k]
  ------------------
 1183|  3.14k|        {
 1184|  3.14k|            ps_prev_vcl_hdr->ps_next = ps_vcl_hdr;
 1185|  3.14k|        }
 1186|  7.91k|        else
 1187|  7.91k|        {
 1188|  7.91k|            ps_node->ps_first_vcl_nal = ps_vcl_hdr;
 1189|  7.91k|        }
 1190|       |
 1191|       |        /* Fill the VCL buffer header */
 1192|  11.0k|        ps_vcl_hdr->ps_next = NULL;
 1193|  11.0k|        ps_vcl_hdr->i4_no_int_lyr_pred = ps_nal_prms->i4_no_int_lyr_pred;
 1194|  11.0k|        ps_vcl_hdr->i4_first_mb_addr = ps_nal_prms->u4_first_mb_addr;
 1195|  11.0k|        ps_vcl_hdr->u4_prefix_nal_bits = ps_prefix_nal_buf->u4_max_bits;
 1196|  11.0k|        ps_vcl_hdr->i4_slice_offset = 0;
 1197|  11.0k|        ps_vcl_hdr->i4_buf_offset = GET_NAL_BUF_INC(VCL_NAL);
 1198|  11.0k|        ps_vcl_hdr->i4_slice_offset = i4_slice_offset;
 1199|       |
 1200|       |        /* Determine max num bits */
 1201|  11.0k|        ps_nal_buf->u4_max_bits = isvcd_nal_rbsp_to_sodb(
 1202|  11.0k|            ps_nal_buf->pu1_buf, ps_nal_buf->i4_buf_size, ps_pps->u1_entropy_coding_mode);
 1203|  11.0k|        ps_vcl_hdr->u4_max_bits = ps_nal_buf->u4_max_bits;
 1204|       |
 1205|       |        /* Updates */
 1206|  11.0k|        ps_nal_parse_ctxt->ps_prev_vcl_buf = ps_vcl_hdr;
 1207|  11.0k|        ps_node->i4_num_slices += 1;
 1208|  11.0k|    }
 1209|       |    /*-----------------------------------------------------------------------*/
 1210|       |    /* If start of NAL and if its a NON VCL NAL then update the              */
 1211|       |    /* start address of the NON VCL NAL                                      */
 1212|       |    /*-----------------------------------------------------------------------*/
 1213|  3.00M|    else
 1214|  3.00M|    {
 1215|  3.00M|        non_vcl_buf_hdr_t *ps_non_vcl_buf_hdr;
 1216|  3.00M|        non_vcl_buf_hdr_t *ps_prev_non_vcl_buf_hdr;
 1217|       |
 1218|  3.00M|        ps_non_vcl_buf_hdr =
 1219|  3.00M|            (non_vcl_buf_hdr_t *) (ps_nal_buf->pu1_buf - GET_NAL_BUF_INC(NON_VCL_NAL));
 1220|       |
 1221|       |        /* Update NON VCL structure */
 1222|  3.00M|        ps_non_vcl_buf_hdr->i4_nal_unit_type = ps_nal_prms->i4_nal_unit_type;
 1223|  3.00M|        ps_non_vcl_buf_hdr->ps_next = NULL;
 1224|  3.00M|        ps_non_vcl_buf_hdr->i4_buf_offset = GET_NAL_BUF_INC(NON_VCL_NAL);
 1225|  3.00M|        ps_non_vcl_buf_hdr->i4_buf_size = ps_nal_buf->i4_buf_size;
 1226|       |
 1227|       |        /* Update the next field and first non vcl fields of */
 1228|       |        /* non vcl buffer header structure and non vcl       */
 1229|       |        /* structure respectively                            */
 1230|  3.00M|        ps_prev_non_vcl_buf_hdr = ps_nal_parse_ctxt->ps_prev_non_vcl_buf;
 1231|  3.00M|        if(NULL != ps_prev_non_vcl_buf_hdr)
  ------------------
  |  Branch (1231:12): [True: 2.99M, False: 4.01k]
  ------------------
 1232|  2.99M|        {
 1233|  2.99M|            ps_prev_non_vcl_buf_hdr->ps_next = ps_non_vcl_buf_hdr;
 1234|  2.99M|        }
 1235|  4.01k|        else
 1236|  4.01k|        {
 1237|  4.01k|            ps_non_vcl_nal->ps_first_non_vcl_nal = ps_non_vcl_buf_hdr;
 1238|  4.01k|        }
 1239|       |
 1240|       |        /* Updates */
 1241|  3.00M|        ps_nal_parse_ctxt->i4_num_non_vcl_nals += 1;
 1242|  3.00M|        ps_non_vcl_nal->i4_num_non_vcl_nals = ps_nal_parse_ctxt->i4_num_non_vcl_nals;
 1243|  3.00M|        ps_nal_parse_ctxt->ps_prev_non_vcl_buf = ps_non_vcl_buf_hdr;
 1244|  3.00M|    }
 1245|  3.01M|}
isvcd_refine_dqid_list:
 1340|  5.97k|{
 1341|  5.97k|    vcl_node_t *ps_node;
 1342|  5.97k|    target_lyr_attr_t *ps_int_attr;
 1343|  5.97k|    dqid_ctxt_t *ps_dqid_ctxt;
 1344|  5.97k|    UWORD8 u1_dep_id;
 1345|  5.97k|    WORD32 i4_status;
 1346|  5.97k|    WORD32 i4_dep_id;
 1347|       |
 1348|  5.97k|    ps_int_attr = &ps_nal_parse_ctxt->s_int_attr;
 1349|  5.97k|    ps_dqid_ctxt = &ps_nal_parse_ctxt->s_dqid_ctxt;
 1350|  5.97k|    i4_dep_id = -1;
 1351|       |
 1352|  15.7k|    for(u1_dep_id = 0; u1_dep_id <= ps_int_attr->i4_dependency_id; u1_dep_id++)
  ------------------
  |  Branch (1352:24): [True: 9.80k, False: 5.96k]
  ------------------
 1353|  9.80k|    {
 1354|  9.80k|        dqid_node_t *ps_dqid_node;
 1355|       |
 1356|       |        /* Get a DQID node */
 1357|  9.80k|        i4_status = isvcd_get_dqid_node(ps_dqid_ctxt, (UWORD8) (u1_dep_id << 4), &ps_dqid_node);
 1358|  9.80k|        if(OK != i4_status)
  ------------------
  |  |  114|  9.80k|#define OK        0
  ------------------
  |  Branch (1358:12): [True: 0, False: 9.80k]
  ------------------
 1359|      0|        {
 1360|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1361|      0|        }
 1362|       |
 1363|       |        /* If node does not exist already then insert a dummy node */
 1364|  9.80k|        if(SVCD_FALSE == ps_dqid_node->u1_valid_flag)
  ------------------
  |  |   45|  9.80k|#define SVCD_FALSE 0
  ------------------
  |  Branch (1364:12): [True: 1.94k, False: 7.86k]
  ------------------
 1365|  1.94k|        {
 1366|  1.94k|            if(1 == ps_nal_parse_ctxt->i4_idr_pic_err_flag)
  ------------------
  |  Branch (1366:16): [True: 1, False: 1.94k]
  ------------------
 1367|      1|            {
 1368|      1|                ps_int_attr->i4_dependency_id = i4_dep_id;
 1369|      1|                ps_int_attr->i4_quality_id = MAX_QUALITY_ID;
  ------------------
  |  |  102|      1|#define MAX_QUALITY_ID 0
  ------------------
 1370|       |
 1371|       |                /* remove all the nodes from dependency list */
 1372|       |                /* which are at higher dependency than the   */
 1373|       |                /* value set in init attributes              */
 1374|      1|                while(NULL != ps_vcl_nal->ps_top_node)
  ------------------
  |  Branch (1374:23): [True: 1, False: 0]
  ------------------
 1375|      1|                {
 1376|       |                    /* if higher dependency */
 1377|      1|                    if(ps_vcl_nal->ps_top_node->i4_dependency_id > i4_dep_id)
  ------------------
  |  Branch (1377:24): [True: 0, False: 1]
  ------------------
 1378|      0|                    {
 1379|      0|                        ps_vcl_nal->ps_top_node = ps_vcl_nal->ps_top_node->ps_bot_node;
 1380|      0|                    }
 1381|      1|                    else
 1382|      1|                    {
 1383|      1|                        break;
 1384|      1|                    }
 1385|      1|                }
 1386|       |
 1387|       |                /* if no node exists in the dependency list */
 1388|      1|                if(NULL == ps_vcl_nal->ps_top_node)
  ------------------
  |  Branch (1388:20): [True: 0, False: 1]
  ------------------
 1389|      0|                {
 1390|      0|                    ps_vcl_nal->ps_bot_node = NULL;
 1391|      0|                }
 1392|      1|                else if(ps_vcl_nal->ps_top_node == ps_vcl_nal->ps_bot_node)
  ------------------
  |  Branch (1392:25): [True: 1, False: 0]
  ------------------
 1393|      1|                {
 1394|       |                    /* if a single node exists */
 1395|      1|                    ps_vcl_nal->ps_top_node->ps_bot_node = NULL;
 1396|      1|                    ps_vcl_nal->ps_bot_node->ps_top_node = NULL;
 1397|      1|                }
 1398|       |
 1399|      1|                return (NOT_OK);
  ------------------
  |  |  116|      1|#define NOT_OK    -1
  ------------------
 1400|      1|            }
 1401|  1.94k|            else
 1402|  1.94k|            {
 1403|  1.94k|                ps_dqid_node->u1_valid_flag = SVCD_TRUE;
  ------------------
  |  |   46|  1.94k|#define SVCD_TRUE 1
  ------------------
 1404|  1.94k|                ps_dqid_node->u1_dqid = (u1_dep_id << 4);
 1405|       |
 1406|       |                /* Fill VCL node information */
 1407|  1.94k|                ps_node = ps_dqid_node->ps_vcl_node;
 1408|  1.94k|                ps_node->i4_dependency_id = u1_dep_id;
 1409|  1.94k|                ps_node->i4_quality_id = 0;
 1410|  1.94k|                ps_node->ps_first_vcl_nal = NULL;
 1411|  1.94k|            }
 1412|       |
 1413|       |            /* Insert node into DQID list */
 1414|  1.94k|            i4_status = isvcd_insert_vcl_node(ps_vcl_nal, ps_node);
 1415|  1.94k|            if(OK != i4_status)
  ------------------
  |  |  114|  1.94k|#define OK        0
  ------------------
  |  Branch (1415:16): [True: 0, False: 1.94k]
  ------------------
 1416|      0|            {
 1417|      0|                return (NOT_OK);
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1418|      0|            }
 1419|  1.94k|        }
 1420|       |
 1421|  9.80k|        i4_dep_id++;
 1422|  9.80k|    } /* End of loop over all the dependency id */
 1423|  5.96k|    return (OK);
  ------------------
  |  |  114|  5.96k|#define OK        0
  ------------------
 1424|  5.97k|}
isvcd_nal_parse_set_target_attr:
 1457|    154|{
 1458|    154|    nal_parse_ctxt_t *ps_nal_parse_ctxt;
 1459|    154|    target_lyr_attr_t *ps_app_attr;
 1460|       |
 1461|    154|    if((i4_target_quality_id > MAX_QUALITY_ID) || (i4_target_dependency_id > MAX_DEPENDENCY_ID))
  ------------------
  |  |  102|    154|#define MAX_QUALITY_ID 0
  ------------------
                  if((i4_target_quality_id > MAX_QUALITY_ID) || (i4_target_dependency_id > MAX_DEPENDENCY_ID))
  ------------------
  |  |  103|    154|#define MAX_DEPENDENCY_ID 4
  ------------------
  |  Branch (1461:8): [True: 0, False: 154]
  |  Branch (1461:51): [True: 0, False: 154]
  ------------------
 1462|      0|    {
 1463|      0|        return IV_FAIL;
 1464|      0|    }
 1465|       |
 1466|    154|    ps_nal_parse_ctxt = (nal_parse_ctxt_t *) pv_nal_parse_ctxt;
 1467|    154|    ps_app_attr = &ps_nal_parse_ctxt->s_app_attr;
 1468|       |
 1469|       |    /*-----------------------------------------------------------------------*/
 1470|       |    /*! Register the target information into context structure               */
 1471|       |    /*-----------------------------------------------------------------------*/
 1472|    154|    ps_app_attr->i4_quality_id = i4_target_quality_id;
 1473|    154|    ps_app_attr->i4_dependency_id = i4_target_dependency_id;
 1474|    154|    ps_app_attr->i4_temporal_id = i4_target_temporal_id;
 1475|    154|    ps_app_attr->i4_priority_id = i4_target_priority_id;
 1476|    154|    return IV_SUCCESS;
 1477|    154|}
isvcd_nal_parse_reset_ctxt:
 1510|    154|{
 1511|    154|    nal_parse_ctxt_t *ps_nal_parse_ctxt = (nal_parse_ctxt_t *) pv_nal_parse_ctxt;
 1512|    154|    UNUSED(i4_input_mode);
  ------------------
  |  |   45|    154|#define UNUSED(x) ((void)(x))
  ------------------
 1513|       |
 1514|       |    /*-----------------------------------------------------------------------*/
 1515|       |    /*! Set the input bitstream mode of context structure                    */
 1516|       |    /*-----------------------------------------------------------------------*/
 1517|    154|    switch(i4_input_bitstream_mode)
 1518|    154|    {
 1519|    154|        case ANNEX_B:
  ------------------
  |  |   64|    154|#define ANNEX_B 0     /*!< Annex B stream*/
  ------------------
  |  Branch (1519:9): [True: 154, False: 0]
  ------------------
 1520|    154|        case NON_ANNEX_B:
  ------------------
  |  |   65|    154|#define NON_ANNEX_B 1 /*!< Non Annex B RFC stream */
  ------------------
  |  Branch (1520:9): [True: 0, False: 154]
  ------------------
 1521|    154|            break;
 1522|      0|        default:
  ------------------
  |  Branch (1522:9): [True: 0, False: 154]
  ------------------
 1523|      0|            break;
 1524|    154|    }
 1525|       |
 1526|    154|    ps_nal_parse_ctxt->i4_input_bitstream_mode = i4_input_bitstream_mode;
 1527|       |
 1528|       |    /*-----------------------------------------------------------------------*/
 1529|       |    /*! Perform the picture level initialization                             */
 1530|       |    /*-----------------------------------------------------------------------*/
 1531|    154|    isvcd_pic_reset_ctxt(pv_nal_parse_ctxt);
 1532|       |
 1533|       |    /* Reset the prefix nal unit buffer structure */
 1534|    154|    isvcd_nal_buf_reset(&ps_nal_parse_ctxt->s_prefix_nal_buf);
 1535|       |
 1536|       |    /*-----------------------------------------------------------------------*/
 1537|       |    /*! Reset other varaibles                                                */
 1538|       |    /*-----------------------------------------------------------------------*/
 1539|    154|    ps_nal_parse_ctxt->i4_dec_frst_sc_flag = SVCD_TRUE;
  ------------------
  |  |   46|    154|#define SVCD_TRUE 1
  ------------------
 1540|    154|    ps_nal_parse_ctxt->i4_eos_flag = SVCD_FALSE;
  ------------------
  |  |   45|    154|#define SVCD_FALSE 0
  ------------------
 1541|    154|    ps_nal_parse_ctxt->u1_pic_boundary_aud_flag = 0;
 1542|    154|    ps_nal_parse_ctxt->u4_bytes_left = 0;
 1543|       |
 1544|       |    /* Reset target layer attributes */
 1545|    154|    {
 1546|    154|        target_lyr_attr_t *ps_app_attr;
 1547|    154|        target_lyr_attr_t *ps_int_attr;
 1548|       |
 1549|    154|        ps_app_attr = &ps_nal_parse_ctxt->s_app_attr;
 1550|    154|        ps_int_attr = &ps_nal_parse_ctxt->s_int_attr;
 1551|       |
 1552|    154|        ps_app_attr->i4_dependency_id = MAX_DEPENDENCY_ID;
  ------------------
  |  |  103|    154|#define MAX_DEPENDENCY_ID 4
  ------------------
 1553|    154|        ps_app_attr->i4_quality_id = MAX_QUALITY_ID;
  ------------------
  |  |  102|    154|#define MAX_QUALITY_ID 0
  ------------------
 1554|    154|        ps_app_attr->i4_temporal_id = MAX_TEMPORAL_ID;
  ------------------
  |  |  104|    154|#define MAX_TEMPORAL_ID 7
  ------------------
 1555|    154|        ps_app_attr->i4_priority_id = MAX_PRIORITY_ID;
  ------------------
  |  |  105|    154|#define MAX_PRIORITY_ID 63
  ------------------
 1556|       |
 1557|    154|        ps_int_attr->i4_dependency_id = -1;
 1558|    154|        ps_int_attr->i4_quality_id = MAX_QUALITY_ID;
  ------------------
  |  |  102|    154|#define MAX_QUALITY_ID 0
  ------------------
 1559|    154|        ps_int_attr->i4_temporal_id = 0;
 1560|    154|        ps_int_attr->i4_priority_id = MAX_PRIORITY_ID;
  ------------------
  |  |  105|    154|#define MAX_PRIORITY_ID 63
  ------------------
 1561|    154|    }
 1562|    154|}
isvcd_nal_parse_pic_bound_proc:
 1677|  5.97k|{
 1678|  5.97k|    WORD32 i4_status;
 1679|       |
 1680|  5.97k|    i4_status = isvcd_refine_dqid_list(ps_vcl_nal, ps_nal_parse_ctxt);
 1681|       |
 1682|       |    /* in case of IDR pictures if the node     */
 1683|       |    /* which has to be added into dependency   */
 1684|       |    /* list is not valied then the layer below */
 1685|       |    /* that node is set as target layer        */
 1686|       |
 1687|  5.97k|    if(NOT_OK == i4_status)
  ------------------
  |  |  116|  5.97k|#define NOT_OK    -1
  ------------------
  |  Branch (1687:8): [True: 1, False: 5.96k]
  ------------------
 1688|      1|    {
 1689|      1|        ps_nal_parse_ctxt->i4_discard_nal_flag = SVCD_TRUE;
  ------------------
  |  |   46|      1|#define SVCD_TRUE 1
  ------------------
 1690|      1|        ps_vcl_nal->i1_nal_ref_id_next = -1;
 1691|      1|    }
 1692|  5.96k|    else
 1693|  5.96k|    {
 1694|       |        /* update the next access unit params */
 1695|       |        /* will be used by lower level decoder*/
 1696|       |        /* for concealment of frame number    */
 1697|       |        /* applicable for single layer cases  */
 1698|  5.96k|        ps_vcl_nal->i1_nal_ref_id_next = ps_nal_prms->i4_nal_ref_idc;
 1699|       |
 1700|  5.96k|        ps_vcl_nal->u2_frm_num_next = ps_nal_prms->u2_frm_num;
 1701|  5.96k|    }
 1702|       |
 1703|       |    /* -------- reset few variables in context structure ----*/
 1704|  5.97k|    isvcd_pic_reset_ctxt(ps_nal_parse_ctxt);
 1705|  5.97k|}
isvcd_nal_parse_vcl_nal_partial:
 1741|  6.27k|{
 1742|       |    /*! - Search for the NAL boundary
 1743|       |        - If NAL boundary is not found and bytes consumed is lesser than
 1744|       |          minimum buffer size then break out of the loop
 1745|       |        - if it is start of NAL then read the NAL header
 1746|       |        - If it is a VCL NAL then invoke picture boundary detection logic and
 1747|       |          picture boundary is detected then break out of the loop without
 1748|       |          updating the bytes consumed variable
 1749|       |        - NAL discard logic determines whther the current NAL has to be
 1750|       |          discarded or not
 1751|       |        - If NAL is not discarded then populate the vcl or non vcl output
 1752|       |          structures
 1753|       |    */
 1754|  6.27k|    nal_parse_ctxt_t *ps_nal_parse_ctxt;
 1755|  6.27k|    vcl_nal_t *ps_vcl_nal;
 1756|  6.27k|    non_vcl_nal_t *ps_non_vcl_nal;
 1757|  6.27k|    nal_unit_t *ps_nal_unit;
 1758|  6.27k|    WORD32 i4_nal_start_flag, i4_cur_pos, i4_status;
 1759|  6.27k|    WORD32 i4_nal_header_len, i4_more_data_flag;
 1760|  6.27k|    UWORD32 u4_bytes_consumed_temp = 0;
 1761|  6.27k|    UWORD8 **ppu1_out_buf;
 1762|  6.27k|    nal_prms_t *ps_nal_prms;
 1763|  6.27k|    WORD32 i4_pic_bound_status;
 1764|       |
 1765|  6.27k|    ps_nal_parse_ctxt = (nal_parse_ctxt_t *) pv_nal_parse_ctxt;
 1766|  6.27k|    ps_vcl_nal = (vcl_nal_t *) pv_out_vcl_nal;
 1767|  6.27k|    ps_non_vcl_nal = (non_vcl_nal_t *) pv_out_non_vcl_nal;
 1768|  6.27k|    ps_nal_unit = (nal_unit_t *) ps_nal_parse_ctxt->pv_nal_unit;
 1769|  6.27k|    ps_nal_prms = &ps_nal_parse_ctxt->s_nal_prms;
 1770|       |
 1771|       |    /* Initialization */
 1772|  6.27k|    i4_cur_pos = 0;
 1773|  6.27k|    *pu4_bytes_consumed = 0;
 1774|  6.27k|    i4_nal_header_len = 0;
 1775|  6.27k|    i4_nal_start_flag = SVCD_FALSE;
  ------------------
  |  |   45|  6.27k|#define SVCD_FALSE 0
  ------------------
 1776|  6.27k|    i4_more_data_flag = SVCD_TRUE;
  ------------------
  |  |   46|  6.27k|#define SVCD_TRUE 1
  ------------------
 1777|  6.27k|    i4_pic_bound_status = PIC_BOUNDARY_FALSE;
 1778|       |
 1779|  6.27k|    ps_non_vcl_nal->i4_num_non_vcl_nals = ps_nal_parse_ctxt->i4_num_non_vcl_nals;
 1780|       |
 1781|       |    /* Since we do not perform the picture boundary detection */
 1782|       |    /* on the prefix NAL unit, the current picture's prefix   */
 1783|       |    /* NAL unit will be at the bottom of the buffer. Hence    */
 1784|       |    /* it should be copied to top of the buffer               */
 1785|  6.27k|    if(SVCD_TRUE == ps_nal_parse_ctxt->i4_is_frst_vcl_nal_in_au)
  ------------------
  |  |   46|  6.27k|#define SVCD_TRUE 1
  ------------------
  |  Branch (1785:8): [True: 6.14k, False: 128]
  ------------------
 1786|  6.14k|    {
 1787|  6.14k|        nal_buf_t *ps_prefix_nal_buf;
 1788|       |
 1789|  6.14k|        ps_prefix_nal_buf = &ps_nal_parse_ctxt->s_prefix_nal_buf;
 1790|  6.14k|        if(SVCD_TRUE == ps_prefix_nal_buf->i4_valid_flag)
  ------------------
  |  |   46|  6.14k|#define SVCD_TRUE 1
  ------------------
  |  Branch (1790:12): [True: 18, False: 6.13k]
  ------------------
 1791|     18|        {
 1792|     18|            WORD32 i4_buf_size;
 1793|     18|            UWORD8 *pu1_vcl_nal;
 1794|       |
 1795|     18|            if(ps_prefix_nal_buf->i4_buf_size > 0)
  ------------------
  |  Branch (1795:16): [True: 6, False: 12]
  ------------------
 1796|      6|            {
 1797|      6|                i4_buf_size = ps_prefix_nal_buf->i4_buf_size;
 1798|      6|                i4_buf_size = UP_ALIGN_8(i4_buf_size + BUFFER_ALIGN_4);
  ------------------
  |  |   51|      6|#define UP_ALIGN_8(x) (((((UWORD64) x) + 7) >> 3) << 3)
  ------------------
 1799|      6|            }
 1800|     12|            else
 1801|     12|            {
 1802|     12|                i4_buf_size = 0;
 1803|     12|            }
 1804|       |
 1805|     18|            pu1_vcl_nal = ps_nal_parse_ctxt->pu1_vcl_nal_buf + i4_buf_size;
 1806|       |
 1807|     18|            memmove(ps_nal_parse_ctxt->pu1_vcl_nal_buf, ps_prefix_nal_buf->pu1_buf, i4_buf_size);
 1808|     18|            ps_prefix_nal_buf->pu1_buf = ps_nal_parse_ctxt->pu1_vcl_nal_buf;
 1809|     18|            ps_nal_parse_ctxt->pu1_vcl_nal_buf = pu1_vcl_nal;
 1810|       |
 1811|       |            /* subtract the buffer size left */
 1812|     18|            ps_nal_parse_ctxt->u4_bytes_left_vcl -= i4_buf_size;
 1813|     18|        }
 1814|       |        /* Reset the top and bottom node */
 1815|  6.14k|        ps_vcl_nal->ps_top_node = NULL;
 1816|  6.14k|        ps_vcl_nal->ps_bot_node = NULL;
 1817|  6.14k|        ps_vcl_nal->i1_nal_ref_id_next = -1;
 1818|  6.14k|        ps_vcl_nal->u2_frm_num_next = 0;
 1819|  6.14k|    }
 1820|       |
 1821|       |    /* If number of bytes left in the previous process call  */
 1822|       |    /* is is greater or equal to number of bytes in input    */
 1823|       |    /* buffer of the current process call then declare that  */
 1824|       |    /* end of bitstream has occurred and consume the bytes   */
 1825|       |    /* but do not decode                                     */
 1826|  6.27k|    if(ps_nal_parse_ctxt->u4_bytes_left >= (UWORD32) *pu4_num_bytes)
  ------------------
  |  Branch (1826:8): [True: 0, False: 6.27k]
  ------------------
 1827|      0|    {
 1828|      0|        ps_nal_parse_ctxt->i4_discard_nal_flag = SVCD_TRUE;
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 1829|      0|        *pu4_bytes_consumed = *pu4_num_bytes;
 1830|       |
 1831|      0|        i4_status =
 1832|      0|            isvcd_nal_parse_partial_signal_eos(ps_nal_parse_ctxt, ps_vcl_nal, ps_non_vcl_nal);
 1833|       |        /* set the next AU params to default values */
 1834|      0|        ps_vcl_nal->i1_nal_ref_id_next = -1;
 1835|      0|        ps_vcl_nal->u2_frm_num_next = 0;
 1836|       |
 1837|      0|        return (i4_status);
 1838|      0|    }
 1839|  6.27k|    ps_nal_parse_ctxt->u4_bytes_left = 0;
 1840|       |
 1841|       |    /*************************************************************************/
 1842|       |    /*                      LOOP OVER NALs                                   */
 1843|       |    /*************************************************************************/
 1844|  6.27k|    do
 1845|  1.26M|    {
 1846|  1.26M|        nal_buf_t *ps_nal_buf;
 1847|  1.26M|        UWORD32 *pu4_bytes_left;
 1848|       |
 1849|       |        /* Find NAL boundary                */
 1850|  1.26M|        if(ANNEX_B == ps_nal_parse_ctxt->i4_input_bitstream_mode)
  ------------------
  |  |   64|  1.26M|#define ANNEX_B 0     /*!< Annex B stream*/
  ------------------
  |  Branch (1850:12): [True: 1.26M, False: 0]
  ------------------
 1851|  1.26M|        {
 1852|  1.26M|            i4_nal_start_flag = isvcd_get_annex_b_nal_unit(
 1853|  1.26M|                pu1_stream_buffer, i4_cur_pos, *pu4_num_bytes,
 1854|  1.26M|                &ps_nal_parse_ctxt->i4_find_nal_state, &ps_nal_parse_ctxt->i4_zero_byte_cnt,
 1855|  1.26M|                &u4_bytes_consumed_temp, ps_nal_parse_ctxt->pv_nal_unit, &i4_more_data_flag);
 1856|       |
 1857|  1.26M|            i4_cur_pos += u4_bytes_consumed_temp;
 1858|  1.26M|        }
 1859|       |
 1860|       |        /*********************************************************************/
 1861|       |        /*          READ NAL HEADER AND NAL DISCARD LOGIC                    */
 1862|       |        /*********************************************************************/
 1863|       |
 1864|       |        /* If it is the start of NAL header perform the following */
 1865|       |        /* 1. Decode NAL header                                   */
 1866|       |        /* 2. Determine whether the NAL has to be discarded or not*/
 1867|       |        /* 3. Detect the picture boundary                         */
 1868|  1.26M|        if(SVCD_TRUE == i4_nal_start_flag)
  ------------------
  |  |   46|  1.26M|#define SVCD_TRUE 1
  ------------------
  |  Branch (1868:12): [True: 1.26M, False: 227]
  ------------------
 1869|  1.26M|        {
 1870|  1.26M|            UWORD32 u4_err_code;
 1871|  1.26M|            WORD32 i4_sps_pps_corrupt_status;
 1872|  1.26M|            WORD32 i4_internal_dep_id_prev;
 1873|       |
 1874|       |            /* Get the NAL prms. This involves the following things*/
 1875|       |            /* 1. Decode the NAL header                            */
 1876|       |            /* 2. Set the discard flag                             */
 1877|       |            /* 3. Decode the slice header if needed                */
 1878|       |
 1879|       |            /* get the dependency id at which the NAl parse is currently */
 1880|       |            /* present */
 1881|  1.26M|            i4_internal_dep_id_prev = ps_nal_parse_ctxt->s_int_attr.i4_dependency_id;
 1882|       |
 1883|  1.26M|            i4_status = isvcd_get_nal_prms(
 1884|  1.26M|                ps_nal_unit->pu1_bufs, ps_nal_unit->i4_buf_sizes, ps_nal_prms,
 1885|  1.26M|                &ps_nal_parse_ctxt->s_prefix_nal_prms, &ps_nal_parse_ctxt->s_prefix_nal_buf,
 1886|  1.26M|                &u4_err_code, &i4_sps_pps_corrupt_status, &ps_nal_parse_ctxt->i4_discard_nal_flag,
 1887|  1.26M|                ps_nal_parse_ctxt);
 1888|       |
 1889|  1.26M|            if(NON_ANNEX_B == ps_nal_parse_ctxt->i4_input_bitstream_mode)
  ------------------
  |  |   65|  1.26M|#define NON_ANNEX_B 1 /*!< Non Annex B RFC stream */
  ------------------
  |  Branch (1889:16): [True: 0, False: 1.26M]
  ------------------
 1890|      0|            {
 1891|      0|                ps_nal_parse_ctxt->i4_prev_dq_id = ps_nal_prms->i4_dqid;
 1892|      0|            }
 1893|       |
 1894|       |            /* If the error code returned by the "picture boundary" */
 1895|       |            /* detetction is                                        */
 1896|       |            /* 1. Insufficient bitstream size: then store the bytes */
 1897|       |            /*    left and break out of the loop                    */
 1898|       |            /* 2. Corrupted slice: then discard the slice           */
 1899|  1.26M|            if((NAL_INSUFFICIENT_DATA == (WORD32) u4_err_code) &&
  ------------------
  |  Branch (1899:16): [True: 538, False: 1.26M]
  ------------------
 1900|    538|               (NAL_END != ps_nal_parse_ctxt->i4_find_nal_state))
  ------------------
  |  Branch (1900:16): [True: 0, False: 538]
  ------------------
 1901|      0|            {
 1902|      0|                ps_nal_parse_ctxt->u4_bytes_left = *pu4_num_bytes - *pu4_bytes_consumed;
 1903|       |
 1904|       |                /* Reset the NAL level tracking variables */
 1905|      0|                isvcd_nal_reset_ctxt(ps_nal_parse_ctxt);
 1906|      0|                break;
 1907|      0|            }
 1908|  1.26M|            else if(0 != u4_err_code)
  ------------------
  |  Branch (1908:21): [True: 16.1k, False: 1.25M]
  ------------------
 1909|  16.1k|            {
 1910|  16.1k|                ps_nal_parse_ctxt->i4_discard_nal_flag = SVCD_TRUE;
  ------------------
  |  |   46|  16.1k|#define SVCD_TRUE 1
  ------------------
 1911|       |
 1912|  16.1k|                if(SVCD_TRUE == ps_nal_prms->i4_idr_pic_flag)
  ------------------
  |  |   46|  16.1k|#define SVCD_TRUE 1
  ------------------
  |  Branch (1912:20): [True: 109, False: 16.0k]
  ------------------
 1913|    109|                {
 1914|       |                    /* IDR Error handler is called       */
 1915|       |                    /* only if for a given layer the NAL */
 1916|       |                    /* haeder and partial slice decode   */
 1917|       |                    /* routine comes out as no SPS PPS   */
 1918|       |                    /* error. But for Lowest layer in    */
 1919|       |                    /* access unit it is doen always     */
 1920|    109|                    if(i4_internal_dep_id_prev != ps_nal_parse_ctxt->s_int_attr.i4_dependency_id)
  ------------------
  |  Branch (1920:24): [True: 0, False: 109]
  ------------------
 1921|      0|                    {
 1922|       |                        /* if the target depedency id has been */
 1923|       |                        /* changed while decoding currnet NAL  */
 1924|       |
 1925|      0|                        if((0 != i4_sps_pps_corrupt_status) ||
  ------------------
  |  Branch (1925:28): [True: 0, False: 0]
  ------------------
 1926|      0|                           (-1 == ps_nal_parse_ctxt->i4_prev_dq_id))
  ------------------
  |  Branch (1926:28): [True: 0, False: 0]
  ------------------
 1927|      0|                        {
 1928|      0|                            i4_status =
 1929|      0|                                isvcd_idr_err_hdlr(ps_vcl_nal, ps_nal_prms, ps_nal_parse_ctxt);
 1930|      0|                            if(OK != i4_status)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (1930:32): [True: 0, False: 0]
  ------------------
 1931|      0|                            {
 1932|      0|                                return i4_status;
 1933|      0|                            }
 1934|      0|                            UNUSED(i4_status);
  ------------------
  |  |   45|      0|#define UNUSED(x) ((void)(x))
  ------------------
 1935|       |
 1936|      0|                            ps_nal_parse_ctxt->i4_tgt_lyr_update = SVCD_FALSE;
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
 1937|      0|                        }
 1938|      0|                        else
 1939|      0|                        {
 1940|      0|                            if(0 == ps_nal_prms->i4_quality_id)
  ------------------
  |  Branch (1940:32): [True: 0, False: 0]
  ------------------
 1941|      0|                            {
 1942|       |                                /* over write the frame number */
 1943|      0|                                ps_nal_parse_ctxt->s_nal_prms.u2_frm_num = 0;
 1944|       |
 1945|       |                                /* Get the previous layer's DQID */
 1946|      0|                                if(ps_nal_parse_ctxt->i4_prev_dq_id < ps_nal_prms->i4_dqid)
  ------------------
  |  Branch (1946:36): [True: 0, False: 0]
  ------------------
 1947|      0|                                {
 1948|      0|                                    ps_nal_parse_ctxt->i4_prev_dq_id = ps_nal_prms->i4_dqid;
 1949|      0|                                    ps_nal_parse_ctxt->i4_is_frst_vcl_nal_in_au = SVCD_FALSE;
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
 1950|      0|                                }
 1951|       |
 1952|       |                                /* update the nal context with the nal */
 1953|       |                                /* header params */
 1954|      0|                                isvcd_update_nal_ctxt(ps_nal_parse_ctxt, ps_vcl_nal,
 1955|      0|                                                      ps_non_vcl_nal);
 1956|      0|                            }
 1957|      0|                        }
 1958|      0|                    }
 1959|    109|                }
 1960|  16.1k|            }
 1961|       |
 1962|       |            /* Populate the derived nal type into bitstream extract*/
 1963|       |            /* context structure                                   */
 1964|  1.26M|            i4_nal_header_len = ps_nal_prms->i4_nal_header_len;
 1965|  1.26M|            ps_nal_parse_ctxt->i4_nal_type = ps_nal_prms->i4_derived_nal_type;
 1966|       |
 1967|       |            /* get the accumulated idr pic error flag */
 1968|  1.26M|            ps_nal_parse_ctxt->i4_idr_pic_err_flag |=
 1969|  1.26M|                ((SVCD_TRUE == ps_nal_prms->i4_idr_pic_flag) &&
  ------------------
  |  |   46|  1.26M|#define SVCD_TRUE 1
  ------------------
  |  Branch (1969:18): [True: 13.0k, False: 1.25M]
  ------------------
 1970|  13.0k|                 (SVCD_FALSE == ps_nal_parse_ctxt->i4_discard_nal_flag) &&
  ------------------
  |  |   45|  13.0k|#define SVCD_FALSE 0
  ------------------
  |  Branch (1970:18): [True: 12.5k, False: 493]
  ------------------
 1971|  12.5k|                 (i4_internal_dep_id_prev != ps_nal_parse_ctxt->s_int_attr.i4_dependency_id));
  ------------------
  |  Branch (1971:18): [True: 186, False: 12.3k]
  ------------------
 1972|       |
 1973|  1.26M|            if(ACCESS_UNIT_DELIMITER_RBSP == ps_nal_prms->i4_nal_unit_type)
  ------------------
  |  |  332|  1.26M|#define ACCESS_UNIT_DELIMITER_RBSP      9
  ------------------
  |  Branch (1973:16): [True: 122, False: 1.26M]
  ------------------
 1974|    122|            {
 1975|    122|                i4_pic_bound_status = PIC_BOUNDARY_TRUE;
 1976|    122|                ps_nal_parse_ctxt->u1_pic_boundary_aud_flag = 1;
 1977|       |                /* If picture boundary is detected then come out of  */
 1978|       |                /* the loop                                          */
 1979|    122|                if(PIC_BOUNDARY_TRUE == i4_pic_bound_status)
  ------------------
  |  Branch (1979:20): [True: 122, False: 0]
  ------------------
 1980|    122|                {
 1981|    122|                    isvcd_nal_parse_pic_bound_proc(ps_nal_parse_ctxt, ps_vcl_nal, ps_nal_prms);
 1982|    122|                    break;
 1983|    122|                }
 1984|    122|            }
 1985|       |            /* Perform the picture boundary detetction if all the  */
 1986|       |            /* following conditions are TRUE                       */
 1987|       |            /*  1. VCL NAL                                         */
 1988|       |            /*  2. Not a prefix NAL                                */
 1989|       |            /*  3. Not a discardable NAL                           */
 1990|  1.26M|            if((VCL_NAL == ps_nal_prms->i4_derived_nal_type) &&
  ------------------
  |  Branch (1990:16): [True: 17.4k, False: 1.24M]
  ------------------
 1991|  17.4k|               (PREFIX_UNIT_NAL != ps_nal_prms->i4_nal_unit_type) &&
  ------------------
  |  |   64|  17.4k|#define PREFIX_UNIT_NAL 14
  ------------------
  |  Branch (1991:16): [True: 17.4k, False: 58]
  ------------------
 1992|  17.4k|               (SVCD_FALSE == ps_nal_parse_ctxt->i4_discard_nal_flag))
  ------------------
  |  |   45|  17.4k|#define SVCD_FALSE 0
  ------------------
  |  Branch (1992:16): [True: 16.9k, False: 484]
  ------------------
 1993|  16.9k|            {
 1994|  16.9k|                if(ANNEX_B == ps_nal_parse_ctxt->i4_input_bitstream_mode)
  ------------------
  |  |   64|  16.9k|#define ANNEX_B 0     /*!< Annex B stream*/
  ------------------
  |  Branch (1994:20): [True: 16.9k, False: 0]
  ------------------
 1995|  16.9k|                {
 1996|  16.9k|                    ps_nal_parse_ctxt->u1_pic_boundary_aud_flag = 0;
 1997|       |
 1998|  16.9k|                    i4_status = isvcd_detect_pic_boundary_annex_b(ps_nal_prms, pu1_stream_buffer,
 1999|  16.9k|                                                                  i4_cur_pos, &i4_pic_bound_status,
 2000|  16.9k|                                                                  ps_nal_parse_ctxt, pu4_num_bytes);
 2001|  16.9k|                }
 2002|       |
 2003|       |                /* If picture boundary is detected then come out of  */
 2004|       |                /* the loop                                          */
 2005|  16.9k|                if(PIC_BOUNDARY_TRUE == i4_pic_bound_status)
  ------------------
  |  Branch (2005:20): [True: 5.84k, False: 11.1k]
  ------------------
 2006|  5.84k|                {
 2007|  5.84k|                    isvcd_nal_parse_pic_bound_proc(ps_nal_parse_ctxt, ps_vcl_nal, ps_nal_prms);
 2008|  5.84k|                    break;
 2009|  5.84k|                }
 2010|  16.9k|            }
 2011|       |
 2012|  1.26M|            if(SVCD_FALSE == ps_nal_parse_ctxt->i4_discard_nal_flag)
  ------------------
  |  |   45|  1.26M|#define SVCD_FALSE 0
  ------------------
  |  Branch (2012:16): [True: 1.24M, False: 16.6k]
  ------------------
 2013|  1.24M|            {
 2014|       |                /* Set the active NAL buffer structure and initialize */
 2015|       |                /* the nal buffer structure                           */
 2016|  1.24M|                isvcd_get_nal_buf(ps_nal_parse_ctxt, &ps_nal_buf);
 2017|  1.24M|                ps_nal_parse_ctxt->ps_nal_buf = ps_nal_buf;
 2018|  1.24M|            }
 2019|  16.6k|            else
 2020|  16.6k|            {
 2021|  16.6k|                ps_nal_parse_ctxt->ps_nal_buf = NULL;
 2022|  16.6k|            }
 2023|  1.26M|        }
 2024|       |
 2025|       |        /*-------------------------------------------------------------------*/
 2026|       |        /* In RFC based bitstreams, this is a dummy update (in this mode, the*/
 2027|       |        /* bytes consumed updation is done by picture boundary dectection    */
 2028|       |        /* But for Annex B based streams this is valid update                */
 2029|       |        /*-------------------------------------------------------------------*/
 2030|  1.26M|        *pu4_bytes_consumed += u4_bytes_consumed_temp;
 2031|       |
 2032|       |        /*********************************************************************/
 2033|       |        /*          EMULATION PREVENTION AND BYTE SWAPPING                   */
 2034|       |        /*********************************************************************/
 2035|       |
 2036|       |        /* Determine output buffer */
 2037|  1.26M|        ps_nal_buf = ps_nal_parse_ctxt->ps_nal_buf;
 2038|       |
 2039|  1.26M|        if(VCL_NAL == ps_nal_parse_ctxt->i4_nal_type)
  ------------------
  |  Branch (2039:12): [True: 11.6k, False: 1.24M]
  ------------------
 2040|  11.6k|        {
 2041|  11.6k|            ppu1_out_buf = &ps_nal_parse_ctxt->pu1_vcl_nal_buf;
 2042|  11.6k|            pu4_bytes_left = &ps_nal_parse_ctxt->u4_bytes_left_vcl;
 2043|  11.6k|            if(*pu4_bytes_left < (MAX_VCL_NAL_BUFF_SIZE * 0.05))
  ------------------
  |  |   69|  11.6k|#define MAX_VCL_NAL_BUFF_SIZE (1024 * 1024 * 2)
  ------------------
  |  Branch (2043:16): [True: 0, False: 11.6k]
  ------------------
 2044|      0|            {
 2045|      0|                return (VCL_NAL_FOUND_FALSE);
 2046|      0|            }
 2047|  11.6k|        }
 2048|  1.24M|        else
 2049|  1.24M|        {
 2050|  1.24M|            ppu1_out_buf = &ps_nal_parse_ctxt->pu1_non_vcl_nal_buf;
 2051|  1.24M|            pu4_bytes_left = &ps_nal_parse_ctxt->u4_bytes_left_non_vcl;
 2052|  1.24M|            if(*pu4_bytes_left < (MAX_NON_VCL_NAL_BUFF_SIZE * 0.05))
  ------------------
  |  |   70|  1.24M|#define MAX_NON_VCL_NAL_BUFF_SIZE (1024 * 1024 * 2)
  ------------------
  |  Branch (2052:16): [True: 233, False: 1.24M]
  ------------------
 2053|    233|            {
 2054|    233|                return (VCL_NAL_FOUND_FALSE);
 2055|    233|            }
 2056|  1.24M|        }
 2057|       |
 2058|       |        /* if 0 bytes left then discard the current NAL */
 2059|  1.26M|        if(0 >= (WORD32) *pu4_bytes_left)
  ------------------
  |  Branch (2059:12): [True: 0, False: 1.26M]
  ------------------
 2060|      0|        {
 2061|      0|            ps_nal_parse_ctxt->i4_discard_nal_flag = SVCD_TRUE;
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 2062|      0|        }
 2063|       |
 2064|       |        /* Perform the emulation prevention and byte swap */
 2065|  1.26M|        if(SVCD_FALSE == ps_nal_parse_ctxt->i4_discard_nal_flag)
  ------------------
  |  |   45|  1.26M|#define SVCD_FALSE 0
  ------------------
  |  Branch (2065:12): [True: 1.24M, False: 16.6k]
  ------------------
 2066|  1.24M|        {
 2067|  1.24M|            UWORD32 u4_output_bytes, u4_buf_inc;
 2068|       |
 2069|       |            /* Do emulation prevention and byte swapping on all the packets  */
 2070|       |            /* of RFC or current partial or full Annex B NAL unit            */
 2071|  1.24M|            {
 2072|  1.24M|                UWORD32 u4_buf_size;
 2073|       |
 2074|       |                /* clip the size before emulation prevention */
 2075|  1.24M|                u4_buf_size = (UWORD32) CLIP3(0, (WORD32) *pu4_bytes_left,
  ------------------
  |  |   77|  1.24M|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 0, False: 1.24M]
  |  |  |  Branch (77:54): [True: 1, False: 1.24M]
  |  |  ------------------
  ------------------
 2076|  1.24M|                                              (ps_nal_unit->i4_buf_sizes - i4_nal_header_len));
 2077|       |
 2078|  1.24M|                u4_buf_inc = isvcd_nal_byte_swap_emulation(
 2079|  1.24M|                    (UWORD32 *) *ppu1_out_buf, &u4_output_bytes,
 2080|  1.24M|                    ps_nal_unit->pu1_bufs + i4_nal_header_len, u4_buf_size,
 2081|  1.24M|                    NUM_OF_ZERO_BYTES_BEFORE_START_CODE, &ps_nal_parse_ctxt->s_emulation_ctxt);
  ------------------
  |  |   54|  1.24M|#define NUM_OF_ZERO_BYTES_BEFORE_START_CODE (2)
  ------------------
 2082|       |
 2083|  1.24M|                i4_nal_header_len = 0;
 2084|  1.24M|                u4_buf_inc = UP_ALIGN_8(u4_buf_inc);
  ------------------
  |  |   51|  1.24M|#define UP_ALIGN_8(x) (((((UWORD64) x) + 7) >> 3) << 3)
  ------------------
 2085|  1.24M|                *ppu1_out_buf += u4_buf_inc;
 2086|  1.24M|                *pu4_bytes_left -= u4_buf_inc;
 2087|  1.24M|                ps_nal_buf->i4_buf_size += u4_output_bytes;
 2088|  1.24M|            }
 2089|  1.24M|        }
 2090|       |
 2091|       |        /*********************************************************************/
 2092|       |        /*                UPDATE VARIABLES                                   */
 2093|       |        /*********************************************************************/
 2094|  1.26M|        if(NAL_END == ps_nal_parse_ctxt->i4_find_nal_state)
  ------------------
  |  Branch (2094:12): [True: 1.26M, False: 73]
  ------------------
 2095|  1.26M|        {
 2096|  1.26M|            if(SVCD_FALSE == ps_nal_parse_ctxt->i4_discard_nal_flag)
  ------------------
  |  |   45|  1.26M|#define SVCD_FALSE 0
  ------------------
  |  Branch (2096:16): [True: 1.24M, False: 16.5k]
  ------------------
 2097|  1.24M|            {
 2098|       |                /* This fucntions updates output nal ctxt - vcl nal structure*/
 2099|       |                /* and non vcl nal structure depending upon the current NAL  */
 2100|       |                /* type.                                                     */
 2101|       |                /* This will only update parameters which are available at   */
 2102|       |                /* end of NAL unit like nal unit's total size                */
 2103|  1.24M|                isvcd_update_nal_ctxt(ps_nal_parse_ctxt, ps_vcl_nal, ps_non_vcl_nal);
 2104|       |
 2105|  1.24M|                UPDATE_NAL_BUF_PTR(ppu1_out_buf, ps_nal_prms->i4_derived_nal_type, pu4_bytes_left);
 2106|  1.24M|            }
 2107|       |
 2108|       |            /* If the prefix NAL unit is not immediatly followed by */
 2109|       |            /* a AVC NAL unit it shall be discarded and hence reset */
 2110|       |            /* is done                                              */
 2111|       |            /* Also if prefix NAL unit is discarded then we should  */
 2112|       |            /* not associate the prefix NAL unit with AVC NAL unit  */
 2113|       |            /* and hence a reset is required                        */
 2114|  1.26M|            if((PREFIX_UNIT_NAL != ps_nal_prms->i4_nal_unit_type) ||
  ------------------
  |  |   64|  1.26M|#define PREFIX_UNIT_NAL 14
  ------------------
  |  Branch (2114:16): [True: 1.26M, False: 441]
  ------------------
 2115|    441|               (SVCD_TRUE == ps_nal_parse_ctxt->i4_discard_nal_flag))
  ------------------
  |  |   46|    441|#define SVCD_TRUE 1
  ------------------
  |  Branch (2115:16): [True: 394, False: 47]
  ------------------
 2116|  1.26M|            {
 2117|  1.26M|                isvcd_nal_buf_reset(&ps_nal_parse_ctxt->s_prefix_nal_buf);
 2118|  1.26M|            }
 2119|       |
 2120|       |            /* Reset the nal level tracking variables */
 2121|  1.26M|            isvcd_nal_reset_ctxt(ps_nal_parse_ctxt);
 2122|  1.26M|        }
 2123|       |
 2124|       |        /*------------- while loop ends here --------------------------------*/
 2125|  1.26M|    } while(SVCD_TRUE == i4_more_data_flag);
  ------------------
  |  |   46|  1.26M|#define SVCD_TRUE 1
  ------------------
  |  Branch (2125:13): [True: 1.26M, False: 73]
  ------------------
 2126|       |
 2127|  6.04k|    return (i4_pic_bound_status);
 2128|  6.27k|}
isvcd_nal_parse_non_vcl_nal:
 2164|  2.95k|{
 2165|       |    /*! - Search for the NAL boundary
 2166|       |        - If NAL boundary is not found and bytes consumed is lesser than
 2167|       |          minimum buffer size then break out of the loop
 2168|       |        - if it is start of NAL then read the NAL header
 2169|       |        - If it is a VCL NAL then return from this fucntion saying that
 2170|       |          VCL NAL found
 2171|       |        - NAL discard logic determines whther the current NAL has to be
 2172|       |          discarded or not
 2173|       |        - If NAL is not discarded then populate the vcl or non vcl output
 2174|       |          structures
 2175|       |    */
 2176|       |
 2177|  2.95k|    nal_parse_ctxt_t *ps_nal_parse_ctxt;
 2178|  2.95k|    non_vcl_nal_t *ps_non_vcl_nal;
 2179|  2.95k|    nal_unit_t *ps_nal_unit;
 2180|  2.95k|    WORD32 i4_nal_start_flag, i4_cur_pos, i4_status;
 2181|  2.95k|    WORD32 i4_nal_header_len, i4_more_data_flag;
 2182|  2.95k|    UWORD32 u4_bytes_consumed_temp = 0;
 2183|  2.95k|    UWORD8 **ppu1_out_buf;
 2184|  2.95k|    nal_prms_t *ps_nal_prms;
 2185|       |
 2186|  2.95k|    ps_nal_parse_ctxt = (nal_parse_ctxt_t *) pv_nal_parse_ctxt;
 2187|  2.95k|    ps_non_vcl_nal = (non_vcl_nal_t *) pv_out_non_vcl_nal;
 2188|  2.95k|    ps_nal_unit = (nal_unit_t *) ps_nal_parse_ctxt->pv_nal_unit;
 2189|  2.95k|    ps_nal_prms = &ps_nal_parse_ctxt->s_nal_prms;
 2190|       |
 2191|       |    /* Initialization */
 2192|  2.95k|    i4_cur_pos = 0;
 2193|  2.95k|    *pu4_bytes_consumed = 0;
 2194|  2.95k|    i4_nal_header_len = 0;
 2195|  2.95k|    i4_nal_start_flag = SVCD_FALSE;
  ------------------
  |  |   45|  2.95k|#define SVCD_FALSE 0
  ------------------
 2196|  2.95k|    i4_more_data_flag = SVCD_TRUE;
  ------------------
  |  |   46|  2.95k|#define SVCD_TRUE 1
  ------------------
 2197|  2.95k|    i4_status = PIC_BOUNDARY_FALSE;
 2198|       |
 2199|       |    /* reset the target layer update flag */
 2200|  2.95k|    ps_nal_parse_ctxt->i4_tgt_lyr_update = SVCD_FALSE;
  ------------------
  |  |   45|  2.95k|#define SVCD_FALSE 0
  ------------------
 2201|       |    /*************************************************************************/
 2202|       |    /*              SEARCHING FOR THE START OF BITSTREAM                     */
 2203|       |    /*************************************************************************/
 2204|       |
 2205|       |    /*-----------------------------------------------------------------------*/
 2206|       |    /* For Annex B based bitstreams the first start code has to decoded      */
 2207|       |    /* The first start code can come after multiple process call also. This  */
 2208|       |    /* has to be carefully handled                                           */
 2209|       |    /*-----------------------------------------------------------------------*/
 2210|       |
 2211|  2.95k|    if(ANNEX_B == ps_nal_parse_ctxt->i4_input_bitstream_mode &&
  ------------------
  |  |   64|  2.95k|#define ANNEX_B 0     /*!< Annex B stream*/
  ------------------
  |  Branch (2211:8): [True: 2.95k, False: 0]
  ------------------
 2212|  2.95k|       SVCD_TRUE == ps_nal_parse_ctxt->i4_dec_frst_sc_flag)
  ------------------
  |  |   46|  2.95k|#define SVCD_TRUE 1
  ------------------
  |  Branch (2212:8): [True: 157, False: 2.80k]
  ------------------
 2213|    157|    {
 2214|    157|        WORD32 i4_status;
 2215|       |
 2216|    157|        i4_status =
 2217|    157|            isvcd_get_first_start_code(pu1_stream_buffer, pu4_bytes_consumed, pu4_num_bytes);
 2218|       |
 2219|       |        /*-------------------------------------------------------------------*/
 2220|       |        /* If start code found then proceed with bitstream extraction        */
 2221|       |        /*-------------------------------------------------------------------*/
 2222|       |
 2223|    157|        if(i4_status == SC_NOT_FOUND)
  ------------------
  |  |   51|    157|#define SC_NOT_FOUND (-1)
  ------------------
  |  Branch (2223:12): [True: 6, False: 151]
  ------------------
 2224|      6|        {
 2225|      6|            return (VCL_NAL_FOUND_FALSE);
 2226|      6|        }
 2227|       |
 2228|    151|        i4_cur_pos = *pu4_bytes_consumed;
 2229|    151|        ps_nal_parse_ctxt->i4_dec_frst_sc_flag = SVCD_FALSE;
  ------------------
  |  |   45|    151|#define SVCD_FALSE 0
  ------------------
 2230|    151|    }
 2231|       |
 2232|       |    /* If number of bytes left in the previous process call  */
 2233|       |    /* is is greater or equal to number of bytes in input    */
 2234|       |    /* buffer of the current process call then declare that  */
 2235|       |    /* end of bitstream has occurred and consume the bytes   */
 2236|       |    /* but do not decode                                     */
 2237|  2.95k|    if(ps_nal_parse_ctxt->u4_bytes_left >= (UWORD32) *pu4_num_bytes)
  ------------------
  |  Branch (2237:8): [True: 0, False: 2.95k]
  ------------------
 2238|      0|    {
 2239|      0|        ps_nal_parse_ctxt->i4_discard_nal_flag = SVCD_TRUE;
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 2240|      0|        *pu4_bytes_consumed = *pu4_num_bytes;
 2241|       |
 2242|      0|        i4_status = isvcd_nal_parse_partial_signal_eos(ps_nal_parse_ctxt, NULL, ps_non_vcl_nal);
 2243|      0|        return (i4_status);
 2244|      0|    }
 2245|       |
 2246|  2.95k|    do
 2247|  1.78M|    {
 2248|  1.78M|        nal_buf_t *ps_nal_buf;
 2249|  1.78M|        UWORD32 *pu4_bytes_left;
 2250|       |
 2251|       |        /*********************************************************************/
 2252|       |        /*                  NAL BOUNDARY DETECTION                           */
 2253|       |        /*********************************************************************/
 2254|       |        /*-------------------------------------------------------------------*/
 2255|       |        /* Detect NAL boundary                                               */
 2256|       |        /* After return,  this NAL boundary detetction logic might be in     */
 2257|       |        /* one of following states:                                          */
 2258|       |        /*  - NAL_START                                                      */
 2259|       |        /*  - FIND_NAL_END                                                   */
 2260|       |        /*  - NAL_END                                                        */
 2261|       |        /*-------------------------------------------------------------------*/
 2262|  1.78M|        if(ANNEX_B == ps_nal_parse_ctxt->i4_input_bitstream_mode)
  ------------------
  |  |   64|  1.78M|#define ANNEX_B 0     /*!< Annex B stream*/
  ------------------
  |  Branch (2262:12): [True: 1.78M, False: 0]
  ------------------
 2263|  1.78M|        {
 2264|  1.78M|            i4_nal_start_flag = isvcd_get_annex_b_nal_unit(
 2265|  1.78M|                pu1_stream_buffer, i4_cur_pos, *pu4_num_bytes,
 2266|  1.78M|                &ps_nal_parse_ctxt->i4_find_nal_state, &ps_nal_parse_ctxt->i4_zero_byte_cnt,
 2267|  1.78M|                &u4_bytes_consumed_temp, ps_nal_parse_ctxt->pv_nal_unit, &i4_more_data_flag);
 2268|       |
 2269|  1.78M|            i4_cur_pos += u4_bytes_consumed_temp;
 2270|  1.78M|        }
 2271|       |
 2272|       |        /* If current NAL unit is start of new NAL unit then parse the NAL
 2273|       |            header. If the current NAL unit type is VCL NAL then return from
 2274|       |            this function. otherwise apply NAL discard logic and discard the
 2275|       |            NAL if discard NAL flag is true                                  */
 2276|       |
 2277|  1.78M|        if(SVCD_TRUE == i4_nal_start_flag)
  ------------------
  |  |   46|  1.78M|#define SVCD_TRUE 1
  ------------------
  |  Branch (2277:12): [True: 1.78M, False: 339]
  ------------------
 2278|  1.78M|        {
 2279|  1.78M|            UWORD32 u4_err_code;
 2280|  1.78M|            WORD32 i4_sps_pps_corrupt_status;
 2281|       |
 2282|       |            /* Get the NAL prms. This involves the following things*/
 2283|       |            /* 1. Decode the NAL header                            */
 2284|       |            /* 2. Set the discard flag                             */
 2285|       |            /* 3. Decode the slice header if needed                */
 2286|  1.78M|            isvcd_get_nal_prms(ps_nal_unit->pu1_bufs, ps_nal_unit->i4_buf_sizes, ps_nal_prms,
 2287|  1.78M|                               &ps_nal_parse_ctxt->s_prefix_nal_prms,
 2288|  1.78M|                               &ps_nal_parse_ctxt->s_prefix_nal_buf, &u4_err_code,
 2289|  1.78M|                               &i4_sps_pps_corrupt_status, &ps_nal_parse_ctxt->i4_discard_nal_flag,
 2290|  1.78M|                               ps_nal_parse_ctxt);
 2291|       |            /* If the error code returned by the "picture boundary" */
 2292|       |            /* detetction is                                        */
 2293|       |            /* 1. Insufficient bitstream size: then store the bytes */
 2294|       |            /*    left and break out of the loop                    */
 2295|       |            /* 2. Corrupted slice: then discard the slice           */
 2296|  1.78M|            if((NAL_INSUFFICIENT_DATA == (WORD32) u4_err_code) &&
  ------------------
  |  Branch (2296:16): [True: 254, False: 1.78M]
  ------------------
 2297|    254|               (NAL_END != ps_nal_parse_ctxt->i4_find_nal_state))
  ------------------
  |  Branch (2297:16): [True: 4, False: 250]
  ------------------
 2298|      4|            {
 2299|      4|                ps_nal_parse_ctxt->u4_bytes_left = *pu4_num_bytes - *pu4_bytes_consumed;
 2300|       |
 2301|       |                /* Reset the NAL level tracking variables */
 2302|      4|                isvcd_nal_reset_ctxt(ps_nal_parse_ctxt);
 2303|      4|                break;
 2304|      4|            }
 2305|  1.78M|            else if(0 != u4_err_code)
  ------------------
  |  Branch (2305:21): [True: 12.2k, False: 1.77M]
  ------------------
 2306|  12.2k|            {
 2307|  12.2k|                ps_nal_parse_ctxt->i4_discard_nal_flag = SVCD_TRUE;
  ------------------
  |  |   46|  12.2k|#define SVCD_TRUE 1
  ------------------
 2308|  12.2k|            }
 2309|       |
 2310|       |            /* Populate other paramters based on the nal prms */
 2311|  1.78M|            ps_nal_parse_ctxt->i4_nal_type = ps_nal_prms->i4_derived_nal_type;
 2312|  1.78M|            i4_nal_header_len = ps_nal_prms->i4_nal_header_len;
 2313|       |
 2314|       |            /* If derived NAL unit is VCL_NAL then return from this function */
 2315|  1.78M|            if(VCL_NAL == ps_nal_prms->i4_derived_nal_type &&
  ------------------
  |  Branch (2315:16): [True: 2.58k, False: 1.78M]
  ------------------
 2316|  2.58k|               PREFIX_UNIT_NAL != ps_nal_prms->i4_nal_unit_type)
  ------------------
  |  |   64|  2.58k|#define PREFIX_UNIT_NAL 14
  ------------------
  |  Branch (2316:16): [True: 2.57k, False: 9]
  ------------------
 2317|  2.57k|            {
 2318|  2.57k|                isvcd_pic_reset_ctxt(ps_nal_parse_ctxt);
 2319|       |
 2320|  2.57k|                return (VCL_NAL_FOUND_TRUE);
 2321|  2.57k|            }
 2322|       |
 2323|       |            /* Set the active NAL buffer structure and initialize */
 2324|       |            /* the nal buffer structure                           */
 2325|  1.78M|            isvcd_get_nal_buf(ps_nal_parse_ctxt, &ps_nal_buf);
 2326|       |
 2327|  1.78M|            ps_nal_parse_ctxt->ps_nal_buf = ps_nal_buf;
 2328|  1.78M|        }
 2329|       |
 2330|       |        /* Update the bytes consumed variable */
 2331|       |
 2332|  1.78M|        *pu4_bytes_consumed += u4_bytes_consumed_temp;
 2333|       |
 2334|  1.78M|        ps_nal_buf = ps_nal_parse_ctxt->ps_nal_buf;
 2335|  1.78M|        if(VCL_NAL == ps_nal_parse_ctxt->i4_nal_type)
  ------------------
  |  Branch (2335:12): [True: 9, False: 1.78M]
  ------------------
 2336|      9|        {
 2337|      9|            ppu1_out_buf = &ps_nal_parse_ctxt->pu1_vcl_nal_buf;
 2338|      9|            pu4_bytes_left = &ps_nal_parse_ctxt->u4_bytes_left_vcl;
 2339|      9|            if(*pu4_bytes_left < (MAX_VCL_NAL_BUFF_SIZE * 0.05))
  ------------------
  |  |   69|      9|#define MAX_VCL_NAL_BUFF_SIZE (1024 * 1024 * 2)
  ------------------
  |  Branch (2339:16): [True: 0, False: 9]
  ------------------
 2340|      0|            {
 2341|      0|                return (VCL_NAL_FOUND_FALSE);
 2342|      0|            }
 2343|      9|        }
 2344|  1.78M|        else
 2345|  1.78M|        {
 2346|  1.78M|            ppu1_out_buf = &ps_nal_parse_ctxt->pu1_non_vcl_nal_buf;
 2347|  1.78M|            pu4_bytes_left = &ps_nal_parse_ctxt->u4_bytes_left_non_vcl;
 2348|  1.78M|            if(*pu4_bytes_left < (MAX_NON_VCL_NAL_BUFF_SIZE * 0.05))
  ------------------
  |  |   70|  1.78M|#define MAX_NON_VCL_NAL_BUFF_SIZE (1024 * 1024 * 2)
  ------------------
  |  Branch (2348:16): [True: 349, False: 1.78M]
  ------------------
 2349|    349|            {
 2350|    349|                return (VCL_NAL_FOUND_FALSE);
 2351|    349|            }
 2352|  1.78M|        }
 2353|       |
 2354|       |        /* if 0 bytes left then discard the current NAL */
 2355|  1.78M|        if(0 >= (WORD32) *pu4_bytes_left)
  ------------------
  |  Branch (2355:12): [True: 0, False: 1.78M]
  ------------------
 2356|      0|        {
 2357|      0|            ps_nal_parse_ctxt->i4_discard_nal_flag = SVCD_TRUE;
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 2358|      0|        }
 2359|       |
 2360|       |        /* If NAL is not discarded then :
 2361|       |            1) Perform emulation prevention and byte swapping on the RBSP data
 2362|       |            2) Update the NAL unit ctxt:
 2363|       |                a) If VCL NAL then update DQID list
 2364|       |                b) If NON VCL NAL then update the non vcl output structure   */
 2365|       |
 2366|  1.78M|        if(SVCD_FALSE == ps_nal_parse_ctxt->i4_discard_nal_flag)
  ------------------
  |  |   45|  1.78M|#define SVCD_FALSE 0
  ------------------
  |  Branch (2366:12): [True: 1.76M, False: 12.3k]
  ------------------
 2367|  1.76M|        {
 2368|  1.76M|            UWORD32 u4_output_bytes, u4_buf_inc;
 2369|       |
 2370|  1.76M|            {
 2371|  1.76M|                UWORD32 u4_buf_size;
 2372|       |
 2373|       |                /* clip the size before emulation prevention */
 2374|  1.76M|                u4_buf_size = (UWORD32) CLIP3(0, (WORD32) *pu4_bytes_left,
  ------------------
  |  |   77|  1.76M|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 0, False: 1.76M]
  |  |  |  Branch (77:54): [True: 3, False: 1.76M]
  |  |  ------------------
  ------------------
 2375|  1.76M|                                              (ps_nal_unit->i4_buf_sizes - i4_nal_header_len));
 2376|       |
 2377|  1.76M|                u4_buf_inc = isvcd_nal_byte_swap_emulation(
 2378|  1.76M|                    (UWORD32 *) *ppu1_out_buf, &u4_output_bytes,
 2379|  1.76M|                    ps_nal_unit->pu1_bufs + i4_nal_header_len, u4_buf_size,
 2380|  1.76M|                    NUM_OF_ZERO_BYTES_BEFORE_START_CODE, &ps_nal_parse_ctxt->s_emulation_ctxt);
  ------------------
  |  |   54|  1.76M|#define NUM_OF_ZERO_BYTES_BEFORE_START_CODE (2)
  ------------------
 2381|  1.76M|                i4_nal_header_len = 0;
 2382|       |
 2383|  1.76M|                u4_buf_inc = UP_ALIGN_8(u4_buf_inc);
  ------------------
  |  |   51|  1.76M|#define UP_ALIGN_8(x) (((((UWORD64) x) + 7) >> 3) << 3)
  ------------------
 2384|  1.76M|                *ppu1_out_buf += u4_buf_inc;
 2385|  1.76M|                *pu4_bytes_left -= u4_buf_inc;
 2386|  1.76M|                ps_nal_buf->i4_buf_size += u4_output_bytes;
 2387|  1.76M|            }
 2388|  1.76M|        }
 2389|       |
 2390|       |        /*********************************************************************/
 2391|       |        /*                UPDATE VARIABLES                                   */
 2392|       |        /*********************************************************************/
 2393|       |
 2394|  1.78M|        if(NAL_END == ps_nal_parse_ctxt->i4_find_nal_state)
  ------------------
  |  Branch (2394:12): [True: 1.78M, False: 27]
  ------------------
 2395|  1.78M|        {
 2396|       |            /*---------------------------------------------------------------*/
 2397|       |            /* - Update the total bits in the NAL. While doing so bits       */
 2398|       |            /* calculated so far should be converted to SODB length          */
 2399|       |            /*---------------------------------------------------------------*/
 2400|  1.78M|            if(SVCD_FALSE == ps_nal_parse_ctxt->i4_discard_nal_flag)
  ------------------
  |  |   45|  1.78M|#define SVCD_FALSE 0
  ------------------
  |  Branch (2400:16): [True: 1.76M, False: 12.3k]
  ------------------
 2401|  1.76M|            {
 2402|  1.76M|                isvcd_update_nal_ctxt(ps_nal_parse_ctxt, NULL, ps_non_vcl_nal);
 2403|       |
 2404|  1.76M|                UPDATE_NAL_BUF_PTR(ppu1_out_buf, ps_nal_prms->i4_derived_nal_type, pu4_bytes_left);
 2405|  1.76M|            }
 2406|       |
 2407|       |            /* If the prefix NAL unit is not immediatly followed by */
 2408|       |            /* a AVC NAL unit it shall be discarded and hence reset */
 2409|       |            /* is done                                              */
 2410|       |            /* Also if prefix NAL unit is discarded then we should  */
 2411|       |            /* not associate the prefix NAL unit with AVC NAL unit  */
 2412|       |            /* and hence a reset is required                        */
 2413|  1.78M|            if((PREFIX_UNIT_NAL != ps_nal_prms->i4_nal_unit_type) ||
  ------------------
  |  |   64|  1.78M|#define PREFIX_UNIT_NAL 14
  ------------------
  |  Branch (2413:16): [True: 1.78M, False: 235]
  ------------------
 2414|    235|               (SVCD_TRUE == ps_nal_parse_ctxt->i4_discard_nal_flag))
  ------------------
  |  |   46|    235|#define SVCD_TRUE 1
  ------------------
  |  Branch (2414:16): [True: 231, False: 4]
  ------------------
 2415|  1.78M|            {
 2416|  1.78M|                isvcd_nal_buf_reset(&ps_nal_parse_ctxt->s_prefix_nal_buf);
 2417|  1.78M|            }
 2418|       |
 2419|       |            /* Reset NAL level tracking variables */
 2420|  1.78M|            isvcd_nal_reset_ctxt(ps_nal_parse_ctxt);
 2421|  1.78M|        }
 2422|       |
 2423|  1.78M|        i4_nal_header_len = 0;
 2424|       |        /*------------- while loop ends here --------------------------------*/
 2425|  1.78M|    } while(SVCD_TRUE == i4_more_data_flag);
  ------------------
  |  |   46|  1.78M|#define SVCD_TRUE 1
  ------------------
  |  Branch (2425:13): [True: 1.78M, False: 27]
  ------------------
 2426|       |
 2427|     31|    if(i4_more_data_flag == 0)
  ------------------
  |  Branch (2427:8): [True: 31, False: 0]
  ------------------
 2428|     31|    {
 2429|     31|        isvcd_pic_reset_ctxt(ps_nal_parse_ctxt);
 2430|     31|        return (VCL_NAL_FOUND_TRUE);
 2431|     31|    }
 2432|       |
 2433|      0|    return (VCL_NAL_FOUND_FALSE);
 2434|     31|}

isvcd_nal_parse.c:UPDATE_NAL_BUF_PTR:
   86|  3.03M|{
   87|  3.03M|    UWORD8 *pu1_buf_ptr;
   88|  3.03M|    UWORD64 u4_inc;
   89|       |
   90|       |    /* Align the start of the structure */
   91|       |
   92|  3.03M|    pu1_buf_ptr = *ppu1_buf;
   93|       |
   94|       |    /* Account for the vcl or non-vcl header */
   95|  3.03M|    u4_inc = GET_NAL_BUF_INC(i4_derived_nal_type);
   96|  3.03M|    u4_inc = UP_ALIGN_8(u4_inc);
  ------------------
  |  |   51|  3.03M|#define UP_ALIGN_8(x) (((((UWORD64) x) + 7) >> 3) << 3)
  ------------------
   97|  3.03M|    pu1_buf_ptr += u4_inc;
   98|       |
   99|       |    /* Update the pointers */
  100|  3.03M|    if(*pu4_bytes_left >= u4_inc)
  ------------------
  |  Branch (100:8): [True: 3.03M, False: 4]
  ------------------
  101|  3.03M|    {
  102|  3.03M|        *pu4_bytes_left -= u4_inc;
  103|  3.03M|    }
  104|  3.03M|    *ppu1_buf = pu1_buf_ptr;
  105|  3.03M|}
isvcd_nal_parse.c:GET_NAL_BUF_INC:
   68|  9.06M|{
   69|  9.06M|    UWORD32 u4_buf_inc;
   70|       |
   71|  9.06M|    if(VCL_NAL == i4_derived_nal_type)
  ------------------
  |  Branch (71:8): [True: 41.9k, False: 9.01M]
  ------------------
   72|  41.9k|    {
   73|  41.9k|        u4_buf_inc = sizeof(vcl_buf_hdr_t);
   74|  41.9k|    }
   75|  9.01M|    else
   76|  9.01M|    {
   77|  9.01M|        u4_buf_inc = sizeof(non_vcl_buf_hdr_t);
   78|  9.01M|    }
   79|       |
   80|  9.06M|    u4_buf_inc = UP_ALIGN_8(u4_buf_inc);
  ------------------
  |  |   51|  9.06M|#define UP_ALIGN_8(x) (((((UWORD64) x) + 7) >> 3) << 3)
  ------------------
   81|  9.06M|    return (u4_buf_inc);
   82|  9.06M|}

isvcd_parse_pmb_ref_index_cavlc:
  205|     45|{
  206|     45|    UWORD32 u4_i;
  207|     45|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  208|     45|    UWORD32 *pu4_bitstream_off = &ps_bitstrm->u4_ofst;
  209|       |
  210|     99|    for(u4_i = 0; u4_i < u4_num_part; u4_i++)
  ------------------
  |  Branch (210:19): [True: 54, False: 45]
  ------------------
  211|     54|    {
  212|     54|        if(((*pu1_motion_prediction_flag >> u4_i) & 0x01) == 0)
  ------------------
  |  Branch (212:12): [True: 3, False: 51]
  ------------------
  213|      3|        {
  214|      3|            UWORD32 u4_ref_idx;
  215|       |            // Inlined ih264d_uev
  216|      3|            UWORD32 u4_bitstream_offset = *pu4_bitstream_off;
  217|      3|            UWORD32 u4_word, u4_ldz;
  218|       |
  219|       |            /***************************************************************/
  220|       |            /* Find leading zeros in next 32 bits                          */
  221|       |            /***************************************************************/
  222|      3|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|      3|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|      3|{                                                                           \
  |  |  152|      3|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|      3|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|      3|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|      3|                                                                            \
  |  |  156|      3|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|      3|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 3, False: 0]
  |  |  ------------------
  |  |  158|      3|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|      3|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|      3|}
  ------------------
  223|      3|            u4_ldz = CLZ(u4_word);
  224|       |            /* Flush the ps_bitstrm */
  225|      3|            u4_bitstream_offset += (u4_ldz + 1);
  226|       |            /* Read the suffix from the ps_bitstrm */
  227|      3|            u4_word = 0;
  228|      3|            if(u4_ldz) GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|      3|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|      3|{                                                                           \
  |  |  122|      3|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|      3|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|      3|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|      3|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|      3|                                                                            \
  |  |  127|      3|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 0, False: 3]
  |  |  ------------------
  |  |  128|      3|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|      3|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|      3|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|      3|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|      3|}                                                                           \
  ------------------
  |  Branch (228:16): [True: 3, False: 0]
  ------------------
  229|      3|            *pu4_bitstream_off = u4_bitstream_offset;
  230|      3|            u4_ref_idx = ((1 << u4_ldz) + u4_word - 1);
  231|       |
  232|       |            // Inlined ih264d_uev
  233|      3|            if(u4_ref_idx > u4_num_ref_idx_active_minus1) return ERROR_REF_IDX;
  ------------------
  |  Branch (233:16): [True: 0, False: 3]
  ------------------
  234|       |
  235|       |            /* Storing Reference Idx Information */
  236|      3|            pi1_ref_idx[u4_i] = (WORD8) u4_ref_idx;
  237|      3|        }
  238|     54|    }
  239|     45|    return OK;
  ------------------
  |  |  114|     45|#define OK        0
  ------------------
  240|     45|}
isvcd_parse_pmb_ref_index_cavlc_range1:
  272|    337|{
  273|    337|    UWORD32 u4_i;
  274|    337|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  275|    337|    UWORD32 *pu4_bitstream_off = &ps_bitstrm->u4_ofst;
  276|    337|    UNUSED(u4_num_ref_idx_active_minus1);
  ------------------
  |  |   45|    337|#define UNUSED(x) ((void)(x))
  ------------------
  277|  1.21k|    for(u4_i = 0; u4_i < u4_num_part; u4_i++)
  ------------------
  |  Branch (277:19): [True: 876, False: 337]
  ------------------
  278|    876|    {
  279|    876|        if(((*pu1_motion_prediction_flag >> u4_i) & 0x01) == 0)
  ------------------
  |  Branch (279:12): [True: 470, False: 406]
  ------------------
  280|    470|        {
  281|    470|            UWORD32 u4_ref_idx;
  282|    470|            u4_ref_idx = ih264d_tev_range1(pu4_bitstream_off, pu4_bitstrm_buf);
  283|       |
  284|       |            /* Storing Reference Idx Information */
  285|    470|            pi1_ref_idx[u4_i] = (WORD8) u4_ref_idx;
  286|    470|        }
  287|    876|    }
  288|    337|}

isvcd_parse_bmb_cabac:
  102|    299|{
  103|    299|    UWORD8 u1_cbp = 0;
  104|    299|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  105|    299|    deblk_mb_t *ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u4_mb_num;
  106|    299|    const UWORD8 *puc_mb_mc_mode = (const UWORD8 *) gau1_ih264d_mb_mc_mode;
  107|    299|    UWORD8 u1_mb_type = ps_cur_mb_info->u1_mb_type;
  108|    299|    ctxt_inc_mb_info_t *p_curr_ctxt = ps_dec->ps_curr_ctxt_mb_info;
  109|    299|    dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm;
  110|    299|    decoding_envirnoment_t *ps_cab_env = &ps_dec->s_cab_dec_env;
  111|    299|    WORD32 ret;
  112|    299|    UWORD8 u1_Bdirect_tranform_read = 1;
  113|    299|    dec_slice_svc_ext_params_t *ps_svc_slice_params = NULL;
  114|       |
  115|    299|    ps_svc_slice_params = &ps_svc_lyr_dec->s_svc_slice_params;
  116|    299|    ps_dec->s_high_profile.u1_no_submb_part_size_lt8x8_flag = 1;
  117|    299|    ps_cur_mb_info->u1_mb_mc_mode = puc_mb_mc_mode[5 + u1_mb_type];
  118|    299|    ps_cur_mb_info->u1_yuv_dc_block_flag = 0;
  119|    299|    ps_cur_deblk_mb->u1_mb_type |= D_B_SLICE;
  ------------------
  |  |  384|    299|#define D_B_SLICE         4
  ------------------
  120|       |
  121|    299|    if(u1_mb_type != B_DIRECT)
  ------------------
  |  |  482|    299|#define B_DIRECT  0
  ------------------
  |  Branch (121:8): [True: 299, False: 0]
  ------------------
  122|    299|    {
  123|    299|        ret = isvcd_parse_bmb_non_direct_cabac(ps_svc_lyr_dec, ps_cur_mb_info, ps_svc_cur_mb_info,
  124|    299|                                               u4_mb_num, u4_num_mbsNby2);
  125|    299|        if(ret != OK) return ret;
  ------------------
  |  |  114|    299|#define OK        0
  ------------------
  |  Branch (125:12): [True: 1, False: 298]
  ------------------
  126|    299|    }
  127|      0|    else
  128|      0|    {
  129|       |        /************ STORING PARTITION INFO ***********/
  130|      0|        parse_part_params_t *ps_part_info;
  131|      0|        ps_part_info = ps_dec->ps_part;
  132|      0|        ps_part_info->u1_is_direct = PART_DIRECT_16x16;
  ------------------
  |  |  571|      0|#define PART_DIRECT_16x16              2
  ------------------
  133|      0|        ps_part_info->u1_sub_mb_num = 0;
  134|      0|        ps_dec->ps_part++;
  135|      0|        p_curr_ctxt->u1_mb_type = CAB_BD16x16;
  ------------------
  |  |  396|      0|#define CAB_BD16x16       0x04 /* 0000 0100 */
  ------------------
  136|       |
  137|      0|        MEMSET_16BYTES(&ps_dec->pu1_left_mv_ctxt_inc[0][0], 0);
  ------------------
  |  |  652|      0|#define MEMSET_16BYTES(pu4_start,value)                         \
  |  |  653|      0|{                                                               \
  |  |  654|      0|    memset(pu4_start,value,16);                                 \
  |  |  655|      0|}
  ------------------
  138|      0|        memset(ps_dec->pi1_left_ref_idx_ctxt_inc, 0, 4);
  139|      0|        MEMSET_16BYTES(p_curr_ctxt->u1_mv, 0);
  ------------------
  |  |  652|      0|#define MEMSET_16BYTES(pu4_start,value)                         \
  |  |  653|      0|{                                                               \
  |  |  654|      0|    memset(pu4_start,value,16);                                 \
  |  |  655|      0|}
  ------------------
  140|      0|        memset(p_curr_ctxt->i1_ref_idx, 0, 4);
  141|       |
  142|       |        /* check whether transform8x8 u4_flag to be read or not */
  143|      0|        u1_Bdirect_tranform_read = ps_dec->s_high_profile.u1_direct_8x8_inference_flag;
  144|      0|    }
  145|       |
  146|    298|    if(ps_svc_slice_params->u1_adaptive_residual_prediction_flag &&
  ------------------
  |  Branch (146:8): [True: 72, False: 226]
  ------------------
  147|     72|       ps_svc_cur_mb_info->u1_crop_window_flag)
  ------------------
  |  Branch (147:8): [True: 72, False: 0]
  ------------------
  148|     72|    {
  149|     72|        ps_svc_cur_mb_info->u1_residual_prediction_flag = ih264d_decode_bin(
  150|     72|            1, ps_svc_lyr_dec->ps_residual_prediction_flag, ps_bitstrm, ps_cab_env);
  151|     72|        COPYTHECONTEXT("SVC ext: u1_residual_prediction_flag",
  152|     72|                       ps_svc_cur_mb_info->u1_residual_prediction_flag);
  153|     72|    }
  154|    226|    else
  155|    226|    {
  156|       |        /*residual flag inference code */
  157|    226|        if(1 == ps_svc_cur_mb_info->u1_crop_window_flag &&
  ------------------
  |  Branch (157:12): [True: 226, False: 0]
  ------------------
  158|    226|           1 == ps_svc_cur_mb_info->u1_base_mode_flag)
  ------------------
  |  Branch (158:12): [True: 0, False: 226]
  ------------------
  159|      0|        {
  160|      0|            ps_svc_cur_mb_info->u1_residual_prediction_flag =
  161|      0|                ps_svc_slice_params->u1_default_residual_prediction_flag;
  162|      0|        }
  163|    226|        else
  164|    226|        {
  165|    226|            ps_svc_cur_mb_info->u1_residual_prediction_flag = 0;
  166|    226|        }
  167|    226|    }
  168|       |
  169|    298|    if(ps_svc_slice_params->u1_scan_idx_end >= ps_svc_slice_params->u1_scan_idx_start)
  ------------------
  |  Branch (169:8): [True: 298, False: 0]
  ------------------
  170|    298|    {
  171|       |        /* Read the Coded block pattern */
  172|    298|        u1_cbp = (WORD8) ih264d_parse_ctx_cbp_cabac(ps_dec);
  173|    298|        p_curr_ctxt->u1_cbp = u1_cbp;
  174|    298|        ps_cur_mb_info->u1_cbp = u1_cbp;
  175|       |
  176|    298|        if(u1_cbp > 47) return ERROR_CBP;
  ------------------
  |  Branch (176:12): [True: 0, False: 298]
  ------------------
  177|    298|        COPYTHECONTEXT("coded_block_pattern", u1_cbp);
  178|       |
  179|    298|        ps_cur_mb_info->u1_tran_form8x8 = 0;
  180|    298|        ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
  181|       |
  182|    298|        if((ps_dec->s_high_profile.u1_transform8x8_present) && (u1_cbp & (0xf)) &&
  ------------------
  |  Branch (182:12): [True: 72, False: 226]
  |  Branch (182:64): [True: 27, False: 45]
  ------------------
  183|     27|           (ps_dec->s_high_profile.u1_no_submb_part_size_lt8x8_flag) && (u1_Bdirect_tranform_read))
  ------------------
  |  Branch (183:12): [True: 12, False: 15]
  |  Branch (183:73): [True: 12, False: 0]
  ------------------
  184|     12|        {
  185|     12|            ps_cur_mb_info->u1_tran_form8x8 =
  186|     12|                ih264d_parse_transform8x8flag_cabac(ps_dec, ps_cur_mb_info);
  187|     12|            COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8);
  188|       |
  189|     12|            ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8;
  190|     12|            p_curr_ctxt->u1_transform8x8_ctxt = ps_cur_mb_info->u1_tran_form8x8;
  191|     12|        }
  192|    286|        else
  193|    286|        {
  194|    286|            p_curr_ctxt->u1_transform8x8_ctxt = 0;
  195|    286|        }
  196|    298|    }
  197|       |
  198|    298|    p_curr_ctxt->u1_intra_chroma_pred_mode = 0;
  199|    298|    p_curr_ctxt->u1_yuv_dc_csbp &= 0xFE;
  200|    298|    ps_dec->pu1_left_yuv_dc_csbp[0] &= 0x6;
  201|       |
  202|       |    /* Read mb_qp_delta */
  203|    298|    if(u1_cbp)
  ------------------
  |  Branch (203:8): [True: 107, False: 191]
  ------------------
  204|    107|    {
  205|    107|        WORD8 c_temp;
  206|    107|        ret = ih264d_parse_mb_qp_delta_cabac(ps_dec, &c_temp);
  207|    107|        if(ret != OK) return ret;
  ------------------
  |  |  114|    107|#define OK        0
  ------------------
  |  Branch (207:12): [True: 0, False: 107]
  ------------------
  208|    107|        COPYTHECONTEXT("mb_qp_delta", c_temp);
  209|    107|        if(c_temp)
  ------------------
  |  Branch (209:12): [True: 7, False: 100]
  ------------------
  210|      7|        {
  211|      7|            ret = ih264d_update_qp(ps_dec, c_temp);
  212|      7|            if(ret != OK) return ret;
  ------------------
  |  |  114|      7|#define OK        0
  ------------------
  |  Branch (212:16): [True: 0, False: 7]
  ------------------
  213|      7|        }
  214|    107|    }
  215|    191|    else
  216|    191|        ps_dec->i1_prev_mb_qp_delta = 0;
  217|       |
  218|       |    /*RESIDUAL FOR Start to end idx*/
  219|    298|    ih264d_parse_residual4x4_cabac(ps_dec, ps_cur_mb_info, 0);
  220|    298|    if(EXCEED_OFFSET(ps_dec->ps_bitstrm)) return ERROR_EOB_TERMINATE_T;
  ------------------
  |  |   93|    298|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 17, False: 281]
  |  |  ------------------
  ------------------
  221|    281|    return OK;
  ------------------
  |  |  114|    281|#define OK        0
  ------------------
  222|    298|}
isvcd_mv_pred_ref_tfr_nby2_ebmb:
  235|    288|{
  236|    288|    svc_dec_lyr_struct_t *ps_svc_lyr_dec = (svc_dec_lyr_struct_t *) ps_dec;
  237|    288|    parse_pmbarams_t *ps_mb_part_info;
  238|    288|    parse_part_params_t *ps_part;
  239|    288|    mv_pred_t *ps_mv_nmb, *ps_mv_nmb_start, *ps_mv_ntop, *ps_mv_ntop_start;
  240|    288|    pic_buffer_t *ps_ref_frame;
  241|    288|    UWORD8 u1_direct_mode_width;
  242|    288|    UWORD8 i, j;
  243|    288|    dec_mb_info_t *ps_cur_mb_info;
  244|    288|    dec_svc_mb_info_t *ps_svc_cur_mb_info;
  245|    288|    const UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  246|    288|    UWORD8 u1_field;
  247|    288|    WORD32 ret = 0;
  248|    288|    WORD16 i2_mv_x, i2_mv_y;
  249|       |
  250|    288|    ps_dec->i4_submb_ofst -= (u4_num_mbs - u4_mb_idx) << 4;
  251|    288|    ps_mb_part_info = ps_dec->ps_parse_mb_data;
  252|    288|    ps_part = ps_dec->ps_parse_part_params;
  253|       |
  254|       |    /* N/2 Mb MvPred and Transfer Setup Loop */
  255|  1.35k|    for(i = u4_mb_idx; i < u4_num_mbs; i++, ps_mb_part_info++)
  ------------------
  |  Branch (255:24): [True: 1.07k, False: 288]
  ------------------
  256|  1.07k|    {
  257|  1.07k|        UWORD8 u1_colz = 0;
  258|  1.07k|        ps_dec->i4_submb_ofst += SUB_BLK_SIZE;
  ------------------
  |  |  562|  1.07k|#define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|  1.07k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  |  |               #define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|  1.07k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  ------------------
  259|       |        /* Restore the slice scratch MbX and MbY context */
  260|  1.07k|        ps_cur_mb_info = ps_dec->ps_nmb_info + i;
  261|  1.07k|        ps_svc_cur_mb_info = ps_svc_lyr_dec->ps_svc_nmb_info + i;
  262|  1.07k|        u1_field = ps_cur_mb_info->u1_mb_field_decodingflag;
  263|  1.07k|        ps_mv_nmb_start = ps_dec->ps_mv_cur + (i << 4);
  264|  1.07k|        ps_dec->u2_mbx = ps_cur_mb_info->u2_mbx;
  265|  1.07k|        ps_dec->u2_mby = ps_cur_mb_info->u2_mby;
  266|  1.07k|        ps_dec->u1_currB_type = 0;
  267|  1.07k|        ps_dec->u2_mv_2mb[i & 0x1] = 0;
  268|       |
  269|       |        /* Look for MV Prediction and Reference Transfer in Non-I Mbs */
  270|  1.07k|        if(!ps_mb_part_info->u4_isI_mb)
  ------------------
  |  Branch (270:12): [True: 1.03k, False: 36]
  ------------------
  271|  1.03k|        {
  272|  1.03k|            UWORD8 u1_blk_no;
  273|  1.03k|            WORD16 i1_ref_idx, i1_ref_idx1;
  274|  1.03k|            UWORD8 u1_pred_mode;
  275|  1.03k|            UWORD8 u1_sub_mb_x, u1_sub_mb_y, u1_sub_mb_num;
  276|  1.03k|            UWORD8 u1_lx, u1_lx_start, u1_lxend, u1_tmp_lx;
  277|  1.03k|            UWORD8 u1_num_part, u1_num_ref, u1_wd, u1_ht;
  278|  1.03k|            UWORD32 *pu4_wt_offst;
  279|  1.03k|            UWORD8 u1_scale_ref, u4_bot_mb;
  280|  1.03k|            deblk_mb_t *ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + i;
  281|  1.03k|            WORD8(*pi1_ref_idx)[MAX_REFIDX_INFO_PER_MB] = ps_mb_part_info->i1_ref_idx;
  282|  1.03k|            WORD8 *pi1_ref_idx0 = pi1_ref_idx[0], *pi1_ref_idx1 = pi1_ref_idx[1];
  283|  1.03k|            UWORD32 **ppu4_wt_ofst = ps_mb_part_info->pu4_wt_offst;
  284|  1.03k|            WORD32 i4_mb_mode_svc;
  285|  1.03k|            UWORD8 u1_motion_pred_flag_l0 = ps_svc_cur_mb_info->au1_motion_pred_flag[0];
  286|  1.03k|            UWORD8 u1_motion_pred_flag_l1 = ps_svc_cur_mb_info->au1_motion_pred_flag[1];
  287|       |
  288|       |            /* MB Level initialisations */
  289|  1.03k|            ps_dec->u4_num_pmbair = i >> u1_mbaff;
  290|  1.03k|            ps_dec->u4_mb_idx_mv = i;
  291|       |
  292|  1.03k|            i4_mb_mode_svc = isvcd_interlyr_motion_mode_pred(
  293|  1.03k|                ps_svc_lyr_dec, ps_cur_mb_info, ps_svc_cur_mb_info, ps_mb_part_info, ps_part);
  294|       |
  295|  1.03k|            if((-1 == i4_mb_mode_svc) || (SVC_INTER_MB == i4_mb_mode_svc))
  ------------------
  |  |  114|    464|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (295:16): [True: 571, False: 464]
  |  Branch (295:42): [True: 464, False: 0]
  ------------------
  296|  1.03k|            {
  297|  1.03k|                ps_mv_ntop_start =
  298|  1.03k|                    ps_mv_nmb_start - (ps_dec->u2_frm_wd_in_mbs << (4 + u1_mbaff)) + 12;
  299|       |
  300|  1.03k|                u1_num_part = ps_mb_part_info->u1_num_part;
  301|  1.03k|                ps_cur_deblk_mb->u1_mb_type |= (u1_num_part > 1) << 1;
  302|  1.03k|                u1_direct_mode_width = (1 == ps_mb_part_info->u1_num_part) ? 16 : 8;
  ------------------
  |  Branch (302:40): [True: 896, False: 139]
  ------------------
  303|       |
  304|  1.03k|                ps_cur_mb_info->u4_pred_info_pkd_idx = ps_dec->u4_pred_info_pkd_idx;
  305|  1.03k|                ps_cur_mb_info->u1_num_pred_parts = 0;
  306|       |
  307|       |                /****************************************************/
  308|       |                /* weighted u4_ofst pointer calculations, this loop  */
  309|       |                /* runs maximum 4 times, even in direct cases       */
  310|       |                /****************************************************/
  311|  1.03k|                u1_scale_ref = u1_mbaff & ps_cur_mb_info->u1_mb_field_decodingflag;
  312|  1.03k|                u4_bot_mb = 1 - ps_cur_mb_info->u1_topmb;
  313|  1.03k|                if(ps_dec->ps_cur_pps->u1_wted_bipred_idc)
  ------------------
  |  Branch (313:20): [True: 511, False: 524]
  ------------------
  314|    511|                {
  315|    511|                    u1_num_ref = MIN(u1_num_part, 4);
  ------------------
  |  |   61|    511|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 488, False: 23]
  |  |  ------------------
  ------------------
  316|    511|                    if(PART_DIRECT_16x16 != ps_part->u1_is_direct)
  ------------------
  |  |  571|    511|#define PART_DIRECT_16x16              2
  ------------------
  |  Branch (316:24): [True: 311, False: 200]
  ------------------
  317|    311|                    {
  318|    746|                        for(u1_blk_no = 0; u1_blk_no < u1_num_ref; u1_blk_no++)
  ------------------
  |  Branch (318:44): [True: 435, False: 311]
  ------------------
  319|    435|                        {
  320|    435|                            i1_ref_idx = MAX(pi1_ref_idx0[u1_blk_no], 0);
  ------------------
  |  |   60|    435|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 6, False: 429]
  |  |  ------------------
  ------------------
  321|    435|                            if(u1_scale_ref) i1_ref_idx >>= 1;
  ------------------
  |  Branch (321:32): [True: 0, False: 435]
  ------------------
  322|    435|                            i1_ref_idx *= ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1];
  323|    435|                            if(u1_scale_ref)
  ------------------
  |  Branch (323:32): [True: 0, False: 435]
  ------------------
  324|      0|                                i1_ref_idx += (MAX(pi1_ref_idx1[u1_blk_no], 0) >> 1);
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  325|    435|                            else
  326|    435|                                i1_ref_idx += MAX(pi1_ref_idx1[u1_blk_no], 0);
  ------------------
  |  |   60|    435|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 435]
  |  |  ------------------
  ------------------
  327|    435|                            pu4_wt_offst = (UWORD32 *) &ps_dec->pu4_wt_ofsts[2 * X3(i1_ref_idx)];
  ------------------
  |  |   92|    435|#define X3(a)   (((a) << 1) + (a))
  ------------------
  328|       |
  329|    435|                            if(pi1_ref_idx0[u1_blk_no] < 0) pu4_wt_offst += 1;
  ------------------
  |  Branch (329:32): [True: 318, False: 117]
  ------------------
  330|       |
  331|    435|                            ppu4_wt_ofst[u1_blk_no] = pu4_wt_offst;
  332|    435|                            if(u1_scale_ref && (ps_dec->ps_cur_pps->u1_wted_bipred_idc == 2))
  ------------------
  |  Branch (332:32): [True: 0, False: 435]
  |  Branch (332:48): [True: 0, False: 0]
  ------------------
  333|      0|                            {
  334|      0|                                i1_ref_idx = MAX(pi1_ref_idx0[u1_blk_no], 0);
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  335|      0|                                i1_ref_idx *=
  336|      0|                                    (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1] << 1);
  337|      0|                                i1_ref_idx += MAX(pi1_ref_idx1[u1_blk_no], 0);
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  338|      0|                                if(u4_bot_mb)
  ------------------
  |  Branch (338:36): [True: 0, False: 0]
  ------------------
  339|      0|                                {
  340|      0|                                    i1_ref_idx +=
  341|      0|                                        (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0] << 1) *
  342|      0|                                        (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1] << 1);
  343|      0|                                }
  344|      0|                                pu4_wt_offst =
  345|      0|                                    (UWORD32 *) &ps_dec->pu4_mbaff_wt_mat[2 * X3(i1_ref_idx)];
  ------------------
  |  |   92|      0|#define X3(a)   (((a) << 1) + (a))
  ------------------
  346|      0|                                ppu4_wt_ofst[u1_blk_no] = pu4_wt_offst;
  347|      0|                            }
  348|    435|                        }
  349|    311|                    }
  350|    511|                }
  351|       |
  352|       |                /**************************************************/
  353|       |                /* Loop on Partitions                             */
  354|       |                /* direct mode is reflected as a single partition */
  355|       |                /**************************************************/
  356|  2.54k|                for(j = 0; j < u1_num_part; j++, ps_part++)
  ------------------
  |  Branch (356:28): [True: 1.50k, False: 1.03k]
  ------------------
  357|  1.50k|                {
  358|  1.50k|                    u1_sub_mb_num = ps_part->u1_sub_mb_num;
  359|  1.50k|                    ps_dec->u1_sub_mb_num = u1_sub_mb_num;
  360|       |
  361|  1.50k|                    if(PART_NOT_DIRECT != ps_part->u1_is_direct)
  ------------------
  |  |  569|  1.50k|#define PART_NOT_DIRECT                0
  ------------------
  |  Branch (361:24): [True: 323, False: 1.18k]
  ------------------
  362|    323|                    {
  363|       |                        /**************************************************/
  364|       |                        /* Direct Mode, Call DecodeSpatial/TemporalDirect */
  365|       |                        /* only (those will in turn call FormMbPartInfo)  */
  366|       |                        /**************************************************/
  367|    323|                        ret = isvcd_decode_spatial_direct(ps_dec, u1_direct_mode_width,
  368|    323|                                                          ps_cur_mb_info, i);
  369|    323|                        if(ret != OK) return ret;
  ------------------
  |  |  114|    323|#define OK        0
  ------------------
  |  Branch (369:28): [True: 0, False: 323]
  ------------------
  370|    323|                        ps_cur_deblk_mb->u1_mb_type |= (ps_dec->u1_currB_type << 1);
  371|    323|                    }
  372|  1.18k|                    else
  373|  1.18k|                    {
  374|  1.18k|                        mv_pred_t s_mvPred = {0};
  375|       |                        /**************************************************/
  376|       |                        /* Non Direct Mode, Call Motion Vector Predictor  */
  377|       |                        /* and FormMbpartInfo                             */
  378|       |                        /**************************************************/
  379|  1.18k|                        u1_sub_mb_x = u1_sub_mb_num & 0x03;
  380|  1.18k|                        u1_sub_mb_y = u1_sub_mb_num >> 2;
  381|  1.18k|                        u1_blk_no = (u1_num_part < 4)
  ------------------
  |  Branch (381:37): [True: 717, False: 467]
  ------------------
  382|  1.18k|                                        ? j
  383|  1.18k|                                        : (((u1_sub_mb_y >> 1) << 1) + (u1_sub_mb_x >> 1));
  384|       |
  385|  1.18k|                        ps_mv_ntop = ps_mv_ntop_start + u1_sub_mb_x;
  386|  1.18k|                        ps_mv_nmb = ps_mv_nmb_start + u1_sub_mb_num;
  387|       |
  388|       |                        /* Populate the colpic info and reference frames */
  389|  1.18k|                        s_mvPred.i1_ref_frame[0] = pi1_ref_idx0[u1_blk_no];
  390|  1.18k|                        s_mvPred.i1_ref_frame[1] = pi1_ref_idx1[u1_blk_no];
  391|  1.18k|                        u1_pred_mode = ps_part->u1_pred_mode;
  392|  1.18k|                        u1_wd = ps_part->u1_partwidth;
  393|  1.18k|                        u1_ht = ps_part->u1_partheight;
  394|       |
  395|  1.18k|                        if(1 != ps_svc_cur_mb_info->u1_base_mode_flag)
  ------------------
  |  Branch (395:28): [True: 608, False: 576]
  ------------------
  396|    608|                        {
  397|    608|                            u1_lx_start = 0;
  398|    608|                            u1_lxend = 2;
  399|    608|                            if(PRED_L0 == u1_pred_mode)
  ------------------
  |  |  483|    608|#define PRED_L0   1
  ------------------
  |  Branch (399:32): [True: 19, False: 589]
  ------------------
  400|     19|                            {
  401|     19|                                s_mvPred.i2_mv[2] = 0;
  402|     19|                                s_mvPred.i2_mv[3] = 0;
  403|     19|                                if(0 == (u1_motion_pred_flag_l0 & (1 << u1_blk_no)))
  ------------------
  |  Branch (403:36): [True: 15, False: 4]
  ------------------
  404|     15|                                {
  405|     15|                                    u1_lxend = 1;
  406|     15|                                }
  407|      4|                                else
  408|      4|                                {
  409|      4|                                    u1_lxend = 0;
  410|      4|                                }
  411|     19|                            }
  412|    589|                            else if(PRED_L1 == u1_pred_mode)
  ------------------
  |  |  484|    589|#define PRED_L1   2
  ------------------
  |  Branch (412:37): [True: 571, False: 18]
  ------------------
  413|    571|                            {
  414|    571|                                s_mvPred.i2_mv[0] = 0;
  415|    571|                                s_mvPred.i2_mv[1] = 0;
  416|    571|                                if(0 == (u1_motion_pred_flag_l1 & (1 << u1_blk_no)))
  ------------------
  |  Branch (416:36): [True: 571, False: 0]
  ------------------
  417|    571|                                {
  418|    571|                                    u1_lx_start = 1;
  419|    571|                                }
  420|      0|                                else
  421|      0|                                {
  422|      0|                                    u1_lx_start = 2;
  423|      0|                                }
  424|    571|                            }
  425|     18|                            else  // Bi Pred
  426|     18|                            {
  427|     18|                                if(0 == (u1_motion_pred_flag_l0 & (1 << u1_blk_no)))
  ------------------
  |  Branch (427:36): [True: 14, False: 4]
  ------------------
  428|     14|                                {
  429|     14|                                    u1_lxend = 1;
  430|     14|                                }
  431|     18|                                if(0 == (u1_motion_pred_flag_l1 & (1 << u1_blk_no)))
  ------------------
  |  Branch (431:36): [True: 18, False: 0]
  ------------------
  432|     18|                                {
  433|     18|                                    u1_lx_start = 1;
  434|     18|                                }
  435|     18|                                if((0 != (u1_motion_pred_flag_l0 & (1 << u1_blk_no))) &&
  ------------------
  |  Branch (435:36): [True: 4, False: 14]
  ------------------
  436|      4|                                   (0 != (u1_motion_pred_flag_l1 & (1 << u1_blk_no))))
  ------------------
  |  Branch (436:36): [True: 0, False: 4]
  ------------------
  437|      0|                                {
  438|      0|                                    u1_lx_start = 0;
  439|      0|                                    u1_lxend = 0;
  440|      0|                                }
  441|     18|                                if((0 == (u1_motion_pred_flag_l0 & (1 << u1_blk_no))) &&
  ------------------
  |  Branch (441:36): [True: 14, False: 4]
  ------------------
  442|     14|                                   (0 == (u1_motion_pred_flag_l1 & (1 << u1_blk_no))))
  ------------------
  |  Branch (442:36): [True: 14, False: 0]
  ------------------
  443|     14|                                {
  444|     14|                                    u1_lx_start = 0;
  445|     14|                                    u1_lxend = 2;
  446|     14|                                }
  447|     18|                            }
  448|    608|                            ps_dec->pf_mvpred(ps_dec, ps_cur_mb_info, ps_mv_nmb, ps_mv_ntop,
  449|    608|                                              &s_mvPred, u1_sub_mb_num, u1_wd, u1_lx_start,
  450|    608|                                              u1_lxend, ps_cur_mb_info->u1_mb_mc_mode);
  451|    608|                        }
  452|       |
  453|       |                        /* for generic case based on pred mode derived / signalled */
  454|  1.18k|                        u1_lx_start = 0;
  455|  1.18k|                        u1_lxend = 2;
  456|  1.18k|                        if(PRED_L0 == u1_pred_mode)
  ------------------
  |  |  483|  1.18k|#define PRED_L0   1
  ------------------
  |  Branch (456:28): [True: 184, False: 1.00k]
  ------------------
  457|    184|                        {
  458|    184|                            s_mvPred.i2_mv[2] = 0;
  459|    184|                            s_mvPred.i2_mv[3] = 0;
  460|    184|                            u1_lxend = 1;
  461|    184|                        }
  462|  1.18k|                        if(PRED_L1 == u1_pred_mode)
  ------------------
  |  |  484|  1.18k|#define PRED_L1   2
  ------------------
  |  Branch (462:28): [True: 753, False: 431]
  ------------------
  463|    753|                        {
  464|    753|                            s_mvPred.i2_mv[0] = 0;
  465|    753|                            s_mvPred.i2_mv[1] = 0;
  466|    753|                            u1_lx_start = 1;
  467|    753|                        }
  468|       |
  469|       |                        /**********************************************************/
  470|       |                        /* Loop on number of predictors, 1 Each for Forw Backw    */
  471|       |                        /* Loop 2 times for BiDirect mode                         */
  472|       |                        /**********************************************************/
  473|  2.61k|                        for(u1_lx = u1_lx_start; u1_lx < u1_lxend; u1_lx++)
  ------------------
  |  Branch (473:50): [True: 1.43k, False: 1.18k]
  ------------------
  474|  1.43k|                        {
  475|  1.43k|                            UWORD8 u1_motion_pred_flag =
  476|  1.43k|                                u1_lx ? u1_motion_pred_flag_l1 : u1_motion_pred_flag_l0;
  ------------------
  |  Branch (476:33): [True: 1.00k, False: 431]
  ------------------
  477|       |
  478|  1.43k|                            if((0 != (u1_motion_pred_flag & (1 << u1_blk_no))) ||
  ------------------
  |  Branch (478:32): [True: 8, False: 1.42k]
  ------------------
  479|  1.42k|                               (ps_svc_cur_mb_info->u1_base_mode_flag))
  ------------------
  |  Branch (479:32): [True: 805, False: 618]
  ------------------
  480|    813|                            {
  481|    813|                                isvcd_retrive_infer_mode_mv(ps_svc_lyr_dec, &s_mvPred, u1_lx,
  482|    813|                                                            u1_sub_mb_num);
  483|    813|                            }
  484|       |                            /********************************************************/
  485|       |                            /* Predict Mv                                           */
  486|       |                            /* Add Mv Residuals and store back                      */
  487|       |                            /********************************************************/
  488|  1.43k|                            u1_tmp_lx = (u1_lx << 1);
  489|  1.43k|                            i1_ref_idx = s_mvPred.i1_ref_frame[u1_lx];
  490|       |                            /********************************************************************/
  491|       |                            /* If reference index is inferred from the base layer and it is     */
  492|       |                            /* exceeding the number of active reference in the current layer.   */
  493|       |                            /* Then reference index is clipped to the max in the current layer  */
  494|       |                            /********************************************************************/
  495|  1.43k|                            if(ps_svc_cur_mb_info->u1_base_mode_flag == 1)
  ------------------
  |  Branch (495:32): [True: 805, False: 626]
  ------------------
  496|    805|                            {
  497|    805|                                if(i1_ref_idx > (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[u1_lx] - 1))
  ------------------
  |  Branch (497:36): [True: 0, False: 805]
  ------------------
  498|      0|                                {
  499|      0|                                    i1_ref_idx = ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[u1_lx] - 1;
  500|      0|                                }
  501|    805|                            }
  502|  1.43k|                            if(0 == ps_svc_cur_mb_info->u1_base_mode_flag)
  ------------------
  |  Branch (502:32): [True: 626, False: 805]
  ------------------
  503|    626|                            {
  504|    626|                                i2_mv_x = ps_mv_nmb->i2_mv[u1_tmp_lx];
  505|    626|                                i2_mv_y = ps_mv_nmb->i2_mv[u1_tmp_lx + 1];
  506|       |
  507|    626|                                i2_mv_x += s_mvPred.i2_mv[u1_tmp_lx];
  508|    626|                                i2_mv_y += s_mvPred.i2_mv[u1_tmp_lx + 1];
  509|       |
  510|    626|                                s_mvPred.i2_mv[u1_tmp_lx] = i2_mv_x;
  511|    626|                                s_mvPred.i2_mv[u1_tmp_lx + 1] = i2_mv_y;
  512|    626|                            }
  513|    805|                            else
  514|    805|                            {
  515|    805|                                i2_mv_x = s_mvPred.i2_mv[u1_tmp_lx];
  516|    805|                                i2_mv_y = s_mvPred.i2_mv[u1_tmp_lx + 1];
  517|    805|                            }
  518|       |
  519|       |                            /********************************************************/
  520|       |                            /* Transfer setup call                                  */
  521|       |                            /* convert RefIdx if it is MbAff                        */
  522|       |                            /* Pass Weight Offset and refFrame                      */
  523|       |                            /********************************************************/
  524|  1.43k|                            i1_ref_idx1 = i1_ref_idx >> u1_scale_ref;
  525|       |
  526|  1.43k|                            if(-1 == i1_ref_idx1) return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (526:32): [True: 0, False: 1.43k]
  ------------------
  527|  1.43k|                            if(u1_scale_ref && ((i1_ref_idx & 0x01) != u4_bot_mb))
  ------------------
  |  Branch (527:32): [True: 0, False: 1.43k]
  |  Branch (527:48): [True: 0, False: 0]
  ------------------
  528|      0|                                i1_ref_idx1 += MAX_REF_BUFS;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  529|  1.43k|                            ps_ref_frame = ps_dec->ps_ref_pic_buf_lx[u1_lx][i1_ref_idx1];
  530|       |
  531|       |                            /* Storing Colocated-Zero u4_flag */
  532|  1.43k|                            if(u1_lx == u1_lx_start)
  ------------------
  |  Branch (532:32): [True: 1.18k, False: 247]
  ------------------
  533|  1.18k|                            {
  534|       |                                /* Fill colocated info in MvPred structure */
  535|  1.18k|                                s_mvPred.u1_col_ref_pic_idx = ps_ref_frame->u1_mv_buf_id;
  536|  1.18k|                                s_mvPred.u1_pic_type = ps_ref_frame->u1_pic_type;
  537|       |
  538|       |                                /* Calculating colocated zero information */
  539|  1.18k|                                u1_colz =
  540|  1.18k|                                    (u1_field << 1) | ((i1_ref_idx == 0) && (ABS(i2_mv_x) <= 1) &&
  ------------------
  |  |  100|  1.17k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 111, False: 1.06k]
  |  |  ------------------
  ------------------
  |  Branch (540:56): [True: 1.17k, False: 8]
  |  Branch (540:77): [True: 665, False: 511]
  ------------------
  541|    665|                                                       (ABS(i2_mv_y) <= 1));
  ------------------
  |  |  100|    665|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 58, False: 607]
  |  |  ------------------
  ------------------
  |  Branch (541:56): [True: 461, False: 204]
  ------------------
  542|  1.18k|                                u1_colz |= ps_mb_part_info->u1_col_info[u1_blk_no];
  543|  1.18k|                            }
  544|       |
  545|  1.43k|                            pu4_wt_offst = ppu4_wt_ofst[u1_blk_no];
  546|  1.43k|                            {
  547|  1.43k|                                pred_info_pkd_t *ps_pred_pkd;
  548|  1.43k|                                WORD16 i2_mv[2];
  549|       |
  550|  1.43k|                                i2_mv[0] = i2_mv_x;
  551|  1.43k|                                i2_mv[1] = i2_mv_y;
  552|       |
  553|  1.43k|                                ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  554|  1.43k|                                ih264d_fill_pred_info(i2_mv, u1_wd, u1_ht, u1_sub_mb_num,
  555|  1.43k|                                                      u1_pred_mode, ps_pred_pkd,
  556|  1.43k|                                                      ps_ref_frame->u1_pic_buf_id, i1_ref_idx,
  557|  1.43k|                                                      pu4_wt_offst, ps_ref_frame->u1_pic_type);
  558|  1.43k|                                ps_dec->u4_pred_info_pkd_idx++;
  559|  1.43k|                                ps_cur_mb_info->u1_num_pred_parts++;
  560|  1.43k|                            }
  561|  1.43k|                        }
  562|  1.18k|                        if(ps_mv_nmb)
  ------------------
  |  Branch (562:28): [True: 1.18k, False: 0]
  ------------------
  563|  1.18k|                        {
  564|  1.18k|                            ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb, u1_sub_mb_num, u1_colz,
  565|  1.18k|                                               u1_ht, u1_wd);
  566|  1.18k|                        }
  567|      0|                        else
  568|      0|                        {
  569|      0|                            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  570|      0|                        }
  571|  1.18k|                    }
  572|  1.50k|                }
  573|       |                /* to take care of 16 parttitions increment for base mode flag case*/
  574|  1.03k|                if(1 == ps_svc_cur_mb_info->u1_base_mode_flag)
  ------------------
  |  Branch (574:20): [True: 464, False: 571]
  ------------------
  575|    464|                {
  576|    464|                    ps_part += (MAX_NUM_MB_PART - u1_num_part);
  ------------------
  |  |   62|    464|#define MAX_NUM_MB_PART NUM_MB_PARTS *NUM_SUB_MB_PARTS
  |  |  ------------------
  |  |  |  |   59|    464|#define NUM_MB_PARTS 4
  |  |  ------------------
  |  |               #define MAX_NUM_MB_PART NUM_MB_PARTS *NUM_SUB_MB_PARTS
  |  |  ------------------
  |  |  |  |   60|    464|#define NUM_SUB_MB_PARTS 4
  |  |  ------------------
  ------------------
  577|    464|                }
  578|  1.03k|            }
  579|      0|            else
  580|      0|            {
  581|       |                /* Set zero values in case of Intra Mbs */
  582|      0|                mv_pred_t s_mvPred = {{0, 0, 0, 0}, {-1, -1}, 0, 0};
  583|       |                /* to take care of 16 parttitions increment for base mode flag case*/
  584|      0|                if(1 != ps_svc_cur_mb_info->u1_base_mode_flag)
  ------------------
  |  Branch (584:20): [True: 0, False: 0]
  ------------------
  585|      0|                {
  586|      0|                    return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  587|      0|                }
  588|       |
  589|      0|                ps_cur_deblk_mb->u1_mb_type |= D_INTRA_IBL;
  ------------------
  |  |   72|      0|#define D_INTRA_IBL 16
  ------------------
  590|      0|                if((ps_svc_lyr_dec->u1_layer_identifier != TARGET_LAYER) &&
  ------------------
  |  |  110|      0|#define TARGET_LAYER 2
  ------------------
  |  Branch (590:20): [True: 0, False: 0]
  ------------------
  591|      0|                   (DBLK_ENABLED == ps_dec->ps_cur_slice->u1_disable_dblk_filter_idc))
  ------------------
  |  |  549|      0|#define DBLK_ENABLED                  0
  ------------------
  |  Branch (591:20): [True: 0, False: 0]
  ------------------
  592|      0|                {
  593|      0|                    ps_cur_deblk_mb->u1_deblocking_mode = MB_ENABLE_FILTERING;
  ------------------
  |  |   69|      0|#define MB_ENABLE_FILTERING           0x00
  ------------------
  594|      0|                }
  595|       |
  596|      0|                ps_part += (MAX_NUM_MB_PART);
  ------------------
  |  |   62|      0|#define MAX_NUM_MB_PART NUM_MB_PARTS *NUM_SUB_MB_PARTS
  |  |  ------------------
  |  |  |  |   59|      0|#define NUM_MB_PARTS 4
  |  |  ------------------
  |  |               #define MAX_NUM_MB_PART NUM_MB_PARTS *NUM_SUB_MB_PARTS
  |  |  ------------------
  |  |  |  |   60|      0|#define NUM_SUB_MB_PARTS 4
  |  |  ------------------
  ------------------
  597|       |                /* Storing colocated zero information */
  598|      0|                if(ps_mv_nmb_start)
  ------------------
  |  Branch (598:20): [True: 0, False: 0]
  ------------------
  599|      0|                {
  600|      0|                    ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb_start, 0,
  601|      0|                                       (UWORD8) (u1_field << 1), 4, 4);
  602|      0|                }
  603|      0|                else
  604|      0|                {
  605|      0|                    return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  606|      0|                }
  607|      0|            }
  608|  1.03k|        }
  609|     36|        else
  610|     36|        {
  611|       |            /* Set zero values in case of Intra Mbs */
  612|     36|            mv_pred_t s_mvPred = {{0, 0, 0, 0}, {-1, -1}, 0, 0};
  613|       |            /* Storing colocated zero information */
  614|     36|            if(ps_mv_nmb_start)
  ------------------
  |  Branch (614:16): [True: 36, False: 0]
  ------------------
  615|     36|            {
  616|     36|                ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb_start, 0, (UWORD8) (u1_field << 1),
  617|     36|                                   4, 4);
  618|     36|            }
  619|      0|            else
  620|      0|            {
  621|      0|                return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  622|      0|            }
  623|     36|        }
  624|  1.07k|    }
  625|       |
  626|    288|    return OK;
  ------------------
  |  |  114|    288|#define OK        0
  ------------------
  627|    288|}
isvcd_parse_bmb_non_direct_cabac:
  808|    299|{
  809|       |    /* Loads from ps_dec */
  810|    299|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  811|    299|    decoding_envirnoment_t *ps_cab_env = &ps_dec->s_cab_dec_env;
  812|    299|    dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm;
  813|    299|    ctxt_inc_mb_info_t *p_curr_ctxt = ps_dec->ps_curr_ctxt_mb_info;
  814|    299|    parse_pmbarams_t *ps_parse_mb_data = ps_dec->ps_parse_mb_data + u4_num_mbsNby2;
  815|       |
  816|       |    /* table pointer loads */
  817|    299|    const UWORD8 *pu1_sub_mb_pred_modes = (UWORD8 *) (gau1_ih264d_submb_pred_modes) + 4;
  818|    299|    const UWORD8(*pu1_mb_pred_modes)[32] = (const UWORD8(*)[32]) gau1_ih264d_mb_pred_modes;
  819|    299|    const UWORD8 *pu1_num_mb_part = (const UWORD8 *) gau1_ih264d_num_mb_part;
  820|    299|    const UWORD8 *pu1_sub_mb_mc_mode = (UWORD8 *) (gau1_ih264d_submb_mc_mode) + 4;
  821|       |
  822|    299|    const UWORD8 u1_mb_type = ps_cur_mb_info->u1_mb_type;
  823|    299|    UWORD8 *pu1_col_info = ps_parse_mb_data->u1_col_info;
  824|    299|    WORD8 *pi1_ref_idx_l0 = &ps_parse_mb_data->i1_ref_idx[0][0];
  825|    299|    WORD8 *pi1_ref_idx_l1 = &ps_parse_mb_data->i1_ref_idx[1][0];
  826|    299|    UWORD8 u1_dec_ref_l0, u1_dec_ref_l1;
  827|       |
  828|    299|    UWORD8 u1_num_mb_part, u1_mb_mc_mode, u1_sub_mb, u1_mbpred_mode = 5 + u1_mb_type;
  829|    299|    UWORD32 u4_mb_mc_mode = 0, u4_mb_pred_mode = 0;
  830|    299|    WORD32 ret;
  831|    299|    dec_slice_svc_ext_params_t *ps_svc_slice_params = NULL;
  832|    299|    ps_svc_slice_params = &ps_svc_lyr_dec->s_svc_slice_params;
  833|       |
  834|    299|    p_curr_ctxt->u1_mb_type = CAB_NON_BD16x16;
  ------------------
  |  |  397|    299|#define CAB_NON_BD16x16   0x05 /* 0000 0101 */
  ------------------
  835|    299|    u1_sub_mb = !(u1_mb_type ^ B_8x8);
  ------------------
  |  |  480|    299|#define B_8x8    22
  ------------------
  836|       |
  837|    299|    {
  838|    299|        UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  839|    299|        UWORD8 *pu1_num_ref_idx_lx_active = ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active;
  840|    299|        UWORD8 uc_field = ps_cur_mb_info->u1_mb_field_decodingflag;
  841|    299|        UWORD8 u1_mbaff_field = (u1_mbaff & uc_field);
  842|    299|        u1_dec_ref_l0 = (pu1_num_ref_idx_lx_active[0] << u1_mbaff_field) - 1;
  843|    299|        u1_dec_ref_l1 = (pu1_num_ref_idx_lx_active[1] << u1_mbaff_field) - 1;
  844|    299|    }
  845|       |
  846|    299|    if(u1_sub_mb)
  ------------------
  |  Branch (846:8): [True: 61, False: 238]
  ------------------
  847|     61|    {
  848|     61|        const UWORD8 u1_colz = ((PRED_8x8) << 6);
  ------------------
  |  |  453|     61|#define PRED_8x8    3
  ------------------
  849|     61|        UWORD8 uc_i;
  850|     61|        u1_mb_mc_mode = 0;
  851|     61|        u1_num_mb_part = 4;
  852|       |        /* Reading the subMB type */
  853|    305|        for(uc_i = 0; uc_i < 4; uc_i++)
  ------------------
  |  Branch (853:23): [True: 244, False: 61]
  ------------------
  854|    244|        {
  855|    244|            UWORD8 u1_sub_mb_mode, u1_subMbPredModes;
  856|    244|            u1_sub_mb_mode =
  857|    244|                ih264d_parse_submb_type_cabac(1, ps_cab_env, ps_bitstrm, ps_dec->p_sub_mb_type_t);
  858|       |
  859|    244|            if(u1_sub_mb_mode > 12) return ERROR_SUB_MB_TYPE;
  ------------------
  |  Branch (859:16): [True: 0, False: 244]
  ------------------
  860|       |
  861|    244|            u1_subMbPredModes = pu1_sub_mb_pred_modes[u1_sub_mb_mode];
  862|    244|            u4_mb_mc_mode = (u4_mb_mc_mode << 8) | pu1_sub_mb_mc_mode[u1_sub_mb_mode];
  863|    244|            u4_mb_pred_mode = (u4_mb_pred_mode << 8) | u1_subMbPredModes;
  864|    244|            *pi1_ref_idx_l0++ = (u1_subMbPredModes & PRED_L0) ? u1_dec_ref_l0 : -1;
  ------------------
  |  |  483|    244|#define PRED_L0   1
  ------------------
  |  Branch (864:33): [True: 2, False: 242]
  ------------------
  865|    244|            *pi1_ref_idx_l1++ = (u1_subMbPredModes & PRED_L1) ? u1_dec_ref_l1 : -1;
  ------------------
  |  |  484|    244|#define PRED_L1   2
  ------------------
  |  Branch (865:33): [True: 210, False: 34]
  ------------------
  866|    244|            COPYTHECONTEXT("sub_mb_type", u1_sub_mb_mode);
  867|       |            /* Storing collocated Mb and SubMb mode information */
  868|    244|            *pu1_col_info++ = (u1_colz | (pu1_sub_mb_mc_mode[u1_sub_mb_mode] << 4));
  869|    244|            if(u1_sub_mb_mode != B_DIRECT_8x8)
  ------------------
  |  |  465|    244|#define B_DIRECT_8x8    0
  ------------------
  |  Branch (869:16): [True: 212, False: 32]
  ------------------
  870|    212|            {
  871|    212|                if(u1_sub_mb_mode > B_BI_8x8)
  ------------------
  |  |  468|    212|#define B_BI_8x8        3
  ------------------
  |  Branch (871:20): [True: 211, False: 1]
  ------------------
  872|    211|                {
  873|    211|                    ps_dec->s_high_profile.u1_no_submb_part_size_lt8x8_flag = 0;
  874|    211|                }
  875|    212|            }
  876|     32|            else if(!ps_dec->s_high_profile.u1_direct_8x8_inference_flag)
  ------------------
  |  Branch (876:21): [True: 30, False: 2]
  ------------------
  877|     30|            {
  878|     30|                ps_dec->s_high_profile.u1_no_submb_part_size_lt8x8_flag = 0;
  879|     30|            }
  880|    244|        }
  881|     61|        pi1_ref_idx_l0 -= 4;
  882|     61|        pi1_ref_idx_l1 -= 4;
  883|     61|    }
  884|    238|    else
  885|    238|    {
  886|    238|        UWORD8 u1_mb_pred_mode_part0 = pu1_mb_pred_modes[0][u1_mbpred_mode];
  887|    238|        UWORD8 u1_mb_pred_mode_part1 = pu1_mb_pred_modes[1][u1_mbpred_mode];
  888|    238|        u1_mb_mc_mode = ps_cur_mb_info->u1_mb_mc_mode;
  889|    238|        u1_num_mb_part = pu1_num_mb_part[u1_mb_mc_mode];
  890|       |        /* Storing collocated Mb and SubMb mode information */
  891|    238|        *pu1_col_info++ = (u1_mb_mc_mode << 6);
  892|    238|        if(u1_mb_mc_mode) *pu1_col_info++ = (u1_mb_mc_mode << 6);
  ------------------
  |  Branch (892:12): [True: 31, False: 207]
  ------------------
  893|    238|        u4_mb_mc_mode = u1_mb_mc_mode | (u1_mb_mc_mode << 8);
  894|    238|        u4_mb_mc_mode <<= 16;
  895|    238|        u4_mb_pred_mode = ((u1_mb_pred_mode_part0 << 8) | u1_mb_pred_mode_part1) << 16;
  896|       |
  897|    238|        *pi1_ref_idx_l0++ = (u1_mb_pred_mode_part0 & PRED_L0) ? u1_dec_ref_l0 : -1;
  ------------------
  |  |  483|    238|#define PRED_L0   1
  ------------------
  |  Branch (897:29): [True: 32, False: 206]
  ------------------
  898|    238|        *pi1_ref_idx_l0-- = (u1_mb_pred_mode_part1 & PRED_L0) ? u1_dec_ref_l0 : -1;
  ------------------
  |  |  483|    238|#define PRED_L0   1
  ------------------
  |  Branch (898:29): [True: 228, False: 10]
  ------------------
  899|    238|        *pi1_ref_idx_l1++ = (u1_mb_pred_mode_part0 & PRED_L1) ? u1_dec_ref_l1 : -1;
  ------------------
  |  |  484|    238|#define PRED_L1   2
  ------------------
  |  Branch (899:29): [True: 224, False: 14]
  ------------------
  900|    238|        *pi1_ref_idx_l1-- = (u1_mb_pred_mode_part1 & PRED_L1) ? u1_dec_ref_l1 : -1;
  ------------------
  |  |  484|    238|#define PRED_L1   2
  ------------------
  |  Branch (900:29): [True: 226, False: 12]
  ------------------
  901|    238|    }
  902|       |
  903|       |    /*Adding SVC extension code to get Motion Prediction Flags*/
  904|    299|    {
  905|    299|        UWORD8 uc_i, u1_mvp_l1, u1_mvp_l0;
  906|    299|        UWORD8 *pu1_motion_pred_flag_l0;
  907|    299|        UWORD8 *pu1_motion_pred_flag_l1;
  908|    299|        WORD8 *pi1_ref_idx;
  909|    299|        WORD8 *pi1_lft_cxt = ps_dec->pi1_left_ref_idx_ctxt_inc;
  910|    299|        WORD8 *pi1_top_cxt = p_curr_ctxt->i1_ref_idx;
  911|       |
  912|    299|        pu1_motion_pred_flag_l0 = &ps_svc_cur_mb_info->au1_motion_pred_flag[0];
  913|    299|        *pu1_motion_pred_flag_l0 = 0;
  914|    299|        pu1_motion_pred_flag_l1 = &ps_svc_cur_mb_info->au1_motion_pred_flag[1];
  915|    299|        *pu1_motion_pred_flag_l1 = 0;
  916|       |
  917|    299|        if(ps_svc_cur_mb_info->u1_crop_window_flag &&
  ------------------
  |  Branch (917:12): [True: 299, False: 0]
  ------------------
  918|    299|           ps_svc_slice_params->u1_adaptive_motion_prediction_flag)
  ------------------
  |  Branch (918:12): [True: 72, False: 227]
  ------------------
  919|     72|        {
  920|     72|            pi1_ref_idx = pi1_ref_idx_l0;
  921|    336|            for(uc_i = 0; uc_i < u1_num_mb_part; uc_i++, pi1_ref_idx++)
  ------------------
  |  Branch (921:27): [True: 264, False: 72]
  ------------------
  922|    264|            {
  923|    264|                if(*pi1_ref_idx > 0)
  ------------------
  |  Branch (923:20): [True: 17, False: 247]
  ------------------
  924|     17|                {
  925|     17|                    u1_mvp_l0 = ih264d_decode_bin(0, ps_svc_lyr_dec->ps_motion_prediction_flag_l0,
  926|     17|                                                  ps_bitstrm, ps_cab_env);
  927|     17|                    COPYTHECONTEXT("SVC ext: u1_motion_prediction_flag_l0", u1_mvp_l0);
  928|       |
  929|     17|                    *pu1_motion_pred_flag_l0 |= (u1_mvp_l0 << uc_i);
  930|     17|                    if((u1_mvp_l0 & 0x01))
  ------------------
  |  Branch (930:24): [True: 8, False: 9]
  ------------------
  931|      8|                    {
  932|      8|                        *pi1_ref_idx = -1;
  933|      8|                    }
  934|     17|                }
  935|    264|            }
  936|     72|            pi1_ref_idx = pi1_ref_idx_l1;
  937|    336|            for(uc_i = 0; uc_i < u1_num_mb_part; uc_i++, pi1_ref_idx++)
  ------------------
  |  Branch (937:27): [True: 264, False: 72]
  ------------------
  938|    264|            {
  939|    264|                if(*pi1_ref_idx > 0)
  ------------------
  |  Branch (939:20): [True: 0, False: 264]
  ------------------
  940|      0|                {
  941|      0|                    u1_mvp_l1 = ih264d_decode_bin(0, ps_svc_lyr_dec->ps_motion_prediction_flag_l1,
  942|      0|                                                  ps_bitstrm, ps_cab_env);
  943|      0|                    COPYTHECONTEXT("SVC ext: u1_motion_prediction_flag_l1", u1_mvp_l1);
  944|       |
  945|      0|                    *pu1_motion_pred_flag_l1 |= (u1_mvp_l1 << uc_i);
  946|       |
  947|      0|                    if((u1_mvp_l1 & 0x01))
  ------------------
  |  Branch (947:24): [True: 0, False: 0]
  ------------------
  948|      0|                    {
  949|      0|                        *pi1_ref_idx = -1;
  950|      0|                    }
  951|      0|                }
  952|    264|            }
  953|     72|        }
  954|    227|        else if(ps_svc_cur_mb_info->u1_crop_window_flag)
  ------------------
  |  Branch (954:17): [True: 227, False: 0]
  ------------------
  955|    227|        {
  956|    227|            *pu1_motion_pred_flag_l0 = ps_svc_slice_params->u1_default_motion_prediction_flag
  ------------------
  |  Branch (956:40): [True: 0, False: 227]
  ------------------
  957|    227|                                           ? ((1 << u1_num_mb_part) - 1)
  958|    227|                                           : 0;
  959|    227|            *pu1_motion_pred_flag_l1 = ps_svc_slice_params->u1_default_motion_prediction_flag
  ------------------
  |  Branch (959:40): [True: 0, False: 227]
  ------------------
  960|    227|                                           ? ((1 << u1_num_mb_part) - 1)
  961|    227|                                           : 0;
  962|    227|            if(ps_svc_slice_params->u1_default_motion_prediction_flag)
  ------------------
  |  Branch (962:16): [True: 0, False: 227]
  ------------------
  963|      0|            {
  964|      0|                pi1_ref_idx_l0[0] = -1;
  965|      0|                pi1_ref_idx_l0[1] = -1;
  966|      0|                pi1_ref_idx_l0[2] = -1;
  967|      0|                pi1_ref_idx_l0[3] = -1;
  968|       |
  969|      0|                pi1_ref_idx_l1[0] = -1;
  970|      0|                pi1_ref_idx_l1[1] = -1;
  971|      0|                pi1_ref_idx_l1[2] = -1;
  972|      0|                pi1_ref_idx_l1[3] = -1;
  973|      0|            }
  974|    227|        }
  975|       |
  976|    299|        ret = ih264d_parse_ref_idx_cabac(u1_num_mb_part, 0, u1_dec_ref_l0, u1_mb_mc_mode,
  977|    299|                                         pi1_ref_idx_l0, pi1_lft_cxt, pi1_top_cxt, ps_cab_env,
  978|    299|                                         ps_bitstrm, ps_dec->p_ref_idx_t);
  979|       |
  980|    299|        if(ret != OK)
  ------------------
  |  |  114|    299|#define OK        0
  ------------------
  |  Branch (980:12): [True: 1, False: 298]
  ------------------
  981|      1|        {
  982|      1|            return ret;
  983|      1|        }
  984|    298|        ret = ih264d_parse_ref_idx_cabac(u1_num_mb_part, 2, u1_dec_ref_l1, u1_mb_mc_mode,
  985|    298|                                         pi1_ref_idx_l1, pi1_lft_cxt, pi1_top_cxt, ps_cab_env,
  986|    298|                                         ps_bitstrm, ps_dec->p_ref_idx_t);
  987|       |
  988|    298|        if(ret != OK)
  ------------------
  |  |  114|    298|#define OK        0
  ------------------
  |  Branch (988:12): [True: 0, False: 298]
  ------------------
  989|      0|        {
  990|      0|            return ret;
  991|      0|        }
  992|    298|    }
  993|       |    /* Read MotionVectors */
  994|    298|    {
  995|    298|        const UWORD8 *pu1_top_left_sub_mb_indx;
  996|    298|        UWORD8 uc_j, uc_lx;
  997|    298|        UWORD8 u1_mb_part_wd, u1_mb_part_ht;
  998|       |
  999|    298|        const UWORD8 *pu1_sub_mb_indx_mod =
 1000|    298|            (const UWORD8 *) gau1_ih264d_submb_indx_mod + (u1_sub_mb * 6);
 1001|    298|        const UWORD8 *pu1_sub_mb_partw = (const UWORD8 *) gau1_ih264d_submb_partw;
 1002|    298|        const UWORD8 *pu1_sub_mb_parth = (const UWORD8 *) gau1_ih264d_submb_parth;
 1003|    298|        const UWORD8 *pu1_num_sub_mb_part = (const UWORD8 *) gau1_ih264d_num_submb_part;
 1004|    298|        const UWORD8 *pu1_mb_partw = (const UWORD8 *) gau1_ih264d_mb_partw;
 1005|    298|        const UWORD8 *pu1_mb_parth = (const UWORD8 *) gau1_ih264d_mb_parth;
 1006|       |
 1007|    298|        UWORD8 u1_p_idx = 0;
 1008|    298|        UWORD8 u1_num_submb_part;
 1009|    298|        parse_part_params_t *ps_part;
 1010|    298|        mv_pred_t *ps_mv_start = ps_dec->ps_mv_cur + (u4_mb_num << 4);
 1011|    298|        ps_part = ps_dec->ps_part;
 1012|       |
 1013|       |        /* Default initialization for non subMb case */
 1014|    298|        u1_mb_part_wd = pu1_mb_partw[u1_mb_mc_mode];
 1015|    298|        u1_mb_part_ht = pu1_mb_parth[u1_mb_mc_mode];
 1016|    298|        u1_num_submb_part = 1;
 1017|       |
 1018|       |        /* Decoding the MV for the subMB */
 1019|    894|        for(uc_lx = 0; uc_lx < 2; uc_lx++)
  ------------------
  |  Branch (1019:24): [True: 596, False: 298]
  ------------------
 1020|    596|        {
 1021|    596|            UWORD8 u1_sub_mb_num = 0;
 1022|    596|            UWORD32 u4_mb_pred_mode_tmp = u4_mb_pred_mode;
 1023|    596|            UWORD32 u4_mb_mc_mode_tmp = u4_mb_mc_mode;
 1024|    596|            UWORD8 u1_mb_mc_mode_1, u1_pred_mode, uc_i;
 1025|    596|            UWORD16 u2_sub_mb_num = 0x028A;
 1026|    596|            UWORD8 u1_b2 = uc_lx << 1;
 1027|    596|            u1_pred_mode = (uc_lx) ? PRED_L1 : PRED_L0;
  ------------------
  |  |  484|    298|#define PRED_L1   2
  ------------------
                          u1_pred_mode = (uc_lx) ? PRED_L1 : PRED_L0;
  ------------------
  |  |  483|    894|#define PRED_L0   1
  ------------------
  |  Branch (1027:28): [True: 298, False: 298]
  ------------------
 1028|       |            /* Default for Cabac */
 1029|    596|            pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_mb_mc_mode << 1);
 1030|  1.62k|            for(uc_i = 0; uc_i < u1_num_mb_part; uc_i++)
  ------------------
  |  Branch (1030:27): [True: 1.02k, False: 596]
  ------------------
 1031|  1.02k|            {
 1032|  1.02k|                WORD8 i1_pred = (UWORD8) (u4_mb_pred_mode_tmp >> 24);
 1033|  1.02k|                u1_mb_mc_mode_1 = (UWORD8) (u4_mb_mc_mode_tmp >> 24);
 1034|  1.02k|                u4_mb_pred_mode_tmp <<= 8;
 1035|  1.02k|                u4_mb_mc_mode_tmp <<= 8;
 1036|       |
 1037|       |                /* subMb prediction mode */
 1038|  1.02k|                if(u1_sub_mb)
  ------------------
  |  Branch (1038:20): [True: 488, False: 536]
  ------------------
 1039|    488|                {
 1040|    488|                    u1_mb_part_wd = pu1_sub_mb_partw[u1_mb_mc_mode_1];
 1041|    488|                    u1_mb_part_ht = pu1_sub_mb_parth[u1_mb_mc_mode_1];
 1042|    488|                    u1_sub_mb_num = u2_sub_mb_num >> 12;
 1043|    488|                    pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_mb_mc_mode_1 << 1);
 1044|    488|                    u1_num_submb_part = pu1_num_sub_mb_part[u1_mb_mc_mode_1];
 1045|    488|                    u2_sub_mb_num = u2_sub_mb_num << 4;
 1046|    488|                }
 1047|       |
 1048|  2.47k|                for(uc_j = 0; uc_j < u1_num_submb_part; uc_j++, pu1_top_left_sub_mb_indx++)
  ------------------
  |  Branch (1048:31): [True: 1.44k, False: 1.02k]
  ------------------
 1049|  1.44k|                {
 1050|  1.44k|                    mv_pred_t *ps_mv;
 1051|  1.44k|                    u1_sub_mb_num = u1_sub_mb_num + *pu1_top_left_sub_mb_indx;
 1052|  1.44k|                    ps_mv = ps_mv_start + u1_sub_mb_num;
 1053|       |
 1054|       |                    /* Storing Info for partitions, writing only once */
 1055|  1.44k|                    if(uc_lx)
  ------------------
  |  Branch (1055:24): [True: 723, False: 723]
  ------------------
 1056|    723|                    {
 1057|    723|                        ps_part->u1_is_direct = (!i1_pred);
 1058|    723|                        ps_part->u1_pred_mode = i1_pred;
 1059|    723|                        ps_part->u1_sub_mb_num = u1_sub_mb_num;
 1060|    723|                        ps_part->u1_partheight = u1_mb_part_ht;
 1061|    723|                        ps_part->u1_partwidth = u1_mb_part_wd;
 1062|       |
 1063|       |                        /* Increment partition Index */
 1064|    723|                        u1_p_idx++;
 1065|    723|                        ps_part++;
 1066|    723|                    }
 1067|       |
 1068|  1.44k|                    ih264d_get_mvd_cabac(u1_sub_mb_num, u1_b2, u1_mb_part_wd, u1_mb_part_ht,
 1069|  1.44k|                                         (UWORD8) (i1_pred & u1_pred_mode), ps_dec, ps_mv);
 1070|  1.44k|                }
 1071|  1.02k|            }
 1072|    596|        }
 1073|       |        /* write back to the scratch partition info */
 1074|    298|        ps_dec->ps_part = ps_part;
 1075|    298|        ps_parse_mb_data->u1_num_part = u1_sub_mb ? u1_p_idx : u1_num_mb_part;
  ------------------
  |  Branch (1075:41): [True: 61, False: 237]
  ------------------
 1076|    298|    }
 1077|       |
 1078|    298|    return OK;
  ------------------
  |  |  114|    298|#define OK        0
  ------------------
 1079|    298|}
isvcd_parse_ebslice:
 1431|     75|{
 1432|     75|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1433|     75|    WORD32 i_status = OK;
  ------------------
  |  |  114|     75|#define OK        0
  ------------------
 1434|     75|    dec_pic_params_t *ps_pps = ps_dec->ps_cur_pps;
 1435|     75|    dec_slice_params_t *ps_slice = ps_dec->ps_cur_slice;
 1436|     75|    dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm;
 1437|     75|    dec_svc_seq_params_t *ps_subset_seq;
 1438|     75|    dec_slice_svc_ext_params_t *ps_svc_slice_params = NULL;
 1439|     75|    dec_subset_seq_params_t *ps_sps_svc_ext = NULL;
 1440|     75|    dec_nal_unit_svc_ext_params_t *ps_nal_svc_ext = NULL;
 1441|     75|    UWORD8 u1_ref_idx_re_flag_lx;
 1442|     75|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 1443|     75|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
 1444|     75|    UWORD64 u8_ref_idx_l0, u8_ref_idx_l1;
 1445|     75|    UWORD32 u4_temp;
 1446|     75|    WORD32 i_temp;
 1447|     75|    WORD32 ret;
 1448|       |
 1449|     75|    ps_nal_svc_ext = ps_svc_lyr_dec->ps_nal_svc_ext;
 1450|     75|    ps_subset_seq = ps_svc_lyr_dec->ps_cur_subset_sps;
 1451|     75|    ps_sps_svc_ext = &ps_subset_seq->s_sps_svc_ext;
 1452|     75|    ps_svc_slice_params = &ps_svc_lyr_dec->s_svc_slice_params;
 1453|       |
 1454|       |    /*--------------------------------------------------------------------*/
 1455|       |    /* Read remaining contents of the slice header                        */
 1456|       |    /*--------------------------------------------------------------------*/
 1457|     75|    {
 1458|     75|        WORD8 *pi1_buf;
 1459|     75|        WORD16 *pi2_mv = ps_dec->s_default_mv_pred.i2_mv;
 1460|     75|        WORD32 *pi4_mv = (WORD32 *) pi2_mv;
 1461|     75|        WORD16 *pi16_refFrame;
 1462|     75|        pi1_buf = ps_dec->s_default_mv_pred.i1_ref_frame;
 1463|     75|        pi16_refFrame = (WORD16 *) pi1_buf;
 1464|     75|        *pi4_mv = 0;
 1465|     75|        *(pi4_mv + 1) = 0;
 1466|     75|        *pi16_refFrame = OUT_OF_RANGE_REF;
  ------------------
  |  |   45|     75|#define OUT_OF_RANGE_REF  -1
  ------------------
 1467|     75|        ps_dec->s_default_mv_pred.u1_col_ref_pic_idx = (UWORD8) -1;
 1468|     75|        ps_dec->s_default_mv_pred.u1_pic_type = (UWORD8) -1;
 1469|     75|    }
 1470|       |
 1471|     75|    if(0 == ps_svc_lyr_dec->ps_nal_svc_ext->u1_quality_id)
  ------------------
  |  Branch (1471:8): [True: 75, False: 0]
  ------------------
 1472|     75|    {
 1473|     75|        ps_slice->u1_num_ref_idx_active_override_flag = ih264d_get_bit_h264(ps_bitstrm);
 1474|     75|        COPYTHECONTEXT("Slice Header SVC ext: num_ref_idx_override_flag",
 1475|     75|                       ps_slice->u1_num_ref_idx_active_override_flag);
 1476|       |
 1477|     75|        u8_ref_idx_l0 = ps_dec->ps_cur_pps->u1_num_ref_idx_lx_active[0];
 1478|     75|        u8_ref_idx_l1 = ps_dec->ps_cur_pps->u1_num_ref_idx_lx_active[1];
 1479|     75|        if(ps_slice->u1_num_ref_idx_active_override_flag)
  ------------------
  |  Branch (1479:12): [True: 68, False: 7]
  ------------------
 1480|     68|        {
 1481|     68|            u8_ref_idx_l0 = (UWORD64) 1 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1482|     68|            COPYTHECONTEXT("Slice Header SVC ext: num_ref_idx_l0_active_minus1", u8_ref_idx_l0 - 1);
 1483|       |
 1484|     68|            u8_ref_idx_l1 = (UWORD64) 1 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1485|     68|            COPYTHECONTEXT("Slice Header SVC ext: num_ref_idx_l1_active_minus1", u8_ref_idx_l1 - 1);
 1486|     68|        }
 1487|       |
 1488|     75|        {
 1489|     75|            UWORD8 u1_max_ref_idx = H264_MAX_REF_PICS;
  ------------------
  |  |  534|     75|#define H264_MAX_REF_PICS         16
  ------------------
 1490|     75|            if(ps_slice->u1_field_pic_flag)
  ------------------
  |  Branch (1490:16): [True: 0, False: 75]
  ------------------
 1491|      0|            {
 1492|      0|                u1_max_ref_idx = H264_MAX_REF_PICS << 1;
  ------------------
  |  |  534|      0|#define H264_MAX_REF_PICS         16
  ------------------
 1493|      0|            }
 1494|     75|            if((u8_ref_idx_l0 >= u1_max_ref_idx) || (u8_ref_idx_l1 >= u1_max_ref_idx))
  ------------------
  |  Branch (1494:16): [True: 0, False: 75]
  |  Branch (1494:53): [True: 0, False: 75]
  ------------------
 1495|      0|            {
 1496|      0|                return ERROR_NUM_REF;
 1497|      0|            }
 1498|     75|            ps_slice->u1_num_ref_idx_lx_active[0] = (UWORD8) u8_ref_idx_l0;
 1499|     75|            ps_slice->u1_num_ref_idx_lx_active[1] = (UWORD8) u8_ref_idx_l1;
 1500|     75|        }
 1501|       |
 1502|      0|        ih264d_init_ref_idx_lx_b(ps_dec);
 1503|       |        /* Store the value for future slices in the same picture */
 1504|     75|        ps_dec->u1_num_ref_idx_lx_active_prev = ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0];
 1505|       |
 1506|     75|        u1_ref_idx_re_flag_lx = ih264d_get_bit_h264(ps_bitstrm);
 1507|     75|        COPYTHECONTEXT("Slice Header SVC ext: ref_pic_list_reordering_flag_l0",
 1508|     75|                       u1_ref_idx_re_flag_lx);
 1509|       |
 1510|       |        /* Modified temporarily */
 1511|     75|        if(u1_ref_idx_re_flag_lx)
  ------------------
  |  Branch (1511:12): [True: 54, False: 21]
  ------------------
 1512|     54|        {
 1513|     54|            WORD8 ret;
 1514|     54|            ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_mod_dpb[0];
 1515|     54|            ret = ih264d_ref_idx_reordering(ps_dec, 0);
 1516|     54|            if(ret == -1) return ERROR_REFIDX_ORDER_T;
  ------------------
  |  Branch (1516:16): [True: 0, False: 54]
  ------------------
 1517|     54|        }
 1518|     21|        else
 1519|     21|            ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_init_dpb[0];
 1520|       |
 1521|     75|        u1_ref_idx_re_flag_lx = ih264d_get_bit_h264(ps_bitstrm);
 1522|     75|        COPYTHECONTEXT("Slice Header SVC ext: ref_pic_list_reordering_flag_l1",
 1523|     75|                       u1_ref_idx_re_flag_lx);
 1524|       |
 1525|       |        /* Modified temporarily */
 1526|     75|        if(u1_ref_idx_re_flag_lx)
  ------------------
  |  Branch (1526:12): [True: 59, False: 16]
  ------------------
 1527|     59|        {
 1528|     59|            WORD8 ret;
 1529|     59|            ps_dec->ps_ref_pic_buf_lx[1] = ps_dec->ps_dpb_mgr->ps_mod_dpb[1];
 1530|     59|            ret = ih264d_ref_idx_reordering(ps_dec, 1);
 1531|     59|            if(ret == -1) return ERROR_REFIDX_ORDER_T;
  ------------------
  |  Branch (1531:16): [True: 0, False: 59]
  ------------------
 1532|     59|        }
 1533|     16|        else
 1534|     16|            ps_dec->ps_ref_pic_buf_lx[1] = ps_dec->ps_dpb_mgr->ps_init_dpb[1];
 1535|       |
 1536|       |        /* Create refIdx to POC mapping */
 1537|     75|        {
 1538|     75|            void **ppv_map_ref_idx_to_poc_lx;
 1539|     75|            WORD8 idx;
 1540|     75|            struct pic_buffer_t *ps_pic;
 1541|       |
 1542|     75|            ppv_map_ref_idx_to_poc_lx = ps_dec->ppv_map_ref_idx_to_poc + FRM_LIST_L0;
  ------------------
  |  |   89|     75|#define FRM_LIST_L0             0                                               //0
  ------------------
 1543|     75|            ppv_map_ref_idx_to_poc_lx[0] = 0;
 1544|     75|            ppv_map_ref_idx_to_poc_lx++;
 1545|    448|            for(idx = 0; idx < ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0]; idx++)
  ------------------
  |  Branch (1545:26): [True: 373, False: 75]
  ------------------
 1546|    373|            {
 1547|    373|                ps_pic = ps_dec->ps_ref_pic_buf_lx[0][idx];
 1548|    373|                ppv_map_ref_idx_to_poc_lx[idx] = (ps_pic->pu1_buf1);
 1549|    373|            }
 1550|       |
 1551|     75|            ppv_map_ref_idx_to_poc_lx = ps_dec->ppv_map_ref_idx_to_poc + FRM_LIST_L1;
  ------------------
  |  |   90|     75|#define FRM_LIST_L1             1 * POC_LIST_L0_TO_L1_DIFF//FRM_LIST_L0 + POC_LIST_L0_TO_L1_DIFF        //0+33                  //(1 * POC_LIST_L0_TO_L1_DIFF)
  |  |  ------------------
  |  |  |  |   86|     75|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|     75|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1552|       |
 1553|     75|            ppv_map_ref_idx_to_poc_lx[0] = 0;
 1554|     75|            ppv_map_ref_idx_to_poc_lx++;
 1555|    150|            for(idx = 0; idx < ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1]; idx++)
  ------------------
  |  Branch (1555:26): [True: 75, False: 75]
  ------------------
 1556|     75|            {
 1557|     75|                ps_pic = ps_dec->ps_ref_pic_buf_lx[1][idx];
 1558|     75|                ppv_map_ref_idx_to_poc_lx[idx] = (ps_pic->pu1_buf1);
 1559|     75|            }
 1560|       |
 1561|     75|            if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (1561:16): [True: 0, False: 75]
  ------------------
 1562|      0|            {
 1563|      0|                void **ppv_map_ref_idx_to_poc_lx_t, **ppv_map_ref_idx_to_poc_lx_b;
 1564|       |
 1565|      0|                ppv_map_ref_idx_to_poc_lx_t = ps_dec->ppv_map_ref_idx_to_poc + TOP_LIST_FLD_L0;
  ------------------
  |  |   91|      0|#define TOP_LIST_FLD_L0         2 * POC_LIST_L0_TO_L1_DIFF//FRM_LIST_L1 + POC_LIST_L0_TO_L1_DIFF        //0+33+33                   //(2 * POC_LIST_L0_TO_L1_DIFF)
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1566|      0|                ppv_map_ref_idx_to_poc_lx_b = ps_dec->ppv_map_ref_idx_to_poc + BOT_LIST_FLD_L0;
  ------------------
  |  |   93|      0|#define BOT_LIST_FLD_L0         4 * POC_LIST_L0_TO_L1_DIFF//TOP_LIST_FLD_L1 + POC_LIST_L0_TO_L1_DIFF_1  //0+33+33+17+17
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1567|       |
 1568|      0|                ppv_map_ref_idx_to_poc_lx_t[0] = 0;
 1569|      0|                ppv_map_ref_idx_to_poc_lx_t++;
 1570|      0|                ppv_map_ref_idx_to_poc_lx_b[0] = 0;
 1571|      0|                ppv_map_ref_idx_to_poc_lx_b++;
 1572|      0|                for(idx = 0; idx < ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0]; idx++)
  ------------------
  |  Branch (1572:30): [True: 0, False: 0]
  ------------------
 1573|      0|                {
 1574|      0|                    ps_pic = ps_dec->ps_ref_pic_buf_lx[0][idx];
 1575|      0|                    ppv_map_ref_idx_to_poc_lx_t[0] = (ps_pic->pu1_buf1);
 1576|      0|                    ppv_map_ref_idx_to_poc_lx_b[1] = (ps_pic->pu1_buf1);
 1577|       |
 1578|      0|                    ppv_map_ref_idx_to_poc_lx_b[0] = (ps_pic->pu1_buf1) + 1;
 1579|      0|                    ppv_map_ref_idx_to_poc_lx_t[1] = (ps_pic->pu1_buf1) + 1;
 1580|       |
 1581|      0|                    ppv_map_ref_idx_to_poc_lx_t += 2;
 1582|      0|                    ppv_map_ref_idx_to_poc_lx_b += 2;
 1583|      0|                }
 1584|       |
 1585|      0|                ppv_map_ref_idx_to_poc_lx_t = ps_dec->ppv_map_ref_idx_to_poc + TOP_LIST_FLD_L1;
  ------------------
  |  |   92|      0|#define TOP_LIST_FLD_L1         3 * POC_LIST_L0_TO_L1_DIFF//TOP_LIST_FLD_L0 + POC_LIST_L0_TO_L1_DIFF_1  //0+33+33+17                //(3 * POC_LIST_L0_TO_L1_DIFF)
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1586|      0|                ppv_map_ref_idx_to_poc_lx_b = ps_dec->ppv_map_ref_idx_to_poc + BOT_LIST_FLD_L1;
  ------------------
  |  |   94|      0|#define BOT_LIST_FLD_L1         5 * POC_LIST_L0_TO_L1_DIFF//BOT_LIST_FLD_L0 + POC_LIST_L0_TO_L1_DIFF_1  //0+33+33+17+17+17
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1587|       |
 1588|      0|                ppv_map_ref_idx_to_poc_lx_t[0] = 0;
 1589|      0|                ppv_map_ref_idx_to_poc_lx_t++;
 1590|      0|                ppv_map_ref_idx_to_poc_lx_b[0] = 0;
 1591|      0|                ppv_map_ref_idx_to_poc_lx_b++;
 1592|      0|                for(idx = 0; idx < ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1]; idx++)
  ------------------
  |  Branch (1592:30): [True: 0, False: 0]
  ------------------
 1593|      0|                {
 1594|      0|                    UWORD8 u1_tmp_idx = idx << 1;
 1595|      0|                    ps_pic = ps_dec->ps_ref_pic_buf_lx[1][idx];
 1596|      0|                    ppv_map_ref_idx_to_poc_lx_t[u1_tmp_idx] = (ps_pic->pu1_buf1);
 1597|      0|                    ppv_map_ref_idx_to_poc_lx_b[u1_tmp_idx + 1] = (ps_pic->pu1_buf1);
 1598|       |
 1599|      0|                    ppv_map_ref_idx_to_poc_lx_b[u1_tmp_idx] = (ps_pic->pu1_buf1) + 1;
 1600|      0|                    ppv_map_ref_idx_to_poc_lx_t[u1_tmp_idx + 1] = (ps_pic->pu1_buf1) + 1;
 1601|      0|                }
 1602|      0|            }
 1603|       |
 1604|       |            /* BS is moved post recon gen in SVC ext*/
 1605|     75|            if(ps_dec->u4_num_cores >= 2)
  ------------------
  |  Branch (1605:16): [True: 31, False: 44]
  ------------------
 1606|     31|            {
 1607|     31|                WORD32 num_entries;
 1608|     31|                WORD32 size;
 1609|     31|                num_entries = MAX_FRAMES;
  ------------------
  |  |  600|     31|#define MAX_FRAMES              16
  ------------------
 1610|     31|                if((1 >= ps_dec->ps_cur_sps->u1_num_ref_frames) && (0 == ps_dec->i4_display_delay))
  ------------------
  |  Branch (1610:20): [True: 0, False: 31]
  |  Branch (1610:68): [True: 0, False: 0]
  ------------------
 1611|      0|                {
 1612|      0|                    num_entries = 1;
 1613|      0|                }
 1614|       |
 1615|     31|                num_entries = ((2 * num_entries) + 1);
 1616|     31|                num_entries *= 2;
 1617|       |
 1618|     31|                size = num_entries * sizeof(void *);
 1619|     31|                size += PAD_MAP_IDX_POC * sizeof(void *);
  ------------------
  |  |  100|     31|#define PAD_MAP_IDX_POC             (1)
  ------------------
 1620|       |
 1621|     31|                memcpy((void *) ps_dec->ps_parse_cur_slice->ppv_map_ref_idx_to_poc,
 1622|     31|                       ps_dec->ppv_map_ref_idx_to_poc, size);
 1623|     31|            }
 1624|     75|        }
 1625|       |
 1626|     75|        if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag &&
  ------------------
  |  Branch (1626:12): [True: 0, False: 75]
  ------------------
 1627|      0|           (ps_dec->ps_cur_slice->u1_field_pic_flag == 0))
  ------------------
  |  Branch (1627:12): [True: 0, False: 0]
  ------------------
 1628|      0|        {
 1629|      0|            ih264d_convert_frm_mbaff_list(ps_dec);
 1630|      0|        }
 1631|       |
 1632|     75|        if(ps_pps->u1_wted_bipred_idc == 1)
  ------------------
  |  Branch (1632:12): [True: 0, False: 75]
  ------------------
 1633|      0|        {
 1634|      0|            if(!ps_nal_svc_ext->u1_no_inter_layer_pred_flag)
  ------------------
  |  Branch (1634:16): [True: 0, False: 0]
  ------------------
 1635|      0|            {
 1636|      0|                ps_svc_slice_params->u1_base_pred_weight_table_flag =
 1637|      0|                    ih264d_get_bit_h264(ps_bitstrm);
 1638|      0|                COPYTHECONTEXT("Slice Header SVC ext: u1_base_pred_weight_table_flag",
 1639|      0|                               ps_svc_slice_params->u1_base_pred_weight_table_flag);
 1640|      0|            }
 1641|       |
 1642|      0|            if(ps_nal_svc_ext->u1_no_inter_layer_pred_flag ||
  ------------------
  |  Branch (1642:16): [True: 0, False: 0]
  ------------------
 1643|      0|               !ps_svc_slice_params->u1_base_pred_weight_table_flag)
  ------------------
  |  Branch (1643:16): [True: 0, False: 0]
  ------------------
 1644|      0|            {
 1645|      0|                ih264d_parse_pred_weight_table(ps_slice, ps_bitstrm);
 1646|       |
 1647|      0|                ih264d_form_pred_weight_matrix(ps_dec);
 1648|      0|                ps_dec->pu4_wt_ofsts = ps_dec->pu4_wts_ofsts_mat;
 1649|      0|            }
 1650|      0|        }
 1651|     75|        else if(ps_pps->u1_wted_bipred_idc == 2)
  ------------------
  |  Branch (1651:17): [True: 50, False: 25]
  ------------------
 1652|     50|        {
 1653|       |            /* Implicit Weighted prediction */
 1654|     50|            ps_slice->u2_log2Y_crwd = 0x0505;
 1655|     50|            ps_dec->pu4_wt_ofsts = ps_dec->pu4_wts_ofsts_mat;
 1656|     50|            ih264d_get_implicit_weights(ps_dec);
 1657|     50|        }
 1658|     25|        else
 1659|     25|            ps_dec->ps_cur_slice->u2_log2Y_crwd = 0;
 1660|       |
 1661|     75|        ps_dec->ps_parse_cur_slice->u2_log2Y_crwd = ps_dec->ps_cur_slice->u2_log2Y_crwd;
 1662|       |
 1663|       |        /* G050 */
 1664|     75|        if(ps_slice->u1_nal_ref_idc != 0)
  ------------------
  |  Branch (1664:12): [True: 75, False: 0]
  ------------------
 1665|     75|        {
 1666|     75|            if(!ps_dec->ps_dpb_cmds->u1_dpb_commands_read)
  ------------------
  |  Branch (1666:16): [True: 75, False: 0]
  ------------------
 1667|     75|            {
 1668|     75|                dec_pic_params_t *ps_pps = ps_dec->ps_cur_pps;
 1669|     75|                dec_seq_params_t *ps_sps_tmp = ps_pps->ps_sps;
 1670|     75|                UWORD8 u1_nal_unit_type_tmp = ps_dec->u1_nal_unit_type;
 1671|       |
 1672|     75|                ps_pps->ps_sps = ps_dec->ps_cur_sps;
 1673|     75|                if(ps_svc_lyr_dec->ps_nal_svc_ext->u1_idr_flag)
  ------------------
  |  Branch (1673:20): [True: 75, False: 0]
  ------------------
 1674|     75|                    ps_dec->u1_nal_unit_type = IDR_SLICE_NAL;
  ------------------
  |  |  328|     75|#define IDR_SLICE_NAL                   5
  ------------------
 1675|       |
 1676|     75|                i_temp = ih264d_read_mmco_commands(ps_dec);
 1677|       |
 1678|     75|                ps_pps->ps_sps = ps_sps_tmp;
 1679|     75|                ps_dec->u1_nal_unit_type = u1_nal_unit_type_tmp;
 1680|       |
 1681|     75|                if(i_temp < 0)
  ------------------
  |  Branch (1681:20): [True: 0, False: 75]
  ------------------
 1682|      0|                {
 1683|      0|                    return ERROR_DBP_MANAGER_T;
 1684|      0|                }
 1685|     75|                ps_dec->u4_bitoffset = i_temp;
 1686|     75|            }
 1687|      0|            else
 1688|      0|                ps_bitstrm->u4_ofst += ps_dec->u4_bitoffset;
 1689|       |
 1690|     75|            if(!ps_sps_svc_ext->u1_slice_header_restriction_flag)
  ------------------
  |  Branch (1690:16): [True: 50, False: 25]
  ------------------
 1691|     50|            {
 1692|     50|                ps_svc_slice_params->u1_store_ref_base_pic_flag = ih264d_get_bit_h264(ps_bitstrm);
 1693|     50|                COPYTHECONTEXT("SPS_SVC_EXT: u1_store_ref_base_pic_flag",
 1694|     50|                               ps_svc_slice_params->u1_store_ref_base_pic_flag);
 1695|       |
 1696|     50|                if(0 != ps_svc_slice_params->u1_store_ref_base_pic_flag)
  ------------------
  |  Branch (1696:20): [True: 2, False: 48]
  ------------------
 1697|      2|                {
 1698|      2|                    return NOT_OK;
  ------------------
  |  |  116|      2|#define NOT_OK    -1
  ------------------
 1699|      2|                }
 1700|     48|                if(((1 == ps_nal_svc_ext->u1_use_ref_base_pic_flag) ||
  ------------------
  |  Branch (1700:21): [True: 0, False: 48]
  ------------------
 1701|     48|                    (1 == ps_svc_slice_params->u1_store_ref_base_pic_flag)) &&
  ------------------
  |  Branch (1701:21): [True: 0, False: 48]
  ------------------
 1702|      0|                   (!ps_nal_svc_ext->u1_idr_flag))
  ------------------
  |  Branch (1702:20): [True: 0, False: 0]
  ------------------
 1703|      0|                {
 1704|      0|                    i_status = isvcd_dec_ref_base_pic_marking(
 1705|      0|                        &ps_svc_slice_params->s_ref_base_pic_marking_svc_ext, ps_bitstrm);
 1706|      0|                    if(i_status != OK)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (1706:24): [True: 0, False: 0]
  ------------------
 1707|      0|                    {
 1708|      0|                        return i_status;
 1709|      0|                    }
 1710|      0|                }
 1711|     48|            }
 1712|     75|        }
 1713|     75|    }
 1714|       |    /* G050 */
 1715|       |    /*Code is present in standard but omitted in the reference code*/
 1716|     73|    if(ps_pps->u1_entropy_coding_mode == CABAC)
  ------------------
  |  |  339|     73|#define CABAC  1
  ------------------
  |  Branch (1716:8): [True: 64, False: 9]
  ------------------
 1717|     64|    {
 1718|     64|        u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1719|     64|        if(u4_temp > MAX_CABAC_INIT_IDC)
  ------------------
  |  |  537|     64|#define MAX_CABAC_INIT_IDC        2
  ------------------
  |  Branch (1719:12): [True: 4, False: 60]
  ------------------
 1720|      4|        {
 1721|      4|            return ERROR_INV_SLICE_HDR_T;
 1722|      4|        }
 1723|     60|        ps_slice->u1_cabac_init_idc = u4_temp;
 1724|     60|        COPYTHECONTEXT("Slice Header SVC ext: cabac_init_idc", ps_slice->u1_cabac_init_idc);
 1725|     60|    }
 1726|       |
 1727|     69|    {
 1728|       |        /* Read slice_qp_delta */
 1729|     69|        WORD64 i8_temp =
 1730|     69|            (WORD64) ps_pps->u1_pic_init_qp + ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1731|     69|        if((i8_temp < MIN_H264_QP) || (i8_temp > MAX_H264_QP))
  ------------------
  |  |  629|     69|#define MIN_H264_QP 0
  ------------------
                      if((i8_temp < MIN_H264_QP) || (i8_temp > MAX_H264_QP))
  ------------------
  |  |  634|     69|#define MAX_H264_QP 51
  ------------------
  |  Branch (1731:12): [True: 0, False: 69]
  |  Branch (1731:39): [True: 0, False: 69]
  ------------------
 1732|      0|        {
 1733|      0|            return ERROR_INV_RANGE_QP_T;
 1734|      0|        }
 1735|     69|        ps_slice->u1_slice_qp = (UWORD8) i8_temp;
 1736|     69|        COPYTHECONTEXT("Slice Header SVC ext: slice_qp_delta",
 1737|     69|                       (WORD8) (ps_slice->u1_slice_qp - ps_pps->u1_pic_init_qp));
 1738|     69|    }
 1739|     69|    if(ps_pps->u1_deblocking_filter_parameters_present_flag == 1)
  ------------------
  |  Branch (1739:8): [True: 60, False: 9]
  ------------------
 1740|     60|    {
 1741|     60|        u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1742|     60|        if(u4_temp > SLICE_BOUNDARY_DBLK_DISABLED)
  ------------------
  |  |  547|     60|#define SLICE_BOUNDARY_DBLK_DISABLED  2
  ------------------
  |  Branch (1742:12): [True: 0, False: 60]
  ------------------
 1743|      0|        {
 1744|      0|            return ERROR_INV_SLICE_HDR_T;
 1745|      0|        }
 1746|     60|        COPYTHECONTEXT("Slice Header SVC ext: disable_deblocking_filter_idc", u4_temp);
 1747|     60|        ps_slice->u1_disable_dblk_filter_idc = u4_temp;
 1748|     60|        if(u4_temp != 1)
  ------------------
  |  Branch (1748:12): [True: 60, False: 0]
  ------------------
 1749|     60|        {
 1750|     60|            i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf) << 1;
 1751|     60|            if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  550|     60|#define MIN_DBLK_FIL_OFF              -12
  ------------------
                          if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  551|     60|#define MAX_DBLK_FIL_OFF              12
  ------------------
  |  Branch (1751:16): [True: 0, False: 60]
  |  Branch (1751:47): [True: 0, False: 60]
  ------------------
 1752|      0|            {
 1753|      0|                return ERROR_INV_SLICE_HDR_T;
 1754|      0|            }
 1755|     60|            ps_slice->i1_slice_alpha_c0_offset = i_temp;
 1756|     60|            COPYTHECONTEXT("Slice Header SVC ext: slice_alpha_c0_offset_div2",
 1757|     60|                           ps_slice->i1_slice_alpha_c0_offset >> 1);
 1758|       |
 1759|     60|            i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf) << 1;
 1760|     60|            if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  550|     60|#define MIN_DBLK_FIL_OFF              -12
  ------------------
                          if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  551|     60|#define MAX_DBLK_FIL_OFF              12
  ------------------
  |  Branch (1760:16): [True: 0, False: 60]
  |  Branch (1760:47): [True: 0, False: 60]
  ------------------
 1761|      0|            {
 1762|      0|                return ERROR_INV_SLICE_HDR_T;
 1763|      0|            }
 1764|     60|            ps_slice->i1_slice_beta_offset = i_temp;
 1765|     60|            COPYTHECONTEXT("Slice Header SVC ext: slice_beta_offset_div2",
 1766|     60|                           ps_slice->i1_slice_beta_offset >> 1);
 1767|     60|        }
 1768|      0|        else
 1769|      0|        {
 1770|      0|            ps_slice->i1_slice_alpha_c0_offset = 0;
 1771|      0|            ps_slice->i1_slice_beta_offset = 0;
 1772|      0|        }
 1773|     60|    }
 1774|      9|    else
 1775|      9|    {
 1776|      9|        ps_slice->u1_disable_dblk_filter_idc = 0;
 1777|      9|        ps_slice->i1_slice_alpha_c0_offset = 0;
 1778|      9|        ps_slice->i1_slice_beta_offset = 0;
 1779|      9|    }
 1780|       |
 1781|       |    /* add the remaining part of the code for svc extension from reference */
 1782|     69|    ret = isvcd_set_default_slice_header_ext(ps_svc_lyr_dec);
 1783|     69|    if(ret != OK)
  ------------------
  |  |  114|     69|#define OK        0
  ------------------
  |  Branch (1783:8): [True: 0, False: 69]
  ------------------
 1784|      0|    {
 1785|      0|        return ERROR_INV_SLICE_HDR_T;
 1786|      0|    }
 1787|       |
 1788|     69|    ret = isvcd_parse_slice_header(ps_svc_lyr_dec);
 1789|     69|    if(ret != OK)
  ------------------
  |  |  114|     69|#define OK        0
  ------------------
  |  Branch (1789:8): [True: 0, False: 69]
  ------------------
 1790|      0|    {
 1791|      0|        return ERROR_INV_SLICE_HDR_T;
 1792|      0|    }
 1793|       |
 1794|     69|    ps_dec->u1_slice_header_done = 2;
 1795|     69|    if(!ps_svc_slice_params->u1_slice_skip_flag)
  ------------------
  |  Branch (1795:8): [True: 69, False: 0]
  ------------------
 1796|     69|    {
 1797|     69|        if(ps_pps->u1_entropy_coding_mode)
  ------------------
  |  Branch (1797:12): [True: 60, False: 9]
  ------------------
 1798|     60|        {
 1799|     60|            SWITCHOFFTRACE;
 1800|     60|            SWITCHONTRACECABAC;
 1801|     60|            ps_svc_lyr_dec->pf_parse_inter_slice_svc_ext =
 1802|     60|                isvcd_parse_inter_slice_data_cabac_enh_lyr;
 1803|     60|            ps_svc_lyr_dec->pf_parse_inter_mb_svc_ext = isvcd_parse_bmb_cabac;
 1804|     60|            isvcd_init_cabac_contexts(B_SLICE, ps_dec);
  ------------------
  |  |  369|     60|#define B_SLICE  1
  ------------------
 1805|       |
 1806|     60|            if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (1806:16): [True: 0, False: 60]
  ------------------
 1807|      0|                ps_dec->pf_get_mb_info = ih264d_get_mb_info_cabac_mbaff;
 1808|     60|            else
 1809|     60|                ps_dec->pf_get_mb_info = isvcd_get_mb_info_cabac_nonmbaff;
 1810|     60|        }
 1811|      9|        else
 1812|      9|        {
 1813|      9|            SWITCHONTRACE;
 1814|      9|            SWITCHOFFTRACECABAC;
 1815|      9|            ps_svc_lyr_dec->pf_parse_inter_slice_svc_ext =
 1816|      9|                isvcd_parse_inter_slice_data_cavlc_enh_lyr;
 1817|      9|            ps_svc_lyr_dec->pf_parse_inter_mb_svc_ext = isvcd_parse_bmb_cavlc;
 1818|      9|            if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (1818:16): [True: 0, False: 9]
  ------------------
 1819|      0|                ps_dec->pf_get_mb_info = ih264d_get_mb_info_cavlc_mbaff;
 1820|      9|            else
 1821|      9|                ps_dec->pf_get_mb_info = isvcd_get_mb_info_cavlc_nonmbaff;
 1822|      9|        }
 1823|     69|    }
 1824|      0|    else
 1825|      0|    {
 1826|      0|        return ERROR_FEATURE_UNAVAIL;
 1827|      0|    }
 1828|       |
 1829|     69|    ret = ih264d_cal_col_pic(ps_dec);
 1830|     69|    if(ret != OK) return ret;
  ------------------
  |  |  114|     69|#define OK        0
  ------------------
  |  Branch (1830:8): [True: 0, False: 69]
  ------------------
 1831|     69|    ps_dec->u1_B = 1;
 1832|     69|    ps_dec->pf_mvpred_ref_tfr_nby2mb = isvcd_mv_pred_ref_tfr_nby2_ebmb;
 1833|     69|    ret = ps_svc_lyr_dec->pf_parse_inter_slice_svc_ext(ps_svc_lyr_dec, ps_slice,
 1834|     69|                                                       u2_first_mb_in_slice);
 1835|     69|    if(ret != OK) return ret;
  ------------------
  |  |  114|     69|#define OK        0
  ------------------
  |  Branch (1835:8): [True: 38, False: 31]
  ------------------
 1836|       |
 1837|     31|    return OK;
  ------------------
  |  |  114|     31|#define OK        0
  ------------------
 1838|     69|}
isvcd_parse_bslice:
 1853|  1.40k|{
 1854|  1.40k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1855|  1.40k|    dec_pic_params_t *ps_pps = ps_dec->ps_cur_pps;
 1856|  1.40k|    dec_slice_params_t *ps_slice = ps_dec->ps_cur_slice;
 1857|  1.40k|    dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm;
 1858|  1.40k|    UWORD8 u1_ref_idx_re_flag_lx;
 1859|  1.40k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 1860|  1.40k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
 1861|  1.40k|    UWORD64 u8_ref_idx_l0, u8_ref_idx_l1;
 1862|  1.40k|    UWORD32 u4_temp;
 1863|  1.40k|    WORD32 i_temp;
 1864|  1.40k|    WORD32 ret;
 1865|       |
 1866|       |    /*--------------------------------------------------------------------*/
 1867|       |    /* Read remaining contents of the slice header                        */
 1868|       |    /*--------------------------------------------------------------------*/
 1869|  1.40k|    {
 1870|  1.40k|        WORD8 *pi1_buf;
 1871|  1.40k|        WORD16 *pi2_mv = ps_dec->s_default_mv_pred.i2_mv;
 1872|  1.40k|        WORD32 *pi4_mv = (WORD32 *) pi2_mv;
 1873|  1.40k|        WORD16 *pi16_refFrame;
 1874|  1.40k|        pi1_buf = ps_dec->s_default_mv_pred.i1_ref_frame;
 1875|  1.40k|        pi16_refFrame = (WORD16 *) pi1_buf;
 1876|  1.40k|        *pi4_mv = 0;
 1877|  1.40k|        *(pi4_mv + 1) = 0;
 1878|  1.40k|        *pi16_refFrame = OUT_OF_RANGE_REF;
  ------------------
  |  |   45|  1.40k|#define OUT_OF_RANGE_REF  -1
  ------------------
 1879|  1.40k|        ps_dec->s_default_mv_pred.u1_col_ref_pic_idx = (UWORD8) -1;
 1880|  1.40k|        ps_dec->s_default_mv_pred.u1_pic_type = (UWORD8) -1;
 1881|  1.40k|    }
 1882|       |
 1883|  1.40k|    ps_slice->u1_num_ref_idx_active_override_flag = ih264d_get_bit_h264(ps_bitstrm);
 1884|  1.40k|    COPYTHECONTEXT("SH: num_ref_idx_override_flag", ps_slice->u1_num_ref_idx_active_override_flag);
 1885|       |
 1886|  1.40k|    u8_ref_idx_l0 = ps_dec->ps_cur_pps->u1_num_ref_idx_lx_active[0];
 1887|  1.40k|    u8_ref_idx_l1 = ps_dec->ps_cur_pps->u1_num_ref_idx_lx_active[1];
 1888|  1.40k|    if(ps_slice->u1_num_ref_idx_active_override_flag)
  ------------------
  |  Branch (1888:8): [True: 1.22k, False: 183]
  ------------------
 1889|  1.22k|    {
 1890|  1.22k|        u8_ref_idx_l0 = (UWORD64) 1 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1891|  1.22k|        COPYTHECONTEXT("SH: num_ref_idx_l0_active_minus1", u8_ref_idx_l0 - 1);
 1892|       |
 1893|  1.22k|        u8_ref_idx_l1 = (UWORD64) 1 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1894|  1.22k|        COPYTHECONTEXT("SH: num_ref_idx_l1_active_minus1", u8_ref_idx_l1 - 1);
 1895|  1.22k|    }
 1896|       |
 1897|  1.40k|    {
 1898|  1.40k|        UWORD8 u1_max_ref_idx = H264_MAX_REF_PICS;
  ------------------
  |  |  534|  1.40k|#define H264_MAX_REF_PICS         16
  ------------------
 1899|  1.40k|        if(ps_slice->u1_field_pic_flag)
  ------------------
  |  Branch (1899:12): [True: 0, False: 1.40k]
  ------------------
 1900|      0|        {
 1901|      0|            u1_max_ref_idx = H264_MAX_REF_PICS << 1;
  ------------------
  |  |  534|      0|#define H264_MAX_REF_PICS         16
  ------------------
 1902|      0|        }
 1903|  1.40k|        if((u8_ref_idx_l0 >= u1_max_ref_idx) || (u8_ref_idx_l1 >= u1_max_ref_idx))
  ------------------
  |  Branch (1903:12): [True: 10, False: 1.39k]
  |  Branch (1903:49): [True: 7, False: 1.38k]
  ------------------
 1904|     17|        {
 1905|     17|            return ERROR_NUM_REF;
 1906|     17|        }
 1907|  1.38k|        ps_slice->u1_num_ref_idx_lx_active[0] = (UWORD8) u8_ref_idx_l0;
 1908|  1.38k|        ps_slice->u1_num_ref_idx_lx_active[1] = (UWORD8) u8_ref_idx_l1;
 1909|  1.38k|    }
 1910|       |
 1911|      0|    ih264d_init_ref_idx_lx_b(ps_dec);
 1912|       |    /* Store the value for future slices in the same picture */
 1913|  1.38k|    ps_dec->u1_num_ref_idx_lx_active_prev = ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0];
 1914|       |
 1915|  1.38k|    u1_ref_idx_re_flag_lx = ih264d_get_bit_h264(ps_bitstrm);
 1916|  1.38k|    COPYTHECONTEXT("SH: ref_pic_list_reordering_flag_l0", u1_ref_idx_re_flag_lx);
 1917|       |
 1918|       |    /* Modified temporarily */
 1919|  1.38k|    if(u1_ref_idx_re_flag_lx)
  ------------------
  |  Branch (1919:8): [True: 193, False: 1.19k]
  ------------------
 1920|    193|    {
 1921|    193|        WORD8 ret;
 1922|    193|        ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_mod_dpb[0];
 1923|    193|        ret = ih264d_ref_idx_reordering(ps_dec, 0);
 1924|    193|        if(ret == -1) return ERROR_REFIDX_ORDER_T;
  ------------------
  |  Branch (1924:12): [True: 0, False: 193]
  ------------------
 1925|    193|    }
 1926|  1.19k|    else
 1927|  1.19k|        ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_init_dpb[0];
 1928|       |
 1929|  1.38k|    u1_ref_idx_re_flag_lx = ih264d_get_bit_h264(ps_bitstrm);
 1930|  1.38k|    COPYTHECONTEXT("SH: ref_pic_list_reordering_flag_l1", u1_ref_idx_re_flag_lx);
 1931|       |
 1932|       |    /* Modified temporarily */
 1933|  1.38k|    if(u1_ref_idx_re_flag_lx)
  ------------------
  |  Branch (1933:8): [True: 207, False: 1.17k]
  ------------------
 1934|    207|    {
 1935|    207|        WORD8 ret;
 1936|    207|        ps_dec->ps_ref_pic_buf_lx[1] = ps_dec->ps_dpb_mgr->ps_mod_dpb[1];
 1937|    207|        ret = ih264d_ref_idx_reordering(ps_dec, 1);
 1938|    207|        if(ret == -1) return ERROR_REFIDX_ORDER_T;
  ------------------
  |  Branch (1938:12): [True: 0, False: 207]
  ------------------
 1939|    207|    }
 1940|  1.17k|    else
 1941|  1.17k|        ps_dec->ps_ref_pic_buf_lx[1] = ps_dec->ps_dpb_mgr->ps_init_dpb[1];
 1942|       |
 1943|       |    /* Create refIdx to POC mapping */
 1944|  1.38k|    {
 1945|  1.38k|        void **ppv_map_ref_idx_to_poc_lx;
 1946|  1.38k|        WORD8 idx;
 1947|  1.38k|        struct pic_buffer_t *ps_pic;
 1948|       |
 1949|  1.38k|        ppv_map_ref_idx_to_poc_lx = ps_dec->ppv_map_ref_idx_to_poc + FRM_LIST_L0;
  ------------------
  |  |   89|  1.38k|#define FRM_LIST_L0             0                                               //0
  ------------------
 1950|  1.38k|        ppv_map_ref_idx_to_poc_lx[0] = 0;
 1951|  1.38k|        ppv_map_ref_idx_to_poc_lx++;
 1952|  4.73k|        for(idx = 0; idx < ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0]; idx++)
  ------------------
  |  Branch (1952:22): [True: 3.35k, False: 1.38k]
  ------------------
 1953|  3.35k|        {
 1954|  3.35k|            ps_pic = ps_dec->ps_ref_pic_buf_lx[0][idx];
 1955|  3.35k|            ppv_map_ref_idx_to_poc_lx[idx] = (ps_pic->pu1_buf1);
 1956|  3.35k|        }
 1957|       |
 1958|  1.38k|        ppv_map_ref_idx_to_poc_lx = ps_dec->ppv_map_ref_idx_to_poc + FRM_LIST_L1;
  ------------------
  |  |   90|  1.38k|#define FRM_LIST_L1             1 * POC_LIST_L0_TO_L1_DIFF//FRM_LIST_L0 + POC_LIST_L0_TO_L1_DIFF        //0+33                  //(1 * POC_LIST_L0_TO_L1_DIFF)
  |  |  ------------------
  |  |  |  |   86|  1.38k|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|  1.38k|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1959|       |
 1960|  1.38k|        ppv_map_ref_idx_to_poc_lx[0] = 0;
 1961|  1.38k|        ppv_map_ref_idx_to_poc_lx++;
 1962|  3.84k|        for(idx = 0; idx < ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1]; idx++)
  ------------------
  |  Branch (1962:22): [True: 2.46k, False: 1.38k]
  ------------------
 1963|  2.46k|        {
 1964|  2.46k|            ps_pic = ps_dec->ps_ref_pic_buf_lx[1][idx];
 1965|  2.46k|            ppv_map_ref_idx_to_poc_lx[idx] = (ps_pic->pu1_buf1);
 1966|  2.46k|        }
 1967|       |
 1968|  1.38k|        if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (1968:12): [True: 0, False: 1.38k]
  ------------------
 1969|      0|        {
 1970|      0|            void **ppv_map_ref_idx_to_poc_lx_t, **ppv_map_ref_idx_to_poc_lx_b;
 1971|       |
 1972|      0|            ppv_map_ref_idx_to_poc_lx_t = ps_dec->ppv_map_ref_idx_to_poc + TOP_LIST_FLD_L0;
  ------------------
  |  |   91|      0|#define TOP_LIST_FLD_L0         2 * POC_LIST_L0_TO_L1_DIFF//FRM_LIST_L1 + POC_LIST_L0_TO_L1_DIFF        //0+33+33                   //(2 * POC_LIST_L0_TO_L1_DIFF)
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1973|      0|            ppv_map_ref_idx_to_poc_lx_b = ps_dec->ppv_map_ref_idx_to_poc + BOT_LIST_FLD_L0;
  ------------------
  |  |   93|      0|#define BOT_LIST_FLD_L0         4 * POC_LIST_L0_TO_L1_DIFF//TOP_LIST_FLD_L1 + POC_LIST_L0_TO_L1_DIFF_1  //0+33+33+17+17
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1974|       |
 1975|      0|            ppv_map_ref_idx_to_poc_lx_t[0] = 0;
 1976|      0|            ppv_map_ref_idx_to_poc_lx_t++;
 1977|      0|            ppv_map_ref_idx_to_poc_lx_b[0] = 0;
 1978|      0|            ppv_map_ref_idx_to_poc_lx_b++;
 1979|      0|            for(idx = 0; idx < ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0]; idx++)
  ------------------
  |  Branch (1979:26): [True: 0, False: 0]
  ------------------
 1980|      0|            {
 1981|      0|                ps_pic = ps_dec->ps_ref_pic_buf_lx[0][idx];
 1982|      0|                ppv_map_ref_idx_to_poc_lx_t[0] = (ps_pic->pu1_buf1);
 1983|      0|                ppv_map_ref_idx_to_poc_lx_b[1] = (ps_pic->pu1_buf1);
 1984|       |
 1985|      0|                ppv_map_ref_idx_to_poc_lx_b[0] = (ps_pic->pu1_buf1) + 1;
 1986|      0|                ppv_map_ref_idx_to_poc_lx_t[1] = (ps_pic->pu1_buf1) + 1;
 1987|       |
 1988|      0|                ppv_map_ref_idx_to_poc_lx_t += 2;
 1989|      0|                ppv_map_ref_idx_to_poc_lx_b += 2;
 1990|      0|            }
 1991|       |
 1992|      0|            ppv_map_ref_idx_to_poc_lx_t = ps_dec->ppv_map_ref_idx_to_poc + TOP_LIST_FLD_L1;
  ------------------
  |  |   92|      0|#define TOP_LIST_FLD_L1         3 * POC_LIST_L0_TO_L1_DIFF//TOP_LIST_FLD_L0 + POC_LIST_L0_TO_L1_DIFF_1  //0+33+33+17                //(3 * POC_LIST_L0_TO_L1_DIFF)
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1993|      0|            ppv_map_ref_idx_to_poc_lx_b = ps_dec->ppv_map_ref_idx_to_poc + BOT_LIST_FLD_L1;
  ------------------
  |  |   94|      0|#define BOT_LIST_FLD_L1         5 * POC_LIST_L0_TO_L1_DIFF//BOT_LIST_FLD_L0 + POC_LIST_L0_TO_L1_DIFF_1  //0+33+33+17+17+17
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1994|       |
 1995|      0|            ppv_map_ref_idx_to_poc_lx_t[0] = 0;
 1996|      0|            ppv_map_ref_idx_to_poc_lx_t++;
 1997|      0|            ppv_map_ref_idx_to_poc_lx_b[0] = 0;
 1998|      0|            ppv_map_ref_idx_to_poc_lx_b++;
 1999|      0|            for(idx = 0; idx < ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1]; idx++)
  ------------------
  |  Branch (1999:26): [True: 0, False: 0]
  ------------------
 2000|      0|            {
 2001|      0|                UWORD8 u1_tmp_idx = idx << 1;
 2002|      0|                ps_pic = ps_dec->ps_ref_pic_buf_lx[1][idx];
 2003|      0|                ppv_map_ref_idx_to_poc_lx_t[u1_tmp_idx] = (ps_pic->pu1_buf1);
 2004|      0|                ppv_map_ref_idx_to_poc_lx_b[u1_tmp_idx + 1] = (ps_pic->pu1_buf1);
 2005|       |
 2006|      0|                ppv_map_ref_idx_to_poc_lx_b[u1_tmp_idx] = (ps_pic->pu1_buf1) + 1;
 2007|      0|                ppv_map_ref_idx_to_poc_lx_t[u1_tmp_idx + 1] = (ps_pic->pu1_buf1) + 1;
 2008|      0|            }
 2009|      0|        }
 2010|  1.38k|    }
 2011|       |
 2012|  1.38k|    if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag && (ps_dec->ps_cur_slice->u1_field_pic_flag == 0))
  ------------------
  |  Branch (2012:8): [True: 0, False: 1.38k]
  |  Branch (2012:53): [True: 0, False: 0]
  ------------------
 2013|      0|    {
 2014|      0|        ih264d_convert_frm_mbaff_list(ps_dec);
 2015|      0|    }
 2016|       |
 2017|  1.38k|    if(ps_pps->u1_wted_bipred_idc == 1)
  ------------------
  |  Branch (2017:8): [True: 31, False: 1.35k]
  ------------------
 2018|     31|    {
 2019|     31|        ret = ih264d_parse_pred_weight_table(ps_slice, ps_bitstrm);
 2020|     31|        if(ret != OK) return ret;
  ------------------
  |  |  114|     31|#define OK        0
  ------------------
  |  Branch (2020:12): [True: 25, False: 6]
  ------------------
 2021|      6|        ih264d_form_pred_weight_matrix(ps_dec);
 2022|      6|        ps_dec->pu4_wt_ofsts = ps_dec->pu4_wts_ofsts_mat;
 2023|      6|    }
 2024|  1.35k|    else if(ps_pps->u1_wted_bipred_idc == 2)
  ------------------
  |  Branch (2024:13): [True: 337, False: 1.01k]
  ------------------
 2025|    337|    {
 2026|       |        /* Implicit Weighted prediction */
 2027|    337|        ps_slice->u2_log2Y_crwd = 0x0505;
 2028|    337|        ps_dec->pu4_wt_ofsts = ps_dec->pu4_wts_ofsts_mat;
 2029|    337|        ih264d_get_implicit_weights(ps_dec);
 2030|    337|    }
 2031|  1.01k|    else
 2032|  1.01k|        ps_dec->ps_cur_slice->u2_log2Y_crwd = 0;
 2033|       |
 2034|  1.36k|    ps_dec->ps_parse_cur_slice->u2_log2Y_crwd = ps_dec->ps_cur_slice->u2_log2Y_crwd;
 2035|       |
 2036|       |    /* G050 */
 2037|  1.36k|    if(ps_slice->u1_nal_ref_idc != 0)
  ------------------
  |  Branch (2037:8): [True: 411, False: 950]
  ------------------
 2038|    411|    {
 2039|    411|        if(!ps_dec->ps_dpb_cmds->u1_dpb_commands_read)
  ------------------
  |  Branch (2039:12): [True: 411, False: 0]
  ------------------
 2040|    411|        {
 2041|    411|            dec_pic_params_t *ps_pps = ps_dec->ps_cur_pps;
 2042|    411|            dec_seq_params_t *ps_sps_tmp = ps_pps->ps_sps;
 2043|    411|            UWORD8 u1_nal_unit_type_tmp = ps_dec->u1_nal_unit_type;
 2044|       |
 2045|    411|            ps_pps->ps_sps = ps_dec->ps_cur_sps;
 2046|    411|            if(ps_svc_lyr_dec->ps_nal_svc_ext->u1_idr_flag)
  ------------------
  |  Branch (2046:16): [True: 385, False: 26]
  ------------------
 2047|    385|                ps_dec->u1_nal_unit_type = IDR_SLICE_NAL;
  ------------------
  |  |  328|    385|#define IDR_SLICE_NAL                   5
  ------------------
 2048|       |
 2049|    411|            i_temp = ih264d_read_mmco_commands(ps_dec);
 2050|       |
 2051|    411|            ps_pps->ps_sps = ps_sps_tmp;
 2052|    411|            ps_dec->u1_nal_unit_type = u1_nal_unit_type_tmp;
 2053|       |
 2054|    411|            if(i_temp < 0)
  ------------------
  |  Branch (2054:16): [True: 0, False: 411]
  ------------------
 2055|      0|            {
 2056|      0|                return ERROR_DBP_MANAGER_T;
 2057|      0|            }
 2058|    411|            ps_dec->u4_bitoffset = i_temp;
 2059|    411|        }
 2060|      0|        else
 2061|      0|            ps_bitstrm->u4_ofst += ps_dec->u4_bitoffset;
 2062|    411|    }
 2063|       |    /* G050 */
 2064|       |
 2065|  1.36k|    if(ps_pps->u1_entropy_coding_mode == CABAC)
  ------------------
  |  |  339|  1.36k|#define CABAC  1
  ------------------
  |  Branch (2065:8): [True: 1.21k, False: 150]
  ------------------
 2066|  1.21k|    {
 2067|  1.21k|        u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 2068|  1.21k|        if(u4_temp > MAX_CABAC_INIT_IDC)
  ------------------
  |  |  537|  1.21k|#define MAX_CABAC_INIT_IDC        2
  ------------------
  |  Branch (2068:12): [True: 9, False: 1.20k]
  ------------------
 2069|      9|        {
 2070|      9|            return ERROR_INV_SLICE_HDR_T;
 2071|      9|        }
 2072|  1.20k|        ps_slice->u1_cabac_init_idc = u4_temp;
 2073|  1.20k|        COPYTHECONTEXT("SH: cabac_init_idc", ps_slice->u1_cabac_init_idc);
 2074|  1.20k|    }
 2075|  1.35k|    {
 2076|       |        /* Read slice_qp_delta */
 2077|  1.35k|        WORD64 i8_temp =
 2078|  1.35k|            (WORD64) ps_pps->u1_pic_init_qp + ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 2079|  1.35k|        if((i8_temp < MIN_H264_QP) || (i8_temp > MAX_H264_QP))
  ------------------
  |  |  629|  1.35k|#define MIN_H264_QP 0
  ------------------
                      if((i8_temp < MIN_H264_QP) || (i8_temp > MAX_H264_QP))
  ------------------
  |  |  634|  1.34k|#define MAX_H264_QP 51
  ------------------
  |  Branch (2079:12): [True: 8, False: 1.34k]
  |  Branch (2079:39): [True: 43, False: 1.30k]
  ------------------
 2080|     51|        {
 2081|     51|            return ERROR_INV_RANGE_QP_T;
 2082|     51|        }
 2083|  1.30k|        ps_slice->u1_slice_qp = (UWORD8) i8_temp;
 2084|  1.30k|        COPYTHECONTEXT("SH: slice_qp_delta",
 2085|  1.30k|                       (WORD8) (ps_slice->u1_slice_qp - ps_pps->u1_pic_init_qp));
 2086|  1.30k|    }
 2087|  1.30k|    if(ps_pps->u1_deblocking_filter_parameters_present_flag == 1)
  ------------------
  |  Branch (2087:8): [True: 1.18k, False: 112]
  ------------------
 2088|  1.18k|    {
 2089|  1.18k|        u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 2090|  1.18k|        if(u4_temp > SLICE_BOUNDARY_DBLK_DISABLED)
  ------------------
  |  |  547|  1.18k|#define SLICE_BOUNDARY_DBLK_DISABLED  2
  ------------------
  |  Branch (2090:12): [True: 5, False: 1.18k]
  ------------------
 2091|      5|        {
 2092|      5|            return ERROR_INV_SLICE_HDR_T;
 2093|      5|        }
 2094|  1.18k|        COPYTHECONTEXT("SH: disable_deblocking_filter_idc", u4_temp);
 2095|  1.18k|        ps_slice->u1_disable_dblk_filter_idc = u4_temp;
 2096|  1.18k|        if(u4_temp != 1)
  ------------------
  |  Branch (2096:12): [True: 1.16k, False: 24]
  ------------------
 2097|  1.16k|        {
 2098|  1.16k|            i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf) << 1;
 2099|  1.16k|            if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  550|  1.16k|#define MIN_DBLK_FIL_OFF              -12
  ------------------
                          if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  551|  1.15k|#define MAX_DBLK_FIL_OFF              12
  ------------------
  |  Branch (2099:16): [True: 4, False: 1.15k]
  |  Branch (2099:47): [True: 0, False: 1.15k]
  ------------------
 2100|      4|            {
 2101|      4|                return ERROR_INV_SLICE_HDR_T;
 2102|      4|            }
 2103|  1.15k|            ps_slice->i1_slice_alpha_c0_offset = i_temp;
 2104|  1.15k|            COPYTHECONTEXT("SH: slice_alpha_c0_offset_div2",
 2105|  1.15k|                           ps_slice->i1_slice_alpha_c0_offset >> 1);
 2106|       |
 2107|  1.15k|            i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf) << 1;
 2108|  1.15k|            if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  550|  1.15k|#define MIN_DBLK_FIL_OFF              -12
  ------------------
                          if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  551|  1.15k|#define MAX_DBLK_FIL_OFF              12
  ------------------
  |  Branch (2108:16): [True: 0, False: 1.15k]
  |  Branch (2108:47): [True: 0, False: 1.15k]
  ------------------
 2109|      0|            {
 2110|      0|                return ERROR_INV_SLICE_HDR_T;
 2111|      0|            }
 2112|  1.15k|            ps_slice->i1_slice_beta_offset = i_temp;
 2113|  1.15k|            COPYTHECONTEXT("SH: slice_beta_offset_div2", ps_slice->i1_slice_beta_offset >> 1);
 2114|  1.15k|        }
 2115|     24|        else
 2116|     24|        {
 2117|     24|            ps_slice->i1_slice_alpha_c0_offset = 0;
 2118|     24|            ps_slice->i1_slice_beta_offset = 0;
 2119|     24|        }
 2120|  1.18k|    }
 2121|    112|    else
 2122|    112|    {
 2123|    112|        ps_slice->u1_disable_dblk_filter_idc = 0;
 2124|    112|        ps_slice->i1_slice_alpha_c0_offset = 0;
 2125|    112|        ps_slice->i1_slice_beta_offset = 0;
 2126|    112|    }
 2127|       |
 2128|  1.29k|    ps_dec->u1_slice_header_done = 2;
 2129|       |
 2130|  1.29k|    if(ps_pps->u1_entropy_coding_mode)
  ------------------
  |  Branch (2130:8): [True: 1.20k, False: 90]
  ------------------
 2131|  1.20k|    {
 2132|  1.20k|        SWITCHOFFTRACE;
 2133|  1.20k|        SWITCHONTRACECABAC;
 2134|  1.20k|        ps_svc_lyr_dec->pf_parse_svc_inter_slice = isvcd_parse_inter_slice_data_cabac;
 2135|  1.20k|        ps_dec->pf_parse_inter_mb = ih264d_parse_bmb_cabac;
 2136|  1.20k|        ih264d_init_cabac_contexts(B_SLICE, ps_dec);
  ------------------
  |  |  369|  1.20k|#define B_SLICE  1
  ------------------
 2137|       |
 2138|  1.20k|        if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (2138:12): [True: 0, False: 1.20k]
  ------------------
 2139|      0|            ps_dec->pf_get_mb_info = ih264d_get_mb_info_cabac_mbaff;
 2140|  1.20k|        else
 2141|  1.20k|            ps_dec->pf_get_mb_info = isvcd_get_mb_info_cabac_nonmbaff;
 2142|  1.20k|    }
 2143|     90|    else
 2144|     90|    {
 2145|     90|        SWITCHONTRACE;
 2146|     90|        SWITCHOFFTRACECABAC;
 2147|     90|        ps_svc_lyr_dec->pf_parse_svc_inter_slice = isvcd_parse_inter_slice_data_cavlc;
 2148|     90|        ps_dec->pf_parse_inter_mb = ih264d_parse_bmb_cavlc;
 2149|     90|        if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (2149:12): [True: 0, False: 90]
  ------------------
 2150|      0|            ps_dec->pf_get_mb_info = ih264d_get_mb_info_cavlc_mbaff;
 2151|     90|        else
 2152|     90|            ps_dec->pf_get_mb_info = isvcd_get_mb_info_cavlc_nonmbaff;
 2153|     90|    }
 2154|       |
 2155|  1.29k|    ret = ih264d_cal_col_pic(ps_dec);
 2156|  1.29k|    if(ret != OK) return ret;
  ------------------
  |  |  114|  1.29k|#define OK        0
  ------------------
  |  Branch (2156:8): [True: 0, False: 1.29k]
  ------------------
 2157|  1.29k|    ps_dec->u1_B = 1;
 2158|  1.29k|    ps_dec->pf_mvpred_ref_tfr_nby2mb = ih264d_mv_pred_ref_tfr_nby2_bmb;
 2159|  1.29k|    ret = ps_svc_lyr_dec->pf_parse_svc_inter_slice(ps_svc_lyr_dec, ps_slice, u2_first_mb_in_slice);
 2160|  1.29k|    if(ret != OK) return ret;
  ------------------
  |  |  114|  1.29k|#define OK        0
  ------------------
  |  Branch (2160:8): [True: 403, False: 889]
  ------------------
 2161|       |
 2162|    889|    return OK;
  ------------------
  |  |  114|    889|#define OK        0
  ------------------
 2163|  1.29k|}

isvcd_parse_islice_data_cabac:
  108|    715|{
  109|    715|    UWORD8 uc_more_data_flag;
  110|    715|    UWORD32 u4_num_mbs, u4_mb_idx;
  111|    715|    dec_mb_info_t *ps_cur_mb_info;
  112|    715|    deblk_mb_t *ps_cur_deblk_mb;
  113|    715|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  114|    715|    dec_bit_stream_t *const ps_bitstrm = ps_dec->ps_bitstrm;
  115|    715|    UWORD16 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs;
  116|    715|    WORD32 i4_cur_mb_addr;
  117|    715|    UWORD8 u1_mbaff;
  118|    715|    UWORD32 u4_num_mbs_next, u4_end_of_row, u4_tfr_n_mb;
  119|    715|    WORD32 ret = OK;
  ------------------
  |  |  114|    715|#define OK        0
  ------------------
  120|       |
  121|    715|    ps_dec->u1_qp = ps_slice->u1_slice_qp;
  122|    715|    ih264d_update_qp(ps_dec, 0);
  123|    715|    u1_mbaff = ps_slice->u1_mbaff_frame_flag;
  124|       |
  125|    715|    if(ps_bitstrm->u4_ofst & 0x07)
  ------------------
  |  Branch (125:8): [True: 708, False: 7]
  ------------------
  126|    708|    {
  127|    708|        ps_bitstrm->u4_ofst += 8;
  128|    708|        ps_bitstrm->u4_ofst &= 0xFFFFFFF8;
  129|    708|    }
  130|    715|    ret = ih264d_init_cabac_dec_envirnoment(&(ps_dec->s_cab_dec_env), ps_bitstrm);
  131|    715|    if(ret != OK) return ret;
  ------------------
  |  |  114|    715|#define OK        0
  ------------------
  |  Branch (131:8): [True: 4, False: 711]
  ------------------
  132|    711|    ih264d_init_cabac_contexts(I_SLICE, ps_dec);
  ------------------
  |  |  370|    711|#define I_SLICE  2
  ------------------
  133|       |
  134|    711|    ps_dec->i1_prev_mb_qp_delta = 0;
  135|       |
  136|       |    /* initializations */
  137|    711|    u4_mb_idx = ps_dec->u4_mb_idx;
  138|    711|    u4_num_mbs = u4_mb_idx;
  139|    711|    uc_more_data_flag = 1;
  140|    711|    i4_cur_mb_addr = u2_first_mb_in_slice << u1_mbaff;
  141|    711|    do
  142|  6.97k|    {
  143|  6.97k|        UWORD16 u2_mbx;
  144|  6.97k|        ps_dec->pv_prev_mb_parse_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
  145|       |
  146|  6.97k|        if(i4_cur_mb_addr > ps_dec->ps_cur_sps->u4_max_mb_addr)
  ------------------
  |  Branch (146:12): [True: 9, False: 6.96k]
  ------------------
  147|      9|        {
  148|      9|            break;
  149|      9|        }
  150|       |
  151|  6.96k|        {
  152|  6.96k|            UWORD8 u1_mb_type;
  153|  6.96k|            ps_cur_mb_info = ps_dec->ps_nmb_info + u4_num_mbs;
  154|  6.96k|            ps_dec->u4_num_mbs_cur_nmb = u4_num_mbs;
  155|  6.96k|            ps_dec->u4_num_pmbair = (u4_num_mbs >> u1_mbaff);
  156|  6.96k|            ps_cur_mb_info->u1_end_of_slice = 0;
  157|       |
  158|       |            /***************************************************************/
  159|       |            /* Get the required information for decoding of MB                  */
  160|       |            /* mb_x, mb_y , neighbour availablity,                              */
  161|       |            /***************************************************************/
  162|  6.96k|            ps_dec->pf_get_mb_info(ps_dec, i4_cur_mb_addr, ps_cur_mb_info, 0);
  163|  6.96k|            u2_mbx = ps_dec->u2_mbx;
  164|       |
  165|       |            /*********************************************************************/
  166|       |            /* initialize u1_tran_form8x8 to zero to aviod uninitialized accesses */
  167|       |            /*********************************************************************/
  168|  6.96k|            ps_cur_mb_info->u1_tran_form8x8 = 0;
  169|  6.96k|            ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
  170|       |
  171|       |            /***************************************************************/
  172|       |            /* Set the deblocking parameters for this MB                   */
  173|       |            /***************************************************************/
  174|  6.96k|            ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u4_num_mbs;
  175|  6.96k|            if(ps_dec->u4_app_disable_deblk_frm == 0)
  ------------------
  |  Branch (175:16): [True: 6.96k, False: 0]
  ------------------
  176|  6.96k|                ih264d_set_deblocking_parameters(ps_cur_deblk_mb, ps_slice,
  177|  6.96k|                                                 ps_dec->u1_mb_ngbr_availablity,
  178|  6.96k|                                                 ps_dec->u1_cur_mb_fld_dec_flag);
  179|       |
  180|  6.96k|            ps_cur_deblk_mb->u1_mb_type = ps_cur_deblk_mb->u1_mb_type | D_INTRA_MB;
  ------------------
  |  |  382|  6.96k|#define D_INTRA_MB        1
  ------------------
  181|       |
  182|       |            /* Macroblock Layer Begins */
  183|       |            /* Decode the u1_mb_type */
  184|  6.96k|            u1_mb_type = ih264d_parse_mb_type_intra_cabac(0, ps_dec);
  185|  6.96k|            if(u1_mb_type > 25) return ERROR_MB_TYPE;
  ------------------
  |  Branch (185:16): [True: 0, False: 6.96k]
  ------------------
  186|  6.96k|            ps_cur_mb_info->u1_mb_type = u1_mb_type;
  187|  6.96k|            COPYTHECONTEXT("u1_mb_type", u1_mb_type);
  188|       |
  189|       |            /* Parse Macroblock Data */
  190|  6.96k|            if(25 == u1_mb_type)
  ------------------
  |  Branch (190:16): [True: 557, False: 6.40k]
  ------------------
  191|    557|            {
  192|       |                /* I_PCM_MB */
  193|    557|                ps_cur_mb_info->ps_curmb->u1_mb_type = I_PCM_MB;
  ------------------
  |  |  423|    557|#define I_PCM_MB    6
  ------------------
  194|    557|                ret = ih264d_parse_ipcm_mb(ps_dec, ps_cur_mb_info, u4_num_mbs);
  195|    557|                if(ret != OK) return ret;
  ------------------
  |  |  114|    557|#define OK        0
  ------------------
  |  Branch (195:20): [True: 218, False: 339]
  ------------------
  196|    339|                ps_cur_deblk_mb->u1_mb_qp = 0;
  197|    339|            }
  198|  6.40k|            else
  199|  6.40k|            {
  200|  6.40k|                ret = ih264d_parse_imb_cabac(ps_dec, ps_cur_mb_info, u1_mb_type);
  201|  6.40k|                if(ret != OK) return ret;
  ------------------
  |  |  114|  6.40k|#define OK        0
  ------------------
  |  Branch (201:20): [True: 442, False: 5.96k]
  ------------------
  202|  5.96k|                ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp;
  203|  5.96k|            }
  204|       |
  205|  6.30k|            if(ps_dec->u1_enable_mb_info)
  ------------------
  |  Branch (205:16): [True: 0, False: 6.30k]
  ------------------
  206|      0|            {
  207|      0|                ih264d_populate_mb_info_map(ps_dec, ps_cur_mb_info, ps_cur_mb_info->u2_mbx << 1,
  208|      0|                                            ps_cur_mb_info->u2_mby << 1, ps_cur_deblk_mb->u1_mb_qp);
  209|      0|            }
  210|  6.30k|            if(u1_mbaff)
  ------------------
  |  Branch (210:16): [True: 0, False: 6.30k]
  ------------------
  211|      0|            {
  212|      0|                ih264d_update_mbaff_left_nnz(ps_dec, ps_cur_mb_info);
  213|      0|            }
  214|       |
  215|  6.30k|            if(ps_cur_mb_info->u1_topmb && u1_mbaff)
  ------------------
  |  Branch (215:16): [True: 6.30k, False: 0]
  |  Branch (215:44): [True: 0, False: 6.30k]
  ------------------
  216|      0|                uc_more_data_flag = 1;
  217|  6.30k|            else
  218|  6.30k|            {
  219|  6.30k|                uc_more_data_flag = ih264d_decode_terminate(&ps_dec->s_cab_dec_env, ps_bitstrm);
  220|  6.30k|                uc_more_data_flag = !uc_more_data_flag;
  221|  6.30k|                COPYTHECONTEXT("Decode Sliceterm", !uc_more_data_flag);
  222|  6.30k|            }
  223|       |
  224|  6.30k|            if(u1_mbaff)
  ------------------
  |  Branch (224:16): [True: 0, False: 6.30k]
  ------------------
  225|      0|            {
  226|      0|                if(!uc_more_data_flag && (0 == (i4_cur_mb_addr & 1)))
  ------------------
  |  Branch (226:20): [True: 0, False: 0]
  |  Branch (226:42): [True: 0, False: 0]
  ------------------
  227|      0|                {
  228|      0|                    return ERROR_EOB_FLUSHBITS_T;
  229|      0|                }
  230|      0|            }
  231|       |            /* Next macroblock information */
  232|  6.30k|            i4_cur_mb_addr++;
  233|       |            /* Store the colocated information */
  234|  6.30k|            {
  235|  6.30k|                mv_pred_t *ps_mv_nmb_start = ps_dec->ps_mv_cur + (u4_num_mbs << 4);
  236|  6.30k|                mv_pred_t s_mvPred = {{0, 0, 0, 0}, {-1, -1}, 0, 0};
  237|  6.30k|                ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb_start, 0,
  238|  6.30k|                                   (UWORD8) (ps_dec->u1_cur_mb_fld_dec_flag << 1), 4, 4);
  239|  6.30k|            }
  240|       |            /*if num _cores is set to 3,compute bs will be done in another thread*/
  241|  6.30k|            if(ps_dec->u4_num_cores < 3)
  ------------------
  |  Branch (241:16): [True: 6.30k, False: 0]
  ------------------
  242|  6.30k|            {
  243|  6.30k|                if(ps_dec->u4_app_disable_deblk_frm == 0)
  ------------------
  |  Branch (243:20): [True: 6.30k, False: 0]
  ------------------
  244|  6.30k|                    ps_svc_lyr_dec->pf_svc_compute_bs(ps_svc_lyr_dec, ps_cur_mb_info,
  245|  6.30k|                                                      (UWORD16) (u4_num_mbs >> u1_mbaff));
  246|  6.30k|            }
  247|  6.30k|            u4_num_mbs++;
  248|  6.30k|        }
  249|       |
  250|       |        /****************************************************************/
  251|       |        /* Check for End Of Row                                         */
  252|       |        /****************************************************************/
  253|      0|        u4_num_mbs_next = i2_pic_wdin_mbs - u2_mbx - 1;
  254|  6.30k|        u4_end_of_row = (!u4_num_mbs_next) && (!(u1_mbaff && (u4_num_mbs & 0x01)));
  ------------------
  |  Branch (254:25): [True: 2.16k, False: 4.13k]
  |  Branch (254:50): [True: 0, False: 2.16k]
  |  Branch (254:62): [True: 0, False: 0]
  ------------------
  255|  6.30k|        u4_tfr_n_mb =
  256|  6.30k|            (u4_num_mbs == ps_dec->u4_recon_mb_grp) || u4_end_of_row || (!uc_more_data_flag);
  ------------------
  |  Branch (256:13): [True: 2.16k, False: 4.13k]
  |  Branch (256:56): [True: 0, False: 4.13k]
  |  Branch (256:73): [True: 29, False: 4.10k]
  ------------------
  257|  6.30k|        ps_cur_mb_info->u1_end_of_slice = (!uc_more_data_flag);
  258|       |
  259|  6.30k|        if(u4_tfr_n_mb || (!uc_more_data_flag))
  ------------------
  |  Branch (259:12): [True: 2.19k, False: 4.10k]
  |  Branch (259:27): [True: 0, False: 4.10k]
  ------------------
  260|  2.19k|        {
  261|  2.19k|            if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (261:16): [True: 115, False: 2.08k]
  ------------------
  262|    115|            {
  263|    115|                ih264d_parse_tfr_nmb(ps_dec, u4_mb_idx, u4_num_mbs, u4_num_mbs_next, u4_tfr_n_mb,
  264|    115|                                     u4_end_of_row);
  265|    115|                ps_dec->ps_nmb_info += u4_num_mbs;
  266|    115|                ps_svc_lyr_dec->ps_svc_nmb_info += u4_num_mbs;
  267|    115|            }
  268|  2.08k|            else
  269|  2.08k|            {
  270|  2.08k|                if(ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER)
  ------------------
  |  |  110|  2.08k|#define TARGET_LAYER 2
  ------------------
  |  Branch (270:20): [True: 495, False: 1.58k]
  ------------------
  271|    495|                {
  272|    495|                    ih264d_decode_recon_tfr_nmb(ps_dec, u4_mb_idx, u4_num_mbs, u4_num_mbs_next,
  273|    495|                                                u4_tfr_n_mb, u4_end_of_row);
  274|    495|                }
  275|  1.58k|                else
  276|  1.58k|                {
  277|  1.58k|                    isvcd_decode_recon_tfr_nmb_base_lyr(ps_svc_lyr_dec, u4_mb_idx, u4_num_mbs,
  278|  1.58k|                                                        u4_num_mbs_next, u4_tfr_n_mb,
  279|  1.58k|                                                        u4_end_of_row);
  280|  1.58k|                }
  281|  2.08k|            }
  282|  2.19k|            ps_dec->u4_total_mbs_coded += u4_num_mbs;
  283|  2.19k|            if(u4_tfr_n_mb) u4_num_mbs = 0;
  ------------------
  |  Branch (283:16): [True: 2.19k, False: 0]
  ------------------
  284|  2.19k|            u4_mb_idx = u4_num_mbs;
  285|  2.19k|            ps_dec->u4_mb_idx = u4_num_mbs;
  286|  2.19k|        }
  287|  6.30k|    } while(uc_more_data_flag);
  ------------------
  |  Branch (287:13): [True: 6.26k, False: 42]
  ------------------
  288|       |
  289|     51|    ps_dec->u4_num_mbs_cur_nmb = 0;
  290|     51|    ps_dec->ps_cur_slice->u4_mbs_in_slice = i4_cur_mb_addr - (u2_first_mb_in_slice << u1_mbaff);
  291|       |
  292|     51|    return ret;
  293|    711|}
isvcd_parse_islice_data_cavlc:
  322|     77|{
  323|     77|    UWORD8 uc_more_data_flag;
  324|     77|    UWORD32 u4_num_mbs, u4_mb_idx;
  325|     77|    dec_mb_info_t *ps_cur_mb_info;
  326|     77|    deblk_mb_t *ps_cur_deblk_mb;
  327|     77|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  328|     77|    dec_bit_stream_t *const ps_bitstrm = ps_dec->ps_bitstrm;
  329|     77|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  330|     77|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  331|     77|    UWORD16 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs;
  332|     77|    WORD32 i4_cur_mb_addr;
  333|     77|    UWORD8 u1_mbaff;
  334|     77|    UWORD32 u4_num_mbs_next, u4_end_of_row, u4_tfr_n_mb;
  335|     77|    WORD32 ret = OK;
  ------------------
  |  |  114|     77|#define OK        0
  ------------------
  336|       |
  337|     77|    ps_dec->u1_qp = ps_slice->u1_slice_qp;
  338|     77|    ih264d_update_qp(ps_dec, 0);
  339|     77|    u1_mbaff = ps_slice->u1_mbaff_frame_flag;
  340|       |
  341|       |    /* initializations */
  342|     77|    u4_mb_idx = ps_dec->u4_mb_idx;
  343|     77|    u4_num_mbs = u4_mb_idx;
  344|       |
  345|     77|    uc_more_data_flag = 1;
  346|     77|    i4_cur_mb_addr = u2_first_mb_in_slice << u1_mbaff;
  347|     77|    do
  348|  1.78k|    {
  349|  1.78k|        UWORD8 u1_mb_type;
  350|  1.78k|        ps_dec->pv_prev_mb_parse_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
  351|  1.78k|        if(i4_cur_mb_addr > ps_dec->ps_cur_sps->u4_max_mb_addr)
  ------------------
  |  Branch (351:12): [True: 12, False: 1.77k]
  ------------------
  352|     12|        {
  353|     12|            break;
  354|     12|        }
  355|       |
  356|  1.77k|        ps_cur_mb_info = ps_dec->ps_nmb_info + u4_num_mbs;
  357|  1.77k|        ps_dec->u4_num_mbs_cur_nmb = u4_num_mbs;
  358|  1.77k|        ps_dec->u4_num_pmbair = (u4_num_mbs >> u1_mbaff);
  359|  1.77k|        ps_cur_mb_info->u1_end_of_slice = 0;
  360|       |
  361|       |        /***************************************************************/
  362|       |        /* Get the required information for decoding of MB             */
  363|       |        /* mb_x, mb_y , neighbour availablity,                         */
  364|       |        /***************************************************************/
  365|  1.77k|        ps_dec->pf_get_mb_info(ps_dec, i4_cur_mb_addr, ps_cur_mb_info, 0);
  366|       |
  367|       |        /***************************************************************/
  368|       |        /* Set the deblocking parameters for this MB                   */
  369|       |        /***************************************************************/
  370|  1.77k|        ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u4_num_mbs;
  371|  1.77k|        if(ps_dec->u4_app_disable_deblk_frm == 0)
  ------------------
  |  Branch (371:12): [True: 1.77k, False: 0]
  ------------------
  372|  1.77k|            ih264d_set_deblocking_parameters(ps_cur_deblk_mb, ps_slice,
  373|  1.77k|                                             ps_dec->u1_mb_ngbr_availablity,
  374|  1.77k|                                             ps_dec->u1_cur_mb_fld_dec_flag);
  375|       |
  376|  1.77k|        ps_cur_deblk_mb->u1_mb_type = ps_cur_deblk_mb->u1_mb_type | D_INTRA_MB;
  ------------------
  |  |  382|  1.77k|#define D_INTRA_MB        1
  ------------------
  377|       |
  378|       |        /**************************************************************/
  379|       |        /* Macroblock Layer Begins, Decode the u1_mb_type             */
  380|       |        /**************************************************************/
  381|       |        /* Inlined ih264d_uev */
  382|  1.77k|        {
  383|  1.77k|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  384|  1.77k|            UWORD32 u4_word, u4_ldz, u4_temp;
  385|       |
  386|       |            /***************************************************************/
  387|       |            /* Find leading zeros in next 32 bits                          */
  388|       |            /***************************************************************/
  389|  1.77k|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|  1.77k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|  1.77k|{                                                                           \
  |  |  152|  1.77k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|  1.77k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|  1.77k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|  1.77k|                                                                            \
  |  |  156|  1.77k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|  1.77k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 1.55k, False: 222]
  |  |  ------------------
  |  |  158|  1.77k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|  1.55k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|  1.77k|}
  ------------------
  390|  1.77k|            u4_ldz = CLZ(u4_word);
  391|       |            /* Flush the ps_bitstrm */
  392|  1.77k|            u4_bitstream_offset += (u4_ldz + 1);
  393|       |            /* Read the suffix from the ps_bitstrm */
  394|  1.77k|            u4_word = 0;
  395|  1.77k|            if(u4_ldz) GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|  1.54k|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|  1.54k|{                                                                           \
  |  |  122|  1.54k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|  1.54k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|  1.54k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|  1.54k|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|  1.54k|                                                                            \
  |  |  127|  1.54k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 1.51k, False: 32]
  |  |  ------------------
  |  |  128|  1.54k|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  1.51k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|  1.54k|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  1.54k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|  1.54k|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|  1.54k|}                                                                           \
  ------------------
  |  Branch (395:16): [True: 1.54k, False: 230]
  ------------------
  396|  1.77k|            *pu4_bitstrm_ofst = u4_bitstream_offset;
  397|  1.77k|            u4_temp = ((1 << u4_ldz) + u4_word - 1);
  398|  1.77k|            if(u4_temp > 25) return ERROR_MB_TYPE;
  ------------------
  |  Branch (398:16): [True: 33, False: 1.74k]
  ------------------
  399|  1.74k|            u1_mb_type = u4_temp;
  400|  1.74k|        }
  401|       |        /* Inlined ih264d_uev */
  402|      0|        ps_cur_mb_info->u1_mb_type = u1_mb_type;
  403|  1.74k|        COPYTHECONTEXT("u1_mb_type", u1_mb_type);
  404|       |
  405|       |        /**************************************************************/
  406|       |        /* Parse Macroblock data                                      */
  407|       |        /**************************************************************/
  408|  1.74k|        if(25 == u1_mb_type)
  ------------------
  |  Branch (408:12): [True: 0, False: 1.74k]
  ------------------
  409|      0|        {
  410|       |            /* I_PCM_MB */
  411|      0|            ps_cur_mb_info->ps_curmb->u1_mb_type = I_PCM_MB;
  ------------------
  |  |  423|      0|#define I_PCM_MB    6
  ------------------
  412|      0|            ret = ih264d_parse_ipcm_mb(ps_dec, ps_cur_mb_info, u4_num_mbs);
  413|      0|            if(ret != OK) return ret;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (413:16): [True: 0, False: 0]
  ------------------
  414|      0|            ps_cur_deblk_mb->u1_mb_qp = 0;
  415|      0|        }
  416|  1.74k|        else
  417|  1.74k|        {
  418|  1.74k|            ret = ih264d_parse_imb_cavlc(ps_dec, ps_cur_mb_info, u4_num_mbs, u1_mb_type);
  419|  1.74k|            if(ret != OK) return ret;
  ------------------
  |  |  114|  1.74k|#define OK        0
  ------------------
  |  Branch (419:16): [True: 31, False: 1.70k]
  ------------------
  420|  1.70k|            ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp;
  421|  1.70k|        }
  422|  1.70k|        if(ps_dec->u1_enable_mb_info)
  ------------------
  |  Branch (422:12): [True: 0, False: 1.70k]
  ------------------
  423|      0|        {
  424|      0|            ih264d_populate_mb_info_map(ps_dec, ps_cur_mb_info, ps_cur_mb_info->u2_mbx << 1,
  425|      0|                                        ps_cur_mb_info->u2_mby << 1, ps_cur_deblk_mb->u1_mb_qp);
  426|      0|        }
  427|  1.70k|        uc_more_data_flag = MORE_RBSP_DATA(ps_bitstrm);
  ------------------
  |  |   97|  1.70k|    CHECK_BITS_SUFFICIENT(ps_bitstrm, 1)
  |  |  ------------------
  |  |  |  |   95|  1.70k|  (ps_bitstrm->u4_ofst + bits_to_read <= ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  ------------------
  428|  1.70k|        if(u1_mbaff)
  ------------------
  |  Branch (428:12): [True: 0, False: 1.70k]
  ------------------
  429|      0|        {
  430|      0|            ih264d_update_mbaff_left_nnz(ps_dec, ps_cur_mb_info);
  431|      0|            if(!uc_more_data_flag && (0 == (i4_cur_mb_addr & 1)))
  ------------------
  |  Branch (431:16): [True: 0, False: 0]
  |  Branch (431:38): [True: 0, False: 0]
  ------------------
  432|      0|            {
  433|      0|                return ERROR_EOB_FLUSHBITS_T;
  434|      0|            }
  435|      0|        }
  436|       |        /**************************************************************/
  437|       |        /* Get next Macroblock address                                */
  438|       |        /**************************************************************/
  439|  1.70k|        i4_cur_mb_addr++;
  440|       |        /* Store the colocated information */
  441|  1.70k|        {
  442|  1.70k|            mv_pred_t *ps_mv_nmb_start = ps_dec->ps_mv_cur + (u4_num_mbs << 4);
  443|  1.70k|            mv_pred_t s_mvPred = {{0, 0, 0, 0}, {-1, -1}, 0, 0};
  444|  1.70k|            ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb_start, 0,
  445|  1.70k|                               (UWORD8) (ps_dec->u1_cur_mb_fld_dec_flag << 1), 4, 4);
  446|  1.70k|        }
  447|       |
  448|       |        /*if num _cores is set to 3,compute bs will be done in another thread*/
  449|  1.70k|        if(ps_dec->u4_num_cores < 3)
  ------------------
  |  Branch (449:12): [True: 1.70k, False: 0]
  ------------------
  450|  1.70k|        {
  451|  1.70k|            if(ps_dec->u4_app_disable_deblk_frm == 0)
  ------------------
  |  Branch (451:16): [True: 1.70k, False: 0]
  ------------------
  452|  1.70k|                ps_svc_lyr_dec->pf_svc_compute_bs(ps_svc_lyr_dec, ps_cur_mb_info,
  453|  1.70k|                                                  (UWORD16) (u4_num_mbs >> u1_mbaff));
  454|  1.70k|        }
  455|  1.70k|        u4_num_mbs++;
  456|       |
  457|       |        /****************************************************************/
  458|       |        /* Check for End Of Row                                         */
  459|       |        /****************************************************************/
  460|  1.70k|        u4_num_mbs_next = i2_pic_wdin_mbs - ps_dec->u2_mbx - 1;
  461|  1.70k|        u4_end_of_row = (!u4_num_mbs_next) && (!(u1_mbaff && (u4_num_mbs & 0x01)));
  ------------------
  |  Branch (461:25): [True: 236, False: 1.47k]
  |  Branch (461:50): [True: 0, False: 236]
  |  Branch (461:62): [True: 0, False: 0]
  ------------------
  462|  1.70k|        u4_tfr_n_mb =
  463|  1.70k|            (u4_num_mbs == ps_dec->u4_recon_mb_grp) || u4_end_of_row || (!uc_more_data_flag);
  ------------------
  |  Branch (463:13): [True: 236, False: 1.47k]
  |  Branch (463:56): [True: 0, False: 1.47k]
  |  Branch (463:73): [True: 1, False: 1.47k]
  ------------------
  464|  1.70k|        ps_cur_mb_info->u1_end_of_slice = (!uc_more_data_flag);
  465|       |
  466|  1.70k|        if(u4_tfr_n_mb || (!uc_more_data_flag))
  ------------------
  |  Branch (466:12): [True: 237, False: 1.47k]
  |  Branch (466:27): [True: 0, False: 1.47k]
  ------------------
  467|    237|        {
  468|    237|            if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (468:16): [True: 0, False: 237]
  ------------------
  469|      0|            {
  470|      0|                ih264d_parse_tfr_nmb(ps_dec, u4_mb_idx, u4_num_mbs, u4_num_mbs_next, u4_tfr_n_mb,
  471|      0|                                     u4_end_of_row);
  472|      0|                ps_dec->ps_nmb_info += u4_num_mbs;
  473|      0|                ps_svc_lyr_dec->ps_svc_nmb_info += u4_num_mbs;
  474|      0|            }
  475|    237|            else
  476|    237|            {
  477|    237|                if(ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER)
  ------------------
  |  |  110|    237|#define TARGET_LAYER 2
  ------------------
  |  Branch (477:20): [True: 193, False: 44]
  ------------------
  478|    193|                {
  479|    193|                    ih264d_decode_recon_tfr_nmb(ps_dec, u4_mb_idx, u4_num_mbs, u4_num_mbs_next,
  480|    193|                                                u4_tfr_n_mb, u4_end_of_row);
  481|    193|                }
  482|     44|                else
  483|     44|                {
  484|     44|                    isvcd_decode_recon_tfr_nmb_base_lyr(ps_svc_lyr_dec, u4_mb_idx, u4_num_mbs,
  485|     44|                                                        u4_num_mbs_next, u4_tfr_n_mb,
  486|     44|                                                        u4_end_of_row);
  487|     44|                }
  488|    237|            }
  489|    237|            ps_dec->u4_total_mbs_coded += u4_num_mbs;
  490|    237|            if(u4_tfr_n_mb) u4_num_mbs = 0;
  ------------------
  |  Branch (490:16): [True: 237, False: 0]
  ------------------
  491|    237|            u4_mb_idx = u4_num_mbs;
  492|    237|            ps_dec->u4_mb_idx = u4_num_mbs;
  493|    237|        }
  494|  1.70k|    } while(uc_more_data_flag);
  ------------------
  |  Branch (494:13): [True: 1.70k, False: 1]
  ------------------
  495|       |
  496|     13|    ps_dec->u4_num_mbs_cur_nmb = 0;
  497|     13|    ps_dec->ps_cur_slice->u4_mbs_in_slice = i4_cur_mb_addr - (u2_first_mb_in_slice << u1_mbaff);
  498|       |
  499|     13|    return ret;
  500|     77|}
isvcd_parse_imb_cavlc:
  517|    782|{
  518|    782|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  519|    782|    WORD32 i4_delta_qp;
  520|    782|    UWORD32 u4_temp;
  521|    782|    UWORD32 ui_is_top_mb_available;
  522|    782|    UWORD32 ui_is_left_mb_available;
  523|    782|    UWORD32 u4_cbp;
  524|    782|    UWORD32 u4_offset;
  525|    782|    UWORD32 *pu4_bitstrm_buf;
  526|    782|    WORD32 ret;
  527|    782|    dec_bit_stream_t *const ps_bitstrm = ps_dec->ps_bitstrm;
  528|    782|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  529|    782|    UNUSED(u4_mb_num);
  ------------------
  |  |   45|    782|#define UNUSED(x) ((void)(x))
  ------------------
  530|       |
  531|    782|    ps_cur_mb_info->u1_tran_form8x8 = 0;
  532|    782|    ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
  533|    782|    ps_cur_mb_info->u1_yuv_dc_block_flag = 0;
  534|    782|    u4_temp = ps_dec->u1_mb_ngbr_availablity;
  535|    782|    ui_is_top_mb_available = BOOLEAN(u4_temp & TOP_MB_AVAILABLE_MASK);
  ------------------
  |  |   61|    782|#define BOOLEAN(x) (!!(x))
  ------------------
  536|    782|    ui_is_left_mb_available = BOOLEAN(u4_temp & LEFT_MB_AVAILABLE_MASK);
  ------------------
  |  |   61|    782|#define BOOLEAN(x) (!!(x))
  ------------------
  537|    782|    pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  538|       |
  539|    782|    ps_cur_mb_info->ps_curmb->u1_mb_type = P_MB;
  ------------------
  |  |  419|    782|#define P_MB        2
  ------------------
  540|    782|    if(!ps_svc_cur_mb_info->u1_base_mode_flag)
  ------------------
  |  Branch (540:8): [True: 11, False: 771]
  ------------------
  541|     11|    {
  542|     11|        if(u1_mb_type == I_4x4_MB)
  ------------------
  |  |  417|     11|#define I_4x4_MB    0
  ------------------
  |  Branch (542:12): [True: 0, False: 11]
  ------------------
  543|      0|        {
  544|      0|            ps_cur_mb_info->ps_curmb->u1_mb_type = I_4x4_MB;
  ------------------
  |  |  417|      0|#define I_4x4_MB    0
  ------------------
  545|      0|            u4_offset = 0;
  546|       |
  547|       |            /*--------------------------------------------------------------------*/
  548|       |            /* Read transform_size_8x8_flag if present                            */
  549|       |            /*--------------------------------------------------------------------*/
  550|      0|            if(ps_dec->ps_cur_pps->i4_transform_8x8_mode_flag)
  ------------------
  |  Branch (550:16): [True: 0, False: 0]
  ------------------
  551|      0|            {
  552|      0|                ps_cur_mb_info->u1_tran_form8x8 = ih264d_get_bit_h264(ps_bitstrm);
  553|      0|                COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8);
  554|      0|                ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8;
  555|      0|            }
  556|       |
  557|       |            /*--------------------------------------------------------------------*/
  558|       |            /* Read the IntraPrediction modes for LUMA                            */
  559|       |            /*--------------------------------------------------------------------*/
  560|      0|            if(!ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (560:16): [True: 0, False: 0]
  ------------------
  561|      0|            {
  562|      0|                UWORD8 *pu1_temp;
  563|      0|                ih264d_read_intra_pred_modes(ps_dec, ((UWORD8 *) ps_dec->pv_parse_tu_coeff_data),
  564|      0|                                             ((UWORD8 *) ps_dec->pv_parse_tu_coeff_data + 16),
  565|      0|                                             ps_cur_mb_info->u1_tran_form8x8);
  566|      0|                pu1_temp = (UWORD8 *) ps_dec->pv_parse_tu_coeff_data;
  567|      0|                pu1_temp += 32;
  568|      0|                ps_dec->pv_parse_tu_coeff_data = (void *) pu1_temp;
  569|      0|            }
  570|      0|            else
  571|      0|            {
  572|      0|                UWORD8 *pu1_temp;
  573|      0|                ih264d_read_intra_pred_modes(ps_dec, ((UWORD8 *) ps_dec->pv_parse_tu_coeff_data),
  574|      0|                                             ((UWORD8 *) ps_dec->pv_parse_tu_coeff_data + 4),
  575|      0|                                             ps_cur_mb_info->u1_tran_form8x8);
  576|      0|                pu1_temp = (UWORD8 *) ps_dec->pv_parse_tu_coeff_data;
  577|      0|                pu1_temp += 8;
  578|      0|                ps_dec->pv_parse_tu_coeff_data = (void *) pu1_temp;
  579|      0|            }
  580|       |            /*--------------------------------------------------------------------*/
  581|       |            /* Read the IntraPrediction mode for CHROMA                           */
  582|       |            /*--------------------------------------------------------------------*/
  583|       |            /* Inlined ih264d_uev */
  584|      0|            {
  585|      0|                UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  586|      0|                UWORD32 u4_word, u4_ldz, u4_temp;
  587|       |
  588|       |                /***************************************************************/
  589|       |                /* Find leading zeros in next 32 bits                          */
  590|       |                /***************************************************************/
  591|      0|                NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|      0|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|      0|{                                                                           \
  |  |  152|      0|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|      0|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|      0|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|      0|                                                                            \
  |  |  156|      0|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|      0|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  158|      0|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|      0|}
  ------------------
  592|      0|                u4_ldz = CLZ(u4_word);
  593|       |                /* Flush the ps_bitstrm */
  594|      0|                u4_bitstream_offset += (u4_ldz + 1);
  595|       |                /* Read the suffix from the ps_bitstrm */
  596|      0|                u4_word = 0;
  597|      0|                if(u4_ldz)
  ------------------
  |  Branch (597:20): [True: 0, False: 0]
  ------------------
  598|      0|                {
  599|      0|                    GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|      0|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|      0|{                                                                           \
  |  |  122|      0|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|      0|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|      0|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|      0|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|      0|                                                                            \
  |  |  127|      0|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  128|      0|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|      0|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|      0|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|      0|}                                                                           \
  ------------------
  600|      0|                }
  601|      0|                *pu4_bitstrm_ofst = u4_bitstream_offset;
  602|      0|                u4_temp = ((1 << u4_ldz) + u4_word - 1);
  603|      0|                if(u4_temp > 3)
  ------------------
  |  Branch (603:20): [True: 0, False: 0]
  ------------------
  604|      0|                {
  605|      0|                    return ERROR_CHROMA_PRED_MODE;
  606|      0|                }
  607|      0|                ps_cur_mb_info->u1_chroma_pred_mode = u4_temp;
  608|      0|                COPYTHECONTEXT("intra_chroma_pred_mode", ps_cur_mb_info->u1_chroma_pred_mode);
  609|      0|            }
  610|       |            /*--------------------------------------------------------------------*/
  611|       |            /* Read the Coded block pattern                                       */
  612|       |            /*--------------------------------------------------------------------*/
  613|      0|            {
  614|      0|                UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  615|      0|                UWORD32 u4_word, u4_ldz;
  616|       |
  617|       |                /***************************************************************/
  618|       |                /* Find leading zeros in next 32 bits                          */
  619|       |                /***************************************************************/
  620|      0|                NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|      0|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|      0|{                                                                           \
  |  |  152|      0|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|      0|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|      0|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|      0|                                                                            \
  |  |  156|      0|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|      0|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  158|      0|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|      0|}
  ------------------
  621|      0|                u4_ldz = CLZ(u4_word);
  622|       |                /* Flush the ps_bitstrm */
  623|      0|                u4_bitstream_offset += (u4_ldz + 1);
  624|       |                /* Read the suffix from the ps_bitstrm */
  625|      0|                u4_word = 0;
  626|      0|                if(u4_ldz)
  ------------------
  |  Branch (626:20): [True: 0, False: 0]
  ------------------
  627|      0|                {
  628|      0|                    GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|      0|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|      0|{                                                                           \
  |  |  122|      0|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|      0|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|      0|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|      0|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|      0|                                                                            \
  |  |  127|      0|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  128|      0|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|      0|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|      0|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|      0|}                                                                           \
  ------------------
  629|      0|                }
  630|      0|                *pu4_bitstrm_ofst = u4_bitstream_offset;
  631|      0|                u4_cbp = ((1 << u4_ldz) + u4_word - 1);
  632|      0|            }
  633|      0|            if(u4_cbp > 47)
  ------------------
  |  Branch (633:16): [True: 0, False: 0]
  ------------------
  634|      0|            {
  635|      0|                return ERROR_CBP;
  636|      0|            }
  637|       |
  638|      0|            u4_cbp = gau1_ih264d_cbp_table[u4_cbp][0];
  639|      0|            COPYTHECONTEXT("coded_block_pattern", u4_cbp);
  640|      0|            ps_cur_mb_info->u1_cbp = u4_cbp;
  641|       |
  642|       |            /*--------------------------------------------------------------------*/
  643|       |            /* Read mb_qp_delta                                                   */
  644|       |            /*--------------------------------------------------------------------*/
  645|      0|            if(ps_cur_mb_info->u1_cbp)
  ------------------
  |  Branch (645:16): [True: 0, False: 0]
  ------------------
  646|      0|            {
  647|      0|                UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  648|      0|                UWORD32 u4_word, u4_ldz, u4_abs_val;
  649|       |
  650|       |                /***************************************************************/
  651|       |                /* Find leading zeros in next 32 bits                          */
  652|       |                /***************************************************************/
  653|      0|                NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|      0|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|      0|{                                                                           \
  |  |  152|      0|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|      0|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|      0|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|      0|                                                                            \
  |  |  156|      0|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|      0|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  158|      0|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|      0|}
  ------------------
  654|      0|                u4_ldz = CLZ(u4_word);
  655|       |
  656|       |                /* Flush the ps_bitstrm */
  657|      0|                u4_bitstream_offset += (u4_ldz + 1);
  658|       |
  659|       |                /* Read the suffix from the ps_bitstrm */
  660|      0|                u4_word = 0;
  661|      0|                if(u4_ldz)
  ------------------
  |  Branch (661:20): [True: 0, False: 0]
  ------------------
  662|      0|                {
  663|      0|                    GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|      0|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|      0|{                                                                           \
  |  |  122|      0|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|      0|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|      0|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|      0|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|      0|                                                                            \
  |  |  127|      0|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  128|      0|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|      0|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|      0|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|      0|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|      0|}                                                                           \
  ------------------
  664|      0|                }
  665|       |
  666|      0|                *pu4_bitstrm_ofst = u4_bitstream_offset;
  667|      0|                u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1;
  668|       |
  669|      0|                if(u4_word & 0x1)
  ------------------
  |  Branch (669:20): [True: 0, False: 0]
  ------------------
  670|      0|                {
  671|      0|                    i4_delta_qp = (-(WORD32) u4_abs_val);
  672|      0|                }
  673|      0|                else
  674|      0|                {
  675|      0|                    i4_delta_qp = (u4_abs_val);
  676|      0|                }
  677|       |
  678|      0|                if((i4_delta_qp < -26) || (i4_delta_qp > 25))
  ------------------
  |  Branch (678:20): [True: 0, False: 0]
  |  Branch (678:43): [True: 0, False: 0]
  ------------------
  679|      0|                {
  680|      0|                    return ERROR_INV_RANGE_QP_T;
  681|      0|                }
  682|       |
  683|      0|                COPYTHECONTEXT("mb_qp_delta", i1_delta_qp);
  684|      0|                if(i4_delta_qp != 0)
  ------------------
  |  Branch (684:20): [True: 0, False: 0]
  ------------------
  685|      0|                {
  686|      0|                    ret = ih264d_update_qp(ps_dec, (WORD8) i4_delta_qp);
  687|      0|                    if(ret != OK) return ret;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (687:24): [True: 0, False: 0]
  ------------------
  688|      0|                }
  689|      0|            }
  690|      0|        }
  691|     11|        else
  692|     11|        {
  693|     11|            u4_offset = 1;
  694|     11|            ps_cur_mb_info->ps_curmb->u1_mb_type = I_16x16_MB;
  ------------------
  |  |  418|     11|#define I_16x16_MB  1
  ------------------
  695|       |            /*-------------------------------------------------------------------*/
  696|       |            /* Read the IntraPrediction mode for CHROMA                          */
  697|       |            /*-------------------------------------------------------------------*/
  698|     11|            {
  699|     11|                UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  700|     11|                UWORD32 u4_word, u4_ldz;
  701|       |
  702|       |                /***************************************************************/
  703|       |                /* Find leading zeros in next 32 bits                          */
  704|       |                /***************************************************************/
  705|     11|                NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|     11|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|     11|{                                                                           \
  |  |  152|     11|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|     11|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|     11|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|     11|                                                                            \
  |  |  156|     11|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|     11|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 5, False: 6]
  |  |  ------------------
  |  |  158|     11|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|      5|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|     11|}
  ------------------
  706|     11|                u4_ldz = CLZ(u4_word);
  707|       |                /* Flush the ps_bitstrm */
  708|     11|                u4_bitstream_offset += (u4_ldz + 1);
  709|       |                /* Read the suffix from the ps_bitstrm */
  710|     11|                u4_word = 0;
  711|     11|                if(u4_ldz)
  ------------------
  |  Branch (711:20): [True: 4, False: 7]
  ------------------
  712|      4|                {
  713|      4|                    GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|      4|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|      4|{                                                                           \
  |  |  122|      4|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|      4|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|      4|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|      4|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|      4|                                                                            \
  |  |  127|      4|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 4, False: 0]
  |  |  ------------------
  |  |  128|      4|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|      4|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|      4|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|      4|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|      4|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|      4|}                                                                           \
  ------------------
  714|      4|                }
  715|     11|                *pu4_bitstrm_ofst = u4_bitstream_offset;
  716|     11|                u4_temp = ((1 << u4_ldz) + u4_word - 1);
  717|       |
  718|       |                /* Inlined ih264d_uev */
  719|     11|                if(u4_temp > 3)
  ------------------
  |  Branch (719:20): [True: 3, False: 8]
  ------------------
  720|      3|                {
  721|      3|                    return ERROR_CHROMA_PRED_MODE;
  722|      3|                }
  723|      8|                ps_cur_mb_info->u1_chroma_pred_mode = u4_temp;
  724|      8|                COPYTHECONTEXT("intra_chroma_pred_mode", ps_cur_mb_info->u1_chroma_pred_mode);
  725|      8|            }
  726|       |            /*-------------------------------------------------------------------*/
  727|       |            /* Read the Coded block pattern                                      */
  728|       |            /*-------------------------------------------------------------------*/
  729|      0|            u4_cbp = gau1_ih264d_cbp_tab[(u1_mb_type - 1) >> 2];
  730|      8|            ps_cur_mb_info->u1_cbp = u4_cbp;
  731|       |
  732|       |            /*-------------------------------------------------------------------*/
  733|       |            /* Read mb_qp_delta                                                  */
  734|       |            /*-------------------------------------------------------------------*/
  735|      8|            {
  736|      8|                UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  737|      8|                UWORD32 u4_word, u4_ldz, u4_abs_val;
  738|       |
  739|       |                /***************************************************************/
  740|       |                /* Find leading zeros in next 32 bits                          */
  741|       |                /***************************************************************/
  742|      8|                NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|      8|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|      8|{                                                                           \
  |  |  152|      8|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|      8|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|      8|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|      8|                                                                            \
  |  |  156|      8|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|      8|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 8, False: 0]
  |  |  ------------------
  |  |  158|      8|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|      8|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|      8|}
  ------------------
  743|      8|                u4_ldz = CLZ(u4_word);
  744|       |
  745|       |                /* Flush the ps_bitstrm */
  746|      8|                u4_bitstream_offset += (u4_ldz + 1);
  747|       |
  748|       |                /* Read the suffix from the ps_bitstrm */
  749|      8|                u4_word = 0;
  750|      8|                if(u4_ldz) GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|      8|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|      8|{                                                                           \
  |  |  122|      8|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|      8|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|      8|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|      8|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|      8|                                                                            \
  |  |  127|      8|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 8, False: 0]
  |  |  ------------------
  |  |  128|      8|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|      8|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|      8|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|      8|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|      8|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|      8|}                                                                           \
  ------------------
  |  Branch (750:20): [True: 8, False: 0]
  ------------------
  751|       |
  752|      8|                *pu4_bitstrm_ofst = u4_bitstream_offset;
  753|      8|                u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1;
  754|       |
  755|      8|                if(u4_word & 0x1)
  ------------------
  |  Branch (755:20): [True: 7, False: 1]
  ------------------
  756|      7|                    i4_delta_qp = (-(WORD32) u4_abs_val);
  757|      1|                else
  758|      1|                    i4_delta_qp = (u4_abs_val);
  759|       |
  760|      8|                if((i4_delta_qp < -26) || (i4_delta_qp > 25)) return ERROR_INV_RANGE_QP_T;
  ------------------
  |  Branch (760:20): [True: 0, False: 8]
  |  Branch (760:43): [True: 0, False: 8]
  ------------------
  761|      8|            }
  762|       |            /* inlinined ih264d_sev */
  763|      8|            COPYTHECONTEXT("Delta quant", i1_delta_qp);
  764|       |
  765|      8|            if(i4_delta_qp != 0)
  ------------------
  |  Branch (765:16): [True: 8, False: 0]
  ------------------
  766|      8|            {
  767|      8|                ret = ih264d_update_qp(ps_dec, (WORD8) i4_delta_qp);
  768|      8|                if(ret != OK) return ret;
  ------------------
  |  |  114|      8|#define OK        0
  ------------------
  |  Branch (768:20): [True: 0, False: 8]
  ------------------
  769|      8|            }
  770|       |
  771|      8|            {
  772|      8|                WORD16 i_scaleFactor;
  773|      8|                UWORD32 ui_N = 0;
  774|      8|                WORD16 *pi2_scale_matrix_ptr;
  775|       |                /*******************************************************************/
  776|       |                /* for luma DC coefficients the scaling is done during the parsing */
  777|       |                /* to preserve the precision                                       */
  778|       |                /*******************************************************************/
  779|      8|                if(ps_dec->s_high_profile.u1_scaling_present)
  ------------------
  |  Branch (779:20): [True: 2, False: 6]
  ------------------
  780|      2|                {
  781|      2|                    pi2_scale_matrix_ptr = ps_dec->s_high_profile.i2_scalinglist4x4[0];
  782|      2|                }
  783|      6|                else
  784|      6|                {
  785|      6|                    i_scaleFactor = 16;
  786|      6|                    pi2_scale_matrix_ptr = &i_scaleFactor;
  787|      6|                }
  788|       |
  789|       |                /*---------------------------------------------------------------*/
  790|       |                /* Decode DC coefficients                                        */
  791|       |                /*---------------------------------------------------------------*/
  792|       |                /*---------------------------------------------------------------*/
  793|       |                /* Calculation of N                                              */
  794|       |                /*---------------------------------------------------------------*/
  795|      8|                if(ui_is_left_mb_available)
  ------------------
  |  Branch (795:20): [True: 7, False: 1]
  ------------------
  796|      7|                {
  797|      7|                    if(ui_is_top_mb_available)
  ------------------
  |  Branch (797:24): [True: 7, False: 0]
  ------------------
  798|      7|                    {
  799|      7|                        ui_N = ((ps_cur_mb_info->ps_top_mb->pu1_nnz_y[0] +
  800|      7|                                 ps_dec->pu1_left_nnz_y[0] + 1) >>
  801|      7|                                1);
  802|      7|                    }
  803|      0|                    else
  804|      0|                    {
  805|      0|                        ui_N = ps_dec->pu1_left_nnz_y[0];
  806|      0|                    }
  807|      7|                }
  808|      1|                else if(ui_is_top_mb_available)
  ------------------
  |  Branch (808:25): [True: 1, False: 0]
  ------------------
  809|      1|                {
  810|      1|                    ui_N = ps_cur_mb_info->ps_top_mb->pu1_nnz_y[0];
  811|      1|                }
  812|       |
  813|      8|                {
  814|      8|                    WORD16 pi2_dc_coef[16] = {0};
  815|      8|                    WORD32 pi4_tmp[16] = {0};
  816|      8|                    tu_sblk4x4_coeff_data_t *ps_tu_4x4 =
  817|      8|                        (tu_sblk4x4_coeff_data_t *) ps_dec->pv_parse_tu_coeff_data;
  818|      8|                    WORD16 *pi2_coeff_block = (WORD16 *) ps_dec->pv_parse_tu_coeff_data;
  819|      8|                    UWORD32 u4_num_coeff;
  820|      8|                    ps_tu_4x4->u2_sig_coeff_map = 0;
  821|      8|                    ret = ps_dec->pf_cavlc_parse4x4coeff[(ui_N > 7)](pi2_dc_coef, 0, ui_N, ps_dec,
  822|      8|                                                                     &u4_num_coeff);
  823|      8|                    if(ret != OK) return ret;
  ------------------
  |  |  114|      8|#define OK        0
  ------------------
  |  Branch (823:24): [True: 0, False: 8]
  ------------------
  824|       |
  825|      8|                    if(EXCEED_OFFSET(ps_bitstrm)) return ERROR_EOB_TERMINATE_T;
  ------------------
  |  |   93|      8|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 0, False: 8]
  |  |  ------------------
  ------------------
  826|      8|                    if(ps_tu_4x4->u2_sig_coeff_map)
  ------------------
  |  Branch (826:24): [True: 0, False: 8]
  ------------------
  827|      0|                    {
  828|      0|                        memset(pi2_dc_coef, 0, sizeof(pi2_dc_coef));
  829|      0|                        ih264d_unpack_coeff4x4_dc_4x4blk(ps_tu_4x4, pi2_dc_coef,
  830|      0|                                                         ps_dec->pu1_inv_scan);
  831|       |
  832|      0|                        PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|      0|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
  833|      0|                        ps_dec->pf_ihadamard_scaling_4x4(
  834|      0|                            pi2_dc_coef, pi2_coeff_block, ps_dec->pu2_quant_scale_y,
  835|      0|                            (UWORD16 *) pi2_scale_matrix_ptr, ps_dec->u1_qp_y_div6, pi4_tmp);
  836|      0|                        pi2_coeff_block += 16;
  837|      0|                        ps_dec->pv_parse_tu_coeff_data = (void *) pi2_coeff_block;
  838|      0|                        SET_BIT(ps_cur_mb_info->u1_yuv_dc_block_flag, 0);
  ------------------
  |  |  106|      0|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
  839|      0|                    }
  840|      8|                }
  841|      8|            }
  842|      8|        }
  843|     11|    }
  844|    771|    else
  845|    771|    {
  846|    771|        ps_cur_mb_info->u1_tran_form8x8 = 0;
  847|    771|        ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
  848|    771|        u4_offset = 0;
  849|       |        /*--------------------------------------------------------------------*/
  850|       |        /* Read the Coded block pattern                                       */
  851|       |        /*--------------------------------------------------------------------*/
  852|    771|        {
  853|    771|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  854|    771|            UWORD32 u4_word, u4_ldz;
  855|       |
  856|       |            /***************************************************************/
  857|       |            /* Find leading zeros in next 32 bits                          */
  858|       |            /***************************************************************/
  859|    771|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|    771|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|    771|{                                                                           \
  |  |  152|    771|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|    771|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|    771|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|    771|                                                                            \
  |  |  156|    771|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|    771|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 750, False: 21]
  |  |  ------------------
  |  |  158|    771|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|    750|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|    771|}
  ------------------
  860|    771|            u4_ldz = CLZ(u4_word);
  861|       |            /* Flush the ps_bitstrm */
  862|    771|            u4_bitstream_offset += (u4_ldz + 1);
  863|       |            /* Read the suffix from the ps_bitstrm */
  864|    771|            u4_word = 0;
  865|    771|            if(u4_ldz)
  ------------------
  |  Branch (865:16): [True: 41, False: 730]
  ------------------
  866|     41|            {
  867|     41|                GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|     41|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|     41|{                                                                           \
  |  |  122|     41|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|     41|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|     41|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|     41|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|     41|                                                                            \
  |  |  127|     41|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 41, False: 0]
  |  |  ------------------
  |  |  128|     41|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|     41|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|     41|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|     41|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|     41|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|     41|}                                                                           \
  ------------------
  868|     41|            }
  869|    771|            *pu4_bitstrm_ofst = u4_bitstream_offset;
  870|    771|            u4_cbp = ((1 << u4_ldz) + u4_word - 1);
  871|    771|        }
  872|    771|        if(u4_cbp > 47)
  ------------------
  |  Branch (872:12): [True: 1, False: 770]
  ------------------
  873|      1|        {
  874|      1|            return ERROR_CBP;
  875|      1|        }
  876|       |
  877|       |        /*  inter cbp table to be used for base mode flag*/
  878|    770|        u4_cbp = gau1_ih264d_cbp_table[u4_cbp][1];
  879|    770|        COPYTHECONTEXT("coded_block_pattern", u4_cbp);
  880|    770|        ps_cur_mb_info->u1_cbp = u4_cbp;
  881|    770|        ps_cur_mb_info->u1_tran_form8x8 = 0;
  882|    770|        ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
  883|       |
  884|       |        /*--------------------------------------------------------------------*/
  885|       |        /* Read transform_size_8x8_flag if present                            */
  886|       |        /*--------------------------------------------------------------------*/
  887|    770|        if((ps_dec->ps_cur_pps->i4_transform_8x8_mode_flag) && (ps_cur_mb_info->u1_cbp & 0xf))
  ------------------
  |  Branch (887:12): [True: 222, False: 548]
  |  Branch (887:64): [True: 10, False: 212]
  ------------------
  888|     10|        {
  889|     10|            ps_cur_mb_info->u1_tran_form8x8 = ih264d_get_bit_h264(ps_bitstrm);
  890|     10|            COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8);
  891|     10|            ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8;
  892|     10|        }
  893|       |        /*--------------------------------------------------------------------*/
  894|       |        /* Read mb_qp_delta                                                   */
  895|       |        /*--------------------------------------------------------------------*/
  896|    770|        if(ps_cur_mb_info->u1_cbp)
  ------------------
  |  Branch (896:12): [True: 40, False: 730]
  ------------------
  897|     40|        {
  898|     40|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  899|     40|            UWORD32 u4_word, u4_ldz, u4_abs_val;
  900|       |
  901|       |            /***************************************************************/
  902|       |            /* Find leading zeros in next 32 bits                          */
  903|       |            /***************************************************************/
  904|     40|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|     40|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|     40|{                                                                           \
  |  |  152|     40|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|     40|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|     40|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|     40|                                                                            \
  |  |  156|     40|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|     40|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 40, False: 0]
  |  |  ------------------
  |  |  158|     40|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|     40|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|     40|}
  ------------------
  905|     40|            u4_ldz = CLZ(u4_word);
  906|       |
  907|       |            /* Flush the ps_bitstrm */
  908|     40|            u4_bitstream_offset += (u4_ldz + 1);
  909|       |
  910|       |            /* Read the suffix from the ps_bitstrm */
  911|     40|            u4_word = 0;
  912|     40|            if(u4_ldz)
  ------------------
  |  Branch (912:16): [True: 7, False: 33]
  ------------------
  913|      7|            {
  914|      7|                GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|      7|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|      7|{                                                                           \
  |  |  122|      7|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|      7|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|      7|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|      7|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|      7|                                                                            \
  |  |  127|      7|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 7, False: 0]
  |  |  ------------------
  |  |  128|      7|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|      7|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|      7|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|      7|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|      7|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|      7|}                                                                           \
  ------------------
  915|      7|            }
  916|       |
  917|     40|            *pu4_bitstrm_ofst = u4_bitstream_offset;
  918|     40|            u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1;
  919|       |
  920|     40|            if(u4_word & 0x1)
  ------------------
  |  Branch (920:16): [True: 6, False: 34]
  ------------------
  921|      6|            {
  922|      6|                i4_delta_qp = (-(WORD32) u4_abs_val);
  923|      6|            }
  924|     34|            else
  925|     34|            {
  926|     34|                i4_delta_qp = (u4_abs_val);
  927|     34|            }
  928|       |
  929|     40|            if((i4_delta_qp < -26) || (i4_delta_qp > 25))
  ------------------
  |  Branch (929:16): [True: 0, False: 40]
  |  Branch (929:39): [True: 0, False: 40]
  ------------------
  930|      0|            {
  931|      0|                return ERROR_INV_RANGE_QP_T;
  932|      0|            }
  933|       |
  934|     40|            COPYTHECONTEXT("mb_qp_delta", i4_delta_qp);
  935|     40|            if(i4_delta_qp != 0)
  ------------------
  |  Branch (935:16): [True: 7, False: 33]
  ------------------
  936|      7|            {
  937|      7|                ret = ih264d_update_qp(ps_dec, (WORD8) i4_delta_qp);
  938|      7|                if(ret != OK) return ret;
  ------------------
  |  |  114|      7|#define OK        0
  ------------------
  |  Branch (938:20): [True: 0, False: 7]
  ------------------
  939|      7|            }
  940|     40|        }
  941|    770|    }
  942|    778|    if(u4_cbp)
  ------------------
  |  Branch (942:8): [True: 48, False: 730]
  ------------------
  943|     48|    {
  944|     48|        ret = ih264d_parse_residual4x4_cavlc(ps_dec, ps_cur_mb_info, (UWORD8) u4_offset);
  945|     48|        if(ret != OK) return ret;
  ------------------
  |  |  114|     48|#define OK        0
  ------------------
  |  Branch (945:12): [True: 0, False: 48]
  ------------------
  946|     48|        if(EXCEED_OFFSET(ps_bitstrm)) return ERROR_EOB_TERMINATE_T;
  ------------------
  |  |   93|     48|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 1, False: 47]
  |  |  ------------------
  ------------------
  947|       |
  948|       |        /* Store Left Mb NNZ and TOP chroma NNZ */
  949|     48|    }
  950|    730|    else
  951|    730|    {
  952|    730|        ps_cur_mb_info->u1_qp_div6 = ps_dec->u1_qp_y_div6;
  953|    730|        ps_cur_mb_info->u1_qpc_div6 = ps_dec->u1_qp_u_div6;
  954|    730|        ps_cur_mb_info->u1_qpcr_div6 = ps_dec->u1_qp_v_div6;
  955|    730|        ps_cur_mb_info->u1_qp_rem6 = ps_dec->u1_qp_y_rem6;
  956|    730|        ps_cur_mb_info->u1_qpc_rem6 = ps_dec->u1_qp_u_rem6;
  957|    730|        ps_cur_mb_info->u1_qpcr_rem6 = ps_dec->u1_qp_v_rem6;
  958|    730|        ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CAVLC);
  ------------------
  |  |  338|    730|#define CAVLC  0
  ------------------
  959|    730|    }
  960|       |
  961|    777|    return OK;
  ------------------
  |  |  114|    777|#define OK        0
  ------------------
  962|    778|}
isvcd_parse_imb_cabac:
 1677|  4.04k|{
 1678|  4.04k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1679|  4.04k|    WORD8 i1_delta_qp;
 1680|  4.04k|    UWORD8 u1_cbp;
 1681|  4.04k|    UWORD8 u1_offset;
 1682|       |    /* Variables for handling Cabac contexts */
 1683|  4.04k|    ctxt_inc_mb_info_t *p_curr_ctxt = ps_dec->ps_curr_ctxt_mb_info;
 1684|  4.04k|    ctxt_inc_mb_info_t *ps_left_ctxt = ps_dec->p_left_ctxt_mb_info;
 1685|  4.04k|    dec_bit_stream_t *const ps_bitstrm = ps_dec->ps_bitstrm;
 1686|  4.04k|    bin_ctxt_model_t *p_bin_ctxt;
 1687|  4.04k|    UWORD8 u1_intra_chrom_pred_mode;
 1688|  4.04k|    UWORD8 u1_dc_block_flag = 0;
 1689|  4.04k|    WORD32 ret;
 1690|       |
 1691|  4.04k|    ps_cur_mb_info->u1_yuv_dc_block_flag = 0;
 1692|       |
 1693|  4.04k|    if(ps_left_ctxt == ps_dec->ps_def_ctxt_mb_info)
  ------------------
  |  Branch (1693:8): [True: 982, False: 3.05k]
  ------------------
 1694|    982|    {
 1695|    982|        ps_dec->pu1_left_yuv_dc_csbp[0] = 0xf;
 1696|    982|    }
 1697|       |
 1698|  4.04k|    if(ps_dec->ps_cur_slice->u1_slice_type != I_SLICE)
  ------------------
  |  |  370|  4.04k|#define I_SLICE  2
  ------------------
  |  Branch (1698:8): [True: 4.04k, False: 0]
  ------------------
 1699|  4.04k|    {
 1700|  4.04k|        MEMSET_16BYTES(&ps_dec->pu1_left_mv_ctxt_inc[0][0], 0);
  ------------------
  |  |  652|  4.04k|#define MEMSET_16BYTES(pu4_start,value)                         \
  |  |  653|  4.04k|{                                                               \
  |  |  654|  4.04k|    memset(pu4_start,value,16);                                 \
  |  |  655|  4.04k|}
  ------------------
 1701|  4.04k|        *((UWORD32 *) ps_dec->pi1_left_ref_idx_ctxt_inc) = 0;
 1702|  4.04k|        MEMSET_16BYTES(p_curr_ctxt->u1_mv, 0);
  ------------------
  |  |  652|  4.04k|#define MEMSET_16BYTES(pu4_start,value)                         \
  |  |  653|  4.04k|{                                                               \
  |  |  654|  4.04k|    memset(pu4_start,value,16);                                 \
  |  |  655|  4.04k|}
  ------------------
 1703|  4.04k|        memset(p_curr_ctxt->i1_ref_idx, 0, 4);
 1704|  4.04k|    }
 1705|       |
 1706|       |    /* default */
 1707|  4.04k|    ps_cur_mb_info->ps_curmb->u1_mb_type = P_MB;
  ------------------
  |  |  419|  4.04k|#define P_MB        2
  ------------------
 1708|  4.04k|    if(!ps_svc_cur_mb_info->u1_base_mode_flag)
  ------------------
  |  Branch (1708:8): [True: 543, False: 3.49k]
  ------------------
 1709|    543|    {
 1710|    543|        if(u1_mb_type == I_4x4_MB)
  ------------------
  |  |  417|    543|#define I_4x4_MB    0
  ------------------
  |  Branch (1710:12): [True: 486, False: 57]
  ------------------
 1711|    486|        {
 1712|    486|            ps_cur_mb_info->ps_curmb->u1_mb_type = I_4x4_MB;
  ------------------
  |  |  417|    486|#define I_4x4_MB    0
  ------------------
 1713|    486|            p_curr_ctxt->u1_mb_type = CAB_I4x4;
  ------------------
  |  |  394|    486|#define CAB_I4x4          0x00 /* 0000 00x0 */
  ------------------
 1714|    486|            u1_offset = 0;
 1715|    486|            ps_cur_mb_info->u1_tran_form8x8 = 0;
 1716|    486|            ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
 1717|       |            /*--------------------------------------------------------------------*/
 1718|       |            /* Read transform_size_8x8_flag if present                            */
 1719|       |            /*--------------------------------------------------------------------*/
 1720|    486|            if(ps_dec->ps_cur_pps->i4_transform_8x8_mode_flag)
  ------------------
  |  Branch (1720:16): [True: 486, False: 0]
  ------------------
 1721|    486|            {
 1722|    486|                ps_cur_mb_info->u1_tran_form8x8 =
 1723|    486|                    ih264d_parse_transform8x8flag_cabac(ps_dec, ps_cur_mb_info);
 1724|    486|                COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8);
 1725|    486|                p_curr_ctxt->u1_transform8x8_ctxt = ps_cur_mb_info->u1_tran_form8x8;
 1726|    486|                ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8;
 1727|    486|            }
 1728|      0|            else
 1729|      0|            {
 1730|      0|                p_curr_ctxt->u1_transform8x8_ctxt = 0;
 1731|      0|            }
 1732|       |
 1733|       |            /*--------------------------------------------------------------------*/
 1734|       |            /* Read the IntraPrediction modes for LUMA                            */
 1735|       |            /*--------------------------------------------------------------------*/
 1736|    486|            if(!ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (1736:16): [True: 433, False: 53]
  ------------------
 1737|    433|            {
 1738|    433|                UWORD8 *pu1_temp;
 1739|    433|                ih264d_read_intra_pred_modes_cabac(ps_dec,
 1740|    433|                                                   ((UWORD8 *) ps_dec->pv_parse_tu_coeff_data),
 1741|    433|                                                   ((UWORD8 *) ps_dec->pv_parse_tu_coeff_data + 16),
 1742|    433|                                                   ps_cur_mb_info->u1_tran_form8x8);
 1743|    433|                pu1_temp = (UWORD8 *) ps_dec->pv_parse_tu_coeff_data;
 1744|    433|                pu1_temp += 32;
 1745|    433|                ps_dec->pv_parse_tu_coeff_data = (void *) pu1_temp;
 1746|    433|            }
 1747|     53|            else
 1748|     53|            {
 1749|     53|                UWORD8 *pu1_temp;
 1750|     53|                ih264d_read_intra_pred_modes_cabac(ps_dec,
 1751|     53|                                                   ((UWORD8 *) ps_dec->pv_parse_tu_coeff_data),
 1752|     53|                                                   ((UWORD8 *) ps_dec->pv_parse_tu_coeff_data + 4),
 1753|     53|                                                   ps_cur_mb_info->u1_tran_form8x8);
 1754|     53|                pu1_temp = (UWORD8 *) ps_dec->pv_parse_tu_coeff_data;
 1755|     53|                pu1_temp += 8;
 1756|     53|                ps_dec->pv_parse_tu_coeff_data = (void *) pu1_temp;
 1757|     53|            }
 1758|       |            /*--------------------------------------------------------------------*/
 1759|       |            /* Read the IntraPrediction mode for CHROMA                           */
 1760|       |            /*--------------------------------------------------------------------*/
 1761|    486|            u1_intra_chrom_pred_mode = ih264d_parse_chroma_pred_mode_cabac(ps_dec);
 1762|    486|            COPYTHECONTEXT("intra_chroma_pred_mode", u1_intra_chrom_pred_mode);
 1763|    486|            p_curr_ctxt->u1_intra_chroma_pred_mode = ps_cur_mb_info->u1_chroma_pred_mode =
 1764|    486|                u1_intra_chrom_pred_mode;
 1765|       |
 1766|       |            /*--------------------------------------------------------------------*/
 1767|       |            /* Read the Coded block pattern                                       */
 1768|       |            /*--------------------------------------------------------------------*/
 1769|    486|            u1_cbp = ih264d_parse_ctx_cbp_cabac(ps_dec);
 1770|    486|            COPYTHECONTEXT("coded_block_pattern", u1_cbp);
 1771|    486|            ps_cur_mb_info->u1_cbp = u1_cbp;
 1772|    486|            p_curr_ctxt->u1_cbp = u1_cbp;
 1773|       |
 1774|       |            /*--------------------------------------------------------------------*/
 1775|       |            /* Read mb_qp_delta                                                   */
 1776|       |            /*--------------------------------------------------------------------*/
 1777|    486|            if(ps_cur_mb_info->u1_cbp)
  ------------------
  |  Branch (1777:16): [True: 476, False: 10]
  ------------------
 1778|    476|            {
 1779|    476|                ret = ih264d_parse_mb_qp_delta_cabac(ps_dec, &i1_delta_qp);
 1780|    476|                if(ret != OK) return ret;
  ------------------
  |  |  114|    476|#define OK        0
  ------------------
  |  Branch (1780:20): [True: 0, False: 476]
  ------------------
 1781|    476|                COPYTHECONTEXT("mb_qp_delta", i1_delta_qp);
 1782|    476|                if(i1_delta_qp != 0)
  ------------------
  |  Branch (1782:20): [True: 14, False: 462]
  ------------------
 1783|     14|                {
 1784|     14|                    ret = ih264d_update_qp(ps_dec, i1_delta_qp);
 1785|     14|                    if(ret != OK) return ret;
  ------------------
  |  |  114|     14|#define OK        0
  ------------------
  |  Branch (1785:24): [True: 0, False: 14]
  ------------------
 1786|     14|                }
 1787|    476|            }
 1788|     10|            else
 1789|     10|                ps_dec->i1_prev_mb_qp_delta = 0;
 1790|    486|            p_curr_ctxt->u1_yuv_dc_csbp &= 0xFE;
 1791|    486|        }
 1792|     57|        else
 1793|     57|        {
 1794|     57|            u1_offset = 1;
 1795|     57|            ps_cur_mb_info->ps_curmb->u1_mb_type = I_16x16_MB;
  ------------------
  |  |  418|     57|#define I_16x16_MB  1
  ------------------
 1796|     57|            p_curr_ctxt->u1_mb_type = CAB_I16x16;
  ------------------
  |  |  395|     57|#define CAB_I16x16        0x01 /* 0000 00x1 */
  ------------------
 1797|     57|            ps_cur_mb_info->u1_tran_form8x8 = 0;
 1798|     57|            p_curr_ctxt->u1_transform8x8_ctxt = 0;
 1799|     57|            ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
 1800|       |            /*--------------------------------------------------------------------*/
 1801|       |            /* Read the IntraPrediction mode for CHROMA                           */
 1802|       |            /*--------------------------------------------------------------------*/
 1803|     57|            u1_intra_chrom_pred_mode = ih264d_parse_chroma_pred_mode_cabac(ps_dec);
 1804|     57|            if(u1_intra_chrom_pred_mode > 3) return ERROR_CHROMA_PRED_MODE;
  ------------------
  |  Branch (1804:16): [True: 0, False: 57]
  ------------------
 1805|       |
 1806|     57|            COPYTHECONTEXT("Chroma intra_chroma_pred_mode pred mode", u1_intra_chrom_pred_mode);
 1807|     57|            p_curr_ctxt->u1_intra_chroma_pred_mode = ps_cur_mb_info->u1_chroma_pred_mode =
 1808|     57|                u1_intra_chrom_pred_mode;
 1809|       |
 1810|       |            /*--------------------------------------------------------------------*/
 1811|       |            /* Read the Coded block pattern                                       */
 1812|       |            /*--------------------------------------------------------------------*/
 1813|     57|            u1_cbp = gau1_ih264d_cbp_tab[(u1_mb_type - 1) >> 2];
 1814|     57|            ps_cur_mb_info->u1_cbp = u1_cbp;
 1815|     57|            p_curr_ctxt->u1_cbp = u1_cbp;
 1816|       |
 1817|       |            /*--------------------------------------------------------------------*/
 1818|       |            /* Read mb_qp_delta                                                   */
 1819|       |            /*--------------------------------------------------------------------*/
 1820|     57|            ret = ih264d_parse_mb_qp_delta_cabac(ps_dec, &i1_delta_qp);
 1821|     57|            if(ret != OK) return ret;
  ------------------
  |  |  114|     57|#define OK        0
  ------------------
  |  Branch (1821:16): [True: 0, False: 57]
  ------------------
 1822|     57|            COPYTHECONTEXT("mb_qp_delta", i1_delta_qp);
 1823|     57|            if(i1_delta_qp != 0)
  ------------------
  |  Branch (1823:16): [True: 23, False: 34]
  ------------------
 1824|     23|            {
 1825|     23|                ret = ih264d_update_qp(ps_dec, i1_delta_qp);
 1826|     23|                if(ret != OK) return ret;
  ------------------
  |  |  114|     23|#define OK        0
  ------------------
  |  Branch (1826:20): [True: 0, False: 23]
  ------------------
 1827|     23|            }
 1828|       |
 1829|     57|            {
 1830|     57|                WORD16 i_scaleFactor;
 1831|     57|                WORD16 *pi2_scale_matrix_ptr;
 1832|       |                /*******************************************************************/
 1833|       |                /* for luma DC coefficients the scaling is done during the parsing */
 1834|       |                /* to preserve the precision                                       */
 1835|       |                /*******************************************************************/
 1836|     57|                if(ps_dec->s_high_profile.u1_scaling_present)
  ------------------
  |  Branch (1836:20): [True: 57, False: 0]
  ------------------
 1837|     57|                {
 1838|     57|                    pi2_scale_matrix_ptr = ps_dec->s_high_profile.i2_scalinglist4x4[0];
 1839|     57|                }
 1840|      0|                else
 1841|      0|                {
 1842|      0|                    i_scaleFactor = 16;
 1843|      0|                    pi2_scale_matrix_ptr = &i_scaleFactor;
 1844|      0|                }
 1845|     57|                {
 1846|     57|                    ctxt_inc_mb_info_t *ps_top_ctxt = ps_dec->p_top_ctxt_mb_info;
 1847|     57|                    UWORD8 uc_a, uc_b;
 1848|     57|                    UWORD32 u4_ctx_inc;
 1849|     57|                    INC_SYM_COUNT(&(ps_dec->s_cab_dec_env));
 1850|       |
 1851|       |                    /* if MbAddrN not available then CondTermN = 1 */
 1852|     57|                    uc_b = ((ps_top_ctxt->u1_yuv_dc_csbp) & 0x01);
 1853|       |
 1854|       |                    /* if MbAddrN not available then CondTermN = 1 */
 1855|     57|                    uc_a = ((ps_dec->pu1_left_yuv_dc_csbp[0]) & 0x01);
 1856|       |
 1857|     57|                    u4_ctx_inc = (uc_a + (uc_b << 1));
 1858|     57|                    {
 1859|     57|                        WORD16 pi2_dc_coef[16] = {0};
 1860|     57|                        tu_sblk4x4_coeff_data_t *ps_tu_4x4 =
 1861|     57|                            (tu_sblk4x4_coeff_data_t *) ps_dec->pv_parse_tu_coeff_data;
 1862|     57|                        WORD16 *pi2_coeff_block = (WORD16 *) ps_dec->pv_parse_tu_coeff_data;
 1863|       |
 1864|     57|                        p_bin_ctxt = (ps_dec->p_cbf_t[LUMA_DC_CTXCAT]) + u4_ctx_inc;
  ------------------
  |  |   71|     57|#define LUMA_DC_CTXCAT    0
  ------------------
 1865|       |
 1866|     57|                        u1_dc_block_flag = ih264d_read_coeff4x4_cabac(
 1867|     57|                            ps_bitstrm, LUMA_DC_CTXCAT,
  ------------------
  |  |   71|     57|#define LUMA_DC_CTXCAT    0
  ------------------
 1868|     57|                            ps_dec->p_significant_coeff_flag_t[LUMA_DC_CTXCAT], ps_dec, p_bin_ctxt);
  ------------------
  |  |   71|     57|#define LUMA_DC_CTXCAT    0
  ------------------
 1869|       |
 1870|       |                        /* Store coded_block_flag */
 1871|     57|                        p_curr_ctxt->u1_yuv_dc_csbp &= 0xFE;
 1872|     57|                        p_curr_ctxt->u1_yuv_dc_csbp |= u1_dc_block_flag;
 1873|     57|                        if(u1_dc_block_flag)
  ------------------
  |  Branch (1873:28): [True: 42, False: 15]
  ------------------
 1874|     42|                        {
 1875|     42|                            WORD32 pi4_tmp[16] = {0};
 1876|     42|                            memset(pi2_dc_coef, 0, sizeof(pi2_dc_coef));
 1877|     42|                            ih264d_unpack_coeff4x4_dc_4x4blk(ps_tu_4x4, pi2_dc_coef,
 1878|     42|                                                             ps_dec->pu1_inv_scan);
 1879|       |
 1880|     42|                            PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|     42|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
 1881|     42|                            ps_dec->pf_ihadamard_scaling_4x4(
 1882|     42|                                pi2_dc_coef, pi2_coeff_block, ps_dec->pu2_quant_scale_y,
 1883|     42|                                (UWORD16 *) pi2_scale_matrix_ptr, ps_dec->u1_qp_y_div6, pi4_tmp);
 1884|     42|                            pi2_coeff_block += 16;
 1885|     42|                            ps_dec->pv_parse_tu_coeff_data = (void *) pi2_coeff_block;
 1886|     42|                            SET_BIT(ps_cur_mb_info->u1_yuv_dc_block_flag, 0);
  ------------------
  |  |  106|     42|#define SET_BIT(x, pos) (x) = (x) | (1 << pos);
  ------------------
 1887|     42|                        }
 1888|     57|                    }
 1889|     57|                }
 1890|     57|            }
 1891|     57|        }
 1892|    543|        ps_dec->pu1_left_yuv_dc_csbp[0] &= 0x6;
 1893|    543|        ps_dec->pu1_left_yuv_dc_csbp[0] |= u1_dc_block_flag;
 1894|    543|    }
 1895|  3.49k|    else
 1896|  3.49k|    {
 1897|  3.49k|        u1_offset = 0;
 1898|       |        /*--------------------------------------------------------------------*/
 1899|       |        /* Read the Coded block pattern                                       */
 1900|       |        /*--------------------------------------------------------------------*/
 1901|  3.49k|        u1_cbp = ih264d_parse_ctx_cbp_cabac(ps_dec);
 1902|  3.49k|        COPYTHECONTEXT("coded_block_pattern", u1_cbp);
 1903|       |
 1904|  3.49k|        ps_cur_mb_info->u1_cbp = u1_cbp;
 1905|  3.49k|        p_curr_ctxt->u1_cbp = u1_cbp;
 1906|  3.49k|        p_curr_ctxt->u1_yuv_dc_csbp &= 0xFE;
 1907|  3.49k|        ps_dec->pu1_left_yuv_dc_csbp[0] &= 0x6;
 1908|  3.49k|        p_curr_ctxt->u1_mb_type = CAB_INFERRED;
  ------------------
  |  |   74|  3.49k|#define CAB_INFERRED 0xFF
  ------------------
 1909|  3.49k|        p_curr_ctxt->u1_intra_chroma_pred_mode = 0;
 1910|  3.49k|        ps_cur_mb_info->u1_tran_form8x8 = 0;
 1911|  3.49k|        ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
 1912|       |
 1913|       |        /*--------------------------------------------------------------------*/
 1914|       |        /* Read transform_size_8x8_flag if present                            */
 1915|       |        /*--------------------------------------------------------------------*/
 1916|  3.49k|        if((ps_dec->ps_cur_pps->i4_transform_8x8_mode_flag) && (u1_cbp & 0xf))
  ------------------
  |  Branch (1916:12): [True: 2.98k, False: 513]
  |  Branch (1916:64): [True: 2.90k, False: 76]
  ------------------
 1917|  2.90k|        {
 1918|  2.90k|            ps_cur_mb_info->u1_tran_form8x8 =
 1919|  2.90k|                ih264d_parse_transform8x8flag_cabac(ps_dec, ps_cur_mb_info);
 1920|  2.90k|            COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8);
 1921|  2.90k|            p_curr_ctxt->u1_transform8x8_ctxt = ps_cur_mb_info->u1_tran_form8x8;
 1922|  2.90k|            ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8;
 1923|  2.90k|        }
 1924|    589|        else
 1925|    589|        {
 1926|    589|            p_curr_ctxt->u1_transform8x8_ctxt = 0;
 1927|    589|        }
 1928|       |
 1929|       |        /*--------------------------------------------------------------------*/
 1930|       |        /* Read mb_qp_delta                                                   */
 1931|       |        /*--------------------------------------------------------------------*/
 1932|  3.49k|        if(ps_cur_mb_info->u1_cbp)
  ------------------
  |  Branch (1932:12): [True: 3.39k, False: 106]
  ------------------
 1933|  3.39k|        {
 1934|  3.39k|            ret = ih264d_parse_mb_qp_delta_cabac(ps_dec, &i1_delta_qp);
 1935|  3.39k|            if(ret != OK) return ret;
  ------------------
  |  |  114|  3.39k|#define OK        0
  ------------------
  |  Branch (1935:16): [True: 0, False: 3.39k]
  ------------------
 1936|  3.39k|            COPYTHECONTEXT("mb_qp_delta", i1_delta_qp);
 1937|  3.39k|            if(i1_delta_qp != 0)
  ------------------
  |  Branch (1937:16): [True: 270, False: 3.12k]
  ------------------
 1938|    270|            {
 1939|    270|                ret = ih264d_update_qp(ps_dec, i1_delta_qp);
 1940|    270|                if(ret != OK) return ret;
  ------------------
  |  |  114|    270|#define OK        0
  ------------------
  |  Branch (1940:20): [True: 0, False: 270]
  ------------------
 1941|    270|            }
 1942|  3.39k|        }
 1943|    106|        else
 1944|    106|            ps_dec->i1_prev_mb_qp_delta = 0;
 1945|  3.49k|    }
 1946|       |
 1947|  4.04k|    ih264d_parse_residual4x4_cabac(ps_dec, ps_cur_mb_info, u1_offset);
 1948|  4.04k|    if(EXCEED_OFFSET(ps_bitstrm)) return ERROR_EOB_TERMINATE_T;
  ------------------
  |  |   93|  4.04k|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 82, False: 3.95k]
  |  |  ------------------
  ------------------
 1949|  3.95k|    return OK;
  ------------------
  |  |  114|  3.95k|#define OK        0
  ------------------
 1950|  4.04k|}
isvcd_parse_islice:
 1965|    821|{
 1966|    821|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1967|    821|    dec_pic_params_t *ps_pps = ps_dec->ps_cur_pps;
 1968|    821|    dec_slice_params_t *ps_slice = ps_dec->ps_cur_slice;
 1969|    821|    UWORD32 *pu4_bitstrm_buf = ps_dec->ps_bitstrm->pu4_buffer;
 1970|    821|    UWORD32 *pu4_bitstrm_ofst = &ps_dec->ps_bitstrm->u4_ofst;
 1971|    821|    UWORD32 u4_temp;
 1972|    821|    WORD32 i_temp;
 1973|    821|    WORD32 ret;
 1974|       |
 1975|       |    /*--------------------------------------------------------------------*/
 1976|       |    /* Read remaining contents of the slice header                        */
 1977|       |    /*--------------------------------------------------------------------*/
 1978|       |    /* dec_ref_pic_marking function */
 1979|       |    /* G050 */
 1980|    821|    if(ps_slice->u1_nal_ref_idc != 0)
  ------------------
  |  Branch (1980:8): [True: 821, False: 0]
  ------------------
 1981|    821|    {
 1982|    821|        if(!ps_dec->ps_dpb_cmds->u1_dpb_commands_read)
  ------------------
  |  Branch (1982:12): [True: 821, False: 0]
  ------------------
 1983|    821|        {
 1984|    821|            dec_pic_params_t *ps_pps = ps_dec->ps_cur_pps;
 1985|    821|            dec_seq_params_t *ps_sps_tmp = ps_pps->ps_sps;
 1986|    821|            UWORD8 u1_nal_unit_type_tmp = ps_dec->u1_nal_unit_type;
 1987|       |
 1988|    821|            ps_pps->ps_sps = ps_dec->ps_cur_sps;
 1989|    821|            if(ps_svc_lyr_dec->ps_nal_svc_ext->u1_idr_flag)
  ------------------
  |  Branch (1989:16): [True: 821, False: 0]
  ------------------
 1990|    821|                ps_dec->u1_nal_unit_type = IDR_SLICE_NAL;
  ------------------
  |  |  328|    821|#define IDR_SLICE_NAL                   5
  ------------------
 1991|       |
 1992|    821|            i_temp = ih264d_read_mmco_commands(ps_dec);
 1993|    821|            ps_pps->ps_sps = ps_sps_tmp;
 1994|    821|            ps_dec->u1_nal_unit_type = u1_nal_unit_type_tmp;
 1995|       |
 1996|    821|            if(i_temp < 0)
  ------------------
  |  Branch (1996:16): [True: 0, False: 821]
  ------------------
 1997|      0|            {
 1998|      0|                return ERROR_DBP_MANAGER_T;
 1999|      0|            }
 2000|    821|            ps_dec->u4_bitoffset = i_temp;
 2001|    821|        }
 2002|      0|        else
 2003|      0|            ps_dec->ps_bitstrm->u4_ofst += ps_dec->u4_bitoffset;
 2004|    821|    }
 2005|       |
 2006|    821|    {
 2007|       |        /* G050 */
 2008|       |        /* Read slice_qp_delta */
 2009|    821|        WORD64 i8_temp =
 2010|    821|            (WORD64) ps_pps->u1_pic_init_qp + ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 2011|    821|        if((i8_temp < MIN_H264_QP) || (i8_temp > MAX_H264_QP)) return ERROR_INV_RANGE_QP_T;
  ------------------
  |  |  629|    821|#define MIN_H264_QP 0
  ------------------
                      if((i8_temp < MIN_H264_QP) || (i8_temp > MAX_H264_QP)) return ERROR_INV_RANGE_QP_T;
  ------------------
  |  |  634|    812|#define MAX_H264_QP 51
  ------------------
  |  Branch (2011:12): [True: 9, False: 812]
  |  Branch (2011:39): [True: 6, False: 806]
  ------------------
 2012|    806|        ps_slice->u1_slice_qp = (UWORD8) i8_temp;
 2013|    806|        COPYTHECONTEXT("SH: slice_qp_delta", ps_slice->u1_slice_qp - ps_pps->u1_pic_init_qp);
 2014|    806|    }
 2015|    806|    if(ps_pps->u1_deblocking_filter_parameters_present_flag == 1)
  ------------------
  |  Branch (2015:8): [True: 91, False: 715]
  ------------------
 2016|     91|    {
 2017|     91|        u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 2018|     91|        COPYTHECONTEXT("SH: disable_deblocking_filter_idc", u4_temp);
 2019|       |
 2020|     91|        if(u4_temp > SLICE_BOUNDARY_DBLK_DISABLED)
  ------------------
  |  |  547|     91|#define SLICE_BOUNDARY_DBLK_DISABLED  2
  ------------------
  |  Branch (2020:12): [True: 14, False: 77]
  ------------------
 2021|     14|        {
 2022|     14|            return ERROR_INV_SLICE_HDR_T;
 2023|     14|        }
 2024|     77|        ps_slice->u1_disable_dblk_filter_idc = u4_temp;
 2025|     77|        if(u4_temp != 1)
  ------------------
  |  Branch (2025:12): [True: 41, False: 36]
  ------------------
 2026|     41|        {
 2027|     41|            i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf) << 1;
 2028|     41|            if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  550|     41|#define MIN_DBLK_FIL_OFF              -12
  ------------------
                          if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  551|     41|#define MAX_DBLK_FIL_OFF              12
  ------------------
  |  Branch (2028:16): [True: 0, False: 41]
  |  Branch (2028:47): [True: 0, False: 41]
  ------------------
 2029|      0|            {
 2030|      0|                return ERROR_INV_SLICE_HDR_T;
 2031|      0|            }
 2032|     41|            ps_slice->i1_slice_alpha_c0_offset = i_temp;
 2033|     41|            COPYTHECONTEXT("SH: slice_alpha_c0_offset_div2",
 2034|     41|                           ps_slice->i1_slice_alpha_c0_offset >> 1);
 2035|       |
 2036|     41|            i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf) << 1;
 2037|     41|            if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  550|     41|#define MIN_DBLK_FIL_OFF              -12
  ------------------
                          if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  551|     41|#define MAX_DBLK_FIL_OFF              12
  ------------------
  |  Branch (2037:16): [True: 0, False: 41]
  |  Branch (2037:47): [True: 0, False: 41]
  ------------------
 2038|      0|            {
 2039|      0|                return ERROR_INV_SLICE_HDR_T;
 2040|      0|            }
 2041|     41|            ps_slice->i1_slice_beta_offset = i_temp;
 2042|     41|            COPYTHECONTEXT("SH: slice_beta_offset_div2", ps_slice->i1_slice_beta_offset >> 1);
 2043|     41|        }
 2044|     36|        else
 2045|     36|        {
 2046|     36|            ps_slice->i1_slice_alpha_c0_offset = 0;
 2047|     36|            ps_slice->i1_slice_beta_offset = 0;
 2048|     36|        }
 2049|     77|    }
 2050|    715|    else
 2051|    715|    {
 2052|    715|        ps_slice->u1_disable_dblk_filter_idc = 0;
 2053|    715|        ps_slice->i1_slice_alpha_c0_offset = 0;
 2054|    715|        ps_slice->i1_slice_beta_offset = 0;
 2055|    715|    }
 2056|       |
 2057|       |    /* Initialization to check if number of motion vector per 2 Mbs */
 2058|       |    /* are exceeding the range or not */
 2059|    792|    ps_dec->u2_mv_2mb[0] = 0;
 2060|    792|    ps_dec->u2_mv_2mb[1] = 0;
 2061|       |
 2062|       |    /*set slice header cone to 2 ,to indicate  correct header*/
 2063|    792|    ps_dec->u1_slice_header_done = 2;
 2064|    792|    if(ps_pps->u1_entropy_coding_mode)
  ------------------
  |  Branch (2064:8): [True: 715, False: 77]
  ------------------
 2065|    715|    {
 2066|    715|        SWITCHOFFTRACE;
 2067|    715|        SWITCHONTRACECABAC;
 2068|    715|        if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (2068:12): [True: 0, False: 715]
  ------------------
 2069|      0|        {
 2070|      0|            ps_dec->pf_get_mb_info = ih264d_get_mb_info_cabac_mbaff;
 2071|      0|        }
 2072|    715|        else
 2073|    715|            ps_dec->pf_get_mb_info = isvcd_get_mb_info_cabac_nonmbaff;
 2074|       |
 2075|    715|        ret = isvcd_parse_islice_data_cabac(ps_svc_lyr_dec, ps_slice, u2_first_mb_in_slice);
 2076|    715|        if(ret != OK) return ret;
  ------------------
  |  |  114|    715|#define OK        0
  ------------------
  |  Branch (2076:12): [True: 664, False: 51]
  ------------------
 2077|     51|        SWITCHONTRACE;
 2078|     51|        SWITCHOFFTRACECABAC;
 2079|     51|    }
 2080|     77|    else
 2081|     77|    {
 2082|     77|        if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (2082:12): [True: 0, False: 77]
  ------------------
 2083|      0|        {
 2084|      0|            ps_dec->pf_get_mb_info = ih264d_get_mb_info_cavlc_mbaff;
 2085|      0|        }
 2086|     77|        else
 2087|     77|            ps_dec->pf_get_mb_info = isvcd_get_mb_info_cavlc_nonmbaff;
 2088|     77|        ret = isvcd_parse_islice_data_cavlc(ps_svc_lyr_dec, ps_slice, u2_first_mb_in_slice);
 2089|     77|        if(ret != OK) return ret;
  ------------------
  |  |  114|     77|#define OK        0
  ------------------
  |  Branch (2089:12): [True: 64, False: 13]
  ------------------
 2090|     77|    }
 2091|       |
 2092|     64|    return OK;
  ------------------
  |  |  114|     64|#define OK        0
  ------------------
 2093|    792|}

isvcd_parse_epslice:
   99|    645|{
  100|    645|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  101|    645|    WORD32 i_status = OK;
  ------------------
  |  |  114|    645|#define OK        0
  ------------------
  102|    645|    dec_pic_params_t *ps_pps = ps_dec->ps_cur_pps;
  103|    645|    dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice;
  104|    645|    dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm;
  105|    645|    dec_seq_params_t *ps_seq;
  106|    645|    dec_svc_seq_params_t *ps_subset_seq;
  107|    645|    dec_slice_svc_ext_params_t *ps_svc_slice_params = NULL;
  108|    645|    dec_subset_seq_params_t *ps_sps_svc_ext = NULL;
  109|    645|    dec_nal_unit_svc_ext_params_t *ps_nal_svc_ext = NULL;
  110|       |
  111|    645|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  112|    645|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  113|    645|    UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  114|    645|    UWORD8 u1_field_pic_flag = ps_cur_slice->u1_field_pic_flag;
  115|       |
  116|    645|    UWORD64 u8_ref_idx_l0;
  117|    645|    UWORD32 u4_temp;
  118|    645|    WORD32 i_temp;
  119|    645|    WORD32 ret;
  120|    645|    WORD64 i8_temp;
  121|       |
  122|    645|    ps_nal_svc_ext = ps_svc_lyr_dec->ps_nal_svc_ext;
  123|    645|    ps_seq = ps_pps->ps_sps;
  124|    645|    ps_seq += MAX_NUM_SEQ_PARAMS;
  ------------------
  |  |  521|    645|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
  125|    645|    ps_subset_seq =
  126|    645|        &ps_svc_lyr_dec->ps_subset_sps[MAX_NUM_SEQ_PARAMS + ps_seq->u1_seq_parameter_set_id];
  ------------------
  |  |  521|    645|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
  127|    645|    ps_sps_svc_ext = &ps_subset_seq->s_sps_svc_ext;
  128|    645|    ps_svc_slice_params = &ps_svc_lyr_dec->s_svc_slice_params;
  129|       |
  130|       |    /*--------------------------------------------------------------------*/
  131|       |    /* Read remaining contents of the slice header                        */
  132|       |    /*--------------------------------------------------------------------*/
  133|    645|    {
  134|    645|        WORD8 *pi1_buf;
  135|    645|        WORD16 *pi2_mv = ps_dec->s_default_mv_pred.i2_mv;
  136|    645|        WORD32 *pi4_mv = (WORD32 *) pi2_mv;
  137|    645|        WORD16 *pi16_refFrame;
  138|       |
  139|    645|        pi1_buf = ps_dec->s_default_mv_pred.i1_ref_frame;
  140|    645|        pi16_refFrame = (WORD16 *) pi1_buf;
  141|    645|        *pi4_mv = 0;
  142|    645|        *(pi4_mv + 1) = 0;
  143|    645|        *pi16_refFrame = OUT_OF_RANGE_REF;
  ------------------
  |  |   45|    645|#define OUT_OF_RANGE_REF  -1
  ------------------
  144|    645|        ps_dec->s_default_mv_pred.u1_col_ref_pic_idx = (UWORD8) -1;
  145|    645|        ps_dec->s_default_mv_pred.u1_pic_type = (UWORD8) -1;
  146|    645|    }
  147|       |
  148|    645|    if(0 == ps_svc_lyr_dec->ps_nal_svc_ext->u1_quality_id)
  ------------------
  |  Branch (148:8): [True: 645, False: 0]
  ------------------
  149|    645|    {
  150|    645|        ps_cur_slice->u1_num_ref_idx_active_override_flag = ih264d_get_bit_h264(ps_bitstrm);
  151|       |
  152|    645|        COPYTHECONTEXT("Slice Header SVC ext: num_ref_idx_override_flag",
  153|    645|                       ps_cur_slice->u1_num_ref_idx_active_override_flag);
  154|       |
  155|    645|        u8_ref_idx_l0 = ps_dec->ps_cur_pps->u1_num_ref_idx_lx_active[0];
  156|    645|        if(ps_cur_slice->u1_num_ref_idx_active_override_flag)
  ------------------
  |  Branch (156:12): [True: 230, False: 415]
  ------------------
  157|    230|        {
  158|    230|            u8_ref_idx_l0 = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf) + (UWORD64) 1;
  159|    230|        }
  160|       |
  161|    645|        {
  162|    645|            UWORD8 u1_max_ref_idx = H264_MAX_REF_PICS << u1_field_pic_flag;
  ------------------
  |  |  534|    645|#define H264_MAX_REF_PICS         16
  ------------------
  163|    645|            if(u8_ref_idx_l0 > u1_max_ref_idx)
  ------------------
  |  Branch (163:16): [True: 18, False: 627]
  ------------------
  164|     18|            {
  165|     18|                return ERROR_NUM_REF;
  166|     18|            }
  167|    627|            ps_cur_slice->u1_num_ref_idx_lx_active[0] = (UWORD8) u8_ref_idx_l0;
  168|    627|            COPYTHECONTEXT("Slice Header SVC ext: num_ref_idx_l0_active_minus1",
  169|    627|                           ps_cur_slice->u1_num_ref_idx_lx_active[0] - 1);
  170|    627|        }
  171|       |
  172|      0|        {
  173|    627|            UWORD8 uc_refIdxReFlagL0 = ih264d_get_bit_h264(ps_bitstrm);
  174|    627|            COPYTHECONTEXT("Slice Header SVC ext: ref_pic_list_reordering_flag_l0",
  175|    627|                           uc_refIdxReFlagL0);
  176|       |
  177|    627|            ih264d_init_ref_idx_lx_p(ps_dec);
  178|       |            /* Store the value for future slices in the same picture */
  179|    627|            ps_dec->u1_num_ref_idx_lx_active_prev = ps_cur_slice->u1_num_ref_idx_lx_active[0];
  180|       |
  181|       |            /* Modified temporarily */
  182|    627|            if(uc_refIdxReFlagL0)
  ------------------
  |  Branch (182:16): [True: 524, False: 103]
  ------------------
  183|    524|            {
  184|    524|                WORD8 ret;
  185|    524|                ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_mod_dpb[0];
  186|    524|                ret = ih264d_ref_idx_reordering(ps_dec, 0);
  187|    524|                if(ret == -1) return ERROR_REFIDX_ORDER_T;
  ------------------
  |  Branch (187:20): [True: 0, False: 524]
  ------------------
  188|    524|                ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_mod_dpb[0];
  189|    524|            }
  190|    103|            else
  191|    103|                ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_init_dpb[0];
  192|    627|        }
  193|       |        /* Create refIdx to POC mapping */
  194|    627|        {
  195|    627|            void **pui_map_ref_idx_to_poc_lx0, **pui_map_ref_idx_to_poc_lx1;
  196|    627|            WORD8 idx;
  197|    627|            struct pic_buffer_t *ps_pic;
  198|       |
  199|    627|            pui_map_ref_idx_to_poc_lx0 = ps_dec->ppv_map_ref_idx_to_poc + FRM_LIST_L0;
  ------------------
  |  |   89|    627|#define FRM_LIST_L0             0                                               //0
  ------------------
  200|    627|            pui_map_ref_idx_to_poc_lx0[0] = 0;
  201|    627|            pui_map_ref_idx_to_poc_lx0++;
  202|  1.71k|            for(idx = 0; idx < ps_cur_slice->u1_num_ref_idx_lx_active[0]; idx++)
  ------------------
  |  Branch (202:26): [True: 1.09k, False: 627]
  ------------------
  203|  1.09k|            {
  204|  1.09k|                ps_pic = ps_dec->ps_ref_pic_buf_lx[0][idx];
  205|  1.09k|                pui_map_ref_idx_to_poc_lx0[idx] = (ps_pic->pu1_buf1);
  206|  1.09k|            }
  207|       |
  208|       |            /* Bug Fix Deblocking */
  209|    627|            pui_map_ref_idx_to_poc_lx1 = ps_dec->ppv_map_ref_idx_to_poc + FRM_LIST_L1;
  ------------------
  |  |   90|    627|#define FRM_LIST_L1             1 * POC_LIST_L0_TO_L1_DIFF//FRM_LIST_L0 + POC_LIST_L0_TO_L1_DIFF        //0+33                  //(1 * POC_LIST_L0_TO_L1_DIFF)
  |  |  ------------------
  |  |  |  |   86|    627|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|    627|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  210|    627|            pui_map_ref_idx_to_poc_lx1[0] = 0;
  211|       |
  212|    627|            if(u1_mbaff)
  ------------------
  |  Branch (212:16): [True: 0, False: 627]
  ------------------
  213|      0|            {
  214|      0|                void **ppv_map_ref_idx_to_poc_lx_t, **ppv_map_ref_idx_to_poc_lx_b;
  215|      0|                void **ppv_map_ref_idx_to_poc_lx_t1, **ppv_map_ref_idx_to_poc_lx_b1;
  216|      0|                ppv_map_ref_idx_to_poc_lx_t = ps_dec->ppv_map_ref_idx_to_poc + TOP_LIST_FLD_L0;
  ------------------
  |  |   91|      0|#define TOP_LIST_FLD_L0         2 * POC_LIST_L0_TO_L1_DIFF//FRM_LIST_L1 + POC_LIST_L0_TO_L1_DIFF        //0+33+33                   //(2 * POC_LIST_L0_TO_L1_DIFF)
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  217|      0|                ppv_map_ref_idx_to_poc_lx_b = ps_dec->ppv_map_ref_idx_to_poc + BOT_LIST_FLD_L0;
  ------------------
  |  |   93|      0|#define BOT_LIST_FLD_L0         4 * POC_LIST_L0_TO_L1_DIFF//TOP_LIST_FLD_L1 + POC_LIST_L0_TO_L1_DIFF_1  //0+33+33+17+17
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  218|       |
  219|      0|                ppv_map_ref_idx_to_poc_lx_t[0] = 0;
  220|      0|                ppv_map_ref_idx_to_poc_lx_t++;
  221|      0|                ppv_map_ref_idx_to_poc_lx_b[0] = 0;
  222|      0|                ppv_map_ref_idx_to_poc_lx_b++;
  223|       |
  224|      0|                idx = 0;
  225|      0|                for(idx = 0; idx < ps_cur_slice->u1_num_ref_idx_lx_active[0]; idx++)
  ------------------
  |  Branch (225:30): [True: 0, False: 0]
  ------------------
  226|      0|                {
  227|      0|                    ps_pic = ps_dec->ps_ref_pic_buf_lx[0][idx];
  228|      0|                    ppv_map_ref_idx_to_poc_lx_t[0] = (ps_pic->pu1_buf1);
  229|      0|                    ppv_map_ref_idx_to_poc_lx_b[1] = (ps_pic->pu1_buf1);
  230|       |
  231|      0|                    ppv_map_ref_idx_to_poc_lx_b[0] = (ps_pic->pu1_buf1) + 1;
  232|      0|                    ppv_map_ref_idx_to_poc_lx_t[1] = (ps_pic->pu1_buf1) + 1;
  233|       |
  234|      0|                    ppv_map_ref_idx_to_poc_lx_t += 2;
  235|      0|                    ppv_map_ref_idx_to_poc_lx_b += 2;
  236|      0|                }
  237|      0|                ppv_map_ref_idx_to_poc_lx_t1 = ps_dec->ppv_map_ref_idx_to_poc + TOP_LIST_FLD_L1;
  ------------------
  |  |   92|      0|#define TOP_LIST_FLD_L1         3 * POC_LIST_L0_TO_L1_DIFF//TOP_LIST_FLD_L0 + POC_LIST_L0_TO_L1_DIFF_1  //0+33+33+17                //(3 * POC_LIST_L0_TO_L1_DIFF)
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  238|      0|                ppv_map_ref_idx_to_poc_lx_t1[0] = 0;
  239|      0|                ppv_map_ref_idx_to_poc_lx_b1 = ps_dec->ppv_map_ref_idx_to_poc + BOT_LIST_FLD_L1;
  ------------------
  |  |   94|      0|#define BOT_LIST_FLD_L1         5 * POC_LIST_L0_TO_L1_DIFF//BOT_LIST_FLD_L0 + POC_LIST_L0_TO_L1_DIFF_1  //0+33+33+17+17+17
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  240|      0|                ppv_map_ref_idx_to_poc_lx_b1[0] = 0;
  241|      0|            }
  242|       |            /* BS is moved post recon gen in libsvc*/
  243|    627|            if(ps_dec->u4_num_cores >= 2)
  ------------------
  |  Branch (243:16): [True: 364, False: 263]
  ------------------
  244|    364|            {
  245|    364|                WORD32 num_entries;
  246|    364|                WORD32 size;
  247|       |
  248|    364|                num_entries = MAX_FRAMES;
  ------------------
  |  |  600|    364|#define MAX_FRAMES              16
  ------------------
  249|    364|                if((1 >= ps_dec->ps_cur_sps->u1_num_ref_frames) && (0 == ps_dec->i4_display_delay))
  ------------------
  |  Branch (249:20): [True: 30, False: 334]
  |  Branch (249:68): [True: 0, False: 30]
  ------------------
  250|      0|                {
  251|      0|                    num_entries = 1;
  252|      0|                }
  253|    364|                num_entries = ((2 * num_entries) + 1);
  254|    364|                num_entries *= 2;
  255|       |
  256|    364|                size = num_entries * sizeof(void *);
  257|    364|                size += PAD_MAP_IDX_POC * sizeof(void *);
  ------------------
  |  |  100|    364|#define PAD_MAP_IDX_POC             (1)
  ------------------
  258|       |
  259|    364|                memcpy((void *) ps_dec->ps_parse_cur_slice->ppv_map_ref_idx_to_poc,
  260|    364|                       ps_dec->ppv_map_ref_idx_to_poc, size);
  261|    364|            }
  262|    627|        }
  263|    627|        if(ps_pps->u1_wted_pred_flag)
  ------------------
  |  Branch (263:12): [True: 569, False: 58]
  ------------------
  264|    569|        {
  265|    569|            if(!ps_nal_svc_ext->u1_no_inter_layer_pred_flag)
  ------------------
  |  Branch (265:16): [True: 569, False: 0]
  ------------------
  266|    569|            {
  267|    569|                ps_svc_slice_params->u1_base_pred_weight_table_flag =
  268|    569|                    ih264d_get_bit_h264(ps_bitstrm);
  269|    569|                COPYTHECONTEXT("Slice Header SVC ext: u1_base_pred_weight_table_flag",
  270|    569|                               ps_svc_slice_params->u1_base_pred_weight_table_flag);
  271|    569|            }
  272|       |
  273|    569|            if(ps_nal_svc_ext->u1_no_inter_layer_pred_flag ||
  ------------------
  |  Branch (273:16): [True: 0, False: 569]
  ------------------
  274|    569|               !ps_svc_slice_params->u1_base_pred_weight_table_flag)
  ------------------
  |  Branch (274:16): [True: 527, False: 42]
  ------------------
  275|    527|            {
  276|    527|                ret = ih264d_parse_pred_weight_table(ps_cur_slice, ps_bitstrm);
  277|    527|                if(ret != OK) return ret;
  ------------------
  |  |  114|    527|#define OK        0
  ------------------
  |  Branch (277:20): [True: 19, False: 508]
  ------------------
  278|       |
  279|    508|                ih264d_form_pred_weight_matrix(ps_dec);
  280|    508|                ps_dec->pu4_wt_ofsts = ps_dec->pu4_wts_ofsts_mat;
  281|    508|            }
  282|    569|        }
  283|     58|        else
  284|     58|        {
  285|     58|            ps_dec->ps_cur_slice->u2_log2Y_crwd = 0;
  286|     58|            ps_dec->pu4_wt_ofsts = ps_dec->pu4_wts_ofsts_mat;
  287|     58|        }
  288|       |
  289|    608|        ps_dec->ps_parse_cur_slice->u2_log2Y_crwd = ps_dec->ps_cur_slice->u2_log2Y_crwd;
  290|       |
  291|    608|        if(u1_mbaff && (u1_field_pic_flag == 0))
  ------------------
  |  Branch (291:12): [True: 0, False: 608]
  |  Branch (291:24): [True: 0, False: 0]
  ------------------
  292|      0|        {
  293|      0|            ih264d_convert_frm_mbaff_list(ps_dec);
  294|      0|        }
  295|       |
  296|       |        /* G050 */
  297|    608|        if(ps_cur_slice->u1_nal_ref_idc != 0)
  ------------------
  |  Branch (297:12): [True: 605, False: 3]
  ------------------
  298|    605|        {
  299|    605|            if(!ps_dec->ps_dpb_cmds->u1_dpb_commands_read)
  ------------------
  |  Branch (299:16): [True: 605, False: 0]
  ------------------
  300|    605|            {
  301|    605|                dec_pic_params_t *ps_pps = ps_dec->ps_cur_pps;
  302|    605|                dec_seq_params_t *ps_sps_tmp = ps_pps->ps_sps;
  303|    605|                UWORD8 u1_nal_unit_type_tmp = ps_dec->u1_nal_unit_type;
  304|       |
  305|    605|                ps_pps->ps_sps = ps_dec->ps_cur_sps;
  306|       |
  307|    605|                if(ps_svc_lyr_dec->ps_nal_svc_ext->u1_idr_flag)
  ------------------
  |  Branch (307:20): [True: 605, False: 0]
  ------------------
  308|    605|                    ps_dec->u1_nal_unit_type = IDR_SLICE_NAL;
  ------------------
  |  |  328|    605|#define IDR_SLICE_NAL                   5
  ------------------
  309|       |
  310|    605|                i_temp = ih264d_read_mmco_commands(ps_dec);
  311|       |
  312|    605|                ps_pps->ps_sps = ps_sps_tmp;
  313|    605|                ps_dec->u1_nal_unit_type = u1_nal_unit_type_tmp;
  314|       |
  315|    605|                if(i_temp < 0)
  ------------------
  |  Branch (315:20): [True: 0, False: 605]
  ------------------
  316|      0|                {
  317|      0|                    return ERROR_DBP_MANAGER_T;
  318|      0|                }
  319|    605|                ps_dec->u4_bitoffset = i_temp;
  320|    605|            }
  321|      0|            else
  322|      0|                ps_bitstrm->u4_ofst += ps_dec->u4_bitoffset;
  323|       |
  324|    605|            if(!ps_sps_svc_ext->u1_slice_header_restriction_flag)
  ------------------
  |  Branch (324:16): [True: 71, False: 534]
  ------------------
  325|     71|            {
  326|     71|                ps_svc_slice_params->u1_store_ref_base_pic_flag = ih264d_get_bit_h264(ps_bitstrm);
  327|     71|                COPYTHECONTEXT("SPS_SVC_EXT: u1_store_ref_base_pic_flag",
  328|     71|                               ps_svc_slice_params->u1_store_ref_base_pic_flag);
  329|       |
  330|     71|                if(0 != ps_svc_slice_params->u1_store_ref_base_pic_flag)
  ------------------
  |  Branch (330:20): [True: 0, False: 71]
  ------------------
  331|      0|                {
  332|      0|                    return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  333|      0|                }
  334|     71|                if(((1 == ps_nal_svc_ext->u1_use_ref_base_pic_flag) ||
  ------------------
  |  Branch (334:21): [True: 0, False: 71]
  ------------------
  335|     71|                    (1 == ps_svc_slice_params->u1_store_ref_base_pic_flag)) &&
  ------------------
  |  Branch (335:21): [True: 0, False: 71]
  ------------------
  336|      0|                   (!ps_nal_svc_ext->u1_idr_flag))
  ------------------
  |  Branch (336:20): [True: 0, False: 0]
  ------------------
  337|      0|                {
  338|      0|                    i_status = isvcd_dec_ref_base_pic_marking(
  339|      0|                        &ps_svc_slice_params->s_ref_base_pic_marking_svc_ext, ps_bitstrm);
  340|      0|                    if(i_status != OK)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (340:24): [True: 0, False: 0]
  ------------------
  341|      0|                    {
  342|      0|                        return i_status;
  343|      0|                    }
  344|      0|                }
  345|     71|            }
  346|    605|        }
  347|    608|    }
  348|       |    /* G050 */
  349|       |
  350|    608|    if(ps_pps->u1_entropy_coding_mode == CABAC)
  ------------------
  |  |  339|    608|#define CABAC  1
  ------------------
  |  Branch (350:8): [True: 550, False: 58]
  ------------------
  351|    550|    {
  352|    550|        u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  353|       |
  354|    550|        if(u4_temp > MAX_CABAC_INIT_IDC)
  ------------------
  |  |  537|    550|#define MAX_CABAC_INIT_IDC        2
  ------------------
  |  Branch (354:12): [True: 0, False: 550]
  ------------------
  355|      0|        {
  356|      0|            return ERROR_INV_SLICE_HDR_T;
  357|      0|        }
  358|    550|        ps_cur_slice->u1_cabac_init_idc = u4_temp;
  359|    550|        COPYTHECONTEXT("Slice Header SVC ext: cabac_init_idc", ps_cur_slice->u1_cabac_init_idc);
  360|    550|    }
  361|       |
  362|       |    /* Read slice_qp_delta */
  363|    608|    i8_temp = (WORD64) ps_pps->u1_pic_init_qp + ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  364|    608|    if((i8_temp < MIN_H264_QP) || (i8_temp > MAX_H264_QP))
  ------------------
  |  |  629|    608|#define MIN_H264_QP 0
  ------------------
                  if((i8_temp < MIN_H264_QP) || (i8_temp > MAX_H264_QP))
  ------------------
  |  |  634|    606|#define MAX_H264_QP 51
  ------------------
  |  Branch (364:8): [True: 2, False: 606]
  |  Branch (364:35): [True: 0, False: 606]
  ------------------
  365|      2|    {
  366|      2|        return ERROR_INV_RANGE_QP_T;
  367|      2|    }
  368|    606|    ps_cur_slice->u1_slice_qp = (UWORD8) i8_temp;
  369|    606|    COPYTHECONTEXT("Slice Header SVC ext: slice_qp_delta",
  370|    606|                   (WORD8) (ps_cur_slice->u1_slice_qp - ps_pps->u1_pic_init_qp));
  371|       |
  372|    606|    if(ps_pps->u1_deblocking_filter_parameters_present_flag == 1)
  ------------------
  |  Branch (372:8): [True: 550, False: 56]
  ------------------
  373|    550|    {
  374|    550|        u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  375|    550|        if(u4_temp > SLICE_BOUNDARY_DBLK_DISABLED)
  ------------------
  |  |  547|    550|#define SLICE_BOUNDARY_DBLK_DISABLED  2
  ------------------
  |  Branch (375:12): [True: 0, False: 550]
  ------------------
  376|      0|        {
  377|      0|            return ERROR_INV_SLICE_HDR_T;
  378|      0|        }
  379|       |
  380|    550|        COPYTHECONTEXT("Slice Header SVC ext: disable_deblocking_filter_idc", u4_temp);
  381|    550|        ps_cur_slice->u1_disable_dblk_filter_idc = u4_temp;
  382|    550|        if(u4_temp != 1)
  ------------------
  |  Branch (382:12): [True: 550, False: 0]
  ------------------
  383|    550|        {
  384|    550|            i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf) << 1;
  385|    550|            if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  550|    550|#define MIN_DBLK_FIL_OFF              -12
  ------------------
                          if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  551|    550|#define MAX_DBLK_FIL_OFF              12
  ------------------
  |  Branch (385:16): [True: 0, False: 550]
  |  Branch (385:47): [True: 0, False: 550]
  ------------------
  386|      0|            {
  387|      0|                return ERROR_INV_SLICE_HDR_T;
  388|      0|            }
  389|    550|            ps_cur_slice->i1_slice_alpha_c0_offset = i_temp;
  390|    550|            COPYTHECONTEXT("Slice Header SVC ext: slice_alpha_c0_offset_div2",
  391|    550|                           ps_cur_slice->i1_slice_alpha_c0_offset >> 1);
  392|       |
  393|    550|            i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf) << 1;
  394|    550|            if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  550|    550|#define MIN_DBLK_FIL_OFF              -12
  ------------------
                          if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  551|    550|#define MAX_DBLK_FIL_OFF              12
  ------------------
  |  Branch (394:16): [True: 0, False: 550]
  |  Branch (394:47): [True: 0, False: 550]
  ------------------
  395|      0|            {
  396|      0|                return ERROR_INV_SLICE_HDR_T;
  397|      0|            }
  398|    550|            ps_cur_slice->i1_slice_beta_offset = i_temp;
  399|    550|            COPYTHECONTEXT("Slice Header SVC ext: slice_beta_offset_div2",
  400|    550|                           ps_cur_slice->i1_slice_beta_offset >> 1);
  401|    550|        }
  402|      0|        else
  403|      0|        {
  404|      0|            ps_cur_slice->i1_slice_alpha_c0_offset = 0;
  405|      0|            ps_cur_slice->i1_slice_beta_offset = 0;
  406|      0|        }
  407|    550|    }
  408|     56|    else
  409|     56|    {
  410|     56|        ps_cur_slice->u1_disable_dblk_filter_idc = 0;
  411|     56|        ps_cur_slice->i1_slice_alpha_c0_offset = 0;
  412|     56|        ps_cur_slice->i1_slice_beta_offset = 0;
  413|     56|    }
  414|       |
  415|       |    /* add the remaining part of the code for svc extension from reference */
  416|    606|    ret = isvcd_set_default_slice_header_ext(ps_svc_lyr_dec);
  417|    606|    if(ret != OK)
  ------------------
  |  |  114|    606|#define OK        0
  ------------------
  |  Branch (417:8): [True: 0, False: 606]
  ------------------
  418|      0|    {
  419|      0|        return ERROR_INV_SLICE_HDR_T;
  420|      0|    }
  421|       |
  422|    606|    ret = isvcd_parse_slice_header(ps_svc_lyr_dec);
  423|    606|    if(ret != OK)
  ------------------
  |  |  114|    606|#define OK        0
  ------------------
  |  Branch (423:8): [True: 1, False: 605]
  ------------------
  424|      1|    {
  425|      1|        return ERROR_INV_SLICE_HDR_T;
  426|      1|    }
  427|       |
  428|    605|    ps_dec->u1_slice_header_done = 2;
  429|       |
  430|    605|    if(!ps_svc_slice_params->u1_slice_skip_flag)
  ------------------
  |  Branch (430:8): [True: 604, False: 1]
  ------------------
  431|    604|    {
  432|    604|        if(ps_pps->u1_entropy_coding_mode)
  ------------------
  |  Branch (432:12): [True: 549, False: 55]
  ------------------
  433|    549|        {
  434|    549|            SWITCHOFFTRACE;
  435|    549|            SWITCHONTRACECABAC;
  436|    549|            ps_svc_lyr_dec->pf_parse_inter_slice_svc_ext =
  437|    549|                isvcd_parse_inter_slice_data_cabac_enh_lyr;
  438|    549|            ps_svc_lyr_dec->pf_parse_inter_mb_svc_ext = isvcd_parse_pmb_cabac;
  439|       |
  440|    549|            isvcd_init_cabac_contexts(P_SLICE, ps_dec);
  ------------------
  |  |  368|    549|#define P_SLICE  0
  ------------------
  441|       |
  442|    549|            if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (442:16): [True: 0, False: 549]
  ------------------
  443|      0|                ps_dec->pf_get_mb_info = ih264d_get_mb_info_cabac_mbaff;
  444|    549|            else
  445|    549|                ps_dec->pf_get_mb_info = isvcd_get_mb_info_cabac_nonmbaff;
  446|    549|        }
  447|     55|        else
  448|     55|        {
  449|     55|            SWITCHONTRACE;
  450|     55|            SWITCHOFFTRACECABAC;
  451|     55|            ps_svc_lyr_dec->pf_parse_inter_slice_svc_ext =
  452|     55|                isvcd_parse_inter_slice_data_cavlc_enh_lyr;
  453|     55|            ps_svc_lyr_dec->pf_parse_inter_mb_svc_ext = isvcd_parse_pmb_cavlc;
  454|       |
  455|     55|            if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (455:16): [True: 0, False: 55]
  ------------------
  456|      0|            {
  457|      0|                ps_dec->pf_get_mb_info = ih264d_get_mb_info_cavlc_mbaff;
  458|      0|            }
  459|     55|            else
  460|     55|                ps_dec->pf_get_mb_info = isvcd_get_mb_info_cavlc_nonmbaff;
  461|     55|        }
  462|    604|    }
  463|      1|    else
  464|      1|    {
  465|      1|        return ERROR_FEATURE_UNAVAIL;
  466|      1|    }
  467|       |
  468|    604|    ps_dec->u1_B = 0;
  469|    604|    ps_dec->pf_mvpred_ref_tfr_nby2mb = isvcd_mv_pred_ref_tfr_nby2_epmb;
  470|    604|    ret = ps_svc_lyr_dec->pf_parse_inter_slice_svc_ext(ps_svc_lyr_dec, ps_cur_slice,
  471|    604|                                                       u2_first_mb_in_slice);
  472|    604|    if(ret != OK) return ret;
  ------------------
  |  |  114|    604|#define OK        0
  ------------------
  |  Branch (472:8): [True: 226, False: 378]
  ------------------
  473|       |
  474|    378|    return OK;
  ------------------
  |  |  114|    378|#define OK        0
  ------------------
  475|    604|}
isvcd_parse_inter_slice_data_cabac:
  505|  1.90k|{
  506|  1.90k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  507|       |
  508|  1.90k|    UWORD32 uc_more_data_flag;
  509|  1.90k|    WORD32 i2_cur_mb_addr;
  510|  1.90k|    UWORD32 u1_num_mbs, u1_num_mbsNby2, u1_mb_idx;
  511|  1.90k|    UWORD32 u1_mbaff;
  512|  1.90k|    UWORD32 u1_num_mbs_next, u1_end_of_row;
  513|  1.90k|    const UWORD16 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs;
  514|  1.90k|    UWORD32 u1_slice_end = 0;
  515|  1.90k|    UWORD32 u1_tfr_n_mb = 0;
  516|  1.90k|    UWORD32 u1_decode_nmb = 0;
  517|       |
  518|  1.90k|    deblk_mb_t *ps_cur_deblk_mb;
  519|  1.90k|    dec_mb_info_t *ps_cur_mb_info;
  520|  1.90k|    parse_pmbarams_t *ps_parse_mb_data = ps_dec->ps_parse_mb_data;
  521|  1.90k|    UWORD32 u1_inter_mb_skip_type;
  522|  1.90k|    UWORD32 u1_inter_mb_type;
  523|  1.90k|    UWORD32 u1_deblk_mb_type;
  524|  1.90k|    UWORD32 u1_mb_threshold;
  525|  1.90k|    dec_bit_stream_t *const ps_bitstrm = ps_dec->ps_bitstrm;
  526|  1.90k|    WORD32 ret = OK;
  ------------------
  |  |  114|  1.90k|#define OK        0
  ------------------
  527|       |
  528|       |    /******************************************************/
  529|       |    /* Initialisations specific to B or P slice           */
  530|       |    /******************************************************/
  531|  1.90k|    if(ps_slice->u1_slice_type == P_SLICE)
  ------------------
  |  |  368|  1.90k|#define P_SLICE  0
  ------------------
  |  Branch (531:8): [True: 706, False: 1.20k]
  ------------------
  532|    706|    {
  533|    706|        u1_inter_mb_skip_type = CAB_P_SKIP;
  ------------------
  |  |  403|    706|#define CAB_P_SKIP        0x16 /* 0001 x11x */
  ------------------
  534|    706|        u1_inter_mb_type = P_MB;
  ------------------
  |  |  419|    706|#define P_MB        2
  ------------------
  535|    706|        u1_deblk_mb_type = D_INTER_MB;
  ------------------
  |  |  381|    706|#define D_INTER_MB        0
  ------------------
  536|    706|        u1_mb_threshold = 5;
  537|    706|    }
  538|  1.20k|    else  // B_SLICE
  539|  1.20k|    {
  540|  1.20k|        u1_inter_mb_skip_type = CAB_B_SKIP;
  ------------------
  |  |  404|  1.20k|#define CAB_B_SKIP        0x14 /* 0001 x100 */
  ------------------
  541|  1.20k|        u1_inter_mb_type = B_MB;
  ------------------
  |  |  420|  1.20k|#define B_MB        3
  ------------------
  542|  1.20k|        u1_deblk_mb_type = D_B_SLICE;
  ------------------
  |  |  384|  1.20k|#define D_B_SLICE         4
  ------------------
  543|  1.20k|        u1_mb_threshold = 23;
  544|  1.20k|    }
  545|       |
  546|       |    /******************************************************/
  547|       |    /* Slice Level Initialisations                        */
  548|       |    /******************************************************/
  549|  1.90k|    i2_cur_mb_addr = u2_first_mb_in_slice;
  550|  1.90k|    ps_dec->u1_qp = ps_slice->u1_slice_qp;
  551|  1.90k|    ih264d_update_qp(ps_dec, 0);
  552|  1.90k|    u1_mb_idx = ps_dec->u4_mb_idx;
  553|  1.90k|    u1_num_mbs = u1_mb_idx;
  554|  1.90k|    u1_num_mbsNby2 = 0;
  555|  1.90k|    u1_mbaff = ps_slice->u1_mbaff_frame_flag;
  556|  1.90k|    i2_cur_mb_addr = u2_first_mb_in_slice << u1_mbaff;
  557|  1.90k|    uc_more_data_flag = 1;
  558|       |
  559|       |    /* Initialisations specific to cabac */
  560|  1.90k|    if(ps_bitstrm->u4_ofst & 0x07)
  ------------------
  |  Branch (560:8): [True: 1.61k, False: 298]
  ------------------
  561|  1.61k|    {
  562|  1.61k|        ps_bitstrm->u4_ofst += 8;
  563|  1.61k|        ps_bitstrm->u4_ofst &= 0xFFFFFFF8;
  564|  1.61k|    }
  565|       |
  566|  1.90k|    ret = ih264d_init_cabac_dec_envirnoment(&(ps_dec->s_cab_dec_env), ps_bitstrm);
  567|  1.90k|    if(ret != OK) return ret;
  ------------------
  |  |  114|  1.90k|#define OK        0
  ------------------
  |  Branch (567:8): [True: 6, False: 1.90k]
  ------------------
  568|       |
  569|  1.90k|    ps_dec->i1_prev_mb_qp_delta = 0;
  570|       |
  571|  62.1k|    while(!u1_slice_end)
  ------------------
  |  Branch (571:11): [True: 61.5k, False: 656]
  ------------------
  572|  61.5k|    {
  573|  61.5k|        UWORD8 u1_mb_type;
  574|  61.5k|        UWORD32 u4_mb_skip;
  575|       |
  576|  61.5k|        ps_dec->pv_prev_mb_parse_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
  577|       |
  578|  61.5k|        if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u4_max_mb_addr)
  ------------------
  |  Branch (578:12): [True: 751, False: 60.7k]
  ------------------
  579|    751|        {
  580|    751|            break;
  581|    751|        }
  582|       |
  583|  60.7k|        ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs;
  584|  60.7k|        ps_dec->u4_num_mbs_cur_nmb = u1_num_mbs;
  585|       |
  586|  60.7k|        ps_cur_mb_info->u1_Mux = 0;
  587|  60.7k|        ps_dec->u4_num_pmbair = (u1_num_mbs >> u1_mbaff);
  588|  60.7k|        ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u1_num_mbs;
  589|  60.7k|        ps_cur_mb_info->u1_end_of_slice = 0;
  590|       |
  591|       |        /* Storing Default partition info */
  592|  60.7k|        ps_parse_mb_data->u1_num_part = 1;
  593|  60.7k|        ps_parse_mb_data->u4_isI_mb = 0;
  594|       |
  595|       |        /***************************************************************/
  596|       |        /* Get the required information for decoding of MB             */
  597|       |        /* mb_x, mb_y , neighbour availablity,                         */
  598|       |        /***************************************************************/
  599|  60.7k|        u4_mb_skip = ps_dec->pf_get_mb_info(ps_dec, i2_cur_mb_addr, ps_cur_mb_info, 1);
  600|       |
  601|       |        /*********************************************************************/
  602|       |        /* initialize u1_tran_form8x8 to zero to aviod uninitialized accesses */
  603|       |        /*********************************************************************/
  604|  60.7k|        ps_cur_mb_info->u1_tran_form8x8 = 0;
  605|  60.7k|        ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
  606|       |
  607|       |        /***************************************************************/
  608|       |        /* Set the deblocking parameters for this MB                   */
  609|       |        /***************************************************************/
  610|  60.7k|        if(ps_dec->u4_app_disable_deblk_frm == 0)
  ------------------
  |  Branch (610:12): [True: 60.7k, False: 0]
  ------------------
  611|  60.7k|            ih264d_set_deblocking_parameters(ps_cur_deblk_mb, ps_slice,
  612|  60.7k|                                             ps_dec->u1_mb_ngbr_availablity,
  613|  60.7k|                                             ps_dec->u1_cur_mb_fld_dec_flag);
  614|       |
  615|  60.7k|        if(u4_mb_skip)
  ------------------
  |  Branch (615:12): [True: 20.1k, False: 40.6k]
  ------------------
  616|  20.1k|        {
  617|       |            /* Set appropriate flags in ps_cur_mb_info and ps_dec */
  618|  20.1k|            memset(ps_dec->ps_curr_ctxt_mb_info, 0, sizeof(ctxt_inc_mb_info_t));
  619|  20.1k|            ps_dec->ps_curr_ctxt_mb_info->u1_mb_type = u1_inter_mb_skip_type;
  620|       |
  621|  20.1k|            MEMSET_16BYTES(&ps_dec->pu1_left_mv_ctxt_inc[0][0], 0);
  ------------------
  |  |  652|  20.1k|#define MEMSET_16BYTES(pu4_start,value)                         \
  |  |  653|  20.1k|{                                                               \
  |  |  654|  20.1k|    memset(pu4_start,value,16);                                 \
  |  |  655|  20.1k|}
  ------------------
  622|       |
  623|  20.1k|            *((UWORD32 *) ps_dec->pi1_left_ref_idx_ctxt_inc) = 0;
  624|  20.1k|            *(ps_dec->pu1_left_yuv_dc_csbp) = 0;
  625|  20.1k|            ps_dec->i1_prev_mb_qp_delta = 0;
  626|  20.1k|            ps_cur_mb_info->u1_mb_type = MB_SKIP;
  ------------------
  |  |   59|  20.1k|#define MB_SKIP 255
  ------------------
  627|  20.1k|            ps_cur_mb_info->u1_cbp = 0;
  628|       |
  629|  20.1k|            {
  630|       |                /* Storing Skip partition info */
  631|  20.1k|                parse_part_params_t *ps_part_info = ps_dec->ps_part;
  632|  20.1k|                ps_part_info->u1_is_direct = PART_DIRECT_16x16;
  ------------------
  |  |  571|  20.1k|#define PART_DIRECT_16x16              2
  ------------------
  633|  20.1k|                ps_part_info->u1_sub_mb_num = 0;
  634|  20.1k|                ps_dec->ps_part++;
  635|  20.1k|            }
  636|       |
  637|       |            /* Update Nnzs */
  638|  20.1k|            ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CABAC);
  ------------------
  |  |  339|  20.1k|#define CABAC  1
  ------------------
  639|  20.1k|            ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type;
  640|  20.1k|            ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type;
  641|  20.1k|            ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp;
  642|  20.1k|            if(ps_svc_lyr_dec->u1_layer_identifier != TARGET_LAYER)
  ------------------
  |  |  110|  20.1k|#define TARGET_LAYER 2
  ------------------
  |  Branch (642:16): [True: 10.3k, False: 9.77k]
  ------------------
  643|  10.3k|            {
  644|  10.3k|                ps_cur_deblk_mb->u1_deblocking_mode = MB_DISABLE_FILTERING;
  ------------------
  |  |   70|  10.3k|#define MB_DISABLE_FILTERING          0x01
  ------------------
  645|  10.3k|            }
  646|  20.1k|        }
  647|  40.6k|        else
  648|  40.6k|        {
  649|       |            /* Macroblock Layer Begins */
  650|       |            /* Decode the u1_mb_type */
  651|  40.6k|            u1_mb_type = ih264d_parse_mb_type_cabac(ps_dec);
  652|  40.6k|            ps_cur_mb_info->u1_mb_type = u1_mb_type;
  653|  40.6k|            if(u1_mb_type > (25 + u1_mb_threshold)) return ERROR_MB_TYPE;
  ------------------
  |  Branch (653:16): [True: 0, False: 40.6k]
  ------------------
  654|       |
  655|       |            /* Parse Macroblock Data */
  656|  40.6k|            if(u1_mb_type < u1_mb_threshold)
  ------------------
  |  Branch (656:16): [True: 37.7k, False: 2.88k]
  ------------------
  657|  37.7k|            {
  658|  37.7k|                ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type;
  659|  37.7k|                *(ps_dec->pu1_left_yuv_dc_csbp) &= 0x6;
  660|       |
  661|  37.7k|                ret = ps_dec->pf_parse_inter_mb(ps_dec, ps_cur_mb_info, u1_num_mbs, u1_num_mbsNby2);
  662|  37.7k|                if(ret != OK) return ret;
  ------------------
  |  |  114|  37.7k|#define OK        0
  ------------------
  |  Branch (662:20): [True: 464, False: 37.2k]
  ------------------
  663|  37.2k|                ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp;
  664|  37.2k|                ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type;
  665|  37.2k|                if(ps_svc_lyr_dec->u1_layer_identifier != TARGET_LAYER)
  ------------------
  |  |  110|  37.2k|#define TARGET_LAYER 2
  ------------------
  |  Branch (665:20): [True: 7.64k, False: 29.6k]
  ------------------
  666|  7.64k|                {
  667|  7.64k|                    ps_cur_deblk_mb->u1_deblocking_mode = MB_DISABLE_FILTERING;
  ------------------
  |  |   70|  7.64k|#define MB_DISABLE_FILTERING          0x01
  ------------------
  668|  7.64k|                }
  669|  37.2k|            }
  670|  2.88k|            else
  671|  2.88k|            {
  672|       |                /* Storing Intra partition info */
  673|  2.88k|                ps_parse_mb_data->u1_num_part = 0;
  674|  2.88k|                ps_parse_mb_data->u4_isI_mb = 1;
  675|       |
  676|  2.88k|                if((25 + u1_mb_threshold) == u1_mb_type)
  ------------------
  |  Branch (676:20): [True: 4, False: 2.87k]
  ------------------
  677|      4|                {
  678|       |                    /* I_PCM_MB */
  679|      4|                    ps_cur_mb_info->ps_curmb->u1_mb_type = I_PCM_MB;
  ------------------
  |  |  423|      4|#define I_PCM_MB    6
  ------------------
  680|      4|                    ret = ih264d_parse_ipcm_mb(ps_dec, ps_cur_mb_info, u1_num_mbs);
  681|      4|                    if(ret != OK) return ret;
  ------------------
  |  |  114|      4|#define OK        0
  ------------------
  |  Branch (681:24): [True: 1, False: 3]
  ------------------
  682|      3|                    ps_cur_deblk_mb->u1_mb_qp = 0;
  683|      3|                }
  684|  2.87k|                else
  685|  2.87k|                {
  686|  2.87k|                    if(u1_mb_type == u1_mb_threshold)
  ------------------
  |  Branch (686:24): [True: 1.92k, False: 957]
  ------------------
  687|  1.92k|                        ps_cur_mb_info->ps_curmb->u1_mb_type = I_4x4_MB;
  ------------------
  |  |  417|  1.92k|#define I_4x4_MB    0
  ------------------
  688|    957|                    else
  689|    957|                        ps_cur_mb_info->ps_curmb->u1_mb_type = I_16x16_MB;
  ------------------
  |  |  418|    957|#define I_16x16_MB  1
  ------------------
  690|       |
  691|  2.87k|                    ret = ih264d_parse_imb_cabac(ps_dec, ps_cur_mb_info,
  692|  2.87k|                                                 (UWORD8) (u1_mb_type - u1_mb_threshold));
  693|  2.87k|                    if(ret != OK) return ret;
  ------------------
  |  |  114|  2.87k|#define OK        0
  ------------------
  |  Branch (693:24): [True: 30, False: 2.84k]
  ------------------
  694|  2.84k|                    ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp;
  695|  2.84k|                }
  696|  2.85k|                ps_cur_deblk_mb->u1_mb_type |= D_INTRA_MB;
  ------------------
  |  |  382|  2.85k|#define D_INTRA_MB        1
  ------------------
  697|  2.85k|            }
  698|  40.6k|        }
  699|       |
  700|  60.2k|        if(ps_dec->u1_enable_mb_info)
  ------------------
  |  Branch (700:12): [True: 0, False: 60.2k]
  ------------------
  701|      0|        {
  702|      0|            ih264d_populate_mb_info_map(ps_dec, ps_cur_mb_info, ps_cur_mb_info->u2_mbx << 1,
  703|      0|                                        ps_cur_mb_info->u2_mby << 1, ps_cur_deblk_mb->u1_mb_qp);
  704|      0|        }
  705|  60.2k|        if(u1_mbaff)
  ------------------
  |  Branch (705:12): [True: 0, False: 60.2k]
  ------------------
  706|      0|        {
  707|      0|            ih264d_update_mbaff_left_nnz(ps_dec, ps_cur_mb_info);
  708|      0|        }
  709|       |
  710|  60.2k|        if(ps_cur_mb_info->u1_topmb && u1_mbaff)
  ------------------
  |  Branch (710:12): [True: 60.2k, False: 0]
  |  Branch (710:40): [True: 0, False: 60.2k]
  ------------------
  711|      0|            uc_more_data_flag = 1;
  712|  60.2k|        else
  713|  60.2k|        {
  714|  60.2k|            uc_more_data_flag = ih264d_decode_terminate(&ps_dec->s_cab_dec_env, ps_bitstrm);
  715|  60.2k|            uc_more_data_flag = !uc_more_data_flag;
  716|  60.2k|            COPYTHECONTEXT("Decode Sliceterm", !uc_more_data_flag);
  717|  60.2k|        }
  718|       |
  719|  60.2k|        if(u1_mbaff)
  ------------------
  |  Branch (719:12): [True: 0, False: 60.2k]
  ------------------
  720|      0|        {
  721|      0|            if(!uc_more_data_flag && (0 == (i2_cur_mb_addr & 1)))
  ------------------
  |  Branch (721:16): [True: 0, False: 0]
  |  Branch (721:38): [True: 0, False: 0]
  ------------------
  722|      0|            {
  723|      0|                return ERROR_EOB_FLUSHBITS_T;
  724|      0|            }
  725|      0|        }
  726|       |        /* Next macroblock information */
  727|  60.2k|        i2_cur_mb_addr++;
  728|  60.2k|        u1_num_mbs++;
  729|  60.2k|        u1_num_mbsNby2++;
  730|  60.2k|        ps_parse_mb_data++;
  731|       |
  732|       |        /****************************************************************/
  733|       |        /* Check for End Of Row and other flags that determine when to  */
  734|       |        /* do DMA setup for N/2-Mb, Decode for N-Mb, and Transfer for   */
  735|       |        /* N-Mb                                                         */
  736|       |        /****************************************************************/
  737|  60.2k|        u1_num_mbs_next = i2_pic_wdin_mbs - ps_dec->u2_mbx - 1;
  738|  60.2k|        u1_end_of_row = (!u1_num_mbs_next) && (!(u1_mbaff && (u1_num_mbs & 0x01)));
  ------------------
  |  Branch (738:25): [True: 15.5k, False: 44.6k]
  |  Branch (738:50): [True: 0, False: 15.5k]
  |  Branch (738:62): [True: 0, False: 0]
  ------------------
  739|  60.2k|        u1_slice_end = !uc_more_data_flag;
  740|  60.2k|        u1_tfr_n_mb = (u1_num_mbs == ps_dec->u4_recon_mb_grp) || u1_end_of_row || u1_slice_end;
  ------------------
  |  Branch (740:23): [True: 15.0k, False: 45.2k]
  |  Branch (740:66): [True: 516, False: 44.6k]
  |  Branch (740:83): [True: 600, False: 44.0k]
  ------------------
  741|  60.2k|        u1_decode_nmb = u1_tfr_n_mb || u1_slice_end;
  ------------------
  |  Branch (741:25): [True: 16.1k, False: 44.0k]
  |  Branch (741:40): [True: 0, False: 44.0k]
  ------------------
  742|  60.2k|        ps_cur_mb_info->u1_end_of_slice = u1_slice_end;
  743|       |
  744|  60.2k|        if(u1_decode_nmb)
  ------------------
  |  Branch (744:12): [True: 16.1k, False: 44.0k]
  ------------------
  745|  16.1k|        {
  746|  16.1k|            ret = ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs);
  747|  16.1k|            u1_num_mbsNby2 = 0;
  748|  16.1k|            {
  749|  16.1k|                ps_parse_mb_data = ps_dec->ps_parse_mb_data;
  750|  16.1k|                ps_dec->ps_part = ps_dec->ps_parse_part_params;
  751|  16.1k|            }
  752|  16.1k|            if(ret != OK) return ret;
  ------------------
  |  |  114|  16.1k|#define OK        0
  ------------------
  |  Branch (752:16): [True: 0, False: 16.1k]
  ------------------
  753|  16.1k|        }
  754|       |
  755|  60.2k|        if(u1_decode_nmb)
  ------------------
  |  Branch (755:12): [True: 16.1k, False: 44.0k]
  ------------------
  756|  16.1k|        {
  757|  16.1k|            if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (757:16): [True: 1.73k, False: 14.4k]
  ------------------
  758|  1.73k|            {
  759|  1.73k|                ih264d_parse_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next, u1_tfr_n_mb,
  760|  1.73k|                                     u1_end_of_row);
  761|  1.73k|                ps_dec->ps_nmb_info += u1_num_mbs;
  762|  1.73k|                ps_svc_lyr_dec->ps_svc_nmb_info += u1_num_mbs;
  763|  1.73k|            }
  764|  14.4k|            else
  765|  14.4k|            {
  766|  14.4k|                if(ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER)
  ------------------
  |  |  110|  14.4k|#define TARGET_LAYER 2
  ------------------
  |  Branch (766:20): [True: 4.38k, False: 10.0k]
  ------------------
  767|  4.38k|                {
  768|  4.38k|                    ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next,
  769|  4.38k|                                                u1_tfr_n_mb, u1_end_of_row);
  770|  4.38k|                }
  771|  10.0k|                else
  772|  10.0k|                {
  773|  10.0k|                    isvcd_decode_recon_tfr_nmb_base_lyr(ps_svc_lyr_dec, u1_mb_idx, u1_num_mbs,
  774|  10.0k|                                                        u1_num_mbs_next, u1_tfr_n_mb,
  775|  10.0k|                                                        u1_end_of_row);
  776|  10.0k|                }
  777|  14.4k|            }
  778|  16.1k|            ps_dec->u4_total_mbs_coded += u1_num_mbs;
  779|  16.1k|            if(u1_tfr_n_mb) u1_num_mbs = 0;
  ------------------
  |  Branch (779:16): [True: 16.1k, False: 0]
  ------------------
  780|  16.1k|            u1_mb_idx = u1_num_mbs;
  781|  16.1k|            ps_dec->u4_mb_idx = u1_num_mbs;
  782|  16.1k|        }
  783|  60.2k|    }
  784|       |
  785|  1.40k|    ps_dec->u4_num_mbs_cur_nmb = 0;
  786|  1.40k|    ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr - (u2_first_mb_in_slice << u1_mbaff);
  787|       |
  788|  1.40k|    return ret;
  789|  1.90k|}
isvcd_parse_inter_slice_data_cavlc:
  820|    781|{
  821|    781|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  822|    781|    UWORD32 uc_more_data_flag;
  823|    781|    WORD32 i2_cur_mb_addr;
  824|    781|    UWORD32 u1_num_mbs, u1_num_mbsNby2, u1_mb_idx;
  825|    781|    UWORD32 i2_mb_skip_run;
  826|    781|    UWORD32 u1_read_mb_type;
  827|       |
  828|    781|    UWORD32 u1_mbaff;
  829|    781|    UWORD32 u1_num_mbs_next, u1_end_of_row;
  830|    781|    const UWORD32 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs;
  831|    781|    UWORD32 u1_slice_end = 0;
  832|    781|    UWORD32 u1_tfr_n_mb = 0;
  833|    781|    UWORD32 u1_decode_nmb = 0;
  834|       |
  835|    781|    dec_bit_stream_t *const ps_bitstrm = ps_dec->ps_bitstrm;
  836|    781|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  837|    781|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  838|    781|    deblk_mb_t *ps_cur_deblk_mb;
  839|    781|    dec_mb_info_t *ps_cur_mb_info;
  840|    781|    parse_pmbarams_t *ps_parse_mb_data = ps_dec->ps_parse_mb_data;
  841|    781|    UWORD32 u1_inter_mb_type;
  842|    781|    UWORD32 u1_deblk_mb_type;
  843|    781|    UWORD32 u1_mb_threshold;
  844|    781|    WORD32 ret = OK;
  ------------------
  |  |  114|    781|#define OK        0
  ------------------
  845|       |
  846|       |    /******************************************************/
  847|       |    /* Initialisations specific to B or P slice           */
  848|       |    /******************************************************/
  849|    781|    if(ps_slice->u1_slice_type == P_SLICE)
  ------------------
  |  |  368|    781|#define P_SLICE  0
  ------------------
  |  Branch (849:8): [True: 691, False: 90]
  ------------------
  850|    691|    {
  851|    691|        u1_inter_mb_type = P_MB;
  ------------------
  |  |  419|    691|#define P_MB        2
  ------------------
  852|    691|        u1_deblk_mb_type = D_INTER_MB;
  ------------------
  |  |  381|    691|#define D_INTER_MB        0
  ------------------
  853|    691|        u1_mb_threshold = 5;
  854|    691|    }
  855|     90|    else  // B_SLICE
  856|     90|    {
  857|     90|        u1_inter_mb_type = B_MB;
  ------------------
  |  |  420|     90|#define B_MB        3
  ------------------
  858|     90|        u1_deblk_mb_type = D_B_SLICE;
  ------------------
  |  |  384|     90|#define D_B_SLICE         4
  ------------------
  859|     90|        u1_mb_threshold = 23;
  860|     90|    }
  861|       |
  862|       |    /******************************************************/
  863|       |    /* Slice Level Initialisations                        */
  864|       |    /******************************************************/
  865|    781|    ps_dec->u1_qp = ps_slice->u1_slice_qp;
  866|    781|    ih264d_update_qp(ps_dec, 0);
  867|    781|    u1_mb_idx = ps_dec->u4_mb_idx;
  868|    781|    u1_num_mbs = u1_mb_idx;
  869|       |
  870|    781|    u1_num_mbsNby2 = 0;
  871|    781|    u1_mbaff = ps_slice->u1_mbaff_frame_flag;
  872|    781|    i2_cur_mb_addr = u2_first_mb_in_slice << u1_mbaff;
  873|    781|    i2_mb_skip_run = 0;
  874|    781|    uc_more_data_flag = 1;
  875|    781|    u1_read_mb_type = 0;
  876|       |
  877|  38.8k|    while(!u1_slice_end)
  ------------------
  |  Branch (877:11): [True: 38.7k, False: 149]
  ------------------
  878|  38.7k|    {
  879|  38.7k|        UWORD8 u1_mb_type;
  880|       |
  881|  38.7k|        ps_dec->pv_prev_mb_parse_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
  882|  38.7k|        if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u4_max_mb_addr)
  ------------------
  |  Branch (882:12): [True: 320, False: 38.4k]
  ------------------
  883|    320|        {
  884|    320|            break;
  885|    320|        }
  886|       |
  887|  38.4k|        ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs;
  888|  38.4k|        ps_dec->u4_num_mbs_cur_nmb = u1_num_mbs;
  889|  38.4k|        ps_cur_mb_info->u1_Mux = 0;
  890|  38.4k|        ps_dec->u4_num_pmbair = (u1_num_mbs >> u1_mbaff);
  891|  38.4k|        ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u1_num_mbs;
  892|       |
  893|  38.4k|        ps_cur_mb_info->u1_end_of_slice = 0;
  894|       |
  895|       |        /* Storing Default partition info */
  896|  38.4k|        ps_parse_mb_data->u1_num_part = 1;
  897|  38.4k|        ps_parse_mb_data->u4_isI_mb = 0;
  898|       |
  899|  38.4k|        if((!i2_mb_skip_run) && (!u1_read_mb_type))
  ------------------
  |  Branch (899:12): [True: 7.48k, False: 30.9k]
  |  Branch (899:33): [True: 5.01k, False: 2.47k]
  ------------------
  900|  5.01k|        {
  901|       |            // Inlined ih264d_uev
  902|  5.01k|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  903|  5.01k|            UWORD32 u4_word, u4_ldz;
  904|       |
  905|       |            /***************************************************************/
  906|       |            /* Find leading zeros in next 32 bits                          */
  907|       |            /***************************************************************/
  908|  5.01k|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|  5.01k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|  5.01k|{                                                                           \
  |  |  152|  5.01k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|  5.01k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|  5.01k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|  5.01k|                                                                            \
  |  |  156|  5.01k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|  5.01k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 4.64k, False: 372]
  |  |  ------------------
  |  |  158|  5.01k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|  4.64k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|  5.01k|}
  ------------------
  909|       |
  910|  5.01k|            u4_ldz = CLZ(u4_word);
  911|       |
  912|       |            /* Flush the ps_bitstrm */
  913|  5.01k|            u4_bitstream_offset += (u4_ldz + 1);
  914|       |            /* Read the suffix from the ps_bitstrm */
  915|  5.01k|            u4_word = 0;
  916|  5.01k|            if(u4_ldz)
  ------------------
  |  Branch (916:16): [True: 2.79k, False: 2.21k]
  ------------------
  917|  2.79k|            {
  918|  2.79k|                GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|  2.79k|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|  2.79k|{                                                                           \
  |  |  122|  2.79k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|  2.79k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|  2.79k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|  2.79k|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|  2.79k|                                                                            \
  |  |  127|  2.79k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 2.67k, False: 120]
  |  |  ------------------
  |  |  128|  2.79k|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  2.67k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|  2.79k|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  2.79k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|  2.79k|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|  2.79k|}                                                                           \
  ------------------
  919|  2.79k|            }
  920|  5.01k|            *pu4_bitstrm_ofst = u4_bitstream_offset;
  921|  5.01k|            i2_mb_skip_run = ((1 << u4_ldz) + u4_word - 1);
  922|       |            // Inlined ih264d_uev
  923|  5.01k|            COPYTHECONTEXT("mb_skip_run", i2_mb_skip_run);
  924|  5.01k|            uc_more_data_flag = MORE_RBSP_DATA(ps_bitstrm);
  ------------------
  |  |   97|  5.01k|    CHECK_BITS_SUFFICIENT(ps_bitstrm, 1)
  |  |  ------------------
  |  |  |  |   95|  5.01k|  (ps_bitstrm->u4_ofst + bits_to_read <= ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  ------------------
  925|  5.01k|            u1_read_mb_type = uc_more_data_flag;
  926|  5.01k|        }
  927|       |
  928|       |        /***************************************************************/
  929|       |        /* Get the required information for decoding of MB            */
  930|       |        /* mb_x, mb_y , neighbour availablity,                              */
  931|       |        /***************************************************************/
  932|  38.4k|        ps_dec->pf_get_mb_info(ps_dec, i2_cur_mb_addr, ps_cur_mb_info, i2_mb_skip_run);
  933|       |
  934|       |        /***************************************************************/
  935|       |        /* Set the deblocking parameters for this MB */
  936|       |        /***************************************************************/
  937|  38.4k|        if(ps_dec->u4_app_disable_deblk_frm == 0)
  ------------------
  |  Branch (937:12): [True: 38.4k, False: 0]
  ------------------
  938|  38.4k|            ih264d_set_deblocking_parameters(ps_cur_deblk_mb, ps_slice,
  939|  38.4k|                                             ps_dec->u1_mb_ngbr_availablity,
  940|  38.4k|                                             ps_dec->u1_cur_mb_fld_dec_flag);
  941|       |
  942|  38.4k|        if(i2_mb_skip_run)
  ------------------
  |  Branch (942:12): [True: 33.7k, False: 4.68k]
  ------------------
  943|  33.7k|        {
  944|       |            /* Set appropriate flags in ps_cur_mb_info and ps_dec */
  945|  33.7k|            ps_dec->i1_prev_mb_qp_delta = 0;
  946|  33.7k|            ps_dec->u1_sub_mb_num = 0;
  947|  33.7k|            ps_cur_mb_info->u1_mb_type = MB_SKIP;
  ------------------
  |  |   59|  33.7k|#define MB_SKIP 255
  ------------------
  948|  33.7k|            ps_cur_mb_info->u1_mb_mc_mode = PRED_16x16;
  ------------------
  |  |  450|  33.7k|#define PRED_16x16  0
  ------------------
  949|  33.7k|            ps_cur_mb_info->u1_cbp = 0;
  950|       |
  951|  33.7k|            {
  952|       |                /* Storing Skip partition info */
  953|  33.7k|                parse_part_params_t *ps_part_info = ps_dec->ps_part;
  954|  33.7k|                ps_part_info->u1_is_direct = PART_DIRECT_16x16;
  ------------------
  |  |  571|  33.7k|#define PART_DIRECT_16x16              2
  ------------------
  955|  33.7k|                ps_part_info->u1_sub_mb_num = 0;
  956|  33.7k|                ps_dec->ps_part++;
  957|  33.7k|            }
  958|       |
  959|       |            /* Update Nnzs */
  960|  33.7k|            ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CAVLC);
  ------------------
  |  |  338|  33.7k|#define CAVLC  0
  ------------------
  961|       |
  962|  33.7k|            ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type;
  963|  33.7k|            ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type;
  964|       |
  965|  33.7k|            if(ps_svc_lyr_dec->u1_layer_identifier != TARGET_LAYER)
  ------------------
  |  |  110|  33.7k|#define TARGET_LAYER 2
  ------------------
  |  Branch (965:16): [True: 6.27k, False: 27.4k]
  ------------------
  966|  6.27k|            {
  967|  6.27k|                ps_cur_deblk_mb->u1_deblocking_mode = MB_DISABLE_FILTERING;
  ------------------
  |  |   70|  6.27k|#define MB_DISABLE_FILTERING          0x01
  ------------------
  968|  6.27k|            }
  969|       |
  970|  33.7k|            i2_mb_skip_run--;
  971|  33.7k|        }
  972|  4.68k|        else
  973|  4.68k|        {
  974|  4.68k|            u1_read_mb_type = 0;
  975|       |            /**************************************************************/
  976|       |            /* Macroblock Layer Begins, Decode the u1_mb_type                */
  977|       |            /**************************************************************/
  978|  4.68k|            {
  979|  4.68k|                UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
  980|  4.68k|                UWORD32 u4_word, u4_ldz, u4_temp;
  981|       |
  982|       |                // Inlined ih264d_uev
  983|       |                /***************************************************************/
  984|       |                /* Find leading zeros in next 32 bits                          */
  985|       |                /***************************************************************/
  986|  4.68k|                NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|  4.68k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|  4.68k|{                                                                           \
  |  |  152|  4.68k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|  4.68k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|  4.68k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|  4.68k|                                                                            \
  |  |  156|  4.68k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|  4.68k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 4.60k, False: 84]
  |  |  ------------------
  |  |  158|  4.68k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|  4.60k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|  4.68k|}
  ------------------
  987|  4.68k|                u4_ldz = CLZ(u4_word);
  988|       |                /* Flush the ps_bitstrm */
  989|  4.68k|                u4_bitstream_offset += (u4_ldz + 1);
  990|       |                /* Read the suffix from the ps_bitstrm */
  991|  4.68k|                u4_word = 0;
  992|  4.68k|                if(u4_ldz) GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|  3.05k|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|  3.05k|{                                                                           \
  |  |  122|  3.05k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|  3.05k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|  3.05k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|  3.05k|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|  3.05k|                                                                            \
  |  |  127|  3.05k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 2.86k, False: 193]
  |  |  ------------------
  |  |  128|  3.05k|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  2.86k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|  3.05k|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  3.05k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|  3.05k|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|  3.05k|}                                                                           \
  ------------------
  |  Branch (992:20): [True: 3.05k, False: 1.63k]
  ------------------
  993|  4.68k|                *pu4_bitstrm_ofst = u4_bitstream_offset;
  994|  4.68k|                u4_temp = ((1 << u4_ldz) + u4_word - 1);
  995|       |                // Inlined ih264d_uev
  996|  4.68k|                if(u4_temp > (UWORD32) (25 + u1_mb_threshold)) return ERROR_MB_TYPE;
  ------------------
  |  Branch (996:20): [True: 13, False: 4.67k]
  ------------------
  997|  4.67k|                u1_mb_type = u4_temp;
  998|  4.67k|                COPYTHECONTEXT("u1_mb_type", u1_mb_type);
  999|  4.67k|            }
 1000|      0|            ps_cur_mb_info->u1_mb_type = u1_mb_type;
 1001|       |
 1002|       |            /**************************************************************/
 1003|       |            /* Parse Macroblock data                                      */
 1004|       |            /**************************************************************/
 1005|  4.67k|            if(u1_mb_type < u1_mb_threshold)
  ------------------
  |  Branch (1005:16): [True: 4.20k, False: 472]
  ------------------
 1006|  4.20k|            {
 1007|  4.20k|                ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type;
 1008|       |
 1009|  4.20k|                ret = ps_dec->pf_parse_inter_mb(ps_dec, ps_cur_mb_info, u1_num_mbs, u1_num_mbsNby2);
 1010|  4.20k|                if(ret != OK) return ret;
  ------------------
  |  |  114|  4.20k|#define OK        0
  ------------------
  |  Branch (1010:20): [True: 169, False: 4.03k]
  ------------------
 1011|  4.03k|                ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type;
 1012|       |
 1013|  4.03k|                if(ps_svc_lyr_dec->u1_layer_identifier != TARGET_LAYER)
  ------------------
  |  |  110|  4.03k|#define TARGET_LAYER 2
  ------------------
  |  Branch (1013:20): [True: 407, False: 3.62k]
  ------------------
 1014|    407|                {
 1015|    407|                    ps_cur_deblk_mb->u1_deblocking_mode = MB_DISABLE_FILTERING;
  ------------------
  |  |   70|    407|#define MB_DISABLE_FILTERING          0x01
  ------------------
 1016|    407|                }
 1017|  4.03k|            }
 1018|    472|            else
 1019|    472|            {
 1020|       |                /* Storing Intra partition info */
 1021|    472|                ps_parse_mb_data->u1_num_part = 0;
 1022|    472|                ps_parse_mb_data->u4_isI_mb = 1;
 1023|       |
 1024|    472|                if((25 + u1_mb_threshold) == u1_mb_type)
  ------------------
  |  Branch (1024:20): [True: 2, False: 470]
  ------------------
 1025|      2|                {
 1026|       |                    /* I_PCM_MB */
 1027|      2|                    ps_cur_mb_info->ps_curmb->u1_mb_type = I_PCM_MB;
  ------------------
  |  |  423|      2|#define I_PCM_MB    6
  ------------------
 1028|      2|                    ret = ih264d_parse_ipcm_mb(ps_dec, ps_cur_mb_info, u1_num_mbs);
 1029|      2|                    if(ret != OK) return ret;
  ------------------
  |  |  114|      2|#define OK        0
  ------------------
  |  Branch (1029:24): [True: 0, False: 2]
  ------------------
 1030|      2|                    ps_dec->u1_qp = 0;
 1031|      2|                }
 1032|    470|                else
 1033|    470|                {
 1034|    470|                    ret = ih264d_parse_imb_cavlc(ps_dec, ps_cur_mb_info, u1_num_mbs,
 1035|    470|                                                 (UWORD8) (u1_mb_type - u1_mb_threshold));
 1036|    470|                    if(ret != OK) return ret;
  ------------------
  |  |  114|    470|#define OK        0
  ------------------
  |  Branch (1036:24): [True: 130, False: 340]
  ------------------
 1037|    470|                }
 1038|       |
 1039|    342|                ps_cur_deblk_mb->u1_mb_type |= D_INTRA_MB;
  ------------------
  |  |  382|    342|#define D_INTRA_MB        1
  ------------------
 1040|    342|            }
 1041|  4.37k|            uc_more_data_flag = MORE_RBSP_DATA(ps_bitstrm);
  ------------------
  |  |   97|  4.37k|    CHECK_BITS_SUFFICIENT(ps_bitstrm, 1)
  |  |  ------------------
  |  |  |  |   95|  4.37k|  (ps_bitstrm->u4_ofst + bits_to_read <= ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  ------------------
 1042|  4.37k|        }
 1043|  38.1k|        ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp;
 1044|       |
 1045|  38.1k|        if(ps_dec->u1_enable_mb_info)
  ------------------
  |  Branch (1045:12): [True: 0, False: 38.1k]
  ------------------
 1046|      0|        {
 1047|      0|            ih264d_populate_mb_info_map(ps_dec, ps_cur_mb_info, ps_cur_mb_info->u2_mbx << 1,
 1048|      0|                                        ps_cur_mb_info->u2_mby << 1, ps_cur_deblk_mb->u1_mb_qp);
 1049|      0|        }
 1050|  38.1k|        if(u1_mbaff)
  ------------------
  |  Branch (1050:12): [True: 0, False: 38.1k]
  ------------------
 1051|      0|        {
 1052|      0|            ih264d_update_mbaff_left_nnz(ps_dec, ps_cur_mb_info);
 1053|      0|            if(!uc_more_data_flag && !i2_mb_skip_run && (0 == (i2_cur_mb_addr & 1)))
  ------------------
  |  Branch (1053:16): [True: 0, False: 0]
  |  Branch (1053:38): [True: 0, False: 0]
  |  Branch (1053:57): [True: 0, False: 0]
  ------------------
 1054|      0|            {
 1055|      0|                return ERROR_EOB_FLUSHBITS_T;
 1056|      0|            }
 1057|      0|        }
 1058|       |
 1059|       |        /**************************************************************/
 1060|       |        /* Get next Macroblock address                                */
 1061|       |        /**************************************************************/
 1062|  38.1k|        i2_cur_mb_addr++;
 1063|       |
 1064|  38.1k|        u1_num_mbs++;
 1065|  38.1k|        u1_num_mbsNby2++;
 1066|  38.1k|        ps_parse_mb_data++;
 1067|       |
 1068|       |        /****************************************************************/
 1069|       |        /* Check for End Of Row and other flags that determine when to  */
 1070|       |        /* do DMA setup for N/2-Mb, Decode for N-Mb, and Transfer for   */
 1071|       |        /* N-Mb                                                         */
 1072|       |        /****************************************************************/
 1073|  38.1k|        u1_num_mbs_next = i2_pic_wdin_mbs - ps_dec->u2_mbx - 1;
 1074|  38.1k|        u1_end_of_row = (!u1_num_mbs_next) && (!(u1_mbaff && (u1_num_mbs & 0x01)));
  ------------------
  |  Branch (1074:25): [True: 5.38k, False: 32.7k]
  |  Branch (1074:50): [True: 0, False: 5.38k]
  |  Branch (1074:62): [True: 0, False: 0]
  ------------------
 1075|  38.1k|        u1_slice_end = (!(uc_more_data_flag || i2_mb_skip_run));
  ------------------
  |  Branch (1075:27): [True: 18.5k, False: 19.5k]
  |  Branch (1075:48): [True: 19.3k, False: 149]
  ------------------
 1076|  38.1k|        u1_tfr_n_mb = (u1_num_mbs == ps_dec->u4_recon_mb_grp) || u1_end_of_row || u1_slice_end;
  ------------------
  |  Branch (1076:23): [True: 5.38k, False: 32.7k]
  |  Branch (1076:66): [True: 0, False: 32.7k]
  |  Branch (1076:83): [True: 133, False: 32.6k]
  ------------------
 1077|  38.1k|        u1_decode_nmb = u1_tfr_n_mb || u1_slice_end;
  ------------------
  |  Branch (1077:25): [True: 5.51k, False: 32.6k]
  |  Branch (1077:40): [True: 0, False: 32.6k]
  ------------------
 1078|  38.1k|        ps_cur_mb_info->u1_end_of_slice = u1_slice_end;
 1079|       |
 1080|  38.1k|        if(u1_decode_nmb)
  ------------------
  |  Branch (1080:12): [True: 5.51k, False: 32.6k]
  ------------------
 1081|  5.51k|        {
 1082|  5.51k|            ret = ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs);
 1083|  5.51k|            u1_num_mbsNby2 = 0;
 1084|  5.51k|            ps_parse_mb_data = ps_dec->ps_parse_mb_data;
 1085|  5.51k|            ps_dec->ps_part = ps_dec->ps_parse_part_params;
 1086|  5.51k|            if(ret != OK) return ret;
  ------------------
  |  |  114|  5.51k|#define OK        0
  ------------------
  |  Branch (1086:16): [True: 0, False: 5.51k]
  ------------------
 1087|  5.51k|        }
 1088|       |
 1089|  38.1k|        if(u1_decode_nmb)
  ------------------
  |  Branch (1089:12): [True: 5.51k, False: 32.6k]
  ------------------
 1090|  5.51k|        {
 1091|  5.51k|            if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (1091:16): [True: 491, False: 5.02k]
  ------------------
 1092|    491|            {
 1093|    491|                ih264d_parse_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next, u1_tfr_n_mb,
 1094|    491|                                     u1_end_of_row);
 1095|    491|                ps_dec->ps_nmb_info += u1_num_mbs;
 1096|    491|                ps_svc_lyr_dec->ps_svc_nmb_info += u1_num_mbs;
 1097|    491|            }
 1098|  5.02k|            else
 1099|  5.02k|            {
 1100|  5.02k|                if(ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER)
  ------------------
  |  |  110|  5.02k|#define TARGET_LAYER 2
  ------------------
  |  Branch (1100:20): [True: 1.55k, False: 3.47k]
  ------------------
 1101|  1.55k|                {
 1102|  1.55k|                    ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next,
 1103|  1.55k|                                                u1_tfr_n_mb, u1_end_of_row);
 1104|  1.55k|                }
 1105|  3.47k|                else
 1106|  3.47k|                {
 1107|  3.47k|                    isvcd_decode_recon_tfr_nmb_base_lyr(ps_svc_lyr_dec, u1_mb_idx, u1_num_mbs,
 1108|  3.47k|                                                        u1_num_mbs_next, u1_tfr_n_mb,
 1109|  3.47k|                                                        u1_end_of_row);
 1110|  3.47k|                }
 1111|  5.02k|            }
 1112|  5.51k|            ps_dec->u4_total_mbs_coded += u1_num_mbs;
 1113|  5.51k|            if(u1_tfr_n_mb) u1_num_mbs = 0;
  ------------------
  |  Branch (1113:16): [True: 5.51k, False: 0]
  ------------------
 1114|  5.51k|            u1_mb_idx = u1_num_mbs;
 1115|  5.51k|            ps_dec->u4_mb_idx = u1_num_mbs;
 1116|  5.51k|        }
 1117|  38.1k|    }
 1118|       |
 1119|    469|    ps_dec->u4_num_mbs_cur_nmb = 0;
 1120|    469|    ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr - (u2_first_mb_in_slice << u1_mbaff);
 1121|       |
 1122|    469|    return ret;
 1123|    781|}
isvcd_parse_inter_slice_data_cabac_enh_lyr:
 1154|    609|{
 1155|    609|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1156|    609|    UWORD32 uc_more_data_flag;
 1157|    609|    WORD32 i2_cur_mb_addr;
 1158|    609|    UWORD32 u1_num_mbs, u1_num_mbsNby2, u1_mb_idx;
 1159|    609|    UWORD32 u1_mbaff;
 1160|    609|    UWORD32 u1_num_mbs_next, u1_end_of_row;
 1161|    609|    const UWORD16 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs;
 1162|    609|    UWORD32 u1_slice_end = 0;
 1163|    609|    UWORD32 u1_tfr_n_mb = 0;
 1164|    609|    UWORD32 u1_decode_nmb = 0;
 1165|       |
 1166|    609|    dec_slice_svc_ext_params_t *ps_svc_slice_params = NULL;
 1167|    609|    deblk_mb_t *ps_cur_deblk_mb;
 1168|    609|    dec_mb_info_t *ps_cur_mb_info;
 1169|    609|    dec_svc_mb_info_t *ps_svc_cur_mb_info;
 1170|       |
 1171|    609|    parse_pmbarams_t *ps_parse_mb_data = ps_dec->ps_parse_mb_data;
 1172|    609|    UWORD32 u1_inter_mb_skip_type;
 1173|    609|    UWORD32 u1_inter_mb_type;
 1174|    609|    UWORD32 u1_deblk_mb_type;
 1175|    609|    UWORD32 u1_mb_threshold;
 1176|    609|    dec_bit_stream_t *const ps_bitstrm = ps_dec->ps_bitstrm;
 1177|    609|    decoding_envirnoment_t *ps_cab_env = NULL;
 1178|    609|    WORD32 ret = OK;
  ------------------
  |  |  114|    609|#define OK        0
  ------------------
 1179|       |
 1180|    609|    ps_svc_slice_params = &ps_svc_lyr_dec->s_svc_slice_params;
 1181|       |
 1182|       |    /******************************************************/
 1183|       |    /* Initialisations specific to B or P slice           */
 1184|       |    /******************************************************/
 1185|    609|    if(ps_slice->u1_slice_type == P_SLICE)
  ------------------
  |  |  368|    609|#define P_SLICE  0
  ------------------
  |  Branch (1185:8): [True: 549, False: 60]
  ------------------
 1186|    549|    {
 1187|    549|        u1_inter_mb_skip_type = CAB_P_SKIP;
  ------------------
  |  |  403|    549|#define CAB_P_SKIP        0x16 /* 0001 x11x */
  ------------------
 1188|    549|        u1_inter_mb_type = P_MB;
  ------------------
  |  |  419|    549|#define P_MB        2
  ------------------
 1189|    549|        u1_deblk_mb_type = D_INTER_MB;
  ------------------
  |  |  381|    549|#define D_INTER_MB        0
  ------------------
 1190|    549|        u1_mb_threshold = 5;
 1191|    549|    }
 1192|     60|    else  // EB_SLICE
 1193|     60|    {
 1194|     60|        u1_inter_mb_skip_type = CAB_B_SKIP;
  ------------------
  |  |  404|     60|#define CAB_B_SKIP        0x14 /* 0001 x100 */
  ------------------
 1195|     60|        u1_inter_mb_type = B_MB;
  ------------------
  |  |  420|     60|#define B_MB        3
  ------------------
 1196|     60|        u1_deblk_mb_type = D_B_SLICE;
  ------------------
  |  |  384|     60|#define D_B_SLICE         4
  ------------------
 1197|     60|        u1_mb_threshold = 23;
 1198|     60|    }
 1199|       |
 1200|       |    /******************************************************/
 1201|       |    /* Slice Level Initialisations                        */
 1202|       |    /******************************************************/
 1203|    609|    i2_cur_mb_addr = u2_first_mb_in_slice;
 1204|    609|    ps_dec->u1_qp = ps_slice->u1_slice_qp;
 1205|    609|    ih264d_update_qp(ps_dec, 0);
 1206|    609|    u1_mb_idx = ps_dec->u4_mb_idx;
 1207|    609|    u1_num_mbs = u1_mb_idx;
 1208|    609|    u1_num_mbsNby2 = 0;
 1209|    609|    u1_mbaff = ps_slice->u1_mbaff_frame_flag;
 1210|    609|    i2_cur_mb_addr = u2_first_mb_in_slice << u1_mbaff;
 1211|    609|    uc_more_data_flag = 1;
 1212|       |
 1213|       |    /* Initialisations specific to cabac */
 1214|    609|    if(ps_bitstrm->u4_ofst & 0x07)
  ------------------
  |  Branch (1214:8): [True: 571, False: 38]
  ------------------
 1215|    571|    {
 1216|    571|        ps_bitstrm->u4_ofst += 8;
 1217|    571|        ps_bitstrm->u4_ofst &= 0xFFFFFFF8;
 1218|    571|    }
 1219|       |
 1220|    609|    ret = ih264d_init_cabac_dec_envirnoment(&(ps_dec->s_cab_dec_env), ps_bitstrm);
 1221|    609|    if(ret != OK) return ret;
  ------------------
  |  |  114|    609|#define OK        0
  ------------------
  |  Branch (1221:8): [True: 0, False: 609]
  ------------------
 1222|       |
 1223|    609|    ps_cab_env = &ps_dec->s_cab_dec_env;
 1224|    609|    ps_dec->i1_prev_mb_qp_delta = 0;
 1225|       |
 1226|  21.3k|    while(!u1_slice_end)
  ------------------
  |  Branch (1226:11): [True: 21.3k, False: 29]
  ------------------
 1227|  21.3k|    {
 1228|  21.3k|        UWORD8 u1_mb_type;
 1229|  21.3k|        UWORD32 u4_mb_skip;
 1230|  21.3k|        ps_dec->pv_prev_mb_parse_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
 1231|  21.3k|        if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u4_max_mb_addr)
  ------------------
  |  Branch (1231:12): [True: 329, False: 20.9k]
  ------------------
 1232|    329|        {
 1233|    329|            break;
 1234|    329|        }
 1235|       |
 1236|  20.9k|        ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs;
 1237|  20.9k|        ps_svc_cur_mb_info = ps_svc_lyr_dec->ps_svc_nmb_info + u1_num_mbs;
 1238|  20.9k|        ps_dec->u4_num_mbs_cur_nmb = u1_num_mbs;
 1239|  20.9k|        ps_cur_mb_info->u1_Mux = 0;
 1240|  20.9k|        ps_dec->u4_num_pmbair = (u1_num_mbs >> u1_mbaff);
 1241|  20.9k|        ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u1_num_mbs;
 1242|  20.9k|        ps_cur_mb_info->u1_end_of_slice = 0;
 1243|       |
 1244|       |        /* Storing Default partition info */
 1245|  20.9k|        ps_parse_mb_data->u1_num_part = 1;
 1246|  20.9k|        ps_parse_mb_data->u4_isI_mb = 0;
 1247|       |
 1248|       |        /***************************************************************/
 1249|       |        /* Get the required information for decoding of MB             */
 1250|       |        /* mb_x, mb_y , neighbour availablity,                         */
 1251|       |        /***************************************************************/
 1252|  20.9k|        u4_mb_skip = ps_dec->pf_get_mb_info(ps_dec, i2_cur_mb_addr, ps_cur_mb_info, 1);
 1253|  20.9k|        ps_svc_cur_mb_info->u1_crop_window_flag =
 1254|  20.9k|            *(ps_svc_lyr_dec->pu1_crop_wnd_flag + ps_cur_mb_info->u2_mbx +
 1255|  20.9k|              (ps_cur_mb_info->u2_mby * ps_dec->u2_frm_wd_in_mbs));
 1256|       |        /*********************************************************************/
 1257|       |        /* initialize u1_tran_form8x8 to zero to aviod uninitialized accesses */
 1258|       |        /*********************************************************************/
 1259|  20.9k|        ps_cur_mb_info->u1_tran_form8x8 = 0;
 1260|  20.9k|        ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
 1261|       |
 1262|       |        /***************************************************************/
 1263|       |        /* Set the deblocking parameters for this MB                   */
 1264|       |        /***************************************************************/
 1265|  20.9k|        if(ps_dec->u4_app_disable_deblk_frm == 0)
  ------------------
  |  Branch (1265:12): [True: 20.9k, False: 0]
  ------------------
 1266|  20.9k|            ih264d_set_deblocking_parameters(ps_cur_deblk_mb, ps_slice,
 1267|  20.9k|                                             ps_dec->u1_mb_ngbr_availablity,
 1268|  20.9k|                                             ps_dec->u1_cur_mb_fld_dec_flag);
 1269|       |
 1270|  20.9k|        if(u4_mb_skip)
  ------------------
  |  Branch (1270:12): [True: 766, False: 20.2k]
  ------------------
 1271|    766|        {
 1272|       |            /* Set appropriate flags in ps_cur_mb_info and ps_dec */
 1273|    766|            memset(ps_dec->ps_curr_ctxt_mb_info, 0, sizeof(ctxt_inc_mb_info_t));
 1274|    766|            ps_dec->ps_curr_ctxt_mb_info->u1_mb_type = u1_inter_mb_skip_type;
 1275|       |
 1276|    766|            MEMSET_16BYTES(&ps_dec->pu1_left_mv_ctxt_inc[0][0], 0);
  ------------------
  |  |  652|    766|#define MEMSET_16BYTES(pu4_start,value)                         \
  |  |  653|    766|{                                                               \
  |  |  654|    766|    memset(pu4_start,value,16);                                 \
  |  |  655|    766|}
  ------------------
 1277|       |
 1278|    766|            *((UWORD32 *) ps_dec->pi1_left_ref_idx_ctxt_inc) = 0;
 1279|    766|            *(ps_dec->pu1_left_yuv_dc_csbp) = 0;
 1280|       |
 1281|    766|            ps_dec->i1_prev_mb_qp_delta = 0;
 1282|    766|            ps_cur_mb_info->u1_mb_type = MB_SKIP;
  ------------------
  |  |   59|    766|#define MB_SKIP 255
  ------------------
 1283|    766|            ps_cur_mb_info->u1_cbp = 0;
 1284|    766|            ps_svc_cur_mb_info->u1_base_mode_flag = 0;
 1285|    766|            ps_svc_cur_mb_info->au1_motion_pred_flag[0] = 0;
 1286|    766|            ps_svc_cur_mb_info->au1_motion_pred_flag[1] = 0;
 1287|    766|            ps_svc_cur_mb_info->u1_residual_prediction_flag = 0;
 1288|       |
 1289|    766|            {
 1290|       |                /* Storing Skip partition info */
 1291|    766|                parse_part_params_t *ps_part_info = ps_dec->ps_part;
 1292|    766|                ps_part_info->u1_is_direct = PART_DIRECT_16x16;
  ------------------
  |  |  571|    766|#define PART_DIRECT_16x16              2
  ------------------
 1293|    766|                ps_part_info->u1_sub_mb_num = 0;
 1294|    766|                ps_dec->ps_part++;
 1295|    766|            }
 1296|       |
 1297|       |            /* Update Nnzs */
 1298|    766|            ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CABAC);
  ------------------
  |  |  339|    766|#define CABAC  1
  ------------------
 1299|    766|            ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type;
 1300|    766|            ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type;
 1301|    766|            ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp;
 1302|    766|            if(ps_svc_lyr_dec->u1_layer_identifier != TARGET_LAYER)
  ------------------
  |  |  110|    766|#define TARGET_LAYER 2
  ------------------
  |  Branch (1302:16): [True: 0, False: 766]
  ------------------
 1303|      0|            {
 1304|      0|                ps_cur_deblk_mb->u1_deblocking_mode = MB_DISABLE_FILTERING;
  ------------------
  |  |   70|      0|#define MB_DISABLE_FILTERING          0x01
  ------------------
 1305|      0|            }
 1306|    766|        }
 1307|  20.2k|        else
 1308|  20.2k|        {
 1309|       |            /* Variables for handling Cabac contexts */
 1310|  20.2k|            UWORD8 *pu1_cur_svc_base_mode_flag;
 1311|  20.2k|            UWORD8 u1_left_svc_base_mode_flag;
 1312|  20.2k|            UWORD8 u1_top_svc_base_mode_flag;
 1313|       |
 1314|  20.2k|            UWORD32 u4_a, u4_b, u4_ctxt_inc;
 1315|  20.2k|            ps_svc_cur_mb_info->u1_base_mode_flag = 0;
 1316|       |            /* Macroblock Layer Begins */
 1317|  20.2k|            if(ps_svc_cur_mb_info->u1_crop_window_flag &&
  ------------------
  |  Branch (1317:16): [True: 20.2k, False: 0]
  ------------------
 1318|  20.2k|               ps_svc_slice_params->u1_adaptive_base_mode_flag)
  ------------------
  |  Branch (1318:16): [True: 17.0k, False: 3.14k]
  ------------------
 1319|  17.0k|            {
 1320|  17.0k|                pu1_cur_svc_base_mode_flag =
 1321|  17.0k|                    ps_svc_lyr_dec->pu1_svc_base_mode_flag + ps_cur_mb_info->u2_mbx;
 1322|  17.0k|                pu1_cur_svc_base_mode_flag +=
 1323|  17.0k|                    ps_cur_mb_info->u2_mby * ps_svc_lyr_dec->i4_frm_svc_base_mode_cabac_stride;
 1324|       |
 1325|  17.0k|                u1_left_svc_base_mode_flag = 0;
 1326|  17.0k|                if(ps_dec->u1_mb_ngbr_availablity & LEFT_MB_AVAILABLE_MASK)
  ------------------
  |  |   53|  17.0k|#define LEFT_MB_AVAILABLE_MASK      0x01
  ------------------
  |  Branch (1326:20): [True: 12.9k, False: 4.17k]
  ------------------
 1327|  12.9k|                    u1_left_svc_base_mode_flag = *(pu1_cur_svc_base_mode_flag - 1);
 1328|       |
 1329|  17.0k|                u1_top_svc_base_mode_flag = 0;
 1330|  17.0k|                if(ps_dec->u1_mb_ngbr_availablity & TOP_MB_AVAILABLE_MASK)
  ------------------
  |  |   55|  17.0k|#define TOP_MB_AVAILABLE_MASK       0x04
  ------------------
  |  Branch (1330:20): [True: 15.4k, False: 1.66k]
  ------------------
 1331|  15.4k|                    u1_top_svc_base_mode_flag =
 1332|  15.4k|                        *(pu1_cur_svc_base_mode_flag -
 1333|  15.4k|                          ps_svc_lyr_dec->i4_frm_svc_base_mode_cabac_stride);
 1334|       |
 1335|  17.0k|                u4_a = 1;
 1336|  17.0k|                u4_b = 1;
 1337|       |
 1338|  17.0k|                if(u1_top_svc_base_mode_flag)
  ------------------
  |  Branch (1338:20): [True: 2.33k, False: 14.7k]
  ------------------
 1339|  2.33k|                {
 1340|  2.33k|                    u4_a = 0;
 1341|  2.33k|                }
 1342|       |
 1343|  17.0k|                if(u1_left_svc_base_mode_flag)
  ------------------
  |  Branch (1343:20): [True: 1.80k, False: 15.2k]
  ------------------
 1344|  1.80k|                {
 1345|  1.80k|                    u4_b = 0;
 1346|  1.80k|                }
 1347|       |
 1348|  17.0k|                u4_ctxt_inc = u4_a + u4_b;
 1349|  17.0k|                ps_svc_cur_mb_info->u1_base_mode_flag = ih264d_decode_bin(
 1350|  17.0k|                    u4_ctxt_inc, ps_svc_lyr_dec->ps_base_mode_flag, ps_bitstrm, ps_cab_env);
 1351|  17.0k|                COPYTHECONTEXT("SVC ext: u1_base_mode_flag", ps_svc_cur_mb_info->u1_base_mode_flag);
 1352|  17.0k|                *pu1_cur_svc_base_mode_flag = ps_svc_cur_mb_info->u1_base_mode_flag;
 1353|  17.0k|            }
 1354|  3.14k|            else if(ps_svc_cur_mb_info->u1_crop_window_flag)
  ------------------
  |  Branch (1354:21): [True: 3.14k, False: 0]
  ------------------
 1355|  3.14k|            {
 1356|  3.14k|                ps_svc_cur_mb_info->u1_base_mode_flag =
 1357|  3.14k|                    ps_svc_slice_params->u1_default_base_mode_flag;
 1358|  3.14k|            }
 1359|       |
 1360|  20.2k|            if(!ps_svc_cur_mb_info->u1_base_mode_flag)
  ------------------
  |  Branch (1360:16): [True: 16.7k, False: 3.49k]
  ------------------
 1361|  16.7k|            {
 1362|       |                /* Decode the u1_mb_type */
 1363|  16.7k|                u1_mb_type = ih264d_parse_mb_type_cabac(ps_dec);
 1364|  16.7k|                ps_cur_mb_info->u1_mb_type = u1_mb_type;
 1365|  16.7k|                if(u1_mb_type > (25 + u1_mb_threshold)) return ERROR_MB_TYPE;
  ------------------
  |  Branch (1365:20): [True: 0, False: 16.7k]
  ------------------
 1366|  16.7k|                COPYTHECONTEXT("u1_mb_type", u1_mb_type);
 1367|  16.7k|            }
 1368|  3.49k|            else
 1369|  3.49k|            {
 1370|       |                // default intialization for Base mode flag : reserved
 1371|  3.49k|                ps_dec->ps_part += MAX_NUM_MB_PART;
  ------------------
  |  |   62|  3.49k|#define MAX_NUM_MB_PART NUM_MB_PARTS *NUM_SUB_MB_PARTS
  |  |  ------------------
  |  |  |  |   59|  3.49k|#define NUM_MB_PARTS 4
  |  |  ------------------
  |  |               #define MAX_NUM_MB_PART NUM_MB_PARTS *NUM_SUB_MB_PARTS
  |  |  ------------------
  |  |  |  |   60|  3.49k|#define NUM_SUB_MB_PARTS 4
  |  |  ------------------
  ------------------
 1372|       |
 1373|  3.49k|                ps_svc_cur_mb_info->au1_motion_pred_flag[0] = 0;
 1374|  3.49k|                ps_svc_cur_mb_info->au1_motion_pred_flag[1] = 0;
 1375|  3.49k|                ps_cur_mb_info->u1_mb_type = MB_INFER;
  ------------------
  |  |  112|  3.49k|#define MB_INFER 250
  ------------------
 1376|  3.49k|                ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type;
 1377|  3.49k|                if(ps_svc_lyr_dec->u1_layer_identifier != TARGET_LAYER)
  ------------------
  |  |  110|  3.49k|#define TARGET_LAYER 2
  ------------------
  |  Branch (1377:20): [True: 0, False: 3.49k]
  ------------------
 1378|      0|                {
 1379|      0|                    ps_cur_deblk_mb->u1_deblocking_mode = MB_DISABLE_FILTERING;
  ------------------
  |  |   70|      0|#define MB_DISABLE_FILTERING          0x01
  ------------------
 1380|      0|                }
 1381|       |
 1382|       |                /*SVC EXT needs to update incropwindow*/
 1383|  3.49k|                if(ps_svc_slice_params->u1_adaptive_residual_prediction_flag &&
  ------------------
  |  Branch (1383:20): [True: 711, False: 2.78k]
  ------------------
 1384|    711|                   ps_svc_cur_mb_info->u1_crop_window_flag)
  ------------------
  |  Branch (1384:20): [True: 711, False: 0]
  ------------------
 1385|    711|                {
 1386|    711|                    ps_svc_cur_mb_info->u1_residual_prediction_flag = ih264d_decode_bin(
 1387|    711|                        0, ps_svc_lyr_dec->ps_residual_prediction_flag, ps_bitstrm, ps_cab_env);
 1388|    711|                    COPYTHECONTEXT("SVC ext: u1_residual_prediction_flag",
 1389|    711|                                   ps_svc_cur_mb_info->u1_residual_prediction_flag);
 1390|    711|                }
 1391|  2.78k|                else
 1392|  2.78k|                {
 1393|       |                    /*residual flag inference code */
 1394|  2.78k|                    if(1 == ps_svc_cur_mb_info->u1_crop_window_flag)
  ------------------
  |  Branch (1394:24): [True: 2.78k, False: 0]
  ------------------
 1395|  2.78k|                    {
 1396|  2.78k|                        ps_svc_cur_mb_info->u1_residual_prediction_flag =
 1397|  2.78k|                            ps_svc_slice_params->u1_default_residual_prediction_flag;
 1398|  2.78k|                    }
 1399|      0|                    else
 1400|      0|                    {
 1401|      0|                        ps_svc_cur_mb_info->u1_residual_prediction_flag = 0;
 1402|      0|                    }
 1403|  2.78k|                }
 1404|  3.49k|            }
 1405|       |
 1406|       |            /* Parse Macroblock Data */
 1407|  20.2k|            u1_mb_type = ps_cur_mb_info->u1_mb_type;
 1408|  20.2k|            if(u1_mb_type < u1_mb_threshold)
  ------------------
  |  Branch (1408:16): [True: 16.1k, False: 4.08k]
  ------------------
 1409|  16.1k|            {
 1410|  16.1k|                ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type;
 1411|  16.1k|                *(ps_dec->pu1_left_yuv_dc_csbp) &= 0x6;
 1412|       |
 1413|  16.1k|                ret = ps_svc_lyr_dec->pf_parse_inter_mb_svc_ext(
 1414|  16.1k|                    ps_svc_lyr_dec, ps_cur_mb_info, ps_svc_cur_mb_info, u1_num_mbs, u1_num_mbsNby2);
 1415|  16.1k|                if(ret != OK) return ret;
  ------------------
  |  |  114|  16.1k|#define OK        0
  ------------------
  |  Branch (1415:20): [True: 160, False: 15.9k]
  ------------------
 1416|  15.9k|                ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp;
 1417|  15.9k|                ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type;
 1418|  15.9k|                if(ps_svc_lyr_dec->u1_layer_identifier != TARGET_LAYER)
  ------------------
  |  |  110|  15.9k|#define TARGET_LAYER 2
  ------------------
  |  Branch (1418:20): [True: 0, False: 15.9k]
  ------------------
 1419|      0|                {
 1420|      0|                    ps_cur_deblk_mb->u1_deblocking_mode = MB_DISABLE_FILTERING;
  ------------------
  |  |   70|      0|#define MB_DISABLE_FILTERING          0x01
  ------------------
 1421|      0|                }
 1422|  15.9k|            }
 1423|  4.08k|            else
 1424|  4.08k|            {
 1425|       |                /* Storing Intra partition info */
 1426|  4.08k|                ps_parse_mb_data->u1_num_part = 0;
 1427|  4.08k|                ps_parse_mb_data->u4_isI_mb = 1;
 1428|       |
 1429|  4.08k|                if((25 + u1_mb_threshold) == u1_mb_type)
  ------------------
  |  Branch (1429:20): [True: 42, False: 4.04k]
  ------------------
 1430|     42|                {
 1431|       |                    /* I_PCM_MB */
 1432|     42|                    ps_cur_mb_info->ps_curmb->u1_mb_type = I_PCM_MB;
  ------------------
  |  |  423|     42|#define I_PCM_MB    6
  ------------------
 1433|     42|                    ret = ih264d_parse_ipcm_mb(ps_dec, ps_cur_mb_info, u1_num_mbs);
 1434|     42|                    if(ret != OK) return ret;
  ------------------
  |  |  114|     42|#define OK        0
  ------------------
  |  Branch (1434:24): [True: 9, False: 33]
  ------------------
 1435|     33|                    ps_cur_deblk_mb->u1_mb_qp = 0;
 1436|     33|                    ps_cur_deblk_mb->u1_mb_type |= D_INTRA_MB;
  ------------------
  |  |  382|     33|#define D_INTRA_MB        1
  ------------------
 1437|     33|                }
 1438|  4.04k|                else
 1439|  4.04k|                {
 1440|  4.04k|                    if(u1_mb_type == u1_mb_threshold)
  ------------------
  |  Branch (1440:24): [True: 486, False: 3.55k]
  ------------------
 1441|    486|                        ps_cur_mb_info->ps_curmb->u1_mb_type = I_4x4_MB;
  ------------------
  |  |  417|    486|#define I_4x4_MB    0
  ------------------
 1442|  3.55k|                    else
 1443|  3.55k|                        ps_cur_mb_info->ps_curmb->u1_mb_type = I_16x16_MB;
  ------------------
  |  |  418|  3.55k|#define I_16x16_MB  1
  ------------------
 1444|       |
 1445|  4.04k|                    ret = isvcd_parse_imb_cabac(ps_svc_lyr_dec, ps_cur_mb_info, ps_svc_cur_mb_info,
 1446|  4.04k|                                                (UWORD8) (u1_mb_type - u1_mb_threshold));
 1447|  4.04k|                    if(ret != OK) return ret;
  ------------------
  |  |  114|  4.04k|#define OK        0
  ------------------
  |  Branch (1447:24): [True: 82, False: 3.95k]
  ------------------
 1448|  3.95k|                    ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp;
 1449|  3.95k|                    if(0 == ps_svc_cur_mb_info->u1_base_mode_flag)
  ------------------
  |  Branch (1449:24): [True: 537, False: 3.42k]
  ------------------
 1450|    537|                    {
 1451|    537|                        ps_cur_deblk_mb->u1_mb_type |= D_INTRA_MB;
  ------------------
  |  |  382|    537|#define D_INTRA_MB        1
  ------------------
 1452|    537|                    }
 1453|  3.95k|                }
 1454|  3.99k|                ps_parse_mb_data->u4_isI_mb = !ps_svc_cur_mb_info->u1_base_mode_flag;
 1455|  3.99k|            }
 1456|  20.2k|        }
 1457|       |
 1458|  20.7k|        if(ps_dec->u1_enable_mb_info)
  ------------------
  |  Branch (1458:12): [True: 0, False: 20.7k]
  ------------------
 1459|      0|        {
 1460|      0|            ih264d_populate_mb_info_map(ps_dec, ps_cur_mb_info, ps_cur_mb_info->u2_mbx << 1,
 1461|      0|                                        ps_cur_mb_info->u2_mby << 1, ps_cur_deblk_mb->u1_mb_qp);
 1462|      0|        }
 1463|  20.7k|        if(u1_mbaff)
  ------------------
  |  Branch (1463:12): [True: 0, False: 20.7k]
  ------------------
 1464|      0|        {
 1465|      0|            ih264d_update_mbaff_left_nnz(ps_dec, ps_cur_mb_info);
 1466|      0|        }
 1467|       |
 1468|  20.7k|        if(ps_cur_mb_info->u1_topmb && u1_mbaff)
  ------------------
  |  Branch (1468:12): [True: 20.7k, False: 0]
  |  Branch (1468:40): [True: 0, False: 20.7k]
  ------------------
 1469|      0|            uc_more_data_flag = 1;
 1470|  20.7k|        else
 1471|  20.7k|        {
 1472|  20.7k|            uc_more_data_flag = ih264d_decode_terminate(&ps_dec->s_cab_dec_env, ps_bitstrm);
 1473|  20.7k|            uc_more_data_flag = !uc_more_data_flag;
 1474|  20.7k|            COPYTHECONTEXT("Decode Sliceterm", !uc_more_data_flag);
 1475|  20.7k|        }
 1476|       |
 1477|  20.7k|        if(u1_mbaff)
  ------------------
  |  Branch (1477:12): [True: 0, False: 20.7k]
  ------------------
 1478|      0|        {
 1479|      0|            if(!uc_more_data_flag && (0 == (i2_cur_mb_addr & 1)))
  ------------------
  |  Branch (1479:16): [True: 0, False: 0]
  |  Branch (1479:38): [True: 0, False: 0]
  ------------------
 1480|      0|            {
 1481|      0|                return ERROR_EOB_FLUSHBITS_T;
 1482|      0|            }
 1483|      0|        }
 1484|       |        /* Next macroblock information */
 1485|  20.7k|        i2_cur_mb_addr++;
 1486|  20.7k|        u1_num_mbs++;
 1487|  20.7k|        u1_num_mbsNby2++;
 1488|  20.7k|        ps_parse_mb_data++;
 1489|       |
 1490|       |        /****************************************************************/
 1491|       |        /* Check for End Of Row and other flags that determine when to  */
 1492|       |        /* do DMA setup for N/2-Mb, Decode for N-Mb, and Transfer for   */
 1493|       |        /* N-Mb                                                         */
 1494|       |        /****************************************************************/
 1495|  20.7k|        u1_num_mbs_next = i2_pic_wdin_mbs - ps_dec->u2_mbx - 1;
 1496|  20.7k|        u1_end_of_row = (!u1_num_mbs_next) && (!(u1_mbaff && (u1_num_mbs & 0x01)));
  ------------------
  |  Branch (1496:25): [True: 5.13k, False: 15.6k]
  |  Branch (1496:50): [True: 0, False: 5.13k]
  |  Branch (1496:62): [True: 0, False: 0]
  ------------------
 1497|  20.7k|        u1_slice_end = !uc_more_data_flag;
 1498|  20.7k|        u1_tfr_n_mb = (u1_num_mbs == ps_dec->u4_recon_mb_grp) || u1_end_of_row || u1_slice_end;
  ------------------
  |  Branch (1498:23): [True: 5.13k, False: 15.6k]
  |  Branch (1498:66): [True: 0, False: 15.6k]
  |  Branch (1498:83): [True: 6, False: 15.5k]
  ------------------
 1499|  20.7k|        u1_decode_nmb = u1_tfr_n_mb || u1_slice_end;
  ------------------
  |  Branch (1499:25): [True: 5.13k, False: 15.5k]
  |  Branch (1499:40): [True: 0, False: 15.5k]
  ------------------
 1500|  20.7k|        ps_cur_mb_info->u1_end_of_slice = u1_slice_end;
 1501|       |
 1502|  20.7k|        if(u1_decode_nmb)
  ------------------
  |  Branch (1502:12): [True: 5.13k, False: 15.5k]
  ------------------
 1503|  5.13k|        {
 1504|  5.13k|            ret = ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs);
 1505|  5.13k|            u1_num_mbsNby2 = 0;
 1506|  5.13k|            ps_parse_mb_data = ps_dec->ps_parse_mb_data;
 1507|  5.13k|            ps_dec->ps_part = ps_dec->ps_parse_part_params;
 1508|  5.13k|            if(ret != OK) return ret;
  ------------------
  |  |  114|  5.13k|#define OK        0
  ------------------
  |  Branch (1508:16): [True: 0, False: 5.13k]
  ------------------
 1509|  5.13k|        }
 1510|       |
 1511|  20.7k|        if(u1_decode_nmb)
  ------------------
  |  Branch (1511:12): [True: 5.13k, False: 15.5k]
  ------------------
 1512|  5.13k|        {
 1513|  5.13k|            if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (1513:16): [True: 3.09k, False: 2.04k]
  ------------------
 1514|  3.09k|            {
 1515|  3.09k|                ih264d_parse_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next, u1_tfr_n_mb,
 1516|  3.09k|                                     u1_end_of_row);
 1517|  3.09k|                ps_dec->ps_nmb_info += u1_num_mbs;
 1518|  3.09k|                ps_svc_lyr_dec->ps_svc_nmb_info += u1_num_mbs;
 1519|  3.09k|            }
 1520|  2.04k|            else
 1521|  2.04k|            {
 1522|  2.04k|                ret = isvcd_decode_recon_tfr_nmb_non_base_lyr(ps_svc_lyr_dec, u1_mb_idx, u1_num_mbs,
 1523|  2.04k|                                                              u1_num_mbs_next, u1_tfr_n_mb,
 1524|  2.04k|                                                              u1_end_of_row);
 1525|  2.04k|                if(ret != OK) return ret;
  ------------------
  |  |  114|  2.04k|#define OK        0
  ------------------
  |  Branch (1525:20): [True: 0, False: 2.04k]
  ------------------
 1526|  2.04k|            }
 1527|  5.13k|            ps_dec->u4_total_mbs_coded += u1_num_mbs;
 1528|  5.13k|            if(u1_tfr_n_mb) u1_num_mbs = 0;
  ------------------
  |  Branch (1528:16): [True: 5.13k, False: 0]
  ------------------
 1529|  5.13k|            u1_mb_idx = u1_num_mbs;
 1530|  5.13k|            ps_dec->u4_mb_idx = u1_num_mbs;
 1531|  5.13k|        }
 1532|  20.7k|    }
 1533|       |
 1534|    358|    ps_dec->u4_num_mbs_cur_nmb = 0;
 1535|    358|    ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr - (u2_first_mb_in_slice << u1_mbaff);
 1536|       |
 1537|    358|    return ret;
 1538|    609|}
isvcd_parse_inter_slice_data_cavlc_enh_lyr:
 1569|     64|{
 1570|     64|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1571|     64|    UWORD32 uc_more_data_flag;
 1572|     64|    WORD32 i2_cur_mb_addr;
 1573|     64|    UWORD32 u1_num_mbs, u1_num_mbsNby2, u1_mb_idx;
 1574|     64|    UWORD32 i2_mb_skip_run;
 1575|     64|    UWORD32 u1_read_mb_type;
 1576|       |
 1577|     64|    UWORD32 u1_mbaff;
 1578|     64|    UWORD32 u1_num_mbs_next, u1_end_of_row;
 1579|     64|    const UWORD32 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs;
 1580|     64|    UWORD32 u1_slice_end = 0;
 1581|     64|    UWORD32 u1_tfr_n_mb = 0;
 1582|     64|    UWORD32 u1_decode_nmb = 0;
 1583|       |
 1584|     64|    dec_bit_stream_t *const ps_bitstrm = ps_dec->ps_bitstrm;
 1585|     64|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 1586|     64|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
 1587|       |
 1588|     64|    dec_slice_svc_ext_params_t *ps_svc_slice_params = NULL;
 1589|       |
 1590|     64|    deblk_mb_t *ps_cur_deblk_mb;
 1591|     64|    dec_mb_info_t *ps_cur_mb_info;
 1592|     64|    dec_svc_mb_info_t *ps_svc_cur_mb_info;
 1593|       |
 1594|     64|    parse_pmbarams_t *ps_parse_mb_data = ps_dec->ps_parse_mb_data;
 1595|     64|    UWORD32 u1_inter_mb_type;
 1596|     64|    UWORD32 u1_deblk_mb_type;
 1597|     64|    UWORD32 u1_mb_threshold;
 1598|     64|    WORD32 ret = OK;
  ------------------
  |  |  114|     64|#define OK        0
  ------------------
 1599|       |
 1600|     64|    ps_svc_slice_params = &ps_svc_lyr_dec->s_svc_slice_params;
 1601|       |
 1602|       |    /******************************************************/
 1603|       |    /* Initialisations specific to EB or EP slice           */
 1604|       |    /******************************************************/
 1605|       |
 1606|     64|    if(ps_slice->u1_slice_type == P_SLICE)
  ------------------
  |  |  368|     64|#define P_SLICE  0
  ------------------
  |  Branch (1606:8): [True: 55, False: 9]
  ------------------
 1607|     55|    {
 1608|     55|        u1_inter_mb_type = P_MB;
  ------------------
  |  |  419|     55|#define P_MB        2
  ------------------
 1609|     55|        u1_deblk_mb_type = D_INTER_MB;
  ------------------
  |  |  381|     55|#define D_INTER_MB        0
  ------------------
 1610|     55|        u1_mb_threshold = 5;
 1611|     55|    }
 1612|      9|    else
 1613|      9|    {
 1614|      9|        u1_inter_mb_type = B_MB;
  ------------------
  |  |  420|      9|#define B_MB        3
  ------------------
 1615|      9|        u1_deblk_mb_type = D_B_SLICE;
  ------------------
  |  |  384|      9|#define D_B_SLICE         4
  ------------------
 1616|      9|        u1_mb_threshold = 23;
 1617|      9|    }
 1618|       |
 1619|       |    /******************************************************/
 1620|       |    /* Slice Level Initialisations                        */
 1621|       |    /******************************************************/
 1622|     64|    ps_dec->u1_qp = ps_slice->u1_slice_qp;
 1623|     64|    ih264d_update_qp(ps_dec, 0);
 1624|     64|    u1_mb_idx = ps_dec->u4_mb_idx;
 1625|     64|    u1_num_mbs = u1_mb_idx;
 1626|     64|    u1_num_mbsNby2 = 0;
 1627|     64|    u1_mbaff = ps_slice->u1_mbaff_frame_flag;
 1628|     64|    i2_cur_mb_addr = u2_first_mb_in_slice << u1_mbaff;
 1629|     64|    i2_mb_skip_run = 0;
 1630|     64|    uc_more_data_flag = 1;
 1631|     64|    u1_read_mb_type = 0;
 1632|       |
 1633|  2.11k|    while(!u1_slice_end)
  ------------------
  |  Branch (1633:11): [True: 2.09k, False: 19]
  ------------------
 1634|  2.09k|    {
 1635|  2.09k|        UWORD8 u1_mb_type;
 1636|       |
 1637|  2.09k|        ps_dec->pv_prev_mb_parse_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
 1638|       |
 1639|  2.09k|        if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u4_max_mb_addr)
  ------------------
  |  Branch (1639:12): [True: 32, False: 2.06k]
  ------------------
 1640|     32|        {
 1641|     32|            break;
 1642|     32|        }
 1643|       |
 1644|  2.06k|        ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs;
 1645|  2.06k|        ps_svc_cur_mb_info = ps_svc_lyr_dec->ps_svc_nmb_info + u1_num_mbs;
 1646|  2.06k|        ps_dec->u4_num_mbs_cur_nmb = u1_num_mbs;
 1647|       |
 1648|  2.06k|        ps_cur_mb_info->u1_Mux = 0;
 1649|  2.06k|        ps_dec->u4_num_pmbair = (u1_num_mbs >> u1_mbaff);
 1650|  2.06k|        ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u1_num_mbs;
 1651|       |
 1652|  2.06k|        ps_cur_mb_info->u1_end_of_slice = 0;
 1653|       |
 1654|       |        /* Storing Default partition info */
 1655|  2.06k|        ps_parse_mb_data->u1_num_part = 1;
 1656|  2.06k|        ps_parse_mb_data->u4_isI_mb = 0;
 1657|       |
 1658|  2.06k|        if((!i2_mb_skip_run) && (!u1_read_mb_type))
  ------------------
  |  Branch (1658:12): [True: 1.35k, False: 707]
  |  Branch (1658:33): [True: 1.18k, False: 171]
  ------------------
 1659|  1.18k|        {
 1660|  1.18k|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
 1661|  1.18k|            UWORD32 u4_word, u4_ldz;
 1662|       |
 1663|       |            /***************************************************************/
 1664|       |            /* Find leading zeros in next 32 bits                          */
 1665|       |            /***************************************************************/
 1666|  1.18k|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|  1.18k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|  1.18k|{                                                                           \
  |  |  152|  1.18k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|  1.18k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|  1.18k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|  1.18k|                                                                            \
  |  |  156|  1.18k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|  1.18k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 1.16k, False: 18]
  |  |  ------------------
  |  |  158|  1.18k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|  1.16k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|  1.18k|}
  ------------------
 1667|       |
 1668|  1.18k|            u4_ldz = CLZ(u4_word);
 1669|       |
 1670|       |            /* Flush the ps_bitstrm */
 1671|  1.18k|            u4_bitstream_offset += (u4_ldz + 1);
 1672|       |            /* Read the suffix from the ps_bitstrm */
 1673|  1.18k|            u4_word = 0;
 1674|  1.18k|            if(u4_ldz)
  ------------------
  |  Branch (1674:16): [True: 187, False: 996]
  ------------------
 1675|    187|            {
 1676|    187|                GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|    187|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    187|{                                                                           \
  |  |  122|    187|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    187|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    187|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    187|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    187|                                                                            \
  |  |  127|    187|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 187, False: 0]
  |  |  ------------------
  |  |  128|    187|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    187|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    187|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    187|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    187|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    187|}                                                                           \
  ------------------
 1677|    187|            }
 1678|  1.18k|            *pu4_bitstrm_ofst = u4_bitstream_offset;
 1679|  1.18k|            i2_mb_skip_run = ((1 << u4_ldz) + u4_word - 1);
 1680|       |
 1681|  1.18k|            COPYTHECONTEXT("mb_skip_run", i2_mb_skip_run);
 1682|  1.18k|            uc_more_data_flag = MORE_RBSP_DATA(ps_bitstrm);
  ------------------
  |  |   97|  1.18k|    CHECK_BITS_SUFFICIENT(ps_bitstrm, 1)
  |  |  ------------------
  |  |  |  |   95|  1.18k|  (ps_bitstrm->u4_ofst + bits_to_read <= ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  ------------------
 1683|  1.18k|            u1_read_mb_type = uc_more_data_flag;
 1684|  1.18k|        }
 1685|       |
 1686|       |        /***************************************************************/
 1687|       |        /* Get the required information for decoding of MB             */
 1688|       |        /* mb_x, mb_y , neighbour availablity,                         */
 1689|       |        /***************************************************************/
 1690|  2.06k|        ps_dec->pf_get_mb_info(ps_dec, i2_cur_mb_addr, ps_cur_mb_info, i2_mb_skip_run);
 1691|  2.06k|        ps_svc_cur_mb_info->u1_crop_window_flag =
 1692|  2.06k|            *(ps_svc_lyr_dec->pu1_crop_wnd_flag + ps_cur_mb_info->u2_mbx +
 1693|  2.06k|              (ps_cur_mb_info->u2_mby * ps_dec->u2_frm_wd_in_mbs));
 1694|       |        /***************************************************************/
 1695|       |        /* Set the deblocking parameters for this MB                   */
 1696|       |        /***************************************************************/
 1697|  2.06k|        if(ps_dec->u4_app_disable_deblk_frm == 0)
  ------------------
  |  Branch (1697:12): [True: 2.06k, False: 0]
  ------------------
 1698|  2.06k|            ih264d_set_deblocking_parameters(ps_cur_deblk_mb, ps_slice,
 1699|  2.06k|                                             ps_dec->u1_mb_ngbr_availablity,
 1700|  2.06k|                                             ps_dec->u1_cur_mb_fld_dec_flag);
 1701|       |
 1702|  2.06k|        if(i2_mb_skip_run)
  ------------------
  |  Branch (1702:12): [True: 894, False: 1.16k]
  ------------------
 1703|    894|        {
 1704|       |            /* Set appropriate flags in ps_cur_mb_info and ps_dec */
 1705|    894|            ps_dec->i1_prev_mb_qp_delta = 0;
 1706|    894|            ps_dec->u1_sub_mb_num = 0;
 1707|    894|            ps_cur_mb_info->u1_mb_type = MB_SKIP;
  ------------------
  |  |   59|    894|#define MB_SKIP 255
  ------------------
 1708|    894|            ps_cur_mb_info->u1_mb_mc_mode = PRED_16x16;
  ------------------
  |  |  450|    894|#define PRED_16x16  0
  ------------------
 1709|    894|            ps_cur_mb_info->u1_cbp = 0;
 1710|    894|            ps_svc_cur_mb_info->u1_base_mode_flag = 0;
 1711|    894|            ps_svc_cur_mb_info->au1_motion_pred_flag[0] = 0;
 1712|    894|            ps_svc_cur_mb_info->au1_motion_pred_flag[1] = 0;
 1713|    894|            ps_svc_cur_mb_info->u1_residual_prediction_flag = 0;
 1714|       |
 1715|    894|            {
 1716|       |                /* Storing Skip partition info */
 1717|    894|                parse_part_params_t *ps_part_info = ps_dec->ps_part;
 1718|    894|                ps_part_info->u1_is_direct = PART_DIRECT_16x16;
  ------------------
  |  |  571|    894|#define PART_DIRECT_16x16              2
  ------------------
 1719|    894|                ps_part_info->u1_sub_mb_num = 0;
 1720|    894|                ps_dec->ps_part++;
 1721|    894|            }
 1722|       |
 1723|       |            /* Update Nnzs */
 1724|    894|            ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CAVLC);
  ------------------
  |  |  338|    894|#define CAVLC  0
  ------------------
 1725|       |
 1726|    894|            ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type;
 1727|    894|            ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type;
 1728|       |
 1729|    894|            if(ps_svc_lyr_dec->u1_layer_identifier != TARGET_LAYER)
  ------------------
  |  |  110|    894|#define TARGET_LAYER 2
  ------------------
  |  Branch (1729:16): [True: 0, False: 894]
  ------------------
 1730|      0|            {
 1731|      0|                ps_cur_deblk_mb->u1_deblocking_mode = MB_DISABLE_FILTERING;
  ------------------
  |  |   70|      0|#define MB_DISABLE_FILTERING          0x01
  ------------------
 1732|      0|            }
 1733|    894|            i2_mb_skip_run--;
 1734|    894|        }
 1735|  1.16k|        else
 1736|  1.16k|        {
 1737|  1.16k|            UWORD32 u4_word, u4_ldz, u4_temp;
 1738|       |
 1739|  1.16k|            ps_svc_cur_mb_info->u1_base_mode_flag = 0;
 1740|  1.16k|            if(ps_svc_cur_mb_info->u1_crop_window_flag &&
  ------------------
  |  Branch (1740:16): [True: 1.16k, False: 0]
  ------------------
 1741|  1.16k|               ps_svc_slice_params->u1_adaptive_base_mode_flag)
  ------------------
  |  Branch (1741:16): [True: 297, False: 870]
  ------------------
 1742|    297|            {
 1743|    297|                ps_svc_cur_mb_info->u1_base_mode_flag = ih264d_get_bit_h264(ps_bitstrm);
 1744|    297|                COPYTHECONTEXT("SVC :u1_base_mode_flag", ps_cur_mb_info->u1_base_mode_flag);
 1745|    297|            }
 1746|    870|            else if(ps_svc_cur_mb_info->u1_crop_window_flag)
  ------------------
  |  Branch (1746:21): [True: 870, False: 0]
  ------------------
 1747|    870|            {
 1748|    870|                ps_svc_cur_mb_info->u1_base_mode_flag =
 1749|    870|                    ps_svc_slice_params->u1_default_base_mode_flag;
 1750|    870|            }
 1751|       |
 1752|  1.16k|            if(!ps_svc_cur_mb_info->u1_base_mode_flag)
  ------------------
  |  Branch (1752:16): [True: 396, False: 771]
  ------------------
 1753|    396|            {
 1754|    396|                UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
 1755|       |
 1756|    396|                u1_read_mb_type = 0;
 1757|       |                /**************************************************************/
 1758|       |                /* Macroblock Layer Begins, Decode the u1_mb_type              */
 1759|       |                /**************************************************************/
 1760|    396|                {
 1761|       |                    /***************************************************************/
 1762|       |                    /* Find leading zeros in next 32 bits                          */
 1763|       |                    /***************************************************************/
 1764|    396|                    NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|    396|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|    396|{                                                                           \
  |  |  152|    396|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|    396|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|    396|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|    396|                                                                            \
  |  |  156|    396|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|    396|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 380, False: 16]
  |  |  ------------------
  |  |  158|    396|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|    380|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|    396|}
  ------------------
 1765|    396|                    u4_ldz = CLZ(u4_word);
 1766|       |                    /* Flush the ps_bitstrm */
 1767|    396|                    u4_bitstream_offset += (u4_ldz + 1);
 1768|       |                    /* Read the suffix from the ps_bitstrm */
 1769|    396|                    u4_word = 0;
 1770|    396|                    if(u4_ldz) GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|    224|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    224|{                                                                           \
  |  |  122|    224|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    224|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    224|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    224|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    224|                                                                            \
  |  |  127|    224|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 224, False: 0]
  |  |  ------------------
  |  |  128|    224|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    224|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    224|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    224|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    224|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    224|}                                                                           \
  ------------------
  |  Branch (1770:24): [True: 224, False: 172]
  ------------------
 1771|    396|                    *pu4_bitstrm_ofst = u4_bitstream_offset;
 1772|    396|                    u4_temp = ((1 << u4_ldz) + u4_word - 1);
 1773|       |
 1774|    396|                    if(u4_temp > (UWORD32) (25 + u1_mb_threshold)) return ERROR_MB_TYPE;
  ------------------
  |  Branch (1774:24): [True: 0, False: 396]
  ------------------
 1775|    396|                    u1_mb_type = u4_temp;
 1776|    396|                    COPYTHECONTEXT("u1_mb_type", u1_mb_type);
 1777|    396|                }
 1778|      0|                ps_cur_mb_info->u1_mb_type = u1_mb_type;
 1779|    396|            }
 1780|    771|            else
 1781|    771|            {
 1782|       |                /* default intialization for Base mode flag : reserved */
 1783|    771|                ps_dec->ps_part += MAX_NUM_MB_PART;
  ------------------
  |  |   62|    771|#define MAX_NUM_MB_PART NUM_MB_PARTS *NUM_SUB_MB_PARTS
  |  |  ------------------
  |  |  |  |   59|    771|#define NUM_MB_PARTS 4
  |  |  ------------------
  |  |               #define MAX_NUM_MB_PART NUM_MB_PARTS *NUM_SUB_MB_PARTS
  |  |  ------------------
  |  |  |  |   60|    771|#define NUM_SUB_MB_PARTS 4
  |  |  ------------------
  ------------------
 1784|    771|                u1_read_mb_type = 0;
 1785|    771|                ps_svc_cur_mb_info->au1_motion_pred_flag[0] = 0;
 1786|    771|                ps_svc_cur_mb_info->au1_motion_pred_flag[1] = 0;
 1787|    771|                ps_cur_mb_info->u1_mb_type = MB_INFER;
  ------------------
  |  |  112|    771|#define MB_INFER 250
  ------------------
 1788|    771|                ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type;
 1789|    771|                if(ps_svc_lyr_dec->u1_layer_identifier != TARGET_LAYER)
  ------------------
  |  |  110|    771|#define TARGET_LAYER 2
  ------------------
  |  Branch (1789:20): [True: 0, False: 771]
  ------------------
 1790|      0|                {
 1791|      0|                    ps_cur_deblk_mb->u1_deblocking_mode = MB_DISABLE_FILTERING;
  ------------------
  |  |   70|      0|#define MB_DISABLE_FILTERING          0x01
  ------------------
 1792|      0|                }
 1793|       |
 1794|       |                /*SVC EXT needs to update incropwindow*/
 1795|    771|                if(ps_svc_slice_params->u1_adaptive_residual_prediction_flag &&
  ------------------
  |  Branch (1795:20): [True: 223, False: 548]
  ------------------
 1796|    223|                   ps_svc_cur_mb_info->u1_crop_window_flag)
  ------------------
  |  Branch (1796:20): [True: 223, False: 0]
  ------------------
 1797|    223|                {
 1798|    223|                    ps_svc_cur_mb_info->u1_residual_prediction_flag =
 1799|    223|                        ih264d_get_bit_h264(ps_bitstrm);
 1800|    223|                    COPYTHECONTEXT("SVC ext: u1_residual_prediction_flag",
 1801|    223|                                   ps_cur_mb_info->u1_residual_prediction_flag);
 1802|    223|                }
 1803|    548|                else
 1804|    548|                {
 1805|       |                    /*residual flag inference code */
 1806|    548|                    if(1 == ps_svc_cur_mb_info->u1_crop_window_flag)
  ------------------
  |  Branch (1806:24): [True: 548, False: 0]
  ------------------
 1807|    548|                    {
 1808|    548|                        ps_svc_cur_mb_info->u1_residual_prediction_flag =
 1809|    548|                            ps_svc_slice_params->u1_default_residual_prediction_flag;
 1810|    548|                    }
 1811|      0|                    else
 1812|      0|                    {
 1813|      0|                        ps_svc_cur_mb_info->u1_residual_prediction_flag = 0;
 1814|      0|                    }
 1815|    548|                }
 1816|    771|            }
 1817|       |
 1818|       |            /**************************************************************/
 1819|       |            /* Parse Macroblock data                                      */
 1820|       |            /**************************************************************/
 1821|  1.16k|            u1_mb_type = ps_cur_mb_info->u1_mb_type;
 1822|  1.16k|            if(u1_mb_type < u1_mb_threshold)
  ------------------
  |  Branch (1822:16): [True: 385, False: 782]
  ------------------
 1823|    385|            {
 1824|    385|                ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type;
 1825|       |
 1826|    385|                ret = ps_svc_lyr_dec->pf_parse_inter_mb_svc_ext(
 1827|    385|                    ps_svc_lyr_dec, ps_cur_mb_info, ps_svc_cur_mb_info, u1_num_mbs, u1_num_mbsNby2);
 1828|    385|                if(ret != OK) return ret;
  ------------------
  |  |  114|    385|#define OK        0
  ------------------
  |  Branch (1828:20): [True: 8, False: 377]
  ------------------
 1829|    377|                ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type;
 1830|       |
 1831|    377|                if(ps_svc_lyr_dec->u1_layer_identifier != TARGET_LAYER)
  ------------------
  |  |  110|    377|#define TARGET_LAYER 2
  ------------------
  |  Branch (1831:20): [True: 0, False: 377]
  ------------------
 1832|      0|                {
 1833|      0|                    ps_cur_deblk_mb->u1_deblocking_mode = MB_DISABLE_FILTERING;
  ------------------
  |  |   70|      0|#define MB_DISABLE_FILTERING          0x01
  ------------------
 1834|      0|                }
 1835|    377|            }
 1836|    782|            else
 1837|    782|            {
 1838|       |                /* Storing Intra partition info */
 1839|    782|                ps_parse_mb_data->u1_num_part = 0;
 1840|       |
 1841|    782|                if((25 + u1_mb_threshold) == u1_mb_type)
  ------------------
  |  Branch (1841:20): [True: 0, False: 782]
  ------------------
 1842|      0|                {
 1843|       |                    /* I_PCM_MB */
 1844|      0|                    ps_cur_mb_info->ps_curmb->u1_mb_type = I_PCM_MB;
  ------------------
  |  |  423|      0|#define I_PCM_MB    6
  ------------------
 1845|      0|                    ret = ih264d_parse_ipcm_mb(ps_dec, ps_cur_mb_info, u1_num_mbs);
 1846|      0|                    if(ret != OK) return ret;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (1846:24): [True: 0, False: 0]
  ------------------
 1847|      0|                    ps_dec->u1_qp = 0;
 1848|      0|                    ps_cur_deblk_mb->u1_mb_type |= D_INTRA_MB;
  ------------------
  |  |  382|      0|#define D_INTRA_MB        1
  ------------------
 1849|      0|                }
 1850|    782|                else
 1851|    782|                {
 1852|    782|                    ret =
 1853|    782|                        isvcd_parse_imb_cavlc(ps_svc_lyr_dec, ps_cur_mb_info, ps_svc_cur_mb_info,
 1854|    782|                                              u1_num_mbs, (UWORD8) (u1_mb_type - u1_mb_threshold));
 1855|    782|                    if(ret != OK) return ret;
  ------------------
  |  |  114|    782|#define OK        0
  ------------------
  |  Branch (1855:24): [True: 5, False: 777]
  ------------------
 1856|       |
 1857|    777|                    if(0 == ps_svc_cur_mb_info->u1_base_mode_flag)
  ------------------
  |  Branch (1857:24): [True: 8, False: 769]
  ------------------
 1858|      8|                    {
 1859|      8|                        ps_cur_deblk_mb->u1_mb_type |= D_INTRA_MB;
  ------------------
  |  |  382|      8|#define D_INTRA_MB        1
  ------------------
 1860|      8|                    }
 1861|    777|                }
 1862|    777|                ps_parse_mb_data->u4_isI_mb = !ps_svc_cur_mb_info->u1_base_mode_flag;
 1863|    777|            }
 1864|  1.15k|            uc_more_data_flag = MORE_RBSP_DATA(ps_bitstrm);
  ------------------
  |  |   97|  1.15k|    CHECK_BITS_SUFFICIENT(ps_bitstrm, 1)
  |  |  ------------------
  |  |  |  |   95|  1.15k|  (ps_bitstrm->u4_ofst + bits_to_read <= ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  ------------------
 1865|  1.15k|        }
 1866|  2.04k|        ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp;
 1867|       |
 1868|  2.04k|        if(ps_dec->u1_enable_mb_info)
  ------------------
  |  Branch (1868:12): [True: 0, False: 2.04k]
  ------------------
 1869|      0|        {
 1870|      0|            ih264d_populate_mb_info_map(ps_dec, ps_cur_mb_info, ps_cur_mb_info->u2_mbx << 1,
 1871|      0|                                        ps_cur_mb_info->u2_mby << 1, ps_cur_deblk_mb->u1_mb_qp);
 1872|      0|        }
 1873|  2.04k|        if(u1_mbaff)
  ------------------
  |  Branch (1873:12): [True: 0, False: 2.04k]
  ------------------
 1874|      0|        {
 1875|      0|            ih264d_update_mbaff_left_nnz(ps_dec, ps_cur_mb_info);
 1876|      0|            if(!uc_more_data_flag && !i2_mb_skip_run && (0 == (i2_cur_mb_addr & 1)))
  ------------------
  |  Branch (1876:16): [True: 0, False: 0]
  |  Branch (1876:38): [True: 0, False: 0]
  |  Branch (1876:57): [True: 0, False: 0]
  ------------------
 1877|      0|            {
 1878|      0|                return ERROR_EOB_FLUSHBITS_T;
 1879|      0|            }
 1880|      0|        }
 1881|       |        /**************************************************************/
 1882|       |        /* Get next Macroblock address                                */
 1883|       |        /**************************************************************/
 1884|  2.04k|        i2_cur_mb_addr++;
 1885|  2.04k|        u1_num_mbs++;
 1886|  2.04k|        u1_num_mbsNby2++;
 1887|  2.04k|        ps_parse_mb_data++;
 1888|       |
 1889|       |        /****************************************************************/
 1890|       |        /* Check for End Of Row and other flags that determine when to  */
 1891|       |        /* do DMA setup for N/2-Mb, Decode for N-Mb, and Transfer for   */
 1892|       |        /* N-Mb                                                         */
 1893|       |        /****************************************************************/
 1894|  2.04k|        u1_num_mbs_next = i2_pic_wdin_mbs - ps_dec->u2_mbx - 1;
 1895|  2.04k|        u1_end_of_row = (!u1_num_mbs_next) && (!(u1_mbaff && (u1_num_mbs & 0x01)));
  ------------------
  |  Branch (1895:25): [True: 568, False: 1.48k]
  |  Branch (1895:50): [True: 0, False: 568]
  |  Branch (1895:62): [True: 0, False: 0]
  ------------------
 1896|  2.04k|        u1_slice_end = (!(uc_more_data_flag || i2_mb_skip_run));
  ------------------
  |  Branch (1896:27): [True: 2.00k, False: 46]
  |  Branch (1896:48): [True: 27, False: 19]
  ------------------
 1897|  2.04k|        u1_tfr_n_mb = (u1_num_mbs == ps_dec->u4_recon_mb_grp) || u1_end_of_row || u1_slice_end;
  ------------------
  |  Branch (1897:23): [True: 568, False: 1.48k]
  |  Branch (1897:66): [True: 0, False: 1.48k]
  |  Branch (1897:83): [True: 14, False: 1.46k]
  ------------------
 1898|  2.04k|        u1_decode_nmb = u1_tfr_n_mb || u1_slice_end;
  ------------------
  |  Branch (1898:25): [True: 582, False: 1.46k]
  |  Branch (1898:40): [True: 0, False: 1.46k]
  ------------------
 1899|  2.04k|        ps_cur_mb_info->u1_end_of_slice = u1_slice_end;
 1900|       |
 1901|  2.04k|        if(u1_decode_nmb)
  ------------------
  |  Branch (1901:12): [True: 582, False: 1.46k]
  ------------------
 1902|    582|        {
 1903|    582|            ret = ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs);
 1904|    582|            u1_num_mbsNby2 = 0;
 1905|    582|            ps_parse_mb_data = ps_dec->ps_parse_mb_data;
 1906|    582|            ps_dec->ps_part = ps_dec->ps_parse_part_params;
 1907|    582|            if(ret != OK) return ret;
  ------------------
  |  |  114|    582|#define OK        0
  ------------------
  |  Branch (1907:16): [True: 0, False: 582]
  ------------------
 1908|    582|        }
 1909|       |
 1910|  2.04k|        if(u1_decode_nmb)
  ------------------
  |  Branch (1910:12): [True: 582, False: 1.46k]
  ------------------
 1911|    582|        {
 1912|    582|            if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (1912:16): [True: 573, False: 9]
  ------------------
 1913|    573|            {
 1914|    573|                ih264d_parse_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next, u1_tfr_n_mb,
 1915|    573|                                     u1_end_of_row);
 1916|    573|                ps_dec->ps_nmb_info += u1_num_mbs;
 1917|    573|                ps_svc_lyr_dec->ps_svc_nmb_info += u1_num_mbs;
 1918|    573|            }
 1919|      9|            else
 1920|      9|            {
 1921|      9|                ret = isvcd_decode_recon_tfr_nmb_non_base_lyr(ps_svc_lyr_dec, u1_mb_idx, u1_num_mbs,
 1922|      9|                                                              u1_num_mbs_next, u1_tfr_n_mb,
 1923|      9|                                                              u1_end_of_row);
 1924|      9|                if(ret != OK) return ret;
  ------------------
  |  |  114|      9|#define OK        0
  ------------------
  |  Branch (1924:20): [True: 0, False: 9]
  ------------------
 1925|      9|            }
 1926|    582|            ps_dec->u4_total_mbs_coded += u1_num_mbs;
 1927|    582|            if(u1_tfr_n_mb) u1_num_mbs = 0;
  ------------------
  |  Branch (1927:16): [True: 582, False: 0]
  ------------------
 1928|    582|            u1_mb_idx = u1_num_mbs;
 1929|    582|            ps_dec->u4_mb_idx = u1_num_mbs;
 1930|    582|        }
 1931|  2.04k|    }
 1932|       |
 1933|     51|    ps_dec->u4_num_mbs_cur_nmb = 0;
 1934|     51|    ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr - (u2_first_mb_in_slice << u1_mbaff);
 1935|       |
 1936|     51|    return ret;
 1937|     64|}
isvcd_parse_pmb_cabac:
 1953|  15.8k|{
 1954|  15.8k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1955|  15.8k|    dec_slice_svc_ext_params_t *ps_svc_slice_params = NULL;
 1956|       |
 1957|  15.8k|    UWORD32 u1_num_mb_part;
 1958|  15.8k|    UWORD32 uc_sub_mb;
 1959|  15.8k|    parse_pmbarams_t *ps_parse_mb_data = ps_dec->ps_parse_mb_data + u4_num_mbsNby2;
 1960|  15.8k|    WORD8 *pi1_ref_idx = ps_parse_mb_data->i1_ref_idx[0];
 1961|  15.8k|    const UWORD8 *pu1_num_mb_part = (const UWORD8 *) gau1_ih264d_num_mb_part;
 1962|  15.8k|    const UWORD32 u1_mb_type = ps_cur_mb_info->u1_mb_type;
 1963|  15.8k|    UWORD8 *pu1_col_info = ps_parse_mb_data->u1_col_info;
 1964|  15.8k|    UWORD32 u1_mb_mc_mode = u1_mb_type;
 1965|  15.8k|    ctxt_inc_mb_info_t *p_curr_ctxt = ps_dec->ps_curr_ctxt_mb_info;
 1966|  15.8k|    decoding_envirnoment_t *ps_cab_env = &ps_dec->s_cab_dec_env;
 1967|  15.8k|    dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm;
 1968|  15.8k|    UWORD32 u4_sub_mb_pack = 0;
 1969|  15.8k|    WORD32 ret;
 1970|       |
 1971|  15.8k|    UWORD8 u1_no_submb_part_size_lt8x8_flag = 1;
 1972|  15.8k|    ps_svc_slice_params = &ps_svc_lyr_dec->s_svc_slice_params;
 1973|       |
 1974|  15.8k|    ps_cur_mb_info->u1_tran_form8x8 = 0;
 1975|  15.8k|    ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
 1976|  15.8k|    ps_cur_mb_info->u1_yuv_dc_block_flag = 0;
 1977|  15.8k|    p_curr_ctxt->u1_mb_type = CAB_P;
  ------------------
  |  |  398|  15.8k|#define CAB_P             0x07 /* 0000 0111 */
  ------------------
 1978|  15.8k|    ps_cur_mb_info->u1_mb_mc_mode = u1_mb_type;
 1979|  15.8k|    uc_sub_mb = ((u1_mb_type == PRED_8x8) | (u1_mb_type == PRED_8x8R0));
  ------------------
  |  |  453|  15.8k|#define PRED_8x8    3
  ------------------
                  uc_sub_mb = ((u1_mb_type == PRED_8x8) | (u1_mb_type == PRED_8x8R0));
  ------------------
  |  |  454|  15.8k|#define PRED_8x8R0  4
  ------------------
 1980|       |
 1981|       |    /* Reading the subMB type */
 1982|  15.8k|    if(uc_sub_mb)
  ------------------
  |  Branch (1982:8): [True: 1.99k, False: 13.8k]
  ------------------
 1983|  1.99k|    {
 1984|  1.99k|        UWORD8 u1_colz = (PRED_8x8 << 6);
  ------------------
  |  |  453|  1.99k|#define PRED_8x8    3
  ------------------
 1985|  1.99k|        u1_mb_mc_mode = 0;
 1986|  1.99k|        {
 1987|  1.99k|            UWORD8 u1_sub_mb_mode;
 1988|  1.99k|            u1_sub_mb_mode =
 1989|  1.99k|                ih264d_parse_submb_type_cabac(0, ps_cab_env, ps_bitstrm, ps_dec->p_sub_mb_type_t);
 1990|  1.99k|            if(u1_sub_mb_mode > 3) return ERROR_SUB_MB_TYPE;
  ------------------
  |  Branch (1990:16): [True: 0, False: 1.99k]
  ------------------
 1991|       |
 1992|  1.99k|            u4_sub_mb_pack = (u4_sub_mb_pack << 8) | u1_sub_mb_mode;
 1993|       |            /* Storing collocated information */
 1994|  1.99k|            *pu1_col_info++ = u1_colz | ((UWORD8) (u1_sub_mb_mode << 4));
 1995|  1.99k|            COPYTHECONTEXT("sub_mb_type", u1_sub_mb_mode);
 1996|       |            /* check if Motion compensation is done below 8x8 */
 1997|  1.99k|            if(u1_sub_mb_mode != P_L0_8x8)
  ------------------
  |  |  459|  1.99k|#define P_L0_8x8    0
  ------------------
  |  Branch (1997:16): [True: 1.49k, False: 502]
  ------------------
 1998|  1.49k|            {
 1999|  1.49k|                u1_no_submb_part_size_lt8x8_flag = 0;
 2000|  1.49k|            }
 2001|  1.99k|        }
 2002|      0|        {
 2003|  1.99k|            UWORD8 u1_sub_mb_mode;
 2004|  1.99k|            u1_sub_mb_mode =
 2005|  1.99k|                ih264d_parse_submb_type_cabac(0, ps_cab_env, ps_bitstrm, ps_dec->p_sub_mb_type_t);
 2006|  1.99k|            if(u1_sub_mb_mode > 3) return ERROR_SUB_MB_TYPE;
  ------------------
  |  Branch (2006:16): [True: 0, False: 1.99k]
  ------------------
 2007|       |
 2008|  1.99k|            u4_sub_mb_pack = (u4_sub_mb_pack << 8) | u1_sub_mb_mode;
 2009|       |            /* Storing collocated information */
 2010|  1.99k|            *pu1_col_info++ = u1_colz | ((UWORD8) (u1_sub_mb_mode << 4));
 2011|  1.99k|            COPYTHECONTEXT("sub_mb_type", u1_sub_mb_mode);
 2012|       |            /* check if Motion compensation is done below 8x8 */
 2013|  1.99k|            if(u1_sub_mb_mode != P_L0_8x8)
  ------------------
  |  |  459|  1.99k|#define P_L0_8x8    0
  ------------------
  |  Branch (2013:16): [True: 1.43k, False: 555]
  ------------------
 2014|  1.43k|            {
 2015|  1.43k|                u1_no_submb_part_size_lt8x8_flag = 0;
 2016|  1.43k|            }
 2017|  1.99k|        }
 2018|      0|        {
 2019|  1.99k|            UWORD8 u1_sub_mb_mode;
 2020|  1.99k|            u1_sub_mb_mode =
 2021|  1.99k|                ih264d_parse_submb_type_cabac(0, ps_cab_env, ps_bitstrm, ps_dec->p_sub_mb_type_t);
 2022|  1.99k|            if(u1_sub_mb_mode > 3) return ERROR_SUB_MB_TYPE;
  ------------------
  |  Branch (2022:16): [True: 0, False: 1.99k]
  ------------------
 2023|       |
 2024|  1.99k|            u4_sub_mb_pack = (u4_sub_mb_pack << 8) | u1_sub_mb_mode;
 2025|       |            /* Storing collocated information */
 2026|  1.99k|            *pu1_col_info++ = u1_colz | ((UWORD8) (u1_sub_mb_mode << 4));
 2027|  1.99k|            COPYTHECONTEXT("sub_mb_type", u1_sub_mb_mode);
 2028|       |            /* check if Motion compensation is done below 8x8 */
 2029|  1.99k|            if(u1_sub_mb_mode != P_L0_8x8)
  ------------------
  |  |  459|  1.99k|#define P_L0_8x8    0
  ------------------
  |  Branch (2029:16): [True: 1.51k, False: 481]
  ------------------
 2030|  1.51k|            {
 2031|  1.51k|                u1_no_submb_part_size_lt8x8_flag = 0;
 2032|  1.51k|            }
 2033|  1.99k|        }
 2034|      0|        {
 2035|  1.99k|            UWORD8 u1_sub_mb_mode;
 2036|  1.99k|            u1_sub_mb_mode =
 2037|  1.99k|                ih264d_parse_submb_type_cabac(0, ps_cab_env, ps_bitstrm, ps_dec->p_sub_mb_type_t);
 2038|  1.99k|            if(u1_sub_mb_mode > 3) return ERROR_SUB_MB_TYPE;
  ------------------
  |  Branch (2038:16): [True: 0, False: 1.99k]
  ------------------
 2039|       |
 2040|  1.99k|            u4_sub_mb_pack = (u4_sub_mb_pack << 8) | u1_sub_mb_mode;
 2041|       |            /* Storing collocated information */
 2042|  1.99k|            *pu1_col_info++ = u1_colz | ((UWORD8) (u1_sub_mb_mode << 4));
 2043|  1.99k|            COPYTHECONTEXT("sub_mb_type", u1_sub_mb_mode);
 2044|       |            /* check if Motion compensation is done below 8x8 */
 2045|  1.99k|            if(u1_sub_mb_mode != P_L0_8x8)
  ------------------
  |  |  459|  1.99k|#define P_L0_8x8    0
  ------------------
  |  Branch (2045:16): [True: 1.44k, False: 548]
  ------------------
 2046|  1.44k|            {
 2047|  1.44k|                u1_no_submb_part_size_lt8x8_flag = 0;
 2048|  1.44k|            }
 2049|  1.99k|        }
 2050|      0|        u1_num_mb_part = 4;
 2051|  1.99k|    }
 2052|  13.8k|    else
 2053|  13.8k|    {
 2054|  13.8k|        u1_num_mb_part = pu1_num_mb_part[u1_mb_type];
 2055|       |        /* Storing collocated Mb and SubMb mode information */
 2056|  13.8k|        *pu1_col_info++ = (u1_mb_type << 6);
 2057|  13.8k|        if(u1_mb_type) *pu1_col_info++ = (u1_mb_type << 6);
  ------------------
  |  Branch (2057:12): [True: 699, False: 13.1k]
  ------------------
 2058|  13.8k|    }
 2059|       |
 2060|       |    /*Adding code to get Motion Prediction Flags*/
 2061|  15.8k|    {
 2062|  15.8k|        UWORD8 uc_i;
 2063|  15.8k|        UWORD8 *pu1_motion_pred_flag_l0;
 2064|  15.8k|        UWORD8 u1_mvp_flag;
 2065|  15.8k|        WORD8 *pi1_top_ref_idx_ctx_inc_arr = p_curr_ctxt->i1_ref_idx;
 2066|  15.8k|        WORD8 *pi1_left_ref_idx_ctxt_inc = ps_dec->pi1_left_ref_idx_ctxt_inc;
 2067|  15.8k|        UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
 2068|  15.8k|        UWORD8 uc_field = ps_cur_mb_info->u1_mb_field_decodingflag;
 2069|  15.8k|        UWORD8 uc_num_ref_idx_l0_active_minus1 =
 2070|  15.8k|            (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0] << (u1_mbaff & uc_field)) - 1;
 2071|  15.8k|        pu1_motion_pred_flag_l0 = &ps_svc_cur_mb_info->au1_motion_pred_flag[0];
 2072|  15.8k|        *pu1_motion_pred_flag_l0 = 0;
 2073|       |
 2074|  15.8k|        if(ps_svc_cur_mb_info->u1_crop_window_flag &&
  ------------------
  |  Branch (2074:12): [True: 15.8k, False: 0]
  ------------------
 2075|  15.8k|           ps_svc_slice_params->u1_adaptive_motion_prediction_flag)
  ------------------
  |  Branch (2075:12): [True: 2.18k, False: 13.6k]
  ------------------
 2076|  2.18k|        {
 2077|  9.89k|            for(uc_i = 0; uc_i < u1_num_mb_part; uc_i++)
  ------------------
  |  Branch (2077:27): [True: 7.70k, False: 2.18k]
  ------------------
 2078|  7.70k|            {
 2079|       |                /*usage of bins and ctxt check*/
 2080|  7.70k|                u1_mvp_flag = ih264d_decode_bin(0, ps_svc_lyr_dec->ps_motion_prediction_flag_l0,
 2081|  7.70k|                                                ps_bitstrm, ps_cab_env);
 2082|  7.70k|                COPYTHECONTEXT("SVC ext: ps_motion_prediction_flag_l0", u1_mvp_flag);
 2083|       |
 2084|  7.70k|                *pu1_motion_pred_flag_l0 |= (u1_mvp_flag << uc_i);
 2085|  7.70k|                if(u1_mvp_flag)
  ------------------
  |  Branch (2085:20): [True: 3.01k, False: 4.68k]
  ------------------
 2086|  3.01k|                {
 2087|  3.01k|                    pi1_ref_idx[uc_i] = -1;
 2088|  3.01k|                }
 2089|  7.70k|            }
 2090|  2.18k|        }
 2091|  13.6k|        else if(ps_svc_cur_mb_info->u1_crop_window_flag)
  ------------------
  |  Branch (2091:17): [True: 13.6k, False: 0]
  ------------------
 2092|  13.6k|        {
 2093|  13.6k|            *pu1_motion_pred_flag_l0 = ps_svc_slice_params->u1_default_motion_prediction_flag
  ------------------
  |  Branch (2093:40): [True: 0, False: 13.6k]
  ------------------
 2094|  13.6k|                                           ? ((1 << u1_num_mb_part) - 1)
 2095|  13.6k|                                           : 0;
 2096|  13.6k|            if(ps_svc_slice_params->u1_default_motion_prediction_flag)
  ------------------
  |  Branch (2096:16): [True: 0, False: 13.6k]
  ------------------
 2097|      0|            {
 2098|      0|                pi1_ref_idx[0] = -1;
 2099|      0|                pi1_ref_idx[1] = -1;
 2100|      0|                pi1_ref_idx[2] = -1;
 2101|      0|                pi1_ref_idx[3] = -1;
 2102|      0|            }
 2103|  13.6k|        }
 2104|       |
 2105|       |        /* Decoding reference index 0: For simple profile the following   */
 2106|       |        /* conditions are always true (mb_field_decoding_flag == 0);      */
 2107|       |        /* (MbPartPredMode != PredL1)                                     */
 2108|  15.8k|        if((uc_num_ref_idx_l0_active_minus1 > 0) & (u1_mb_type != PRED_8x8R0))
  ------------------
  |  |  454|  15.8k|#define PRED_8x8R0  4
  ------------------
  |  Branch (2108:12): [True: 30, False: 15.8k]
  ------------------
 2109|     30|        {
 2110|       |            /* force the routine to decode ref idx for each partition */
 2111|       |            /*SVC added motion_prediction_flag to force it to take it only for
 2112|       |             * !motion_pred_flag_l0*/
 2113|       |
 2114|     30|            ret = ih264d_parse_ref_idx_cabac(u1_num_mb_part, 0, uc_num_ref_idx_l0_active_minus1,
 2115|     30|                                             u1_mb_mc_mode, pi1_ref_idx, pi1_left_ref_idx_ctxt_inc,
 2116|     30|                                             pi1_top_ref_idx_ctx_inc_arr, ps_cab_env, ps_bitstrm,
 2117|     30|                                             ps_dec->p_ref_idx_t);
 2118|     30|            if(ret != OK)
  ------------------
  |  |  114|     30|#define OK        0
  ------------------
  |  Branch (2118:16): [True: 0, False: 30]
  ------------------
 2119|      0|            {
 2120|      0|                return ret;
 2121|      0|            }
 2122|     30|        }
 2123|  15.8k|        else
 2124|  15.8k|        {
 2125|       |            /* When there exists only a single frame to predict from */
 2126|  15.8k|            pi1_left_ref_idx_ctxt_inc[0] = 0;
 2127|  15.8k|            pi1_left_ref_idx_ctxt_inc[1] = 0;
 2128|  15.8k|            pi1_top_ref_idx_ctx_inc_arr[0] = 0;
 2129|  15.8k|            pi1_top_ref_idx_ctx_inc_arr[1] = 0;
 2130|  15.8k|            *((UWORD32 *) pi1_ref_idx) = 0;
 2131|  15.8k|        }
 2132|  15.8k|    }
 2133|       |
 2134|  15.8k|    {
 2135|  15.8k|        UWORD8 u1_p_idx;
 2136|  15.8k|        UWORD32 uc_i;
 2137|  15.8k|        parse_part_params_t *ps_part = ps_dec->ps_part;
 2138|  15.8k|        UWORD8 u1_sub_mb_mode, u1_num_subpart, u1_mb_part_width, u1_mb_part_height;
 2139|  15.8k|        UWORD32 u4_sub_mb_num;
 2140|  15.8k|        const UWORD8 *pu1_top_left_sub_mb_indx;
 2141|  15.8k|        mv_pred_t *ps_mv_start = ps_dec->ps_mv_cur + (u4_mb_num << 4);
 2142|  15.8k|        UWORD16 u2_sub_mb_num_pack = 0x028A;
 2143|       |
 2144|       |        /* Loading the table pointers */
 2145|  15.8k|        const UWORD8 *pu1_mb_partw = (const UWORD8 *) gau1_ih264d_mb_partw;
 2146|  15.8k|        const UWORD8 *pu1_mb_parth = (const UWORD8 *) gau1_ih264d_mb_parth;
 2147|  15.8k|        const UWORD8 *pu1_sub_mb_indx_mod =
 2148|  15.8k|            (const UWORD8 *) (gau1_ih264d_submb_indx_mod) + (uc_sub_mb * 6);
 2149|  15.8k|        const UWORD8 *pu1_sub_mb_partw = (const UWORD8 *) gau1_ih264d_submb_partw;
 2150|  15.8k|        const UWORD8 *pu1_sub_mb_parth = (const UWORD8 *) gau1_ih264d_submb_parth;
 2151|  15.8k|        const UWORD8 *pu1_num_sub_mb_part = (const UWORD8 *) gau1_ih264d_num_submb_part;
 2152|       |
 2153|       |        /*********************************************************/
 2154|       |        /* default initialisations for condition (uc_sub_mb == 0) */
 2155|       |        /* i.e. all are subpartitions of 8x8                     */
 2156|       |        /*********************************************************/
 2157|  15.8k|        u1_sub_mb_mode = 0;
 2158|  15.8k|        u1_num_subpart = 1;
 2159|  15.8k|        u1_mb_part_width = pu1_mb_partw[u1_mb_type];
 2160|  15.8k|        u1_mb_part_height = pu1_mb_parth[u1_mb_type];
 2161|  15.8k|        pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_mb_type << 1);
 2162|  15.8k|        u4_sub_mb_num = 0;
 2163|       |
 2164|       |        /* Loop on number of partitions */
 2165|  38.3k|        for(uc_i = 0, u1_p_idx = 0; uc_i < u1_num_mb_part; uc_i++)
  ------------------
  |  Branch (2165:37): [True: 22.5k, False: 15.8k]
  ------------------
 2166|  22.5k|        {
 2167|  22.5k|            UWORD8 uc_j;
 2168|  22.5k|            if(uc_sub_mb)
  ------------------
  |  Branch (2168:16): [True: 7.97k, False: 14.5k]
  ------------------
 2169|  7.97k|            {
 2170|  7.97k|                u1_sub_mb_mode = u4_sub_mb_pack >> 24;
 2171|  7.97k|                u1_num_subpart = pu1_num_sub_mb_part[u1_sub_mb_mode];
 2172|  7.97k|                u1_mb_part_width = pu1_sub_mb_partw[u1_sub_mb_mode];
 2173|  7.97k|                u1_mb_part_height = pu1_sub_mb_parth[u1_sub_mb_mode];
 2174|  7.97k|                pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_sub_mb_mode << 1);
 2175|  7.97k|                u4_sub_mb_num = u2_sub_mb_num_pack >> 12;
 2176|  7.97k|                u4_sub_mb_pack <<= 8;
 2177|  7.97k|                u2_sub_mb_num_pack <<= 4;
 2178|  7.97k|            }
 2179|       |            /* Loop on Number of sub-partitions */
 2180|  54.4k|            for(uc_j = 0; uc_j < u1_num_subpart; uc_j++, pu1_top_left_sub_mb_indx++)
  ------------------
  |  Branch (2180:27): [True: 31.9k, False: 22.5k]
  ------------------
 2181|  31.9k|            {
 2182|  31.9k|                mv_pred_t *ps_mv;
 2183|  31.9k|                u4_sub_mb_num += *pu1_top_left_sub_mb_indx;
 2184|  31.9k|                ps_mv = ps_mv_start + u4_sub_mb_num;
 2185|       |
 2186|       |                /* Storing Info for partitions */
 2187|  31.9k|                ps_part->u1_is_direct = PART_NOT_DIRECT;
  ------------------
  |  |  569|  31.9k|#define PART_NOT_DIRECT                0
  ------------------
 2188|  31.9k|                ps_part->u1_sub_mb_num = u4_sub_mb_num;
 2189|  31.9k|                ps_part->u1_partheight = u1_mb_part_height;
 2190|  31.9k|                ps_part->u1_partwidth = u1_mb_part_width;
 2191|       |
 2192|       |                /* Increment partition Index */
 2193|  31.9k|                u1_p_idx++;
 2194|  31.9k|                ps_part++;
 2195|       |
 2196|  31.9k|                ih264d_get_mvd_cabac(u4_sub_mb_num, 0, u1_mb_part_width, u1_mb_part_height, 1,
 2197|  31.9k|                                     ps_dec, ps_mv);
 2198|  31.9k|            }
 2199|  22.5k|        }
 2200|  15.8k|        ps_parse_mb_data->u1_num_part = u1_p_idx;
 2201|  15.8k|        ps_dec->ps_part = ps_part;
 2202|  15.8k|    }
 2203|       |
 2204|       |    /* update incropwindow*/
 2205|  15.8k|    if(ps_svc_slice_params->u1_adaptive_residual_prediction_flag &&
  ------------------
  |  Branch (2205:8): [True: 0, False: 15.8k]
  ------------------
 2206|      0|       ps_svc_cur_mb_info->u1_crop_window_flag)
  ------------------
  |  Branch (2206:8): [True: 0, False: 0]
  ------------------
 2207|      0|    {
 2208|      0|        ps_svc_cur_mb_info->u1_residual_prediction_flag = ih264d_decode_bin(
 2209|      0|            1, ps_svc_lyr_dec->ps_residual_prediction_flag, ps_bitstrm, ps_cab_env);
 2210|      0|        COPYTHECONTEXT("SVC ext: u1_residual_prediction_flag",
 2211|      0|                       ps_cur_mb_info->u1_residual_prediction_flag);
 2212|      0|    }
 2213|  15.8k|    else
 2214|  15.8k|    {
 2215|       |        /*residual flag inference code */
 2216|  15.8k|        if(1 == ps_svc_cur_mb_info->u1_crop_window_flag)
  ------------------
  |  Branch (2216:12): [True: 15.8k, False: 0]
  ------------------
 2217|  15.8k|        {
 2218|  15.8k|            ps_svc_cur_mb_info->u1_residual_prediction_flag =
 2219|  15.8k|                ps_svc_slice_params->u1_default_residual_prediction_flag;
 2220|  15.8k|        }
 2221|      0|        else
 2222|      0|        {
 2223|      0|            ps_svc_cur_mb_info->u1_residual_prediction_flag = 0;
 2224|      0|        }
 2225|  15.8k|    }
 2226|       |
 2227|  15.8k|    if(ps_svc_slice_params->u1_scan_idx_end >= ps_svc_slice_params->u1_scan_idx_start)
  ------------------
  |  Branch (2227:8): [True: 15.8k, False: 0]
  ------------------
 2228|  15.8k|    {
 2229|  15.8k|        UWORD8 u1_cbp;
 2230|       |        /* Read the Coded block pattern */
 2231|  15.8k|        u1_cbp = (WORD8) ih264d_parse_ctx_cbp_cabac(ps_dec);
 2232|  15.8k|        COPYTHECONTEXT("coded_block_pattern", u1_cbp);
 2233|  15.8k|        ps_cur_mb_info->u1_cbp = u1_cbp;
 2234|  15.8k|        p_curr_ctxt->u1_cbp = u1_cbp;
 2235|  15.8k|        p_curr_ctxt->u1_intra_chroma_pred_mode = 0;
 2236|  15.8k|        p_curr_ctxt->u1_yuv_dc_csbp &= 0xFE;
 2237|  15.8k|        ps_dec->pu1_left_yuv_dc_csbp[0] &= 0x6;
 2238|       |
 2239|  15.8k|        if(u1_cbp > 47) return ERROR_CBP;
  ------------------
  |  Branch (2239:12): [True: 0, False: 15.8k]
  ------------------
 2240|       |
 2241|  15.8k|        ps_cur_mb_info->u1_tran_form8x8 = 0;
 2242|  15.8k|        ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
 2243|       |
 2244|       |        /* Read the transform8x8 u4_flag if present */
 2245|  15.8k|        if((ps_dec->s_high_profile.u1_transform8x8_present) && (u1_cbp & 0xf) &&
  ------------------
  |  Branch (2245:12): [True: 15.8k, False: 30]
  |  Branch (2245:64): [True: 15.6k, False: 189]
  ------------------
 2246|  15.6k|           u1_no_submb_part_size_lt8x8_flag)
  ------------------
  |  Branch (2246:12): [True: 13.7k, False: 1.85k]
  ------------------
 2247|  13.7k|        {
 2248|  13.7k|            ps_cur_mb_info->u1_tran_form8x8 =
 2249|  13.7k|                ih264d_parse_transform8x8flag_cabac(ps_dec, ps_cur_mb_info);
 2250|  13.7k|            COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8);
 2251|  13.7k|            p_curr_ctxt->u1_transform8x8_ctxt = ps_cur_mb_info->u1_tran_form8x8;
 2252|  13.7k|            ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8;
 2253|  13.7k|        }
 2254|  2.07k|        else
 2255|  2.07k|        {
 2256|  2.07k|            p_curr_ctxt->u1_transform8x8_ctxt = 0;
 2257|  2.07k|        }
 2258|       |
 2259|       |        /* Read mb_qp_delta */
 2260|  15.8k|        if(u1_cbp)
  ------------------
  |  Branch (2260:12): [True: 15.7k, False: 103]
  ------------------
 2261|  15.7k|        {
 2262|  15.7k|            WORD8 c_temp;
 2263|  15.7k|            ret = ih264d_parse_mb_qp_delta_cabac(ps_dec, &c_temp);
 2264|  15.7k|            if(ret != OK) return ret;
  ------------------
  |  |  114|  15.7k|#define OK        0
  ------------------
  |  Branch (2264:16): [True: 6, False: 15.7k]
  ------------------
 2265|  15.7k|            COPYTHECONTEXT("mb_qp_delta", c_temp);
 2266|  15.7k|            if(c_temp != 0)
  ------------------
  |  Branch (2266:16): [True: 8.49k, False: 7.23k]
  ------------------
 2267|  8.49k|            {
 2268|  8.49k|                ret = ih264d_update_qp(ps_dec, c_temp);
 2269|  8.49k|                if(ret != OK) return ret;
  ------------------
  |  |  114|  8.49k|#define OK        0
  ------------------
  |  Branch (2269:20): [True: 0, False: 8.49k]
  ------------------
 2270|  8.49k|            }
 2271|  15.7k|        }
 2272|    103|        else
 2273|    103|            ps_dec->i1_prev_mb_qp_delta = 0;
 2274|       |
 2275|       |        /*residual from start to end idx */
 2276|  15.8k|        ih264d_parse_residual4x4_cabac(ps_dec, ps_cur_mb_info, 0);
 2277|  15.8k|        if(EXCEED_OFFSET(ps_dec->ps_bitstrm)) return ERROR_EOB_TERMINATE_T;
  ------------------
  |  |   93|  15.8k|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 136, False: 15.6k]
  |  |  ------------------
  ------------------
 2278|  15.8k|    }
 2279|  15.6k|    return OK;
  ------------------
  |  |  114|  15.6k|#define OK        0
  ------------------
 2280|  15.8k|}
isvcd_parse_pmb_cavlc:
 2296|    385|{
 2297|    385|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 2298|    385|    dec_slice_svc_ext_params_t *ps_svc_slice_params = NULL;
 2299|    385|    UWORD32 u1_num_mb_part;
 2300|    385|    UWORD32 uc_sub_mb;
 2301|    385|    dec_bit_stream_t *const ps_bitstrm = ps_dec->ps_bitstrm;
 2302|    385|    UWORD32 *const pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 2303|    385|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
 2304|    385|    parse_pmbarams_t *ps_parse_mb_data = ps_dec->ps_parse_mb_data + u4_num_mbsNby2;
 2305|    385|    WORD8 *pi1_ref_idx = ps_parse_mb_data->i1_ref_idx[0];
 2306|    385|    const UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
 2307|    385|    const UWORD8 *pu1_num_mb_part = (const UWORD8 *) gau1_ih264d_num_mb_part;
 2308|    385|    UWORD8 *pu1_col_info = ps_parse_mb_data->u1_col_info;
 2309|    385|    UWORD32 u1_mb_type = ps_cur_mb_info->u1_mb_type;
 2310|    385|    UWORD32 u4_sum_mb_mode_pack = 0;
 2311|    385|    WORD32 ret;
 2312|    385|    UWORD8 u1_no_submb_part_size_lt8x8_flag = 1;
 2313|       |
 2314|    385|    ps_svc_slice_params = &ps_svc_lyr_dec->s_svc_slice_params;
 2315|    385|    ps_cur_mb_info->u1_tran_form8x8 = 0;
 2316|    385|    ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0;
 2317|    385|    ps_cur_mb_info->u1_yuv_dc_block_flag = 0;
 2318|    385|    ps_cur_mb_info->u1_mb_mc_mode = u1_mb_type;
 2319|    385|    uc_sub_mb = ((u1_mb_type == PRED_8x8) | (u1_mb_type == PRED_8x8R0));
  ------------------
  |  |  453|    385|#define PRED_8x8    3
  ------------------
                  uc_sub_mb = ((u1_mb_type == PRED_8x8) | (u1_mb_type == PRED_8x8R0));
  ------------------
  |  |  454|    385|#define PRED_8x8R0  4
  ------------------
 2320|       |
 2321|       |    /* Reading the subMB type */
 2322|    385|    if(uc_sub_mb)
  ------------------
  |  Branch (2322:8): [True: 172, False: 213]
  ------------------
 2323|    172|    {
 2324|    172|        WORD32 i;
 2325|    172|        UWORD8 u1_colz = (PRED_8x8 << 6);
  ------------------
  |  |  453|    172|#define PRED_8x8    3
  ------------------
 2326|       |
 2327|    857|        for(i = 0; i < 4; i++)
  ------------------
  |  Branch (2327:20): [True: 688, False: 169]
  ------------------
 2328|    688|        {
 2329|    688|            UWORD32 ui_sub_mb_mode;
 2330|       |
 2331|       |            // Inlined ih264d_uev
 2332|    688|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
 2333|    688|            UWORD32 u4_word, u4_ldz;
 2334|       |
 2335|       |            /***************************************************************/
 2336|       |            /* Find leading zeros in next 32 bits                          */
 2337|       |            /***************************************************************/
 2338|    688|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|    688|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|    688|{                                                                           \
  |  |  152|    688|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|    688|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|    688|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|    688|                                                                            \
  |  |  156|    688|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|    688|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 688, False: 0]
  |  |  ------------------
  |  |  158|    688|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|    688|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|    688|}
  ------------------
 2339|    688|            u4_ldz = CLZ(u4_word);
 2340|       |            /* Flush the ps_bitstrm */
 2341|    688|            u4_bitstream_offset += (u4_ldz + 1);
 2342|       |            /* Read the suffix from the ps_bitstrm */
 2343|    688|            u4_word = 0;
 2344|    688|            if(u4_ldz) GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|    684|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    684|{                                                                           \
  |  |  122|    684|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    684|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    684|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    684|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    684|                                                                            \
  |  |  127|    684|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 684, False: 0]
  |  |  ------------------
  |  |  128|    684|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    684|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    684|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    684|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    684|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    684|}                                                                           \
  ------------------
  |  Branch (2344:16): [True: 684, False: 4]
  ------------------
 2345|    688|            *pu4_bitstrm_ofst = u4_bitstream_offset;
 2346|    688|            ui_sub_mb_mode = ((1 << u4_ldz) + u4_word - 1);
 2347|       |            // Inlined ih264d_uev
 2348|       |
 2349|    688|            if(ui_sub_mb_mode > 3)
  ------------------
  |  Branch (2349:16): [True: 3, False: 685]
  ------------------
 2350|      3|            {
 2351|      3|                return ERROR_SUB_MB_TYPE;
 2352|      3|            }
 2353|    685|            else
 2354|    685|            {
 2355|    685|                u4_sum_mb_mode_pack = (u4_sum_mb_mode_pack << 8) | ui_sub_mb_mode;
 2356|       |                /* Storing collocated information */
 2357|    685|                *pu1_col_info++ = u1_colz | (UWORD8) (ui_sub_mb_mode << 4);
 2358|       |
 2359|    685|                COPYTHECONTEXT("sub_mb_type", ui_sub_mb_mode);
 2360|    685|            }
 2361|       |
 2362|       |            /* check if Motion compensation is done below 8x8 */
 2363|    685|            if(ui_sub_mb_mode != P_L0_8x8)
  ------------------
  |  |  459|    685|#define P_L0_8x8    0
  ------------------
  |  Branch (2363:16): [True: 681, False: 4]
  ------------------
 2364|    681|            {
 2365|    681|                u1_no_submb_part_size_lt8x8_flag = 0;
 2366|    681|            }
 2367|    685|        }
 2368|    169|        u1_num_mb_part = 4;
 2369|    169|    }
 2370|    213|    else
 2371|    213|    {
 2372|    213|        *pu1_col_info++ = (u1_mb_type << 6);
 2373|    213|        if(u1_mb_type) *pu1_col_info++ = (u1_mb_type << 6);
  ------------------
  |  Branch (2373:12): [True: 41, False: 172]
  ------------------
 2374|    213|        u1_num_mb_part = pu1_num_mb_part[u1_mb_type];
 2375|    213|    }
 2376|       |
 2377|       |    /*Adding code to get Motion Prediction Flags*/
 2378|    382|    {
 2379|       |        /*free the scratch buffer once used*/
 2380|    382|        UWORD8 uc_i;
 2381|    382|        UWORD8 *pu1_motion_pred_flag_l0;
 2382|    382|        UWORD8 u1_mvp_flag;
 2383|    382|        UWORD8 uc_field = ps_cur_mb_info->u1_mb_field_decodingflag;
 2384|    382|        UWORD8 uc_num_ref_idx_l0_active_minus1 =
 2385|    382|            (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0] << (u1_mbaff & uc_field)) - 1;
 2386|       |
 2387|    382|        pu1_motion_pred_flag_l0 = &ps_svc_cur_mb_info->au1_motion_pred_flag[0];
 2388|    382|        *pu1_motion_pred_flag_l0 = 0;
 2389|    382|        if(ps_svc_cur_mb_info->u1_crop_window_flag &&
  ------------------
  |  Branch (2389:12): [True: 382, False: 0]
  ------------------
 2390|    382|           ps_svc_slice_params->u1_adaptive_motion_prediction_flag)
  ------------------
  |  Branch (2390:12): [True: 332, False: 50]
  ------------------
 2391|    332|        {
 2392|  1.20k|            for(uc_i = 0; uc_i < u1_num_mb_part; uc_i++)
  ------------------
  |  Branch (2392:27): [True: 873, False: 332]
  ------------------
 2393|    873|            {
 2394|       |                /*usage of bins and ctxt check*/
 2395|    873|                u1_mvp_flag = ih264d_get_bit_h264(ps_bitstrm);
 2396|    873|                COPYTHECONTEXT("SVC ext: ps_motion_prediction_flag_l0", u1_mvp_flag);
 2397|       |
 2398|    873|                *pu1_motion_pred_flag_l0 |= (u1_mvp_flag << uc_i);
 2399|    873|            }
 2400|    332|        }
 2401|     50|        else if(ps_svc_cur_mb_info->u1_crop_window_flag)
  ------------------
  |  Branch (2401:17): [True: 50, False: 0]
  ------------------
 2402|     50|        {
 2403|     50|            *pu1_motion_pred_flag_l0 = ps_svc_slice_params->u1_default_motion_prediction_flag
  ------------------
  |  Branch (2403:40): [True: 39, False: 11]
  ------------------
 2404|     50|                                           ? ((1 << u1_num_mb_part) - 1)
 2405|     50|                                           : 0;
 2406|     50|        }
 2407|       |
 2408|       |        /* Decoding reference index 0: For simple profile the following   */
 2409|       |        /* conditions are always true (mb_field_decoding_flag == 0);      */
 2410|       |        /* (MbPartPredMode != PredL1)                                     */
 2411|    382|        if((uc_num_ref_idx_l0_active_minus1 > 0) & (u1_mb_type != PRED_8x8R0))
  ------------------
  |  |  454|    382|#define PRED_8x8R0  4
  ------------------
  |  Branch (2411:12): [True: 382, False: 0]
  ------------------
 2412|    382|        {
 2413|    382|            if(1 == uc_num_ref_idx_l0_active_minus1)
  ------------------
  |  Branch (2413:16): [True: 337, False: 45]
  ------------------
 2414|    337|                isvcd_parse_pmb_ref_index_cavlc_range1(u1_num_mb_part, ps_bitstrm, pi1_ref_idx,
 2415|    337|                                                       uc_num_ref_idx_l0_active_minus1,
 2416|    337|                                                       pu1_motion_pred_flag_l0);
 2417|     45|            else
 2418|     45|            {
 2419|     45|                ret = isvcd_parse_pmb_ref_index_cavlc(u1_num_mb_part, ps_bitstrm, pi1_ref_idx,
 2420|     45|                                                      uc_num_ref_idx_l0_active_minus1,
 2421|     45|                                                      pu1_motion_pred_flag_l0);
 2422|     45|                if(ret != OK) return ret;
  ------------------
  |  |  114|     45|#define OK        0
  ------------------
  |  Branch (2422:20): [True: 0, False: 45]
  ------------------
 2423|     45|            }
 2424|    382|        }
 2425|      0|        else
 2426|      0|        {
 2427|       |            /* When there exists only a single frame to predict from */
 2428|      0|            UWORD32 uc_i;
 2429|      0|            for(uc_i = 0; uc_i < u1_num_mb_part; uc_i++) /* Storing Reference Idx Information */
  ------------------
  |  Branch (2429:27): [True: 0, False: 0]
  ------------------
 2430|      0|                pi1_ref_idx[uc_i] = 0;
 2431|      0|        }
 2432|    382|    }
 2433|       |
 2434|    382|    {
 2435|    382|        UWORD8 u1_p_idx;
 2436|    382|        UWORD32 uc_i;
 2437|    382|        parse_part_params_t *ps_part = ps_dec->ps_part;
 2438|    382|        UWORD8 u1_sub_mb_mode, u1_num_subpart, u1_mb_part_width, u1_mb_part_height;
 2439|    382|        UWORD32 u4_sub_mb_num;
 2440|    382|        const UWORD8 *pu1_top_left_sub_mb_indx;
 2441|    382|        mv_pred_t *ps_mv, *ps_mv_start = ps_dec->ps_mv_cur + (u4_mb_num << 4);
 2442|       |        /* Loading the table pointers */
 2443|    382|        const UWORD8 *pu1_mb_partw = (const UWORD8 *) gau1_ih264d_mb_partw;
 2444|    382|        const UWORD8 *pu1_mb_parth = (const UWORD8 *) gau1_ih264d_mb_parth;
 2445|    382|        const UWORD8 *pu1_sub_mb_indx_mod =
 2446|    382|            (const UWORD8 *) (gau1_ih264d_submb_indx_mod) + (uc_sub_mb * 6);
 2447|    382|        const UWORD8 *pu1_sub_mb_partw = (const UWORD8 *) gau1_ih264d_submb_partw;
 2448|    382|        const UWORD8 *pu1_sub_mb_parth = (const UWORD8 *) gau1_ih264d_submb_parth;
 2449|    382|        const UWORD8 *pu1_num_sub_mb_part = (const UWORD8 *) gau1_ih264d_num_submb_part;
 2450|    382|        UWORD16 u2_sub_mb_num = 0x028A;
 2451|       |
 2452|       |        /*********************************************************/
 2453|       |        /* default initialisations for condition (uc_sub_mb == 0) */
 2454|       |        /* i.e. all are subpartitions of 8x8                     */
 2455|       |        /*********************************************************/
 2456|    382|        u1_sub_mb_mode = 0;
 2457|    382|        u1_num_subpart = 1;
 2458|    382|        u1_mb_part_width = pu1_mb_partw[u1_mb_type];
 2459|    382|        u1_mb_part_height = pu1_mb_parth[u1_mb_type];
 2460|    382|        pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_mb_type << 1);
 2461|    382|        u4_sub_mb_num = 0;
 2462|       |
 2463|       |        /* Loop on number of partitions */
 2464|  1.31k|        for(uc_i = 0, u1_p_idx = 0; uc_i < u1_num_mb_part; uc_i++)
  ------------------
  |  Branch (2464:37): [True: 930, False: 382]
  ------------------
 2465|    930|        {
 2466|    930|            UWORD8 uc_j;
 2467|    930|            if(uc_sub_mb)
  ------------------
  |  Branch (2467:16): [True: 676, False: 254]
  ------------------
 2468|    676|            {
 2469|    676|                u1_sub_mb_mode = u4_sum_mb_mode_pack >> 24;
 2470|    676|                u1_num_subpart = pu1_num_sub_mb_part[u1_sub_mb_mode];
 2471|    676|                u1_mb_part_width = pu1_sub_mb_partw[u1_sub_mb_mode];
 2472|    676|                u1_mb_part_height = pu1_sub_mb_parth[u1_sub_mb_mode];
 2473|    676|                pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_sub_mb_mode << 1);
 2474|    676|                u4_sub_mb_num = u2_sub_mb_num >> 12;
 2475|    676|                u4_sum_mb_mode_pack <<= 8;
 2476|    676|                u2_sub_mb_num <<= 4;
 2477|    676|            }
 2478|       |            /* Loop on Number of sub-partitions */
 2479|  3.20k|            for(uc_j = 0; uc_j < u1_num_subpart; uc_j++, pu1_top_left_sub_mb_indx++)
  ------------------
  |  Branch (2479:27): [True: 2.27k, False: 930]
  ------------------
 2480|  2.27k|            {
 2481|  2.27k|                WORD16 i2_mvx, i2_mvy;
 2482|  2.27k|                u4_sub_mb_num += *pu1_top_left_sub_mb_indx;
 2483|  2.27k|                ps_mv = ps_mv_start + u4_sub_mb_num;
 2484|       |
 2485|       |                /* Reading the differential Mv from the bitstream */
 2486|       |                // inlining ih264d_sev
 2487|  2.27k|                {
 2488|  2.27k|                    UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
 2489|  2.27k|                    UWORD32 u4_word, u4_ldz, u4_abs_val;
 2490|       |
 2491|       |                    /***************************************************************/
 2492|       |                    /* Find leading zeros in next 32 bits                          */
 2493|       |                    /***************************************************************/
 2494|  2.27k|                    NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|  2.27k|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|  2.27k|{                                                                           \
  |  |  152|  2.27k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|  2.27k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|  2.27k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|  2.27k|                                                                            \
  |  |  156|  2.27k|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|  2.27k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 2.26k, False: 8]
  |  |  ------------------
  |  |  158|  2.27k|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|  2.26k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|  2.27k|}
  ------------------
 2495|  2.27k|                    u4_ldz = CLZ(u4_word);
 2496|       |
 2497|       |                    /* Flush the ps_bitstrm */
 2498|  2.27k|                    u4_bitstream_offset += (u4_ldz + 1);
 2499|       |
 2500|       |                    /* Read the suffix from the ps_bitstrm */
 2501|  2.27k|                    u4_word = 0;
 2502|  2.27k|                    if(u4_ldz) GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|  2.11k|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|  2.11k|{                                                                           \
  |  |  122|  2.11k|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|  2.11k|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|  2.11k|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|  2.11k|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|  2.11k|                                                                            \
  |  |  127|  2.11k|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 2.10k, False: 13]
  |  |  ------------------
  |  |  128|  2.11k|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|  2.10k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|  2.11k|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|  2.11k|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|  2.11k|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|  2.11k|}                                                                           \
  ------------------
  |  Branch (2502:24): [True: 2.11k, False: 161]
  ------------------
 2503|       |
 2504|  2.27k|                    *pu4_bitstrm_ofst = u4_bitstream_offset;
 2505|  2.27k|                    u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1;
 2506|       |
 2507|  2.27k|                    if(u4_word & 0x1)
  ------------------
  |  Branch (2507:24): [True: 167, False: 2.10k]
  ------------------
 2508|    167|                        i2_mvx = (-(WORD32) u4_abs_val);
 2509|  2.10k|                    else
 2510|  2.10k|                        i2_mvx = (u4_abs_val);
 2511|  2.27k|                }
 2512|       |                // inlinined ih264d_sev
 2513|  2.27k|                COPYTHECONTEXT("MVD", i2_mvx);
 2514|  2.27k|                i2_mvy = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 2515|  2.27k|                COPYTHECONTEXT("MVD", i2_mvy);
 2516|       |
 2517|       |                /* Storing Info for partitions */
 2518|  2.27k|                ps_part->u1_is_direct = PART_NOT_DIRECT;
  ------------------
  |  |  569|  2.27k|#define PART_NOT_DIRECT                0
  ------------------
 2519|  2.27k|                ps_part->u1_sub_mb_num = u4_sub_mb_num;
 2520|  2.27k|                ps_part->u1_partheight = u1_mb_part_height;
 2521|  2.27k|                ps_part->u1_partwidth = u1_mb_part_width;
 2522|       |
 2523|       |                /* Storing Mv residuals */
 2524|  2.27k|                ps_mv->i2_mv[0] = i2_mvx;
 2525|  2.27k|                ps_mv->i2_mv[1] = i2_mvy;
 2526|       |
 2527|       |                /* Increment partition Index */
 2528|  2.27k|                u1_p_idx++;
 2529|  2.27k|                ps_part++;
 2530|  2.27k|            }
 2531|    930|        }
 2532|    382|        ps_parse_mb_data->u1_num_part = u1_p_idx;
 2533|    382|        ps_dec->ps_part = ps_part;
 2534|    382|    }
 2535|       |
 2536|    382|    if(ps_svc_slice_params->u1_adaptive_residual_prediction_flag &&
  ------------------
  |  Branch (2536:8): [True: 314, False: 68]
  ------------------
 2537|    314|       ps_svc_cur_mb_info->u1_crop_window_flag)
  ------------------
  |  Branch (2537:8): [True: 314, False: 0]
  ------------------
 2538|    314|    {
 2539|    314|        ps_svc_cur_mb_info->u1_residual_prediction_flag = ih264d_get_bit_h264(ps_bitstrm);
 2540|    314|        COPYTHECONTEXT("SVC ext: u1_residual_prediction_flag",
 2541|    314|                       ps_svc_cur_mb_info->u1_residual_prediction_flag);
 2542|    314|    }
 2543|     68|    else
 2544|     68|    {
 2545|       |        /*residual flag inference code */
 2546|     68|        if(1 == ps_svc_cur_mb_info->u1_crop_window_flag)
  ------------------
  |  Branch (2546:12): [True: 68, False: 0]
  ------------------
 2547|     68|        {
 2548|     68|            ps_svc_cur_mb_info->u1_residual_prediction_flag =
 2549|     68|                ps_svc_slice_params->u1_default_residual_prediction_flag;
 2550|     68|        }
 2551|      0|        else
 2552|      0|        {
 2553|      0|            ps_svc_cur_mb_info->u1_residual_prediction_flag = 0;
 2554|      0|        }
 2555|     68|    }
 2556|       |
 2557|    382|    if(ps_svc_slice_params->u1_scan_idx_end >= ps_svc_slice_params->u1_scan_idx_start)
  ------------------
  |  Branch (2557:8): [True: 382, False: 0]
  ------------------
 2558|    382|    {
 2559|    382|        UWORD32 u4_cbp;
 2560|       |        /* Read the Coded block pattern */
 2561|    382|        UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
 2562|    382|        UWORD32 u4_word, u4_ldz;
 2563|       |
 2564|       |        /***************************************************************/
 2565|       |        /* Find leading zeros in next 32 bits                          */
 2566|       |        /***************************************************************/
 2567|    382|        NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|    382|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|    382|{                                                                           \
  |  |  152|    382|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|    382|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|    382|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|    382|                                                                            \
  |  |  156|    382|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|    382|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 380, False: 2]
  |  |  ------------------
  |  |  158|    382|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|    380|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|    382|}
  ------------------
 2568|    382|        u4_ldz = CLZ(u4_word);
 2569|       |        /* Flush the ps_bitstrm */
 2570|    382|        u4_bitstream_offset += (u4_ldz + 1);
 2571|       |        /* Read the suffix from the ps_bitstrm */
 2572|    382|        u4_word = 0;
 2573|    382|        if(u4_ldz) GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|    180|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    180|{                                                                           \
  |  |  122|    180|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    180|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    180|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    180|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    180|                                                                            \
  |  |  127|    180|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 180, False: 0]
  |  |  ------------------
  |  |  128|    180|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    180|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    180|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    180|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    180|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    180|}                                                                           \
  ------------------
  |  Branch (2573:12): [True: 180, False: 202]
  ------------------
 2574|    382|        *pu4_bitstrm_ofst = u4_bitstream_offset;
 2575|    382|        u4_cbp = ((1 << u4_ldz) + u4_word - 1);
 2576|       |
 2577|    382|        if(u4_cbp > 47) return ERROR_CBP;
  ------------------
  |  Branch (2577:12): [True: 0, False: 382]
  ------------------
 2578|       |
 2579|    382|        u4_cbp = *((UWORD8 *) gau1_ih264d_cbp_inter + u4_cbp);
 2580|    382|        COPYTHECONTEXT("coded_block_pattern", u4_cbp);
 2581|    382|        ps_cur_mb_info->u1_cbp = u4_cbp;
 2582|       |
 2583|       |        /* Read the transform8x8 u4_flag if present */
 2584|    382|        if((ps_dec->s_high_profile.u1_transform8x8_present) && (u4_cbp & 0xf) &&
  ------------------
  |  Branch (2584:12): [True: 310, False: 72]
  |  Branch (2584:64): [True: 160, False: 150]
  ------------------
 2585|    160|           u1_no_submb_part_size_lt8x8_flag)
  ------------------
  |  Branch (2585:12): [True: 32, False: 128]
  ------------------
 2586|     32|        {
 2587|     32|            ps_cur_mb_info->u1_tran_form8x8 = ih264d_get_bit_h264(ps_bitstrm);
 2588|     32|            COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8);
 2589|     32|            ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8;
 2590|     32|        }
 2591|       |
 2592|       |        /* Read mb_qp_delta */
 2593|    382|        if(u4_cbp)
  ------------------
  |  Branch (2593:12): [True: 180, False: 202]
  ------------------
 2594|    180|        {
 2595|    180|            WORD32 i_temp;
 2596|    180|            UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst;
 2597|    180|            UWORD32 u4_word, u4_ldz, u4_abs_val;
 2598|       |
 2599|       |            /***************************************************************/
 2600|       |            /* Find leading zeros in next 32 bits                          */
 2601|       |            /***************************************************************/
 2602|    180|            NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf);
  ------------------
  |  |  150|    180|#define     NEXTBITS_32(u4_word, u4_offset, pu4_bitstream)                  \
  |  |  151|    180|{                                                                           \
  |  |  152|    180|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  153|    180|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  154|    180|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  155|    180|                                                                            \
  |  |  156|    180|    u4_word = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  157|    180|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (157:8): [True: 180, False: 0]
  |  |  ------------------
  |  |  158|    180|    u4_word |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));        \
  |  |  ------------------
  |  |  |  |   45|    180|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  159|    180|}
  ------------------
 2603|    180|            u4_ldz = CLZ(u4_word);
 2604|       |
 2605|       |            /* Flush the ps_bitstrm */
 2606|    180|            u4_bitstream_offset += (u4_ldz + 1);
 2607|       |
 2608|       |            /* Read the suffix from the ps_bitstrm */
 2609|    180|            u4_word = 0;
 2610|    180|            if(u4_ldz) GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz);
  ------------------
  |  |  120|    171|#define     GETBITS(u4_code, u4_offset, pu4_bitstream, u4_no_bits)          \
  |  |  121|    171|{                                                                           \
  |  |  122|    171|    UWORD32 *pu4_buf =  (pu4_bitstream);                                    \
  |  |  123|    171|    UWORD32 u4_word_off = ((u4_offset) >> 5);                               \
  |  |  124|    171|    UWORD32 u4_bit_off = (u4_offset) & 0x1F;                                \
  |  |  125|    171|    u4_code = pu4_buf[u4_word_off++] << u4_bit_off;                         \
  |  |  126|    171|                                                                            \
  |  |  127|    171|    if(u4_bit_off)                                                          \
  |  |  ------------------
  |  |  |  Branch (127:8): [True: 171, False: 0]
  |  |  ------------------
  |  |  128|    171|        u4_code |= (pu4_buf[u4_word_off] >> (INT_IN_BITS - u4_bit_off));    \
  |  |  ------------------
  |  |  |  |   45|    171|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  129|    171|    u4_code = u4_code >> (INT_IN_BITS - u4_no_bits);                        \
  |  |  ------------------
  |  |  |  |   45|    171|#define INT_IN_BITS         32
  |  |  ------------------
  |  |  130|    171|    (u4_offset) += u4_no_bits;                                              \
  |  |  131|    171|}                                                                           \
  ------------------
  |  Branch (2610:16): [True: 171, False: 9]
  ------------------
 2611|       |
 2612|    180|            *pu4_bitstrm_ofst = u4_bitstream_offset;
 2613|    180|            u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1;
 2614|       |
 2615|    180|            if(u4_word & 0x1)
  ------------------
  |  Branch (2615:16): [True: 9, False: 171]
  ------------------
 2616|      9|                i_temp = (-(WORD32) u4_abs_val);
 2617|    171|            else
 2618|    171|                i_temp = (u4_abs_val);
 2619|       |
 2620|    180|            if((i_temp < -26) || (i_temp > 25)) return ERROR_INV_RANGE_QP_T;
  ------------------
  |  Branch (2620:16): [True: 1, False: 179]
  |  Branch (2620:34): [True: 0, False: 179]
  ------------------
 2621|       |            // inlinined ih264d_sev
 2622|       |
 2623|    179|            COPYTHECONTEXT("mb_qp_delta", i_temp);
 2624|    179|            if(i_temp)
  ------------------
  |  Branch (2624:16): [True: 170, False: 9]
  ------------------
 2625|    170|            {
 2626|    170|                ret = ih264d_update_qp(ps_dec, (WORD8) i_temp);
 2627|    170|                if(ret != OK) return ret;
  ------------------
  |  |  114|    170|#define OK        0
  ------------------
  |  Branch (2627:20): [True: 0, False: 170]
  ------------------
 2628|    170|            }
 2629|       |
 2630|       |            /*change to support start to end idx*/
 2631|    179|            ret = ih264d_parse_residual4x4_cavlc(ps_dec, ps_cur_mb_info, 0);
 2632|    179|            if(ret != OK) return ret;
  ------------------
  |  |  114|    179|#define OK        0
  ------------------
  |  Branch (2632:16): [True: 2, False: 177]
  ------------------
 2633|    177|            if(EXCEED_OFFSET(ps_bitstrm)) return ERROR_EOB_TERMINATE_T;
  ------------------
  |  |   93|    177|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 2, False: 175]
  |  |  ------------------
  ------------------
 2634|    177|        }
 2635|    202|        else
 2636|    202|        {
 2637|    202|            ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CAVLC);
  ------------------
  |  |  338|    202|#define CAVLC  0
  ------------------
 2638|    202|        }
 2639|    382|    }
 2640|       |
 2641|    377|    return OK;
  ------------------
  |  |  114|    377|#define OK        0
  ------------------
 2642|    382|}
isvcd_mark_err_slice_skip:
 2657|  2.03k|{
 2658|  2.03k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 2659|  2.03k|    WORD32 i2_cur_mb_addr;
 2660|  2.03k|    UWORD32 u1_num_mbs;
 2661|  2.03k|    UWORD32 u1_mb_idx = ps_dec->u4_mb_idx;
 2662|  2.03k|    UWORD32 i2_mb_skip_run;
 2663|  2.03k|    UWORD32 u1_num_mbs_next, u1_end_of_row;
 2664|  2.03k|    const UWORD32 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs;
 2665|  2.03k|    UWORD32 u1_slice_end;
 2666|  2.03k|    UWORD32 u1_tfr_n_mb;
 2667|  2.03k|    UWORD32 u1_decode_nmb;
 2668|  2.03k|    dec_slice_params_t *ps_slice = ps_dec->ps_cur_slice;
 2669|  2.03k|    deblk_mb_t *ps_cur_deblk_mb;
 2670|  2.03k|    dec_mb_info_t *ps_cur_mb_info;
 2671|  2.03k|    dec_svc_mb_info_t *ps_svc_cur_mb_info;
 2672|  2.03k|    parse_pmbarams_t *ps_parse_mb_data;
 2673|  2.03k|    UWORD32 u1_inter_mb_type;
 2674|  2.03k|    UWORD32 u1_deblk_mb_type;
 2675|  2.03k|    UWORD32 u1_mbaff;
 2676|  2.03k|    parse_part_params_t *ps_part_info;
 2677|  2.03k|    WORD32 ret;
 2678|  2.03k|    UNUSED(u1_is_idr_slice);
  ------------------
  |  |   45|  2.03k|#define UNUSED(x) ((void)(x))
  ------------------
 2679|       |
 2680|  2.03k|    ps_svc_lyr_dec->u1_error_in_cur_frame = 1;
 2681|  2.03k|    if(ps_dec->ps_dec_err_status->u1_err_flag & REJECT_CUR_PIC)
  ------------------
  |  |  601|  2.03k|#define REJECT_CUR_PIC    (0x01)
  ------------------
  |  Branch (2681:8): [True: 0, False: 2.03k]
  ------------------
 2682|      0|    {
 2683|      0|        ih264d_err_pic_dispbuf_mgr(ps_dec);
 2684|      0|        return 0;
 2685|      0|    }
 2686|       |
 2687|  2.03k|    if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag && (num_mb_skip & 1))
  ------------------
  |  Branch (2687:8): [True: 0, False: 2.03k]
  |  Branch (2687:53): [True: 0, False: 0]
  ------------------
 2688|      0|    {
 2689|      0|        num_mb_skip++;
 2690|      0|    }
 2691|  2.03k|    ps_dec->ps_dpb_cmds->u1_long_term_reference_flag = 0;
 2692|  2.03k|    if(prev_slice_err == 1)
  ------------------
  |  Branch (2692:8): [True: 1.08k, False: 952]
  ------------------
 2693|  1.08k|    {
 2694|       |        /* first slice - missing/header corruption */
 2695|  1.08k|        ps_dec->ps_cur_slice->u2_frame_num = u2_frame_num;
 2696|  1.08k|        {
 2697|  1.08k|            WORD32 i, j, poc = 0;
 2698|  1.08k|            ps_dec->ps_cur_slice->u2_first_mb_in_slice = 0;
 2699|  1.08k|            ps_dec->pf_mvpred = ih264d_mvpred_nonmbaff;
 2700|  1.08k|            ps_dec->p_form_mb_part_info = ih264d_form_mb_part_info_bp;
 2701|  1.08k|            ps_dec->p_motion_compensate = ih264d_motion_compensate_bp;
 2702|       |
 2703|  1.08k|            if(ps_dec->ps_cur_pic != NULL)
  ------------------
  |  Branch (2703:16): [True: 1.08k, False: 0]
  ------------------
 2704|  1.08k|            {
 2705|  1.08k|                poc = ps_dec->ps_cur_pic->i4_poc;
 2706|  1.08k|                if(poc <= INT32_MAX - 2) poc += 2;
  ------------------
  |  Branch (2706:20): [True: 1.08k, False: 0]
  ------------------
 2707|  1.08k|            }
 2708|       |
 2709|  1.08k|            j = -1;
 2710|  1.31k|            for(i = 0; i < MAX_NUM_PIC_PARAMS; i++)
  ------------------
  |  |  524|  1.31k|#define MAX_NUM_PIC_PARAMS 256
  ------------------
  |  Branch (2710:24): [True: 1.31k, False: 0]
  ------------------
 2711|  1.31k|            {
 2712|  1.31k|                if(ps_dec->ps_pps[i].u1_is_valid == TRUE)
  ------------------
  |  |  591|  1.31k|#define TRUE    1
  ------------------
  |  Branch (2712:20): [True: 1.08k, False: 232]
  ------------------
 2713|  1.08k|                {
 2714|  1.08k|                    if(ps_dec->ps_pps[i].ps_sps->u1_is_valid == TRUE)
  ------------------
  |  |  591|  1.08k|#define TRUE    1
  ------------------
  |  Branch (2714:24): [True: 1.08k, False: 0]
  ------------------
 2715|  1.08k|                    {
 2716|  1.08k|                        j = i;
 2717|  1.08k|                        break;
 2718|  1.08k|                    }
 2719|  1.08k|                }
 2720|  1.31k|            }
 2721|       |
 2722|       |            // if valid SPS PPS is not found return error
 2723|  1.08k|            if(j == -1)
  ------------------
  |  Branch (2723:16): [True: 0, False: 1.08k]
  ------------------
 2724|      0|            {
 2725|      0|                return ERROR_INV_SLICE_HDR_T;
 2726|      0|            }
 2727|       |
 2728|       |            /* call ih264d_start_of_pic only if it was not called earlier*/
 2729|  1.08k|            if(ps_dec->u4_pic_buf_got == 0)
  ------------------
  |  Branch (2729:16): [True: 0, False: 1.08k]
  ------------------
 2730|      0|            {
 2731|       |                // initialize slice params required by isvcd_start_of_pic to valid values
 2732|      0|                ps_dec->ps_cur_slice->u1_slice_type = P_SLICE;
  ------------------
  |  |  368|      0|#define P_SLICE  0
  ------------------
 2733|      0|                ps_dec->ps_cur_slice->u1_nal_ref_idc = 1;
 2734|      0|                ps_dec->ps_cur_slice->u1_nal_unit_type = 1;
 2735|      0|                ret = isvcd_start_of_pic(ps_svc_lyr_dec, poc, ps_cur_poc,
 2736|      0|                                         ps_dec->ps_cur_slice->u2_frame_num, &ps_dec->ps_pps[j]);
 2737|       |
 2738|      0|                if(ret != OK)
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (2738:20): [True: 0, False: 0]
  ------------------
 2739|      0|                {
 2740|      0|                    return ret;
 2741|      0|                }
 2742|       |                /*inter layer buffer intialization */
 2743|      0|                ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb =
 2744|      0|                    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start;
 2745|      0|                ps_svc_lyr_dec->ps_il_pred_mv_bank_buf_cur_mb =
 2746|      0|                    ps_svc_lyr_dec->ps_il_pred_mv_bank_buf_base;
 2747|      0|            }
 2748|       |
 2749|  1.08k|            ps_dec->ps_ref_pic_buf_lx[0][0]->u1_pic_buf_id = 0;
 2750|  1.08k|            ps_dec->u4_output_present = 0;
 2751|       |
 2752|  1.08k|            {
 2753|  1.08k|                ih264d_get_next_display_field(ps_dec, ps_dec->ps_out_buffer, &(ps_dec->s_disp_op));
 2754|       |                /* If error code is non-zero then there is no buffer available for
 2755|       |                display, hence avoid format conversion */
 2756|       |
 2757|  1.08k|                if(0 != ps_dec->s_disp_op.u4_error_code)
  ------------------
  |  Branch (2757:20): [True: 1.04k, False: 44]
  ------------------
 2758|  1.04k|                {
 2759|  1.04k|                    ps_dec->u4_output_present = 0;
 2760|  1.04k|                    ps_dec->u4_fmt_conv_cur_row = ps_dec->s_disp_frame_info.u4_y_ht;
 2761|  1.04k|                }
 2762|     44|                else
 2763|     44|                    ps_dec->u4_output_present = 1;
 2764|  1.08k|            }
 2765|       |
 2766|  1.08k|            if(ps_dec->u1_separate_parse == 1)
  ------------------
  |  Branch (2766:16): [True: 268, False: 817]
  ------------------
 2767|    268|            {
 2768|       |#ifdef KEEP_THREADS_ACTIVE
 2769|       |                ret = ithread_mutex_lock(ps_dec->apv_proc_start_mutex[0]);
 2770|       |                RETURN_IF((ret != IV_SUCCESS), ret);
 2771|       |
 2772|       |                ps_dec->ai4_process_start[0] = PROC_START;
 2773|       |                ret = ithread_cond_signal(ps_dec->apv_proc_start_condition[0]);
 2774|       |                RETURN_IF((ret != IV_SUCCESS), ret);
 2775|       |
 2776|       |                ret = ithread_mutex_unlock(ps_dec->apv_proc_start_mutex[0]);
 2777|       |                RETURN_IF((ret != IV_SUCCESS), ret);
 2778|       |#endif
 2779|       |#ifdef KEEP_THREADS_ACTIVE
 2780|       |                if(ps_dec->u4_bs_deblk_thread_created)
 2781|       |                {
 2782|       |                    ret = ithread_mutex_lock(ps_dec->apv_proc_start_mutex[1]);
 2783|       |                    RETURN_IF((ret != IV_SUCCESS), ret);
 2784|       |
 2785|       |                    ps_dec->ai4_process_start[1] = PROC_START;
 2786|       |                    ret = ithread_cond_signal(ps_dec->apv_proc_start_condition[1]);
 2787|       |                    RETURN_IF((ret != IV_SUCCESS), ret);
 2788|       |
 2789|       |                    ret = ithread_mutex_unlock(ps_dec->apv_proc_start_mutex[1]);
 2790|       |                    RETURN_IF((ret != IV_SUCCESS), ret);
 2791|       |                }
 2792|       |#endif
 2793|    268|            }
 2794|  1.08k|        }
 2795|  1.08k|    }
 2796|    952|    else
 2797|    952|    {
 2798|       |        // Middle / last slice
 2799|    952|        dec_slice_struct_t *ps_parse_cur_slice;
 2800|    952|        ps_parse_cur_slice = ps_dec->ps_dec_slice_buf + ps_dec->u2_cur_slice_num;
 2801|       |
 2802|    952|        if(ps_dec->u1_slice_header_done && ps_parse_cur_slice == ps_dec->ps_parse_cur_slice)
  ------------------
  |  Branch (2802:12): [True: 946, False: 6]
  |  Branch (2802:44): [True: 946, False: 0]
  ------------------
 2803|    946|        {
 2804|       |            // Slice data corrupted
 2805|       |            // in the case of mbaff, conceal from the even mb.
 2806|    946|            if((ps_dec->ps_cur_slice->u1_mbaff_frame_flag) && (ps_dec->u4_num_mbs_cur_nmb & 1))
  ------------------
  |  Branch (2806:16): [True: 0, False: 946]
  |  Branch (2806:63): [True: 0, False: 0]
  ------------------
 2807|      0|            {
 2808|      0|                ps_dec->u4_num_mbs_cur_nmb = ps_dec->u4_num_mbs_cur_nmb - 1;
 2809|      0|                ps_dec->u4_cur_mb_addr--;
 2810|      0|            }
 2811|       |
 2812|    946|            u1_num_mbs = ps_dec->u4_num_mbs_cur_nmb;
 2813|    946|            if(u1_num_mbs)
  ------------------
  |  Branch (2813:16): [True: 479, False: 467]
  ------------------
 2814|    479|            {
 2815|    479|                ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs - 1;
 2816|    479|            }
 2817|    467|            else
 2818|    467|            {
 2819|    467|                if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (2819:20): [True: 138, False: 329]
  ------------------
 2820|    138|                {
 2821|    138|                    ps_cur_mb_info = ps_dec->ps_nmb_info;
 2822|    138|                }
 2823|    329|                else
 2824|    329|                {
 2825|    329|                    ps_cur_mb_info = ps_dec->ps_nmb_info + ps_dec->u4_num_mbs_prev_nmb - 1;
 2826|    329|                }
 2827|    467|            }
 2828|       |
 2829|    946|            ps_dec->u2_mby = ps_cur_mb_info->u2_mby;
 2830|    946|            ps_dec->u2_mbx = ps_cur_mb_info->u2_mbx;
 2831|    946|            ps_dec->u1_mb_ngbr_availablity = ps_cur_mb_info->u1_mb_ngbr_availablity;
 2832|       |
 2833|    946|            if(u1_num_mbs)
  ------------------
  |  Branch (2833:16): [True: 479, False: 467]
  ------------------
 2834|    479|            {
 2835|       |                // Going back 1 mb
 2836|    479|                ps_dec->pv_parse_tu_coeff_data = ps_dec->pv_prev_mb_parse_tu_coeff_data;
 2837|    479|                ps_dec->u4_cur_mb_addr--;
 2838|    479|                ps_dec->i4_submb_ofst -= SUB_BLK_SIZE;
  ------------------
  |  |  562|    479|#define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|    479|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  |  |               #define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|    479|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  ------------------
 2839|       |
 2840|       |                // Parse/decode N-MB left unparsed
 2841|    479|                if(ps_dec->u1_pr_sl_type == P_SLICE || ps_dec->u1_pr_sl_type == B_SLICE)
  ------------------
  |  |  368|    958|#define P_SLICE  0
  ------------------
                              if(ps_dec->u1_pr_sl_type == P_SLICE || ps_dec->u1_pr_sl_type == B_SLICE)
  ------------------
  |  |  369|    278|#define B_SLICE  1
  ------------------
  |  Branch (2841:20): [True: 201, False: 278]
  |  Branch (2841:56): [True: 271, False: 7]
  ------------------
 2842|    472|                {
 2843|    472|                    if((ps_dec->i4_submb_ofst - ((WORD32) ((u1_num_mbs - u1_mb_idx) << 4))) < 0)
  ------------------
  |  Branch (2843:24): [True: 0, False: 472]
  ------------------
 2844|      0|                    {
 2845|      0|                        ps_dec->i4_submb_ofst = ((u1_num_mbs - u1_mb_idx) << 4);
 2846|      0|                    }
 2847|       |
 2848|    472|                    ret = ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs);
 2849|    472|                    ps_dec->ps_part = ps_dec->ps_parse_part_params;
 2850|    472|                    if(ret != OK) return ret;
  ------------------
  |  |  114|    472|#define OK        0
  ------------------
  |  Branch (2850:24): [True: 0, False: 472]
  ------------------
 2851|    472|                }
 2852|       |
 2853|    479|                u1_num_mbs_next = i2_pic_wdin_mbs - ps_dec->u2_mbx - 1;
 2854|    479|                u1_end_of_row =
 2855|    479|                    (!u1_num_mbs_next) &&
  ------------------
  |  Branch (2855:21): [True: 0, False: 479]
  ------------------
 2856|      0|                    (!(ps_dec->ps_cur_slice->u1_mbaff_frame_flag && (u1_num_mbs & 0x01)));
  ------------------
  |  Branch (2856:24): [True: 0, False: 0]
  |  Branch (2856:69): [True: 0, False: 0]
  ------------------
 2857|    479|                u1_slice_end = 1;
 2858|    479|                u1_tfr_n_mb = 1;
 2859|    479|                ps_cur_mb_info->u1_end_of_slice = u1_slice_end;
 2860|       |
 2861|    479|                if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (2861:20): [True: 182, False: 297]
  ------------------
 2862|    182|                {
 2863|    182|                    ih264d_parse_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next,
 2864|    182|                                         u1_tfr_n_mb, u1_end_of_row);
 2865|    182|                    ps_dec->ps_nmb_info += u1_num_mbs;
 2866|    182|                    ps_svc_lyr_dec->ps_svc_nmb_info += u1_num_mbs;
 2867|    182|                }
 2868|    297|                else
 2869|    297|                {
 2870|    297|                    ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next,
 2871|    297|                                                u1_tfr_n_mb, u1_end_of_row);
 2872|    297|                }
 2873|    479|                ps_dec->u4_total_mbs_coded += u1_num_mbs;
 2874|    479|                ps_dec->u4_mb_idx = 0;
 2875|    479|                ps_dec->u4_num_mbs_cur_nmb = 0;
 2876|    479|            }
 2877|       |
 2878|    946|            if(ps_dec->u4_total_mbs_coded >= ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs)
  ------------------
  |  Branch (2878:16): [True: 0, False: 946]
  ------------------
 2879|      0|            {
 2880|      0|                ps_dec->u1_pic_decode_done = 1;
 2881|      0|                return 0;
 2882|      0|            }
 2883|       |
 2884|       |            /* Inserting new slice only if the current slice has atleast 1 MB*/
 2885|    946|            if(ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice <
  ------------------
  |  Branch (2885:16): [True: 946, False: 0]
  ------------------
 2886|    946|               (UWORD32) (ps_dec->u4_total_mbs_coded >> ps_slice->u1_mbaff_frame_flag))
 2887|    946|            {
 2888|    946|                ps_dec->i2_prev_slice_mbx = ps_dec->u2_mbx;
 2889|    946|                ps_dec->i2_prev_slice_mby = ps_dec->u2_mby;
 2890|    946|                ps_dec->u2_cur_slice_num++;
 2891|    946|                ps_dec->ps_parse_cur_slice++;
 2892|    946|            }
 2893|    946|        }
 2894|      6|        else
 2895|      6|        {
 2896|       |            // Slice missing / header corrupted
 2897|      6|            ps_dec->ps_parse_cur_slice = ps_dec->ps_dec_slice_buf + ps_dec->u2_cur_slice_num;
 2898|      6|        }
 2899|    952|    }
 2900|       |
 2901|       |    /******************************************************/
 2902|       |    /* Initializations to new slice                       */
 2903|       |    /******************************************************/
 2904|  2.03k|    {
 2905|  2.03k|        WORD32 num_entries;
 2906|  2.03k|        WORD32 size;
 2907|  2.03k|        UWORD8 *pu1_buf;
 2908|       |
 2909|  2.03k|        num_entries = MAX_FRAMES;
  ------------------
  |  |  600|  2.03k|#define MAX_FRAMES              16
  ------------------
 2910|  2.03k|        if((1 >= ps_dec->ps_cur_sps->u1_num_ref_frames) && (0 == ps_dec->i4_display_delay))
  ------------------
  |  Branch (2910:12): [True: 1.25k, False: 780]
  |  Branch (2910:60): [True: 0, False: 1.25k]
  ------------------
 2911|      0|        {
 2912|      0|            num_entries = 1;
 2913|      0|        }
 2914|  2.03k|        num_entries = ((2 * num_entries) + 1);
 2915|  2.03k|        num_entries *= 2;
 2916|       |
 2917|  2.03k|        size = num_entries * sizeof(void *);
 2918|  2.03k|        size += PAD_MAP_IDX_POC * sizeof(void *);
  ------------------
  |  |  100|  2.03k|#define PAD_MAP_IDX_POC             (1)
  ------------------
 2919|       |
 2920|  2.03k|        pu1_buf = (UWORD8 *) ps_dec->pv_map_ref_idx_to_poc_buf;
 2921|  2.03k|        pu1_buf += size * ps_dec->u2_cur_slice_num;
 2922|  2.03k|        ps_dec->ps_parse_cur_slice->ppv_map_ref_idx_to_poc = (volatile void **) pu1_buf;
 2923|  2.03k|    }
 2924|  2.03k|    u1_mbaff = ps_slice->u1_mbaff_frame_flag;
 2925|  2.03k|    ps_dec->ps_cur_slice->u2_first_mb_in_slice = ps_dec->u4_total_mbs_coded >> u1_mbaff;
 2926|  2.03k|    ps_dec->ps_cur_slice->i1_slice_alpha_c0_offset = 0;
 2927|  2.03k|    ps_dec->ps_cur_slice->i1_slice_beta_offset = 0;
 2928|       |
 2929|  2.03k|    if(ps_dec->ps_cur_slice->u1_field_pic_flag)
  ------------------
  |  Branch (2929:8): [True: 0, False: 2.03k]
  ------------------
 2930|      0|        ps_dec->u2_prv_frame_num = ps_dec->ps_cur_slice->u2_frame_num;
 2931|       |
 2932|  2.03k|    ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice = ps_dec->u4_total_mbs_coded >> u1_mbaff;
 2933|  2.03k|    ps_dec->ps_parse_cur_slice->u2_log2Y_crwd = ps_dec->ps_cur_slice->u2_log2Y_crwd;
 2934|       |
 2935|  2.03k|    if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (2935:8): [True: 588, False: 1.44k]
  ------------------
 2936|    588|    {
 2937|    588|        ps_dec->ps_parse_cur_slice->pv_tu_coeff_data_start = ps_dec->pv_parse_tu_coeff_data;
 2938|    588|    }
 2939|  1.44k|    else
 2940|  1.44k|    {
 2941|  1.44k|        ps_dec->pv_proc_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
 2942|  1.44k|    }
 2943|       |
 2944|       |    /******************************************************/
 2945|       |    /* Initializations specific to P slice                */
 2946|       |    /******************************************************/
 2947|  2.03k|    u1_inter_mb_type = P_MB;
  ------------------
  |  |  419|  2.03k|#define P_MB        2
  ------------------
 2948|  2.03k|    u1_deblk_mb_type = D_INTER_MB;
  ------------------
  |  |  381|  2.03k|#define D_INTER_MB        0
  ------------------
 2949|       |
 2950|  2.03k|    ps_dec->ps_cur_slice->u1_slice_type = P_SLICE;
  ------------------
  |  |  368|  2.03k|#define P_SLICE  0
  ------------------
 2951|  2.03k|    ps_dec->ps_parse_cur_slice->slice_type = P_SLICE;
  ------------------
  |  |  368|  2.03k|#define P_SLICE  0
  ------------------
 2952|  2.03k|    ps_dec->pf_mvpred_ref_tfr_nby2mb = ih264d_mv_pred_ref_tfr_nby2_pmb;
 2953|  2.03k|    ps_dec->ps_part = ps_dec->ps_parse_part_params;
 2954|  2.03k|    ps_dec->u2_mbx =
 2955|  2.03k|        (MOD(ps_dec->ps_cur_slice->u2_first_mb_in_slice - 1, ps_dec->u2_frm_wd_in_mbs));
  ------------------
  |  |   64|  2.03k|#define MOD(x,y) ((x)%(y))
  ------------------
 2956|  2.03k|    ps_dec->u2_mby =
 2957|  2.03k|        (DIV(ps_dec->ps_cur_slice->u2_first_mb_in_slice - 1, ps_dec->u2_frm_wd_in_mbs));
  ------------------
  |  |   65|  2.03k|#define DIV(x,y) ((x)/(y))
  ------------------
 2958|  2.03k|    ps_dec->u2_mby <<= u1_mbaff;
 2959|       |
 2960|       |    /******************************************************/
 2961|       |    /* Parsing / decoding the slice                       */
 2962|       |    /******************************************************/
 2963|  2.03k|    ret = isvcd_parse_interlayer_resamp_func_init(ps_svc_lyr_dec,
 2964|  2.03k|                                                  ps_dec->ps_cur_slice->u2_first_mb_in_slice);
 2965|  2.03k|    ps_dec->u1_slice_header_done = 2;
 2966|       |
 2967|  2.03k|    ps_dec->u1_qp = ps_slice->u1_slice_qp;
 2968|  2.03k|    ih264d_update_qp(ps_dec, 0);
 2969|  2.03k|    u1_mb_idx = ps_dec->u4_mb_idx;
 2970|  2.03k|    ps_parse_mb_data = ps_dec->ps_parse_mb_data;
 2971|  2.03k|    u1_num_mbs = u1_mb_idx;
 2972|  2.03k|    u1_slice_end = 0;
 2973|  2.03k|    u1_tfr_n_mb = 0;
 2974|  2.03k|    u1_decode_nmb = 0;
 2975|  2.03k|    i2_cur_mb_addr = ps_dec->u4_total_mbs_coded;
 2976|  2.03k|    i2_mb_skip_run = num_mb_skip;
 2977|  2.03k|    if(0 == ps_dec->u4_total_mbs_coded)
  ------------------
  |  Branch (2977:8): [True: 1.08k, False: 952]
  ------------------
 2978|  1.08k|    {
 2979|  1.08k|        ps_dec->ps_cur_mb_row = ps_dec->ps_nbr_mb_row;  //[0];
 2980|       |        // Increment by 2 ,so that left mb (mbaff decrements by 2)  will always be valid
 2981|  1.08k|        ps_dec->ps_cur_mb_row += 2;
 2982|  1.08k|        ps_dec->ps_top_mb_row = ps_dec->ps_nbr_mb_row;
 2983|  1.08k|        ps_dec->ps_top_mb_row +=
 2984|  1.08k|            ((ps_dec->u2_frm_wd_in_mbs + 2) << (1 - ps_dec->ps_cur_sps->u1_frame_mbs_only_flag));
 2985|       |        // Increment by 2 ,so that left mb (mbaff decrements by 2)  will always be valid
 2986|  1.08k|        ps_dec->ps_top_mb_row += 2;
 2987|       |
 2988|       |        /* CHANGED CODE */
 2989|  1.08k|        ps_dec->ps_mv_cur = ps_dec->s_cur_pic.ps_mv;
 2990|  1.08k|        ps_dec->ps_mv_left = ps_dec->s_cur_pic.ps_mv;
 2991|  1.08k|        ps_dec->ps_mv_top = ps_dec->ps_mv_top_p[0];
 2992|  1.08k|        ps_dec->ps_deblk_mbn = ps_dec->ps_deblk_pic;
 2993|  1.08k|        ps_dec->ps_mv = ps_dec->s_cur_pic.ps_mv;
 2994|  1.08k|        ps_dec->ps_mv_bank_cur = ps_dec->s_cur_pic.ps_mv;
 2995|  1.08k|        ps_dec->pu1_col_zero_flag = ps_dec->s_cur_pic.pu1_col_zero_flag;
 2996|  1.08k|        ps_dec->ps_part = ps_dec->ps_parse_part_params;
 2997|  1.08k|        ps_dec->pf_mvpred_ref_tfr_nby2mb = isvcd_mv_pred_ref_tfr_nby2_epmb;
 2998|  1.08k|    }
 2999|   501k|    while(!u1_slice_end)
  ------------------
  |  Branch (2999:11): [True: 499k, False: 1.55k]
  ------------------
 3000|   499k|    {
 3001|   499k|        if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u4_max_mb_addr) break;
  ------------------
  |  Branch (3001:12): [True: 479, False: 499k]
  ------------------
 3002|       |
 3003|   499k|        ps_svc_cur_mb_info = ps_svc_lyr_dec->ps_svc_nmb_info + u1_num_mbs;
 3004|   499k|        ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs;
 3005|   499k|        ps_dec->u4_num_mbs_cur_nmb = u1_num_mbs;
 3006|   499k|        ps_cur_mb_info->u1_Mux = 0;
 3007|   499k|        ps_dec->u4_num_pmbair = (u1_num_mbs >> u1_mbaff);
 3008|   499k|        ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u1_num_mbs;
 3009|   499k|        ps_cur_mb_info->u1_end_of_slice = 0;
 3010|       |
 3011|       |        /* Storing Default partition info */
 3012|   499k|        ps_parse_mb_data->u1_num_part = 1;
 3013|   499k|        ps_parse_mb_data->u4_isI_mb = 0;
 3014|       |
 3015|       |        /**************************************************************/
 3016|       |        /* Get the required information for decoding of MB            */
 3017|       |        /**************************************************************/
 3018|       |        /* mb_x, mb_y, neighbor availablity, */
 3019|   499k|        if(u1_mbaff)
  ------------------
  |  Branch (3019:12): [True: 0, False: 499k]
  ------------------
 3020|      0|            ih264d_get_mb_info_cavlc_mbaff(ps_dec, i2_cur_mb_addr, ps_cur_mb_info, i2_mb_skip_run);
 3021|   499k|        else
 3022|   499k|            isvcd_get_mb_info_cavlc_nonmbaff(ps_dec, i2_cur_mb_addr, ps_cur_mb_info,
 3023|   499k|                                             i2_mb_skip_run);
 3024|       |
 3025|   499k|        {
 3026|   499k|            UWORD16 *pu2_res_luma_csbp;
 3027|       |
 3028|       |            /*Pointer assignment for Residual NNZ */
 3029|   499k|            pu2_res_luma_csbp = ps_svc_lyr_dec->pu2_frm_res_luma_csbp + ps_cur_mb_info->u2_mbx;
 3030|   499k|            pu2_res_luma_csbp +=
 3031|   499k|                ps_cur_mb_info->u2_mby * ps_svc_lyr_dec->i4_frm_res_luma_csbp_stride;
 3032|   499k|            *pu2_res_luma_csbp = 0;
 3033|   499k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb =
 3034|   499k|                ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start + ps_cur_mb_info->u2_mbx +
 3035|   499k|                (ps_svc_lyr_dec->u2_inter_lyr_mb_prms_stride * (ps_cur_mb_info->u2_mby));
 3036|   499k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_mb_mode = SVC_INTER_MB;
  ------------------
  |  |  114|   499k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
 3037|   499k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_tx_size =
 3038|   499k|                ps_cur_mb_info->u1_tran_form8x8;
 3039|   499k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u2_luma_nnz = 0;
 3040|   499k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz = 0;
 3041|   499k|        }
 3042|       |
 3043|       |        /* Set the deblocking parameters for this MB */
 3044|   499k|        if(ps_dec->u4_app_disable_deblk_frm == 0)
  ------------------
  |  Branch (3044:12): [True: 499k, False: 0]
  ------------------
 3045|   499k|        {
 3046|   499k|            ih264d_set_deblocking_parameters(ps_cur_deblk_mb, ps_slice,
 3047|   499k|                                             ps_dec->u1_mb_ngbr_availablity,
 3048|   499k|                                             ps_dec->u1_cur_mb_fld_dec_flag);
 3049|   499k|        }
 3050|       |
 3051|       |        /* Set appropriate flags in ps_cur_mb_info and ps_dec */
 3052|   499k|        ps_dec->i1_prev_mb_qp_delta = 0;
 3053|   499k|        ps_dec->u1_sub_mb_num = 0;
 3054|   499k|        ps_cur_mb_info->u1_mb_type = MB_SKIP;
  ------------------
  |  |   59|   499k|#define MB_SKIP 255
  ------------------
 3055|   499k|        ps_cur_mb_info->u1_mb_mc_mode = PRED_16x16;
  ------------------
  |  |  450|   499k|#define PRED_16x16  0
  ------------------
 3056|   499k|        ps_cur_mb_info->u1_cbp = 0;
 3057|       |
 3058|       |        /* set appropriat flags in svc cur MB info */
 3059|   499k|        ps_svc_cur_mb_info->u1_base_mode_flag = 0;
 3060|   499k|        ps_svc_cur_mb_info->u1_residual_prediction_flag = 0;
 3061|   499k|        ps_svc_cur_mb_info->u1_crop_window_flag = 0;
 3062|   499k|        ps_svc_cur_mb_info->au1_motion_pred_flag[0] = 0;
 3063|   499k|        ps_svc_cur_mb_info->au1_motion_pred_flag[1] = 0;
 3064|       |
 3065|       |        /* Storing Skip partition info */
 3066|   499k|        ps_part_info = ps_dec->ps_part;
 3067|   499k|        ps_part_info->u1_is_direct = PART_DIRECT_16x16;
  ------------------
  |  |  571|   499k|#define PART_DIRECT_16x16              2
  ------------------
 3068|   499k|        ps_part_info->u1_sub_mb_num = 0;
 3069|   499k|        ps_dec->ps_part++;
 3070|       |
 3071|       |        /* Update Nnzs */
 3072|   499k|        ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CAVLC);
  ------------------
  |  |  338|   499k|#define CAVLC  0
  ------------------
 3073|       |
 3074|   499k|        ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type;
 3075|   499k|        ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type;
 3076|       |
 3077|   499k|        if(ps_svc_lyr_dec->u1_layer_identifier != TARGET_LAYER)
  ------------------
  |  |  110|   499k|#define TARGET_LAYER 2
  ------------------
  |  Branch (3077:12): [True: 26.0k, False: 473k]
  ------------------
 3078|  26.0k|        {
 3079|  26.0k|            ps_cur_deblk_mb->u1_deblocking_mode = MB_DISABLE_FILTERING;
  ------------------
  |  |   70|  26.0k|#define MB_DISABLE_FILTERING          0x01
  ------------------
 3080|  26.0k|        }
 3081|       |
 3082|   499k|        i2_mb_skip_run--;
 3083|   499k|        ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp;
 3084|       |
 3085|   499k|        if(u1_mbaff)
  ------------------
  |  Branch (3085:12): [True: 0, False: 499k]
  ------------------
 3086|      0|        {
 3087|      0|            ih264d_update_mbaff_left_nnz(ps_dec, ps_cur_mb_info);
 3088|      0|        }
 3089|       |
 3090|       |        /**************************************************************/
 3091|       |        /* Get next Macroblock address                                */
 3092|       |        /**************************************************************/
 3093|   499k|        i2_cur_mb_addr++;
 3094|   499k|        u1_num_mbs++;
 3095|   499k|        ps_parse_mb_data++;
 3096|       |
 3097|       |        /****************************************************************/
 3098|       |        /* Check for End Of Row and other flags that determine when to  */
 3099|       |        /* do DMA setup for N/2-Mb, Decode for N-Mb, and Transfer for   */
 3100|       |        /* N-Mb                                                         */
 3101|       |        /****************************************************************/
 3102|   499k|        u1_num_mbs_next = i2_pic_wdin_mbs - ps_dec->u2_mbx - 1;
 3103|   499k|        u1_end_of_row = (!u1_num_mbs_next) && (!(u1_mbaff && (u1_num_mbs & 0x01)));
  ------------------
  |  Branch (3103:25): [True: 87.8k, False: 411k]
  |  Branch (3103:50): [True: 0, False: 87.8k]
  |  Branch (3103:62): [True: 0, False: 0]
  ------------------
 3104|   499k|        u1_slice_end = !i2_mb_skip_run;
 3105|   499k|        u1_tfr_n_mb = (u1_num_mbs == ps_dec->u4_recon_mb_grp) || u1_end_of_row || u1_slice_end;
  ------------------
  |  Branch (3105:23): [True: 87.1k, False: 412k]
  |  Branch (3105:66): [True: 739, False: 411k]
  |  Branch (3105:83): [True: 5, False: 411k]
  ------------------
 3106|   499k|        u1_decode_nmb = u1_tfr_n_mb || u1_slice_end;
  ------------------
  |  Branch (3106:25): [True: 87.8k, False: 411k]
  |  Branch (3106:40): [True: 0, False: 411k]
  ------------------
 3107|   499k|        ps_cur_mb_info->u1_end_of_slice = u1_slice_end;
 3108|       |
 3109|   499k|        if(u1_decode_nmb)
  ------------------
  |  Branch (3109:12): [True: 87.8k, False: 411k]
  ------------------
 3110|  87.8k|        {
 3111|  87.8k|            if((ps_dec->i4_submb_ofst - ((WORD32) ((u1_num_mbs - u1_mb_idx) << 4))) < 0)
  ------------------
  |  Branch (3111:16): [True: 245, False: 87.6k]
  ------------------
 3112|    245|            {
 3113|    245|                ps_dec->i4_submb_ofst = ((u1_num_mbs - u1_mb_idx) << 4);
 3114|    245|            }
 3115|       |
 3116|  87.8k|            ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs);
 3117|  87.8k|            ps_parse_mb_data = ps_dec->ps_parse_mb_data;
 3118|  87.8k|            ps_dec->ps_part = ps_dec->ps_parse_part_params;
 3119|       |
 3120|  87.8k|            if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (3120:16): [True: 34.5k, False: 53.3k]
  ------------------
 3121|  34.5k|            {
 3122|  34.5k|                ih264d_parse_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next, u1_tfr_n_mb,
 3123|  34.5k|                                     u1_end_of_row);
 3124|  34.5k|                ps_dec->ps_nmb_info += u1_num_mbs;
 3125|  34.5k|                ps_svc_lyr_dec->ps_svc_nmb_info += u1_num_mbs;
 3126|  34.5k|            }
 3127|  53.3k|            else
 3128|  53.3k|            {
 3129|  53.3k|                if(ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER)
  ------------------
  |  |  110|  53.3k|#define TARGET_LAYER 2
  ------------------
  |  Branch (3129:20): [True: 40.3k, False: 12.9k]
  ------------------
 3130|  40.3k|                {
 3131|  40.3k|                    ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next,
 3132|  40.3k|                                                u1_tfr_n_mb, u1_end_of_row);
 3133|  40.3k|                }
 3134|  12.9k|                else
 3135|  12.9k|                {
 3136|  12.9k|                    isvcd_decode_recon_tfr_nmb_base_lyr(ps_svc_lyr_dec, u1_mb_idx, u1_num_mbs,
 3137|  12.9k|                                                        u1_num_mbs_next, u1_tfr_n_mb,
 3138|  12.9k|                                                        u1_end_of_row);
 3139|  12.9k|                }
 3140|  53.3k|            }
 3141|  87.8k|            ps_dec->u4_total_mbs_coded += u1_num_mbs;
 3142|  87.8k|            if(u1_tfr_n_mb) u1_num_mbs = 0;
  ------------------
  |  Branch (3142:16): [True: 87.8k, False: 0]
  ------------------
 3143|  87.8k|            u1_mb_idx = u1_num_mbs;
 3144|  87.8k|            ps_dec->u4_mb_idx = u1_num_mbs;
 3145|  87.8k|        }
 3146|   499k|    }
 3147|       |
 3148|  2.03k|    ps_dec->u4_num_mbs_cur_nmb = 0;
 3149|  2.03k|    ps_dec->ps_cur_slice->u4_mbs_in_slice =
 3150|  2.03k|        i2_cur_mb_addr - ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice;
 3151|       |
 3152|  2.03k|    H264_DEC_DEBUG_PRINT("Mbs in slice: %d\n", ps_dec->ps_cur_slice->u4_mbs_in_slice);
  ------------------
  |  |   39|  2.03k|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
 3153|       |
 3154|       |    /* incremented here only if first slice is inserted */
 3155|  2.03k|    if(ps_dec->u4_first_slice_in_pic != 0)
  ------------------
  |  Branch (3155:8): [True: 0, False: 2.03k]
  ------------------
 3156|      0|    {
 3157|      0|        ps_dec->ps_parse_cur_slice++;
 3158|      0|        ps_dec->u2_cur_slice_num++;
 3159|      0|    }
 3160|       |
 3161|  2.03k|    ps_dec->i2_prev_slice_mbx = ps_dec->u2_mbx;
 3162|  2.03k|    ps_dec->i2_prev_slice_mby = ps_dec->u2_mby;
 3163|       |
 3164|  2.03k|    if(ps_dec->u4_total_mbs_coded >= ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs)
  ------------------
  |  Branch (3164:8): [True: 2.03k, False: 5]
  ------------------
 3165|  2.03k|    {
 3166|  2.03k|        ps_dec->u1_pic_decode_done = 1;
 3167|  2.03k|    }
 3168|       |
 3169|  2.03k|    return 0;
 3170|  2.03k|}
isvcd_parse_interlayer_resamp_func_init:
 3184|  6.12k|{
 3185|  6.12k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 3186|  6.12k|    dec_slice_params_t *ps_slice = ps_dec->ps_cur_slice;
 3187|  6.12k|    WORD32 ret = OK;
  ------------------
  |  |  114|  6.12k|#define OK        0
  ------------------
 3188|  6.12k|    if(ps_svc_lyr_dec->u1_res_init_done == 1)
  ------------------
  |  Branch (3188:8): [True: 2.03k, False: 4.09k]
  ------------------
 3189|  2.03k|        return ret;
 3190|       |
 3191|  4.09k|    if(TARGET_LAYER != ps_svc_lyr_dec->u1_layer_identifier)
  ------------------
  |  |  110|  4.09k|#define TARGET_LAYER 2
  ------------------
  |  Branch (3191:8): [True: 1.77k, False: 2.32k]
  ------------------
 3192|  1.77k|    {
 3193|  1.77k|        ps_slice->u1_disable_dblk_filter_idc = ps_svc_lyr_dec->u1_inter_lyr_disable_dblk_filter_idc;
 3194|  1.77k|        ps_slice->i1_slice_alpha_c0_offset = ps_svc_lyr_dec->i1_inter_lyr_slice_alpha_c0_offset;
 3195|  1.77k|        ps_slice->i1_slice_beta_offset = ps_svc_lyr_dec->i1_inter_lyr_slice_beta_offset;
 3196|  1.77k|    }
 3197|       |
 3198|  4.09k|    if(0 == u2_first_mb_in_slice)
  ------------------
  |  Branch (3198:8): [True: 4.09k, False: 0]
  ------------------
 3199|  4.09k|    {
 3200|  4.09k|        ret = isvcd_populate_res_prms(ps_svc_lyr_dec);
 3201|  4.09k|        if(ret != OK) return NOT_OK;
  ------------------
  |  |  114|  4.09k|#define OK        0
  ------------------
                      if(ret != OK) return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (3201:12): [True: 0, False: 4.09k]
  ------------------
 3202|  4.09k|        isvcd_crop_wnd_flag_res_int(ps_svc_lyr_dec);
 3203|  4.09k|        ret = isvcd_comp_mode_mv_res_init(ps_svc_lyr_dec);
 3204|  4.09k|        if(ret != OK) return NOT_OK;
  ------------------
  |  |  114|  4.09k|#define OK        0
  ------------------
                      if(ret != OK) return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (3204:12): [True: 0, False: 4.09k]
  ------------------
 3205|  4.09k|        ret = isvcd_ii_pred_res_init(ps_svc_lyr_dec);
 3206|  4.09k|        if(ret != OK) return NOT_OK;
  ------------------
  |  |  114|  4.09k|#define OK        0
  ------------------
                      if(ret != OK) return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (3206:12): [True: 0, False: 4.09k]
  ------------------
 3207|  4.09k|        ret = isvcd_intra_resamp_res_init(ps_svc_lyr_dec);
 3208|  4.09k|        if(ret != OK) return NOT_OK;
  ------------------
  |  |  114|  4.09k|#define OK        0
  ------------------
                      if(ret != OK) return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (3208:12): [True: 0, False: 4.09k]
  ------------------
 3209|  4.09k|        ret = isvcd_residual_samp_res_init(ps_svc_lyr_dec);
 3210|  4.09k|        if(ret != OK) return NOT_OK;
  ------------------
  |  |  114|  4.09k|#define OK        0
  ------------------
                      if(ret != OK) return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (3210:12): [True: 0, False: 4.09k]
  ------------------
 3211|       |
 3212|  4.09k|        ps_svc_lyr_dec->u1_res_init_done = 1;
 3213|  4.09k|    }
 3214|       |
 3215|  4.09k|    return ret;
 3216|  4.09k|}
isvcd_parse_pslice:
 3231|  1.67k|{
 3232|  1.67k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 3233|  1.67k|    dec_pic_params_t *ps_pps = ps_dec->ps_cur_pps;
 3234|  1.67k|    dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice;
 3235|  1.67k|    dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm;
 3236|  1.67k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 3237|  1.67k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
 3238|  1.67k|    UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
 3239|  1.67k|    UWORD8 u1_field_pic_flag = ps_cur_slice->u1_field_pic_flag;
 3240|  1.67k|    UWORD64 u8_ref_idx_l0;
 3241|  1.67k|    UWORD32 u4_temp;
 3242|  1.67k|    WORD32 i_temp;
 3243|  1.67k|    WORD32 ret;
 3244|  1.67k|    WORD64 i8_temp;
 3245|       |
 3246|       |    /*--------------------------------------------------------------------*/
 3247|       |    /* Read remaining contents of the slice header                        */
 3248|       |    /*--------------------------------------------------------------------*/
 3249|  1.67k|    {
 3250|  1.67k|        WORD8 *pi1_buf;
 3251|  1.67k|        WORD16 *pi2_mv = ps_dec->s_default_mv_pred.i2_mv;
 3252|  1.67k|        WORD32 *pi4_mv = (WORD32 *) pi2_mv;
 3253|  1.67k|        WORD16 *pi16_refFrame;
 3254|       |
 3255|  1.67k|        pi1_buf = ps_dec->s_default_mv_pred.i1_ref_frame;
 3256|  1.67k|        pi16_refFrame = (WORD16 *) pi1_buf;
 3257|  1.67k|        *pi4_mv = 0;
 3258|  1.67k|        *(pi4_mv + 1) = 0;
 3259|  1.67k|        *pi16_refFrame = OUT_OF_RANGE_REF;
  ------------------
  |  |   45|  1.67k|#define OUT_OF_RANGE_REF  -1
  ------------------
 3260|  1.67k|        ps_dec->s_default_mv_pred.u1_col_ref_pic_idx = (UWORD8) -1;
 3261|  1.67k|        ps_dec->s_default_mv_pred.u1_pic_type = (UWORD8) -1;
 3262|  1.67k|    }
 3263|       |
 3264|  1.67k|    ps_cur_slice->u1_num_ref_idx_active_override_flag = ih264d_get_bit_h264(ps_bitstrm);
 3265|  1.67k|    COPYTHECONTEXT("SH: num_ref_idx_override_flag",
 3266|  1.67k|                   ps_cur_slice->u1_num_ref_idx_active_override_flag);
 3267|       |
 3268|  1.67k|    u8_ref_idx_l0 = ps_dec->ps_cur_pps->u1_num_ref_idx_lx_active[0];
 3269|  1.67k|    if(ps_cur_slice->u1_num_ref_idx_active_override_flag)
  ------------------
  |  Branch (3269:8): [True: 1.00k, False: 675]
  ------------------
 3270|  1.00k|    {
 3271|  1.00k|        u8_ref_idx_l0 = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf) + (UWORD64) 1;
 3272|  1.00k|    }
 3273|       |
 3274|  1.67k|    {
 3275|  1.67k|        UWORD8 u1_max_ref_idx = H264_MAX_REF_PICS << u1_field_pic_flag;
  ------------------
  |  |  534|  1.67k|#define H264_MAX_REF_PICS         16
  ------------------
 3276|  1.67k|        if(u8_ref_idx_l0 >= u1_max_ref_idx)
  ------------------
  |  Branch (3276:12): [True: 0, False: 1.67k]
  ------------------
 3277|      0|        {
 3278|      0|            return ERROR_NUM_REF;
 3279|      0|        }
 3280|  1.67k|        ps_cur_slice->u1_num_ref_idx_lx_active[0] = (UWORD8) u8_ref_idx_l0;
 3281|  1.67k|        COPYTHECONTEXT("SH: num_ref_idx_l0_active_minus1",
 3282|  1.67k|                       ps_cur_slice->u1_num_ref_idx_lx_active[0] - 1);
 3283|  1.67k|    }
 3284|       |
 3285|      0|    {
 3286|  1.67k|        UWORD8 uc_refIdxReFlagL0 = ih264d_get_bit_h264(ps_bitstrm);
 3287|  1.67k|        COPYTHECONTEXT("SH: ref_pic_list_reordering_flag_l0", uc_refIdxReFlagL0);
 3288|       |
 3289|  1.67k|        ih264d_init_ref_idx_lx_p(ps_dec);
 3290|       |        /* Store the value for future slices in the same picture */
 3291|  1.67k|        ps_dec->u1_num_ref_idx_lx_active_prev = ps_cur_slice->u1_num_ref_idx_lx_active[0];
 3292|       |
 3293|       |        /* Modified temporarily */
 3294|  1.67k|        if(uc_refIdxReFlagL0)
  ------------------
  |  Branch (3294:12): [True: 437, False: 1.24k]
  ------------------
 3295|    437|        {
 3296|    437|            WORD8 ret;
 3297|    437|            ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_mod_dpb[0];
 3298|    437|            ret = ih264d_ref_idx_reordering(ps_dec, 0);
 3299|    437|            if(ret == -1) return ERROR_REFIDX_ORDER_T;
  ------------------
  |  Branch (3299:16): [True: 0, False: 437]
  ------------------
 3300|    437|            ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_mod_dpb[0];
 3301|    437|        }
 3302|  1.24k|        else
 3303|  1.24k|            ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_init_dpb[0];
 3304|  1.67k|    }
 3305|       |    /* Create refIdx to POC mapping */
 3306|  1.67k|    {
 3307|  1.67k|        void **pui_map_ref_idx_to_poc_lx0, **pui_map_ref_idx_to_poc_lx1;
 3308|  1.67k|        WORD8 idx;
 3309|  1.67k|        struct pic_buffer_t *ps_pic;
 3310|       |
 3311|  1.67k|        pui_map_ref_idx_to_poc_lx0 = ps_dec->ppv_map_ref_idx_to_poc + FRM_LIST_L0;
  ------------------
  |  |   89|  1.67k|#define FRM_LIST_L0             0                                               //0
  ------------------
 3312|  1.67k|        pui_map_ref_idx_to_poc_lx0[0] = 0;
 3313|  1.67k|        pui_map_ref_idx_to_poc_lx0++;
 3314|  5.19k|        for(idx = 0; idx < ps_cur_slice->u1_num_ref_idx_lx_active[0]; idx++)
  ------------------
  |  Branch (3314:22): [True: 3.51k, False: 1.67k]
  ------------------
 3315|  3.51k|        {
 3316|  3.51k|            ps_pic = ps_dec->ps_ref_pic_buf_lx[0][idx];
 3317|  3.51k|            pui_map_ref_idx_to_poc_lx0[idx] = (ps_pic->pu1_buf1);
 3318|  3.51k|        }
 3319|       |
 3320|       |        /* Bug Fix Deblocking */
 3321|  1.67k|        pui_map_ref_idx_to_poc_lx1 = ps_dec->ppv_map_ref_idx_to_poc + FRM_LIST_L1;
  ------------------
  |  |   90|  1.67k|#define FRM_LIST_L1             1 * POC_LIST_L0_TO_L1_DIFF//FRM_LIST_L0 + POC_LIST_L0_TO_L1_DIFF        //0+33                  //(1 * POC_LIST_L0_TO_L1_DIFF)
  |  |  ------------------
  |  |  |  |   86|  1.67k|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|  1.67k|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3322|  1.67k|        pui_map_ref_idx_to_poc_lx1[0] = 0;
 3323|       |
 3324|  1.67k|        if(u1_mbaff)
  ------------------
  |  Branch (3324:12): [True: 0, False: 1.67k]
  ------------------
 3325|      0|        {
 3326|      0|            void **ppv_map_ref_idx_to_poc_lx_t, **ppv_map_ref_idx_to_poc_lx_b;
 3327|      0|            void **ppv_map_ref_idx_to_poc_lx_t1, **ppv_map_ref_idx_to_poc_lx_b1;
 3328|      0|            ppv_map_ref_idx_to_poc_lx_t = ps_dec->ppv_map_ref_idx_to_poc + TOP_LIST_FLD_L0;
  ------------------
  |  |   91|      0|#define TOP_LIST_FLD_L0         2 * POC_LIST_L0_TO_L1_DIFF//FRM_LIST_L1 + POC_LIST_L0_TO_L1_DIFF        //0+33+33                   //(2 * POC_LIST_L0_TO_L1_DIFF)
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3329|      0|            ppv_map_ref_idx_to_poc_lx_b = ps_dec->ppv_map_ref_idx_to_poc + BOT_LIST_FLD_L0;
  ------------------
  |  |   93|      0|#define BOT_LIST_FLD_L0         4 * POC_LIST_L0_TO_L1_DIFF//TOP_LIST_FLD_L1 + POC_LIST_L0_TO_L1_DIFF_1  //0+33+33+17+17
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3330|      0|            ppv_map_ref_idx_to_poc_lx_t[0] = 0;
 3331|      0|            ppv_map_ref_idx_to_poc_lx_t++;
 3332|      0|            ppv_map_ref_idx_to_poc_lx_b[0] = 0;
 3333|      0|            ppv_map_ref_idx_to_poc_lx_b++;
 3334|      0|            idx = 0;
 3335|      0|            for(idx = 0; idx < ps_cur_slice->u1_num_ref_idx_lx_active[0]; idx++)
  ------------------
  |  Branch (3335:26): [True: 0, False: 0]
  ------------------
 3336|      0|            {
 3337|      0|                ps_pic = ps_dec->ps_ref_pic_buf_lx[0][idx];
 3338|      0|                ppv_map_ref_idx_to_poc_lx_t[0] = (ps_pic->pu1_buf1);
 3339|      0|                ppv_map_ref_idx_to_poc_lx_b[1] = (ps_pic->pu1_buf1);
 3340|      0|                ppv_map_ref_idx_to_poc_lx_b[0] = (ps_pic->pu1_buf1) + 1;
 3341|      0|                ppv_map_ref_idx_to_poc_lx_t[1] = (ps_pic->pu1_buf1) + 1;
 3342|      0|                ppv_map_ref_idx_to_poc_lx_t += 2;
 3343|      0|                ppv_map_ref_idx_to_poc_lx_b += 2;
 3344|      0|            }
 3345|      0|            ppv_map_ref_idx_to_poc_lx_t1 = ps_dec->ppv_map_ref_idx_to_poc + TOP_LIST_FLD_L1;
  ------------------
  |  |   92|      0|#define TOP_LIST_FLD_L1         3 * POC_LIST_L0_TO_L1_DIFF//TOP_LIST_FLD_L0 + POC_LIST_L0_TO_L1_DIFF_1  //0+33+33+17                //(3 * POC_LIST_L0_TO_L1_DIFF)
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3346|      0|            ppv_map_ref_idx_to_poc_lx_t1[0] = 0;
 3347|      0|            ppv_map_ref_idx_to_poc_lx_b1 = ps_dec->ppv_map_ref_idx_to_poc + BOT_LIST_FLD_L1;
  ------------------
  |  |   94|      0|#define BOT_LIST_FLD_L1         5 * POC_LIST_L0_TO_L1_DIFF//BOT_LIST_FLD_L0 + POC_LIST_L0_TO_L1_DIFF_1  //0+33+33+17+17+17
  |  |  ------------------
  |  |  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3348|      0|            ppv_map_ref_idx_to_poc_lx_b1[0] = 0;
 3349|      0|        }
 3350|  1.67k|    }
 3351|  1.67k|    if(ps_pps->u1_wted_pred_flag)
  ------------------
  |  Branch (3351:8): [True: 895, False: 783]
  ------------------
 3352|    895|    {
 3353|    895|        ret = ih264d_parse_pred_weight_table(ps_cur_slice, ps_bitstrm);
 3354|    895|        if(ret != OK) return ret;
  ------------------
  |  |  114|    895|#define OK        0
  ------------------
  |  Branch (3354:12): [True: 36, False: 859]
  ------------------
 3355|       |
 3356|    859|        ih264d_form_pred_weight_matrix(ps_dec);
 3357|    859|        ps_dec->pu4_wt_ofsts = ps_dec->pu4_wts_ofsts_mat;
 3358|    859|    }
 3359|    783|    else
 3360|    783|    {
 3361|    783|        ps_dec->ps_cur_slice->u2_log2Y_crwd = 0;
 3362|    783|        ps_dec->pu4_wt_ofsts = ps_dec->pu4_wts_ofsts_mat;
 3363|    783|    }
 3364|       |
 3365|  1.64k|    ps_dec->ps_parse_cur_slice->u2_log2Y_crwd = ps_dec->ps_cur_slice->u2_log2Y_crwd;
 3366|       |
 3367|  1.64k|    if(u1_mbaff && (u1_field_pic_flag == 0))
  ------------------
  |  Branch (3367:8): [True: 0, False: 1.64k]
  |  Branch (3367:20): [True: 0, False: 0]
  ------------------
 3368|      0|    {
 3369|      0|        ih264d_convert_frm_mbaff_list(ps_dec);
 3370|      0|    }
 3371|       |
 3372|       |    /* G050 */
 3373|  1.64k|    if(ps_cur_slice->u1_nal_ref_idc != 0)
  ------------------
  |  Branch (3373:8): [True: 1.55k, False: 92]
  ------------------
 3374|  1.55k|    {
 3375|  1.55k|        if(!ps_dec->ps_dpb_cmds->u1_dpb_commands_read)
  ------------------
  |  Branch (3375:12): [True: 1.55k, False: 0]
  ------------------
 3376|  1.55k|        {
 3377|  1.55k|            dec_pic_params_t *ps_pps = ps_dec->ps_cur_pps;
 3378|  1.55k|            dec_seq_params_t *ps_sps_tmp = ps_pps->ps_sps;
 3379|  1.55k|            UWORD8 u1_nal_unit_type_tmp = ps_dec->u1_nal_unit_type;
 3380|       |
 3381|  1.55k|            ps_pps->ps_sps = ps_dec->ps_cur_sps;
 3382|  1.55k|            if(ps_svc_lyr_dec->ps_nal_svc_ext->u1_idr_flag)
  ------------------
  |  Branch (3382:16): [True: 1.50k, False: 45]
  ------------------
 3383|  1.50k|                ps_dec->u1_nal_unit_type = IDR_SLICE_NAL;
  ------------------
  |  |  328|  1.50k|#define IDR_SLICE_NAL                   5
  ------------------
 3384|       |
 3385|  1.55k|            i_temp = ih264d_read_mmco_commands(ps_dec);
 3386|       |
 3387|  1.55k|            ps_pps->ps_sps = ps_sps_tmp;
 3388|  1.55k|            ps_dec->u1_nal_unit_type = u1_nal_unit_type_tmp;
 3389|       |
 3390|  1.55k|            if(i_temp < 0)
  ------------------
  |  Branch (3390:16): [True: 0, False: 1.55k]
  ------------------
 3391|      0|            {
 3392|      0|                return ERROR_DBP_MANAGER_T;
 3393|      0|            }
 3394|  1.55k|            ps_dec->u4_bitoffset = i_temp;
 3395|  1.55k|        }
 3396|      0|        else
 3397|      0|            ps_bitstrm->u4_ofst += ps_dec->u4_bitoffset;
 3398|  1.55k|    }
 3399|       |    /* G050 */
 3400|       |
 3401|  1.64k|    if(ps_pps->u1_entropy_coding_mode == CABAC)
  ------------------
  |  |  339|  1.64k|#define CABAC  1
  ------------------
  |  Branch (3401:8): [True: 823, False: 819]
  ------------------
 3402|    823|    {
 3403|    823|        u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3404|       |
 3405|    823|        if(u4_temp > MAX_CABAC_INIT_IDC)
  ------------------
  |  |  537|    823|#define MAX_CABAC_INIT_IDC        2
  ------------------
  |  Branch (3405:12): [True: 57, False: 766]
  ------------------
 3406|     57|        {
 3407|     57|            return ERROR_INV_SLICE_HDR_T;
 3408|     57|        }
 3409|    766|        ps_cur_slice->u1_cabac_init_idc = u4_temp;
 3410|    766|        COPYTHECONTEXT("SH: cabac_init_idc", ps_cur_slice->u1_cabac_init_idc);
 3411|    766|    }
 3412|       |
 3413|       |    /* Read slice_qp_delta */
 3414|  1.58k|    i8_temp = (WORD64) ps_pps->u1_pic_init_qp + ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3415|  1.58k|    if((i8_temp < MIN_H264_QP) || (i8_temp > MAX_H264_QP))
  ------------------
  |  |  629|  1.58k|#define MIN_H264_QP 0
  ------------------
                  if((i8_temp < MIN_H264_QP) || (i8_temp > MAX_H264_QP))
  ------------------
  |  |  634|  1.57k|#define MAX_H264_QP 51
  ------------------
  |  Branch (3415:8): [True: 14, False: 1.57k]
  |  Branch (3415:35): [True: 106, False: 1.46k]
  ------------------
 3416|    120|    {
 3417|    120|        return ERROR_INV_RANGE_QP_T;
 3418|    120|    }
 3419|  1.46k|    ps_cur_slice->u1_slice_qp = (UWORD8) i8_temp;
 3420|  1.46k|    COPYTHECONTEXT("SH: slice_qp_delta",
 3421|  1.46k|                   (WORD8) (ps_cur_slice->u1_slice_qp - ps_pps->u1_pic_init_qp));
 3422|       |
 3423|  1.46k|    if(ps_pps->u1_deblocking_filter_parameters_present_flag == 1)
  ------------------
  |  Branch (3423:8): [True: 770, False: 695]
  ------------------
 3424|    770|    {
 3425|    770|        u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 3426|    770|        if(u4_temp > SLICE_BOUNDARY_DBLK_DISABLED)
  ------------------
  |  |  547|    770|#define SLICE_BOUNDARY_DBLK_DISABLED  2
  ------------------
  |  Branch (3426:12): [True: 52, False: 718]
  ------------------
 3427|     52|        {
 3428|     52|            return ERROR_INV_SLICE_HDR_T;
 3429|     52|        }
 3430|       |
 3431|    718|        COPYTHECONTEXT("SH: disable_deblocking_filter_idc", u4_temp);
 3432|    718|        ps_cur_slice->u1_disable_dblk_filter_idc = u4_temp;
 3433|    718|        if(u4_temp != 1)
  ------------------
  |  Branch (3433:12): [True: 680, False: 38]
  ------------------
 3434|    680|        {
 3435|    680|            i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf) << 1;
 3436|    680|            if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  550|    680|#define MIN_DBLK_FIL_OFF              -12
  ------------------
                          if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  551|    672|#define MAX_DBLK_FIL_OFF              12
  ------------------
  |  Branch (3436:16): [True: 8, False: 672]
  |  Branch (3436:47): [True: 3, False: 669]
  ------------------
 3437|     11|            {
 3438|     11|                return ERROR_INV_SLICE_HDR_T;
 3439|     11|            }
 3440|    669|            ps_cur_slice->i1_slice_alpha_c0_offset = i_temp;
 3441|    669|            COPYTHECONTEXT("SH: slice_alpha_c0_offset_div2",
 3442|    669|                           ps_cur_slice->i1_slice_alpha_c0_offset >> 1);
 3443|       |
 3444|    669|            i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf) << 1;
 3445|    669|            if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  550|    669|#define MIN_DBLK_FIL_OFF              -12
  ------------------
                          if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF))
  ------------------
  |  |  551|    668|#define MAX_DBLK_FIL_OFF              12
  ------------------
  |  Branch (3445:16): [True: 1, False: 668]
  |  Branch (3445:47): [True: 4, False: 664]
  ------------------
 3446|      5|            {
 3447|      5|                return ERROR_INV_SLICE_HDR_T;
 3448|      5|            }
 3449|    664|            ps_cur_slice->i1_slice_beta_offset = i_temp;
 3450|    664|            COPYTHECONTEXT("SH: slice_beta_offset_div2", ps_cur_slice->i1_slice_beta_offset >> 1);
 3451|    664|        }
 3452|     38|        else
 3453|     38|        {
 3454|     38|            ps_cur_slice->i1_slice_alpha_c0_offset = 0;
 3455|     38|            ps_cur_slice->i1_slice_beta_offset = 0;
 3456|     38|        }
 3457|    718|    }
 3458|    695|    else
 3459|    695|    {
 3460|    695|        ps_cur_slice->u1_disable_dblk_filter_idc = 0;
 3461|    695|        ps_cur_slice->i1_slice_alpha_c0_offset = 0;
 3462|    695|        ps_cur_slice->i1_slice_beta_offset = 0;
 3463|    695|    }
 3464|       |
 3465|  1.39k|    ps_dec->u1_slice_header_done = 2;
 3466|  1.39k|    if(ps_pps->u1_entropy_coding_mode)
  ------------------
  |  Branch (3466:8): [True: 706, False: 691]
  ------------------
 3467|    706|    {
 3468|    706|        SWITCHOFFTRACE;
 3469|    706|        SWITCHONTRACECABAC;
 3470|    706|        ps_svc_lyr_dec->pf_parse_svc_inter_slice = isvcd_parse_inter_slice_data_cabac;
 3471|    706|        ps_dec->pf_parse_inter_mb = ih264d_parse_pmb_cabac;
 3472|    706|        ih264d_init_cabac_contexts(P_SLICE, ps_dec);
  ------------------
  |  |  368|    706|#define P_SLICE  0
  ------------------
 3473|       |
 3474|    706|        if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (3474:12): [True: 0, False: 706]
  ------------------
 3475|      0|            ps_dec->pf_get_mb_info = ih264d_get_mb_info_cabac_mbaff;
 3476|    706|        else
 3477|    706|            ps_dec->pf_get_mb_info = isvcd_get_mb_info_cabac_nonmbaff;
 3478|    706|    }
 3479|    691|    else
 3480|    691|    {
 3481|    691|        SWITCHONTRACE;
 3482|    691|        SWITCHOFFTRACECABAC;
 3483|    691|        ps_svc_lyr_dec->pf_parse_svc_inter_slice = isvcd_parse_inter_slice_data_cavlc;
 3484|    691|        ps_dec->pf_parse_inter_mb = ih264d_parse_pmb_cavlc;
 3485|    691|        if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (3485:12): [True: 0, False: 691]
  ------------------
 3486|      0|        {
 3487|      0|            ps_dec->pf_get_mb_info = ih264d_get_mb_info_cavlc_mbaff;
 3488|      0|        }
 3489|    691|        else
 3490|    691|            ps_dec->pf_get_mb_info = isvcd_get_mb_info_cavlc_nonmbaff;
 3491|    691|    }
 3492|       |
 3493|  1.39k|    ps_dec->u1_B = 0;
 3494|  1.39k|    ps_dec->pf_mvpred_ref_tfr_nby2mb = ih264d_mv_pred_ref_tfr_nby2_pmb;
 3495|  1.39k|    ret = ps_svc_lyr_dec->pf_parse_svc_inter_slice(ps_svc_lyr_dec, ps_cur_slice,
 3496|  1.39k|                                                   u2_first_mb_in_slice);
 3497|  1.39k|    if(ret != OK) return ret;
  ------------------
  |  |  114|  1.39k|#define OK        0
  ------------------
  |  Branch (3497:8): [True: 410, False: 987]
  ------------------
 3498|       |
 3499|    987|    return OK;
  ------------------
  |  |  114|    987|#define OK        0
  ------------------
 3500|  1.39k|}

isvcd_set_default_seq_svc_ext:
   97|  1.54k|{
   98|  1.54k|    ps_seq_svc_ext->u1_inter_layer_deblocking_filter_control_present_flag = 0;
   99|  1.54k|    ps_seq_svc_ext->u1_extended_spatial_scalability_idc = 0;
  100|  1.54k|    ps_seq_svc_ext->u1_chroma_phase_x_plus1_flag = 1;
  101|  1.54k|    ps_seq_svc_ext->u1_chroma_phase_y_plus1 = 1;
  102|  1.54k|    ps_seq_svc_ext->u1_seq_ref_layer_chroma_phase_x_plus1_flag =
  103|  1.54k|        ps_seq_svc_ext->u1_chroma_phase_x_plus1_flag;
  104|  1.54k|    ps_seq_svc_ext->u1_seq_ref_layer_chroma_phase_y_plus1 = ps_seq_svc_ext->u1_chroma_phase_y_plus1;
  105|  1.54k|    ps_seq_svc_ext->i4_seq_scaled_ref_layer_left_offset = 0;
  106|  1.54k|    ps_seq_svc_ext->i4_seq_scaled_ref_layer_top_offset = 0;
  107|  1.54k|    ps_seq_svc_ext->i4_seq_scaled_ref_layer_right_offset = 0;
  108|  1.54k|    ps_seq_svc_ext->i4_seq_scaled_ref_layer_bottom_offset = 0;
  109|  1.54k|    ps_seq_svc_ext->u1_seq_tcoeff_level_prediction_flag =
  110|  1.54k|        ps_seq_svc_ext->u1_adaptive_tcoeff_level_prediction_flag = 0;
  111|  1.54k|    ps_seq_svc_ext->u1_slice_header_restriction_flag = 0;
  112|  1.54k|    ps_seq_svc_ext->u1_svc_vui_parameters_present_flag = 0;
  113|  1.54k|}
isvcd_parse_subset_sps:
  127|  1.86k|{
  128|  1.86k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  129|  1.86k|    UWORD8 i;
  130|  1.86k|    dec_seq_params_t *ps_seq = NULL;
  131|  1.86k|    dec_svc_seq_params_t *ps_subset_seq = NULL;
  132|  1.86k|    dec_subset_seq_params_t *ps_seq_svc_ext;
  133|  1.86k|    UWORD8 u1_profile_idc, u1_level_idc, u1_seq_parameter_set_id, u1_mb_aff_flag = 0;
  134|  1.86k|    UWORD16 i2_max_frm_num;
  135|  1.86k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  136|  1.86k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  137|  1.86k|    UWORD8 u1_frm, uc_constraint_set0_flag, uc_constraint_set1_flag, uc_constraint_set2_flag;
  138|  1.86k|    WORD32 i4_cropped_ht, i4_cropped_wd;
  139|  1.86k|    UWORD32 u4_temp;
  140|  1.86k|    UWORD64 u8_temp;
  141|  1.86k|    UWORD32 u4_pic_height_in_map_units, u4_pic_width_in_mbs;
  142|  1.86k|    UWORD32 u2_pic_wd = 0;
  143|  1.86k|    UWORD32 u2_pic_ht = 0;
  144|  1.86k|    UWORD32 u2_frm_wd_y = 0;
  145|  1.86k|    UWORD32 u2_frm_ht_y = 0;
  146|  1.86k|    UWORD32 u2_frm_wd_uv = 0;
  147|  1.86k|    UWORD32 u2_frm_ht_uv = 0;
  148|  1.86k|    UWORD32 u2_crop_offset_y = 0;
  149|  1.86k|    UWORD32 u2_crop_offset_uv = 0;
  150|  1.86k|    WORD32 ret;
  151|       |    /* High profile related syntax element */
  152|  1.86k|    WORD32 i4_i;
  153|       |    /* G050 */
  154|  1.86k|    UWORD8 u1_frame_cropping_flag,
  155|  1.86k|        u1_frame_cropping_rect_left_ofst = 0, u1_frame_cropping_rect_right_ofst = 0,
  156|  1.86k|        u1_frame_cropping_rect_top_ofst = 0, u1_frame_cropping_rect_bottom_ofst = 0;
  157|       |    /* G050 */
  158|       |    /*--------------------------------------------------------------------*/
  159|       |    /* Decode seq_parameter_set_id and profile and level values           */
  160|       |    /*--------------------------------------------------------------------*/
  161|  1.86k|    SWITCHONTRACE;
  162|  1.86k|    u1_profile_idc = ih264d_get_bits_h264(ps_bitstrm, 8);
  163|  1.86k|    COPYTHECONTEXT("SPS: profile_idc", u1_profile_idc);
  164|       |
  165|       |    /* G050 */
  166|  1.86k|    uc_constraint_set0_flag = ih264d_get_bit_h264(ps_bitstrm);
  167|  1.86k|    uc_constraint_set1_flag = ih264d_get_bit_h264(ps_bitstrm);
  168|  1.86k|    uc_constraint_set2_flag = ih264d_get_bit_h264(ps_bitstrm);
  169|  1.86k|    UNUSED(uc_constraint_set1_flag);
  ------------------
  |  |   45|  1.86k|#define UNUSED(x) ((void)(x))
  ------------------
  170|  1.86k|    UNUSED(uc_constraint_set2_flag);
  ------------------
  |  |   45|  1.86k|#define UNUSED(x) ((void)(x))
  ------------------
  171|       |
  172|       |    /*****************************************************/
  173|       |    /* Read 5 bits for uc_constraint_set3_flag (1 bit)   */
  174|       |    /* and reserved_zero_4bits (4 bits) - Sushant        */
  175|       |    /*****************************************************/
  176|  1.86k|    ih264d_get_bits_h264(ps_bitstrm, 5);
  177|       |    /* G050 */
  178|  1.86k|    u1_level_idc = (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 8);
  179|  1.86k|    COPYTHECONTEXT("SPS: u4_level_idc", u1_level_idc);
  180|       |
  181|  1.86k|    u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  182|  1.86k|    if(u4_temp & MASK_ERR_SEQ_SET_ID) return ERROR_INV_SPS_PPS_T;
  ------------------
  |  |  526|  1.86k|#define MASK_ERR_SEQ_SET_ID   (0xFFFFFFE0)
  ------------------
  |  Branch (182:8): [True: 10, False: 1.85k]
  ------------------
  183|  1.85k|    u1_seq_parameter_set_id = u4_temp;
  184|  1.85k|    COPYTHECONTEXT("SPS: seq_parameter_set_id", u1_seq_parameter_set_id);
  185|       |
  186|  1.85k|    if(u1_seq_parameter_set_id >= MAX_NUM_SEQ_PARAMS) return ERROR_INV_SPS_PPS_T;
  ------------------
  |  |  521|  1.85k|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
  |  Branch (186:8): [True: 0, False: 1.85k]
  ------------------
  187|       |
  188|       |    /*--------------------------------------------------------------------*/
  189|       |    /* Find an seq param entry in seqparam array of decStruct             */
  190|       |    /*--------------------------------------------------------------------*/
  191|  1.85k|    ps_subset_seq = ps_svc_lyr_dec->pv_scratch_subset_sps;
  192|  1.85k|    memset(ps_subset_seq, 0, sizeof(dec_svc_seq_params_t));
  193|  1.85k|    ps_seq = ps_dec->pv_scratch_sps_pps;
  194|  1.85k|    memset(ps_seq, 0, sizeof(dec_seq_params_t));
  195|       |
  196|  1.85k|    ps_seq->u1_profile_idc = u1_profile_idc;
  197|  1.85k|    ps_seq->u1_level_idc = u1_level_idc;
  198|  1.85k|    ps_seq->u1_seq_parameter_set_id = u1_seq_parameter_set_id;
  199|       |
  200|       |    /* subset_seq_sps_will be stored from location 32 : MAX_NUM_SEQ_PARAMS*/
  201|  1.85k|    u1_seq_parameter_set_id += MAX_NUM_SEQ_PARAMS;
  ------------------
  |  |  521|  1.85k|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
  202|  1.85k|    ps_subset_seq->ps_seq = &ps_dec->ps_sps[u1_seq_parameter_set_id];
  203|       |
  204|  1.85k|    if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (204:8): [True: 1.18k, False: 670]
  ------------------
  205|  1.18k|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (205:8): [True: 1.14k, False: 40]
  ------------------
  206|  1.14k|       (ps_dec->ps_sps[u1_seq_parameter_set_id].u1_profile_idc != u1_profile_idc))
  ------------------
  |  Branch (206:8): [True: 255, False: 893]
  ------------------
  207|    255|    {
  208|    255|        ps_dec->u1_res_changed = 1;
  209|    255|        return IVD_RES_CHANGED;
  210|    255|    }
  211|       |
  212|  1.60k|    if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (212:8): [True: 933, False: 670]
  ------------------
  213|    933|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (213:8): [True: 893, False: 40]
  ------------------
  214|    893|       (ps_dec->ps_sps[u1_seq_parameter_set_id].u1_level_idc != u1_level_idc))
  ------------------
  |  Branch (214:8): [True: 0, False: 893]
  ------------------
  215|      0|    {
  216|      0|        ps_dec->u1_res_changed = 1;
  217|      0|        return IVD_RES_CHANGED;
  218|      0|    }
  219|       |    /*******************************************************************/
  220|       |    /* Initializations for high profile - Sushant                      */
  221|       |    /*******************************************************************/
  222|  1.60k|    ps_seq->i4_chroma_format_idc = 1;
  223|  1.60k|    ps_seq->i4_bit_depth_luma_minus8 = 0;
  224|  1.60k|    ps_seq->i4_bit_depth_chroma_minus8 = 0;
  225|  1.60k|    ps_seq->i4_qpprime_y_zero_transform_bypass_flag = 0;
  226|  1.60k|    ps_seq->i4_seq_scaling_matrix_present_flag = 0;
  227|  1.60k|    if(u1_profile_idc == HIGH_PROFILE_IDC || u1_profile_idc == SCALABLE_BASELINE_PROFILE_IDC ||
  ------------------
  |  |  278|  3.20k|#define HIGH_PROFILE_IDC   100
  ------------------
                  if(u1_profile_idc == HIGH_PROFILE_IDC || u1_profile_idc == SCALABLE_BASELINE_PROFILE_IDC ||
  ------------------
  |  |   59|  3.20k|#define SCALABLE_BASELINE_PROFILE_IDC 83
  ------------------
  |  Branch (227:8): [True: 0, False: 1.60k]
  |  Branch (227:46): [True: 790, False: 813]
  ------------------
  228|    813|       u1_profile_idc == SCALABLE_HIGH_PROFILE_IDC)
  ------------------
  |  |   60|    813|#define SCALABLE_HIGH_PROFILE_IDC 86
  ------------------
  |  Branch (228:8): [True: 250, False: 563]
  ------------------
  229|  1.04k|    {
  230|       |        /* reading chroma_format_idc   */
  231|  1.04k|        ps_seq->i4_chroma_format_idc = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  232|       |
  233|       |        /* Monochrome is not supported */
  234|  1.04k|        if(ps_seq->i4_chroma_format_idc != 1)
  ------------------
  |  Branch (234:12): [True: 1, False: 1.03k]
  ------------------
  235|      1|        {
  236|      1|            return ERROR_FEATURE_UNAVAIL;
  237|      1|        }
  238|       |
  239|       |        /* reading bit_depth_luma_minus8   */
  240|  1.03k|        ps_seq->i4_bit_depth_luma_minus8 = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  241|       |
  242|  1.03k|        if(ps_seq->i4_bit_depth_luma_minus8 != 0)
  ------------------
  |  Branch (242:12): [True: 1, False: 1.03k]
  ------------------
  243|      1|        {
  244|      1|            return ERROR_FEATURE_UNAVAIL;
  245|      1|        }
  246|       |
  247|       |        /* reading bit_depth_chroma_minus8   */
  248|  1.03k|        ps_seq->i4_bit_depth_chroma_minus8 = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  249|       |
  250|  1.03k|        if(ps_seq->i4_bit_depth_chroma_minus8 != 0)
  ------------------
  |  Branch (250:12): [True: 2, False: 1.03k]
  ------------------
  251|      2|        {
  252|      2|            return ERROR_FEATURE_UNAVAIL;
  253|      2|        }
  254|       |
  255|       |        /* reading qpprime_y_zero_transform_bypass_flag   */
  256|  1.03k|        ps_seq->i4_qpprime_y_zero_transform_bypass_flag = (WORD32) ih264d_get_bit_h264(ps_bitstrm);
  257|       |
  258|  1.03k|        if(ps_seq->i4_qpprime_y_zero_transform_bypass_flag != 0)
  ------------------
  |  Branch (258:12): [True: 0, False: 1.03k]
  ------------------
  259|      0|        {
  260|      0|            return ERROR_INV_SPS_PPS_T;
  261|      0|        }
  262|       |
  263|       |        /* reading seq_scaling_matrix_present_flag   */
  264|  1.03k|        ps_seq->i4_seq_scaling_matrix_present_flag = (WORD32) ih264d_get_bit_h264(ps_bitstrm);
  265|       |
  266|  1.03k|        if(ps_seq->i4_seq_scaling_matrix_present_flag)
  ------------------
  |  Branch (266:12): [True: 1.02k, False: 16]
  ------------------
  267|  1.02k|        {
  268|  9.17k|            for(i4_i = 0; i4_i < 8; i4_i++)
  ------------------
  |  Branch (268:27): [True: 8.15k, False: 1.01k]
  ------------------
  269|  8.15k|            {
  270|  8.15k|                ps_seq->u1_seq_scaling_list_present_flag[i4_i] = ih264d_get_bit_h264(ps_bitstrm);
  271|       |
  272|       |                /* initialize u1_use_default_scaling_matrix_flag[i4_i] to zero */
  273|       |                /* before calling scaling list                             */
  274|  8.15k|                ps_seq->u1_use_default_scaling_matrix_flag[i4_i] = 0;
  275|       |
  276|  8.15k|                if(ps_seq->u1_seq_scaling_list_present_flag[i4_i])
  ------------------
  |  Branch (276:20): [True: 4.03k, False: 4.11k]
  ------------------
  277|  4.03k|                {
  278|  4.03k|                    if(i4_i < 6)
  ------------------
  |  Branch (278:24): [True: 3.04k, False: 991]
  ------------------
  279|  3.04k|                    {
  280|  3.04k|                        ret = ih264d_scaling_list(ps_seq->i2_scalinglist4x4[i4_i], 16,
  281|  3.04k|                                                  &ps_seq->u1_use_default_scaling_matrix_flag[i4_i],
  282|  3.04k|                                                  ps_bitstrm);
  283|  3.04k|                    }
  284|    991|                    else
  285|    991|                    {
  286|    991|                        ret = ih264d_scaling_list(ps_seq->i2_scalinglist8x8[i4_i - 6], 64,
  287|    991|                                                  &ps_seq->u1_use_default_scaling_matrix_flag[i4_i],
  288|    991|                                                  ps_bitstrm);
  289|    991|                    }
  290|  4.03k|                    if(ret != OK)
  ------------------
  |  |  114|  4.03k|#define OK        0
  ------------------
  |  Branch (290:24): [True: 2, False: 4.03k]
  ------------------
  291|      2|                    {
  292|      2|                        return ret;
  293|      2|                    }
  294|  4.03k|                }
  295|  8.15k|            }
  296|  1.02k|        }
  297|  1.03k|    }
  298|       |    /*--------------------------------------------------------------------*/
  299|       |    /* Decode MaxFrameNum                                                 */
  300|       |    /*--------------------------------------------------------------------*/
  301|  1.59k|    u8_temp = (UWORD64) 4 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  302|  1.59k|    if(u8_temp > MAX_BITS_IN_FRAME_NUM)
  ------------------
  |  |  531|  1.59k|#define MAX_BITS_IN_FRAME_NUM     16
  ------------------
  |  Branch (302:8): [True: 7, False: 1.59k]
  ------------------
  303|      7|    {
  304|      7|        return ERROR_INV_SPS_PPS_T;
  305|      7|    }
  306|  1.59k|    ps_seq->u1_bits_in_frm_num = (UWORD8) u8_temp;
  307|  1.59k|    COPYTHECONTEXT("SPS: log2_max_frame_num_minus4", (ps_seq->u1_bits_in_frm_num - 4));
  308|       |
  309|  1.59k|    i2_max_frm_num = (1 << (ps_seq->u1_bits_in_frm_num));
  310|  1.59k|    ps_seq->u2_u4_max_pic_num_minus1 = i2_max_frm_num - 1;
  311|       |    /*--------------------------------------------------------------------*/
  312|       |    /* Decode picture order count and related values                      */
  313|       |    /*--------------------------------------------------------------------*/
  314|  1.59k|    u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  315|       |
  316|  1.59k|    if(u4_temp > MAX_PIC_ORDER_CNT_TYPE)
  ------------------
  |  |  529|  1.59k|#define MAX_PIC_ORDER_CNT_TYPE    2
  ------------------
  |  Branch (316:8): [True: 5, False: 1.58k]
  ------------------
  317|      5|    {
  318|      5|        return ERROR_INV_POC_TYPE_T;
  319|      5|    }
  320|  1.58k|    ps_seq->u1_pic_order_cnt_type = u4_temp;
  321|  1.58k|    COPYTHECONTEXT("SPS: pic_order_cnt_type", ps_seq->u1_pic_order_cnt_type);
  322|       |
  323|  1.58k|    ps_seq->u1_num_ref_frames_in_pic_order_cnt_cycle = 1;
  324|  1.58k|    if(ps_seq->u1_pic_order_cnt_type == 0)
  ------------------
  |  Branch (324:8): [True: 1.53k, False: 55]
  ------------------
  325|  1.53k|    {
  326|  1.53k|        u8_temp = (UWORD64) 4 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  327|  1.53k|        if(u8_temp > MAX_BITS_IN_POC_LSB)
  ------------------
  |  |  532|  1.53k|#define MAX_BITS_IN_POC_LSB       16
  ------------------
  |  Branch (327:12): [True: 0, False: 1.53k]
  ------------------
  328|      0|        {
  329|      0|            return ERROR_INV_SPS_PPS_T;
  330|      0|        }
  331|  1.53k|        ps_seq->u1_log2_max_pic_order_cnt_lsb_minus = (UWORD8) u8_temp;
  332|  1.53k|        ps_seq->i4_max_pic_order_cntLsb = (1 << u8_temp);
  333|  1.53k|        COPYTHECONTEXT("SPS: log2_max_pic_order_cnt_lsb_minus4", (u8_temp - 4));
  334|  1.53k|    }
  335|     55|    else if(ps_seq->u1_pic_order_cnt_type == 1)
  ------------------
  |  Branch (335:13): [True: 32, False: 23]
  ------------------
  336|     32|    {
  337|     32|        ps_seq->u1_delta_pic_order_always_zero_flag = ih264d_get_bit_h264(ps_bitstrm);
  338|     32|        COPYTHECONTEXT("SPS: delta_pic_order_always_zero_flag",
  339|     32|                       ps_seq->u1_delta_pic_order_always_zero_flag);
  340|       |
  341|     32|        ps_seq->i4_ofst_for_non_ref_pic = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  342|     32|        COPYTHECONTEXT("SPS: offset_for_non_ref_pic", ps_seq->i4_ofst_for_non_ref_pic);
  343|       |
  344|     32|        ps_seq->i4_ofst_for_top_to_bottom_field = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  345|     32|        COPYTHECONTEXT("SPS: offset_for_top_to_bottom_field",
  346|     32|                       ps_seq->i4_ofst_for_top_to_bottom_field);
  347|       |
  348|     32|        u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  349|     32|        if(u4_temp > 255) return ERROR_INV_SPS_PPS_T;
  ------------------
  |  Branch (349:12): [True: 0, False: 32]
  ------------------
  350|     32|        ps_seq->u1_num_ref_frames_in_pic_order_cnt_cycle = u4_temp;
  351|     32|        COPYTHECONTEXT("SPS: num_ref_frames_in_pic_order_cnt_cycle",
  352|     32|                       ps_seq->u1_num_ref_frames_in_pic_order_cnt_cycle);
  353|       |
  354|     33|        for(i = 0; i < ps_seq->u1_num_ref_frames_in_pic_order_cnt_cycle; i++)
  ------------------
  |  Branch (354:20): [True: 1, False: 32]
  ------------------
  355|      1|        {
  356|      1|            ps_seq->i4_ofst_for_ref_frame[i] = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  357|      1|            COPYTHECONTEXT("SPS: offset_for_ref_frame", ps_seq->i4_ofst_for_ref_frame[i]);
  358|      1|        }
  359|     32|    }
  360|       |
  361|  1.58k|    u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  362|       |
  363|  1.58k|    if((u4_temp > H264_MAX_REF_PICS))
  ------------------
  |  |  534|  1.58k|#define H264_MAX_REF_PICS         16
  ------------------
  |  Branch (363:8): [True: 6, False: 1.57k]
  ------------------
  364|      6|    {
  365|      6|        return ERROR_NUM_REF;
  366|      6|    }
  367|       |
  368|       |    /* Compare with older num_ref_frames is header is already once */
  369|  1.57k|    if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (369:8): [True: 927, False: 652]
  ------------------
  370|    927|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (370:8): [True: 891, False: 36]
  ------------------
  371|    891|       (ps_dec->ps_sps[u1_seq_parameter_set_id].u1_num_ref_frames != u4_temp))
  ------------------
  |  Branch (371:8): [True: 0, False: 891]
  ------------------
  372|      0|    {
  373|      0|        ps_dec->u1_res_changed = 1;
  374|      0|        return IVD_RES_CHANGED;
  375|      0|    }
  376|  1.57k|    ps_seq->u1_num_ref_frames = u4_temp;
  377|  1.57k|    COPYTHECONTEXT("SPS: num_ref_frames", ps_seq->u1_num_ref_frames);
  378|       |
  379|  1.57k|    ps_seq->u1_gaps_in_frame_num_value_allowed_flag = ih264d_get_bit_h264(ps_bitstrm);
  380|  1.57k|    COPYTHECONTEXT("SPS: gaps_in_frame_num_value_allowed_flag",
  381|  1.57k|                   ps_seq->u1_gaps_in_frame_num_value_allowed_flag);
  382|       |    /* SVC_DEC_REVIEW */
  383|  1.57k|    ps_seq->u1_gaps_in_frame_num_value_allowed_flag = 0;
  384|       |
  385|       |    /*--------------------------------------------------------------------*/
  386|       |    /* Decode FrameWidth and FrameHeight and related values               */
  387|       |    /*--------------------------------------------------------------------*/
  388|  1.57k|    u8_temp = (UWORD64) 1 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  389|       |    /* Check  for unsupported resolutions*/
  390|  1.57k|    if(u8_temp > (H264_MAX_FRAME_WIDTH >> 4))
  ------------------
  |  |   39|  1.57k|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
  |  Branch (390:8): [True: 12, False: 1.56k]
  ------------------
  391|     12|    {
  392|     12|        return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED;
  393|     12|    }
  394|  1.56k|    u4_pic_width_in_mbs = (UWORD32) u8_temp;
  395|  1.56k|    COPYTHECONTEXT("SPS: pic_width_in_mbs_minus1", u4_pic_width_in_mbs - 1);
  396|       |
  397|  1.56k|    u8_temp = (UWORD64) 1 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  398|  1.56k|    if(u8_temp > (H264_MAX_FRAME_HEIGHT >> 4))
  ------------------
  |  |   40|  1.56k|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
  |  Branch (398:8): [True: 0, False: 1.56k]
  ------------------
  399|      0|    {
  400|      0|        return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED;
  401|      0|    }
  402|  1.56k|    u4_pic_height_in_map_units = (UWORD32) u8_temp;
  403|       |
  404|  1.56k|    ps_seq->u2_frm_wd_in_mbs = u4_pic_width_in_mbs;
  405|  1.56k|    ps_seq->u2_frm_ht_in_mbs = u4_pic_height_in_map_units;
  406|       |
  407|  1.56k|    u2_pic_wd = (u4_pic_width_in_mbs << 4);
  408|  1.56k|    u2_pic_ht = (u4_pic_height_in_map_units << 4);
  409|  1.56k|    if(ps_svc_lyr_dec->pic_width < u2_pic_wd)
  ------------------
  |  Branch (409:8): [True: 65, False: 1.50k]
  ------------------
  410|     65|    {
  411|     65|        ps_svc_lyr_dec->pic_width = u2_pic_wd;
  412|     65|    }
  413|  1.56k|    if(ps_svc_lyr_dec->pic_height < u2_pic_ht)
  ------------------
  |  Branch (413:8): [True: 61, False: 1.50k]
  ------------------
  414|     61|    {
  415|     61|        ps_svc_lyr_dec->pic_height = u2_pic_ht;
  416|     61|    }
  417|       |
  418|       |    /*--------------------------------------------------------------------*/
  419|       |    /* Get the value of MaxMbAddress and Number of bits needed for it     */
  420|       |    /*--------------------------------------------------------------------*/
  421|  1.56k|    ps_seq->u4_max_mb_addr = (ps_seq->u2_frm_wd_in_mbs * ps_seq->u2_frm_ht_in_mbs) - 1;
  422|       |
  423|  1.56k|    ps_seq->u4_total_num_of_mbs = ps_seq->u4_max_mb_addr + 1;
  424|       |
  425|  1.56k|    ps_seq->u1_level_idc = ih264d_correct_level_idc(u1_level_idc, ps_seq->u4_total_num_of_mbs);
  426|       |
  427|  1.56k|    u1_frm = ih264d_get_bit_h264(ps_bitstrm);
  428|       |
  429|  1.56k|    if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (429:8): [True: 927, False: 640]
  ------------------
  430|    927|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (430:8): [True: 891, False: 36]
  ------------------
  431|    891|       (ps_dec->ps_sps[u1_seq_parameter_set_id].u1_frame_mbs_only_flag != u1_frm))
  ------------------
  |  Branch (431:8): [True: 0, False: 891]
  ------------------
  432|      0|    {
  433|      0|        ps_dec->u1_res_changed = 1;
  434|      0|        return IVD_RES_CHANGED;
  435|      0|    }
  436|  1.56k|    ps_seq->u1_frame_mbs_only_flag = u1_frm;
  437|       |
  438|  1.56k|    COPYTHECONTEXT("SPS: frame_mbs_only_flag", u1_frm);
  439|       |
  440|  1.56k|    if(!u1_frm) u1_mb_aff_flag = ih264d_get_bit_h264(ps_bitstrm);
  ------------------
  |  Branch (440:8): [True: 91, False: 1.47k]
  ------------------
  441|  1.56k|    if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (441:8): [True: 927, False: 640]
  ------------------
  442|    927|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (442:8): [True: 891, False: 36]
  ------------------
  443|    891|       (ps_dec->ps_sps[u1_seq_parameter_set_id].u1_mb_aff_flag != u1_mb_aff_flag))
  ------------------
  |  Branch (443:8): [True: 0, False: 891]
  ------------------
  444|      0|    {
  445|      0|        ps_dec->u1_res_changed = 1;
  446|      0|        return IVD_RES_CHANGED;
  447|      0|    }
  448|  1.56k|    if(!u1_frm)
  ------------------
  |  Branch (448:8): [True: 91, False: 1.47k]
  ------------------
  449|     91|    {
  450|     91|        u2_pic_ht <<= 1;
  451|     91|        ps_seq->u1_mb_aff_flag = u1_mb_aff_flag;
  452|     91|        COPYTHECONTEXT("SPS: mb_adaptive_frame_field_flag", ps_seq->u1_mb_aff_flag);
  453|     91|    }
  454|  1.47k|    else
  455|  1.47k|        ps_seq->u1_mb_aff_flag = 0;
  456|       |
  457|  1.56k|    ps_seq->u1_direct_8x8_inference_flag = ih264d_get_bit_h264(ps_bitstrm);
  458|       |
  459|  1.56k|    COPYTHECONTEXT("SPS: direct_8x8_inference_flag", ps_seq->u1_direct_8x8_inference_flag);
  460|       |
  461|       |    /* G050 */
  462|  1.56k|    u1_frame_cropping_flag = ih264d_get_bit_h264(ps_bitstrm);
  463|  1.56k|    COPYTHECONTEXT("SPS: frame_cropping_flag", u1_frame_cropping_flag);
  464|       |
  465|  1.56k|    if(u1_frame_cropping_flag)
  ------------------
  |  Branch (465:8): [True: 1.05k, False: 511]
  ------------------
  466|  1.05k|    {
  467|  1.05k|        u1_frame_cropping_rect_left_ofst = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  468|  1.05k|        COPYTHECONTEXT("SPS: frame_cropping_rect_left_offset", u1_frame_cropping_rect_left_ofst);
  469|  1.05k|        u1_frame_cropping_rect_right_ofst = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  470|  1.05k|        COPYTHECONTEXT("SPS: frame_cropping_rect_right_offset", u1_frame_cropping_rect_right_ofst);
  471|  1.05k|        u1_frame_cropping_rect_top_ofst = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  472|  1.05k|        COPYTHECONTEXT("SPS: frame_cropping_rect_top_offset", u1_frame_cropping_rect_top_ofst);
  473|  1.05k|        u1_frame_cropping_rect_bottom_ofst = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  474|  1.05k|        COPYTHECONTEXT("SPS: frame_cropping_rect_bottom_offset",
  475|  1.05k|                       u1_frame_cropping_rect_bottom_ofst);
  476|  1.05k|    }
  477|       |    /* G050 */
  478|  1.56k|    ps_seq->u1_vui_parameters_present_flag = ih264d_get_bit_h264(ps_bitstrm);
  479|  1.56k|    COPYTHECONTEXT("SPS: vui_parameters_present_flag", ps_seq->u1_vui_parameters_present_flag);
  480|       |
  481|  1.56k|    u2_frm_wd_y = u2_pic_wd + (UWORD8) (PAD_LEN_Y_H << 1);
  ------------------
  |  |  571|  1.56k|#define PAD_LEN_Y_H                   32
  ------------------
  482|  1.56k|    if(1 == ps_dec->u4_share_disp_buf)
  ------------------
  |  Branch (482:8): [True: 0, False: 1.56k]
  ------------------
  483|      0|    {
  484|      0|        if(ps_dec->u4_app_disp_width > u2_frm_wd_y) u2_frm_wd_y = ps_dec->u4_app_disp_width;
  ------------------
  |  Branch (484:12): [True: 0, False: 0]
  ------------------
  485|      0|    }
  486|       |
  487|  1.56k|    u2_frm_ht_y = u2_pic_ht + (UWORD8) (PAD_LEN_Y_V << 2);
  ------------------
  |  |  572|  1.56k|#define PAD_LEN_Y_V                   20
  ------------------
  488|  1.56k|    u2_frm_wd_uv = u2_pic_wd + (UWORD8) (PAD_LEN_UV_H << 2);
  ------------------
  |  |  573|  1.56k|#define PAD_LEN_UV_H                  16
  ------------------
  489|  1.56k|    u2_frm_wd_uv = MAX(u2_frm_wd_uv, u2_frm_wd_y);
  ------------------
  |  |   60|  1.56k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 1.56k]
  |  |  ------------------
  ------------------
  490|       |
  491|  1.56k|    u2_frm_ht_uv = (u2_pic_ht >> 1) + (UWORD8) (PAD_LEN_UV_V << 2);
  ------------------
  |  |  574|  1.56k|#define PAD_LEN_UV_V                  8
  ------------------
  492|  1.56k|    u2_frm_ht_uv = MAX(u2_frm_ht_uv, (u2_frm_ht_y >> 1));
  ------------------
  |  |   60|  1.56k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 1.56k]
  |  |  ------------------
  ------------------
  493|       |
  494|       |    /* Calculate display picture width, height and start u4_ofst from YUV420 */
  495|       |    /* pictute buffers as per cropping information parsed above             */
  496|  1.56k|    {
  497|  1.56k|        UWORD16 u2_rgt_ofst = 0;
  498|  1.56k|        UWORD16 u2_lft_ofst = 0;
  499|  1.56k|        UWORD16 u2_top_ofst = 0;
  500|  1.56k|        UWORD16 u2_btm_ofst = 0;
  501|  1.56k|        UWORD8 u1_frm_mbs_flag;
  502|  1.56k|        UWORD8 u1_vert_mult_factor;
  503|       |
  504|  1.56k|        if(u1_frame_cropping_flag)
  ------------------
  |  Branch (504:12): [True: 1.05k, False: 511]
  ------------------
  505|  1.05k|        {
  506|       |            /* Calculate right and left u4_ofst for cropped picture           */
  507|  1.05k|            u2_rgt_ofst = u1_frame_cropping_rect_right_ofst << 1;
  508|  1.05k|            u2_lft_ofst = u1_frame_cropping_rect_left_ofst << 1;
  509|       |
  510|       |            /* Know frame MBs only u4_flag                                      */
  511|  1.05k|            u1_frm_mbs_flag = (1 == ps_seq->u1_frame_mbs_only_flag);
  512|       |
  513|       |            /* Simplify the vertical u4_ofst calculation from field/frame     */
  514|  1.05k|            u1_vert_mult_factor = (2 - u1_frm_mbs_flag);
  515|       |
  516|       |            /* Calculate bottom and top u4_ofst for cropped  picture          */
  517|  1.05k|            u2_btm_ofst = (u1_frame_cropping_rect_bottom_ofst << u1_vert_mult_factor);
  518|  1.05k|            u2_top_ofst = (u1_frame_cropping_rect_top_ofst << u1_vert_mult_factor);
  519|  1.05k|        }
  520|       |
  521|       |        /* Calculate u4_ofst from start of YUV 420 picture buffer to start of*/
  522|       |        /* cropped picture buffer                                           */
  523|  1.56k|        u2_crop_offset_y = (u2_frm_wd_y * u2_top_ofst) + (u2_lft_ofst);
  524|  1.56k|        u2_crop_offset_uv =
  525|  1.56k|            (u2_frm_wd_uv * (u2_top_ofst >> 1)) + (u2_lft_ofst >> 1) * YUV420SP_FACTOR;
  ------------------
  |  |  119|  1.56k|#define YUV420SP_FACTOR 2
  ------------------
  526|       |        /* Calculate the display picture width and height based on crop      */
  527|       |        /* information                                                       */
  528|  1.56k|        i4_cropped_ht = (WORD32) u2_pic_ht - (WORD32) (u2_btm_ofst + u2_top_ofst);
  529|  1.56k|        i4_cropped_wd = (WORD32) u2_pic_wd - (WORD32) (u2_rgt_ofst + u2_lft_ofst);
  530|       |
  531|  1.56k|        if((i4_cropped_ht < MB_SIZE) || (i4_cropped_wd < MB_SIZE))
  ------------------
  |  |  554|  1.56k|#define MB_SIZE             16
  ------------------
                      if((i4_cropped_ht < MB_SIZE) || (i4_cropped_wd < MB_SIZE))
  ------------------
  |  |  554|  1.56k|#define MB_SIZE             16
  ------------------
  |  Branch (531:12): [True: 4, False: 1.56k]
  |  Branch (531:41): [True: 0, False: 1.56k]
  ------------------
  532|      4|        {
  533|      4|            return ERROR_INV_SPS_PPS_T;
  534|      4|        }
  535|       |
  536|  1.56k|        if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (536:12): [True: 926, False: 637]
  ------------------
  537|    926|           (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (537:12): [True: 891, False: 35]
  ------------------
  538|    891|           (ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id].u2_pic_wd != u2_pic_wd))
  ------------------
  |  Branch (538:12): [True: 0, False: 891]
  ------------------
  539|      0|        {
  540|      0|            ps_dec->u1_res_changed = 1;
  541|      0|            return IVD_RES_CHANGED;
  542|      0|        }
  543|       |
  544|  1.56k|        if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (544:12): [True: 926, False: 637]
  ------------------
  545|    926|           (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (545:12): [True: 891, False: 35]
  ------------------
  546|    891|           (ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id].u2_disp_width != i4_cropped_wd))
  ------------------
  |  Branch (546:12): [True: 0, False: 891]
  ------------------
  547|      0|        {
  548|      0|            ps_dec->u1_res_changed = 1;
  549|      0|            return IVD_RES_CHANGED;
  550|      0|        }
  551|       |
  552|  1.56k|        if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (552:12): [True: 926, False: 637]
  ------------------
  553|    926|           (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (553:12): [True: 891, False: 35]
  ------------------
  554|    891|           (ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id].u2_pic_ht != u2_pic_ht))
  ------------------
  |  Branch (554:12): [True: 0, False: 891]
  ------------------
  555|      0|        {
  556|      0|            ps_dec->u1_res_changed = 1;
  557|      0|            return IVD_RES_CHANGED;
  558|      0|        }
  559|       |
  560|  1.56k|        if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (560:12): [True: 926, False: 637]
  ------------------
  561|    926|           (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (561:12): [True: 891, False: 35]
  ------------------
  562|    891|           (ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id].u2_disp_height != i4_cropped_ht))
  ------------------
  |  Branch (562:12): [True: 0, False: 891]
  ------------------
  563|      0|        {
  564|      0|            ps_dec->u1_res_changed = 1;
  565|      0|            return IVD_RES_CHANGED;
  566|      0|        }
  567|       |        /* Check again for unsupported resolutions with updated values*/
  568|  1.56k|        if((u2_pic_wd > SVCD_MAX_FRAME_WIDTH) || (u2_pic_ht > SVCD_MAX_FRAME_HEIGHT) ||
  ------------------
  |  |   52|  1.56k|#define SVCD_MAX_FRAME_WIDTH 4096
  ------------------
                      if((u2_pic_wd > SVCD_MAX_FRAME_WIDTH) || (u2_pic_ht > SVCD_MAX_FRAME_HEIGHT) ||
  ------------------
  |  |   53|  1.56k|#define SVCD_MAX_FRAME_HEIGHT 4096
  ------------------
  |  Branch (568:12): [True: 0, False: 1.56k]
  |  Branch (568:50): [True: 0, False: 1.56k]
  ------------------
  569|  1.56k|           (u2_pic_wd < SVCD_MIN_FRAME_WIDTH) || (u2_pic_ht < SVCD_MIN_FRAME_HEIGHT) ||
  ------------------
  |  |   56|  1.56k|#define SVCD_MIN_FRAME_WIDTH 32
  ------------------
                         (u2_pic_wd < SVCD_MIN_FRAME_WIDTH) || (u2_pic_ht < SVCD_MIN_FRAME_HEIGHT) ||
  ------------------
  |  |   57|  1.54k|#define SVCD_MIN_FRAME_HEIGHT 32
  ------------------
  |  Branch (569:12): [True: 17, False: 1.54k]
  |  Branch (569:50): [True: 0, False: 1.54k]
  ------------------
  570|  1.54k|           (u2_pic_wd * (UWORD32) u2_pic_ht > SVCD_MAX_FRAME_SIZE))
  ------------------
  |  |   54|  1.54k|#define SVCD_MAX_FRAME_SIZE (4096 * 4096)
  ------------------
  |  Branch (570:12): [True: 0, False: 1.54k]
  ------------------
  571|     17|        {
  572|     17|            return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED;
  573|     17|        }
  574|       |
  575|       |        /* If MBAff is enabled, decoder support is limited to streams with
  576|       |         * width less than half of H264_MAX_FRAME_WIDTH.
  577|       |         * In case of MBAff decoder processes two rows at a time
  578|       |         */
  579|  1.54k|        if((u2_pic_wd << ps_seq->u1_mb_aff_flag) > H264_MAX_FRAME_WIDTH)
  ------------------
  |  |   39|  1.54k|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
  |  Branch (579:12): [True: 0, False: 1.54k]
  ------------------
  580|      0|        {
  581|      0|            return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED;
  582|      0|        }
  583|  1.54k|    }
  584|       |
  585|  1.54k|    if(1 == ps_seq->u1_vui_parameters_present_flag)
  ------------------
  |  Branch (585:8): [True: 830, False: 716]
  ------------------
  586|    830|    {
  587|    830|        ret = ih264d_parse_vui_parametres(&ps_seq->s_vui, ps_bitstrm);
  588|    830|        if(ret != OK) return ret;
  ------------------
  |  |  114|    830|#define OK        0
  ------------------
  |  Branch (588:12): [True: 0, False: 830]
  ------------------
  589|    830|    }
  590|  1.54k|    ps_seq_svc_ext = &ps_subset_seq->s_sps_svc_ext;
  591|       |
  592|  1.54k|    isvcd_set_default_seq_svc_ext(ps_seq_svc_ext);
  593|       |
  594|  1.54k|    if(SCALABLE_BASELINE_PROFILE_IDC == ps_seq->u1_profile_idc ||
  ------------------
  |  |   59|  1.54k|#define SCALABLE_BASELINE_PROFILE_IDC 83
  ------------------
  |  Branch (594:8): [True: 785, False: 761]
  ------------------
  595|    761|       SCALABLE_HIGH_PROFILE_IDC == ps_seq->u1_profile_idc)
  ------------------
  |  |   60|    761|#define SCALABLE_HIGH_PROFILE_IDC 86
  ------------------
  |  Branch (595:8): [True: 244, False: 517]
  ------------------
  596|  1.02k|    {
  597|  1.02k|        SWITCHONTRACE;
  598|  1.02k|        ps_seq_svc_ext->u1_inter_layer_deblocking_filter_control_present_flag =
  599|  1.02k|            ih264d_get_bit_h264(ps_bitstrm);
  600|  1.02k|        COPYTHECONTEXT("SPS_EXt: u1_inter_layer_deblocking_filter_control_present_flag",
  601|  1.02k|                       ps_seq_svc_ext->u1_inter_layer_deblocking_filter_control_present_flag);
  602|       |
  603|  1.02k|        ps_seq_svc_ext->u1_extended_spatial_scalability_idc = ih264d_get_bits_h264(ps_bitstrm, 2);
  604|  1.02k|        COPYTHECONTEXT("SPS_EXt: u1_extended_spatial_scalability_idc",
  605|  1.02k|                       ps_seq_svc_ext->u1_extended_spatial_scalability_idc);
  606|       |
  607|       |        /* u1_extended_spatial_scalability_idc value 0, 1 and 2 are supported */
  608|  1.02k|        if(ps_seq_svc_ext->u1_extended_spatial_scalability_idc > 2)
  ------------------
  |  Branch (608:12): [True: 0, False: 1.02k]
  ------------------
  609|      0|        {
  610|      0|            return ERROR_SVC_INV_SUBSET_SPS;
  611|      0|        }
  612|       |
  613|       |        /* ChromaArrayType = i4_chroma_format_idc  if  separate_colour_plane_flag =
  614|       |         * 0 for all chroma format except 4:4:4 */
  615|  1.02k|        if(1 == ps_seq->i4_chroma_format_idc || 2 == ps_seq->i4_chroma_format_idc)
  ------------------
  |  Branch (615:12): [True: 1.02k, False: 0]
  |  Branch (615:49): [True: 0, False: 0]
  ------------------
  616|  1.02k|        {
  617|  1.02k|            ps_seq_svc_ext->u1_chroma_phase_x_plus1_flag = ih264d_get_bit_h264(ps_bitstrm);
  618|  1.02k|            COPYTHECONTEXT("SPS_EXt: u1_chroma_phase_x_plus1_flag",
  619|  1.02k|                           ps_seq_svc_ext->u1_chroma_phase_x_plus1_flag);
  620|  1.02k|        }
  621|       |
  622|  1.02k|        if(1 == ps_seq->i4_chroma_format_idc)
  ------------------
  |  Branch (622:12): [True: 1.02k, False: 0]
  ------------------
  623|  1.02k|        {
  624|  1.02k|            ps_seq_svc_ext->u1_chroma_phase_y_plus1 = ih264d_get_bits_h264(ps_bitstrm, 2);
  625|  1.02k|            COPYTHECONTEXT("SPS_EXt: u1_chroma_phase_y_plus1",
  626|  1.02k|                           ps_seq_svc_ext->u1_chroma_phase_y_plus1);
  627|       |
  628|  1.02k|            if(ps_seq_svc_ext->u1_chroma_phase_y_plus1 >= 3)
  ------------------
  |  Branch (628:16): [True: 0, False: 1.02k]
  ------------------
  629|      0|            {
  630|      0|                return ERROR_SVC_INV_SUBSET_SPS;
  631|      0|            }
  632|  1.02k|        }
  633|       |
  634|       |        /* inferred values not covered in isvcd_set_default_seq_svc_ext*/
  635|  1.02k|        ps_seq_svc_ext->u1_seq_ref_layer_chroma_phase_x_plus1_flag =
  636|  1.02k|            ps_seq_svc_ext->u1_chroma_phase_x_plus1_flag;
  637|  1.02k|        ps_seq_svc_ext->u1_seq_ref_layer_chroma_phase_y_plus1 =
  638|  1.02k|            ps_seq_svc_ext->u1_chroma_phase_y_plus1;
  639|       |
  640|  1.02k|        if(1 == ps_seq_svc_ext->u1_extended_spatial_scalability_idc)
  ------------------
  |  Branch (640:12): [True: 9, False: 1.02k]
  ------------------
  641|      9|        {
  642|      9|            if(ps_seq->i4_chroma_format_idc > 0)
  ------------------
  |  Branch (642:16): [True: 9, False: 0]
  ------------------
  643|      9|            {
  644|      9|                ps_seq_svc_ext->u1_seq_ref_layer_chroma_phase_x_plus1_flag =
  645|      9|                    ih264d_get_bit_h264(ps_bitstrm);
  646|      9|                COPYTHECONTEXT("SPS_EXt: u1_seq_ref_layer_chroma_phase_x_plus1_flag",
  647|      9|                               ps_seq_svc_ext->u1_seq_ref_layer_chroma_phase_x_plus1_flag);
  648|       |
  649|      9|                ps_seq_svc_ext->u1_seq_ref_layer_chroma_phase_y_plus1 =
  650|      9|                    ih264d_get_bits_h264(ps_bitstrm, 2);
  651|      9|                COPYTHECONTEXT("SPS_EXt: u1_seq_ref_layer_chroma_phase_y_plus1",
  652|      9|                               ps_seq_svc_ext->u1_seq_ref_layer_chroma_phase_y_plus1);
  653|       |
  654|      9|                if(ps_seq_svc_ext->u1_seq_ref_layer_chroma_phase_y_plus1 >= 3)
  ------------------
  |  Branch (654:20): [True: 0, False: 9]
  ------------------
  655|      0|                {
  656|      0|                    return ERROR_SVC_INV_SUBSET_SPS;
  657|      0|                }
  658|      9|            }
  659|       |
  660|      9|            ps_seq_svc_ext->i4_seq_scaled_ref_layer_left_offset =
  661|      9|                ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  662|      9|            COPYTHECONTEXT("SPS_EXt: i4_seq_scaled_ref_layer_left_offset",
  663|      9|                           ps_seq_svc_ext->i4_seq_scaled_ref_layer_left_offset);
  664|       |
  665|      9|            if(ps_seq_svc_ext->i4_seq_scaled_ref_layer_left_offset != 0)
  ------------------
  |  Branch (665:16): [True: 0, False: 9]
  ------------------
  666|      0|            {
  667|      0|                return ERROR_SVC_INV_SUBSET_SPS;
  668|      0|            }
  669|       |
  670|      9|            if(ps_seq_svc_ext->i4_seq_scaled_ref_layer_left_offset >= MAX_SCLD_REF_LAYER_OFFSET ||
  ------------------
  |  |   71|     18|#define MAX_SCLD_REF_LAYER_OFFSET 32768
  ------------------
  |  Branch (670:16): [True: 0, False: 9]
  ------------------
  671|      9|               ps_seq_svc_ext->i4_seq_scaled_ref_layer_left_offset < MIN_SCLD_REF_LAYER_OFFSET)
  ------------------
  |  |   72|      9|#define MIN_SCLD_REF_LAYER_OFFSET -32768
  ------------------
  |  Branch (671:16): [True: 0, False: 9]
  ------------------
  672|      0|            {
  673|      0|                return ERROR_SVC_INV_SUBSET_SPS;
  674|      0|            }
  675|       |
  676|      9|            ps_seq_svc_ext->i4_seq_scaled_ref_layer_top_offset =
  677|      9|                ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  678|      9|            COPYTHECONTEXT("SPS_EXt: i4_seq_scaled_ref_layer_top_offset",
  679|      9|                           ps_seq_svc_ext->i4_seq_scaled_ref_layer_top_offset);
  680|       |
  681|      9|            if(ps_seq_svc_ext->i4_seq_scaled_ref_layer_top_offset != 0)
  ------------------
  |  Branch (681:16): [True: 0, False: 9]
  ------------------
  682|      0|            {
  683|      0|                return ERROR_SVC_INV_SUBSET_SPS;
  684|      0|            }
  685|       |
  686|      9|            if(ps_seq_svc_ext->i4_seq_scaled_ref_layer_top_offset >= MAX_SCLD_REF_LAYER_OFFSET ||
  ------------------
  |  |   71|     18|#define MAX_SCLD_REF_LAYER_OFFSET 32768
  ------------------
  |  Branch (686:16): [True: 0, False: 9]
  ------------------
  687|      9|               ps_seq_svc_ext->i4_seq_scaled_ref_layer_top_offset < MIN_SCLD_REF_LAYER_OFFSET)
  ------------------
  |  |   72|      9|#define MIN_SCLD_REF_LAYER_OFFSET -32768
  ------------------
  |  Branch (687:16): [True: 0, False: 9]
  ------------------
  688|      0|            {
  689|      0|                return ERROR_SVC_INV_SUBSET_SPS;
  690|      0|            }
  691|       |
  692|      9|            ps_seq_svc_ext->i4_seq_scaled_ref_layer_right_offset =
  693|      9|                ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  694|      9|            COPYTHECONTEXT("SPS_EXt: i4_seq_scaled_ref_layer_right_offset",
  695|      9|                           ps_seq_svc_ext->i4_seq_scaled_ref_layer_right_offset);
  696|       |
  697|      9|            if(ps_seq_svc_ext->i4_seq_scaled_ref_layer_right_offset >= MAX_SCLD_REF_LAYER_OFFSET ||
  ------------------
  |  |   71|     18|#define MAX_SCLD_REF_LAYER_OFFSET 32768
  ------------------
  |  Branch (697:16): [True: 0, False: 9]
  ------------------
  698|      9|               ps_seq_svc_ext->i4_seq_scaled_ref_layer_right_offset < MIN_SCLD_REF_LAYER_OFFSET)
  ------------------
  |  |   72|      9|#define MIN_SCLD_REF_LAYER_OFFSET -32768
  ------------------
  |  Branch (698:16): [True: 0, False: 9]
  ------------------
  699|      0|            {
  700|      0|                return ERROR_SVC_INV_SUBSET_SPS;
  701|      0|            }
  702|       |
  703|      9|            ps_seq_svc_ext->i4_seq_scaled_ref_layer_bottom_offset =
  704|      9|                ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  705|      9|            COPYTHECONTEXT("SPS_EXt: i4_seq_scaled_ref_layer_bottom_offset",
  706|      9|                           ps_seq_svc_ext->i4_seq_scaled_ref_layer_bottom_offset);
  707|       |
  708|      9|            if(ps_seq_svc_ext->i4_seq_scaled_ref_layer_bottom_offset >= MAX_SCLD_REF_LAYER_OFFSET ||
  ------------------
  |  |   71|     18|#define MAX_SCLD_REF_LAYER_OFFSET 32768
  ------------------
  |  Branch (708:16): [True: 2, False: 7]
  ------------------
  709|      7|               ps_seq_svc_ext->i4_seq_scaled_ref_layer_bottom_offset < MIN_SCLD_REF_LAYER_OFFSET)
  ------------------
  |  |   72|      7|#define MIN_SCLD_REF_LAYER_OFFSET -32768
  ------------------
  |  Branch (709:16): [True: 0, False: 7]
  ------------------
  710|      2|            {
  711|      2|                return ERROR_INV_SLICE_HDR_T;
  712|      2|            }
  713|      9|        }
  714|       |
  715|  1.02k|        ps_seq_svc_ext->u1_seq_tcoeff_level_prediction_flag = ih264d_get_bit_h264(ps_bitstrm);
  716|  1.02k|        COPYTHECONTEXT("SPS_EXt: u1_seq_tcoeff_level_prediction_flag",
  717|  1.02k|                       ps_seq_svc_ext->u1_seq_tcoeff_level_prediction_flag);
  718|       |
  719|  1.02k|        if(1 == ps_seq_svc_ext->u1_seq_tcoeff_level_prediction_flag)
  ------------------
  |  Branch (719:12): [True: 815, False: 212]
  ------------------
  720|    815|        {
  721|    815|            ps_seq_svc_ext->u1_adaptive_tcoeff_level_prediction_flag =
  722|    815|                ih264d_get_bit_h264(ps_bitstrm);
  723|    815|            COPYTHECONTEXT("SPS_EXt: u1_adaptive_tcoeff_level_prediction_flag",
  724|    815|                           ps_seq_svc_ext->u1_adaptive_tcoeff_level_prediction_flag);
  725|    815|        }
  726|       |
  727|  1.02k|        ps_seq_svc_ext->u1_slice_header_restriction_flag = ih264d_get_bit_h264(ps_bitstrm);
  728|  1.02k|        COPYTHECONTEXT("SPS_EXt: u1_slice_header_restriction_flag",
  729|  1.02k|                       ps_seq_svc_ext->u1_slice_header_restriction_flag);
  730|       |
  731|  1.02k|        ps_seq_svc_ext->u1_svc_vui_parameters_present_flag = ih264d_get_bit_h264(ps_bitstrm);
  732|  1.02k|        COPYTHECONTEXT("SPS_EXt: u1_svc_vui_parameters_present_flag",
  733|  1.02k|                       ps_seq_svc_ext->u1_svc_vui_parameters_present_flag);
  734|       |
  735|  1.02k|        if(1 == ps_seq_svc_ext->u1_svc_vui_parameters_present_flag)
  ------------------
  |  Branch (735:12): [True: 201, False: 826]
  ------------------
  736|    201|        {
  737|    201|            if(NULL ==
  ------------------
  |  Branch (737:16): [True: 9, False: 192]
  ------------------
  738|    201|               ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id].s_sps_svc_ext.ps_svc_vui_ext)
  739|      9|            {
  740|      9|                void *pv_buf;
  741|      9|                UWORD32 size;
  742|       |                /* Memory allocation only if VUI is enabled in a particular subset SPS*/
  743|      9|                size = sizeof(svc_vui_ext_t);
  744|      9|                pv_buf = ps_dec->pf_aligned_alloc(ps_dec->pv_mem_ctxt, 128, size);
  745|      9|                RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|      9|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 9]
  |  |  ------------------
  ------------------
  746|      9|                memset(pv_buf, 0, size);
  747|      9|                ps_seq_svc_ext->ps_svc_vui_ext = pv_buf;
  748|      9|                ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id]
  749|      9|                    .s_sps_svc_ext.ps_svc_vui_ext = pv_buf;
  750|      9|            }
  751|    192|            else
  752|    192|            {
  753|    192|                ps_seq_svc_ext->ps_svc_vui_ext =
  754|    192|                    ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id]
  755|    192|                        .s_sps_svc_ext.ps_svc_vui_ext;
  756|    192|            }
  757|    201|            ret = isvcd_parse_vui_ext_parametres(ps_seq_svc_ext->ps_svc_vui_ext, ps_bitstrm);
  758|    201|            if(ret != OK) return ret;
  ------------------
  |  |  114|    201|#define OK        0
  ------------------
  |  Branch (758:16): [True: 10, False: 191]
  ------------------
  759|    201|        }
  760|  1.02k|    }
  761|       |    /* Add conditions for SCALABLE BASELINE PROFILE */
  762|  1.53k|    if(SCALABLE_BASELINE_PROFILE_IDC == ps_seq->u1_profile_idc ||
  ------------------
  |  |   59|  1.53k|#define SCALABLE_BASELINE_PROFILE_IDC 83
  ------------------
  |  Branch (762:8): [True: 785, False: 749]
  ------------------
  763|    749|       ((SCALABLE_HIGH_PROFILE_IDC == ps_seq->u1_profile_idc) && (1 == uc_constraint_set0_flag)))
  ------------------
  |  |   60|    749|#define SCALABLE_HIGH_PROFILE_IDC 86
  ------------------
  |  Branch (763:9): [True: 232, False: 517]
  |  Branch (763:66): [True: 185, False: 47]
  ------------------
  764|    970|    {
  765|    970|        if(ps_seq->i4_chroma_format_idc != 1)
  ------------------
  |  Branch (765:12): [True: 0, False: 970]
  ------------------
  766|      0|        {
  767|      0|            return ERROR_FEATURE_UNAVAIL;
  768|      0|        }
  769|       |
  770|    970|        if(ps_seq->i4_bit_depth_luma_minus8 != 0)
  ------------------
  |  Branch (770:12): [True: 0, False: 970]
  ------------------
  771|      0|        {
  772|      0|            return ERROR_FEATURE_UNAVAIL;
  773|      0|        }
  774|       |
  775|    970|        if(ps_seq->i4_bit_depth_chroma_minus8 != 0)
  ------------------
  |  Branch (775:12): [True: 0, False: 970]
  ------------------
  776|      0|        {
  777|      0|            return ERROR_FEATURE_UNAVAIL;
  778|      0|        }
  779|       |
  780|    970|        if(ps_seq->i4_qpprime_y_zero_transform_bypass_flag != 0)
  ------------------
  |  Branch (780:12): [True: 0, False: 970]
  ------------------
  781|      0|        {
  782|      0|            return ERROR_FEATURE_UNAVAIL;
  783|      0|        }
  784|       |
  785|    970|        if(ps_seq->u1_frame_mbs_only_flag != 1)
  ------------------
  |  Branch (785:12): [True: 3, False: 967]
  ------------------
  786|      3|        {
  787|      3|            return ERROR_FEATURE_UNAVAIL;
  788|      3|        }
  789|       |
  790|    967|        if((0 != ps_seq_svc_ext->i4_seq_scaled_ref_layer_left_offset % 16) &&
  ------------------
  |  Branch (790:12): [True: 0, False: 967]
  ------------------
  791|      0|           (0 != ps_seq_svc_ext->i4_seq_scaled_ref_layer_top_offset % 16))
  ------------------
  |  Branch (791:12): [True: 0, False: 0]
  ------------------
  792|      0|        {
  793|      0|            return ERROR_FEATURE_UNAVAIL;
  794|      0|        }
  795|    967|    }
  796|       |    /* Compare older num_reorder_frames with the new one if header is already
  797|       |     * decoded */
  798|  1.53k|    if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (798:8): [True: 912, False: 619]
  ------------------
  799|    912|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (799:8): [True: 891, False: 21]
  ------------------
  800|    891|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_vui_parameters_present_flag) &&
  ------------------
  |  Branch (800:8): [True: 454, False: 437]
  ------------------
  801|    454|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].s_vui.u1_bitstream_restriction_flag))
  ------------------
  |  Branch (801:8): [True: 0, False: 454]
  ------------------
  802|      0|    {
  803|      0|        ps_dec->u1_res_changed = 1;
  804|      0|        return IVD_RES_CHANGED;
  805|      0|    }
  806|       |    /* In case bitstream read has exceeded the filled size, then return an error */
  807|  1.53k|    if(EXCEED_OFFSET(ps_bitstrm))
  ------------------
  |  |   93|  1.53k|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 7, False: 1.52k]
  |  |  ------------------
  ------------------
  808|      7|    {
  809|      7|        return ERROR_INV_SPS_PPS_T;
  810|      7|    }
  811|       |
  812|       |    /*--------------------------------------------------------------------*/
  813|       |    /* All initializations to ps_dec are beyond this point                */
  814|       |    /*--------------------------------------------------------------------*/
  815|  1.52k|    {
  816|  1.52k|        WORD32 reorder_depth = ih264d_get_dpb_size(ps_seq);
  817|  1.52k|        if((1 == ps_seq->u1_vui_parameters_present_flag) &&
  ------------------
  |  Branch (817:12): [True: 827, False: 697]
  ------------------
  818|    827|           (1 == ps_seq->s_vui.u1_bitstream_restriction_flag))
  ------------------
  |  Branch (818:12): [True: 0, False: 827]
  ------------------
  819|      0|        {
  820|      0|            reorder_depth = ps_seq->s_vui.u4_num_reorder_frames + 1;
  821|      0|        }
  822|       |
  823|  1.52k|        if(reorder_depth > H264_MAX_REF_PICS)
  ------------------
  |  |  534|  1.52k|#define H264_MAX_REF_PICS         16
  ------------------
  |  Branch (823:12): [True: 0, False: 1.52k]
  ------------------
  824|      0|        {
  825|      0|            return ERROR_INV_SPS_PPS_T;
  826|      0|        }
  827|       |
  828|  1.52k|        if(ps_seq->u1_frame_mbs_only_flag != 1) reorder_depth *= 2;
  ------------------
  |  Branch (828:12): [True: 74, False: 1.45k]
  ------------------
  829|  1.52k|        ps_subset_seq->i4_reorder_depth = reorder_depth + DISPLAY_LATENCY;
  ------------------
  |  |   51|  1.52k|#define DISPLAY_LATENCY         2
  ------------------
  830|  1.52k|    }
  831|      0|    ps_subset_seq->u2_disp_height = i4_cropped_ht;
  832|  1.52k|    ps_subset_seq->u2_disp_width = i4_cropped_wd;
  833|  1.52k|    ps_subset_seq->u2_pic_wd = u2_pic_wd;
  834|  1.52k|    ps_subset_seq->u2_pic_ht = u2_pic_ht;
  835|       |
  836|       |    /* Assuming 8k is the maximum resolution svc dec supports*/
  837|  1.52k|    if(u2_frm_wd_y > H264_MAX_FRAME_WIDTH) return (NOT_OK);
  ------------------
  |  |   39|  1.52k|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
                  if(u2_frm_wd_y > H264_MAX_FRAME_WIDTH) return (NOT_OK);
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (837:8): [True: 0, False: 1.52k]
  ------------------
  838|  1.52k|    if(u2_frm_ht_y > H264_MAX_FRAME_HEIGHT) return (NOT_OK);
  ------------------
  |  |   40|  1.52k|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
                  if(u2_frm_ht_y > H264_MAX_FRAME_HEIGHT) return (NOT_OK);
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (838:8): [True: 0, False: 1.52k]
  ------------------
  839|  1.52k|    if(u2_frm_wd_uv > H264_MAX_FRAME_WIDTH) return (NOT_OK);
  ------------------
  |  |   39|  1.52k|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
                  if(u2_frm_wd_uv > H264_MAX_FRAME_WIDTH) return (NOT_OK);
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (839:8): [True: 0, False: 1.52k]
  ------------------
  840|  1.52k|    if(u2_frm_ht_uv > H264_MAX_FRAME_HEIGHT) return (NOT_OK);
  ------------------
  |  |   40|  1.52k|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
                  if(u2_frm_ht_uv > H264_MAX_FRAME_HEIGHT) return (NOT_OK);
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (840:8): [True: 0, False: 1.52k]
  ------------------
  841|       |
  842|       |    /* Determining the Width and Height of Frame from that of Picture */
  843|  1.52k|    ps_subset_seq->u2_frm_wd_y = u2_frm_wd_y;
  844|  1.52k|    ps_subset_seq->u2_frm_ht_y = u2_frm_ht_y;
  845|  1.52k|    ps_subset_seq->u2_frm_wd_uv = u2_frm_wd_uv;
  846|  1.52k|    ps_subset_seq->u2_frm_ht_uv = u2_frm_ht_uv;
  847|       |
  848|  1.52k|    ps_subset_seq->u1_pad_len_y_v = (UWORD8) (PAD_LEN_Y_V << (1 - u1_frm));
  ------------------
  |  |  572|  1.52k|#define PAD_LEN_Y_V                   20
  ------------------
  849|  1.52k|    ps_subset_seq->u1_pad_len_cr_v = (UWORD8) (PAD_LEN_UV_V << (1 - u1_frm));
  ------------------
  |  |  574|  1.52k|#define PAD_LEN_UV_V                  8
  ------------------
  850|       |
  851|  1.52k|    ps_subset_seq->u2_crop_offset_y = u2_crop_offset_y;
  852|  1.52k|    ps_subset_seq->u2_crop_offset_uv = u2_crop_offset_uv;
  853|       |
  854|  1.52k|    ps_seq->u1_is_valid = TRUE;
  ------------------
  |  |  591|  1.52k|#define TRUE    1
  ------------------
  855|  1.52k|    ps_dec->ps_sps[u1_seq_parameter_set_id] = *ps_seq;
  856|  1.52k|    if(NULL != ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id].s_sps_svc_ext.ps_svc_vui_ext)
  ------------------
  |  Branch (856:8): [True: 188, False: 1.33k]
  ------------------
  857|    188|    {
  858|    188|        ps_seq_svc_ext->ps_svc_vui_ext =
  859|    188|            ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id].s_sps_svc_ext.ps_svc_vui_ext;
  860|    188|    }
  861|  1.52k|    ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id] = *ps_subset_seq;
  862|  1.52k|    ps_svc_lyr_dec->ps_cur_subset_sps = &ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id];
  863|       |
  864|  1.52k|    return OK;
  ------------------
  |  |  114|  1.52k|#define OK        0
  ------------------
  865|  1.52k|}
isvcd_parse_nal_unit:
  943|  5.91k|{
  944|  5.91k|    dec_bit_stream_t *ps_bitstrm;
  945|       |
  946|  5.91k|    dec_struct_t *ps_dec;
  947|  5.91k|    svc_dec_lyr_struct_t *ps_svc_lyr_dec;
  948|  5.91k|    UWORD8 u1_nal_unit_type;
  949|  5.91k|    WORD32 i_status = OK;
  ------------------
  |  |  114|  5.91k|#define OK        0
  ------------------
  950|       |
  951|  5.91k|    ps_svc_lyr_dec = (svc_dec_lyr_struct_t *) dec_svc_hdl;
  952|  5.91k|    ps_dec = &ps_svc_lyr_dec->s_dec;
  953|       |
  954|  5.91k|    {
  955|  5.91k|        SWITCHOFFTRACE;
  956|  5.91k|        u1_nal_unit_type = ps_dec->u1_nal_unit_type;
  957|       |
  958|  5.91k|        ps_bitstrm = ps_dec->ps_bitstrm;
  959|       |
  960|       |        // Skip all NALUs if SPS and PPS are not decoded
  961|  5.91k|        switch(u1_nal_unit_type)
  962|  5.91k|        {
  963|      0|            case SLICE_DATA_PARTITION_A_NAL:
  ------------------
  |  |  325|      0|#define SLICE_DATA_PARTITION_A_NAL      2
  ------------------
  |  Branch (963:13): [True: 0, False: 5.91k]
  ------------------
  964|      0|            case SLICE_DATA_PARTITION_B_NAL:
  ------------------
  |  |  326|      0|#define SLICE_DATA_PARTITION_B_NAL      3
  ------------------
  |  Branch (964:13): [True: 0, False: 5.91k]
  ------------------
  965|      0|            case SLICE_DATA_PARTITION_C_NAL:
  ------------------
  |  |  327|      0|#define SLICE_DATA_PARTITION_C_NAL      4
  ------------------
  |  Branch (965:13): [True: 0, False: 5.91k]
  ------------------
  966|      0|                if(!ps_dec->i4_decode_header) ih264d_parse_slice_partition(ps_dec, ps_bitstrm);
  ------------------
  |  Branch (966:20): [True: 0, False: 0]
  ------------------
  967|      0|                break;
  968|       |
  969|  3.61k|            case IDR_SLICE_NAL:
  ------------------
  |  |  328|  3.61k|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (969:13): [True: 3.61k, False: 2.29k]
  ------------------
  970|  4.86k|            case SLICE_NAL:
  ------------------
  |  |  324|  4.86k|#define SLICE_NAL                       1
  ------------------
  |  Branch (970:13): [True: 1.24k, False: 4.66k]
  ------------------
  971|       |
  972|  4.86k|                if(ps_svc_lyr_dec->u1_base_res_flag != 1)
  ------------------
  |  Branch (972:20): [True: 0, False: 4.86k]
  ------------------
  973|      0|                {
  974|      0|                    return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  975|      0|                }
  976|  4.86k|                if(!ps_dec->i4_decode_header)
  ------------------
  |  Branch (976:20): [True: 4.86k, False: 0]
  ------------------
  977|  4.86k|                {
  978|  4.86k|                    if(ps_dec->i4_header_decoded == 3)
  ------------------
  |  Branch (978:24): [True: 4.86k, False: 0]
  ------------------
  979|  4.86k|                    {
  980|       |                        /* ! */
  981|  4.86k|                        DEBUG_THREADS_PRINTF("Decoding  a slice NAL\n");
  982|  4.86k|                        {
  983|  4.86k|                            ih264d_get_pre_sei_params(ps_dec, u1_nal_unit_type);
  984|       |                            /* ! */
  985|  4.86k|                            ps_dec->u4_slice_start_code_found = 1;
  986|       |
  987|  4.86k|                            i_status = isvcd_parse_decode_slice(
  988|  4.86k|                                (UWORD8) (u1_nal_unit_type == IDR_SLICE_NAL), u1_nal_ref_idc,
  ------------------
  |  |  328|  4.86k|#define IDR_SLICE_NAL                   5
  ------------------
  989|  4.86k|                                ps_svc_lyr_dec);
  990|       |
  991|  4.86k|                            if(i_status != OK)
  ------------------
  |  |  114|  4.86k|#define OK        0
  ------------------
  |  Branch (991:32): [True: 2.92k, False: 1.94k]
  ------------------
  992|  2.92k|                            {
  993|  2.92k|                                return i_status;
  994|  2.92k|                            }
  995|  4.86k|                        }
  996|  4.86k|                    }
  997|  4.86k|                }
  998|  1.94k|                break;
  999|       |
 1000|  1.94k|            case SEI_NAL:
  ------------------
  |  |  329|      0|#define SEI_NAL                         6
  ------------------
  |  Branch (1000:13): [True: 0, False: 5.91k]
  ------------------
 1001|      0|            case PREFIX_UNIT_NAL:
  ------------------
  |  |   64|      0|#define PREFIX_UNIT_NAL 14
  ------------------
  |  Branch (1001:13): [True: 0, False: 5.91k]
  ------------------
 1002|      0|            case SEQ_PARAM_NAL:
  ------------------
  |  |  330|      0|#define SEQ_PARAM_NAL                   7
  ------------------
  |  Branch (1002:13): [True: 0, False: 5.91k]
  ------------------
 1003|      0|            case PIC_PARAM_NAL:
  ------------------
  |  |  331|      0|#define PIC_PARAM_NAL                   8
  ------------------
  |  Branch (1003:13): [True: 0, False: 5.91k]
  ------------------
 1004|      0|            case SUBSET_SPS_NAL:
  ------------------
  |  |   65|      0|#define SUBSET_SPS_NAL 15
  ------------------
  |  Branch (1004:13): [True: 0, False: 5.91k]
  ------------------
 1005|      0|                H264_DEC_DEBUG_PRINT("\nUnknown NAL type %d\n", u1_nal_unit_type);
  ------------------
  |  |   39|      0|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
 1006|      0|                break;
 1007|       |
 1008|      0|            case ACCESS_UNIT_DELIMITER_RBSP:
  ------------------
  |  |  332|      0|#define ACCESS_UNIT_DELIMITER_RBSP      9
  ------------------
  |  Branch (1008:13): [True: 0, False: 5.91k]
  ------------------
 1009|      0|                if(!ps_dec->i4_decode_header)
  ------------------
  |  Branch (1009:20): [True: 0, False: 0]
  ------------------
 1010|      0|                {
 1011|      0|                    ih264d_access_unit_delimiter_rbsp(ps_dec);
 1012|      0|                }
 1013|      0|                break;
 1014|       |                // ignore the END_OF_SEQ_RBSP NAL and decode even after this NAL
 1015|      0|            case END_OF_STREAM_RBSP:
  ------------------
  |  |  334|      0|#define END_OF_STREAM_RBSP              11
  ------------------
  |  Branch (1015:13): [True: 0, False: 5.91k]
  ------------------
 1016|      0|                if(!ps_dec->i4_decode_header)
  ------------------
  |  Branch (1016:20): [True: 0, False: 0]
  ------------------
 1017|      0|                {
 1018|      0|                    ih264d_parse_end_of_stream(ps_dec);
 1019|      0|                }
 1020|      0|                break;
 1021|      0|            case FILLER_DATA_NAL:
  ------------------
  |  |  335|      0|#define FILLER_DATA_NAL                 12
  ------------------
  |  Branch (1021:13): [True: 0, False: 5.91k]
  ------------------
 1022|      0|                if(!ps_dec->i4_decode_header)
  ------------------
  |  Branch (1022:20): [True: 0, False: 0]
  ------------------
 1023|      0|                {
 1024|      0|                    ih264d_parse_filler_data(ps_dec, ps_bitstrm);
 1025|      0|                }
 1026|      0|                break;
 1027|  1.05k|            case CODED_SLICE_EXTENSION_NAL:
  ------------------
  |  |   66|  1.05k|#define CODED_SLICE_EXTENSION_NAL 20
  ------------------
  |  Branch (1027:13): [True: 1.05k, False: 4.86k]
  ------------------
 1028|       |
 1029|  1.05k|                if(ps_svc_lyr_dec->u1_base_res_flag == 1)
  ------------------
  |  Branch (1029:20): [True: 40, False: 1.01k]
  ------------------
 1030|     40|                {
 1031|     40|                    return NOT_OK;
  ------------------
  |  |  116|     40|#define NOT_OK    -1
  ------------------
 1032|     40|                }
 1033|  1.01k|                if(!ps_dec->i4_decode_header)
  ------------------
  |  Branch (1033:20): [True: 1.01k, False: 0]
  ------------------
 1034|  1.01k|                {
 1035|  1.01k|                    if(ps_dec->i4_header_decoded == 3)
  ------------------
  |  Branch (1035:24): [True: 1.01k, False: 0]
  ------------------
 1036|  1.01k|                    {
 1037|       |                        /* ! */
 1038|  1.01k|                        DEBUG_THREADS_PRINTF("Decoding  an SVC slice NAL\n");
 1039|  1.01k|                        {
 1040|  1.01k|                            {
 1041|  1.01k|                                ih264d_get_pre_sei_params(ps_dec, u1_nal_unit_type);
 1042|       |                                /* ! */
 1043|  1.01k|                                ps_dec->u4_slice_start_code_found = 1;
 1044|       |
 1045|  1.01k|                                i_status = isvcd_parse_decode_slice_ext_nal(
 1046|  1.01k|                                    (UWORD8) (ps_svc_lyr_dec->ps_nal_svc_ext->u1_idr_flag),
 1047|  1.01k|                                    u1_nal_ref_idc, ps_svc_lyr_dec);
 1048|       |
 1049|  1.01k|                                if(i_status != OK)
  ------------------
  |  |  114|  1.01k|#define OK        0
  ------------------
  |  Branch (1049:36): [True: 604, False: 409]
  ------------------
 1050|    604|                                {
 1051|    604|                                    return i_status;
 1052|    604|                                }
 1053|  1.01k|                            }
 1054|  1.01k|                        }
 1055|  1.01k|                    }
 1056|  1.01k|                }
 1057|    409|                break;
 1058|       |
 1059|    409|            default:
  ------------------
  |  Branch (1059:13): [True: 0, False: 5.91k]
  ------------------
 1060|      0|                H264_DEC_DEBUG_PRINT("\nUnknown NAL type %d\n", u1_nal_unit_type);
  ------------------
  |  |   39|      0|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
 1061|      0|                break;
 1062|  5.91k|        }
 1063|  5.91k|    }
 1064|  2.34k|    return i_status;
 1065|  5.91k|}
isvcd_parse_sps:
 1079|  6.75k|{
 1080|  6.75k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1081|  6.75k|    UWORD8 i;
 1082|  6.75k|    dec_seq_params_t *ps_seq = NULL;
 1083|  6.75k|    dec_svc_seq_params_t *ps_subset_seq = NULL;
 1084|  6.75k|    UWORD8 u1_profile_idc, u1_level_idc, u1_seq_parameter_set_id, u1_mb_aff_flag = 0;
 1085|  6.75k|    UWORD16 i2_max_frm_num;
 1086|  6.75k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 1087|  6.75k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
 1088|  6.75k|    UWORD8 u1_frm, uc_constraint_set0_flag, uc_constraint_set1_flag, uc_constraint_set2_flag;
 1089|  6.75k|    WORD32 i4_cropped_ht, i4_cropped_wd;
 1090|  6.75k|    UWORD32 u4_temp;
 1091|  6.75k|    UWORD64 u8_temp;
 1092|  6.75k|    UWORD32 u4_pic_height_in_map_units, u4_pic_width_in_mbs;
 1093|  6.75k|    UWORD32 u2_pic_wd = 0;
 1094|  6.75k|    UWORD32 u2_pic_ht = 0;
 1095|  6.75k|    UWORD32 u2_frm_wd_y = 0;
 1096|  6.75k|    UWORD32 u2_frm_ht_y = 0;
 1097|  6.75k|    UWORD32 u2_frm_wd_uv = 0;
 1098|  6.75k|    UWORD32 u2_frm_ht_uv = 0;
 1099|  6.75k|    UWORD32 u2_crop_offset_y = 0;
 1100|  6.75k|    UWORD32 u2_crop_offset_uv = 0;
 1101|  6.75k|    WORD32 ret;
 1102|  6.75k|    WORD32 num_reorder_frames;
 1103|       |    /* High profile related syntax element */
 1104|  6.75k|    WORD32 i4_i;
 1105|       |    /* G050 */
 1106|  6.75k|    UWORD8 u1_frame_cropping_flag,
 1107|  6.75k|        u1_frame_cropping_rect_left_ofst = 0, u1_frame_cropping_rect_right_ofst = 0,
 1108|  6.75k|        u1_frame_cropping_rect_top_ofst = 0, u1_frame_cropping_rect_bottom_ofst = 0;
 1109|       |    /* G050 */
 1110|       |    /*--------------------------------------------------------------------*/
 1111|       |    /* Decode seq_parameter_set_id and profile and level values           */
 1112|       |    /*--------------------------------------------------------------------*/
 1113|  6.75k|    SWITCHONTRACE;
 1114|  6.75k|    u1_profile_idc = ih264d_get_bits_h264(ps_bitstrm, 8);
 1115|  6.75k|    COPYTHECONTEXT("SPS: profile_idc", u1_profile_idc);
 1116|       |
 1117|       |    /* G050 */
 1118|  6.75k|    uc_constraint_set0_flag = ih264d_get_bit_h264(ps_bitstrm);
 1119|  6.75k|    uc_constraint_set1_flag = ih264d_get_bit_h264(ps_bitstrm);
 1120|  6.75k|    uc_constraint_set2_flag = ih264d_get_bit_h264(ps_bitstrm);
 1121|  6.75k|    UNUSED(uc_constraint_set2_flag);
  ------------------
  |  |   45|  6.75k|#define UNUSED(x) ((void)(x))
  ------------------
 1122|       |    /*****************************************************/
 1123|       |    /* Read 5 bits for uc_constraint_set3_flag (1 bit)   */
 1124|       |    /* and reserved_zero_4bits (4 bits) - Sushant        */
 1125|       |    /*****************************************************/
 1126|  6.75k|    ih264d_get_bits_h264(ps_bitstrm, 5);
 1127|       |    /* G050 */
 1128|       |    /* Check whether particular profile is suported or not */
 1129|       |    /* Check whether particular profile is suported or not */
 1130|  6.75k|    if((u1_profile_idc != MAIN_PROFILE_IDC) && (u1_profile_idc != BASE_PROFILE_IDC) &&
  ------------------
  |  |  276|  6.75k|#define MAIN_PROFILE_IDC    77
  ------------------
                  if((u1_profile_idc != MAIN_PROFILE_IDC) && (u1_profile_idc != BASE_PROFILE_IDC) &&
  ------------------
  |  |  275|  6.65k|#define BASE_PROFILE_IDC    66
  ------------------
  |  Branch (1130:8): [True: 6.65k, False: 106]
  |  Branch (1130:48): [True: 2.01k, False: 4.63k]
  ------------------
 1131|  2.01k|       (u1_profile_idc != HIGH_PROFILE_IDC))
  ------------------
  |  |  278|  2.01k|#define HIGH_PROFILE_IDC   100
  ------------------
  |  Branch (1131:8): [True: 1.95k, False: 64]
  ------------------
 1132|  1.95k|    {
 1133|       |        /* Apart from Baseline, main and high profile,
 1134|       |         * only extended profile is supported provided
 1135|       |         * uc_constraint_set0_flag or uc_constraint_set1_flag are set to 1
 1136|       |         */
 1137|  1.95k|        if((u1_profile_idc != EXTENDED_PROFILE_IDC) ||
  ------------------
  |  |  277|  1.95k|#define EXTENDED_PROFILE_IDC    88
  ------------------
  |  Branch (1137:12): [True: 47, False: 1.90k]
  ------------------
 1138|  1.90k|           ((uc_constraint_set1_flag != 1) && (uc_constraint_set0_flag != 1)))
  ------------------
  |  Branch (1138:13): [True: 31, False: 1.87k]
  |  Branch (1138:47): [True: 5, False: 26]
  ------------------
 1139|     52|        {
 1140|     52|            return (ERROR_FEATURE_UNAVAIL);
 1141|     52|        }
 1142|  1.95k|    }
 1143|       |
 1144|  6.70k|    u1_level_idc = ih264d_get_bits_h264(ps_bitstrm, 8);
 1145|  6.70k|    COPYTHECONTEXT("SPS: u4_level_idc", u1_level_idc);
 1146|       |
 1147|  6.70k|    u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1148|  6.70k|    if(u4_temp & MASK_ERR_SEQ_SET_ID) return ERROR_INV_SPS_PPS_T;
  ------------------
  |  |  526|  6.70k|#define MASK_ERR_SEQ_SET_ID   (0xFFFFFFE0)
  ------------------
  |  Branch (1148:8): [True: 14, False: 6.69k]
  ------------------
 1149|  6.69k|    u1_seq_parameter_set_id = u4_temp;
 1150|  6.69k|    COPYTHECONTEXT("SPS: seq_parameter_set_id", u1_seq_parameter_set_id);
 1151|       |
 1152|       |    /*--------------------------------------------------------------------*/
 1153|       |    /* Find an seq param entry in seqparam array of decStruct             */
 1154|       |    /*--------------------------------------------------------------------*/
 1155|  6.69k|    ps_subset_seq = ps_svc_lyr_dec->pv_scratch_subset_sps;
 1156|  6.69k|    memset(ps_subset_seq, 0, sizeof(dec_svc_seq_params_t));
 1157|  6.69k|    ps_seq = ps_dec->pv_scratch_sps_pps;
 1158|  6.69k|    memset(ps_seq, 0, sizeof(dec_seq_params_t));
 1159|       |
 1160|  6.69k|    if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (1160:8): [True: 6.45k, False: 235]
  ------------------
 1161|  6.45k|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (1161:8): [True: 6.40k, False: 52]
  ------------------
 1162|  6.40k|       (ps_dec->ps_sps[u1_seq_parameter_set_id].u1_profile_idc != u1_profile_idc))
  ------------------
  |  Branch (1162:8): [True: 33, False: 6.37k]
  ------------------
 1163|     33|    {
 1164|     33|        ps_dec->u1_res_changed = 1;
 1165|     33|        return IVD_RES_CHANGED;
 1166|     33|    }
 1167|       |
 1168|  6.65k|    if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (1168:8): [True: 6.42k, False: 235]
  ------------------
 1169|  6.42k|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (1169:8): [True: 6.37k, False: 52]
  ------------------
 1170|  6.37k|       (ps_dec->ps_sps[u1_seq_parameter_set_id].u1_level_idc != u1_level_idc))
  ------------------
  |  Branch (1170:8): [True: 416, False: 5.95k]
  ------------------
 1171|    416|    {
 1172|    416|        ps_dec->u1_res_changed = 1;
 1173|    416|        return IVD_RES_CHANGED;
 1174|    416|    }
 1175|       |
 1176|  6.24k|    ps_seq->u1_profile_idc = u1_profile_idc;
 1177|  6.24k|    ps_seq->u1_level_idc = u1_level_idc;
 1178|  6.24k|    ps_seq->u1_seq_parameter_set_id = u1_seq_parameter_set_id;
 1179|  6.24k|    ps_subset_seq->ps_seq = &ps_dec->ps_sps[u1_seq_parameter_set_id];
 1180|       |
 1181|       |    /*******************************************************************/
 1182|       |    /* Initializations for high profile - Sushant                      */
 1183|       |    /*******************************************************************/
 1184|  6.24k|    ps_seq->i4_chroma_format_idc = 1;
 1185|  6.24k|    ps_seq->i4_bit_depth_luma_minus8 = 0;
 1186|  6.24k|    ps_seq->i4_bit_depth_chroma_minus8 = 0;
 1187|  6.24k|    ps_seq->i4_qpprime_y_zero_transform_bypass_flag = 0;
 1188|  6.24k|    ps_seq->i4_seq_scaling_matrix_present_flag = 0;
 1189|  6.24k|    if(u1_profile_idc == HIGH_PROFILE_IDC || u1_profile_idc == SCALABLE_BASELINE_PROFILE_IDC ||
  ------------------
  |  |  278|  12.4k|#define HIGH_PROFILE_IDC   100
  ------------------
                  if(u1_profile_idc == HIGH_PROFILE_IDC || u1_profile_idc == SCALABLE_BASELINE_PROFILE_IDC ||
  ------------------
  |  |   59|  12.4k|#define SCALABLE_BASELINE_PROFILE_IDC 83
  ------------------
  |  Branch (1189:8): [True: 52, False: 6.19k]
  |  Branch (1189:46): [True: 0, False: 6.19k]
  ------------------
 1190|  6.19k|       u1_profile_idc == SCALABLE_HIGH_PROFILE_IDC)
  ------------------
  |  |   60|  6.19k|#define SCALABLE_HIGH_PROFILE_IDC 86
  ------------------
  |  Branch (1190:8): [True: 0, False: 6.19k]
  ------------------
 1191|     52|    {
 1192|       |        /* reading chroma_format_idc   */
 1193|     52|        ps_seq->i4_chroma_format_idc = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1194|       |
 1195|       |        /* Monochrome is not supported */
 1196|     52|        if(ps_seq->i4_chroma_format_idc != 1)
  ------------------
  |  Branch (1196:12): [True: 0, False: 52]
  ------------------
 1197|      0|        {
 1198|      0|            return ERROR_FEATURE_UNAVAIL;
 1199|      0|        }
 1200|       |
 1201|       |        /* reading bit_depth_luma_minus8   */
 1202|     52|        ps_seq->i4_bit_depth_luma_minus8 = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1203|       |
 1204|     52|        if(ps_seq->i4_bit_depth_luma_minus8 != 0)
  ------------------
  |  Branch (1204:12): [True: 1, False: 51]
  ------------------
 1205|      1|        {
 1206|      1|            return ERROR_FEATURE_UNAVAIL;
 1207|      1|        }
 1208|       |
 1209|       |        /* reading bit_depth_chroma_minus8   */
 1210|     51|        ps_seq->i4_bit_depth_chroma_minus8 = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1211|       |
 1212|     51|        if(ps_seq->i4_bit_depth_chroma_minus8 != 0)
  ------------------
  |  Branch (1212:12): [True: 0, False: 51]
  ------------------
 1213|      0|        {
 1214|      0|            return ERROR_FEATURE_UNAVAIL;
 1215|      0|        }
 1216|       |
 1217|       |        /* reading qpprime_y_zero_transform_bypass_flag   */
 1218|     51|        ps_seq->i4_qpprime_y_zero_transform_bypass_flag = (WORD32) ih264d_get_bit_h264(ps_bitstrm);
 1219|       |
 1220|     51|        if(ps_seq->i4_qpprime_y_zero_transform_bypass_flag != 0)
  ------------------
  |  Branch (1220:12): [True: 0, False: 51]
  ------------------
 1221|      0|        {
 1222|      0|            return ERROR_INV_SPS_PPS_T;
 1223|      0|        }
 1224|       |
 1225|       |        /* reading seq_scaling_matrix_present_flag   */
 1226|     51|        ps_seq->i4_seq_scaling_matrix_present_flag = (WORD32) ih264d_get_bit_h264(ps_bitstrm);
 1227|       |
 1228|     51|        if(ps_seq->i4_seq_scaling_matrix_present_flag)
  ------------------
  |  Branch (1228:12): [True: 27, False: 24]
  ------------------
 1229|     27|        {
 1230|    237|            for(i4_i = 0; i4_i < 8; i4_i++)
  ------------------
  |  Branch (1230:27): [True: 213, False: 24]
  ------------------
 1231|    213|            {
 1232|    213|                ps_seq->u1_seq_scaling_list_present_flag[i4_i] = ih264d_get_bit_h264(ps_bitstrm);
 1233|       |
 1234|       |                /* initialize u1_use_default_scaling_matrix_flag[i4_i] to zero */
 1235|       |                /* before calling scaling list                             */
 1236|    213|                ps_seq->u1_use_default_scaling_matrix_flag[i4_i] = 0;
 1237|       |
 1238|    213|                if(ps_seq->u1_seq_scaling_list_present_flag[i4_i])
  ------------------
  |  Branch (1238:20): [True: 148, False: 65]
  ------------------
 1239|    148|                {
 1240|    148|                    if(i4_i < 6)
  ------------------
  |  Branch (1240:24): [True: 125, False: 23]
  ------------------
 1241|    125|                    {
 1242|    125|                        ret = ih264d_scaling_list(ps_seq->i2_scalinglist4x4[i4_i], 16,
 1243|    125|                                                  &ps_seq->u1_use_default_scaling_matrix_flag[i4_i],
 1244|    125|                                                  ps_bitstrm);
 1245|    125|                    }
 1246|     23|                    else
 1247|     23|                    {
 1248|     23|                        ret = ih264d_scaling_list(ps_seq->i2_scalinglist8x8[i4_i - 6], 64,
 1249|     23|                                                  &ps_seq->u1_use_default_scaling_matrix_flag[i4_i],
 1250|     23|                                                  ps_bitstrm);
 1251|     23|                    }
 1252|    148|                    if(ret != OK)
  ------------------
  |  |  114|    148|#define OK        0
  ------------------
  |  Branch (1252:24): [True: 3, False: 145]
  ------------------
 1253|      3|                    {
 1254|      3|                        return ret;
 1255|      3|                    }
 1256|    148|                }
 1257|    213|            }
 1258|     27|        }
 1259|     51|    }
 1260|       |    /*--------------------------------------------------------------------*/
 1261|       |    /* Decode MaxFrameNum                                                 */
 1262|       |    /*--------------------------------------------------------------------*/
 1263|  6.23k|    u8_temp = (UWORD64) 4 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1264|  6.23k|    if(u8_temp > MAX_BITS_IN_FRAME_NUM)
  ------------------
  |  |  531|  6.23k|#define MAX_BITS_IN_FRAME_NUM     16
  ------------------
  |  Branch (1264:8): [True: 0, False: 6.23k]
  ------------------
 1265|      0|    {
 1266|      0|        return ERROR_INV_SPS_PPS_T;
 1267|      0|    }
 1268|  6.23k|    ps_seq->u1_bits_in_frm_num = (UWORD8) u8_temp;
 1269|  6.23k|    COPYTHECONTEXT("SPS: log2_max_frame_num_minus4", (ps_seq->u1_bits_in_frm_num - 4));
 1270|       |
 1271|  6.23k|    i2_max_frm_num = (1 << (ps_seq->u1_bits_in_frm_num));
 1272|  6.23k|    ps_seq->u2_u4_max_pic_num_minus1 = i2_max_frm_num - 1;
 1273|       |    /*--------------------------------------------------------------------*/
 1274|       |    /* Decode picture order count and related values                      */
 1275|       |    /*--------------------------------------------------------------------*/
 1276|  6.23k|    u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1277|  6.23k|    if(u4_temp > MAX_PIC_ORDER_CNT_TYPE)
  ------------------
  |  |  529|  6.23k|#define MAX_PIC_ORDER_CNT_TYPE    2
  ------------------
  |  Branch (1277:8): [True: 13, False: 6.22k]
  ------------------
 1278|     13|    {
 1279|     13|        return ERROR_INV_POC_TYPE_T;
 1280|     13|    }
 1281|  6.22k|    ps_seq->u1_pic_order_cnt_type = u4_temp;
 1282|  6.22k|    COPYTHECONTEXT("SPS: pic_order_cnt_type", ps_seq->u1_pic_order_cnt_type);
 1283|       |
 1284|  6.22k|    ps_seq->u1_num_ref_frames_in_pic_order_cnt_cycle = 1;
 1285|  6.22k|    if(ps_seq->u1_pic_order_cnt_type == 0)
  ------------------
  |  Branch (1285:8): [True: 1.60k, False: 4.62k]
  ------------------
 1286|  1.60k|    {
 1287|  1.60k|        u8_temp = (UWORD64) 4 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1288|  1.60k|        if(u8_temp > MAX_BITS_IN_POC_LSB)
  ------------------
  |  |  532|  1.60k|#define MAX_BITS_IN_POC_LSB       16
  ------------------
  |  Branch (1288:12): [True: 0, False: 1.60k]
  ------------------
 1289|      0|        {
 1290|      0|            return ERROR_INV_SPS_PPS_T;
 1291|      0|        }
 1292|  1.60k|        ps_seq->u1_log2_max_pic_order_cnt_lsb_minus = (UWORD8) u8_temp;
 1293|  1.60k|        ps_seq->i4_max_pic_order_cntLsb = (1 << u8_temp);
 1294|  1.60k|        COPYTHECONTEXT("SPS: log2_max_pic_order_cnt_lsb_minus4", (u8_temp - 4));
 1295|  1.60k|    }
 1296|  4.62k|    else if(ps_seq->u1_pic_order_cnt_type == 1)
  ------------------
  |  Branch (1296:13): [True: 71, False: 4.55k]
  ------------------
 1297|     71|    {
 1298|     71|        ps_seq->u1_delta_pic_order_always_zero_flag = ih264d_get_bit_h264(ps_bitstrm);
 1299|     71|        COPYTHECONTEXT("SPS: delta_pic_order_always_zero_flag",
 1300|     71|                       ps_seq->u1_delta_pic_order_always_zero_flag);
 1301|       |
 1302|     71|        ps_seq->i4_ofst_for_non_ref_pic = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1303|     71|        COPYTHECONTEXT("SPS: offset_for_non_ref_pic", ps_seq->i4_ofst_for_non_ref_pic);
 1304|       |
 1305|     71|        ps_seq->i4_ofst_for_top_to_bottom_field = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1306|     71|        COPYTHECONTEXT("SPS: offset_for_top_to_bottom_field",
 1307|     71|                       ps_seq->i4_ofst_for_top_to_bottom_field);
 1308|       |
 1309|     71|        u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1310|     71|        if(u4_temp > 255) return ERROR_INV_SPS_PPS_T;
  ------------------
  |  Branch (1310:12): [True: 4, False: 67]
  ------------------
 1311|     67|        ps_seq->u1_num_ref_frames_in_pic_order_cnt_cycle = u4_temp;
 1312|     67|        COPYTHECONTEXT("SPS: num_ref_frames_in_pic_order_cnt_cycle",
 1313|     67|                       ps_seq->u1_num_ref_frames_in_pic_order_cnt_cycle);
 1314|       |
 1315|    388|        for(i = 0; i < ps_seq->u1_num_ref_frames_in_pic_order_cnt_cycle; i++)
  ------------------
  |  Branch (1315:20): [True: 321, False: 67]
  ------------------
 1316|    321|        {
 1317|    321|            ps_seq->i4_ofst_for_ref_frame[i] = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1318|    321|            COPYTHECONTEXT("SPS: offset_for_ref_frame", ps_seq->i4_ofst_for_ref_frame[i]);
 1319|    321|        }
 1320|     67|    }
 1321|       |
 1322|  6.22k|    u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1323|       |
 1324|  6.22k|    if((u4_temp > H264_MAX_REF_PICS))
  ------------------
  |  |  534|  6.22k|#define H264_MAX_REF_PICS         16
  ------------------
  |  Branch (1324:8): [True: 1, False: 6.22k]
  ------------------
 1325|      1|    {
 1326|      1|        return ERROR_NUM_REF;
 1327|      1|    }
 1328|       |
 1329|       |    /* Compare with older num_ref_frames is header is already once */
 1330|  6.22k|    if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (1330:8): [True: 5.99k, False: 226]
  ------------------
 1331|  5.99k|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (1331:8): [True: 5.95k, False: 39]
  ------------------
 1332|  5.95k|       (ps_dec->ps_sps[u1_seq_parameter_set_id].u1_num_ref_frames != u4_temp))
  ------------------
  |  Branch (1332:8): [True: 2, False: 5.95k]
  ------------------
 1333|      2|    {
 1334|      2|        ps_dec->u1_res_changed = 1;
 1335|      2|        return IVD_RES_CHANGED;
 1336|      2|    }
 1337|       |
 1338|  6.21k|    ps_seq->u1_num_ref_frames = u4_temp;
 1339|  6.21k|    COPYTHECONTEXT("SPS: num_ref_frames", ps_seq->u1_num_ref_frames);
 1340|       |
 1341|  6.21k|    ps_seq->u1_gaps_in_frame_num_value_allowed_flag = ih264d_get_bit_h264(ps_bitstrm);
 1342|  6.21k|    COPYTHECONTEXT("SPS: gaps_in_frame_num_value_allowed_flag",
 1343|  6.21k|                   ps_seq->u1_gaps_in_frame_num_value_allowed_flag);
 1344|       |
 1345|  6.21k|    ps_seq->u1_gaps_in_frame_num_value_allowed_flag = 0;
 1346|       |
 1347|       |    /*--------------------------------------------------------------------*/
 1348|       |    /* Decode FrameWidth and FrameHeight and related values               */
 1349|       |    /*--------------------------------------------------------------------*/
 1350|  6.21k|    u8_temp = (UWORD64) 1 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1351|       |    /* Check  for unsupported resolutions*/
 1352|  6.21k|    if(u8_temp > (H264_MAX_FRAME_WIDTH >> 4))
  ------------------
  |  |   39|  6.21k|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
  |  Branch (1352:8): [True: 0, False: 6.21k]
  ------------------
 1353|      0|    {
 1354|      0|        return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED;
 1355|      0|    }
 1356|  6.21k|    u4_pic_width_in_mbs = (UWORD32) u8_temp;
 1357|  6.21k|    COPYTHECONTEXT("SPS: pic_width_in_mbs_minus1", u4_pic_width_in_mbs - 1);
 1358|       |
 1359|  6.21k|    u8_temp = (UWORD64) 1 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1360|  6.21k|    if(u8_temp > (H264_MAX_FRAME_HEIGHT >> 4))
  ------------------
  |  |   40|  6.21k|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
  |  Branch (1360:8): [True: 2, False: 6.21k]
  ------------------
 1361|      2|    {
 1362|      2|        return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED;
 1363|      2|    }
 1364|  6.21k|    u4_pic_height_in_map_units = (UWORD32) u8_temp;
 1365|       |
 1366|  6.21k|    ps_seq->u2_frm_wd_in_mbs = u4_pic_width_in_mbs;
 1367|  6.21k|    ps_seq->u2_frm_ht_in_mbs = u4_pic_height_in_map_units;
 1368|  6.21k|    u2_pic_wd = (u4_pic_width_in_mbs << 4);
 1369|  6.21k|    u2_pic_ht = (u4_pic_height_in_map_units << 4);
 1370|  6.21k|    if(ps_svc_lyr_dec->pic_width < u2_pic_wd)
  ------------------
  |  Branch (1370:8): [True: 120, False: 6.09k]
  ------------------
 1371|    120|    {
 1372|    120|        ps_svc_lyr_dec->pic_width = u2_pic_wd;
 1373|    120|    }
 1374|  6.21k|    if(ps_svc_lyr_dec->pic_height < u2_pic_ht)
  ------------------
  |  Branch (1374:8): [True: 123, False: 6.09k]
  ------------------
 1375|    123|    {
 1376|    123|        ps_svc_lyr_dec->pic_height = u2_pic_ht;
 1377|    123|    }
 1378|       |
 1379|       |    /*--------------------------------------------------------------------*/
 1380|       |    /* Get the value of MaxMbAddress and Number of bits needed for it     */
 1381|       |    /*--------------------------------------------------------------------*/
 1382|  6.21k|    ps_seq->u4_max_mb_addr = ((UWORD32)ps_seq->u2_frm_wd_in_mbs * (UWORD32)ps_seq->u2_frm_ht_in_mbs) - 1;
 1383|  6.21k|    ps_seq->u4_total_num_of_mbs = ps_seq->u4_max_mb_addr + 1;
 1384|  6.21k|    ps_seq->u1_level_idc = ih264d_correct_level_idc(u1_level_idc, ps_seq->u4_total_num_of_mbs);
 1385|       |
 1386|  6.21k|    u1_frm = ih264d_get_bit_h264(ps_bitstrm);
 1387|  6.21k|    if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (1387:8): [True: 5.99k, False: 224]
  ------------------
 1388|  5.99k|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (1388:8): [True: 5.95k, False: 39]
  ------------------
 1389|  5.95k|       (ps_dec->ps_sps[u1_seq_parameter_set_id].u1_frame_mbs_only_flag != u1_frm))
  ------------------
  |  Branch (1389:8): [True: 0, False: 5.95k]
  ------------------
 1390|      0|    {
 1391|      0|        ps_dec->u1_res_changed = 1;
 1392|      0|        return IVD_RES_CHANGED;
 1393|      0|    }
 1394|  6.21k|    ps_seq->u1_frame_mbs_only_flag = u1_frm;
 1395|  6.21k|    COPYTHECONTEXT("SPS: frame_mbs_only_flag", u1_frm);
 1396|       |
 1397|  6.21k|    if(!u1_frm) u1_mb_aff_flag = ih264d_get_bit_h264(ps_bitstrm);
  ------------------
  |  Branch (1397:8): [True: 27, False: 6.18k]
  ------------------
 1398|       |
 1399|  6.21k|    if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (1399:8): [True: 5.99k, False: 224]
  ------------------
 1400|  5.99k|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (1400:8): [True: 5.95k, False: 39]
  ------------------
 1401|  5.95k|       (ps_dec->ps_sps[u1_seq_parameter_set_id].u1_mb_aff_flag != u1_mb_aff_flag))
  ------------------
  |  Branch (1401:8): [True: 0, False: 5.95k]
  ------------------
 1402|      0|    {
 1403|      0|        ps_dec->u1_res_changed = 1;
 1404|      0|        return IVD_RES_CHANGED;
 1405|      0|    }
 1406|       |
 1407|  6.21k|    if(!u1_frm)
  ------------------
  |  Branch (1407:8): [True: 27, False: 6.18k]
  ------------------
 1408|     27|    {
 1409|     27|        u2_pic_ht <<= 1;
 1410|     27|        ps_seq->u1_mb_aff_flag = u1_mb_aff_flag;
 1411|     27|        COPYTHECONTEXT("SPS: mb_adaptive_frame_field_flag", ps_seq->u1_mb_aff_flag);
 1412|     27|    }
 1413|  6.18k|    else
 1414|  6.18k|        ps_seq->u1_mb_aff_flag = 0;
 1415|       |
 1416|  6.21k|    ps_seq->u1_direct_8x8_inference_flag = ih264d_get_bit_h264(ps_bitstrm);
 1417|  6.21k|    COPYTHECONTEXT("SPS: direct_8x8_inference_flag", ps_seq->u1_direct_8x8_inference_flag);
 1418|       |
 1419|       |    /* G050 */
 1420|  6.21k|    u1_frame_cropping_flag = ih264d_get_bit_h264(ps_bitstrm);
 1421|  6.21k|    COPYTHECONTEXT("SPS: frame_cropping_flag", u1_frame_cropping_flag);
 1422|       |
 1423|  6.21k|    if(u1_frame_cropping_flag)
  ------------------
  |  Branch (1423:8): [True: 4.66k, False: 1.55k]
  ------------------
 1424|  4.66k|    {
 1425|  4.66k|        u1_frame_cropping_rect_left_ofst = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1426|  4.66k|        COPYTHECONTEXT("SPS: frame_cropping_rect_left_offset", u1_frame_cropping_rect_left_ofst);
 1427|  4.66k|        u1_frame_cropping_rect_right_ofst = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1428|  4.66k|        COPYTHECONTEXT("SPS: frame_cropping_rect_right_offset", u1_frame_cropping_rect_right_ofst);
 1429|  4.66k|        u1_frame_cropping_rect_top_ofst = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1430|  4.66k|        COPYTHECONTEXT("SPS: frame_cropping_rect_top_offset", u1_frame_cropping_rect_top_ofst);
 1431|  4.66k|        u1_frame_cropping_rect_bottom_ofst = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1432|  4.66k|        COPYTHECONTEXT("SPS: frame_cropping_rect_bottom_offset",
 1433|  4.66k|                       u1_frame_cropping_rect_bottom_ofst);
 1434|  4.66k|    }
 1435|       |    /* G050 */
 1436|  6.21k|    ps_seq->u1_vui_parameters_present_flag = ih264d_get_bit_h264(ps_bitstrm);
 1437|  6.21k|    COPYTHECONTEXT("SPS: vui_parameters_present_flag", ps_seq->u1_vui_parameters_present_flag);
 1438|       |
 1439|  6.21k|    u2_frm_wd_y = u2_pic_wd + (UWORD8) (PAD_LEN_Y_H << 1);
  ------------------
  |  |  571|  6.21k|#define PAD_LEN_Y_H                   32
  ------------------
 1440|       |
 1441|  6.21k|    if(1 == ps_dec->u4_share_disp_buf)
  ------------------
  |  Branch (1441:8): [True: 0, False: 6.21k]
  ------------------
 1442|      0|    {
 1443|      0|        if(ps_dec->u4_app_disp_width > u2_frm_wd_y) u2_frm_wd_y = ps_dec->u4_app_disp_width;
  ------------------
  |  Branch (1443:12): [True: 0, False: 0]
  ------------------
 1444|      0|    }
 1445|       |
 1446|  6.21k|    u2_frm_ht_y = u2_pic_ht + (UWORD8) (PAD_LEN_Y_V << 2);
  ------------------
  |  |  572|  6.21k|#define PAD_LEN_Y_V                   20
  ------------------
 1447|  6.21k|    u2_frm_wd_uv = u2_pic_wd + (UWORD8) (PAD_LEN_UV_H << 2);
  ------------------
  |  |  573|  6.21k|#define PAD_LEN_UV_H                  16
  ------------------
 1448|  6.21k|    u2_frm_wd_uv = MAX(u2_frm_wd_uv, u2_frm_wd_y);
  ------------------
  |  |   60|  6.21k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 6.21k]
  |  |  ------------------
  ------------------
 1449|  6.21k|    u2_frm_ht_uv = (u2_pic_ht >> 1) + (UWORD8) (PAD_LEN_UV_V << 2);
  ------------------
  |  |  574|  6.21k|#define PAD_LEN_UV_V                  8
  ------------------
 1450|  6.21k|    u2_frm_ht_uv = MAX(u2_frm_ht_uv, (u2_frm_ht_y >> 1));
  ------------------
  |  |   60|  6.21k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 6.21k]
  |  |  ------------------
  ------------------
 1451|       |
 1452|       |    /* Calculate display picture width, height and start u4_ofst from YUV420 */
 1453|       |    /* pictute buffers as per cropping information parsed above             */
 1454|  6.21k|    {
 1455|  6.21k|        UWORD16 u2_rgt_ofst = 0;
 1456|  6.21k|        UWORD16 u2_lft_ofst = 0;
 1457|  6.21k|        UWORD16 u2_top_ofst = 0;
 1458|  6.21k|        UWORD16 u2_btm_ofst = 0;
 1459|  6.21k|        UWORD8 u1_frm_mbs_flag;
 1460|  6.21k|        UWORD8 u1_vert_mult_factor;
 1461|       |
 1462|  6.21k|        if(u1_frame_cropping_flag)
  ------------------
  |  Branch (1462:12): [True: 4.66k, False: 1.55k]
  ------------------
 1463|  4.66k|        {
 1464|       |            /* Calculate right and left u4_ofst for cropped picture           */
 1465|  4.66k|            u2_rgt_ofst = u1_frame_cropping_rect_right_ofst << 1;
 1466|  4.66k|            u2_lft_ofst = u1_frame_cropping_rect_left_ofst << 1;
 1467|       |
 1468|       |            /* Know frame MBs only u4_flag                                      */
 1469|  4.66k|            u1_frm_mbs_flag = (1 == ps_seq->u1_frame_mbs_only_flag);
 1470|       |
 1471|       |            /* Simplify the vertical u4_ofst calculation from field/frame     */
 1472|  4.66k|            u1_vert_mult_factor = (2 - u1_frm_mbs_flag);
 1473|       |
 1474|       |            /* Calculate bottom and top u4_ofst for cropped  picture          */
 1475|  4.66k|            u2_btm_ofst = (u1_frame_cropping_rect_bottom_ofst << u1_vert_mult_factor);
 1476|  4.66k|            u2_top_ofst = (u1_frame_cropping_rect_top_ofst << u1_vert_mult_factor);
 1477|  4.66k|        }
 1478|       |
 1479|       |        /* Calculate u4_ofst from start of YUV 420 picture buffer to start of*/
 1480|       |        /* cropped picture buffer                                           */
 1481|  6.21k|        u2_crop_offset_y = (u2_frm_wd_y * u2_top_ofst) + (u2_lft_ofst);
 1482|  6.21k|        u2_crop_offset_uv =
 1483|  6.21k|            (u2_frm_wd_uv * (u2_top_ofst >> 1)) + (u2_lft_ofst >> 1) * YUV420SP_FACTOR;
  ------------------
  |  |  119|  6.21k|#define YUV420SP_FACTOR 2
  ------------------
 1484|       |        /* Calculate the display picture width and height based on crop      */
 1485|       |        /* information                                                       */
 1486|  6.21k|        i4_cropped_ht = (WORD32) u2_pic_ht - (WORD32) (u2_btm_ofst + u2_top_ofst);
 1487|  6.21k|        i4_cropped_wd = (WORD32) u2_pic_wd - (WORD32) (u2_rgt_ofst + u2_lft_ofst);
 1488|       |
 1489|  6.21k|        if((i4_cropped_ht < MB_SIZE) || (i4_cropped_wd < MB_SIZE))
  ------------------
  |  |  554|  6.21k|#define MB_SIZE             16
  ------------------
                      if((i4_cropped_ht < MB_SIZE) || (i4_cropped_wd < MB_SIZE))
  ------------------
  |  |  554|  6.21k|#define MB_SIZE             16
  ------------------
  |  Branch (1489:12): [True: 1, False: 6.21k]
  |  Branch (1489:41): [True: 1, False: 6.21k]
  ------------------
 1490|      2|        {
 1491|      2|            return ERROR_INV_SPS_PPS_T;
 1492|      2|        }
 1493|       |
 1494|  6.21k|        if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (1494:12): [True: 5.99k, False: 222]
  ------------------
 1495|  5.99k|           (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (1495:12): [True: 5.95k, False: 39]
  ------------------
 1496|  5.95k|           (ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id].u2_pic_wd != u2_pic_wd))
  ------------------
  |  Branch (1496:12): [True: 7, False: 5.94k]
  ------------------
 1497|      7|        {
 1498|      7|            ps_dec->u1_res_changed = 1;
 1499|      7|            return IVD_RES_CHANGED;
 1500|      7|        }
 1501|       |
 1502|  6.20k|        if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (1502:12): [True: 5.98k, False: 222]
  ------------------
 1503|  5.98k|           (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (1503:12): [True: 5.94k, False: 39]
  ------------------
 1504|  5.94k|           (ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id].u2_disp_width != i4_cropped_wd))
  ------------------
  |  Branch (1504:12): [True: 2, False: 5.94k]
  ------------------
 1505|      2|        {
 1506|      2|            ps_dec->u1_res_changed = 1;
 1507|      2|            return IVD_RES_CHANGED;
 1508|      2|        }
 1509|       |
 1510|  6.20k|        if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (1510:12): [True: 5.98k, False: 222]
  ------------------
 1511|  5.98k|           (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (1511:12): [True: 5.94k, False: 39]
  ------------------
 1512|  5.94k|           (ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id].u2_pic_ht != u2_pic_ht))
  ------------------
  |  Branch (1512:12): [True: 2, False: 5.94k]
  ------------------
 1513|      2|        {
 1514|      2|            ps_dec->u1_res_changed = 1;
 1515|      2|            return IVD_RES_CHANGED;
 1516|      2|        }
 1517|       |
 1518|  6.20k|        if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (1518:12): [True: 5.98k, False: 222]
  ------------------
 1519|  5.98k|           (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) &&
  ------------------
  |  Branch (1519:12): [True: 5.94k, False: 39]
  ------------------
 1520|  5.94k|           (ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id].u2_disp_height != i4_cropped_ht))
  ------------------
  |  Branch (1520:12): [True: 1, False: 5.94k]
  ------------------
 1521|      1|        {
 1522|      1|            ps_dec->u1_res_changed = 1;
 1523|      1|            return IVD_RES_CHANGED;
 1524|      1|        }
 1525|       |        /* Check again for unsupported resolutions with updated values*/
 1526|  6.20k|        if((u2_pic_wd > SVCD_MAX_FRAME_WIDTH) || (u2_pic_ht > SVCD_MAX_FRAME_HEIGHT) ||
  ------------------
  |  |   52|  6.20k|#define SVCD_MAX_FRAME_WIDTH 4096
  ------------------
                      if((u2_pic_wd > SVCD_MAX_FRAME_WIDTH) || (u2_pic_ht > SVCD_MAX_FRAME_HEIGHT) ||
  ------------------
  |  |   53|  6.20k|#define SVCD_MAX_FRAME_HEIGHT 4096
  ------------------
  |  Branch (1526:12): [True: 0, False: 6.20k]
  |  Branch (1526:50): [True: 0, False: 6.20k]
  ------------------
 1527|  6.20k|           (u2_pic_wd < SVCD_MIN_FRAME_WIDTH) || (u2_pic_ht < SVCD_MIN_FRAME_HEIGHT) ||
  ------------------
  |  |   56|  6.20k|#define SVCD_MIN_FRAME_WIDTH 32
  ------------------
                         (u2_pic_wd < SVCD_MIN_FRAME_WIDTH) || (u2_pic_ht < SVCD_MIN_FRAME_HEIGHT) ||
  ------------------
  |  |   57|  6.20k|#define SVCD_MIN_FRAME_HEIGHT 32
  ------------------
  |  Branch (1527:12): [True: 2, False: 6.20k]
  |  Branch (1527:50): [True: 0, False: 6.20k]
  ------------------
 1528|  6.20k|           (u2_pic_wd * (UWORD32) u2_pic_ht > SVCD_MAX_FRAME_SIZE))
  ------------------
  |  |   54|  6.20k|#define SVCD_MAX_FRAME_SIZE (4096 * 4096)
  ------------------
  |  Branch (1528:12): [True: 0, False: 6.20k]
  ------------------
 1529|      2|        {
 1530|      2|            return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED;
 1531|      2|        }
 1532|       |
 1533|       |        /* If MBAff is enabled, decoder support is limited to streams with
 1534|       |         * width less than half of H264_MAX_FRAME_WIDTH.
 1535|       |         * In case of MBAff decoder processes two rows at a time
 1536|       |         */
 1537|  6.20k|        if((u2_pic_wd << ps_seq->u1_mb_aff_flag) > H264_MAX_FRAME_WIDTH)
  ------------------
  |  |   39|  6.20k|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
  |  Branch (1537:12): [True: 0, False: 6.20k]
  ------------------
 1538|      0|        {
 1539|      0|            return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED;
 1540|      0|        }
 1541|  6.20k|    }
 1542|       |
 1543|       |    /* Backup num_reorder_frames if header is already decoded */
 1544|  6.20k|    if((ps_dec->i4_header_decoded & 1) && (1 == ps_seq->u1_vui_parameters_present_flag) &&
  ------------------
  |  Branch (1544:8): [True: 5.98k, False: 220]
  |  Branch (1544:43): [True: 4.62k, False: 1.35k]
  ------------------
 1545|  4.62k|       (1 == ps_seq->s_vui.u1_bitstream_restriction_flag))
  ------------------
  |  Branch (1545:8): [True: 0, False: 4.62k]
  ------------------
 1546|      0|    {
 1547|      0|        num_reorder_frames = (WORD32) ps_seq->s_vui.u4_num_reorder_frames;
 1548|      0|    }
 1549|  6.20k|    else
 1550|  6.20k|    {
 1551|  6.20k|        num_reorder_frames = -1;
 1552|  6.20k|    }
 1553|  6.20k|    if(1 == ps_seq->u1_vui_parameters_present_flag)
  ------------------
  |  Branch (1553:8): [True: 4.65k, False: 1.54k]
  ------------------
 1554|  4.65k|    {
 1555|  4.65k|        ret = ih264d_parse_vui_parametres(&ps_seq->s_vui, ps_bitstrm);
 1556|  4.65k|        if(ret != OK) return ret;
  ------------------
  |  |  114|  4.65k|#define OK        0
  ------------------
  |  Branch (1556:12): [True: 0, False: 4.65k]
  ------------------
 1557|  4.65k|    }
 1558|       |
 1559|       |    /* Compare older num_reorder_frames with the new one if header is already
 1560|       |     * decoded */
 1561|  6.20k|    if((ps_dec->i4_header_decoded & 1) &&
  ------------------
  |  Branch (1561:8): [True: 5.98k, False: 220]
  ------------------
 1562|  5.98k|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_is_valid) && (-1 != num_reorder_frames) &&
  ------------------
  |  Branch (1562:8): [True: 5.94k, False: 39]
  |  Branch (1562:70): [True: 0, False: 5.94k]
  ------------------
 1563|      0|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].u1_vui_parameters_present_flag) &&
  ------------------
  |  Branch (1563:8): [True: 0, False: 0]
  ------------------
 1564|      0|       (1 == ps_dec->ps_sps[u1_seq_parameter_set_id].s_vui.u1_bitstream_restriction_flag) &&
  ------------------
  |  Branch (1564:8): [True: 0, False: 0]
  ------------------
 1565|      0|       ((WORD32) ps_dec->ps_sps[u1_seq_parameter_set_id].s_vui.u4_num_reorder_frames !=
  ------------------
  |  Branch (1565:8): [True: 0, False: 0]
  ------------------
 1566|      0|        num_reorder_frames))
 1567|      0|    {
 1568|      0|        ps_dec->u1_res_changed = 1;
 1569|      0|        return IVD_RES_CHANGED;
 1570|      0|    }
 1571|       |
 1572|       |    /* In case bitstream read has exceeded the filled size, then return an error */
 1573|  6.20k|    if(EXCEED_OFFSET(ps_bitstrm))
  ------------------
  |  |   93|  6.20k|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 3, False: 6.19k]
  |  |  ------------------
  ------------------
 1574|      3|    {
 1575|      3|        return ERROR_INV_SPS_PPS_T;
 1576|      3|    }
 1577|       |
 1578|       |    /*--------------------------------------------------------------------*/
 1579|       |    /* All initializations to ps_dec are beyond this point                */
 1580|       |    /*--------------------------------------------------------------------*/
 1581|  6.19k|    {
 1582|  6.19k|        WORD32 reorder_depth = ih264d_get_dpb_size(ps_seq);
 1583|  6.19k|        if((1 == ps_seq->u1_vui_parameters_present_flag) &&
  ------------------
  |  Branch (1583:12): [True: 4.65k, False: 1.54k]
  ------------------
 1584|  4.65k|           (1 == ps_seq->s_vui.u1_bitstream_restriction_flag))
  ------------------
  |  Branch (1584:12): [True: 142, False: 4.51k]
  ------------------
 1585|    142|        {
 1586|    142|            reorder_depth = ps_seq->s_vui.u4_num_reorder_frames + 1;
 1587|    142|        }
 1588|       |
 1589|  6.19k|        if(reorder_depth > H264_MAX_REF_PICS)
  ------------------
  |  |  534|  6.19k|#define H264_MAX_REF_PICS         16
  ------------------
  |  Branch (1589:12): [True: 0, False: 6.19k]
  ------------------
 1590|      0|        {
 1591|      0|            return ERROR_INV_SPS_PPS_T;
 1592|      0|        }
 1593|       |
 1594|  6.19k|        if(ps_seq->u1_frame_mbs_only_flag != 1) reorder_depth *= 2;
  ------------------
  |  Branch (1594:12): [True: 26, False: 6.17k]
  ------------------
 1595|  6.19k|        ps_subset_seq->i4_reorder_depth = reorder_depth + DISPLAY_LATENCY;
  ------------------
  |  |   51|  6.19k|#define DISPLAY_LATENCY         2
  ------------------
 1596|  6.19k|    }
 1597|      0|    ps_subset_seq->u2_disp_height = i4_cropped_ht;
 1598|  6.19k|    ps_subset_seq->u2_disp_width = i4_cropped_wd;
 1599|  6.19k|    ps_subset_seq->u2_pic_wd = u2_pic_wd;
 1600|  6.19k|    ps_subset_seq->u2_pic_ht = u2_pic_ht;
 1601|       |
 1602|       |    /* Determining the Width and Height of Frame from that of Picture */
 1603|  6.19k|    ps_subset_seq->u2_frm_wd_y = u2_frm_wd_y;
 1604|  6.19k|    ps_subset_seq->u2_frm_ht_y = u2_frm_ht_y;
 1605|  6.19k|    ps_subset_seq->u2_frm_wd_uv = u2_frm_wd_uv;
 1606|  6.19k|    ps_subset_seq->u2_frm_ht_uv = u2_frm_ht_uv;
 1607|       |
 1608|  6.19k|    ps_subset_seq->u1_pad_len_y_v = (UWORD8) (PAD_LEN_Y_V << (1 - u1_frm));
  ------------------
  |  |  572|  6.19k|#define PAD_LEN_Y_V                   20
  ------------------
 1609|  6.19k|    ps_subset_seq->u1_pad_len_cr_v = (UWORD8) (PAD_LEN_UV_V << (1 - u1_frm));
  ------------------
  |  |  574|  6.19k|#define PAD_LEN_UV_V                  8
  ------------------
 1610|       |
 1611|  6.19k|    ps_subset_seq->u2_crop_offset_y = u2_crop_offset_y;
 1612|  6.19k|    ps_subset_seq->u2_crop_offset_uv = u2_crop_offset_uv;
 1613|       |
 1614|  6.19k|    ps_seq->u1_is_valid = TRUE;
  ------------------
  |  |  591|  6.19k|#define TRUE    1
  ------------------
 1615|  6.19k|    ps_dec->ps_sps[u1_seq_parameter_set_id] = *ps_seq;
 1616|  6.19k|    ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id] = *ps_subset_seq;
 1617|  6.19k|    ps_svc_lyr_dec->ps_cur_subset_sps = &ps_svc_lyr_dec->ps_subset_sps[u1_seq_parameter_set_id];
 1618|       |
 1619|  6.19k|    return OK;
  ------------------
  |  |  114|  6.19k|#define OK        0
  ------------------
 1620|  6.19k|}
isvcd_parse_pps:
 1634|  3.48k|{
 1635|  3.48k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1636|  3.48k|    UWORD8 uc_temp;
 1637|  3.48k|    dec_seq_params_t *ps_sps = NULL;
 1638|  3.48k|    dec_pic_params_t *ps_pps = NULL;
 1639|  3.48k|    UWORD32 *pu4_bitstrm_buf = ps_dec->ps_bitstrm->pu4_buffer;
 1640|  3.48k|    UWORD32 *pu4_bitstrm_ofst = &ps_dec->ps_bitstrm->u4_ofst;
 1641|       |
 1642|       |    /* Variables used for error resilience checks */
 1643|  3.48k|    UWORD64 u8_temp;
 1644|  3.48k|    UWORD32 u4_temp;
 1645|  3.48k|    WORD32 i_temp;
 1646|       |
 1647|       |    /* For High profile related syntax elements */
 1648|  3.48k|    UWORD8 u1_more_data_flag;
 1649|  3.48k|    WORD32 i4_i;
 1650|       |
 1651|       |    /*--------------------------------------------------------------------*/
 1652|       |    /* Decode pic_parameter_set_id and find corresponding pic params      */
 1653|       |    /*--------------------------------------------------------------------*/
 1654|  3.48k|    u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1655|  3.48k|    if(u4_temp & MASK_ERR_PIC_SET_ID) return ERROR_INV_SPS_PPS_T;
  ------------------
  |  |  527|  3.48k|#define MASK_ERR_PIC_SET_ID   (0xFFFFFF00)
  ------------------
  |  Branch (1655:8): [True: 0, False: 3.48k]
  ------------------
 1656|  3.48k|    ps_pps = ps_dec->pv_scratch_sps_pps;
 1657|  3.48k|    *ps_pps = ps_dec->ps_pps[u4_temp];
 1658|  3.48k|    ps_pps->u1_pic_parameter_set_id = (UWORD8) u4_temp;
 1659|  3.48k|    COPYTHECONTEXT("PPS: pic_parameter_set_id", ps_pps->u1_pic_parameter_set_id);
 1660|       |
 1661|       |    /************************************************/
 1662|       |    /* initilization of High profile syntax element */
 1663|       |    /************************************************/
 1664|  3.48k|    ps_pps->i4_transform_8x8_mode_flag = 0;
 1665|  3.48k|    ps_pps->i4_pic_scaling_matrix_present_flag = 0;
 1666|       |
 1667|       |    /*--------------------------------------------------------------------*/
 1668|       |    /* Decode seq_parameter_set_id and map it to a seq_parameter_set      */
 1669|       |    /*--------------------------------------------------------------------*/
 1670|  3.48k|    u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1671|  3.48k|    if(u4_temp & MASK_ERR_SEQ_SET_ID) return ERROR_INV_SPS_PPS_T;
  ------------------
  |  |  526|  3.48k|#define MASK_ERR_SEQ_SET_ID   (0xFFFFFFE0)
  ------------------
  |  Branch (1671:8): [True: 2, False: 3.48k]
  ------------------
 1672|  3.48k|    COPYTHECONTEXT("PPS: seq_parameter_set_id", u4_temp);
 1673|  3.48k|    ps_sps = &ps_dec->ps_sps[u4_temp];
 1674|  3.48k|    ps_pps->ps_sps = ps_sps;
 1675|       |
 1676|       |    /*--------------------------------------------------------------------*/
 1677|       |    /* Decode entropy_coding_mode                                         */
 1678|       |    /*--------------------------------------------------------------------*/
 1679|  3.48k|    ps_pps->u1_entropy_coding_mode = ih264d_get_bit_h264(ps_bitstrm);
 1680|  3.48k|    COPYTHECONTEXT("PPS: entropy_coding_mode_flag", ps_pps->u1_entropy_coding_mode);
 1681|       |
 1682|  3.48k|    ps_pps->u1_pic_order_present_flag = ih264d_get_bit_h264(ps_bitstrm);
 1683|  3.48k|    COPYTHECONTEXT("PPS: pic_order_present_flag", ps_pps->u1_pic_order_present_flag);
 1684|       |
 1685|       |    /*--------------------------------------------------------------------*/
 1686|       |    /* Decode num_slice_groups_minus1                                     */
 1687|       |    /*--------------------------------------------------------------------*/
 1688|  3.48k|    u8_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf) + (UWORD64) 1;
 1689|  3.48k|    if(u8_temp != 1)
  ------------------
  |  Branch (1689:8): [True: 8, False: 3.47k]
  ------------------
 1690|      8|    {
 1691|      8|        return ERROR_FEATURE_UNAVAIL;
 1692|      8|    }
 1693|  3.47k|    ps_pps->u1_num_slice_groups = (UWORD8) u8_temp;
 1694|  3.47k|    COPYTHECONTEXT("PPS: num_slice_groups_minus1", ps_pps->u1_num_slice_groups - 1);
 1695|       |
 1696|       |    /*--------------------------------------------------------------------*/
 1697|       |    /* Other parameter set values                                         */
 1698|       |    /*--------------------------------------------------------------------*/
 1699|  3.47k|    u8_temp = (UWORD64) 1 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1700|  3.47k|    if(u8_temp >= H264_MAX_REF_IDX) return ERROR_REF_IDX;
  ------------------
  |  |  535|  3.47k|#define H264_MAX_REF_IDX          32
  ------------------
  |  Branch (1700:8): [True: 0, False: 3.47k]
  ------------------
 1701|  3.47k|    ps_pps->u1_num_ref_idx_lx_active[0] = (UWORD8) u8_temp;
 1702|  3.47k|    COPYTHECONTEXT("PPS: num_ref_idx_l0_active_minus1", ps_pps->u1_num_ref_idx_lx_active[0] - 1);
 1703|       |
 1704|  3.47k|    u8_temp = (UWORD64) 1 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1705|  3.47k|    if(u8_temp >= H264_MAX_REF_IDX) return ERROR_REF_IDX;
  ------------------
  |  |  535|  3.47k|#define H264_MAX_REF_IDX          32
  ------------------
  |  Branch (1705:8): [True: 46, False: 3.42k]
  ------------------
 1706|  3.42k|    ps_pps->u1_num_ref_idx_lx_active[1] = (UWORD8) u8_temp;
 1707|  3.42k|    COPYTHECONTEXT("PPS: num_ref_idx_l1_active_minus1", ps_pps->u1_num_ref_idx_lx_active[1] - 1);
 1708|       |
 1709|  3.42k|    ps_pps->u1_wted_pred_flag = ih264d_get_bit_h264(ps_bitstrm);
 1710|  3.42k|    COPYTHECONTEXT("PPS: weighted prediction u4_flag", ps_pps->u1_wted_pred_flag);
 1711|  3.42k|    uc_temp = (UWORD8) ih264d_get_bits_h264(ps_bitstrm, 2);
 1712|  3.42k|    COPYTHECONTEXT("PPS: weighted_bipred_idc", uc_temp);
 1713|  3.42k|    ps_pps->u1_wted_bipred_idc = uc_temp;
 1714|       |
 1715|  3.42k|    if(ps_pps->u1_wted_bipred_idc > MAX_WEIGHT_BIPRED_IDC) return ERROR_INV_SPS_PPS_T;
  ------------------
  |  |  536|  3.42k|#define MAX_WEIGHT_BIPRED_IDC     2
  ------------------
  |  Branch (1715:8): [True: 13, False: 3.41k]
  ------------------
 1716|       |
 1717|  3.41k|    {
 1718|  3.41k|        WORD64 i8_temp = (WORD64) 26 + ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1719|       |
 1720|  3.41k|        if((i8_temp < MIN_H264_QP) || (i8_temp > MAX_H264_QP)) return ERROR_INV_RANGE_QP_T;
  ------------------
  |  |  629|  3.41k|#define MIN_H264_QP 0
  ------------------
                      if((i8_temp < MIN_H264_QP) || (i8_temp > MAX_H264_QP)) return ERROR_INV_RANGE_QP_T;
  ------------------
  |  |  634|  3.41k|#define MAX_H264_QP 51
  ------------------
  |  Branch (1720:12): [True: 1, False: 3.41k]
  |  Branch (1720:39): [True: 13, False: 3.39k]
  ------------------
 1721|       |
 1722|  3.39k|        ps_pps->u1_pic_init_qp = (UWORD8) i8_temp;
 1723|  3.39k|        COPYTHECONTEXT("PPS: pic_init_qp_minus26", ps_pps->u1_pic_init_qp - 26);
 1724|       |
 1725|  3.39k|        i8_temp = (WORD64) 26 + ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1726|  3.39k|        if((i8_temp < MIN_H264_QP) || (i8_temp > MAX_H264_QP)) return ERROR_INV_RANGE_QP_T;
  ------------------
  |  |  629|  3.39k|#define MIN_H264_QP 0
  ------------------
                      if((i8_temp < MIN_H264_QP) || (i8_temp > MAX_H264_QP)) return ERROR_INV_RANGE_QP_T;
  ------------------
  |  |  634|  3.39k|#define MAX_H264_QP 51
  ------------------
  |  Branch (1726:12): [True: 2, False: 3.39k]
  |  Branch (1726:39): [True: 1, False: 3.39k]
  ------------------
 1727|       |
 1728|  3.39k|        ps_pps->u1_pic_init_qs = (UWORD8) i8_temp;
 1729|  3.39k|        COPYTHECONTEXT("PPS: pic_init_qs_minus26", ps_pps->u1_pic_init_qs - 26);
 1730|  3.39k|    }
 1731|       |
 1732|      0|    i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1733|  3.39k|    if((i_temp < -12) || (i_temp > 12)) return ERROR_INV_RANGE_QP_T;
  ------------------
  |  Branch (1733:8): [True: 17, False: 3.37k]
  |  Branch (1733:26): [True: 0, False: 3.37k]
  ------------------
 1734|  3.37k|    ps_pps->i1_chroma_qp_index_offset = i_temp;
 1735|  3.37k|    COPYTHECONTEXT("PPS: chroma_qp_index_offset", ps_pps->i1_chroma_qp_index_offset);
 1736|       |
 1737|       |    /***************************************************************************/
 1738|       |    /* initialize second_chroma_qp_index_offset to i1_chroma_qp_index_offset if */
 1739|       |    /* second_chroma_qp_index_offset is not present in bit-ps_bitstrm */
 1740|       |    /***************************************************************************/
 1741|  3.37k|    ps_pps->i1_second_chroma_qp_index_offset = ps_pps->i1_chroma_qp_index_offset;
 1742|       |
 1743|  3.37k|    ps_pps->u1_deblocking_filter_parameters_present_flag = ih264d_get_bit_h264(ps_bitstrm);
 1744|  3.37k|    COPYTHECONTEXT("PPS: deblocking_filter_control_present_flag",
 1745|  3.37k|                   ps_pps->u1_deblocking_filter_parameters_present_flag);
 1746|  3.37k|    ps_pps->u1_constrained_intra_pred_flag = ih264d_get_bit_h264(ps_bitstrm);
 1747|  3.37k|    COPYTHECONTEXT("PPS: constrained_intra_pred_flag", ps_pps->u1_constrained_intra_pred_flag);
 1748|  3.37k|    ps_pps->u1_redundant_pic_cnt_present_flag = ih264d_get_bit_h264(ps_bitstrm);
 1749|  3.37k|    COPYTHECONTEXT("PPS: redundant_pic_cnt_present_flag",
 1750|  3.37k|                   ps_pps->u1_redundant_pic_cnt_present_flag);
 1751|       |
 1752|       |    /* High profile related syntax elements */
 1753|  3.37k|    u1_more_data_flag = MORE_RBSP_DATA(ps_bitstrm);
  ------------------
  |  |   97|  3.37k|    CHECK_BITS_SUFFICIENT(ps_bitstrm, 1)
  |  |  ------------------
  |  |  |  |   95|  3.37k|  (ps_bitstrm->u4_ofst + bits_to_read <= ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  ------------------
 1754|       |
 1755|  3.37k|    if(u1_more_data_flag)
  ------------------
  |  Branch (1755:8): [True: 2.92k, False: 457]
  ------------------
 1756|  2.92k|    {
 1757|       |        /* read transform_8x8_mode_flag  */
 1758|  2.92k|        ps_pps->i4_transform_8x8_mode_flag = (WORD32) ih264d_get_bit_h264(ps_bitstrm);
 1759|       |
 1760|       |        /* read pic_scaling_matrix_present_flag */
 1761|  2.92k|        ps_pps->i4_pic_scaling_matrix_present_flag = (WORD32) ih264d_get_bit_h264(ps_bitstrm);
 1762|       |
 1763|  2.92k|        if(ps_pps->i4_pic_scaling_matrix_present_flag)
  ------------------
  |  Branch (1763:12): [True: 742, False: 2.18k]
  ------------------
 1764|    742|        {
 1765|       |            /* read the scaling matrices */
 1766|  5.28k|            for(i4_i = 0; i4_i < (6 + (ps_pps->i4_transform_8x8_mode_flag << 1)); i4_i++)
  ------------------
  |  Branch (1766:27): [True: 4.57k, False: 704]
  ------------------
 1767|  4.57k|            {
 1768|  4.57k|                ps_pps->u1_pic_scaling_list_present_flag[i4_i] = ih264d_get_bit_h264(ps_bitstrm);
 1769|       |
 1770|  4.57k|                if(ps_pps->u1_pic_scaling_list_present_flag[i4_i])
  ------------------
  |  Branch (1770:20): [True: 435, False: 4.14k]
  ------------------
 1771|    435|                {
 1772|    435|                    WORD32 ret;
 1773|    435|                    if(i4_i < 6)
  ------------------
  |  Branch (1773:24): [True: 249, False: 186]
  ------------------
 1774|    249|                    {
 1775|    249|                        ret = ih264d_scaling_list(
 1776|    249|                            ps_pps->i2_pic_scalinglist4x4[i4_i], 16,
 1777|    249|                            &ps_pps->u1_pic_use_default_scaling_matrix_flag[i4_i], ps_bitstrm);
 1778|    249|                    }
 1779|    186|                    else
 1780|    186|                    {
 1781|    186|                        ret = ih264d_scaling_list(
 1782|    186|                            ps_pps->i2_pic_scalinglist8x8[i4_i - 6], 64,
 1783|    186|                            &ps_pps->u1_pic_use_default_scaling_matrix_flag[i4_i], ps_bitstrm);
 1784|    186|                    }
 1785|       |
 1786|    435|                    if(ret != OK)
  ------------------
  |  |  114|    435|#define OK        0
  ------------------
  |  Branch (1786:24): [True: 38, False: 397]
  ------------------
 1787|     38|                    {
 1788|     38|                        return ret;
 1789|     38|                    }
 1790|    435|                }
 1791|  4.57k|            }
 1792|    742|        }
 1793|       |
 1794|       |        /* read second_chroma_qp_index_offset syntax element */
 1795|  2.88k|        i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1796|  2.88k|        if((i_temp < -12) || (i_temp > 12)) return ERROR_INV_RANGE_QP_T;
  ------------------
  |  Branch (1796:12): [True: 0, False: 2.88k]
  |  Branch (1796:30): [True: 7, False: 2.87k]
  ------------------
 1797|       |
 1798|  2.87k|        ps_pps->i1_second_chroma_qp_index_offset = i_temp;
 1799|  2.87k|    }
 1800|       |
 1801|  3.33k|    if(SCALABLE_BASELINE_PROFILE_IDC == ps_sps->u1_profile_idc)
  ------------------
  |  |   59|  3.33k|#define SCALABLE_BASELINE_PROFILE_IDC 83
  ------------------
  |  Branch (1801:8): [True: 0, False: 3.33k]
  ------------------
 1802|       |
 1803|      0|    {
 1804|      0|        if(ps_pps->u1_num_slice_groups > 7)
  ------------------
  |  Branch (1804:12): [True: 0, False: 0]
  ------------------
 1805|      0|        {
 1806|      0|            return ERROR_INV_SPS_PPS_T;
 1807|      0|        }
 1808|      0|    }
 1809|       |
 1810|       |    /* In case bitstream read has exceeded the filled size, then return an error */
 1811|  3.33k|    if(EXCEED_OFFSET(ps_bitstrm))
  ------------------
  |  |   93|  3.33k|  (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
  |  |  ------------------
  |  |  |  Branch (93:3): [True: 9, False: 3.32k]
  |  |  ------------------
  ------------------
 1812|      9|    {
 1813|      9|        return ERROR_INV_SPS_PPS_T;
 1814|      9|    }
 1815|  3.32k|    ps_pps->u1_is_valid = TRUE;
  ------------------
  |  |  591|  3.32k|#define TRUE    1
  ------------------
 1816|  3.32k|    ps_dec->ps_pps[ps_pps->u1_pic_parameter_set_id] = *ps_pps;
 1817|  3.32k|    return OK;
  ------------------
  |  |  114|  3.32k|#define OK        0
  ------------------
 1818|  3.33k|}

isvcd_verify_level:
   95|  4.90k|{
   96|  4.90k|    switch(u1_level_idc)
   97|  4.90k|    {
   98|      0|        case H264_LEVEL_1_0:
  ------------------
  |  |  291|      0|#define H264_LEVEL_1_0     10
  ------------------
  |  Branch (98:9): [True: 0, False: 4.90k]
  ------------------
   99|    870|        case H264_LEVEL_1_1:
  ------------------
  |  |  292|    870|#define H264_LEVEL_1_1     11
  ------------------
  |  Branch (99:9): [True: 870, False: 4.03k]
  ------------------
  100|    938|        case H264_LEVEL_1_2:
  ------------------
  |  |  293|    938|#define H264_LEVEL_1_2     12
  ------------------
  |  Branch (100:9): [True: 68, False: 4.84k]
  ------------------
  101|    938|        case H264_LEVEL_1_3:
  ------------------
  |  |  294|    938|#define H264_LEVEL_1_3     13
  ------------------
  |  Branch (101:9): [True: 0, False: 4.90k]
  ------------------
  102|  2.80k|        case H264_LEVEL_2_0:
  ------------------
  |  |  295|  2.80k|#define H264_LEVEL_2_0     20
  ------------------
  |  Branch (102:9): [True: 1.86k, False: 3.04k]
  ------------------
  103|  4.11k|        case H264_LEVEL_2_1:
  ------------------
  |  |  296|  4.11k|#define H264_LEVEL_2_1     21
  ------------------
  |  Branch (103:9): [True: 1.30k, False: 3.60k]
  ------------------
  104|  4.11k|        case H264_LEVEL_2_2:
  ------------------
  |  |  297|  4.11k|#define H264_LEVEL_2_2     22
  ------------------
  |  Branch (104:9): [True: 0, False: 4.90k]
  ------------------
  105|  4.13k|        case H264_LEVEL_3_0:
  ------------------
  |  |  298|  4.13k|#define H264_LEVEL_3_0     30
  ------------------
  |  Branch (105:9): [True: 17, False: 4.89k]
  ------------------
  106|  4.14k|        case H264_LEVEL_3_1:
  ------------------
  |  |  299|  4.14k|#define H264_LEVEL_3_1     31
  ------------------
  |  Branch (106:9): [True: 12, False: 4.89k]
  ------------------
  107|  4.57k|        case H264_LEVEL_3_2:
  ------------------
  |  |  300|  4.57k|#define H264_LEVEL_3_2     32
  ------------------
  |  Branch (107:9): [True: 434, False: 4.47k]
  ------------------
  108|  4.76k|        case H264_LEVEL_4_0:
  ------------------
  |  |  301|  4.76k|#define H264_LEVEL_4_0     40
  ------------------
  |  Branch (108:9): [True: 186, False: 4.72k]
  ------------------
  109|  4.90k|        case H264_LEVEL_4_1:
  ------------------
  |  |  302|  4.90k|#define H264_LEVEL_4_1     41
  ------------------
  |  Branch (109:9): [True: 147, False: 4.76k]
  ------------------
  110|  4.90k|        case H264_LEVEL_4_2:
  ------------------
  |  |  303|  4.90k|#define H264_LEVEL_4_2     42
  ------------------
  |  Branch (110:9): [True: 0, False: 4.90k]
  ------------------
  111|  4.90k|        case H264_LEVEL_5_0:
  ------------------
  |  |  304|  4.90k|#define H264_LEVEL_5_0     50
  ------------------
  |  Branch (111:9): [True: 0, False: 4.90k]
  ------------------
  112|  4.90k|        case H264_LEVEL_5_1:
  ------------------
  |  |  305|  4.90k|#define H264_LEVEL_5_1     51
  ------------------
  |  Branch (112:9): [True: 0, False: 4.90k]
  ------------------
  113|  4.90k|            return OK;
  ------------------
  |  |  114|  4.90k|#define OK        0
  ------------------
  114|      0|        default:
  ------------------
  |  Branch (114:9): [True: 0, False: 4.90k]
  ------------------
  115|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  116|  4.90k|    }
  117|  4.90k|}
isvcd_start_of_pic:
  133|  4.27k|{
  134|  4.27k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  135|  4.27k|    pocstruct_t *ps_prev_poc = &ps_dec->s_cur_pic_poc;
  136|  4.27k|    pocstruct_t *ps_cur_poc = ps_temp_poc;
  137|       |
  138|  4.27k|    dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice;
  139|  4.27k|    dec_seq_params_t *ps_seq = ps_dec->ps_cur_sps;
  140|  4.27k|    UWORD8 u1_bottom_field_flag = ps_cur_slice->u1_bottom_field_flag;
  141|  4.27k|    UWORD8 u1_field_pic_flag = ps_cur_slice->u1_field_pic_flag;
  142|       |    /* high profile related declarations */
  143|  4.27k|    WORD32 ret;
  144|       |
  145|  4.27k|    H264_MUTEX_LOCK(&ps_dec->process_disp_mutex);
  146|       |
  147|  4.27k|    if(u1_field_pic_flag == 1)
  ------------------
  |  Branch (147:8): [True: 0, False: 4.27k]
  ------------------
  148|      0|    {
  149|      0|        ps_dec->i4_error_code = ERROR_SVC_FIELD_PIC_UNSUPPORTED;
  150|      0|        return ERROR_SVC_FIELD_PIC_UNSUPPORTED;
  151|      0|    }
  152|       |
  153|       |    /* check output buffer size given by the application */
  154|  4.27k|    if(check_app_out_buf_size(ps_dec) != IV_SUCCESS) return IVD_DISP_FRM_ZERO_OP_BUF_SIZE;
  ------------------
  |  Branch (154:8): [True: 172, False: 4.10k]
  ------------------
  155|       |
  156|  4.10k|    ps_prev_poc->i4_pic_order_cnt_lsb = ps_cur_poc->i4_pic_order_cnt_lsb;
  157|  4.10k|    ps_prev_poc->i4_pic_order_cnt_msb = ps_cur_poc->i4_pic_order_cnt_msb;
  158|  4.10k|    ps_prev_poc->i4_delta_pic_order_cnt_bottom = ps_cur_poc->i4_delta_pic_order_cnt_bottom;
  159|  4.10k|    ps_prev_poc->i4_delta_pic_order_cnt[0] = ps_cur_poc->i4_delta_pic_order_cnt[0];
  160|  4.10k|    ps_prev_poc->i4_delta_pic_order_cnt[1] = ps_cur_poc->i4_delta_pic_order_cnt[1];
  161|  4.10k|    ps_prev_poc->u1_bot_field = ps_dec->ps_cur_slice->u1_bottom_field_flag;
  162|  4.10k|    ps_prev_poc->i4_prev_frame_num_ofst = ps_cur_poc->i4_prev_frame_num_ofst;
  163|  4.10k|    ps_prev_poc->u2_frame_num = u2_frame_num;
  164|  4.10k|    ps_dec->i1_prev_mb_qp_delta = 0;
  165|  4.10k|    ps_dec->i1_next_ctxt_idx = 0;
  166|       |
  167|  4.10k|    ps_dec->u4_nmb_deblk = 0;
  168|  4.10k|    if(ps_dec->u4_num_cores == 1) ps_dec->u4_nmb_deblk = 1;
  ------------------
  |  Branch (168:8): [True: 3.25k, False: 846]
  ------------------
  169|       |
  170|  4.10k|    if(ps_seq->u1_mb_aff_flag == 1)
  ------------------
  |  Branch (170:8): [True: 0, False: 4.10k]
  ------------------
  171|      0|    {
  172|      0|        ps_dec->u4_nmb_deblk = 0;
  173|      0|        if(ps_dec->u4_num_cores > 2) ps_dec->u4_num_cores = 2;
  ------------------
  |  Branch (173:12): [True: 0, False: 0]
  ------------------
  174|      0|    }
  175|       |
  176|  4.10k|    ps_dec->u4_use_intrapred_line_copy = 0;
  177|       |
  178|  4.10k|    if(ps_seq->u1_mb_aff_flag == 0)
  ------------------
  |  Branch (178:8): [True: 4.10k, False: 0]
  ------------------
  179|  4.10k|    {
  180|  4.10k|        ps_dec->u4_use_intrapred_line_copy = 1;
  181|  4.10k|    }
  182|       |
  183|  4.10k|    ps_dec->u4_app_disable_deblk_frm = 0;
  184|       |    /* If degrade is enabled, set the degrade flags appropriately */
  185|  4.10k|    if(ps_dec->i4_degrade_type && ps_dec->i4_degrade_pics)
  ------------------
  |  Branch (185:8): [True: 0, False: 4.10k]
  |  Branch (185:35): [True: 0, False: 0]
  ------------------
  186|      0|    {
  187|      0|        WORD32 degrade_pic;
  188|      0|        ps_dec->i4_degrade_pic_cnt++;
  189|      0|        degrade_pic = 0;
  190|       |
  191|       |        /* If degrade is to be done in all frames, then do not check further */
  192|      0|        switch(ps_dec->i4_degrade_pics)
  ------------------
  |  Branch (192:16): [True: 0, False: 0]
  ------------------
  193|      0|        {
  194|      0|            case 4:
  ------------------
  |  Branch (194:13): [True: 0, False: 0]
  ------------------
  195|      0|            {
  196|      0|                degrade_pic = 1;
  197|      0|                break;
  198|      0|            }
  199|      0|            case 3:
  ------------------
  |  Branch (199:13): [True: 0, False: 0]
  ------------------
  200|      0|            {
  201|      0|                if(ps_cur_slice->u1_slice_type != I_SLICE) degrade_pic = 1;
  ------------------
  |  |  370|      0|#define I_SLICE  2
  ------------------
  |  Branch (201:20): [True: 0, False: 0]
  ------------------
  202|       |
  203|      0|                break;
  204|      0|            }
  205|      0|            case 2:
  ------------------
  |  Branch (205:13): [True: 0, False: 0]
  ------------------
  206|      0|            {
  207|       |                /* If pic count hits non-degrade interval or it is an islice, then do not
  208|       |                 * degrade */
  209|      0|                if((ps_cur_slice->u1_slice_type != I_SLICE) &&
  ------------------
  |  |  370|      0|#define I_SLICE  2
  ------------------
  |  Branch (209:20): [True: 0, False: 0]
  ------------------
  210|      0|                   (ps_dec->i4_degrade_pic_cnt != ps_dec->i4_nondegrade_interval))
  ------------------
  |  Branch (210:20): [True: 0, False: 0]
  ------------------
  211|      0|                    degrade_pic = 1;
  212|       |
  213|      0|                break;
  214|      0|            }
  215|      0|            case 1:
  ------------------
  |  Branch (215:13): [True: 0, False: 0]
  ------------------
  216|      0|            {
  217|       |                /* Check if the current picture is non-ref */
  218|      0|                if(0 == ps_cur_slice->u1_nal_ref_idc)
  ------------------
  |  Branch (218:20): [True: 0, False: 0]
  ------------------
  219|      0|                {
  220|      0|                    degrade_pic = 1;
  221|      0|                }
  222|      0|                break;
  223|      0|            }
  224|      0|        }
  225|      0|        if(degrade_pic)
  ------------------
  |  Branch (225:12): [True: 0, False: 0]
  ------------------
  226|      0|        {
  227|      0|            if(ps_dec->i4_degrade_type & 0x2) ps_dec->u4_app_disable_deblk_frm = 1;
  ------------------
  |  Branch (227:16): [True: 0, False: 0]
  ------------------
  228|       |
  229|       |            /* MC degrading is done only for non-ref pictures */
  230|      0|            if(0 == ps_cur_slice->u1_nal_ref_idc)
  ------------------
  |  Branch (230:16): [True: 0, False: 0]
  ------------------
  231|      0|            {
  232|      0|                if(ps_dec->i4_degrade_type & 0x4) ps_dec->i4_mv_frac_mask = 0;
  ------------------
  |  Branch (232:20): [True: 0, False: 0]
  ------------------
  233|       |
  234|      0|                if(ps_dec->i4_degrade_type & 0x8) ps_dec->i4_mv_frac_mask = 0;
  ------------------
  |  Branch (234:20): [True: 0, False: 0]
  ------------------
  235|      0|            }
  236|      0|        }
  237|      0|        else
  238|      0|            ps_dec->i4_degrade_pic_cnt = 0;
  239|      0|    }
  240|       |
  241|  4.10k|    {
  242|  4.10k|        dec_err_status_t *ps_err = ps_dec->ps_dec_err_status;
  243|  4.10k|        if((ps_cur_slice->u1_slice_type == I_SLICE) || (ps_cur_slice->u1_slice_type == SI_SLICE))
  ------------------
  |  |  370|  4.10k|#define I_SLICE  2
  ------------------
                      if((ps_cur_slice->u1_slice_type == I_SLICE) || (ps_cur_slice->u1_slice_type == SI_SLICE))
  ------------------
  |  |  372|  3.28k|#define SI_SLICE 4
  ------------------
  |  Branch (243:12): [True: 821, False: 3.28k]
  |  Branch (243:56): [True: 0, False: 3.28k]
  ------------------
  244|    821|            ps_err->u1_cur_pic_type = PIC_TYPE_I;
  ------------------
  |  |  608|    821|#define PIC_TYPE_I        (0x00)
  ------------------
  245|  3.28k|        else
  246|  3.28k|            ps_err->u1_cur_pic_type = PIC_TYPE_UNKNOWN;
  ------------------
  |  |  607|  3.28k|#define PIC_TYPE_UNKNOWN  (0xFF)
  ------------------
  247|       |
  248|  4.10k|        if(ps_err->u1_pic_aud_i == PIC_TYPE_I)
  ------------------
  |  |  608|  4.10k|#define PIC_TYPE_I        (0x00)
  ------------------
  |  Branch (248:12): [True: 0, False: 4.10k]
  ------------------
  249|      0|        {
  250|      0|            ps_err->u1_cur_pic_type = PIC_TYPE_I;
  ------------------
  |  |  608|      0|#define PIC_TYPE_I        (0x00)
  ------------------
  251|      0|            ps_err->u1_pic_aud_i = PIC_TYPE_UNKNOWN;
  ------------------
  |  |  607|      0|#define PIC_TYPE_UNKNOWN  (0xFF)
  ------------------
  252|      0|        }
  253|       |
  254|  4.10k|        if(ps_cur_slice->u1_nal_unit_type == IDR_SLICE_NAL)
  ------------------
  |  |  328|  4.10k|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (254:12): [True: 3.54k, False: 557]
  ------------------
  255|  3.54k|        {
  256|  3.54k|            if(ps_err->u1_err_flag) ih264d_reset_ref_bufs(ps_dec->ps_dpb_mgr);
  ------------------
  |  Branch (256:16): [True: 0, False: 3.54k]
  ------------------
  257|  3.54k|            ps_err->u1_err_flag = ACCEPT_ALL_PICS;
  ------------------
  |  |  600|  3.54k|#define ACCEPT_ALL_PICS   (0x00)
  ------------------
  258|  3.54k|        }
  259|  4.10k|    }
  260|       |
  261|  4.10k|    if(ps_dec->u1_init_dec_flag && ps_dec->s_prev_seq_params.u1_eoseq_pending)
  ------------------
  |  Branch (261:8): [True: 3.94k, False: 160]
  |  Branch (261:36): [True: 0, False: 3.94k]
  ------------------
  262|      0|    {
  263|       |        /* Reset the decoder picture buffers */
  264|      0|        WORD32 j;
  265|      0|        for(j = 0; j < MAX_DISP_BUFS_NEW; j++)
  ------------------
  |  |   76|      0|#define MAX_DISP_BUFS_NEW 64
  ------------------
  |  Branch (265:20): [True: 0, False: 0]
  ------------------
  266|      0|        {
  267|      0|            ih264_buf_mgr_release((buf_mgr_t *) ps_dec->pv_pic_buf_mgr, j, BUF_MGR_REF);
  ------------------
  |  |   50|      0|#define BUF_MGR_REF          (1 << 2)
  ------------------
  268|      0|            ih264_buf_mgr_release((buf_mgr_t *) ps_dec->pv_mv_buf_mgr,
  269|      0|                                  ps_dec->as_buf_id_info_map[j].mv_buf_id, BUF_MGR_REF);
  ------------------
  |  |   50|      0|#define BUF_MGR_REF          (1 << 2)
  ------------------
  270|      0|            ih264_buf_mgr_release((buf_mgr_t *) ps_dec->pv_pic_buf_mgr, j, BUF_MGR_IO);
  ------------------
  |  |   53|      0|#define BUF_MGR_IO           (1 << 3)
  ------------------
  271|      0|        }
  272|       |
  273|       |        /* reset the decoder structure parameters related to buffer handling */
  274|      0|        ps_dec->u1_second_field = 0;
  275|      0|        ps_dec->i4_cur_display_seq = 0;
  276|       |
  277|       |        /********************************************************************/
  278|       |        /* indicate in the decoder output i4_status that some frames are being */
  279|       |        /* dropped, so that it resets timestamp and wait for a new sequence */
  280|       |        /********************************************************************/
  281|      0|        ps_dec->s_prev_seq_params.u1_eoseq_pending = 0;
  282|      0|    }
  283|  4.10k|    ret = isvcd_init_pic(ps_svc_lyr_dec, u2_frame_num, i4_poc, ps_pps);
  284|  4.10k|    if(ret != OK) return ret;
  ------------------
  |  |  114|  4.10k|#define OK        0
  ------------------
  |  Branch (284:8): [True: 0, False: 4.10k]
  ------------------
  285|       |
  286|  4.10k|    ps_dec->pv_parse_tu_coeff_data = ps_dec->pv_pic_tu_coeff_data;
  287|  4.10k|    ps_dec->pv_proc_tu_coeff_data = ps_dec->pv_pic_tu_coeff_data;
  288|  4.10k|    ps_dec->ps_nmb_info = ps_dec->ps_frm_mb_info;
  289|  4.10k|    ps_svc_lyr_dec->ps_svc_nmb_info = ps_svc_lyr_dec->ps_svc_frm_mb_info;
  290|  4.10k|    if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (290:8): [True: 846, False: 3.25k]
  ------------------
  291|    846|    {
  292|    846|        UWORD32 num_mbs;
  293|    846|        num_mbs = ps_dec->ps_cur_sps->u4_total_num_of_mbs
  294|    846|                  << (1 - ps_dec->ps_cur_sps->u1_frame_mbs_only_flag);
  295|       |
  296|    846|        if(ps_dec->pu1_dec_mb_map)
  ------------------
  |  Branch (296:12): [True: 846, False: 0]
  ------------------
  297|    846|        {
  298|    846|            memset((void *) ps_dec->pu1_dec_mb_map, 0, num_mbs);
  299|    846|        }
  300|       |
  301|    846|        if(ps_dec->pu1_recon_mb_map)
  ------------------
  |  Branch (301:12): [True: 846, False: 0]
  ------------------
  302|    846|        {
  303|    846|            memset((void *) ps_dec->pu1_recon_mb_map, 0, num_mbs);
  304|    846|        }
  305|       |
  306|    846|        if(ps_dec->pu2_slice_num_map)
  ------------------
  |  Branch (306:12): [True: 846, False: 0]
  ------------------
  307|    846|        {
  308|    846|            memset((void *) ps_dec->pu2_slice_num_map, 0, (num_mbs * sizeof(UWORD16)));
  309|    846|        }
  310|    846|    }
  311|       |
  312|  4.10k|    ps_dec->ps_parse_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
  313|  4.10k|    ps_dec->ps_decode_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
  314|  4.10k|    ps_dec->ps_computebs_cur_slice = &(ps_dec->ps_dec_slice_buf[0]);
  315|  4.10k|    ps_dec->u2_cur_slice_num = 0;
  316|       |
  317|       |    /* Initialize all the HP toolsets to zero */
  318|  4.10k|    ps_dec->s_high_profile.u1_scaling_present = 0;
  319|  4.10k|    ps_dec->s_high_profile.u1_transform8x8_present = 0;
  320|       |
  321|       |    /* Get Next Free Picture */
  322|  4.10k|    if(1 == ps_dec->u4_share_disp_buf)
  ------------------
  |  Branch (322:8): [True: 0, False: 4.10k]
  ------------------
  323|      0|    {
  324|      0|        UWORD32 i;
  325|       |        /* Free any buffer that is in the queue to be freed */
  326|      0|        for(i = 0; i < MAX_DISP_BUFS_NEW; i++)
  ------------------
  |  |   76|      0|#define MAX_DISP_BUFS_NEW 64
  ------------------
  |  Branch (326:20): [True: 0, False: 0]
  ------------------
  327|      0|        {
  328|      0|            if(0 == ps_dec->u4_disp_buf_to_be_freed[i]) continue;
  ------------------
  |  Branch (328:16): [True: 0, False: 0]
  ------------------
  329|      0|            ih264_buf_mgr_release((buf_mgr_t *) ps_dec->pv_pic_buf_mgr, i, BUF_MGR_IO);
  ------------------
  |  |   53|      0|#define BUF_MGR_IO           (1 << 3)
  ------------------
  330|      0|            ps_dec->u4_disp_buf_to_be_freed[i] = 0;
  331|      0|            ps_dec->u4_disp_buf_mapping[i] = 0;
  332|      0|        }
  333|      0|    }
  334|  4.10k|    if(!(u1_field_pic_flag && 0 != ps_dec->u1_top_bottom_decoded))
  ------------------
  |  Branch (334:10): [True: 0, False: 4.10k]
  |  Branch (334:31): [True: 0, False: 0]
  ------------------
  335|  4.10k|    {
  336|  4.10k|        pic_buffer_t *ps_cur_pic;
  337|  4.10k|        WORD32 cur_pic_buf_id, cur_mv_buf_id;
  338|  4.10k|        col_mv_buf_t *ps_col_mv;
  339|  4.10k|        while(1)
  ------------------
  |  Branch (339:15): [True: 4.10k, Folded]
  ------------------
  340|  4.10k|        {
  341|  4.10k|            ps_cur_pic = (pic_buffer_t *) ih264_buf_mgr_get_next_free(
  342|  4.10k|                (buf_mgr_t *) ps_dec->pv_pic_buf_mgr, &cur_pic_buf_id);
  343|       |
  344|       |            /* In case of IDR slices, if there is no free picture buffer, then release
  345|       |             * all buffers from display and reference
  346|       |             */
  347|  4.10k|            if((ps_cur_pic == NULL) && (ps_cur_slice->u1_nal_unit_type == IDR_SLICE_NAL))
  ------------------
  |  |  328|     33|#define IDR_SLICE_NAL                   5
  ------------------
  |  Branch (347:16): [True: 33, False: 4.07k]
  |  Branch (347:40): [True: 32, False: 1]
  ------------------
  348|     32|            {
  349|     32|                WORD32 j;
  350|       |
  351|  2.08k|                for(j = 0; j < MAX_DISP_BUFS_NEW; j++)
  ------------------
  |  |   76|  2.08k|#define MAX_DISP_BUFS_NEW 64
  ------------------
  |  Branch (351:28): [True: 2.04k, False: 32]
  ------------------
  352|  2.04k|                {
  353|  2.04k|                    ih264_buf_mgr_release((buf_mgr_t *) ps_dec->pv_pic_buf_mgr, j, BUF_MGR_REF);
  ------------------
  |  |   50|  2.04k|#define BUF_MGR_REF          (1 << 2)
  ------------------
  354|  2.04k|                    ih264_buf_mgr_release((buf_mgr_t *) ps_dec->pv_mv_buf_mgr,
  355|  2.04k|                                          ps_dec->as_buf_id_info_map[j].mv_buf_id, BUF_MGR_REF);
  ------------------
  |  |   50|  2.04k|#define BUF_MGR_REF          (1 << 2)
  ------------------
  356|       |
  357|  2.04k|                    ih264_buf_mgr_release((buf_mgr_t *) ps_dec->pv_pic_buf_mgr, j, BUF_MGR_IO);
  ------------------
  |  |   53|  2.04k|#define BUF_MGR_IO           (1 << 3)
  ------------------
  358|  2.04k|                }
  359|     32|                ps_cur_pic = (pic_buffer_t *) ih264_buf_mgr_get_next_free(
  360|     32|                    (buf_mgr_t *) ps_dec->pv_pic_buf_mgr, &cur_pic_buf_id);
  361|     32|            }
  362|  4.10k|            if(ps_cur_pic == NULL)
  ------------------
  |  Branch (362:16): [True: 1, False: 4.10k]
  ------------------
  363|      1|            {
  364|      1|                ps_dec->i4_error_code = ERROR_UNAVAIL_PICBUF_T;
  365|      1|                ps_dec->ps_dec_err_status->u1_err_flag |= REJECT_CUR_PIC;
  ------------------
  |  |  601|      1|#define REJECT_CUR_PIC    (0x01)
  ------------------
  366|      1|                return ERROR_UNAVAIL_PICBUF_T;
  367|      1|            }
  368|  4.10k|            if(0 == ps_dec->u4_disp_buf_mapping[cur_pic_buf_id])
  ------------------
  |  Branch (368:16): [True: 4.10k, False: 0]
  ------------------
  369|  4.10k|            {
  370|  4.10k|                break;
  371|  4.10k|            }
  372|  4.10k|        }
  373|  4.10k|        ps_col_mv = (col_mv_buf_t *) ih264_buf_mgr_get_next_free(
  374|  4.10k|            (buf_mgr_t *) ps_dec->pv_mv_buf_mgr, &cur_mv_buf_id);
  375|  4.10k|        if(ps_col_mv == NULL)
  ------------------
  |  Branch (375:12): [True: 10, False: 4.09k]
  ------------------
  376|     10|        {
  377|     10|            ps_dec->i4_error_code = ERROR_UNAVAIL_MVBUF_T;
  378|     10|            ps_dec->ps_dec_err_status->u1_err_flag |= REJECT_CUR_PIC;
  ------------------
  |  |  601|     10|#define REJECT_CUR_PIC    (0x01)
  ------------------
  379|     10|            return ERROR_UNAVAIL_MVBUF_T;
  380|     10|        }
  381|       |
  382|  4.09k|        ps_dec->ps_cur_pic = ps_cur_pic;
  383|  4.09k|        ps_dec->u1_pic_buf_id = cur_pic_buf_id;
  384|  4.09k|        ps_cur_pic->u4_ts = ps_dec->u4_ts;
  385|  4.09k|        memcpy(&ps_cur_pic->s_sei_pic, ps_dec->ps_sei, sizeof(sei));
  386|       |
  387|  4.09k|        ps_cur_pic->u1_mv_buf_id = cur_mv_buf_id;
  388|  4.09k|        ps_dec->as_buf_id_info_map[cur_pic_buf_id].mv_buf_id = cur_mv_buf_id;
  389|       |
  390|  4.09k|        if(ps_dec->u1_enable_mb_info)
  ------------------
  |  Branch (390:12): [True: 0, False: 4.09k]
  ------------------
  391|      0|        {
  392|      0|            UWORD32 mb_info_map_size = ps_dec->u4_total_mbs << 2;
  393|      0|            ps_dec->as_buf_id_info_map[cur_pic_buf_id].pu1_qp_map =
  394|      0|                ps_dec->pu1_qp_map_base + cur_pic_buf_id * mb_info_map_size;
  395|      0|            ps_dec->as_buf_id_info_map[cur_pic_buf_id].pu1_mb_type_map =
  396|      0|                ps_dec->pu1_mb_type_map_base + cur_pic_buf_id * mb_info_map_size;
  397|      0|            memset(ps_dec->as_buf_id_info_map[cur_pic_buf_id].pu1_qp_map, 0, mb_info_map_size);
  398|      0|            memset(ps_dec->as_buf_id_info_map[cur_pic_buf_id].pu1_mb_type_map, 0, mb_info_map_size);
  399|      0|        }
  400|  4.09k|        ps_cur_pic->pu1_col_zero_flag = (UWORD8 *) ps_col_mv->pv_col_zero_flag;
  401|  4.09k|        ps_cur_pic->ps_mv = (mv_pred_t *) ps_col_mv->pv_mv;
  402|  4.09k|        ps_dec->au1_pic_buf_ref_flag[cur_pic_buf_id] = 0;
  403|       |
  404|  4.09k|        {
  405|       |            /*make first entry of list0 and list1 point to cur pic,
  406|       |             *so that if first slice is in error, ref pic struct will have valid
  407|       |             *entries*/
  408|  4.09k|            ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_init_dpb[0];
  409|  4.09k|            ps_dec->ps_ref_pic_buf_lx[1] = ps_dec->ps_dpb_mgr->ps_init_dpb[1];
  410|  4.09k|            *(ps_dec->ps_dpb_mgr->ps_init_dpb[0][0]) = *ps_cur_pic;
  411|       |            /* Initialize for field reference as well */
  412|  4.09k|            *(ps_dec->ps_dpb_mgr->ps_init_dpb[0][MAX_REF_BUFS]) = *ps_cur_pic;
  ------------------
  |  |   75|  4.09k|#define MAX_REF_BUFS    32
  ------------------
  413|       |
  414|  4.09k|            *(ps_dec->ps_dpb_mgr->ps_mod_dpb[0][0]) = *ps_cur_pic;
  415|       |            /* Initialize for field reference as well */
  416|  4.09k|            *(ps_dec->ps_dpb_mgr->ps_mod_dpb[0][MAX_REF_BUFS]) = *ps_cur_pic;
  ------------------
  |  |   75|  4.09k|#define MAX_REF_BUFS    32
  ------------------
  417|  4.09k|            *(ps_dec->ps_dpb_mgr->ps_init_dpb[1][0]) = *ps_cur_pic;
  418|       |            /* Initialize for field reference as well */
  419|  4.09k|            *(ps_dec->ps_dpb_mgr->ps_init_dpb[1][MAX_REF_BUFS]) = *ps_cur_pic;
  ------------------
  |  |   75|  4.09k|#define MAX_REF_BUFS    32
  ------------------
  420|  4.09k|            *(ps_dec->ps_dpb_mgr->ps_mod_dpb[1][0]) = *ps_cur_pic;
  421|       |            /* Initialize for field reference as well */
  422|  4.09k|            *(ps_dec->ps_dpb_mgr->ps_mod_dpb[1][MAX_REF_BUFS]) = *ps_cur_pic;
  ------------------
  |  |   75|  4.09k|#define MAX_REF_BUFS    32
  ------------------
  423|  4.09k|        }
  424|       |
  425|  4.09k|        ps_dec->ps_cur_pic->u1_picturetype = u1_field_pic_flag;
  426|  4.09k|        ps_dec->ps_cur_pic->u4_pack_slc_typ = SKIP_NONE;
  ------------------
  |  |  375|  4.09k|#define SKIP_NONE  (0x0)
  ------------------
  427|  4.09k|        H264_DEC_DEBUG_PRINT("got a buffer\n");
  ------------------
  |  |   39|  4.09k|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
  428|  4.09k|    }
  429|      0|    else
  430|      0|    {
  431|      0|        H264_DEC_DEBUG_PRINT("did not get a buffer\n");
  ------------------
  |  |   39|      0|#define H264_DEC_DEBUG_PRINT(...) {}
  ------------------
  432|      0|    }
  433|       |
  434|  4.09k|    ps_dec->u4_pic_buf_got = 1;
  435|       |
  436|  4.09k|    ps_dec->ps_cur_pic->i4_poc = i4_poc;
  437|  4.09k|    ps_dec->ps_cur_pic->i4_frame_num = u2_frame_num;
  438|  4.09k|    ps_dec->ps_cur_pic->i4_pic_num = u2_frame_num;
  439|  4.09k|    ps_dec->ps_cur_pic->i4_top_field_order_cnt = ps_pps->i4_top_field_order_cnt;
  440|  4.09k|    ps_dec->ps_cur_pic->i4_bottom_field_order_cnt = ps_pps->i4_bottom_field_order_cnt;
  441|  4.09k|    ps_dec->ps_cur_pic->i4_avg_poc = ps_pps->i4_avg_poc;
  442|  4.09k|    ps_dec->ps_cur_pic->u4_time_stamp = ps_dec->u4_pts;
  443|       |
  444|  4.09k|    ps_dec->s_cur_pic = *(ps_dec->ps_cur_pic);
  445|  4.09k|    if(u1_field_pic_flag && u1_bottom_field_flag)
  ------------------
  |  Branch (445:8): [True: 0, False: 4.09k]
  |  Branch (445:29): [True: 0, False: 0]
  ------------------
  446|      0|    {
  447|      0|        WORD32 i4_temp_poc;
  448|      0|        WORD32 i4_top_field_order_poc, i4_bot_field_order_poc;
  449|       |        /* Point to odd lines, since it's bottom field */
  450|      0|        ps_dec->s_cur_pic.pu1_buf1 += ps_dec->s_cur_pic.u2_frm_wd_y;
  451|      0|        ps_dec->s_cur_pic.pu1_buf2 += ps_dec->s_cur_pic.u2_frm_wd_uv;
  452|      0|        ps_dec->s_cur_pic.pu1_buf3 += ps_dec->s_cur_pic.u2_frm_wd_uv;
  453|      0|        ps_dec->s_cur_pic.ps_mv += ((ps_dec->u2_pic_ht * ps_dec->u2_pic_wd) >> 5);
  454|      0|        ps_dec->s_cur_pic.pu1_col_zero_flag += ((ps_dec->u2_pic_ht * ps_dec->u2_pic_wd) >> 5);
  455|      0|        ps_dec->ps_cur_pic->u1_picturetype |= BOT_FLD;
  ------------------
  |  |  354|      0|#define BOT_FLD         0x02
  ------------------
  456|      0|        i4_top_field_order_poc = ps_dec->ps_cur_pic->i4_top_field_order_cnt;
  457|      0|        i4_bot_field_order_poc = ps_dec->ps_cur_pic->i4_bottom_field_order_cnt;
  458|      0|        i4_temp_poc = MIN(i4_top_field_order_poc, i4_bot_field_order_poc);
  ------------------
  |  |   61|      0|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  459|      0|        ps_dec->ps_cur_pic->i4_avg_poc = i4_temp_poc;
  460|      0|    }
  461|       |
  462|  4.09k|    ps_cur_slice->u1_mbaff_frame_flag = ps_seq->u1_mb_aff_flag && (!u1_field_pic_flag);
  ------------------
  |  Branch (462:41): [True: 0, False: 4.09k]
  |  Branch (462:67): [True: 0, False: 0]
  ------------------
  463|  4.09k|    ps_dec->ps_cur_pic->u1_picturetype |= (ps_cur_slice->u1_mbaff_frame_flag << 2);
  464|       |
  465|  4.09k|    ps_dec->ps_cur_mb_row = ps_dec->ps_nbr_mb_row;
  466|  4.09k|    ps_dec->ps_cur_mb_row += 2;
  467|  4.09k|    ps_dec->ps_top_mb_row = ps_dec->ps_nbr_mb_row;
  468|  4.09k|    ps_dec->ps_top_mb_row +=
  469|  4.09k|        ((ps_dec->u2_frm_wd_in_mbs + 2) << (1 - ps_dec->ps_cur_sps->u1_frame_mbs_only_flag));
  470|       |    // Increment by 2 ,so that left mb (mbaff decrements by 2)  will always be valid
  471|  4.09k|    ps_dec->ps_top_mb_row += 2;
  472|  4.09k|    ps_dec->ps_mv_cur = ps_dec->s_cur_pic.ps_mv;
  473|  4.09k|    ps_dec->ps_mv_top = ps_dec->ps_mv_top_p[0];
  474|  4.09k|    ps_dec->u1_mv_top_p = 0;
  475|  4.09k|    ps_dec->u4_mb_idx = 0;
  476|  4.09k|    ps_dec->ps_mv_left = ps_dec->s_cur_pic.ps_mv;
  477|  4.09k|    ps_dec->u4_total_mbs_coded = 0;
  478|  4.09k|    ps_dec->i4_submb_ofst = -(SUB_BLK_SIZE);
  ------------------
  |  |  562|  4.09k|#define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|  4.09k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  |  |               #define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|  4.09k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  ------------------
  479|  4.09k|    ps_dec->u4_pred_info_idx = 0;
  480|  4.09k|    ps_dec->u4_pred_info_pkd_idx = 0;
  481|  4.09k|    ps_dec->u4_dma_buf_idx = 0;
  482|  4.09k|    ps_dec->ps_mv = ps_dec->s_cur_pic.ps_mv;
  483|  4.09k|    ps_dec->ps_mv_bank_cur = ps_dec->s_cur_pic.ps_mv;
  484|  4.09k|    ps_dec->pu1_col_zero_flag = ps_dec->s_cur_pic.pu1_col_zero_flag;
  485|  4.09k|    ps_dec->ps_part = ps_dec->ps_parse_part_params;
  486|  4.09k|    ps_dec->i2_prev_slice_mbx = -1;
  487|  4.09k|    ps_dec->i2_prev_slice_mby = 0;
  488|  4.09k|    ps_dec->u2_mv_2mb[0] = 0;
  489|  4.09k|    ps_dec->u2_mv_2mb[1] = 0;
  490|  4.09k|    ps_dec->u1_last_pic_not_decoded = 0;
  491|       |
  492|  4.09k|    ps_dec->u2_cur_slice_num_dec_thread = 0;
  493|  4.09k|    ps_dec->u2_cur_slice_num_bs = 0;
  494|  4.09k|    ps_dec->u4_intra_pred_line_ofst = 0;
  495|  4.09k|    ps_dec->pu1_cur_y_intra_pred_line = ps_dec->pu1_y_intra_pred_line;
  496|  4.09k|    ps_dec->pu1_cur_u_intra_pred_line = ps_dec->pu1_u_intra_pred_line;
  497|  4.09k|    ps_dec->pu1_cur_v_intra_pred_line = ps_dec->pu1_v_intra_pred_line;
  498|       |
  499|  4.09k|    ps_dec->pu1_cur_y_intra_pred_line_base = ps_dec->pu1_y_intra_pred_line;
  500|  4.09k|    ps_dec->pu1_cur_u_intra_pred_line_base = ps_dec->pu1_u_intra_pred_line;
  501|  4.09k|    ps_dec->pu1_cur_v_intra_pred_line_base = ps_dec->pu1_v_intra_pred_line;
  502|       |
  503|  4.09k|    ps_dec->pu1_prev_y_intra_pred_line =
  504|  4.09k|        ps_dec->pu1_y_intra_pred_line + (ps_dec->u2_frm_wd_in_mbs * MB_SIZE);
  ------------------
  |  |  554|  4.09k|#define MB_SIZE             16
  ------------------
  505|       |
  506|  4.09k|    ps_dec->pu1_prev_u_intra_pred_line =
  507|  4.09k|        ps_dec->pu1_u_intra_pred_line + ps_dec->u2_frm_wd_in_mbs * BLK8x8SIZE * YUV420SP_FACTOR;
  ------------------
  |  |  555|  4.09k|#define BLK8x8SIZE          8
  ------------------
                      ps_dec->pu1_u_intra_pred_line + ps_dec->u2_frm_wd_in_mbs * BLK8x8SIZE * YUV420SP_FACTOR;
  ------------------
  |  |  119|  4.09k|#define YUV420SP_FACTOR 2
  ------------------
  508|  4.09k|    ps_dec->pu1_prev_v_intra_pred_line =
  509|  4.09k|        ps_dec->pu1_v_intra_pred_line + ps_dec->u2_frm_wd_in_mbs * BLK8x8SIZE;
  ------------------
  |  |  555|  4.09k|#define BLK8x8SIZE          8
  ------------------
  510|       |
  511|  4.09k|    ps_dec->ps_deblk_mbn = ps_dec->ps_deblk_pic;
  512|       |    /* Initialize The Function Pointer Depending Upon the Entropy and MbAff Flag
  513|       |     */
  514|  4.09k|    {
  515|  4.09k|        if(ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (515:12): [True: 0, False: 4.09k]
  ------------------
  516|      0|        {
  517|      0|            ps_dec->pf_compute_bs = ih264d_compute_bs_mbaff;
  518|      0|            ps_dec->pf_mvpred = ih264d_mvpred_mbaff;
  519|      0|            ps_svc_lyr_dec->pf_svc_compute_bs = isvcd_compute_bs_non_mbaff;
  520|      0|        }
  521|  4.09k|        else
  522|  4.09k|        {
  523|  4.09k|            ps_dec->pf_compute_bs = ih264d_compute_bs_non_mbaff;
  524|  4.09k|            ps_svc_lyr_dec->pf_svc_compute_bs = isvcd_compute_bs_non_mbaff;
  525|  4.09k|            ps_dec->u1_cur_mb_fld_dec_flag = ps_cur_slice->u1_field_pic_flag;
  526|       |
  527|  4.09k|            if((ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER) &&
  ------------------
  |  |  110|  4.09k|#define TARGET_LAYER 2
  ------------------
  |  Branch (527:16): [True: 2.32k, False: 1.77k]
  ------------------
  528|  2.32k|               (0 == ps_svc_lyr_dec->u1_base_res_flag))
  ------------------
  |  Branch (528:16): [True: 720, False: 1.60k]
  ------------------
  529|    720|            {
  530|    720|                ps_svc_lyr_dec->pf_svc_compute_bs = isvcd_compute_bs_non_mbaff_target_lyr;
  531|    720|            }
  532|       |
  533|  4.09k|            if((ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER) &&
  ------------------
  |  |  110|  4.09k|#define TARGET_LAYER 2
  ------------------
  |  Branch (533:16): [True: 2.32k, False: 1.77k]
  ------------------
  534|  2.32k|               (1 == ps_svc_lyr_dec->u1_base_res_flag))
  ------------------
  |  Branch (534:16): [True: 1.60k, False: 720]
  ------------------
  535|  1.60k|            {
  536|  1.60k|                ps_svc_lyr_dec->pf_svc_compute_bs =
  537|  1.60k|                    isvcd_compute_bs_non_mbaff_target_lyr_no_inter_layer;
  538|  1.60k|            }
  539|       |
  540|  4.09k|            if((ps_svc_lyr_dec->u1_layer_identifier == MEDIAL_ENHANCEMENT_LAYER) &&
  ------------------
  |  |  109|  4.09k|#define MEDIAL_ENHANCEMENT_LAYER 1
  ------------------
  |  Branch (540:16): [True: 0, False: 4.09k]
  ------------------
  541|      0|               (0 == ps_svc_lyr_dec->u1_base_res_flag))
  ------------------
  |  Branch (541:16): [True: 0, False: 0]
  ------------------
  542|      0|            {
  543|      0|                ps_svc_lyr_dec->pf_svc_compute_bs = isvcd_compute_bs_non_mbaff_medial_lyr;
  544|      0|            }
  545|  4.09k|        }
  546|  4.09k|    }
  547|       |    /* Set up the Parameter for DMA transfer */
  548|  4.09k|    {
  549|  4.09k|        UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag;
  550|  4.09k|        UWORD8 u1_mbaff = ps_cur_slice->u1_mbaff_frame_flag;
  551|  4.09k|        UWORD16 uc_lastmbs = (((ps_dec->u2_pic_wd) >> 4) % (ps_dec->u4_recon_mb_grp >> u1_mbaff));
  552|  4.09k|        UWORD16 ui16_lastmbs_widthY =
  553|  4.09k|            (uc_lastmbs ? (uc_lastmbs << 4) : ((ps_dec->u4_recon_mb_grp >> u1_mbaff) << 4));
  ------------------
  |  Branch (553:14): [True: 0, False: 4.09k]
  ------------------
  554|  4.09k|        UWORD16 ui16_lastmbs_widthUV =
  555|  4.09k|            uc_lastmbs ? (uc_lastmbs << 3) : ((ps_dec->u4_recon_mb_grp >> u1_mbaff) << 3);
  ------------------
  |  Branch (555:13): [True: 0, False: 4.09k]
  ------------------
  556|       |
  557|  4.09k|        ps_dec->s_tran_addrecon.pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1;
  558|  4.09k|        ps_dec->s_tran_addrecon.pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2;
  559|  4.09k|        ps_dec->s_tran_addrecon.pu1_dest_v = ps_dec->s_cur_pic.pu1_buf3;
  560|       |
  561|  4.09k|        ps_dec->s_tran_addrecon.u2_frm_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag;
  562|  4.09k|        ps_dec->s_tran_addrecon.u2_frm_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag;
  563|       |
  564|  4.09k|        if(u1_field_pic_flag)
  ------------------
  |  Branch (564:12): [True: 0, False: 4.09k]
  ------------------
  565|      0|        {
  566|      0|            ui16_lastmbs_widthY += ps_dec->u2_frm_wd_y;
  567|      0|            ui16_lastmbs_widthUV += ps_dec->u2_frm_wd_uv;
  568|      0|        }
  569|       |
  570|       |        /* Normal Increment of Pointer */
  571|  4.09k|        ps_dec->s_tran_addrecon.u4_inc_y[0] = ((ps_dec->u4_recon_mb_grp << 4) >> u1_mbaff);
  572|  4.09k|        ps_dec->s_tran_addrecon.u4_inc_uv[0] = ((ps_dec->u4_recon_mb_grp << 4) >> u1_mbaff);
  573|       |
  574|       |        /* End of Row Increment */
  575|  4.09k|        ps_dec->s_tran_addrecon.u4_inc_y[1] =
  576|  4.09k|            (ui16_lastmbs_widthY + (PAD_LEN_Y_H << 1) +
  ------------------
  |  |  571|  4.09k|#define PAD_LEN_Y_H                   32
  ------------------
  577|  4.09k|             ps_dec->s_tran_addrecon.u2_frm_wd_y * ((15 << u1_mbaff) + u1_mbaff));
  578|  4.09k|        ps_dec->s_tran_addrecon.u4_inc_uv[1] =
  579|  4.09k|            (ui16_lastmbs_widthUV + (PAD_LEN_UV_H << 2) +
  ------------------
  |  |  573|  4.09k|#define PAD_LEN_UV_H                  16
  ------------------
  580|  4.09k|             ps_dec->s_tran_addrecon.u2_frm_wd_uv * ((15 << u1_mbaff) + u1_mbaff));
  581|       |
  582|       |        /* Assign picture numbers to each frame/field  */
  583|       |        /* only once per picture.                      */
  584|  4.09k|        ih264d_assign_pic_num(ps_dec);
  585|  4.09k|        ps_dec->s_tran_addrecon.u2_mv_top_left_inc =
  586|  4.09k|            (ps_dec->u4_recon_mb_grp << 2) - 1 - (u1_mbaff << 2);
  587|  4.09k|        ps_dec->s_tran_addrecon.u2_mv_left_inc = ((ps_dec->u4_recon_mb_grp >> u1_mbaff) - 1)
  588|  4.09k|                                                 << (4 + u1_mbaff);
  589|  4.09k|    }
  590|       |    /**********************************************************************/
  591|       |    /* High profile related initialization at pictrue level               */
  592|       |    /**********************************************************************/
  593|  4.09k|    if((ps_seq->u1_profile_idc == HIGH_PROFILE_IDC) ||
  ------------------
  |  |  278|  4.09k|#define HIGH_PROFILE_IDC   100
  ------------------
  |  Branch (593:8): [True: 426, False: 3.66k]
  ------------------
  594|  3.66k|       (ps_seq->u1_profile_idc == SCALABLE_HIGH_PROFILE_IDC) ||
  ------------------
  |  |   60|  3.66k|#define SCALABLE_HIGH_PROFILE_IDC 86
  ------------------
  |  Branch (594:8): [True: 462, False: 3.20k]
  ------------------
  595|  3.20k|       (ps_seq->u1_profile_idc == SCALABLE_BASELINE_PROFILE_IDC))
  ------------------
  |  |   59|  3.20k|#define SCALABLE_BASELINE_PROFILE_IDC 83
  ------------------
  |  Branch (595:8): [True: 134, False: 3.07k]
  ------------------
  596|  1.02k|    {
  597|  1.02k|        if((ps_seq->i4_seq_scaling_matrix_present_flag) ||
  ------------------
  |  Branch (597:12): [True: 1.01k, False: 8]
  ------------------
  598|      8|           (ps_pps->i4_pic_scaling_matrix_present_flag))
  ------------------
  |  Branch (598:12): [True: 0, False: 8]
  ------------------
  599|  1.01k|        {
  600|  1.01k|            ret = ih264d_form_scaling_matrix_picture(ps_seq, ps_pps, ps_dec);
  601|  1.01k|            ps_dec->s_high_profile.u1_scaling_present = 1;
  602|  1.01k|        }
  603|      8|        else
  604|      8|        {
  605|      8|            ret = ih264d_form_default_scaling_matrix(ps_dec);
  606|      8|        }
  607|       |
  608|  1.02k|        if(ps_pps->i4_transform_8x8_mode_flag)
  ------------------
  |  Branch (608:12): [True: 987, False: 35]
  ------------------
  609|    987|        {
  610|    987|            ps_dec->s_high_profile.u1_transform8x8_present = 1;
  611|    987|        }
  612|  1.02k|    }
  613|  3.07k|    else
  614|  3.07k|    {
  615|  3.07k|        ret = ih264d_form_default_scaling_matrix(ps_dec);
  616|  3.07k|    }
  617|       |
  618|  4.09k|    if(ret != OK) return ret;
  ------------------
  |  |  114|  4.09k|#define OK        0
  ------------------
  |  Branch (618:8): [True: 0, False: 4.09k]
  ------------------
  619|       |
  620|       |    /* required while reading the transform_size_8x8 u4_flag */
  621|  4.09k|    ps_dec->s_high_profile.u1_direct_8x8_inference_flag = ps_seq->u1_direct_8x8_inference_flag;
  622|  4.09k|    ps_dec->s_high_profile.s_cavlc_ctxt = ps_dec->s_cavlc_ctxt;
  623|       |
  624|  4.09k|    ps_dec->i1_recon_in_thread3_flag = 1;
  625|  4.09k|    ps_dec->ps_frame_buf_ip_recon = &ps_dec->s_tran_addrecon;
  626|  4.09k|    if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (626:8): [True: 846, False: 3.24k]
  ------------------
  627|    846|    {
  628|    846|        memcpy(&ps_dec->s_tran_addrecon_parse, &ps_dec->s_tran_addrecon, sizeof(tfr_ctxt_t));
  629|    846|    }
  630|       |
  631|  4.09k|    ih264d_init_deblk_tfr_ctxt(ps_dec, &(ps_dec->s_pad_mgr), &(ps_dec->s_tran_addrecon),
  632|  4.09k|                               ps_dec->u2_frm_wd_in_mbs, 0);
  633|       |
  634|  4.09k|    ps_dec->ps_cur_deblk_mb = ps_dec->ps_deblk_pic;
  635|  4.09k|    ps_dec->u4_cur_deblk_mb_num = 0;
  636|  4.09k|    ps_dec->u4_deblk_mb_x = 0;
  637|  4.09k|    ps_dec->u4_deblk_mb_y = 0;
  638|  4.09k|    ps_dec->pu4_wt_ofsts = ps_dec->pu4_wts_ofsts_mat;
  639|       |
  640|  4.09k|    ps_dec->u4_first_slice_in_pic = 0;
  641|  4.09k|    H264_MUTEX_UNLOCK(&ps_dec->process_disp_mutex);
  642|  4.09k|    return OK;
  ------------------
  |  |  114|  4.09k|#define OK        0
  ------------------
  643|  4.09k|}
isvcd_parse_decode_slice_ext_nal:
  657|  1.01k|{
  658|  1.01k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  659|  1.01k|    dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm;
  660|  1.01k|    dec_pic_params_t *ps_pps;
  661|  1.01k|    dec_seq_params_t *ps_seq;
  662|  1.01k|    dec_svc_seq_params_t *ps_subset_seq;
  663|  1.01k|    dec_slice_params_t *ps_cur_slice = NULL;
  664|  1.01k|    dec_slice_svc_ext_params_t *ps_svc_slice_params = NULL;
  665|       |
  666|  1.01k|    pocstruct_t s_tmp_poc = {0};
  667|  1.01k|    WORD32 i_delta_poc[2] = {0};
  668|  1.01k|    WORD32 i4_poc = 0;
  669|  1.01k|    UWORD16 u2_first_mb_in_slice, u2_frame_num;
  670|  1.01k|    UWORD8 u1_field_pic_flag, u1_redundant_pic_cnt = 0, u1_slice_type;
  671|  1.01k|    UWORD32 u4_idr_pic_id = 0;
  672|  1.01k|    UWORD8 u1_bottom_field_flag, u1_pic_order_cnt_type;
  673|       |
  674|  1.01k|    UWORD8 u1_nal_unit_type;
  675|  1.01k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
  676|  1.01k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
  677|  1.01k|    WORD8 i1_is_end_of_poc;
  678|  1.01k|    WORD32 ret;
  679|  1.01k|    WORD32 prev_slice_err, num_mb_skipped;
  680|  1.01k|    UWORD8 u1_mbaff;
  681|  1.01k|    pocstruct_t *ps_cur_poc;
  682|  1.01k|    UWORD32 u4_temp;
  683|  1.01k|    WORD32 i_temp;
  684|  1.01k|    svc_dec_ctxt_t *psvcd_dec_ctxt;
  685|  1.01k|    dec_struct_t *ps_dec_cur_lyr_minus_1;
  686|  1.01k|    svc_dec_lyr_struct_t *ps_svc_cur_lyr_dec_minus_1;
  687|       |
  688|  1.01k|    ps_cur_slice = ps_dec->ps_cur_slice;
  689|  1.01k|    ps_svc_slice_params = &ps_svc_lyr_dec->s_svc_slice_params;
  690|       |
  691|       |    /* read FirstMbInSlice  and slice type*/
  692|  1.01k|    ps_dec->ps_dpb_cmds->u1_dpb_commands_read_slc = 0;
  693|  1.01k|    u2_first_mb_in_slice = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  694|  1.01k|    if(u2_first_mb_in_slice > (ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs))
  ------------------
  |  Branch (694:8): [True: 21, False: 992]
  ------------------
  695|     21|    {
  696|     21|        return ERROR_CORRUPTED_SLICE;
  697|     21|    }
  698|       |
  699|       |    /*we currently don not support ASO*/
  700|    992|    if(((u2_first_mb_in_slice << ps_cur_slice->u1_mbaff_frame_flag) <= ps_dec->u4_cur_mb_addr) &&
  ------------------
  |  Branch (700:8): [True: 992, False: 0]
  ------------------
  701|    992|       (ps_dec->u4_first_slice_in_pic == 0))
  ------------------
  |  Branch (701:8): [True: 3, False: 989]
  ------------------
  702|      3|    {
  703|      3|        return ERROR_CORRUPTED_SLICE;
  704|      3|    }
  705|       |
  706|    989|    if(ps_dec->u4_first_slice_in_pic == 1)
  ------------------
  |  Branch (706:8): [True: 989, False: 0]
  ------------------
  707|    989|    {
  708|    989|        if(u2_first_mb_in_slice != 0)
  ------------------
  |  Branch (708:12): [True: 0, False: 989]
  ------------------
  709|      0|        {
  710|      0|            return ERROR_CORRUPTED_SLICE;
  711|      0|        }
  712|    989|    }
  713|       |
  714|    989|    COPYTHECONTEXT("Slice Header SVC ext: first_mb_in_slice", u2_first_mb_in_slice);
  715|       |
  716|    989|    u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  717|       |
  718|    989|    if(u4_temp > 9) return ERROR_INV_SLC_TYPE_T;
  ------------------
  |  Branch (718:8): [True: 0, False: 989]
  ------------------
  719|       |
  720|    989|    u1_slice_type = u4_temp;
  721|    989|    COPYTHECONTEXT("Slice Header SVC ext: slice_type", (u1_slice_type));
  722|       |    /* Find Out the Slice Type is 5 to 9 or not then Set the Flag   */
  723|       |    /* u1_sl_typ_5_9 = 1 .Which tells that all the slices in the Pic*/
  724|       |    /* will be of same type of current                            */
  725|    989|    if(u1_slice_type > 4)
  ------------------
  |  Branch (725:8): [True: 0, False: 989]
  ------------------
  726|      0|    {
  727|      0|        u1_slice_type -= 5;
  728|      0|    }
  729|       |
  730|    989|    u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  731|    989|    if(u4_temp & MASK_ERR_PIC_SET_ID) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  |  527|    989|#define MASK_ERR_PIC_SET_ID   (0xFFFFFF00)
  ------------------
  |  Branch (731:8): [True: 0, False: 989]
  ------------------
  732|       |    /* discard slice if pic param is invalid */
  733|    989|    COPYTHECONTEXT("Slice Header SVC ext: pic_parameter_set_id", u4_temp);
  734|    989|    ps_pps = &ps_dec->ps_pps[u4_temp];
  735|    989|    if(FALSE == ps_pps->u1_is_valid)
  ------------------
  |  |  592|    989|#define FALSE   0
  ------------------
  |  Branch (735:8): [True: 0, False: 989]
  ------------------
  736|      0|    {
  737|      0|        return ERROR_INV_SLICE_HDR_T;
  738|      0|    }
  739|       |    /* slices in a layer should have same PPS id*/
  740|    989|    if(UINT32_MAX == ps_svc_lyr_dec->u4_pps_id_for_layer)
  ------------------
  |  Branch (740:8): [True: 989, False: 0]
  ------------------
  741|    989|    {
  742|    989|        ps_svc_lyr_dec->u4_pps_id_for_layer = u4_temp;
  743|    989|    }
  744|      0|    else if(u4_temp != ps_svc_lyr_dec->u4_pps_id_for_layer)
  ------------------
  |  Branch (744:13): [True: 0, False: 0]
  ------------------
  745|      0|    {
  746|      0|        return ERROR_INV_SLICE_HDR_T;
  747|      0|    }
  748|    989|    ps_seq = ps_pps->ps_sps;
  749|    989|    ps_seq += MAX_NUM_SEQ_PARAMS;
  ------------------
  |  |  521|    989|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
  750|    989|    ps_subset_seq =
  751|    989|        &ps_svc_lyr_dec->ps_subset_sps[MAX_NUM_SEQ_PARAMS + ps_seq->u1_seq_parameter_set_id];
  ------------------
  |  |  521|    989|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
  752|       |
  753|    989|    ps_dec->ps_cur_sps = ps_seq;
  754|    989|    ps_svc_lyr_dec->ps_cur_subset_sps = ps_subset_seq;
  755|       |
  756|    989|    if(!ps_seq) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (756:8): [True: 0, False: 989]
  ------------------
  757|    989|    if(FALSE == ps_seq->u1_is_valid) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  |  592|    989|#define FALSE   0
  ------------------
  |  Branch (757:8): [True: 23, False: 966]
  ------------------
  758|    966|    if(ps_seq->u1_mb_aff_flag) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (758:8): [True: 0, False: 966]
  ------------------
  759|    966|    if(ps_seq->u1_level_idc > H264_LEVEL_4_2) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  |  303|    966|#define H264_LEVEL_4_2     42
  ------------------
  |  Branch (759:8): [True: 1, False: 965]
  ------------------
  760|    965|    if(!ps_seq->u1_frame_mbs_only_flag) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (760:8): [True: 28, False: 937]
  ------------------
  761|    937|    if(OK != isvcd_verify_level(ps_seq->u1_level_idc)) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  |  114|    937|#define OK        0
  ------------------
  |  Branch (761:8): [True: 0, False: 937]
  ------------------
  762|       |
  763|    937|    if(ps_dec->u1_init_dec_flag == 1)
  ------------------
  |  Branch (763:8): [True: 823, False: 114]
  ------------------
  764|    823|    {
  765|    823|        if(ps_dec->u2_frm_wd_in_mbs != ps_seq->u2_frm_wd_in_mbs) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (765:12): [True: 0, False: 823]
  ------------------
  766|    823|        if(ps_dec->u2_frm_ht_in_mbs != ps_seq->u2_frm_ht_in_mbs) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (766:12): [True: 0, False: 823]
  ------------------
  767|    823|    }
  768|       |
  769|    937|    if(ps_dec->u1_init_dec_flag == 1)
  ------------------
  |  Branch (769:8): [True: 823, False: 114]
  ------------------
  770|    823|    {
  771|    823|        if(ps_dec->u2_disp_height != ps_subset_seq->u2_disp_height) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (771:12): [True: 0, False: 823]
  ------------------
  772|    823|        if(ps_dec->u2_disp_width != ps_subset_seq->u2_disp_width) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (772:12): [True: 0, False: 823]
  ------------------
  773|    823|    }
  774|       |
  775|    937|    ps_dec->i4_reorder_depth = ps_subset_seq->i4_reorder_depth;
  776|       |
  777|    937|    ps_dec->u2_disp_height = ps_subset_seq->u2_disp_height;
  778|    937|    ps_dec->u2_disp_width = ps_subset_seq->u2_disp_width;
  779|       |
  780|    937|    if(ps_svc_lyr_dec->u1_layer_id > 0)
  ------------------
  |  Branch (780:8): [True: 937, False: 0]
  ------------------
  781|    937|    {
  782|    937|        psvcd_dec_ctxt = ps_svc_lyr_dec->ps_svcd_ctxt;
  783|    937|        ps_svc_cur_lyr_dec_minus_1 =
  784|    937|            &psvcd_dec_ctxt->ps_svc_dec_lyr[ps_svc_lyr_dec->u1_layer_id - 1];
  785|       |
  786|    937|        ps_dec_cur_lyr_minus_1 = &ps_svc_cur_lyr_dec_minus_1->s_dec;
  787|       |
  788|    937|        if((ps_dec_cur_lyr_minus_1->u2_pic_wd > ps_subset_seq->u2_pic_wd) ||
  ------------------
  |  Branch (788:12): [True: 0, False: 937]
  ------------------
  789|    937|           (ps_dec_cur_lyr_minus_1->u2_pic_ht > ps_subset_seq->u2_pic_ht))
  ------------------
  |  Branch (789:12): [True: 14, False: 923]
  ------------------
  790|     14|        {
  791|     14|            return ERROR_CORRUPTED_SLICE;
  792|     14|        }
  793|    937|    }
  794|       |
  795|    923|    ps_dec->u2_pic_wd = ps_subset_seq->u2_pic_wd;
  796|    923|    ps_dec->u2_pic_ht = ps_subset_seq->u2_pic_ht;
  797|    923|    ps_dec->u4_total_mbs = ps_seq->u4_total_num_of_mbs << (1 - ps_seq->u1_frame_mbs_only_flag);
  798|       |
  799|       |    /* Determining the Width and Height of Frame from that of Picture */
  800|    923|    ps_dec->u2_frm_wd_y = ps_subset_seq->u2_frm_wd_y;
  801|    923|    ps_dec->u2_frm_ht_y = ps_subset_seq->u2_frm_ht_y;
  802|       |
  803|    923|    ps_dec->u2_frm_wd_uv = ps_subset_seq->u2_frm_wd_uv;
  804|    923|    ps_dec->u2_frm_ht_uv = ps_subset_seq->u2_frm_ht_uv;
  805|       |
  806|    923|    ps_dec->s_pad_mgr.u1_pad_len_y_v = ps_subset_seq->u1_pad_len_y_v;
  807|    923|    ps_dec->s_pad_mgr.u1_pad_len_cr_v = ps_subset_seq->u1_pad_len_cr_v;
  808|       |
  809|    923|    ps_dec->u2_frm_wd_in_mbs = ps_seq->u2_frm_wd_in_mbs;
  810|    923|    ps_dec->u2_frm_ht_in_mbs = ps_seq->u2_frm_ht_in_mbs;
  811|       |
  812|    923|    ps_dec->u2_crop_offset_y = ps_subset_seq->u2_crop_offset_y;
  813|    923|    ps_dec->u2_crop_offset_uv = ps_subset_seq->u2_crop_offset_uv;
  814|       |
  815|       |    /* Get the frame num */
  816|    923|    u2_frame_num = ih264d_get_bits_h264(ps_bitstrm, ps_seq->u1_bits_in_frm_num);
  817|       |
  818|    923|    COPYTHECONTEXT("Slice Header SVC ext: frame_num", u2_frame_num);
  819|    923|    if(!ps_dec->u1_first_slice_in_stream && ps_dec->u4_first_slice_in_pic)
  ------------------
  |  Branch (819:8): [True: 768, False: 155]
  |  Branch (819:45): [True: 768, False: 0]
  ------------------
  820|    768|    {
  821|    768|        pocstruct_t *ps_prev_poc = &ps_dec->s_prev_pic_poc;
  822|    768|        pocstruct_t *ps_cur_poc = &ps_dec->s_cur_pic_poc;
  823|       |
  824|    768|        ps_dec->u2_mbx = 0xffff;
  825|    768|        ps_dec->u2_mby = 0;
  826|       |
  827|    768|        if((0 == u1_is_idr_slice) && ps_cur_slice->u1_nal_ref_idc)
  ------------------
  |  Branch (827:12): [True: 0, False: 768]
  |  Branch (827:38): [True: 0, False: 0]
  ------------------
  828|      0|            ps_dec->u2_prev_ref_frame_num = ps_cur_slice->u2_frame_num;
  829|       |
  830|    768|        if(u1_is_idr_slice || ps_cur_slice->u1_mmco_equalto5) ps_dec->u2_prev_ref_frame_num = 0;
  ------------------
  |  Branch (830:12): [True: 768, False: 0]
  |  Branch (830:31): [True: 0, False: 0]
  ------------------
  831|       |
  832|    768|        if(ps_dec->ps_cur_sps->u1_gaps_in_frame_num_value_allowed_flag)
  ------------------
  |  Branch (832:12): [True: 0, False: 768]
  ------------------
  833|      0|        {
  834|      0|            isvcd_decode_gaps_in_frame_num(ps_dec, u2_frame_num);
  835|      0|        }
  836|       |
  837|    768|        ps_prev_poc->i4_prev_frame_num_ofst = ps_cur_poc->i4_prev_frame_num_ofst;
  838|    768|        ps_prev_poc->u2_frame_num = ps_cur_poc->u2_frame_num;
  839|    768|        ps_prev_poc->u1_mmco_equalto5 = ps_cur_slice->u1_mmco_equalto5;
  840|    768|        if(ps_cur_slice->u1_nal_ref_idc)
  ------------------
  |  Branch (840:12): [True: 768, False: 0]
  ------------------
  841|    768|        {
  842|    768|            ps_prev_poc->i4_pic_order_cnt_lsb = ps_cur_poc->i4_pic_order_cnt_lsb;
  843|    768|            ps_prev_poc->i4_pic_order_cnt_msb = ps_cur_poc->i4_pic_order_cnt_msb;
  844|    768|            ps_prev_poc->i4_delta_pic_order_cnt_bottom = ps_cur_poc->i4_delta_pic_order_cnt_bottom;
  845|    768|            ps_prev_poc->i4_delta_pic_order_cnt[0] = ps_cur_poc->i4_delta_pic_order_cnt[0];
  846|    768|            ps_prev_poc->i4_delta_pic_order_cnt[1] = ps_cur_poc->i4_delta_pic_order_cnt[1];
  847|    768|            ps_prev_poc->u1_bot_field = ps_cur_poc->u1_bot_field;
  848|    768|        }
  849|       |
  850|    768|        ps_dec->u4_total_mbs_coded = 0;
  851|    768|    }
  852|       |    /* Get the field related flags  */
  853|    923|    if(!ps_seq->u1_frame_mbs_only_flag)
  ------------------
  |  Branch (853:8): [True: 0, False: 923]
  ------------------
  854|      0|    {
  855|      0|        u1_field_pic_flag = ih264d_get_bit_h264(ps_bitstrm);
  856|      0|        COPYTHECONTEXT("Slice Header SVC ext: field_pic_flag", u1_field_pic_flag);
  857|      0|        u1_bottom_field_flag = 0;
  858|       |
  859|      0|        if(u1_field_pic_flag)
  ------------------
  |  Branch (859:12): [True: 0, False: 0]
  ------------------
  860|      0|        {
  861|      0|            ps_dec->pu1_inv_scan = (UWORD8 *) gau1_ih264d_inv_scan_fld;
  862|      0|            u1_bottom_field_flag = ih264d_get_bit_h264(ps_bitstrm);
  863|      0|            COPYTHECONTEXT("Slice Header SVC ext: bottom_field_flag", u1_bottom_field_flag);
  864|      0|        }
  865|      0|        else
  866|      0|        {
  867|      0|            ps_dec->pu1_inv_scan = (UWORD8 *) gau1_ih264d_inv_scan;
  868|      0|        }
  869|      0|    }
  870|    923|    else
  871|    923|    {
  872|    923|        u1_field_pic_flag = 0;
  873|    923|        u1_bottom_field_flag = 0;
  874|    923|        ps_dec->pu1_inv_scan = (UWORD8 *) gau1_ih264d_inv_scan;
  875|    923|    }
  876|       |
  877|    923|    u1_nal_unit_type = SLICE_NAL;
  ------------------
  |  |  324|    923|#define SLICE_NAL                       1
  ------------------
  878|    923|    if(u1_is_idr_slice)
  ------------------
  |  Branch (878:8): [True: 923, False: 0]
  ------------------
  879|    923|    {
  880|    923|        u1_nal_unit_type = IDR_SLICE_NAL;
  ------------------
  |  |  328|    923|#define IDR_SLICE_NAL                   5
  ------------------
  881|    923|        u4_idr_pic_id = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  882|    923|        if(u4_idr_pic_id > 65535) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (882:12): [True: 35, False: 888]
  ------------------
  883|    888|        COPYTHECONTEXT("Slice Header SVC ext:  ", u4_idr_pic_id);
  884|    888|    }
  885|       |
  886|       |    /* read delta pic order count information*/
  887|    888|    i_delta_poc[0] = i_delta_poc[1] = 0;
  888|    888|    s_tmp_poc.i4_pic_order_cnt_lsb = 0;
  889|    888|    s_tmp_poc.i4_delta_pic_order_cnt_bottom = 0;
  890|    888|    u1_pic_order_cnt_type = ps_seq->u1_pic_order_cnt_type;
  891|    888|    if(u1_pic_order_cnt_type == 0)
  ------------------
  |  Branch (891:8): [True: 856, False: 32]
  ------------------
  892|    856|    {
  893|    856|        i_temp = ih264d_get_bits_h264(ps_bitstrm, ps_seq->u1_log2_max_pic_order_cnt_lsb_minus);
  894|    856|        if(i_temp < 0 || i_temp >= ps_seq->i4_max_pic_order_cntLsb) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (894:12): [True: 0, False: 856]
  |  Branch (894:26): [True: 0, False: 856]
  ------------------
  895|    856|        s_tmp_poc.i4_pic_order_cnt_lsb = i_temp;
  896|    856|        COPYTHECONTEXT("Slice Header SVC ext: pic_order_cnt_lsb", s_tmp_poc.i4_pic_order_cnt_lsb);
  897|       |
  898|    856|        if((ps_pps->u1_pic_order_present_flag == 1) && (!u1_field_pic_flag))
  ------------------
  |  Branch (898:12): [True: 20, False: 836]
  |  Branch (898:56): [True: 20, False: 0]
  ------------------
  899|     20|        {
  900|     20|            s_tmp_poc.i4_delta_pic_order_cnt_bottom = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  901|     20|            COPYTHECONTEXT("Slice Header SVC ext: delta_pic_order_cnt_bottom",
  902|     20|                           s_tmp_poc.i4_delta_pic_order_cnt_bottom);
  903|     20|        }
  904|    856|    }
  905|       |
  906|    888|    s_tmp_poc.i4_delta_pic_order_cnt[0] = 0;
  907|    888|    s_tmp_poc.i4_delta_pic_order_cnt[1] = 0;
  908|    888|    if(u1_pic_order_cnt_type == 1 && (!ps_seq->u1_delta_pic_order_always_zero_flag))
  ------------------
  |  Branch (908:8): [True: 32, False: 856]
  |  Branch (908:38): [True: 32, False: 0]
  ------------------
  909|     32|    {
  910|     32|        s_tmp_poc.i4_delta_pic_order_cnt[0] = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  911|     32|        COPYTHECONTEXT("Slice Header SVC ext: delta_pic_order_cnt[0]",
  912|     32|                       s_tmp_poc.i4_delta_pic_order_cnt[0]);
  913|       |
  914|     32|        if(ps_pps->u1_pic_order_present_flag && !u1_field_pic_flag)
  ------------------
  |  Branch (914:12): [True: 0, False: 32]
  |  Branch (914:49): [True: 0, False: 0]
  ------------------
  915|      0|        {
  916|      0|            s_tmp_poc.i4_delta_pic_order_cnt[1] = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  917|      0|            COPYTHECONTEXT("Slice Header SVC ext: delta_pic_order_cnt[1]",
  918|      0|                           s_tmp_poc.i4_delta_pic_order_cnt[1]);
  919|      0|        }
  920|     32|    }
  921|       |
  922|    888|    if(ps_pps->u1_redundant_pic_cnt_present_flag)
  ------------------
  |  Branch (922:8): [True: 776, False: 112]
  ------------------
  923|    776|    {
  924|    776|        u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
  925|    776|        if(u4_temp > MAX_REDUNDANT_PIC_CNT) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  |  611|    776|#define MAX_REDUNDANT_PIC_CNT       127
  ------------------
  |  Branch (925:12): [True: 18, False: 758]
  ------------------
  926|    758|        u1_redundant_pic_cnt = u4_temp;
  927|    758|        COPYTHECONTEXT("Slice Header SVC ext: redundant_pic_cnt", u1_redundant_pic_cnt);
  928|    758|    }
  929|       |
  930|       |    /*--------------------------------------------------------------------*/
  931|       |    /* Check if the slice is part of new picture                          */
  932|       |    /*--------------------------------------------------------------------*/
  933|       |    /* First slice of a picture is always considered as part of new picture */
  934|    870|    i1_is_end_of_poc = 1;
  935|    870|    ps_dec->ps_dec_err_status->u1_err_flag &= MASK_REJECT_CUR_PIC;
  ------------------
  |  |  604|    870|#define MASK_REJECT_CUR_PIC (0xFE)
  ------------------
  936|       |
  937|    870|    if(ps_dec->u4_first_slice_in_pic == 0)
  ------------------
  |  Branch (937:8): [True: 0, False: 870]
  ------------------
  938|      0|    {
  939|      0|        i1_is_end_of_poc =
  940|      0|            ih264d_is_end_of_pic(u2_frame_num, u1_nal_ref_idc, &s_tmp_poc, &ps_dec->s_cur_pic_poc,
  941|      0|                                 ps_cur_slice, u1_pic_order_cnt_type, u1_nal_unit_type,
  942|      0|                                 u4_idr_pic_id, u1_field_pic_flag, u1_bottom_field_flag);
  943|      0|        if(i1_is_end_of_poc)
  ------------------
  |  Branch (943:12): [True: 0, False: 0]
  ------------------
  944|      0|        {
  945|      0|            ps_dec->u1_first_slice_in_stream = 0;
  946|      0|            return ERROR_INCOMPLETE_FRAME;
  947|      0|        }
  948|      0|    }
  949|       |
  950|       |    /*--------------------------------------------------------------------*/
  951|       |    /* Check for error in slice and parse the missing/corrupted MB's      */
  952|       |    /* as skip-MB's in an inserted P-slice                                */
  953|       |    /*--------------------------------------------------------------------*/
  954|    870|    u1_mbaff = ps_seq->u1_mb_aff_flag && (!u1_field_pic_flag);
  ------------------
  |  Branch (954:16): [True: 0, False: 870]
  |  Branch (954:42): [True: 0, False: 0]
  ------------------
  955|    870|    prev_slice_err = 0;
  956|       |
  957|    870|    if(i1_is_end_of_poc || ps_dec->u1_first_slice_in_stream)
  ------------------
  |  Branch (957:8): [True: 870, False: 0]
  |  Branch (957:28): [True: 0, False: 0]
  ------------------
  958|    870|    {
  959|       |        /* If the current slice is not a field or frame number of the current
  960|       |         * slice doesn't match with previous slice, and decoder is expecting
  961|       |         * to decode a field i.e. ps_dec->u1_top_bottom_decoded is not 0 and
  962|       |         * is not (TOP_FIELD_ONLY | BOT_FIELD_ONLY), treat it as a dangling
  963|       |         * field */
  964|    870|        if((u1_field_pic_flag == 0 || u2_frame_num != ps_dec->u2_prv_frame_num) &&
  ------------------
  |  Branch (964:13): [True: 870, False: 0]
  |  Branch (964:39): [True: 0, False: 0]
  ------------------
  965|    870|           ps_dec->u1_top_bottom_decoded != 0 &&
  ------------------
  |  Branch (965:12): [True: 0, False: 870]
  ------------------
  966|      0|           ps_dec->u1_top_bottom_decoded != (TOP_FIELD_ONLY | BOT_FIELD_ONLY))
  ------------------
  |  |   64|      0|#define TOP_FIELD_ONLY      0x02
  ------------------
                         ps_dec->u1_top_bottom_decoded != (TOP_FIELD_ONLY | BOT_FIELD_ONLY))
  ------------------
  |  |   65|      0|#define BOT_FIELD_ONLY      0x01
  ------------------
  |  Branch (966:12): [True: 0, False: 0]
  ------------------
  967|      0|        {
  968|      0|            ps_dec->u1_dangling_field = 1;
  969|      0|            if(ps_dec->u4_first_slice_in_pic)
  ------------------
  |  Branch (969:16): [True: 0, False: 0]
  ------------------
  970|      0|            {
  971|       |                // first slice - dangling field
  972|      0|                prev_slice_err = 1;
  973|      0|            }
  974|      0|            else
  975|      0|            {
  976|       |                // last slice - dangling field
  977|      0|                prev_slice_err = 2;
  978|      0|            }
  979|       |
  980|      0|            if(ps_dec->u1_top_bottom_decoded == TOP_FIELD_ONLY)
  ------------------
  |  |   64|      0|#define TOP_FIELD_ONLY      0x02
  ------------------
  |  Branch (980:16): [True: 0, False: 0]
  ------------------
  981|      0|                ps_cur_slice->u1_bottom_field_flag = 1;
  982|      0|            else
  983|      0|                ps_cur_slice->u1_bottom_field_flag = 0;
  984|       |
  985|      0|            num_mb_skipped =
  986|      0|                (ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs) - ps_dec->u4_total_mbs_coded;
  987|      0|            ps_cur_poc = &ps_dec->s_cur_pic_poc;
  988|       |
  989|      0|            u1_is_idr_slice = ps_cur_slice->u1_nal_unit_type == IDR_SLICE_NAL;
  ------------------
  |  |  328|      0|#define IDR_SLICE_NAL                   5
  ------------------
  990|      0|        }
  991|    870|        else if(ps_dec->u4_first_slice_in_pic)
  ------------------
  |  Branch (991:17): [True: 870, False: 0]
  ------------------
  992|    870|        {
  993|    870|            if(u2_first_mb_in_slice > 0)
  ------------------
  |  Branch (993:16): [True: 0, False: 870]
  ------------------
  994|      0|            {
  995|       |                // first slice - missing/header corruption
  996|      0|                prev_slice_err = 1;
  997|      0|                num_mb_skipped = u2_first_mb_in_slice << u1_mbaff;
  998|      0|                ps_cur_poc = &s_tmp_poc;
  999|       |
 1000|       |                // initializing slice parameters
 1001|      0|                ps_cur_slice->u4_idr_pic_id = u4_idr_pic_id;
 1002|      0|                ps_cur_slice->u1_field_pic_flag = u1_field_pic_flag;
 1003|      0|                ps_cur_slice->u1_bottom_field_flag = u1_bottom_field_flag;
 1004|      0|                ps_cur_slice->i4_pic_order_cnt_lsb = s_tmp_poc.i4_pic_order_cnt_lsb;
 1005|      0|                ps_cur_slice->u1_nal_unit_type = u1_nal_unit_type;
 1006|      0|                ps_cur_slice->u1_redundant_pic_cnt = u1_redundant_pic_cnt;
 1007|      0|                ps_cur_slice->u1_nal_ref_idc = u1_nal_ref_idc;
 1008|      0|                ps_cur_slice->u1_pic_order_cnt_type = u1_pic_order_cnt_type;
 1009|      0|                ps_cur_slice->u1_mbaff_frame_flag = ps_seq->u1_mb_aff_flag && (!u1_field_pic_flag);
  ------------------
  |  Branch (1009:53): [True: 0, False: 0]
  |  Branch (1009:79): [True: 0, False: 0]
  ------------------
 1010|      0|            }
 1011|    870|        }
 1012|      0|        else
 1013|      0|        {
 1014|       |            /* since i1_is_end_of_poc is set ,means new frame num is encountered. so
 1015|       |             * conceal the current frame completely */
 1016|      0|            prev_slice_err = 2;
 1017|      0|            num_mb_skipped =
 1018|      0|                (ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs) - ps_dec->u4_total_mbs_coded;
 1019|      0|            ps_cur_poc = &s_tmp_poc;
 1020|      0|        }
 1021|    870|    }
 1022|      0|    else
 1023|      0|    {
 1024|      0|        if((u2_first_mb_in_slice << u1_mbaff) > ps_dec->u4_total_mbs_coded)
  ------------------
  |  Branch (1024:12): [True: 0, False: 0]
  ------------------
 1025|      0|        {
 1026|       |            // previous slice - missing/corruption
 1027|      0|            prev_slice_err = 2;
 1028|      0|            num_mb_skipped = (u2_first_mb_in_slice << u1_mbaff) - ps_dec->u4_total_mbs_coded;
 1029|      0|            ps_cur_poc = &s_tmp_poc;
 1030|      0|        }
 1031|      0|        else if((u2_first_mb_in_slice << u1_mbaff) < ps_dec->u4_total_mbs_coded)
  ------------------
  |  Branch (1031:17): [True: 0, False: 0]
  ------------------
 1032|      0|        {
 1033|      0|            return ERROR_CORRUPTED_SLICE;
 1034|      0|        }
 1035|      0|    }
 1036|    870|    if(prev_slice_err)
  ------------------
  |  Branch (1036:8): [True: 0, False: 870]
  ------------------
 1037|      0|    {
 1038|      0|        ret = isvcd_mark_err_slice_skip((svc_dec_lyr_struct_t *) ps_dec, num_mb_skipped,
 1039|      0|                                        u1_is_idr_slice, u2_frame_num, ps_cur_poc, prev_slice_err);
 1040|       |
 1041|      0|        if(ps_dec->u1_dangling_field == 1)
  ------------------
  |  Branch (1041:12): [True: 0, False: 0]
  ------------------
 1042|      0|        {
 1043|      0|            ps_dec->u1_second_field = 1 - ps_dec->u1_second_field;
 1044|      0|            ps_dec->u1_first_slice_in_stream = 0;
 1045|      0|            ps_dec->u1_top_bottom_decoded = TOP_FIELD_ONLY | BOT_FIELD_ONLY;
  ------------------
  |  |   64|      0|#define TOP_FIELD_ONLY      0x02
  ------------------
                          ps_dec->u1_top_bottom_decoded = TOP_FIELD_ONLY | BOT_FIELD_ONLY;
  ------------------
  |  |   65|      0|#define BOT_FIELD_ONLY      0x01
  ------------------
 1046|      0|            return ERROR_DANGLING_FIELD_IN_PIC;
 1047|      0|        }
 1048|       |
 1049|      0|        if(prev_slice_err == 2)
  ------------------
  |  Branch (1049:12): [True: 0, False: 0]
  ------------------
 1050|      0|        {
 1051|      0|            ps_dec->u1_first_slice_in_stream = 0;
 1052|      0|            return ERROR_INCOMPLETE_FRAME;
 1053|      0|        }
 1054|       |
 1055|      0|        if(ps_dec->u4_total_mbs_coded >= ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs)
  ------------------
  |  Branch (1055:12): [True: 0, False: 0]
  ------------------
 1056|      0|        {
 1057|       |            /* return if all MBs in frame are parsed*/
 1058|      0|            ps_dec->u1_first_slice_in_stream = 0;
 1059|      0|            return ERROR_IN_LAST_SLICE_OF_PIC;
 1060|      0|        }
 1061|       |
 1062|      0|        if(ps_dec->ps_dec_err_status->u1_err_flag & REJECT_CUR_PIC)
  ------------------
  |  |  601|      0|#define REJECT_CUR_PIC    (0x01)
  ------------------
  |  Branch (1062:12): [True: 0, False: 0]
  ------------------
 1063|      0|        {
 1064|      0|            ih264d_err_pic_dispbuf_mgr(ps_dec);
 1065|      0|            return ERROR_NEW_FRAME_EXPECTED;
 1066|      0|        }
 1067|       |
 1068|      0|        if(ret != OK) return ret;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (1068:12): [True: 0, False: 0]
  ------------------
 1069|       |
 1070|      0|        i1_is_end_of_poc = 0;
 1071|      0|    }
 1072|       |
 1073|    870|    if(u1_field_pic_flag)
  ------------------
  |  Branch (1073:8): [True: 0, False: 870]
  ------------------
 1074|      0|    {
 1075|      0|        ps_dec->u2_prv_frame_num = u2_frame_num;
 1076|      0|    }
 1077|       |
 1078|    870|    if(ps_cur_slice->u1_mmco_equalto5)
  ------------------
  |  Branch (1078:8): [True: 0, False: 870]
  ------------------
 1079|      0|    {
 1080|      0|        WORD32 i4_temp_poc;
 1081|      0|        WORD32 i4_top_field_order_poc, i4_bot_field_order_poc;
 1082|      0|        WORD64 i8_result;
 1083|      0|        if(!ps_cur_slice->u1_field_pic_flag)  // or a complementary field pair
  ------------------
  |  Branch (1083:12): [True: 0, False: 0]
  ------------------
 1084|      0|        {
 1085|      0|            i4_top_field_order_poc = ps_dec->ps_cur_pic->i4_top_field_order_cnt;
 1086|      0|            i4_bot_field_order_poc = ps_dec->ps_cur_pic->i4_bottom_field_order_cnt;
 1087|      0|            i4_temp_poc = MIN(i4_top_field_order_poc, i4_bot_field_order_poc);
  ------------------
  |  |   61|      0|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1088|      0|        }
 1089|      0|        else if(!ps_cur_slice->u1_bottom_field_flag)
  ------------------
  |  Branch (1089:17): [True: 0, False: 0]
  ------------------
 1090|      0|            i4_temp_poc = ps_dec->ps_cur_pic->i4_top_field_order_cnt;
 1091|      0|        else
 1092|      0|            i4_temp_poc = ps_dec->ps_cur_pic->i4_bottom_field_order_cnt;
 1093|       |
 1094|      0|        i8_result = (WORD64) i4_temp_poc - ps_dec->ps_cur_pic->i4_top_field_order_cnt;
 1095|      0|        if(IS_OUT_OF_RANGE_S32(i8_result))
  ------------------
  |  |   58|      0|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 0]
  |  |  |  Branch (58:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1096|      0|        {
 1097|      0|            return ERROR_INV_POC;
 1098|      0|        }
 1099|      0|        ps_dec->ps_cur_pic->i4_top_field_order_cnt = (WORD32) i8_result;
 1100|      0|        i8_result = (WORD64) i4_temp_poc - ps_dec->ps_cur_pic->i4_bottom_field_order_cnt;
 1101|      0|        if(IS_OUT_OF_RANGE_S32(i8_result))
  ------------------
  |  |   58|      0|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 0]
  |  |  |  Branch (58:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1102|      0|        {
 1103|      0|            return ERROR_INV_POC;
 1104|      0|        }
 1105|      0|        ps_dec->ps_cur_pic->i4_bottom_field_order_cnt = (WORD32) i8_result;
 1106|      0|        ps_dec->ps_cur_pic->i4_poc = i4_temp_poc;
 1107|      0|        ps_dec->ps_cur_pic->i4_avg_poc = i4_temp_poc;
 1108|      0|    }
 1109|    870|    if(ps_dec->u4_first_slice_in_pic)
  ------------------
  |  Branch (1109:8): [True: 870, False: 0]
  ------------------
 1110|    870|    {
 1111|    870|        ret = isvcd_decode_pic_order_cnt(u1_is_idr_slice, u2_frame_num, &ps_dec->s_prev_pic_poc,
 1112|    870|                                         &s_tmp_poc, ps_cur_slice, ps_pps, u1_nal_ref_idc,
 1113|    870|                                         u1_bottom_field_flag, u1_field_pic_flag, &i4_poc, ps_dec);
 1114|    870|        if(ret != OK) return ret;
  ------------------
  |  |  114|    870|#define OK        0
  ------------------
  |  Branch (1114:12): [True: 0, False: 870]
  ------------------
 1115|       |        /* Display seq no calculations */
 1116|    870|        if(i4_poc >= ps_dec->i4_max_poc) ps_dec->i4_max_poc = i4_poc;
  ------------------
  |  Branch (1116:12): [True: 142, False: 728]
  ------------------
 1117|       |        /* IDR Picture or POC wrap around */
 1118|    870|        if(i4_poc == 0)
  ------------------
  |  Branch (1118:12): [True: 33, False: 837]
  ------------------
 1119|     33|        {
 1120|     33|            WORD64 i8_temp;
 1121|     33|            i8_temp = (WORD64) ps_dec->i4_prev_max_display_seq + ps_dec->i4_max_poc +
 1122|     33|                      ps_dec->u1_max_dec_frame_buffering + 1;
 1123|       |            /*If i4_prev_max_display_seq overflows integer range, reset it */
 1124|     33|            ps_dec->i4_prev_max_display_seq = IS_OUT_OF_RANGE_S32(i8_temp) ? 0 : i8_temp;
  ------------------
  |  |   58|     33|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 33]
  |  |  |  Branch (58:54): [True: 0, False: 33]
  |  |  ------------------
  ------------------
 1125|     33|            ps_dec->i4_max_poc = 0;
 1126|     33|        }
 1127|    870|    }
 1128|       |
 1129|       |    /* Increment only if the current slice has atleast 1 more MB */
 1130|    870|    if(ps_dec->u4_first_slice_in_pic == 0 &&
  ------------------
  |  Branch (1130:8): [True: 0, False: 870]
  ------------------
 1131|      0|       (ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice <
  ------------------
  |  Branch (1131:8): [True: 0, False: 0]
  ------------------
 1132|      0|        (UWORD32) (ps_dec->u4_total_mbs_coded >> ps_dec->ps_cur_slice->u1_mbaff_frame_flag)))
 1133|      0|    {
 1134|      0|        ps_dec->ps_parse_cur_slice++;
 1135|      0|        ps_dec->u2_cur_slice_num++;
 1136|       |        // in the case of single core increment ps_decode_cur_slice
 1137|      0|        if(ps_dec->u1_separate_parse == 0)
  ------------------
  |  Branch (1137:12): [True: 0, False: 0]
  ------------------
 1138|      0|        {
 1139|      0|            ps_dec->ps_decode_cur_slice++;
 1140|      0|        }
 1141|      0|    }
 1142|       |
 1143|    870|    ps_dec->u1_slice_header_done = 0;
 1144|       |
 1145|       |    /*--------------------------------------------------------------------*/
 1146|       |    /* Copy the values read from the bitstream to the slice header and then*/
 1147|       |    /* If the slice is first slice in picture, then do Start of Picture   */
 1148|       |    /* processing.                                                        */
 1149|       |    /*--------------------------------------------------------------------*/
 1150|    870|    ps_cur_slice->i4_delta_pic_order_cnt[0] = i_delta_poc[0];
 1151|    870|    ps_cur_slice->i4_delta_pic_order_cnt[1] = i_delta_poc[1];
 1152|    870|    ps_cur_slice->u4_idr_pic_id = u4_idr_pic_id;
 1153|    870|    ps_cur_slice->u2_first_mb_in_slice = u2_first_mb_in_slice;
 1154|    870|    ps_cur_slice->u1_field_pic_flag = u1_field_pic_flag;
 1155|    870|    ps_cur_slice->u1_bottom_field_flag = u1_bottom_field_flag;
 1156|    870|    ps_cur_slice->u1_slice_type = u1_slice_type;
 1157|    870|    ps_cur_slice->i4_pic_order_cnt_lsb = s_tmp_poc.i4_pic_order_cnt_lsb;
 1158|       |
 1159|    870|    ps_cur_slice->u1_nal_unit_type = u1_nal_unit_type;
 1160|    870|    ps_cur_slice->u1_redundant_pic_cnt = u1_redundant_pic_cnt;
 1161|    870|    ps_cur_slice->u1_nal_ref_idc = u1_nal_ref_idc;
 1162|    870|    ps_cur_slice->u1_pic_order_cnt_type = u1_pic_order_cnt_type;
 1163|       |
 1164|    870|    if(ps_seq->u1_frame_mbs_only_flag)
  ------------------
  |  Branch (1164:8): [True: 870, False: 0]
  ------------------
 1165|    870|        ps_cur_slice->u1_direct_8x8_inference_flag = ps_seq->u1_direct_8x8_inference_flag;
 1166|      0|    else
 1167|      0|        ps_cur_slice->u1_direct_8x8_inference_flag = 1;
 1168|       |
 1169|    870|    if(0 == ps_svc_lyr_dec->ps_nal_svc_ext->u1_quality_id)
  ------------------
  |  Branch (1169:8): [True: 870, False: 0]
  ------------------
 1170|    870|    {
 1171|    870|        if(B_SLICE == u1_slice_type)
  ------------------
  |  |  369|    870|#define B_SLICE  1
  ------------------
  |  Branch (1171:12): [True: 78, False: 792]
  ------------------
 1172|     78|        {
 1173|     78|            ps_cur_slice->u1_direct_spatial_mv_pred_flag = ih264d_get_bit_h264(ps_bitstrm);
 1174|     78|            COPYTHECONTEXT("Slice Header SVC ext: direct_spatial_mv_pred_flag",
 1175|     78|                           ps_cur_slice->u1_direct_spatial_mv_pred_flag);
 1176|       |
 1177|     78|            if(ps_cur_slice->u1_direct_spatial_mv_pred_flag)
  ------------------
  |  Branch (1177:16): [True: 21, False: 57]
  ------------------
 1178|     21|                ps_cur_slice->pf_decodeDirect = isvcd_decode_spatial_direct;
 1179|     57|            else
 1180|     57|                ps_cur_slice->pf_decodeDirect = ih264d_decode_temporal_direct;
 1181|     78|            if(!((ps_seq->u1_mb_aff_flag) && (!u1_field_pic_flag)))
  ------------------
  |  Branch (1181:18): [True: 0, False: 78]
  |  Branch (1181:46): [True: 0, False: 0]
  ------------------
 1182|     78|                ps_dec->pf_mvpred = ih264d_mvpred_nonmbaffB;
 1183|     78|        }
 1184|    792|        else
 1185|    792|        {
 1186|    792|            if(!((ps_seq->u1_mb_aff_flag) && (!u1_field_pic_flag))) /*check if this is valid here */
  ------------------
  |  Branch (1186:18): [True: 0, False: 792]
  |  Branch (1186:46): [True: 0, False: 0]
  ------------------
 1187|    792|                ps_dec->pf_mvpred = ih264d_mvpred_nonmbaff;
 1188|    792|        }
 1189|    870|    }
 1190|       |
 1191|    870|    if(ps_dec->u4_first_slice_in_pic)
  ------------------
  |  Branch (1191:8): [True: 870, False: 0]
  ------------------
 1192|    870|    {
 1193|    870|        if(u2_first_mb_in_slice == 0)
  ------------------
  |  Branch (1193:12): [True: 870, False: 0]
  ------------------
 1194|    870|        {
 1195|    870|            ret = isvcd_start_of_pic(ps_svc_lyr_dec, i4_poc, &s_tmp_poc, u2_frame_num, ps_pps);
 1196|    870|            if(ret != OK) return ret;
  ------------------
  |  |  114|    870|#define OK        0
  ------------------
  |  Branch (1196:16): [True: 150, False: 720]
  ------------------
 1197|       |            /*inter layer buffer intialization */
 1198|    720|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb =
 1199|    720|                ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start;
 1200|    720|            ps_svc_lyr_dec->ps_il_pred_mv_bank_buf_cur_mb =
 1201|    720|                ps_svc_lyr_dec->ps_il_pred_mv_bank_buf_base;
 1202|    720|        }
 1203|       |
 1204|    720|        ps_dec->u4_output_present = 0;
 1205|       |
 1206|    720|        {
 1207|    720|            ih264d_get_next_display_field(ps_dec, ps_dec->ps_out_buffer, &(ps_dec->s_disp_op));
 1208|       |            /* If error code is non-zero then there is no buffer available for
 1209|       |            display, hence avoid format conversion */
 1210|       |
 1211|    720|            if(0 != ps_dec->s_disp_op.u4_error_code)
  ------------------
  |  Branch (1211:16): [True: 53, False: 667]
  ------------------
 1212|     53|            {
 1213|     53|                ps_dec->u4_output_present = 0;
 1214|     53|                ps_dec->u4_fmt_conv_cur_row = ps_dec->s_disp_frame_info.u4_y_ht;
 1215|     53|            }
 1216|    667|            else
 1217|    667|                ps_dec->u4_output_present = 1;
 1218|    720|        }
 1219|    720|        ret = isvcd_parse_interlayer_resamp_func_init(ps_svc_lyr_dec, u2_first_mb_in_slice);
 1220|    720|        if(ret != OK)
  ------------------
  |  |  114|    720|#define OK        0
  ------------------
  |  Branch (1220:12): [True: 0, False: 720]
  ------------------
 1221|      0|        {
 1222|      0|            return ERROR_CORRUPTED_SLICE;
 1223|      0|        }
 1224|    720|        if((ps_dec->u1_separate_parse == 1) &&
  ------------------
  |  Branch (1224:12): [True: 395, False: 325]
  ------------------
 1225|    395|           (ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER) && (ps_svc_lyr_dec->u1_res_init_done == 1))
  ------------------
  |  |  110|    395|#define TARGET_LAYER 2
  ------------------
  |  Branch (1225:12): [True: 395, False: 0]
  |  Branch (1225:69): [True: 395, False: 0]
  ------------------
 1226|    395|        {
 1227|    395|            if(ps_dec->u4_dec_thread_created == 0)
  ------------------
  |  Branch (1227:16): [True: 395, False: 0]
  ------------------
 1228|    395|            {
 1229|    395|                ithread_create(ps_dec->pv_dec_thread_handle, NULL,
 1230|    395|                               (void *) isvcd_decode_picture_thread, (void *) ps_dec);
 1231|       |
 1232|    395|                ps_dec->u4_dec_thread_created = 1;
 1233|    395|            }
 1234|       |#ifdef KEEP_THREADS_ACTIVE
 1235|       |            ret = ithread_mutex_lock(ps_dec->apv_proc_start_mutex[0]);
 1236|       |            RETURN_IF((ret != IV_SUCCESS), ret);
 1237|       |
 1238|       |            ps_dec->ai4_process_start[0] = PROC_START;
 1239|       |            ret = ithread_cond_signal(ps_dec->apv_proc_start_condition[0]);
 1240|       |            RETURN_IF((ret != IV_SUCCESS), ret);
 1241|       |
 1242|       |            ret = ithread_mutex_unlock(ps_dec->apv_proc_start_mutex[0]);
 1243|       |            RETURN_IF((ret != IV_SUCCESS), ret);
 1244|       |#endif
 1245|       |#ifdef KEEP_THREADS_ACTIVE
 1246|       |            if(ps_dec->u4_bs_deblk_thread_created)
 1247|       |            {
 1248|       |                ret = ithread_mutex_lock(ps_dec->apv_proc_start_mutex[1]);
 1249|       |                RETURN_IF((ret != IV_SUCCESS), ret);
 1250|       |
 1251|       |                ps_dec->ai4_process_start[1] = PROC_START;
 1252|       |                ret = ithread_cond_signal(ps_dec->apv_proc_start_condition[1]);
 1253|       |                RETURN_IF((ret != IV_SUCCESS), ret);
 1254|       |
 1255|       |                ret = ithread_mutex_unlock(ps_dec->apv_proc_start_mutex[1]);
 1256|       |                RETURN_IF((ret != IV_SUCCESS), ret);
 1257|       |            }
 1258|       |#endif
 1259|    395|        }
 1260|    720|    }
 1261|       |
 1262|       |    /* INITIALIZATION of fn ptrs for MC and formMbPartInfo functions */
 1263|    720|    {
 1264|    720|        UWORD8 uc_nofield_nombaff;
 1265|       |
 1266|    720|        uc_nofield_nombaff =
 1267|    720|            ((ps_dec->ps_cur_slice->u1_field_pic_flag == 0) &&
  ------------------
  |  Branch (1267:14): [True: 720, False: 0]
  ------------------
 1268|    720|             (ps_dec->ps_cur_slice->u1_mbaff_frame_flag == 0) && (u1_slice_type != B_SLICE) &&
  ------------------
  |  |  369|    720|#define B_SLICE  1
  ------------------
  |  Branch (1268:14): [True: 720, False: 0]
  |  Branch (1268:66): [True: 645, False: 75]
  ------------------
 1269|    645|             (ps_dec->ps_cur_pps->u1_wted_pred_flag == 0));
  ------------------
  |  Branch (1269:14): [True: 76, False: 569]
  ------------------
 1270|       |
 1271|       |        /* Initialise MC and formMbPartInfo fn ptrs one time based on profile_idc */
 1272|       |
 1273|    720|        if(uc_nofield_nombaff)
  ------------------
  |  Branch (1273:12): [True: 76, False: 644]
  ------------------
 1274|     76|        {
 1275|     76|            ps_dec->p_form_mb_part_info = ih264d_form_mb_part_info_bp;
 1276|     76|            ps_dec->p_motion_compensate = ih264d_motion_compensate_bp;
 1277|     76|        }
 1278|    644|        else
 1279|    644|        {
 1280|    644|            ps_dec->p_form_mb_part_info = ih264d_form_mb_part_info_mp;
 1281|    644|            ps_dec->p_motion_compensate = ih264d_motion_compensate_mp;
 1282|    644|        }
 1283|    720|    }
 1284|       |
 1285|       |    /*
 1286|       |     * Decide whether to decode the current picture or not
 1287|       |     */
 1288|    720|    {
 1289|    720|        dec_err_status_t *ps_err = ps_dec->ps_dec_err_status;
 1290|    720|        if(ps_err->u4_frm_sei_sync == u2_frame_num)
  ------------------
  |  Branch (1290:12): [True: 0, False: 720]
  ------------------
 1291|      0|        {
 1292|      0|            ps_err->u1_err_flag = ACCEPT_ALL_PICS;
  ------------------
  |  |  600|      0|#define ACCEPT_ALL_PICS   (0x00)
  ------------------
 1293|      0|            ps_err->u4_frm_sei_sync = SYNC_FRM_DEFAULT;
  ------------------
  |  |  609|      0|#define SYNC_FRM_DEFAULT  (0xFFFFFFFF)
  ------------------
 1294|      0|        }
 1295|    720|        ps_err->u4_cur_frm = u2_frame_num;
 1296|    720|    }
 1297|       |
 1298|       |    /* Decision for decoding if the picture is to be skipped */
 1299|    720|    {
 1300|    720|        WORD32 i4_skip_b_pic, i4_skip_p_pic;
 1301|       |
 1302|    720|        i4_skip_b_pic = (ps_dec->u4_skip_frm_mask & B_SLC_BIT) && (B_SLICE == u1_slice_type) &&
  ------------------
  |  |  378|    720|#define B_SLC_BIT  (0x4)
  ------------------
                      i4_skip_b_pic = (ps_dec->u4_skip_frm_mask & B_SLC_BIT) && (B_SLICE == u1_slice_type) &&
  ------------------
  |  |  369|      0|#define B_SLICE  1
  ------------------
  |  Branch (1302:25): [True: 0, False: 720]
  |  Branch (1302:67): [True: 0, False: 0]
  ------------------
 1303|      0|                        (0 == u1_nal_ref_idc);
  ------------------
  |  Branch (1303:25): [True: 0, False: 0]
  ------------------
 1304|       |
 1305|    720|        i4_skip_p_pic = (ps_dec->u4_skip_frm_mask & P_SLC_BIT) && (P_SLICE == u1_slice_type) &&
  ------------------
  |  |  377|    720|#define P_SLC_BIT  (0x2)
  ------------------
                      i4_skip_p_pic = (ps_dec->u4_skip_frm_mask & P_SLC_BIT) && (P_SLICE == u1_slice_type) &&
  ------------------
  |  |  368|      0|#define P_SLICE  0
  ------------------
  |  Branch (1305:25): [True: 0, False: 720]
  |  Branch (1305:67): [True: 0, False: 0]
  ------------------
 1306|      0|                        (0 == u1_nal_ref_idc);
  ------------------
  |  Branch (1306:25): [True: 0, False: 0]
  ------------------
 1307|       |
 1308|       |        /**************************************************************/
 1309|       |        /* Skip the B picture if skip mask is set for B picture and   */
 1310|       |        /* Current B picture is a non reference B picture or there is */
 1311|       |        /* no user for reference B picture                            */
 1312|       |        /**************************************************************/
 1313|    720|        if(i4_skip_b_pic)
  ------------------
  |  Branch (1313:12): [True: 0, False: 720]
  ------------------
 1314|      0|        {
 1315|      0|            ps_dec->ps_cur_pic->u4_pack_slc_typ |= B_SLC_BIT;
  ------------------
  |  |  378|      0|#define B_SLC_BIT  (0x4)
  ------------------
 1316|       |            /* Don't decode the picture in SKIP-B mode if that picture is B */
 1317|       |            /* and also it is not to be used as a reference picture         */
 1318|      0|            ps_dec->u1_last_pic_not_decoded = 1;
 1319|       |
 1320|      0|            return OK;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
 1321|      0|        }
 1322|       |        /**************************************************************/
 1323|       |        /* Skip the P picture if skip mask is set for P picture and   */
 1324|       |        /* Current P picture is a non reference P picture or there is */
 1325|       |        /* no user for reference P picture                            */
 1326|       |        /**************************************************************/
 1327|    720|        if(i4_skip_p_pic)
  ------------------
  |  Branch (1327:12): [True: 0, False: 720]
  ------------------
 1328|      0|        {
 1329|      0|            ps_dec->ps_cur_pic->u4_pack_slc_typ |= P_SLC_BIT;
  ------------------
  |  |  377|      0|#define P_SLC_BIT  (0x2)
  ------------------
 1330|       |            /* Don't decode the picture in SKIP-P mode if that picture is P */
 1331|       |            /* and also it is not to be used as a reference picture         */
 1332|      0|            ps_dec->u1_last_pic_not_decoded = 1;
 1333|       |
 1334|      0|            return OK;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
 1335|      0|        }
 1336|    720|    }
 1337|       |
 1338|    720|    {
 1339|    720|        UWORD16 u2_mb_x, u2_mb_y;
 1340|       |
 1341|    720|        ps_dec->i4_submb_ofst =
 1342|    720|            ((u2_first_mb_in_slice << ps_cur_slice->u1_mbaff_frame_flag) * SUB_BLK_SIZE) -
  ------------------
  |  |  562|    720|#define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|    720|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  |  |               #define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|    720|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  ------------------
 1343|    720|            SUB_BLK_SIZE;
  ------------------
  |  |  562|    720|#define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|    720|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  |  |               #define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|    720|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  ------------------
 1344|    720|        if(u2_first_mb_in_slice)
  ------------------
  |  Branch (1344:12): [True: 0, False: 720]
  ------------------
 1345|      0|        {
 1346|      0|            UWORD8 u1_mb_aff;
 1347|      0|            UWORD8 u1_field_pic;
 1348|      0|            UWORD16 u2_frm_wd_in_mbs;
 1349|      0|            u2_frm_wd_in_mbs = ps_seq->u2_frm_wd_in_mbs;
 1350|      0|            u1_mb_aff = ps_cur_slice->u1_mbaff_frame_flag;
 1351|      0|            u1_field_pic = ps_cur_slice->u1_field_pic_flag;
 1352|       |
 1353|      0|            {
 1354|      0|                UWORD32 x_offset;
 1355|      0|                UWORD32 y_offset;
 1356|      0|                UWORD32 u4_frame_stride;
 1357|      0|                tfr_ctxt_t *ps_trns_addr;  // = &ps_dec->s_tran_addrecon_parse;
 1358|       |
 1359|      0|                if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (1359:20): [True: 0, False: 0]
  ------------------
 1360|      0|                {
 1361|      0|                    ps_trns_addr = &ps_dec->s_tran_addrecon_parse;
 1362|      0|                }
 1363|      0|                else
 1364|      0|                {
 1365|      0|                    ps_trns_addr = &ps_dec->s_tran_addrecon;
 1366|      0|                }
 1367|      0|                u2_mb_x = MOD(u2_first_mb_in_slice, u2_frm_wd_in_mbs);
  ------------------
  |  |   64|      0|#define MOD(x,y) ((x)%(y))
  ------------------
 1368|      0|                u2_mb_y = DIV(u2_first_mb_in_slice, u2_frm_wd_in_mbs);
  ------------------
  |  |   65|      0|#define DIV(x,y) ((x)/(y))
  ------------------
 1369|       |
 1370|      0|                u2_mb_y <<= u1_mb_aff;
 1371|       |
 1372|      0|                if((u2_mb_x > u2_frm_wd_in_mbs - 1) || (u2_mb_y > ps_dec->u2_frm_ht_in_mbs - 1))
  ------------------
  |  Branch (1372:20): [True: 0, False: 0]
  |  Branch (1372:56): [True: 0, False: 0]
  ------------------
 1373|      0|                {
 1374|      0|                    return ERROR_CORRUPTED_SLICE;
 1375|      0|                }
 1376|       |
 1377|      0|                u4_frame_stride = ps_dec->u2_frm_wd_y << u1_field_pic;
 1378|      0|                x_offset = u2_mb_x << 4;
 1379|      0|                y_offset = (u2_mb_y * u4_frame_stride) << 4;
 1380|       |
 1381|      0|                ps_trns_addr->pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1 + x_offset + y_offset;
 1382|       |
 1383|      0|                u4_frame_stride = ps_dec->u2_frm_wd_uv << u1_field_pic;
 1384|      0|                x_offset >>= 1;
 1385|      0|                y_offset = (u2_mb_y * u4_frame_stride) << 3;
 1386|       |
 1387|      0|                x_offset *= YUV420SP_FACTOR;
  ------------------
  |  |  119|      0|#define YUV420SP_FACTOR 2
  ------------------
 1388|       |
 1389|      0|                ps_trns_addr->pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2 + x_offset + y_offset;
 1390|      0|                ps_trns_addr->pu1_dest_v = ps_dec->s_cur_pic.pu1_buf3 + x_offset + y_offset;
 1391|       |
 1392|      0|                ps_trns_addr->pu1_mb_y = ps_trns_addr->pu1_dest_y;
 1393|      0|                ps_trns_addr->pu1_mb_u = ps_trns_addr->pu1_dest_u;
 1394|      0|                ps_trns_addr->pu1_mb_v = ps_trns_addr->pu1_dest_v;
 1395|       |
 1396|       |                // assign the deblock structure pointers to start of slice
 1397|      0|                if(ps_dec->u1_separate_parse == 1)
  ------------------
  |  Branch (1397:20): [True: 0, False: 0]
  ------------------
 1398|      0|                {
 1399|      0|                    ps_dec->ps_deblk_mbn =
 1400|      0|                        ps_dec->ps_deblk_pic + (u2_first_mb_in_slice << u1_mb_aff);
 1401|      0|                }
 1402|      0|                else
 1403|      0|                {
 1404|      0|                    ps_dec->ps_deblk_mbn =
 1405|      0|                        ps_dec->ps_deblk_pic + (u2_first_mb_in_slice << u1_mb_aff);
 1406|      0|                }
 1407|       |
 1408|      0|                ps_dec->u4_cur_mb_addr = (u2_first_mb_in_slice << u1_mb_aff);
 1409|       |
 1410|      0|                ps_dec->ps_mv_cur =
 1411|      0|                    ps_dec->s_cur_pic.ps_mv + ((u2_first_mb_in_slice << u1_mb_aff) << 4);
 1412|      0|            }
 1413|      0|        }
 1414|    720|        else
 1415|    720|        {
 1416|    720|            tfr_ctxt_t *ps_trns_addr;
 1417|       |
 1418|    720|            if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (1418:16): [True: 395, False: 325]
  ------------------
 1419|    395|            {
 1420|    395|                ps_trns_addr = &ps_dec->s_tran_addrecon_parse;
 1421|    395|            }
 1422|    325|            else
 1423|    325|            {
 1424|    325|                ps_trns_addr = &ps_dec->s_tran_addrecon;
 1425|    325|            }
 1426|       |
 1427|    720|            u2_mb_x = 0xffff;
 1428|    720|            u2_mb_y = 0;
 1429|       |            // assign the deblock structure pointers to start of slice
 1430|    720|            ps_dec->u4_cur_mb_addr = 0;
 1431|    720|            ps_dec->ps_deblk_mbn = ps_dec->ps_deblk_pic;
 1432|    720|            ps_dec->ps_mv_cur = ps_dec->s_cur_pic.ps_mv;
 1433|    720|            ps_trns_addr->pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1;
 1434|    720|            ps_trns_addr->pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2;
 1435|    720|            ps_trns_addr->pu1_dest_v = ps_dec->s_cur_pic.pu1_buf3;
 1436|       |
 1437|    720|            ps_trns_addr->pu1_mb_y = ps_trns_addr->pu1_dest_y;
 1438|    720|            ps_trns_addr->pu1_mb_u = ps_trns_addr->pu1_dest_u;
 1439|    720|            ps_trns_addr->pu1_mb_v = ps_trns_addr->pu1_dest_v;
 1440|    720|        }
 1441|       |
 1442|    720|        ps_dec->ps_part = ps_dec->ps_parse_part_params;
 1443|       |
 1444|    720|        ps_dec->u2_mbx = (MOD(u2_first_mb_in_slice - 1, ps_seq->u2_frm_wd_in_mbs));
  ------------------
  |  |   64|    720|#define MOD(x,y) ((x)%(y))
  ------------------
 1445|    720|        ps_dec->u2_mby = (DIV(u2_first_mb_in_slice - 1, ps_seq->u2_frm_wd_in_mbs));
  ------------------
  |  |   65|    720|#define DIV(x,y) ((x)/(y))
  ------------------
 1446|    720|        ps_dec->u2_mby <<= ps_cur_slice->u1_mbaff_frame_flag;
 1447|    720|        ps_dec->i2_prev_slice_mbx = ps_dec->u2_mbx;
 1448|    720|        ps_dec->i2_prev_slice_mby = ps_dec->u2_mby;
 1449|    720|    }
 1450|       |
 1451|       |    /* RBSP stop bit is used for CABAC decoding*/
 1452|      0|    ps_bitstrm->u4_max_ofst += ps_dec->ps_cur_pps->u1_entropy_coding_mode;
 1453|       |
 1454|    720|    ps_dec->u1_B = (u1_slice_type == B_SLICE);
  ------------------
  |  |  369|    720|#define B_SLICE  1
  ------------------
 1455|    720|    ps_dec->u4_next_mb_skip = 0;
 1456|       |
 1457|    720|    ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice = ps_dec->ps_cur_slice->u2_first_mb_in_slice;
 1458|    720|    ps_dec->ps_parse_cur_slice->slice_type = ps_dec->ps_cur_slice->u1_slice_type;
 1459|       |
 1460|    720|    ps_dec->u4_start_recon_deblk = 1;
 1461|    720|    {
 1462|    720|        WORD32 num_entries;
 1463|    720|        WORD32 size;
 1464|    720|        UWORD8 *pu1_buf;
 1465|       |
 1466|    720|        num_entries = MAX_FRAMES;
  ------------------
  |  |  600|    720|#define MAX_FRAMES              16
  ------------------
 1467|    720|        if((1 >= ps_dec->ps_cur_sps->u1_num_ref_frames) && (0 == ps_dec->i4_display_delay))
  ------------------
  |  Branch (1467:12): [True: 76, False: 644]
  |  Branch (1467:60): [True: 0, False: 76]
  ------------------
 1468|      0|        {
 1469|      0|            num_entries = 1;
 1470|      0|        }
 1471|    720|        num_entries = ((2 * num_entries) + 1);
 1472|    720|        num_entries *= 2;
 1473|       |
 1474|    720|        size = num_entries * sizeof(void *);
 1475|    720|        size += PAD_MAP_IDX_POC * sizeof(void *);
  ------------------
  |  |  100|    720|#define PAD_MAP_IDX_POC             (1)
  ------------------
 1476|       |
 1477|    720|        pu1_buf = (UWORD8 *) ps_dec->pv_map_ref_idx_to_poc_buf;
 1478|    720|        pu1_buf += size * ps_dec->u2_cur_slice_num;
 1479|    720|        ps_dec->ps_parse_cur_slice->ppv_map_ref_idx_to_poc = (void *) pu1_buf;
 1480|    720|    }
 1481|       |
 1482|    720|    if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (1482:8): [True: 395, False: 325]
  ------------------
 1483|    395|    {
 1484|    395|        ps_dec->ps_parse_cur_slice->pv_tu_coeff_data_start = ps_dec->pv_parse_tu_coeff_data;
 1485|    395|    }
 1486|    325|    else
 1487|    325|    {
 1488|    325|        ps_dec->pv_proc_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
 1489|    325|    }
 1490|       |
 1491|    720|    ret = ih264d_fix_error_in_dpb(ps_dec);
 1492|    720|    if(ret < 0) return ERROR_DBP_MANAGER_T;
  ------------------
  |  Branch (1492:8): [True: 0, False: 720]
  ------------------
 1493|       |
 1494|       |    /*Default initializing default values for some parameters*/
 1495|    720|    ps_svc_slice_params->u1_slice_skip_flag = 0;
 1496|    720|    ps_svc_slice_params->u1_adaptive_base_mode_flag = 0;
 1497|    720|    ps_svc_slice_params->u1_default_base_mode_flag = 0;
 1498|    720|    ps_svc_slice_params->u1_adaptive_motion_prediction_flag = 0;
 1499|    720|    ps_svc_slice_params->u1_default_motion_prediction_flag = 0;
 1500|    720|    ps_svc_slice_params->u1_adaptive_residual_prediction_flag = 0;
 1501|    720|    ps_svc_slice_params->u1_default_residual_prediction_flag = 0;
 1502|       |
 1503|    720|    if(u1_slice_type == I_SLICE)
  ------------------
  |  |  370|    720|#define I_SLICE  2
  ------------------
  |  Branch (1503:8): [True: 0, False: 720]
  ------------------
 1504|      0|    {
 1505|      0|        ps_dec->ps_cur_pic->u4_pack_slc_typ |= I_SLC_BIT;
  ------------------
  |  |  376|      0|#define I_SLC_BIT  (0x1)
  ------------------
 1506|       |
 1507|      0|        ret = isvcd_parse_eislice(ps_svc_lyr_dec, u2_first_mb_in_slice);
 1508|      0|        ps_dec->u1_pr_sl_type = u1_slice_type;
 1509|      0|        if(ps_dec->i4_pic_type != B_SLICE && ps_dec->i4_pic_type != P_SLICE)
  ------------------
  |  |  369|      0|#define B_SLICE  1
  ------------------
                      if(ps_dec->i4_pic_type != B_SLICE && ps_dec->i4_pic_type != P_SLICE)
  ------------------
  |  |  368|      0|#define P_SLICE  0
  ------------------
  |  Branch (1509:12): [True: 0, False: 0]
  |  Branch (1509:46): [True: 0, False: 0]
  ------------------
 1510|      0|            ps_dec->i4_pic_type = I_SLICE;
  ------------------
  |  |  370|      0|#define I_SLICE  2
  ------------------
 1511|      0|    }
 1512|    720|    else if(u1_slice_type == P_SLICE)
  ------------------
  |  |  368|    720|#define P_SLICE  0
  ------------------
  |  Branch (1512:13): [True: 645, False: 75]
  ------------------
 1513|    645|    {
 1514|    645|        ps_dec->ps_cur_pic->u4_pack_slc_typ |= P_SLC_BIT;
  ------------------
  |  |  377|    645|#define P_SLC_BIT  (0x2)
  ------------------
 1515|    645|        ret = isvcd_parse_epslice(ps_svc_lyr_dec, u2_first_mb_in_slice);
 1516|    645|        ps_dec->u1_pr_sl_type = u1_slice_type;
 1517|    645|        if(ps_dec->i4_pic_type != B_SLICE) ps_dec->i4_pic_type = P_SLICE;
  ------------------
  |  |  369|    645|#define B_SLICE  1
  ------------------
                      if(ps_dec->i4_pic_type != B_SLICE) ps_dec->i4_pic_type = P_SLICE;
  ------------------
  |  |  368|    645|#define P_SLICE  0
  ------------------
  |  Branch (1517:12): [True: 645, False: 0]
  ------------------
 1518|    645|    }
 1519|     75|    else if(u1_slice_type == B_SLICE)
  ------------------
  |  |  369|     75|#define B_SLICE  1
  ------------------
  |  Branch (1519:13): [True: 75, False: 0]
  ------------------
 1520|     75|    {
 1521|     75|        ps_dec->ps_cur_pic->u4_pack_slc_typ |= B_SLC_BIT;
  ------------------
  |  |  378|     75|#define B_SLC_BIT  (0x4)
  ------------------
 1522|     75|        ret = isvcd_parse_ebslice(ps_svc_lyr_dec, u2_first_mb_in_slice);
 1523|     75|        ps_dec->u1_pr_sl_type = u1_slice_type;
 1524|     75|        ps_dec->i4_pic_type = B_SLICE;
  ------------------
  |  |  369|     75|#define B_SLICE  1
  ------------------
 1525|     75|    }
 1526|      0|    else
 1527|      0|        return ERROR_INV_SLC_TYPE_T;
 1528|       |
 1529|    720|    if(ps_dec->u1_slice_header_done)
  ------------------
  |  Branch (1529:8): [True: 674, False: 46]
  ------------------
 1530|    674|    {
 1531|       |        /* set to zero to indicate a valid slice has been decoded */
 1532|    674|        ps_dec->u1_first_slice_in_stream = 0;
 1533|    674|    }
 1534|       |
 1535|    720|    if(ret != OK) return ret;
  ------------------
  |  |  114|    720|#define OK        0
  ------------------
  |  Branch (1535:8): [True: 311, False: 409]
  ------------------
 1536|       |
 1537|    409|    if(u1_nal_ref_idc != 0)
  ------------------
  |  Branch (1537:8): [True: 408, False: 1]
  ------------------
 1538|    408|    {
 1539|    408|        if(!ps_dec->ps_dpb_cmds->u1_dpb_commands_read)
  ------------------
  |  Branch (1539:12): [True: 408, False: 0]
  ------------------
 1540|    408|        {
 1541|    408|            memcpy((void *) ps_dec->ps_dpb_cmds, (void *) (&(ps_dec->s_dpb_cmds_scratch)),
 1542|    408|                   sizeof(dpb_commands_t));
 1543|    408|        }
 1544|    408|    }
 1545|       |
 1546|       |    /* storing last Mb X and MbY of the slice */
 1547|    409|    ps_dec->i2_prev_slice_mbx = ps_dec->u2_mbx;
 1548|    409|    ps_dec->i2_prev_slice_mby = ps_dec->u2_mby;
 1549|       |
 1550|       |    /* End of Picture detection */
 1551|    409|    if(ps_dec->u4_total_mbs_coded >= (ps_seq->u4_max_mb_addr + 1))
  ------------------
  |  Branch (1551:8): [True: 361, False: 48]
  ------------------
 1552|    361|    {
 1553|    361|        ps_dec->u1_pic_decode_done = 1;
 1554|    361|    }
 1555|       |
 1556|    409|    {
 1557|    409|        dec_err_status_t *ps_err = ps_dec->ps_dec_err_status;
 1558|    409|        if((ps_err->u1_err_flag & REJECT_PB_PICS) && (ps_err->u1_cur_pic_type == PIC_TYPE_I))
  ------------------
  |  |  602|    409|#define REJECT_PB_PICS    (0x02)
  ------------------
                      if((ps_err->u1_err_flag & REJECT_PB_PICS) && (ps_err->u1_cur_pic_type == PIC_TYPE_I))
  ------------------
  |  |  608|      0|#define PIC_TYPE_I        (0x00)
  ------------------
  |  Branch (1558:12): [True: 0, False: 409]
  |  Branch (1558:54): [True: 0, False: 0]
  ------------------
 1559|      0|        {
 1560|      0|            ps_err->u1_err_flag = ACCEPT_ALL_PICS;
  ------------------
  |  |  600|      0|#define ACCEPT_ALL_PICS   (0x00)
  ------------------
 1561|      0|        }
 1562|    409|    }
 1563|       |
 1564|    409|    PRINT_BIN_BIT_RATIO(ps_dec)
 1565|       |
 1566|    409|    return ret;
 1567|    720|}
isvcd_set_default_slice_header_ext:
 1581|    675|{
 1582|    675|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1583|    675|    WORD32 i_status = OK;
  ------------------
  |  |  114|    675|#define OK        0
  ------------------
 1584|    675|    dec_pic_params_t *ps_pps = ps_dec->ps_cur_pps;
 1585|    675|    dec_seq_params_t *ps_seq;
 1586|    675|    dec_svc_seq_params_t *ps_subset_seq;
 1587|    675|    dec_slice_svc_ext_params_t *ps_svc_slice_params = NULL;
 1588|    675|    dec_subset_seq_params_t *ps_sps_svc_ext = NULL;
 1589|    675|    ps_seq = ps_pps->ps_sps;
 1590|    675|    ps_seq += MAX_NUM_SEQ_PARAMS;
  ------------------
  |  |  521|    675|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
 1591|    675|    ps_subset_seq =
 1592|    675|        &ps_svc_lyr_dec->ps_subset_sps[MAX_NUM_SEQ_PARAMS + ps_seq->u1_seq_parameter_set_id];
  ------------------
  |  |  521|    675|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
 1593|    675|    ps_sps_svc_ext = &ps_subset_seq->s_sps_svc_ext;
 1594|    675|    ps_svc_slice_params = &ps_svc_lyr_dec->s_svc_slice_params;
 1595|       |
 1596|    675|    if(0 == ps_svc_lyr_dec->ps_nal_svc_ext->u1_quality_id)
  ------------------
  |  Branch (1596:8): [True: 675, False: 0]
  ------------------
 1597|    675|    {
 1598|    675|        ps_svc_slice_params->u1_ref_layer_chroma_phase_y_plus1 =
 1599|    675|            ps_sps_svc_ext->u1_seq_ref_layer_chroma_phase_y_plus1;
 1600|       |
 1601|    675|        ps_svc_slice_params->u1_ref_layer_chroma_phase_x_plus1_flag =
 1602|    675|            ps_sps_svc_ext->u1_seq_ref_layer_chroma_phase_x_plus1_flag;
 1603|    675|    }
 1604|       |
 1605|    675|    ps_svc_slice_params->u4_ref_layer_dq_id = UINT32_MAX;
 1606|    675|    ps_svc_slice_params->u4_disable_inter_layer_deblk_filter_idc = 0;
 1607|    675|    ps_svc_slice_params->u1_scan_idx_start = 0;
 1608|    675|    ps_svc_slice_params->u1_scan_idx_end = 15;
 1609|    675|    ps_svc_slice_params->i4_inter_layer_slice_alpha_c0_offset_div2 = 0;
 1610|    675|    ps_svc_slice_params->i4_inter_layer_slice_beta_offset_div2 = 0;
 1611|    675|    ps_svc_slice_params->u1_constrained_intra_resampling_flag = 0;
 1612|       |
 1613|    675|    return i_status;
 1614|    675|}
isvcd_parse_slice_header:
 1628|    675|{
 1629|    675|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1630|    675|    dec_pic_params_t *ps_pps = ps_dec->ps_cur_pps;
 1631|    675|    dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm;
 1632|    675|    dec_seq_params_t *ps_seq;
 1633|    675|    dec_svc_seq_params_t *ps_subset_seq;
 1634|    675|    dec_slice_svc_ext_params_t *ps_svc_slice_params = NULL;
 1635|    675|    dec_subset_seq_params_t *ps_sps_svc_ext = NULL;
 1636|    675|    svc_dec_ctxt_t *ps_svcd_ctxt;
 1637|    675|    UWORD32 *pu4_bitstrm_buf = ps_dec->ps_bitstrm->pu4_buffer;
 1638|    675|    UWORD32 *pu4_bitstrm_ofst = &ps_dec->ps_bitstrm->u4_ofst;
 1639|    675|    ps_svcd_ctxt = ps_svc_lyr_dec->ps_svcd_ctxt;
 1640|    675|    ps_seq = ps_pps->ps_sps;
 1641|    675|    ps_seq += MAX_NUM_SEQ_PARAMS;
  ------------------
  |  |  521|    675|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
 1642|    675|    ps_subset_seq =
 1643|    675|        &ps_svc_lyr_dec->ps_subset_sps[MAX_NUM_SEQ_PARAMS + ps_seq->u1_seq_parameter_set_id];
  ------------------
  |  |  521|    675|#define MAX_NUM_SEQ_PARAMS 32
  ------------------
 1644|    675|    ps_sps_svc_ext = &ps_subset_seq->s_sps_svc_ext;
 1645|    675|    ps_svc_slice_params = &ps_svc_lyr_dec->s_svc_slice_params;
 1646|       |
 1647|    675|    if(!ps_svc_lyr_dec->ps_nal_svc_ext->u1_no_inter_layer_pred_flag &&
  ------------------
  |  Branch (1647:8): [True: 675, False: 0]
  ------------------
 1648|    675|       (0 == ps_svc_lyr_dec->ps_nal_svc_ext->u1_quality_id))
  ------------------
  |  Branch (1648:8): [True: 675, False: 0]
  ------------------
 1649|    675|    {
 1650|    675|        ps_svc_slice_params->u4_ref_layer_dq_id = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1651|    675|        COPYTHECONTEXT("Slice Header SVC ext: u4_ref_layer_dq_id",
 1652|    675|                       ps_svc_slice_params->u4_ref_layer_dq_id);
 1653|    675|        if(ps_svc_slice_params->u4_ref_layer_dq_id > MAX_REF_DEP_ID)
  ------------------
  |  |  106|    675|#define MAX_REF_DEP_ID ((MAX_DEPENDENCY_ID << 4) | MAX_QUALITY_ID)
  |  |  ------------------
  |  |  |  |  103|    675|#define MAX_DEPENDENCY_ID 4
  |  |  ------------------
  |  |               #define MAX_REF_DEP_ID ((MAX_DEPENDENCY_ID << 4) | MAX_QUALITY_ID)
  |  |  ------------------
  |  |  |  |  102|    675|#define MAX_QUALITY_ID 0
  |  |  ------------------
  ------------------
  |  Branch (1653:12): [True: 0, False: 675]
  ------------------
 1654|      0|        {
 1655|      0|            return ERROR_INV_SLICE_HDR_T;
 1656|      0|        }
 1657|       |        /* Reference layer id update is taken care during resolution init */
 1658|       |        /*
 1659|       |        ps_svc_lyr_dec->u1_ref_layer_id = ps_svc_slice_params->u4_ref_layer_dq_id >> 4;
 1660|       |        if(ps_svc_lyr_dec->u1_ref_layer_id >= ps_svc_lyr_dec->u1_layer_id)
 1661|       |        {
 1662|       |            return ERROR_INV_SLICE_HDR_T;
 1663|       |        }
 1664|       |        */
 1665|    675|        ps_svc_lyr_dec->ps_dec_svc_ref_layer =
 1666|    675|            &ps_svcd_ctxt->ps_svc_dec_lyr[ps_svc_lyr_dec->u1_ref_layer_id];
 1667|       |
 1668|    675|        if(ps_sps_svc_ext->u1_inter_layer_deblocking_filter_control_present_flag)
  ------------------
  |  Branch (1668:12): [True: 34, False: 641]
  ------------------
 1669|     34|        {
 1670|     34|            ps_svc_slice_params->u4_disable_inter_layer_deblk_filter_idc =
 1671|     34|                ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1672|     34|            COPYTHECONTEXT("Slice Header SVC ext: u4_disable_inter_layer_deblk_filter_idc",
 1673|     34|                           ps_svc_slice_params->u4_disable_inter_layer_deblk_filter_idc);
 1674|       |
 1675|     34|            if(ps_svc_slice_params->u4_disable_inter_layer_deblk_filter_idc > 6)
  ------------------
  |  Branch (1675:16): [True: 0, False: 34]
  ------------------
 1676|      0|            {
 1677|      0|                return ERROR_INV_SLICE_HDR_T;
 1678|      0|            }
 1679|       |
 1680|     34|            if(1 != ps_svc_slice_params->u4_disable_inter_layer_deblk_filter_idc)
  ------------------
  |  Branch (1680:16): [True: 34, False: 0]
  ------------------
 1681|     34|            {
 1682|     34|                ps_svc_slice_params->i4_inter_layer_slice_alpha_c0_offset_div2 =
 1683|     34|                    ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1684|     34|                COPYTHECONTEXT("Slice Header SVC ext: i4_inter_layer_slice_alpha_c0_offset_div2",
 1685|     34|                               ps_svc_slice_params->i4_inter_layer_slice_alpha_c0_offset_div2);
 1686|       |
 1687|     34|                if(ps_svc_slice_params->i4_inter_layer_slice_alpha_c0_offset_div2 > 6 ||
  ------------------
  |  Branch (1687:20): [True: 0, False: 34]
  ------------------
 1688|     34|                   ps_svc_slice_params->i4_inter_layer_slice_alpha_c0_offset_div2 < -6)
  ------------------
  |  Branch (1688:20): [True: 0, False: 34]
  ------------------
 1689|      0|                {
 1690|      0|                    return ERROR_INV_SLICE_HDR_T;
 1691|      0|                }
 1692|       |
 1693|     34|                ps_svc_slice_params->i4_inter_layer_slice_beta_offset_div2 =
 1694|     34|                    ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1695|     34|                COPYTHECONTEXT("Slice Header SVC ext: i4_inter_layer_slice_beta_offset_div2",
 1696|     34|                               ps_svc_slice_params->i4_inter_layer_slice_beta_offset_div2);
 1697|       |
 1698|     34|                if(ps_svc_slice_params->i4_inter_layer_slice_beta_offset_div2 > 6 ||
  ------------------
  |  Branch (1698:20): [True: 1, False: 33]
  ------------------
 1699|     33|                   ps_svc_slice_params->i4_inter_layer_slice_beta_offset_div2 < -6)
  ------------------
  |  Branch (1699:20): [True: 0, False: 33]
  ------------------
 1700|      1|                {
 1701|      1|                    return ERROR_INV_SLICE_HDR_T;
 1702|      1|                }
 1703|     34|            }
 1704|     34|        }
 1705|       |
 1706|    674|        ps_svc_slice_params->u1_constrained_intra_resampling_flag = ih264d_get_bit_h264(ps_bitstrm);
 1707|    674|        COPYTHECONTEXT("Slice Header SVC ext: u1_constrained_intra_resampling_flag",
 1708|    674|                       ps_svc_slice_params->u1_constrained_intra_resampling_flag);
 1709|       |
 1710|    674|        ps_svc_lyr_dec->s_res_prms.i1_constrained_intra_rsmpl_flag =
 1711|    674|            ps_svc_lyr_dec->s_svc_slice_params.u1_constrained_intra_resampling_flag;
 1712|    674|        isvcd_intra_resamp_res_init_update_flags(ps_svc_lyr_dec);
 1713|       |
 1714|    674|        if(2 == ps_sps_svc_ext->u1_extended_spatial_scalability_idc)
  ------------------
  |  Branch (1714:12): [True: 0, False: 674]
  ------------------
 1715|      0|        {
 1716|       |            /* ChromaArrayType = i4_chroma_format_idc  if  separate_colour_plane_flag
 1717|       |             * = 0 for all chroma format except 4:4:4 */
 1718|      0|            if(ps_dec->ps_cur_sps->i4_chroma_format_idc >= 0)
  ------------------
  |  Branch (1718:16): [True: 0, False: 0]
  ------------------
 1719|      0|            {
 1720|      0|                ps_svc_slice_params->u1_ref_layer_chroma_phase_x_plus1_flag =
 1721|      0|                    ih264d_get_bit_h264(ps_bitstrm);
 1722|      0|                COPYTHECONTEXT("Slice Header SVC ext: u1_ref_layer_chroma_phase_x_plus1_flag",
 1723|      0|                               ps_svc_slice_params->u1_ref_layer_chroma_phase_x_plus1_flag);
 1724|       |
 1725|      0|                ps_svc_slice_params->u1_ref_layer_chroma_phase_y_plus1 =
 1726|      0|                    ih264d_get_bits_h264(ps_bitstrm, 2);
 1727|      0|                COPYTHECONTEXT("Slice Header SVC ext: u1_ref_layer_chroma_phase_y_plus1",
 1728|      0|                               ps_svc_slice_params->u1_ref_layer_chroma_phase_y_plus1);
 1729|       |
 1730|      0|                if(ps_svc_slice_params->u1_ref_layer_chroma_phase_y_plus1 > 2)
  ------------------
  |  Branch (1730:20): [True: 0, False: 0]
  ------------------
 1731|      0|                {
 1732|      0|                    return ERROR_INV_SLICE_HDR_T;
 1733|      0|                }
 1734|      0|            }
 1735|      0|            else
 1736|      0|            {
 1737|      0|                if(0 == ps_svc_lyr_dec->ps_nal_svc_ext->u1_quality_id)
  ------------------
  |  Branch (1737:20): [True: 0, False: 0]
  ------------------
 1738|      0|                {
 1739|      0|                    ps_svc_slice_params->u1_ref_layer_chroma_phase_y_plus1 =
 1740|      0|                        ps_sps_svc_ext->u1_seq_ref_layer_chroma_phase_y_plus1;
 1741|      0|                }
 1742|      0|            }
 1743|       |
 1744|      0|            ps_svc_slice_params->i4_scaled_ref_layer_left_offset =
 1745|      0|                ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1746|      0|            COPYTHECONTEXT("Slice Header SVC ext: i4_scaled_ref_layer_left_offset",
 1747|      0|                           ps_svc_slice_params->i4_scaled_ref_layer_left_offset);
 1748|       |
 1749|      0|            if(ps_svc_slice_params->i4_scaled_ref_layer_left_offset != 0)
  ------------------
  |  Branch (1749:16): [True: 0, False: 0]
  ------------------
 1750|      0|            {
 1751|      0|                return ERROR_INV_SLICE_HDR_T;
 1752|      0|            }
 1753|       |
 1754|      0|            if(ps_svc_slice_params->i4_scaled_ref_layer_left_offset >= MAX_SCLD_REF_LAYER_OFFSET ||
  ------------------
  |  |   71|      0|#define MAX_SCLD_REF_LAYER_OFFSET 32768
  ------------------
  |  Branch (1754:16): [True: 0, False: 0]
  ------------------
 1755|      0|               ps_svc_slice_params->i4_scaled_ref_layer_left_offset < MIN_SCLD_REF_LAYER_OFFSET)
  ------------------
  |  |   72|      0|#define MIN_SCLD_REF_LAYER_OFFSET -32768
  ------------------
  |  Branch (1755:16): [True: 0, False: 0]
  ------------------
 1756|      0|            {
 1757|      0|                return ERROR_INV_SLICE_HDR_T;
 1758|      0|            }
 1759|       |
 1760|      0|            ps_svc_slice_params->i4_scaled_ref_layer_top_offset =
 1761|      0|                ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1762|      0|            COPYTHECONTEXT("Slice Header SVC ext: i4_scaled_ref_layer_top_offset",
 1763|      0|                           ps_svc_slice_params->i4_scaled_ref_layer_top_offset);
 1764|       |
 1765|      0|            if(ps_svc_slice_params->i4_scaled_ref_layer_top_offset != 0)
  ------------------
  |  Branch (1765:16): [True: 0, False: 0]
  ------------------
 1766|      0|            {
 1767|      0|                return ERROR_INV_SLICE_HDR_T;
 1768|      0|            }
 1769|       |
 1770|      0|            if(ps_svc_slice_params->i4_scaled_ref_layer_top_offset >= MAX_SCLD_REF_LAYER_OFFSET ||
  ------------------
  |  |   71|      0|#define MAX_SCLD_REF_LAYER_OFFSET 32768
  ------------------
  |  Branch (1770:16): [True: 0, False: 0]
  ------------------
 1771|      0|               ps_svc_slice_params->i4_scaled_ref_layer_top_offset < MIN_SCLD_REF_LAYER_OFFSET)
  ------------------
  |  |   72|      0|#define MIN_SCLD_REF_LAYER_OFFSET -32768
  ------------------
  |  Branch (1771:16): [True: 0, False: 0]
  ------------------
 1772|      0|            {
 1773|      0|                return ERROR_INV_SLICE_HDR_T;
 1774|      0|            }
 1775|       |
 1776|      0|            ps_svc_slice_params->i4_scaled_ref_layer_right_offset =
 1777|      0|                ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1778|      0|            COPYTHECONTEXT("Slice Header SVC ext: i4_scaled_ref_layer_right_offset",
 1779|      0|                           ps_svc_slice_params->i4_scaled_ref_layer_right_offset);
 1780|       |
 1781|      0|            if(ps_svc_slice_params->i4_scaled_ref_layer_right_offset >= MAX_SCLD_REF_LAYER_OFFSET ||
  ------------------
  |  |   71|      0|#define MAX_SCLD_REF_LAYER_OFFSET 32768
  ------------------
  |  Branch (1781:16): [True: 0, False: 0]
  ------------------
 1782|      0|               ps_svc_slice_params->i4_scaled_ref_layer_right_offset < MIN_SCLD_REF_LAYER_OFFSET)
  ------------------
  |  |   72|      0|#define MIN_SCLD_REF_LAYER_OFFSET -32768
  ------------------
  |  Branch (1782:16): [True: 0, False: 0]
  ------------------
 1783|      0|            {
 1784|      0|                return ERROR_INV_SLICE_HDR_T;
 1785|      0|            }
 1786|       |
 1787|      0|            ps_svc_slice_params->i4_scaled_ref_layer_bottom_offset =
 1788|      0|                ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1789|      0|            COPYTHECONTEXT("Slice Header SVC ext: i4_scaled_ref_layer_bottom_offset",
 1790|      0|                           ps_svc_slice_params->i4_scaled_ref_layer_bottom_offset);
 1791|       |
 1792|      0|            if(ps_svc_slice_params->i4_scaled_ref_layer_bottom_offset >=
  ------------------
  |  Branch (1792:16): [True: 0, False: 0]
  ------------------
 1793|      0|                   MAX_SCLD_REF_LAYER_OFFSET ||
  ------------------
  |  |   71|      0|#define MAX_SCLD_REF_LAYER_OFFSET 32768
  ------------------
 1794|      0|               ps_svc_slice_params->i4_scaled_ref_layer_bottom_offset < MIN_SCLD_REF_LAYER_OFFSET)
  ------------------
  |  |   72|      0|#define MIN_SCLD_REF_LAYER_OFFSET -32768
  ------------------
  |  Branch (1794:16): [True: 0, False: 0]
  ------------------
 1795|      0|            {
 1796|      0|                return ERROR_INV_SLICE_HDR_T;
 1797|      0|            }
 1798|      0|        }
 1799|    674|        else
 1800|    674|        {
 1801|    674|            ps_svc_slice_params->i4_scaled_ref_layer_left_offset =
 1802|    674|                ps_sps_svc_ext->i4_seq_scaled_ref_layer_left_offset;
 1803|    674|            ps_svc_slice_params->i4_scaled_ref_layer_top_offset =
 1804|    674|                ps_sps_svc_ext->i4_seq_scaled_ref_layer_top_offset;
 1805|    674|            ps_svc_slice_params->i4_scaled_ref_layer_right_offset =
 1806|    674|                ps_sps_svc_ext->i4_seq_scaled_ref_layer_right_offset;
 1807|    674|            ps_svc_slice_params->i4_scaled_ref_layer_bottom_offset =
 1808|    674|                ps_sps_svc_ext->i4_seq_scaled_ref_layer_bottom_offset;
 1809|    674|        }
 1810|    674|    }
 1811|       |
 1812|    674|    if(!ps_svc_lyr_dec->ps_nal_svc_ext->u1_no_inter_layer_pred_flag)
  ------------------
  |  Branch (1812:8): [True: 674, False: 0]
  ------------------
 1813|    674|    {
 1814|    674|        ps_svc_slice_params->u1_slice_skip_flag = ih264d_get_bit_h264(ps_bitstrm);
 1815|    674|        COPYTHECONTEXT("Slice Header SVC ext: u1_slice_skip_flag",
 1816|    674|                       ps_svc_slice_params->u1_slice_skip_flag);
 1817|       |
 1818|    674|        if(ps_svc_slice_params->u1_slice_skip_flag)
  ------------------
  |  Branch (1818:12): [True: 1, False: 673]
  ------------------
 1819|      1|        {
 1820|      1|            ps_svc_slice_params->u4_num_mbs_in_slice_minus1 =
 1821|      1|                ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1822|      1|            COPYTHECONTEXT("Slice Header SVC ext: u4_num_mbs_in_slice_minus1",
 1823|      1|                           ps_svc_slice_params->u4_num_mbs_in_slice_minus1);
 1824|      1|        }
 1825|    673|        else
 1826|    673|        {
 1827|    673|            ps_svc_slice_params->u1_adaptive_base_mode_flag = ih264d_get_bit_h264(ps_bitstrm);
 1828|    673|            COPYTHECONTEXT("Slice Header SVC ext: u1_adaptive_base_mode_flag",
 1829|    673|                           ps_svc_slice_params->u1_adaptive_base_mode_flag);
 1830|       |
 1831|    673|            if(!ps_svc_slice_params->u1_adaptive_base_mode_flag)
  ------------------
  |  Branch (1831:16): [True: 235, False: 438]
  ------------------
 1832|    235|            {
 1833|    235|                ps_svc_slice_params->u1_default_base_mode_flag = ih264d_get_bit_h264(ps_bitstrm);
 1834|    235|                COPYTHECONTEXT("Slice Header SVC ext: u1_default_base_mode_flag",
 1835|    235|                               ps_svc_slice_params->u1_default_base_mode_flag);
 1836|    235|            }
 1837|    673|            if(!ps_svc_slice_params->u1_default_base_mode_flag)
  ------------------
  |  Branch (1837:16): [True: 613, False: 60]
  ------------------
 1838|    613|            {
 1839|    613|                ps_svc_slice_params->u1_adaptive_motion_prediction_flag =
 1840|    613|                    ih264d_get_bit_h264(ps_bitstrm);
 1841|    613|                COPYTHECONTEXT("Slice Header SVC ext: u1_adaptive_motion_prediction_flag",
 1842|    613|                               ps_svc_slice_params->u1_adaptive_motion_prediction_flag);
 1843|       |
 1844|    613|                if(!ps_svc_slice_params->u1_adaptive_motion_prediction_flag)
  ------------------
  |  Branch (1844:20): [True: 461, False: 152]
  ------------------
 1845|    461|                {
 1846|    461|                    ps_svc_slice_params->u1_default_motion_prediction_flag =
 1847|    461|                        ih264d_get_bit_h264(ps_bitstrm);
 1848|    461|                    COPYTHECONTEXT("Slice Header SVC ext: u1_default_motion_prediction_flag",
 1849|    461|                                   ps_svc_slice_params->u1_default_motion_prediction_flag);
 1850|    461|                }
 1851|    613|            }
 1852|    673|            ps_svc_slice_params->u1_adaptive_residual_prediction_flag =
 1853|    673|                ih264d_get_bit_h264(ps_bitstrm);
 1854|    673|            COPYTHECONTEXT("Slice Header SVC ext: u1_adaptive_residual_prediction_flag",
 1855|    673|                           ps_svc_slice_params->u1_adaptive_residual_prediction_flag);
 1856|       |
 1857|    673|            if(!ps_svc_slice_params->u1_adaptive_residual_prediction_flag)
  ------------------
  |  Branch (1857:16): [True: 589, False: 84]
  ------------------
 1858|    589|            {
 1859|    589|                ps_svc_slice_params->u1_default_residual_prediction_flag =
 1860|    589|                    ih264d_get_bit_h264(ps_bitstrm);
 1861|    589|                COPYTHECONTEXT("Slice Header SVC ext: u1_default_residual_prediction_flag",
 1862|    589|                               ps_svc_slice_params->u1_default_residual_prediction_flag);
 1863|    589|            }
 1864|    673|        }
 1865|       |
 1866|    674|        if(ps_sps_svc_ext->u1_adaptive_tcoeff_level_prediction_flag)
  ------------------
  |  Branch (1866:12): [True: 0, False: 674]
  ------------------
 1867|      0|        {
 1868|      0|            ps_svc_slice_params->u1_tcoeff_level_prediction_flag = ih264d_get_bit_h264(ps_bitstrm);
 1869|      0|            COPYTHECONTEXT("Slice Header SVC ext: u1_tcoeff_level_prediction_flag",
 1870|      0|                           ps_svc_slice_params->u1_tcoeff_level_prediction_flag);
 1871|       |
 1872|      0|            if(ps_svc_slice_params->u1_tcoeff_level_prediction_flag != 0)
  ------------------
  |  Branch (1872:16): [True: 0, False: 0]
  ------------------
 1873|      0|            {
 1874|      0|                return ERROR_INV_SPS_PPS_T;
 1875|      0|            }
 1876|      0|        }
 1877|    674|    }
 1878|       |
 1879|    674|    if(!ps_sps_svc_ext->u1_slice_header_restriction_flag &&
  ------------------
  |  Branch (1879:8): [True: 116, False: 558]
  ------------------
 1880|    116|       !ps_svc_slice_params->u1_slice_skip_flag)
  ------------------
  |  Branch (1880:8): [True: 116, False: 0]
  ------------------
 1881|    116|    {
 1882|    116|        ps_svc_slice_params->u1_scan_idx_start = ih264d_get_bits_h264(ps_bitstrm, 4);
 1883|    116|        COPYTHECONTEXT("Slice Header SVC ext: u1_scan_idx_start",
 1884|    116|                       ps_svc_slice_params->u1_scan_idx_start);
 1885|    116|        ps_svc_slice_params->u1_scan_idx_end = ih264d_get_bits_h264(ps_bitstrm, 4);
 1886|    116|        COPYTHECONTEXT("Slice Header SVC ext: u1_scan_idx_end",
 1887|    116|                       ps_svc_slice_params->u1_scan_idx_end);
 1888|       |
 1889|    116|        if(0 != ps_svc_slice_params->u1_scan_idx_start &&
  ------------------
  |  Branch (1889:12): [True: 35, False: 81]
  ------------------
 1890|     35|           15 != ps_svc_slice_params->u1_scan_idx_end)
  ------------------
  |  Branch (1890:12): [True: 0, False: 35]
  ------------------
 1891|      0|            return ERROR_SVC_INV_SCAN_IDX;
 1892|    116|    }
 1893|    674|    return OK;
  ------------------
  |  |  114|    674|#define OK        0
  ------------------
 1894|    674|}
isvcd_parse_decode_slice:
 1911|  4.86k|{
 1912|  4.86k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1913|  4.86k|    dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm;
 1914|  4.86k|    dec_pic_params_t *ps_pps;
 1915|  4.86k|    dec_seq_params_t *ps_seq;
 1916|  4.86k|    dec_svc_seq_params_t *ps_subset_seq;
 1917|  4.86k|    dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice;
 1918|  4.86k|    pocstruct_t s_tmp_poc = {0};
 1919|  4.86k|    WORD32 i_delta_poc[2] = {0};
 1920|  4.86k|    WORD32 i4_poc = 0;
 1921|  4.86k|    UWORD16 u2_first_mb_in_slice, u2_frame_num;
 1922|  4.86k|    UWORD8 u1_field_pic_flag, u1_redundant_pic_cnt = 0, u1_slice_type;
 1923|  4.86k|    UWORD32 u4_idr_pic_id = 0;
 1924|  4.86k|    UWORD8 u1_bottom_field_flag, u1_pic_order_cnt_type;
 1925|  4.86k|    UWORD8 u1_nal_unit_type;
 1926|  4.86k|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
 1927|  4.86k|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
 1928|  4.86k|    WORD8 i1_is_end_of_poc;
 1929|       |
 1930|  4.86k|    WORD32 ret;
 1931|  4.86k|    WORD32 prev_slice_err, num_mb_skipped;
 1932|  4.86k|    UWORD32 u4_mbaff;
 1933|  4.86k|    pocstruct_t *ps_cur_poc;
 1934|       |
 1935|  4.86k|    UWORD32 u4_temp;
 1936|  4.86k|    WORD32 i_temp;
 1937|  4.86k|    svc_dec_ctxt_t *psvcd_dec_ctxt;
 1938|  4.86k|    dec_struct_t *ps_dec_cur_lyr_minus_1;
 1939|  4.86k|    svc_dec_lyr_struct_t *ps_svc_cur_lyr_dec_minus_1;
 1940|       |
 1941|       |    /* read FirstMbInSlice  and slice type*/
 1942|  4.86k|    ps_dec->ps_dpb_cmds->u1_dpb_commands_read_slc = 0;
 1943|  4.86k|    u2_first_mb_in_slice = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1944|  4.86k|    if(u2_first_mb_in_slice > (ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs))
  ------------------
  |  Branch (1944:8): [True: 425, False: 4.43k]
  ------------------
 1945|    425|    {
 1946|    425|        return ERROR_CORRUPTED_SLICE;
 1947|    425|    }
 1948|       |
 1949|       |    /*we currently don not support ASO*/
 1950|  4.43k|    if(((u2_first_mb_in_slice << ps_cur_slice->u1_mbaff_frame_flag) <= ps_dec->u4_cur_mb_addr) &&
  ------------------
  |  Branch (1950:8): [True: 3.65k, False: 785]
  ------------------
 1951|  3.65k|       (ps_dec->u4_first_slice_in_pic == 0))
  ------------------
  |  Branch (1951:8): [True: 92, False: 3.56k]
  ------------------
 1952|     92|    {
 1953|     92|        return ERROR_CORRUPTED_SLICE;
 1954|     92|    }
 1955|       |
 1956|  4.34k|    if(ps_dec->u4_first_slice_in_pic == 1)
  ------------------
  |  Branch (1956:8): [True: 3.80k, False: 536]
  ------------------
 1957|  3.80k|    {
 1958|  3.80k|        if(u2_first_mb_in_slice != 0)
  ------------------
  |  Branch (1958:12): [True: 249, False: 3.56k]
  ------------------
 1959|    249|        {
 1960|    249|            return ERROR_CORRUPTED_SLICE;
 1961|    249|        }
 1962|  3.80k|    }
 1963|       |
 1964|  4.09k|    COPYTHECONTEXT("SH: first_mb_in_slice", u2_first_mb_in_slice);
 1965|       |
 1966|  4.09k|    u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1967|  4.09k|    if(u4_temp > 9) return ERROR_INV_SLC_TYPE_T;
  ------------------
  |  Branch (1967:8): [True: 28, False: 4.06k]
  ------------------
 1968|       |
 1969|  4.06k|    u1_slice_type = u4_temp;
 1970|  4.06k|    COPYTHECONTEXT("SH: slice_type", (u1_slice_type));
 1971|       |    /* Find Out the Slice Type is 5 to 9 or not then Set the Flag   */
 1972|       |    /* u1_sl_typ_5_9 = 1 .Which tells that all the slices in the Pic*/
 1973|       |    /* will be of same type of current                            */
 1974|  4.06k|    if(u1_slice_type > 4)
  ------------------
  |  Branch (1974:8): [True: 48, False: 4.02k]
  ------------------
 1975|     48|    {
 1976|     48|        u1_slice_type -= 5;
 1977|     48|    }
 1978|       |
 1979|  4.06k|    u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 1980|  4.06k|    if(u4_temp & MASK_ERR_PIC_SET_ID) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  |  527|  4.06k|#define MASK_ERR_PIC_SET_ID   (0xFFFFFF00)
  ------------------
  |  Branch (1980:8): [True: 0, False: 4.06k]
  ------------------
 1981|       |    /* discard slice if pic param is invalid */
 1982|  4.06k|    COPYTHECONTEXT("SH: pic_parameter_set_id", u4_temp);
 1983|  4.06k|    ps_pps = &ps_dec->ps_pps[u4_temp];
 1984|  4.06k|    if(FALSE == ps_pps->u1_is_valid)
  ------------------
  |  |  592|  4.06k|#define FALSE   0
  ------------------
  |  Branch (1984:8): [True: 95, False: 3.97k]
  ------------------
 1985|     95|    {
 1986|     95|        return ERROR_INV_SLICE_HDR_T;
 1987|     95|    }
 1988|       |    /* slices in a layer should have same PPS id*/
 1989|  3.97k|    if(UINT32_MAX == ps_svc_lyr_dec->u4_pps_id_for_layer)
  ------------------
  |  Branch (1989:8): [True: 3.43k, False: 536]
  ------------------
 1990|  3.43k|    {
 1991|  3.43k|        ps_svc_lyr_dec->u4_pps_id_for_layer = u4_temp;
 1992|  3.43k|    }
 1993|    536|    else if(u4_temp != ps_svc_lyr_dec->u4_pps_id_for_layer)
  ------------------
  |  Branch (1993:13): [True: 0, False: 536]
  ------------------
 1994|      0|    {
 1995|      0|        return ERROR_INV_SLICE_HDR_T;
 1996|      0|    }
 1997|  3.97k|    ps_seq = ps_pps->ps_sps;
 1998|  3.97k|    ps_dec->ps_cur_sps = ps_seq;
 1999|  3.97k|    ps_subset_seq = &ps_svc_lyr_dec->ps_subset_sps[ps_seq->u1_seq_parameter_set_id];
 2000|  3.97k|    ps_svc_lyr_dec->ps_cur_subset_sps = ps_subset_seq;
 2001|  3.97k|    if(!ps_seq) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (2001:8): [True: 0, False: 3.97k]
  ------------------
 2002|  3.97k|    if(FALSE == ps_seq->u1_is_valid) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  |  592|  3.97k|#define FALSE   0
  ------------------
  |  Branch (2002:8): [True: 1, False: 3.97k]
  ------------------
 2003|  3.97k|    if(ps_seq->u1_mb_aff_flag) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (2003:8): [True: 0, False: 3.97k]
  ------------------
 2004|  3.97k|    if(ps_seq->u1_level_idc > H264_LEVEL_4_2) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  |  303|  3.97k|#define H264_LEVEL_4_2     42
  ------------------
  |  Branch (2004:8): [True: 0, False: 3.97k]
  ------------------
 2005|  3.97k|    if(!ps_seq->u1_frame_mbs_only_flag) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (2005:8): [True: 0, False: 3.97k]
  ------------------
 2006|  3.97k|    if(OK != isvcd_verify_level(ps_seq->u1_level_idc)) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  |  114|  3.97k|#define OK        0
  ------------------
  |  Branch (2006:8): [True: 0, False: 3.97k]
  ------------------
 2007|  3.97k|    if(ps_dec->u1_init_dec_flag == 1)
  ------------------
  |  Branch (2007:8): [True: 3.81k, False: 162]
  ------------------
 2008|  3.81k|    {
 2009|  3.81k|        if(ps_dec->u2_frm_wd_in_mbs != ps_seq->u2_frm_wd_in_mbs) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (2009:12): [True: 1, False: 3.80k]
  ------------------
 2010|  3.80k|        if(ps_dec->u2_frm_ht_in_mbs != ps_seq->u2_frm_ht_in_mbs) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (2010:12): [True: 0, False: 3.80k]
  ------------------
 2011|  3.80k|    }
 2012|       |
 2013|  3.97k|    if(ps_dec->u1_init_dec_flag == 1)
  ------------------
  |  Branch (2013:8): [True: 3.80k, False: 162]
  ------------------
 2014|  3.80k|    {
 2015|  3.80k|        if(ps_dec->u2_disp_height != ps_subset_seq->u2_disp_height) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (2015:12): [True: 0, False: 3.80k]
  ------------------
 2016|  3.80k|        if(ps_dec->u2_disp_width != ps_subset_seq->u2_disp_width) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (2016:12): [True: 0, False: 3.80k]
  ------------------
 2017|  3.80k|    }
 2018|       |
 2019|  3.97k|    if(ps_seq->u1_profile_idc == BASE_PROFILE_IDC)
  ------------------
  |  |  275|  3.97k|#define BASE_PROFILE_IDC    66
  ------------------
  |  Branch (2019:8): [True: 218, False: 3.75k]
  ------------------
 2020|    218|    {
 2021|    218|        if(ps_pps->u1_entropy_coding_mode != 0)
  ------------------
  |  Branch (2021:12): [True: 2, False: 216]
  ------------------
 2022|      2|        {
 2023|      2|            return ERROR_INV_SPS_PPS_T;
 2024|      2|        }
 2025|    218|    }
 2026|       |
 2027|  3.96k|    ps_dec->i4_reorder_depth = ps_subset_seq->i4_reorder_depth;
 2028|  3.96k|    ps_dec->u2_disp_height = ps_subset_seq->u2_disp_height;
 2029|  3.96k|    ps_dec->u2_disp_width = ps_subset_seq->u2_disp_width;
 2030|       |
 2031|  3.96k|    if(ps_svc_lyr_dec->u1_layer_id > 0)
  ------------------
  |  Branch (2031:8): [True: 0, False: 3.96k]
  ------------------
 2032|      0|    {
 2033|      0|        psvcd_dec_ctxt = ps_svc_lyr_dec->ps_svcd_ctxt;
 2034|      0|        ps_svc_cur_lyr_dec_minus_1 =
 2035|      0|            &psvcd_dec_ctxt->ps_svc_dec_lyr[ps_svc_lyr_dec->u1_layer_id - 1];
 2036|       |
 2037|      0|        ps_dec_cur_lyr_minus_1 = &ps_svc_cur_lyr_dec_minus_1->s_dec;
 2038|       |
 2039|      0|        if((ps_dec_cur_lyr_minus_1->u2_pic_wd > ps_subset_seq->u2_pic_wd) ||
  ------------------
  |  Branch (2039:12): [True: 0, False: 0]
  ------------------
 2040|      0|           (ps_dec_cur_lyr_minus_1->u2_pic_ht > ps_subset_seq->u2_pic_ht))
  ------------------
  |  Branch (2040:12): [True: 0, False: 0]
  ------------------
 2041|      0|        {
 2042|      0|            return ERROR_CORRUPTED_SLICE;
 2043|      0|        }
 2044|      0|    }
 2045|       |
 2046|  3.96k|    ps_dec->u2_pic_wd = ps_subset_seq->u2_pic_wd;
 2047|  3.96k|    ps_dec->u2_pic_ht = ps_subset_seq->u2_pic_ht;
 2048|  3.96k|    ps_dec->u4_total_mbs = ps_seq->u4_total_num_of_mbs << (1 - ps_seq->u1_frame_mbs_only_flag);
 2049|       |
 2050|       |    /* Determining the Width and Height of Frame from that of Picture */
 2051|  3.96k|    ps_dec->u2_frm_wd_y = ps_subset_seq->u2_frm_wd_y;
 2052|  3.96k|    ps_dec->u2_frm_ht_y = ps_subset_seq->u2_frm_ht_y;
 2053|       |
 2054|  3.96k|    ps_dec->u2_frm_wd_uv = ps_subset_seq->u2_frm_wd_uv;
 2055|  3.96k|    ps_dec->u2_frm_ht_uv = ps_subset_seq->u2_frm_ht_uv;
 2056|       |
 2057|  3.96k|    ps_dec->s_pad_mgr.u1_pad_len_y_v = ps_subset_seq->u1_pad_len_y_v;
 2058|  3.96k|    ps_dec->s_pad_mgr.u1_pad_len_cr_v = ps_subset_seq->u1_pad_len_cr_v;
 2059|  3.96k|    ps_dec->u2_frm_wd_in_mbs = ps_seq->u2_frm_wd_in_mbs;
 2060|  3.96k|    ps_dec->u2_frm_ht_in_mbs = ps_seq->u2_frm_ht_in_mbs;
 2061|       |
 2062|  3.96k|    ps_dec->u2_crop_offset_y = ps_subset_seq->u2_crop_offset_y;
 2063|  3.96k|    ps_dec->u2_crop_offset_uv = ps_subset_seq->u2_crop_offset_uv;
 2064|       |
 2065|       |    /* Get the frame num */
 2066|  3.96k|    u2_frame_num = ih264d_get_bits_h264(ps_bitstrm, ps_seq->u1_bits_in_frm_num);
 2067|  3.96k|    COPYTHECONTEXT("SH: frame_num", u2_frame_num);
 2068|       |
 2069|  3.96k|    if(!ps_dec->u1_first_slice_in_stream && ps_dec->u4_first_slice_in_pic)
  ------------------
  |  Branch (2069:8): [True: 3.67k, False: 295]
  |  Branch (2069:45): [True: 3.13k, False: 536]
  ------------------
 2070|  3.13k|    {
 2071|  3.13k|        pocstruct_t *ps_prev_poc = &ps_dec->s_prev_pic_poc;
 2072|  3.13k|        pocstruct_t *ps_cur_poc = &ps_dec->s_cur_pic_poc;
 2073|       |
 2074|  3.13k|        ps_dec->u2_mbx = 0xffff;
 2075|  3.13k|        ps_dec->u2_mby = 0;
 2076|       |
 2077|  3.13k|        if((0 == u1_is_idr_slice) && ps_cur_slice->u1_nal_ref_idc)
  ------------------
  |  Branch (2077:12): [True: 552, False: 2.58k]
  |  Branch (2077:38): [True: 104, False: 448]
  ------------------
 2078|    104|            ps_dec->u2_prev_ref_frame_num = ps_cur_slice->u2_frame_num;
 2079|       |
 2080|  3.13k|        if(u1_is_idr_slice || ps_cur_slice->u1_mmco_equalto5) ps_dec->u2_prev_ref_frame_num = 0;
  ------------------
  |  Branch (2080:12): [True: 2.58k, False: 552]
  |  Branch (2080:31): [True: 1, False: 551]
  ------------------
 2081|       |
 2082|  3.13k|        if(ps_dec->ps_cur_sps->u1_gaps_in_frame_num_value_allowed_flag)
  ------------------
  |  Branch (2082:12): [True: 0, False: 3.13k]
  ------------------
 2083|      0|        {
 2084|      0|            isvcd_decode_gaps_in_frame_num(ps_dec, u2_frame_num);
 2085|      0|        }
 2086|       |
 2087|  3.13k|        ps_prev_poc->i4_prev_frame_num_ofst = ps_cur_poc->i4_prev_frame_num_ofst;
 2088|  3.13k|        ps_prev_poc->u2_frame_num = ps_cur_poc->u2_frame_num;
 2089|  3.13k|        ps_prev_poc->u1_mmco_equalto5 = ps_cur_slice->u1_mmco_equalto5;
 2090|  3.13k|        if(ps_cur_slice->u1_nal_ref_idc)
  ------------------
  |  Branch (2090:12): [True: 2.61k, False: 527]
  ------------------
 2091|  2.61k|        {
 2092|  2.61k|            ps_prev_poc->i4_pic_order_cnt_lsb = ps_cur_poc->i4_pic_order_cnt_lsb;
 2093|  2.61k|            ps_prev_poc->i4_pic_order_cnt_msb = ps_cur_poc->i4_pic_order_cnt_msb;
 2094|  2.61k|            ps_prev_poc->i4_delta_pic_order_cnt_bottom = ps_cur_poc->i4_delta_pic_order_cnt_bottom;
 2095|  2.61k|            ps_prev_poc->i4_delta_pic_order_cnt[0] = ps_cur_poc->i4_delta_pic_order_cnt[0];
 2096|  2.61k|            ps_prev_poc->i4_delta_pic_order_cnt[1] = ps_cur_poc->i4_delta_pic_order_cnt[1];
 2097|  2.61k|            ps_prev_poc->u1_bot_field = ps_cur_poc->u1_bot_field;
 2098|  2.61k|        }
 2099|       |
 2100|  3.13k|        ps_dec->u4_total_mbs_coded = 0;
 2101|  3.13k|    }
 2102|       |    /* Get the field related flags  */
 2103|  3.96k|    if(!ps_seq->u1_frame_mbs_only_flag)
  ------------------
  |  Branch (2103:8): [True: 0, False: 3.96k]
  ------------------
 2104|      0|    {
 2105|      0|        u1_field_pic_flag = ih264d_get_bit_h264(ps_bitstrm);
 2106|      0|        COPYTHECONTEXT("SH: field_pic_flag", u1_field_pic_flag);
 2107|      0|        u1_bottom_field_flag = 0;
 2108|       |
 2109|      0|        if(u1_field_pic_flag)
  ------------------
  |  Branch (2109:12): [True: 0, False: 0]
  ------------------
 2110|      0|        {
 2111|      0|            ps_dec->pu1_inv_scan = (UWORD8 *) gau1_ih264d_inv_scan_fld;
 2112|      0|            u1_bottom_field_flag = ih264d_get_bit_h264(ps_bitstrm);
 2113|      0|            COPYTHECONTEXT("SH: bottom_field_flag", u1_bottom_field_flag);
 2114|      0|        }
 2115|      0|        else
 2116|      0|        {
 2117|      0|            ps_dec->pu1_inv_scan = (UWORD8 *) gau1_ih264d_inv_scan;
 2118|      0|        }
 2119|      0|    }
 2120|  3.96k|    else
 2121|  3.96k|    {
 2122|  3.96k|        u1_field_pic_flag = 0;
 2123|  3.96k|        u1_bottom_field_flag = 0;
 2124|       |
 2125|  3.96k|        ps_dec->pu1_inv_scan = (UWORD8 *) gau1_ih264d_inv_scan;
 2126|  3.96k|    }
 2127|       |
 2128|  3.96k|    u1_nal_unit_type = SLICE_NAL;
  ------------------
  |  |  324|  3.96k|#define SLICE_NAL                       1
  ------------------
 2129|  3.96k|    if(u1_is_idr_slice)
  ------------------
  |  Branch (2129:8): [True: 2.86k, False: 1.10k]
  ------------------
 2130|  2.86k|    {
 2131|  2.86k|        u1_nal_unit_type = IDR_SLICE_NAL;
  ------------------
  |  |  328|  2.86k|#define IDR_SLICE_NAL                   5
  ------------------
 2132|  2.86k|        u4_idr_pic_id = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 2133|  2.86k|        if(u4_idr_pic_id > 65535) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (2133:12): [True: 4, False: 2.86k]
  ------------------
 2134|  2.86k|        COPYTHECONTEXT("SH:  ", u4_idr_pic_id);
 2135|  2.86k|    }
 2136|       |
 2137|       |    /* read delta pic order count information*/
 2138|  3.96k|    i_delta_poc[0] = i_delta_poc[1] = 0;
 2139|  3.96k|    s_tmp_poc.i4_pic_order_cnt_lsb = 0;
 2140|  3.96k|    s_tmp_poc.i4_delta_pic_order_cnt_bottom = 0;
 2141|  3.96k|    u1_pic_order_cnt_type = ps_seq->u1_pic_order_cnt_type;
 2142|  3.96k|    if(u1_pic_order_cnt_type == 0)
  ------------------
  |  Branch (2142:8): [True: 3.73k, False: 233]
  ------------------
 2143|  3.73k|    {
 2144|  3.73k|        i_temp = ih264d_get_bits_h264(ps_bitstrm, ps_seq->u1_log2_max_pic_order_cnt_lsb_minus);
 2145|  3.73k|        if(i_temp < 0 || i_temp >= ps_seq->i4_max_pic_order_cntLsb) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  Branch (2145:12): [True: 0, False: 3.73k]
  |  Branch (2145:26): [True: 0, False: 3.73k]
  ------------------
 2146|  3.73k|        s_tmp_poc.i4_pic_order_cnt_lsb = i_temp;
 2147|  3.73k|        COPYTHECONTEXT("SH: pic_order_cnt_lsb", s_tmp_poc.i4_pic_order_cnt_lsb);
 2148|       |
 2149|  3.73k|        if((ps_pps->u1_pic_order_present_flag == 1) && (!u1_field_pic_flag))
  ------------------
  |  Branch (2149:12): [True: 1.35k, False: 2.37k]
  |  Branch (2149:56): [True: 1.35k, False: 0]
  ------------------
 2150|  1.35k|        {
 2151|  1.35k|            s_tmp_poc.i4_delta_pic_order_cnt_bottom = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 2152|  1.35k|            COPYTHECONTEXT("SH: delta_pic_order_cnt_bottom",
 2153|  1.35k|                           s_tmp_poc.i4_delta_pic_order_cnt_bottom);
 2154|  1.35k|        }
 2155|  3.73k|    }
 2156|       |
 2157|  3.96k|    s_tmp_poc.i4_delta_pic_order_cnt[0] = 0;
 2158|  3.96k|    s_tmp_poc.i4_delta_pic_order_cnt[1] = 0;
 2159|  3.96k|    if(u1_pic_order_cnt_type == 1 && (!ps_seq->u1_delta_pic_order_always_zero_flag))
  ------------------
  |  Branch (2159:8): [True: 212, False: 3.75k]
  |  Branch (2159:38): [True: 206, False: 6]
  ------------------
 2160|    206|    {
 2161|    206|        s_tmp_poc.i4_delta_pic_order_cnt[0] = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 2162|    206|        COPYTHECONTEXT("SH: delta_pic_order_cnt[0]", s_tmp_poc.i4_delta_pic_order_cnt[0]);
 2163|       |
 2164|    206|        if(ps_pps->u1_pic_order_present_flag && !u1_field_pic_flag)
  ------------------
  |  Branch (2164:12): [True: 184, False: 22]
  |  Branch (2164:49): [True: 184, False: 0]
  ------------------
 2165|    184|        {
 2166|    184|            s_tmp_poc.i4_delta_pic_order_cnt[1] = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 2167|    184|            COPYTHECONTEXT("SH: delta_pic_order_cnt[1]", s_tmp_poc.i4_delta_pic_order_cnt[1]);
 2168|    184|        }
 2169|    206|    }
 2170|       |
 2171|  3.96k|    if(ps_pps->u1_redundant_pic_cnt_present_flag)
  ------------------
  |  Branch (2171:8): [True: 1.40k, False: 2.56k]
  ------------------
 2172|  1.40k|    {
 2173|  1.40k|        u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
 2174|  1.40k|        if(u4_temp > MAX_REDUNDANT_PIC_CNT) return ERROR_INV_SLICE_HDR_T;
  ------------------
  |  |  611|  1.40k|#define MAX_REDUNDANT_PIC_CNT       127
  ------------------
  |  Branch (2174:12): [True: 13, False: 1.38k]
  ------------------
 2175|  1.38k|        u1_redundant_pic_cnt = u4_temp;
 2176|  1.38k|        COPYTHECONTEXT("SH: redundant_pic_cnt", u1_redundant_pic_cnt);
 2177|  1.38k|    }
 2178|       |
 2179|       |    /*--------------------------------------------------------------------*/
 2180|       |    /* Check if the slice is part of new picture                          */
 2181|       |    /*--------------------------------------------------------------------*/
 2182|       |    /* First slice of a picture is always considered as part of new picture */
 2183|  3.95k|    i1_is_end_of_poc = 1;
 2184|  3.95k|    ps_dec->ps_dec_err_status->u1_err_flag &= MASK_REJECT_CUR_PIC;
  ------------------
  |  |  604|  3.95k|#define MASK_REJECT_CUR_PIC (0xFE)
  ------------------
 2185|       |
 2186|  3.95k|    if(ps_dec->u4_first_slice_in_pic == 0)
  ------------------
  |  Branch (2186:8): [True: 536, False: 3.41k]
  ------------------
 2187|    536|    {
 2188|    536|        i1_is_end_of_poc =
 2189|    536|            ih264d_is_end_of_pic(u2_frame_num, u1_nal_ref_idc, &s_tmp_poc, &ps_dec->s_cur_pic_poc,
 2190|    536|                                 ps_cur_slice, u1_pic_order_cnt_type, u1_nal_unit_type,
 2191|    536|                                 u4_idr_pic_id, u1_field_pic_flag, u1_bottom_field_flag);
 2192|    536|        if(i1_is_end_of_poc)
  ------------------
  |  Branch (2192:12): [True: 1, False: 535]
  ------------------
 2193|      1|        {
 2194|      1|            ps_dec->u1_first_slice_in_stream = 0;
 2195|      1|            return ERROR_INCOMPLETE_FRAME;
 2196|      1|        }
 2197|    536|    }
 2198|       |
 2199|       |    /*--------------------------------------------------------------------*/
 2200|       |    /* Check for error in slice and parse the missing/corrupted MB's      */
 2201|       |    /* as skip-MB's in an inserted P-slice                                */
 2202|       |    /*--------------------------------------------------------------------*/
 2203|  3.95k|    u4_mbaff = ps_seq->u1_mb_aff_flag && (!u1_field_pic_flag);
  ------------------
  |  Branch (2203:16): [True: 0, False: 3.95k]
  |  Branch (2203:42): [True: 0, False: 0]
  ------------------
 2204|  3.95k|    prev_slice_err = 0;
 2205|       |
 2206|  3.95k|    if(i1_is_end_of_poc || ps_dec->u1_first_slice_in_stream)
  ------------------
  |  Branch (2206:8): [True: 3.41k, False: 535]
  |  Branch (2206:28): [True: 0, False: 535]
  ------------------
 2207|  3.41k|    {
 2208|       |        /* If the current slice is not a field or frame number of the current
 2209|       |         * slice doesn't match with previous slice, and decoder is expecting
 2210|       |         * to decode a field i.e. ps_dec->u1_top_bottom_decoded is not 0 and
 2211|       |         * is not (TOP_FIELD_ONLY | BOT_FIELD_ONLY), treat it as a dangling
 2212|       |         * field */
 2213|  3.41k|        if((u1_field_pic_flag == 0 || u2_frame_num != ps_dec->u2_prv_frame_num) &&
  ------------------
  |  Branch (2213:13): [True: 3.41k, False: 0]
  |  Branch (2213:39): [True: 0, False: 0]
  ------------------
 2214|  3.41k|           ps_dec->u1_top_bottom_decoded != 0 &&
  ------------------
  |  Branch (2214:12): [True: 0, False: 3.41k]
  ------------------
 2215|      0|           ps_dec->u1_top_bottom_decoded != (TOP_FIELD_ONLY | BOT_FIELD_ONLY))
  ------------------
  |  |   64|      0|#define TOP_FIELD_ONLY      0x02
  ------------------
                         ps_dec->u1_top_bottom_decoded != (TOP_FIELD_ONLY | BOT_FIELD_ONLY))
  ------------------
  |  |   65|      0|#define BOT_FIELD_ONLY      0x01
  ------------------
  |  Branch (2215:12): [True: 0, False: 0]
  ------------------
 2216|      0|        {
 2217|      0|            ps_dec->u1_dangling_field = 1;
 2218|      0|            if(ps_dec->u4_first_slice_in_pic)
  ------------------
  |  Branch (2218:16): [True: 0, False: 0]
  ------------------
 2219|      0|            {
 2220|       |                // first slice - dangling field
 2221|      0|                prev_slice_err = 1;
 2222|      0|            }
 2223|      0|            else
 2224|      0|            {
 2225|       |                // last slice - dangling field
 2226|      0|                prev_slice_err = 2;
 2227|      0|            }
 2228|       |
 2229|      0|            if(ps_dec->u1_top_bottom_decoded == TOP_FIELD_ONLY)
  ------------------
  |  |   64|      0|#define TOP_FIELD_ONLY      0x02
  ------------------
  |  Branch (2229:16): [True: 0, False: 0]
  ------------------
 2230|      0|                ps_cur_slice->u1_bottom_field_flag = 1;
 2231|      0|            else
 2232|      0|                ps_cur_slice->u1_bottom_field_flag = 0;
 2233|       |
 2234|      0|            num_mb_skipped =
 2235|      0|                (ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs) - ps_dec->u4_total_mbs_coded;
 2236|      0|            ps_cur_poc = &ps_dec->s_cur_pic_poc;
 2237|       |
 2238|      0|            u1_is_idr_slice = ps_cur_slice->u1_nal_unit_type == IDR_SLICE_NAL;
  ------------------
  |  |  328|      0|#define IDR_SLICE_NAL                   5
  ------------------
 2239|      0|        }
 2240|  3.41k|        else if(ps_dec->u4_first_slice_in_pic)
  ------------------
  |  Branch (2240:17): [True: 3.41k, False: 0]
  ------------------
 2241|  3.41k|        {
 2242|  3.41k|            if(u2_first_mb_in_slice > 0)
  ------------------
  |  Branch (2242:16): [True: 0, False: 3.41k]
  ------------------
 2243|      0|            {
 2244|       |                /* first slice - missing/header corruption */
 2245|      0|                prev_slice_err = 1;
 2246|      0|                num_mb_skipped = u2_first_mb_in_slice << u4_mbaff;
 2247|      0|                ps_cur_poc = &s_tmp_poc;
 2248|       |
 2249|       |                /* initializing slice parameters */
 2250|      0|                ps_cur_slice->u4_idr_pic_id = u4_idr_pic_id;
 2251|      0|                ps_cur_slice->u1_field_pic_flag = u1_field_pic_flag;
 2252|      0|                ps_cur_slice->u1_bottom_field_flag = u1_bottom_field_flag;
 2253|      0|                ps_cur_slice->i4_pic_order_cnt_lsb = s_tmp_poc.i4_pic_order_cnt_lsb;
 2254|      0|                ps_cur_slice->u1_nal_unit_type = u1_nal_unit_type;
 2255|      0|                ps_cur_slice->u1_redundant_pic_cnt = u1_redundant_pic_cnt;
 2256|      0|                ps_cur_slice->u1_nal_ref_idc = u1_nal_ref_idc;
 2257|      0|                ps_cur_slice->u1_pic_order_cnt_type = u1_pic_order_cnt_type;
 2258|      0|                ps_cur_slice->u1_mbaff_frame_flag = ps_seq->u1_mb_aff_flag && (!u1_field_pic_flag);
  ------------------
  |  Branch (2258:53): [True: 0, False: 0]
  |  Branch (2258:79): [True: 0, False: 0]
  ------------------
 2259|      0|            }
 2260|  3.41k|        }
 2261|      0|        else
 2262|      0|        {
 2263|       |            /* since i1_is_end_of_poc is set ,means new frame num is encountered. so
 2264|       |             * conceal the current frame completely */
 2265|      0|            prev_slice_err = 2;
 2266|      0|            num_mb_skipped =
 2267|      0|                (ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs) - ps_dec->u4_total_mbs_coded;
 2268|      0|            ps_cur_poc = &s_tmp_poc;
 2269|      0|        }
 2270|  3.41k|    }
 2271|    535|    else
 2272|    535|    {
 2273|    535|        if((u2_first_mb_in_slice << u4_mbaff) > ps_dec->u4_total_mbs_coded)
  ------------------
  |  Branch (2273:12): [True: 5, False: 530]
  ------------------
 2274|      5|        {
 2275|       |            // previous slice - missing/corruption
 2276|      5|            prev_slice_err = 2;
 2277|      5|            num_mb_skipped = (u2_first_mb_in_slice << u4_mbaff) - ps_dec->u4_total_mbs_coded;
 2278|      5|            ps_cur_poc = &s_tmp_poc;
 2279|      5|        }
 2280|    530|        else if((u2_first_mb_in_slice << u4_mbaff) < ps_dec->u4_total_mbs_coded)
  ------------------
  |  Branch (2280:17): [True: 0, False: 530]
  ------------------
 2281|      0|        {
 2282|      0|            return ERROR_CORRUPTED_SLICE;
 2283|      0|        }
 2284|    535|    }
 2285|  3.95k|    if(prev_slice_err)
  ------------------
  |  Branch (2285:8): [True: 5, False: 3.94k]
  ------------------
 2286|      5|    {
 2287|      5|        ret = isvcd_mark_err_slice_skip((svc_dec_lyr_struct_t *) ps_dec, num_mb_skipped,
 2288|      5|                                        u1_is_idr_slice, u2_frame_num, ps_cur_poc, prev_slice_err);
 2289|       |
 2290|      5|        if(ps_dec->u1_dangling_field == 1)
  ------------------
  |  Branch (2290:12): [True: 0, False: 5]
  ------------------
 2291|      0|        {
 2292|      0|            ps_dec->u1_second_field = 1 - ps_dec->u1_second_field;
 2293|      0|            ps_dec->u1_first_slice_in_stream = 0;
 2294|      0|            ps_dec->u1_top_bottom_decoded = TOP_FIELD_ONLY | BOT_FIELD_ONLY;
  ------------------
  |  |   64|      0|#define TOP_FIELD_ONLY      0x02
  ------------------
                          ps_dec->u1_top_bottom_decoded = TOP_FIELD_ONLY | BOT_FIELD_ONLY;
  ------------------
  |  |   65|      0|#define BOT_FIELD_ONLY      0x01
  ------------------
 2295|      0|            return ERROR_DANGLING_FIELD_IN_PIC;
 2296|      0|        }
 2297|       |
 2298|      5|        if(prev_slice_err == 2)
  ------------------
  |  Branch (2298:12): [True: 5, False: 0]
  ------------------
 2299|      5|        {
 2300|      5|            ps_dec->u1_first_slice_in_stream = 0;
 2301|      5|            return ERROR_INCOMPLETE_FRAME;
 2302|      5|        }
 2303|       |
 2304|      0|        if(ps_dec->u4_total_mbs_coded >= ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs)
  ------------------
  |  Branch (2304:12): [True: 0, False: 0]
  ------------------
 2305|      0|        {
 2306|       |            /* return if all MBs in frame are parsed*/
 2307|      0|            ps_dec->u1_first_slice_in_stream = 0;
 2308|      0|            return ERROR_IN_LAST_SLICE_OF_PIC;
 2309|      0|        }
 2310|       |
 2311|      0|        if(ps_dec->ps_dec_err_status->u1_err_flag & REJECT_CUR_PIC)
  ------------------
  |  |  601|      0|#define REJECT_CUR_PIC    (0x01)
  ------------------
  |  Branch (2311:12): [True: 0, False: 0]
  ------------------
 2312|      0|        {
 2313|      0|            ih264d_err_pic_dispbuf_mgr(ps_dec);
 2314|      0|            return ERROR_NEW_FRAME_EXPECTED;
 2315|      0|        }
 2316|       |
 2317|      0|        if(ret != OK) return ret;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (2317:12): [True: 0, False: 0]
  ------------------
 2318|       |
 2319|      0|        i1_is_end_of_poc = 0;
 2320|      0|    }
 2321|       |
 2322|  3.94k|    if(u1_field_pic_flag)
  ------------------
  |  Branch (2322:8): [True: 0, False: 3.94k]
  ------------------
 2323|      0|    {
 2324|      0|        ps_dec->u2_prv_frame_num = u2_frame_num;
 2325|      0|    }
 2326|       |
 2327|  3.94k|    if(ps_cur_slice->u1_mmco_equalto5 && NULL != ps_dec->ps_cur_pic)
  ------------------
  |  Branch (2327:8): [True: 1, False: 3.94k]
  |  Branch (2327:42): [True: 1, False: 0]
  ------------------
 2328|      1|    {
 2329|      1|        WORD32 i4_temp_poc;
 2330|      1|        WORD32 i4_top_field_order_poc, i4_bot_field_order_poc;
 2331|      1|        WORD64 i8_result;
 2332|      1|        if(!ps_cur_slice->u1_field_pic_flag)
  ------------------
  |  Branch (2332:12): [True: 1, False: 0]
  ------------------
 2333|      1|        {
 2334|      1|            i4_top_field_order_poc = ps_dec->ps_cur_pic->i4_top_field_order_cnt;
 2335|      1|            i4_bot_field_order_poc = ps_dec->ps_cur_pic->i4_bottom_field_order_cnt;
 2336|      1|            i4_temp_poc = MIN(i4_top_field_order_poc, i4_bot_field_order_poc);
  ------------------
  |  |   61|      1|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 2337|      1|        }
 2338|      0|        else if(!ps_cur_slice->u1_bottom_field_flag)
  ------------------
  |  Branch (2338:17): [True: 0, False: 0]
  ------------------
 2339|      0|            i4_temp_poc = ps_dec->ps_cur_pic->i4_top_field_order_cnt;
 2340|      0|        else
 2341|      0|            i4_temp_poc = ps_dec->ps_cur_pic->i4_bottom_field_order_cnt;
 2342|       |
 2343|      1|        i8_result = (WORD64) i4_temp_poc - ps_dec->ps_cur_pic->i4_top_field_order_cnt;
 2344|      1|        if(IS_OUT_OF_RANGE_S32(i8_result))
  ------------------
  |  |   58|      1|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 1]
  |  |  |  Branch (58:54): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 2345|      0|        {
 2346|      0|            return ERROR_INV_POC;
 2347|      0|        }
 2348|      1|        ps_dec->ps_cur_pic->i4_top_field_order_cnt = (WORD32) i8_result;
 2349|      1|        i8_result = (WORD64) i4_temp_poc - ps_dec->ps_cur_pic->i4_bottom_field_order_cnt;
 2350|      1|        if(IS_OUT_OF_RANGE_S32(i8_result))
  ------------------
  |  |   58|      1|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 1]
  |  |  |  Branch (58:54): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 2351|      0|        {
 2352|      0|            return ERROR_INV_POC;
 2353|      0|        }
 2354|      1|        ps_dec->ps_cur_pic->i4_bottom_field_order_cnt = (WORD32) i8_result;
 2355|      1|        ps_dec->ps_cur_pic->i4_poc = i4_temp_poc;
 2356|      1|        ps_dec->ps_cur_pic->i4_avg_poc = i4_temp_poc;
 2357|      1|    }
 2358|  3.94k|    if(ps_dec->u4_first_slice_in_pic)
  ------------------
  |  Branch (2358:8): [True: 3.41k, False: 530]
  ------------------
 2359|  3.41k|    {
 2360|  3.41k|        ret = isvcd_decode_pic_order_cnt(u1_is_idr_slice, u2_frame_num, &ps_dec->s_prev_pic_poc,
 2361|  3.41k|                                         &s_tmp_poc, ps_cur_slice, ps_pps, u1_nal_ref_idc,
 2362|  3.41k|                                         u1_bottom_field_flag, u1_field_pic_flag, &i4_poc, ps_dec);
 2363|  3.41k|        if(ret != OK) return ret;
  ------------------
  |  |  114|  3.41k|#define OK        0
  ------------------
  |  Branch (2363:12): [True: 11, False: 3.40k]
  ------------------
 2364|       |        /* Display seq no calculations */
 2365|  3.40k|        if(i4_poc >= ps_dec->i4_max_poc) ps_dec->i4_max_poc = i4_poc;
  ------------------
  |  Branch (2365:12): [True: 1.66k, False: 1.73k]
  ------------------
 2366|       |        /* IDR Picture or POC wrap around */
 2367|  3.40k|        if(i4_poc == 0)
  ------------------
  |  Branch (2367:12): [True: 219, False: 3.18k]
  ------------------
 2368|    219|        {
 2369|    219|            WORD64 i8_temp;
 2370|    219|            i8_temp = (WORD64) ps_dec->i4_prev_max_display_seq + ps_dec->i4_max_poc +
 2371|    219|                      ps_dec->u1_max_dec_frame_buffering + 1;
 2372|       |            /*If i4_prev_max_display_seq overflows integer range, reset it */
 2373|    219|            ps_dec->i4_prev_max_display_seq = IS_OUT_OF_RANGE_S32(i8_temp) ? 0 : i8_temp;
  ------------------
  |  |   58|    219|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 219]
  |  |  |  Branch (58:54): [True: 0, False: 219]
  |  |  ------------------
  ------------------
 2374|    219|            ps_dec->i4_max_poc = 0;
 2375|    219|        }
 2376|  3.40k|    }
 2377|       |
 2378|       |    /* Increment only if the current slice has atleast 1 more MB */
 2379|  3.93k|    if(ps_dec->u4_first_slice_in_pic == 0 &&
  ------------------
  |  Branch (2379:8): [True: 530, False: 3.40k]
  ------------------
 2380|    530|       (ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice <
  ------------------
  |  Branch (2380:8): [True: 530, False: 0]
  ------------------
 2381|    530|        (UWORD32) (ps_dec->u4_total_mbs_coded >> ps_dec->ps_cur_slice->u1_mbaff_frame_flag)))
 2382|    530|    {
 2383|    530|        ps_dec->ps_parse_cur_slice++;
 2384|    530|        ps_dec->u2_cur_slice_num++;
 2385|       |        // in the case of single core increment ps_decode_cur_slice
 2386|    530|        if(ps_dec->u1_separate_parse == 0)
  ------------------
  |  Branch (2386:12): [True: 447, False: 83]
  ------------------
 2387|    447|        {
 2388|    447|            ps_dec->ps_decode_cur_slice++;
 2389|    447|        }
 2390|    530|    }
 2391|       |
 2392|  3.93k|    ps_dec->u1_slice_header_done = 0;
 2393|       |
 2394|       |    /*--------------------------------------------------------------------*/
 2395|       |    /* Copy the values read from the bitstream to the slice header and then*/
 2396|       |    /* If the slice is first slice in picture, then do Start of Picture   */
 2397|       |    /* processing.                                                        */
 2398|       |    /*--------------------------------------------------------------------*/
 2399|  3.93k|    ps_cur_slice->i4_delta_pic_order_cnt[0] = i_delta_poc[0];
 2400|  3.93k|    ps_cur_slice->i4_delta_pic_order_cnt[1] = i_delta_poc[1];
 2401|  3.93k|    ps_cur_slice->u4_idr_pic_id = u4_idr_pic_id;
 2402|  3.93k|    ps_cur_slice->u2_first_mb_in_slice = u2_first_mb_in_slice;
 2403|  3.93k|    ps_cur_slice->u1_field_pic_flag = u1_field_pic_flag;
 2404|  3.93k|    ps_cur_slice->u1_bottom_field_flag = u1_bottom_field_flag;
 2405|  3.93k|    ps_cur_slice->u1_slice_type = u1_slice_type;
 2406|  3.93k|    ps_cur_slice->i4_pic_order_cnt_lsb = s_tmp_poc.i4_pic_order_cnt_lsb;
 2407|       |
 2408|  3.93k|    ps_cur_slice->u1_nal_unit_type = u1_nal_unit_type;
 2409|  3.93k|    ps_cur_slice->u1_redundant_pic_cnt = u1_redundant_pic_cnt;
 2410|  3.93k|    ps_cur_slice->u1_nal_ref_idc = u1_nal_ref_idc;
 2411|  3.93k|    ps_cur_slice->u1_pic_order_cnt_type = u1_pic_order_cnt_type;
 2412|       |
 2413|  3.93k|    if(ps_seq->u1_frame_mbs_only_flag)
  ------------------
  |  Branch (2413:8): [True: 3.93k, False: 0]
  ------------------
 2414|  3.93k|        ps_cur_slice->u1_direct_8x8_inference_flag = ps_seq->u1_direct_8x8_inference_flag;
 2415|      0|    else
 2416|      0|        ps_cur_slice->u1_direct_8x8_inference_flag = 1;
 2417|       |
 2418|  3.93k|    if(u1_slice_type == B_SLICE)
  ------------------
  |  |  369|  3.93k|#define B_SLICE  1
  ------------------
  |  Branch (2418:8): [True: 1.41k, False: 2.52k]
  ------------------
 2419|  1.41k|    {
 2420|  1.41k|        ps_cur_slice->u1_direct_spatial_mv_pred_flag = ih264d_get_bit_h264(ps_bitstrm);
 2421|  1.41k|        COPYTHECONTEXT("SH: direct_spatial_mv_pred_flag",
 2422|  1.41k|                       ps_cur_slice->u1_direct_spatial_mv_pred_flag);
 2423|       |
 2424|  1.41k|        if(ps_cur_slice->u1_direct_spatial_mv_pred_flag)
  ------------------
  |  Branch (2424:12): [True: 371, False: 1.03k]
  ------------------
 2425|    371|            ps_cur_slice->pf_decodeDirect = ih264d_decode_spatial_direct;
 2426|  1.03k|        else
 2427|  1.03k|            ps_cur_slice->pf_decodeDirect = ih264d_decode_temporal_direct;
 2428|  1.41k|        if(!((ps_seq->u1_mb_aff_flag) && (!u1_field_pic_flag)))
  ------------------
  |  Branch (2428:14): [True: 0, False: 1.41k]
  |  Branch (2428:42): [True: 0, False: 0]
  ------------------
 2429|  1.41k|            ps_dec->pf_mvpred = ih264d_mvpred_nonmbaffB;
 2430|  1.41k|    }
 2431|  2.52k|    else
 2432|  2.52k|    {
 2433|  2.52k|        if(!((ps_seq->u1_mb_aff_flag) && (!u1_field_pic_flag)))
  ------------------
  |  Branch (2433:14): [True: 0, False: 2.52k]
  |  Branch (2433:42): [True: 0, False: 0]
  ------------------
 2434|  2.52k|            ps_dec->pf_mvpred = ih264d_mvpred_nonmbaff;
 2435|  2.52k|    }
 2436|       |
 2437|  3.93k|    if(ps_dec->u4_first_slice_in_pic)
  ------------------
  |  Branch (2437:8): [True: 3.40k, False: 530]
  ------------------
 2438|  3.40k|    {
 2439|  3.40k|        if(u2_first_mb_in_slice == 0)
  ------------------
  |  Branch (2439:12): [True: 3.40k, False: 0]
  ------------------
 2440|  3.40k|        {
 2441|  3.40k|            ret = isvcd_start_of_pic(ps_svc_lyr_dec, i4_poc, &s_tmp_poc, u2_frame_num, ps_pps);
 2442|  3.40k|            if(ret != OK) return ret;
  ------------------
  |  |  114|  3.40k|#define OK        0
  ------------------
  |  Branch (2442:16): [True: 33, False: 3.37k]
  ------------------
 2443|       |            /*inter layer buffer intialization */
 2444|  3.37k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb =
 2445|  3.37k|                ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start;
 2446|  3.37k|            ps_svc_lyr_dec->ps_il_pred_mv_bank_buf_cur_mb =
 2447|  3.37k|                ps_svc_lyr_dec->ps_il_pred_mv_bank_buf_base;
 2448|  3.37k|        }
 2449|       |
 2450|  3.37k|        ps_dec->u4_output_present = 0;
 2451|       |
 2452|  3.37k|        {
 2453|  3.37k|            ih264d_get_next_display_field(ps_dec, ps_dec->ps_out_buffer, &(ps_dec->s_disp_op));
 2454|       |            /* If error code is non-zero then there is no buffer available for
 2455|       |            display, hence avoid format conversion */
 2456|       |
 2457|  3.37k|            if(0 != ps_dec->s_disp_op.u4_error_code)
  ------------------
  |  Branch (2457:16): [True: 1.04k, False: 2.32k]
  ------------------
 2458|  1.04k|            {
 2459|  1.04k|                ps_dec->u4_output_present = 0;
 2460|  1.04k|                ps_dec->u4_fmt_conv_cur_row = ps_dec->s_disp_frame_info.u4_y_ht;
 2461|  1.04k|            }
 2462|  2.32k|            else
 2463|  2.32k|                ps_dec->u4_output_present = 1;
 2464|  3.37k|        }
 2465|  3.37k|        ret = isvcd_parse_interlayer_resamp_func_init(ps_svc_lyr_dec, u2_first_mb_in_slice);
 2466|  3.37k|        if(ret != OK)
  ------------------
  |  |  114|  3.37k|#define OK        0
  ------------------
  |  Branch (2466:12): [True: 0, False: 3.37k]
  ------------------
 2467|      0|        {
 2468|      0|            return ERROR_CORRUPTED_SLICE;
 2469|      0|        }
 2470|  3.37k|        if((ps_dec->u1_separate_parse == 1) && (ps_svc_lyr_dec->u1_res_init_done == 1))
  ------------------
  |  Branch (2470:12): [True: 451, False: 2.92k]
  |  Branch (2470:48): [True: 451, False: 0]
  ------------------
 2471|    451|        {
 2472|    451|            if(ps_dec->u4_dec_thread_created == 0)
  ------------------
  |  Branch (2472:16): [True: 451, False: 0]
  ------------------
 2473|    451|            {
 2474|    451|                if(ps_svc_lyr_dec->u1_layer_identifier != TARGET_LAYER)
  ------------------
  |  |  110|    451|#define TARGET_LAYER 2
  ------------------
  |  Branch (2474:20): [True: 0, False: 451]
  ------------------
 2475|      0|                {
 2476|      0|                    ithread_create(ps_dec->pv_dec_thread_handle, NULL,
 2477|      0|                                   (void *) isvcd_decode_picture_thread, (void *) ps_dec);
 2478|       |
 2479|      0|                    ps_dec->u4_dec_thread_created = 1;
 2480|      0|                }
 2481|    451|                else
 2482|    451|                {
 2483|    451|                    ithread_create(ps_dec->pv_dec_thread_handle, NULL,
 2484|    451|                                   (void *) ih264d_decode_picture_thread, (void *) ps_dec);
 2485|       |
 2486|    451|                    ps_dec->u4_dec_thread_created = 1;
 2487|    451|                }
 2488|    451|            }
 2489|       |#ifdef KEEP_THREADS_ACTIVE
 2490|       |            ret = ithread_mutex_lock(ps_dec->apv_proc_start_mutex[0]);
 2491|       |            RETURN_IF((ret != IV_SUCCESS), ret);
 2492|       |
 2493|       |            ps_dec->ai4_process_start[0] = PROC_START;
 2494|       |            ret = ithread_cond_signal(ps_dec->apv_proc_start_condition[0]);
 2495|       |            RETURN_IF((ret != IV_SUCCESS), ret);
 2496|       |
 2497|       |            ret = ithread_mutex_unlock(ps_dec->apv_proc_start_mutex[0]);
 2498|       |            RETURN_IF((ret != IV_SUCCESS), ret);
 2499|       |#endif
 2500|       |#ifdef KEEP_THREADS_ACTIVE
 2501|       |            if(ps_dec->u4_bs_deblk_thread_created)
 2502|       |            {
 2503|       |                ret = ithread_mutex_lock(ps_dec->apv_proc_start_mutex[1]);
 2504|       |                RETURN_IF((ret != IV_SUCCESS), ret);
 2505|       |
 2506|       |                ps_dec->ai4_process_start[1] = PROC_START;
 2507|       |                ret = ithread_cond_signal(ps_dec->apv_proc_start_condition[1]);
 2508|       |                RETURN_IF((ret != IV_SUCCESS), ret);
 2509|       |
 2510|       |                ret = ithread_mutex_unlock(ps_dec->apv_proc_start_mutex[1]);
 2511|       |                RETURN_IF((ret != IV_SUCCESS), ret);
 2512|       |            }
 2513|       |#endif
 2514|    451|        }
 2515|  3.37k|    }
 2516|       |
 2517|       |    /* INITIALIZATION of fn ptrs for MC and formMbPartInfo functions */
 2518|  3.90k|    {
 2519|  3.90k|        UWORD8 uc_nofield_nombaff;
 2520|       |
 2521|  3.90k|        uc_nofield_nombaff =
 2522|  3.90k|            ((ps_dec->ps_cur_slice->u1_field_pic_flag == 0) &&
  ------------------
  |  Branch (2522:14): [True: 3.90k, False: 0]
  ------------------
 2523|  3.90k|             (ps_dec->ps_cur_slice->u1_mbaff_frame_flag == 0) && (u1_slice_type != B_SLICE) &&
  ------------------
  |  |  369|  3.90k|#define B_SLICE  1
  ------------------
  |  Branch (2523:14): [True: 3.90k, False: 0]
  |  Branch (2523:66): [True: 2.49k, False: 1.40k]
  ------------------
 2524|  2.49k|             (ps_dec->ps_cur_pps->u1_wted_pred_flag == 0));
  ------------------
  |  Branch (2524:14): [True: 866, False: 1.63k]
  ------------------
 2525|       |
 2526|       |        /* Initialise MC and formMbPartInfo fn ptrs one time based on profile_idc */
 2527|       |
 2528|  3.90k|        if(uc_nofield_nombaff)
  ------------------
  |  Branch (2528:12): [True: 866, False: 3.03k]
  ------------------
 2529|    866|        {
 2530|    866|            ps_dec->p_form_mb_part_info = ih264d_form_mb_part_info_bp;
 2531|    866|            ps_dec->p_motion_compensate = ih264d_motion_compensate_bp;
 2532|    866|        }
 2533|  3.03k|        else
 2534|  3.03k|        {
 2535|  3.03k|            ps_dec->p_form_mb_part_info = ih264d_form_mb_part_info_mp;
 2536|  3.03k|            ps_dec->p_motion_compensate = ih264d_motion_compensate_mp;
 2537|  3.03k|        }
 2538|  3.90k|    }
 2539|       |
 2540|       |    /*
 2541|       |     * Decide whether to decode the current picture or not
 2542|       |     */
 2543|  3.90k|    {
 2544|  3.90k|        dec_err_status_t *ps_err = ps_dec->ps_dec_err_status;
 2545|  3.90k|        if(ps_err->u4_frm_sei_sync == u2_frame_num)
  ------------------
  |  Branch (2545:12): [True: 16, False: 3.88k]
  ------------------
 2546|     16|        {
 2547|     16|            ps_err->u1_err_flag = ACCEPT_ALL_PICS;
  ------------------
  |  |  600|     16|#define ACCEPT_ALL_PICS   (0x00)
  ------------------
 2548|     16|            ps_err->u4_frm_sei_sync = SYNC_FRM_DEFAULT;
  ------------------
  |  |  609|     16|#define SYNC_FRM_DEFAULT  (0xFFFFFFFF)
  ------------------
 2549|     16|        }
 2550|  3.90k|        ps_err->u4_cur_frm = u2_frame_num;
 2551|  3.90k|    }
 2552|       |
 2553|       |    /* Decision for decoding if the picture is to be skipped */
 2554|  3.90k|    {
 2555|  3.90k|        WORD32 i4_skip_b_pic, i4_skip_p_pic;
 2556|       |
 2557|  3.90k|        i4_skip_b_pic = (ps_dec->u4_skip_frm_mask & B_SLC_BIT) && (B_SLICE == u1_slice_type) &&
  ------------------
  |  |  378|  3.90k|#define B_SLC_BIT  (0x4)
  ------------------
                      i4_skip_b_pic = (ps_dec->u4_skip_frm_mask & B_SLC_BIT) && (B_SLICE == u1_slice_type) &&
  ------------------
  |  |  369|      0|#define B_SLICE  1
  ------------------
  |  Branch (2557:25): [True: 0, False: 3.90k]
  |  Branch (2557:67): [True: 0, False: 0]
  ------------------
 2558|      0|                        (0 == u1_nal_ref_idc);
  ------------------
  |  Branch (2558:25): [True: 0, False: 0]
  ------------------
 2559|       |
 2560|  3.90k|        i4_skip_p_pic = (ps_dec->u4_skip_frm_mask & P_SLC_BIT) && (P_SLICE == u1_slice_type) &&
  ------------------
  |  |  377|  3.90k|#define P_SLC_BIT  (0x2)
  ------------------
                      i4_skip_p_pic = (ps_dec->u4_skip_frm_mask & P_SLC_BIT) && (P_SLICE == u1_slice_type) &&
  ------------------
  |  |  368|      0|#define P_SLICE  0
  ------------------
  |  Branch (2560:25): [True: 0, False: 3.90k]
  |  Branch (2560:67): [True: 0, False: 0]
  ------------------
 2561|      0|                        (0 == u1_nal_ref_idc);
  ------------------
  |  Branch (2561:25): [True: 0, False: 0]
  ------------------
 2562|       |
 2563|       |        /**************************************************************/
 2564|       |        /* Skip the B picture if skip mask is set for B picture and   */
 2565|       |        /* Current B picture is a non reference B picture or there is */
 2566|       |        /* no user for reference B picture                            */
 2567|       |        /**************************************************************/
 2568|  3.90k|        if(i4_skip_b_pic)
  ------------------
  |  Branch (2568:12): [True: 0, False: 3.90k]
  ------------------
 2569|      0|        {
 2570|      0|            ps_dec->ps_cur_pic->u4_pack_slc_typ |= B_SLC_BIT;
  ------------------
  |  |  378|      0|#define B_SLC_BIT  (0x4)
  ------------------
 2571|       |            /* Don't decode the picture in SKIP-B mode if that picture is B */
 2572|       |            /* and also it is not to be used as a reference picture         */
 2573|      0|            ps_dec->u1_last_pic_not_decoded = 1;
 2574|       |
 2575|      0|            return OK;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
 2576|      0|        }
 2577|       |        /**************************************************************/
 2578|       |        /* Skip the P picture if skip mask is set for P picture and   */
 2579|       |        /* Current P picture is a non reference P picture or there is */
 2580|       |        /* no user for reference P picture                            */
 2581|       |        /**************************************************************/
 2582|  3.90k|        if(i4_skip_p_pic)
  ------------------
  |  Branch (2582:12): [True: 0, False: 3.90k]
  ------------------
 2583|      0|        {
 2584|      0|            ps_dec->ps_cur_pic->u4_pack_slc_typ |= P_SLC_BIT;
  ------------------
  |  |  377|      0|#define P_SLC_BIT  (0x2)
  ------------------
 2585|       |            /* Don't decode the picture in SKIP-P mode if that picture is P */
 2586|       |            /* and also it is not to be used as a reference picture         */
 2587|      0|            ps_dec->u1_last_pic_not_decoded = 1;
 2588|       |
 2589|      0|            return OK;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
 2590|      0|        }
 2591|  3.90k|    }
 2592|       |
 2593|  3.90k|    {
 2594|  3.90k|        UWORD16 u2_mb_x, u2_mb_y;
 2595|       |
 2596|  3.90k|        ps_dec->i4_submb_ofst =
 2597|  3.90k|            ((u2_first_mb_in_slice << ps_cur_slice->u1_mbaff_frame_flag) * SUB_BLK_SIZE) -
  ------------------
  |  |  562|  3.90k|#define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|  3.90k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  |  |               #define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|  3.90k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  ------------------
 2598|  3.90k|            SUB_BLK_SIZE;
  ------------------
  |  |  562|  3.90k|#define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|  3.90k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  |  |               #define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|  3.90k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  ------------------
 2599|  3.90k|        if(u2_first_mb_in_slice)
  ------------------
  |  Branch (2599:12): [True: 530, False: 3.37k]
  ------------------
 2600|    530|        {
 2601|    530|            UWORD8 u1_mb_aff;
 2602|    530|            UWORD8 u1_field_pic;
 2603|    530|            UWORD16 u2_frm_wd_in_mbs;
 2604|    530|            u2_frm_wd_in_mbs = ps_seq->u2_frm_wd_in_mbs;
 2605|    530|            u1_mb_aff = ps_cur_slice->u1_mbaff_frame_flag;
 2606|    530|            u1_field_pic = ps_cur_slice->u1_field_pic_flag;
 2607|       |
 2608|    530|            {
 2609|    530|                UWORD32 x_offset;
 2610|    530|                UWORD32 y_offset;
 2611|    530|                UWORD32 u4_frame_stride;
 2612|    530|                tfr_ctxt_t *ps_trns_addr;
 2613|       |
 2614|    530|                if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (2614:20): [True: 83, False: 447]
  ------------------
 2615|     83|                {
 2616|     83|                    ps_trns_addr = &ps_dec->s_tran_addrecon_parse;
 2617|     83|                }
 2618|    447|                else
 2619|    447|                {
 2620|    447|                    ps_trns_addr = &ps_dec->s_tran_addrecon;
 2621|    447|                }
 2622|    530|                u2_mb_x = MOD(u2_first_mb_in_slice, u2_frm_wd_in_mbs);
  ------------------
  |  |   64|    530|#define MOD(x,y) ((x)%(y))
  ------------------
 2623|    530|                u2_mb_y = DIV(u2_first_mb_in_slice, u2_frm_wd_in_mbs);
  ------------------
  |  |   65|    530|#define DIV(x,y) ((x)/(y))
  ------------------
 2624|       |
 2625|    530|                u2_mb_y <<= u1_mb_aff;
 2626|       |
 2627|    530|                if((u2_mb_x > u2_frm_wd_in_mbs - 1) || (u2_mb_y > ps_dec->u2_frm_ht_in_mbs - 1))
  ------------------
  |  Branch (2627:20): [True: 0, False: 530]
  |  Branch (2627:56): [True: 0, False: 530]
  ------------------
 2628|      0|                {
 2629|      0|                    return ERROR_CORRUPTED_SLICE;
 2630|      0|                }
 2631|       |
 2632|    530|                u4_frame_stride = ps_dec->u2_frm_wd_y << u1_field_pic;
 2633|    530|                x_offset = u2_mb_x << 4;
 2634|    530|                y_offset = (u2_mb_y * u4_frame_stride) << 4;
 2635|       |
 2636|    530|                ps_trns_addr->pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1 + x_offset + y_offset;
 2637|       |
 2638|    530|                u4_frame_stride = ps_dec->u2_frm_wd_uv << u1_field_pic;
 2639|    530|                x_offset >>= 1;
 2640|    530|                y_offset = (u2_mb_y * u4_frame_stride) << 3;
 2641|       |
 2642|    530|                x_offset *= YUV420SP_FACTOR;
  ------------------
  |  |  119|    530|#define YUV420SP_FACTOR 2
  ------------------
 2643|       |
 2644|    530|                ps_trns_addr->pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2 + x_offset + y_offset;
 2645|    530|                ps_trns_addr->pu1_dest_v = ps_dec->s_cur_pic.pu1_buf3 + x_offset + y_offset;
 2646|       |
 2647|    530|                ps_trns_addr->pu1_mb_y = ps_trns_addr->pu1_dest_y;
 2648|    530|                ps_trns_addr->pu1_mb_u = ps_trns_addr->pu1_dest_u;
 2649|    530|                ps_trns_addr->pu1_mb_v = ps_trns_addr->pu1_dest_v;
 2650|       |
 2651|       |                /* assign the deblock structure pointers to start of slice */
 2652|    530|                if(ps_dec->u1_separate_parse == 1)
  ------------------
  |  Branch (2652:20): [True: 83, False: 447]
  ------------------
 2653|     83|                {
 2654|     83|                    ps_dec->ps_deblk_mbn =
 2655|     83|                        ps_dec->ps_deblk_pic + (u2_first_mb_in_slice << u1_mb_aff);
 2656|     83|                }
 2657|    447|                else
 2658|    447|                {
 2659|    447|                    ps_dec->ps_deblk_mbn =
 2660|    447|                        ps_dec->ps_deblk_pic + (u2_first_mb_in_slice << u1_mb_aff);
 2661|    447|                }
 2662|       |
 2663|    530|                ps_dec->u4_cur_mb_addr = (u2_first_mb_in_slice << u1_mb_aff);
 2664|       |
 2665|    530|                ps_dec->ps_mv_cur =
 2666|    530|                    ps_dec->s_cur_pic.ps_mv + ((u2_first_mb_in_slice << u1_mb_aff) << 4);
 2667|    530|            }
 2668|    530|        }
 2669|  3.37k|        else
 2670|  3.37k|        {
 2671|  3.37k|            tfr_ctxt_t *ps_trns_addr;
 2672|       |
 2673|  3.37k|            if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (2673:16): [True: 451, False: 2.92k]
  ------------------
 2674|    451|            {
 2675|    451|                ps_trns_addr = &ps_dec->s_tran_addrecon_parse;
 2676|    451|            }
 2677|  2.92k|            else
 2678|  2.92k|            {
 2679|  2.92k|                ps_trns_addr = &ps_dec->s_tran_addrecon;
 2680|  2.92k|            }
 2681|       |
 2682|  3.37k|            u2_mb_x = 0xffff;
 2683|  3.37k|            u2_mb_y = 0;
 2684|       |            // assign the deblock structure pointers to start of slice
 2685|  3.37k|            ps_dec->u4_cur_mb_addr = 0;
 2686|  3.37k|            ps_dec->ps_deblk_mbn = ps_dec->ps_deblk_pic;
 2687|  3.37k|            ps_dec->ps_mv_cur = ps_dec->s_cur_pic.ps_mv;
 2688|  3.37k|            ps_trns_addr->pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1;
 2689|  3.37k|            ps_trns_addr->pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2;
 2690|  3.37k|            ps_trns_addr->pu1_dest_v = ps_dec->s_cur_pic.pu1_buf3;
 2691|       |
 2692|  3.37k|            ps_trns_addr->pu1_mb_y = ps_trns_addr->pu1_dest_y;
 2693|  3.37k|            ps_trns_addr->pu1_mb_u = ps_trns_addr->pu1_dest_u;
 2694|  3.37k|            ps_trns_addr->pu1_mb_v = ps_trns_addr->pu1_dest_v;
 2695|  3.37k|        }
 2696|       |
 2697|  3.90k|        ps_dec->ps_part = ps_dec->ps_parse_part_params;
 2698|       |
 2699|  3.90k|        ps_dec->u2_mbx = (MOD(u2_first_mb_in_slice - 1, ps_seq->u2_frm_wd_in_mbs));
  ------------------
  |  |   64|  3.90k|#define MOD(x,y) ((x)%(y))
  ------------------
 2700|  3.90k|        ps_dec->u2_mby = (DIV(u2_first_mb_in_slice - 1, ps_seq->u2_frm_wd_in_mbs));
  ------------------
  |  |   65|  3.90k|#define DIV(x,y) ((x)/(y))
  ------------------
 2701|  3.90k|        ps_dec->u2_mby <<= ps_cur_slice->u1_mbaff_frame_flag;
 2702|  3.90k|        ps_dec->i2_prev_slice_mbx = (WORD16) ps_dec->u2_mbx;
 2703|  3.90k|        ps_dec->i2_prev_slice_mby = (WORD16) ps_dec->u2_mby;
 2704|  3.90k|    }
 2705|       |
 2706|       |    /* RBSP stop bit is used for CABAC decoding*/
 2707|      0|    ps_bitstrm->u4_max_ofst += ps_dec->ps_cur_pps->u1_entropy_coding_mode;
 2708|       |
 2709|  3.90k|    ps_dec->u1_B = (u1_slice_type == B_SLICE);
  ------------------
  |  |  369|  3.90k|#define B_SLICE  1
  ------------------
 2710|  3.90k|    ps_dec->u4_next_mb_skip = 0;
 2711|       |
 2712|  3.90k|    ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice = ps_dec->ps_cur_slice->u2_first_mb_in_slice;
 2713|  3.90k|    ps_dec->ps_parse_cur_slice->slice_type = ps_dec->ps_cur_slice->u1_slice_type;
 2714|       |
 2715|  3.90k|    ps_dec->u4_start_recon_deblk = 1;
 2716|  3.90k|    {
 2717|  3.90k|        WORD32 num_entries;
 2718|  3.90k|        WORD32 size;
 2719|  3.90k|        UWORD8 *pu1_buf;
 2720|       |
 2721|  3.90k|        num_entries = MAX_FRAMES;
  ------------------
  |  |  600|  3.90k|#define MAX_FRAMES              16
  ------------------
 2722|  3.90k|        if((1 >= ps_dec->ps_cur_sps->u1_num_ref_frames) && (0 == ps_dec->i4_display_delay))
  ------------------
  |  Branch (2722:12): [True: 2.84k, False: 1.05k]
  |  Branch (2722:60): [True: 0, False: 2.84k]
  ------------------
 2723|      0|        {
 2724|      0|            num_entries = 1;
 2725|      0|        }
 2726|  3.90k|        num_entries = ((2 * num_entries) + 1);
 2727|  3.90k|        num_entries *= 2;
 2728|       |
 2729|  3.90k|        size = num_entries * sizeof(void *);
 2730|  3.90k|        size += PAD_MAP_IDX_POC * sizeof(void *);
  ------------------
  |  |  100|  3.90k|#define PAD_MAP_IDX_POC             (1)
  ------------------
 2731|       |
 2732|  3.90k|        pu1_buf = (UWORD8 *) ps_dec->pv_map_ref_idx_to_poc_buf;
 2733|  3.90k|        pu1_buf += size * ps_dec->u2_cur_slice_num;
 2734|  3.90k|        ps_dec->ps_parse_cur_slice->ppv_map_ref_idx_to_poc = (void *) pu1_buf;
 2735|  3.90k|    }
 2736|       |
 2737|  3.90k|    if(ps_dec->u1_separate_parse)
  ------------------
  |  Branch (2737:8): [True: 534, False: 3.36k]
  ------------------
 2738|    534|    {
 2739|    534|        ps_dec->ps_parse_cur_slice->pv_tu_coeff_data_start = ps_dec->pv_parse_tu_coeff_data;
 2740|    534|    }
 2741|  3.36k|    else
 2742|  3.36k|    {
 2743|  3.36k|        ps_dec->pv_proc_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data;
 2744|  3.36k|    }
 2745|       |
 2746|  3.90k|    ret = ih264d_fix_error_in_dpb(ps_dec);
 2747|  3.90k|    if(ret < 0) return ERROR_DBP_MANAGER_T;
  ------------------
  |  Branch (2747:8): [True: 0, False: 3.90k]
  ------------------
 2748|       |
 2749|  3.90k|    if(u1_slice_type == I_SLICE)
  ------------------
  |  |  370|  3.90k|#define I_SLICE  2
  ------------------
  |  Branch (2749:8): [True: 821, False: 3.08k]
  ------------------
 2750|    821|    {
 2751|    821|        ps_dec->ps_cur_pic->u4_pack_slc_typ |= I_SLC_BIT;
  ------------------
  |  |  376|    821|#define I_SLC_BIT  (0x1)
  ------------------
 2752|       |
 2753|    821|        ret = isvcd_parse_islice(ps_svc_lyr_dec, u2_first_mb_in_slice);
 2754|    821|        ps_dec->u1_pr_sl_type = u1_slice_type;
 2755|    821|        if(ps_dec->i4_pic_type != B_SLICE && ps_dec->i4_pic_type != P_SLICE)
  ------------------
  |  |  369|  1.64k|#define B_SLICE  1
  ------------------
                      if(ps_dec->i4_pic_type != B_SLICE && ps_dec->i4_pic_type != P_SLICE)
  ------------------
  |  |  368|    821|#define P_SLICE  0
  ------------------
  |  Branch (2755:12): [True: 821, False: 0]
  |  Branch (2755:46): [True: 821, False: 0]
  ------------------
 2756|    821|            ps_dec->i4_pic_type = I_SLICE;
  ------------------
  |  |  370|    821|#define I_SLICE  2
  ------------------
 2757|    821|    }
 2758|  3.08k|    else if(u1_slice_type == P_SLICE)
  ------------------
  |  |  368|  3.08k|#define P_SLICE  0
  ------------------
  |  Branch (2758:13): [True: 1.67k, False: 1.40k]
  ------------------
 2759|  1.67k|    {
 2760|  1.67k|        ps_dec->ps_cur_pic->u4_pack_slc_typ |= P_SLC_BIT;
  ------------------
  |  |  377|  1.67k|#define P_SLC_BIT  (0x2)
  ------------------
 2761|  1.67k|        ret = isvcd_parse_pslice(ps_svc_lyr_dec, u2_first_mb_in_slice);
 2762|  1.67k|        ps_dec->u1_pr_sl_type = u1_slice_type;
 2763|  1.67k|        if(ps_dec->i4_pic_type != B_SLICE) ps_dec->i4_pic_type = P_SLICE;
  ------------------
  |  |  369|  1.67k|#define B_SLICE  1
  ------------------
                      if(ps_dec->i4_pic_type != B_SLICE) ps_dec->i4_pic_type = P_SLICE;
  ------------------
  |  |  368|  1.67k|#define P_SLICE  0
  ------------------
  |  Branch (2763:12): [True: 1.67k, False: 0]
  ------------------
 2764|  1.67k|    }
 2765|  1.40k|    else if(u1_slice_type == B_SLICE)
  ------------------
  |  |  369|  1.40k|#define B_SLICE  1
  ------------------
  |  Branch (2765:13): [True: 1.40k, False: 0]
  ------------------
 2766|  1.40k|    {
 2767|  1.40k|        ps_dec->ps_cur_pic->u4_pack_slc_typ |= B_SLC_BIT;
  ------------------
  |  |  378|  1.40k|#define B_SLC_BIT  (0x4)
  ------------------
 2768|  1.40k|        ret = isvcd_parse_bslice(ps_svc_lyr_dec, u2_first_mb_in_slice);
 2769|  1.40k|        ps_dec->u1_pr_sl_type = u1_slice_type;
 2770|  1.40k|        ps_dec->i4_pic_type = B_SLICE;
  ------------------
  |  |  369|  1.40k|#define B_SLICE  1
  ------------------
 2771|  1.40k|    }
 2772|      0|    else
 2773|      0|        return ERROR_INV_SLC_TYPE_T;
 2774|       |
 2775|  3.90k|    if(ps_dec->u1_slice_header_done)
  ------------------
  |  Branch (2775:8): [True: 3.48k, False: 421]
  ------------------
 2776|  3.48k|    {
 2777|       |        /* set to zero to indicate a valid slice has been decoded */
 2778|  3.48k|        ps_dec->u1_first_slice_in_stream = 0;
 2779|  3.48k|    }
 2780|       |
 2781|  3.90k|    if(ret != OK) return ret;
  ------------------
  |  |  114|  3.90k|#define OK        0
  ------------------
  |  Branch (2781:8): [True: 1.96k, False: 1.94k]
  ------------------
 2782|       |
 2783|  1.94k|    if(u1_nal_ref_idc != 0)
  ------------------
  |  Branch (2783:8): [True: 1.27k, False: 661]
  ------------------
 2784|  1.27k|    {
 2785|  1.27k|        if(!ps_dec->ps_dpb_cmds->u1_dpb_commands_read)
  ------------------
  |  Branch (2785:12): [True: 1.27k, False: 0]
  ------------------
 2786|  1.27k|        {
 2787|  1.27k|            memcpy((void *) ps_dec->ps_dpb_cmds, (void *) (&(ps_dec->s_dpb_cmds_scratch)),
 2788|  1.27k|                   sizeof(dpb_commands_t));
 2789|  1.27k|        }
 2790|  1.27k|    }
 2791|       |
 2792|       |    /* storing last Mb X and MbY of the slice */
 2793|  1.94k|    ps_dec->i2_prev_slice_mbx = ps_dec->u2_mbx;
 2794|  1.94k|    ps_dec->i2_prev_slice_mby = ps_dec->u2_mby;
 2795|       |
 2796|       |    /* End of Picture detection */
 2797|       |
 2798|  1.94k|    if(ps_dec->u4_total_mbs_coded >= (ps_seq->u4_max_mb_addr + 1))
  ------------------
  |  Branch (2798:8): [True: 1.13k, False: 810]
  ------------------
 2799|  1.13k|    {
 2800|  1.13k|        ps_dec->u1_pic_decode_done = 1;
 2801|  1.13k|    }
 2802|       |
 2803|  1.94k|    {
 2804|  1.94k|        dec_err_status_t *ps_err = ps_dec->ps_dec_err_status;
 2805|  1.94k|        if((ps_err->u1_err_flag & REJECT_PB_PICS) && (ps_err->u1_cur_pic_type == PIC_TYPE_I))
  ------------------
  |  |  602|  1.94k|#define REJECT_PB_PICS    (0x02)
  ------------------
                      if((ps_err->u1_err_flag & REJECT_PB_PICS) && (ps_err->u1_cur_pic_type == PIC_TYPE_I))
  ------------------
  |  |  608|      0|#define PIC_TYPE_I        (0x00)
  ------------------
  |  Branch (2805:12): [True: 0, False: 1.94k]
  |  Branch (2805:54): [True: 0, False: 0]
  ------------------
 2806|      0|        {
 2807|      0|            ps_err->u1_err_flag = ACCEPT_ALL_PICS;
  ------------------
  |  |  600|      0|#define ACCEPT_ALL_PICS   (0x00)
  ------------------
 2808|      0|        }
 2809|  1.94k|    }
 2810|       |
 2811|  1.94k|    PRINT_BIN_BIT_RATIO(ps_dec)
 2812|       |
 2813|  1.94k|    return ret;
 2814|  3.90k|}

isvcd_pred_residual_recon_chroma_8x8:
   88|  6.46k|{
   89|  6.46k|    UWORD8 *pu1_pred_ptr = pu1_pred;
   90|  6.46k|    WORD16 *pi2_rsd_ptr = pi2_rsd;
   91|  6.46k|    UWORD8 *pu1_out_ptr = pu1_out;
   92|  6.46k|    WORD16 i, j;
   93|  6.46k|    WORD16 i_macro;
   94|       |
   95|  58.1k|    for(i = 0; i < 8; i++)
  ------------------
  |  Branch (95:16): [True: 51.6k, False: 6.46k]
  ------------------
   96|  51.6k|    {
   97|  51.6k|        pu1_pred_ptr = pu1_pred;
   98|  51.6k|        pi2_rsd_ptr = pi2_rsd;
   99|  51.6k|        pu1_out = pu1_out_ptr;
  100|       |
  101|   465k|        for(j = 0; j < 8; j++)
  ------------------
  |  Branch (101:20): [True: 413k, False: 51.6k]
  ------------------
  102|   413k|        {
  103|   413k|            i_macro = *pu1_pred_ptr + *pi2_rsd_ptr;
  104|   413k|            *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   413k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   413k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 2.67k, False: 410k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 410k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  105|   413k|            pu1_pred_ptr += pred_strd;
  106|   413k|            pi2_rsd_ptr += rsd_strd;
  107|   413k|            pu1_out += out_strd;
  108|   413k|        }
  109|       |
  110|  51.6k|        pu1_out_ptr += 2;  // Interleaved store for output
  111|  51.6k|        pu1_pred += 2;     // Interleaved load for pred buffer
  112|  51.6k|        pi2_rsd += 2;
  113|  51.6k|    }
  114|  6.46k|}
isvcd_pred_residual_recon_chroma_4x4:
  190|  7.07k|{
  191|  7.07k|    UWORD8 *pu1_pred_ptr = pu1_pred;
  192|  7.07k|    WORD16 *pi2_rsd_ptr = pi2_rsd;
  193|  7.07k|    UWORD8 *pu1_out_ptr = pu1_out;
  194|  7.07k|    WORD16 i, j;
  195|  7.07k|    WORD16 i_macro;
  196|       |
  197|  35.3k|    for(i = 0; i < 4; i++)
  ------------------
  |  Branch (197:16): [True: 28.2k, False: 7.07k]
  ------------------
  198|  28.2k|    {
  199|  28.2k|        pu1_pred_ptr = pu1_pred;
  200|  28.2k|        pi2_rsd_ptr = pi2_rsd;
  201|  28.2k|        pu1_out = pu1_out_ptr;
  202|       |
  203|   141k|        for(j = 0; j < 4; j++)
  ------------------
  |  Branch (203:20): [True: 113k, False: 28.2k]
  ------------------
  204|   113k|        {
  205|   113k|            i_macro = *pu1_pred_ptr + *pi2_rsd_ptr;
  206|   113k|            *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   113k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   113k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 113k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 113k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  207|   113k|            pu1_pred_ptr += pred_strd;
  208|   113k|            pi2_rsd_ptr += rsd_strd;
  209|   113k|            pu1_out += out_strd;
  210|   113k|        }
  211|       |
  212|  28.2k|        pu1_out_ptr += 2;  // Interleaved store for output
  213|  28.2k|        pu1_pred += 2;     // Interleaved load for pred buffer
  214|  28.2k|        pi2_rsd += 2;
  215|  28.2k|    }
  216|  7.07k|}
isvcd_pred_residual_recon_16x16:
  242|    423|{
  243|    423|    WORD32 i4_nnz = 0, i4_nnz_blk[4][4] = {0};
  244|    423|    UWORD8 *pu1_pred_ptr = pu1_pred;
  245|    423|    WORD16 *pi2_rsd_ptr = pi2_rsd;
  246|    423|    UWORD8 *pu1_out_ptr = pu1_out;
  247|    423|    WORD16 i, j;
  248|    423|    WORD16 i_macro;
  249|       |
  250|  7.19k|    for(i = 0; i < 16; i++)
  ------------------
  |  Branch (250:16): [True: 6.76k, False: 423]
  ------------------
  251|  6.76k|    {
  252|  6.76k|        pu1_pred_ptr = pu1_pred;
  253|  6.76k|        pi2_rsd_ptr = pi2_rsd;
  254|  6.76k|        pu1_out = pu1_out_ptr;
  255|       |
  256|   115k|        for(j = 0; j < 16; j++)
  ------------------
  |  Branch (256:20): [True: 108k, False: 6.76k]
  ------------------
  257|   108k|        {
  258|   108k|            i_macro = *pi2_rsd_ptr;
  259|   108k|            i4_nnz_blk[j >> 2][i >> 2] |= !!i_macro;
  260|   108k|            i_macro += *pu1_pred_ptr;
  261|   108k|            *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   108k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   108k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 1.36k, False: 106k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 106k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  262|   108k|            pu1_pred_ptr += pred_strd;
  263|   108k|            pi2_rsd_ptr += rsd_strd;
  264|   108k|            pu1_out += out_strd;
  265|   108k|        }
  266|       |
  267|  6.76k|        pu1_out_ptr++;
  268|  6.76k|        pi2_rsd++;
  269|  6.76k|        pu1_pred++;
  270|  6.76k|    }
  271|       |
  272|  2.11k|    for(i = 0; i < 4; i++)
  ------------------
  |  Branch (272:16): [True: 1.69k, False: 423]
  ------------------
  273|  1.69k|    {
  274|  8.46k|        for(j = 0; j < 4; j++)
  ------------------
  |  Branch (274:20): [True: 6.76k, False: 1.69k]
  ------------------
  275|  6.76k|        {
  276|  6.76k|            i4_nnz |= (i4_nnz_blk[j][i]) << (i + (j << 2));
  277|  6.76k|        }
  278|  1.69k|    }
  279|       |
  280|    423|    return i4_nnz;
  281|    423|}
isvcd_pred_residual_recon_4x4:
  307|  14.0k|{
  308|  14.0k|    WORD32 i4_nnz_blk[4][4] = {0};
  309|  14.0k|    UWORD8 *pu1_pred_ptr = pu1_pred;
  310|  14.0k|    WORD16 *pi2_rsd_ptr = pi2_rsd;
  311|  14.0k|    UWORD8 *pu1_out_ptr = pu1_out;
  312|  14.0k|    WORD16 i, j;
  313|  14.0k|    WORD16 i_macro;
  314|       |
  315|  70.0k|    for(i = 0; i < 4; i++)
  ------------------
  |  Branch (315:16): [True: 56.0k, False: 14.0k]
  ------------------
  316|  56.0k|    {
  317|  56.0k|        pu1_pred_ptr = pu1_pred;
  318|  56.0k|        pi2_rsd_ptr = pi2_rsd;
  319|  56.0k|        pu1_out = pu1_out_ptr;
  320|       |
  321|   280k|        for(j = 0; j < 4; j++)
  ------------------
  |  Branch (321:20): [True: 224k, False: 56.0k]
  ------------------
  322|   224k|        {
  323|   224k|            i_macro = *pi2_rsd_ptr;
  324|   224k|            i4_nnz_blk[j >> 2][i >> 2] |= !!i_macro;
  325|   224k|            i_macro += *pu1_pred_ptr;
  326|   224k|            *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|   224k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|   224k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 8.37k, False: 215k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 215k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  327|   224k|            pu1_pred_ptr += pred_strd;
  328|   224k|            pi2_rsd_ptr += rsd_strd;
  329|   224k|            pu1_out += out_strd;
  330|   224k|        }
  331|       |
  332|  56.0k|        pu1_out_ptr++;
  333|  56.0k|        pi2_rsd++;
  334|  56.0k|        pu1_pred++;
  335|  56.0k|    }
  336|       |
  337|  14.0k|    return i4_nnz_blk[0][0];
  338|  14.0k|}
isvcd_pred_residual_recon_8x8:
  364|  1.33k|{
  365|  1.33k|    WORD32 i4_nnz = 0, i4_nnz_blk[4][4] = {0};
  366|  1.33k|    UWORD8 *pu1_pred_ptr = pu1_pred;
  367|  1.33k|    WORD16 *pi2_rsd_ptr = pi2_rsd;
  368|  1.33k|    UWORD8 *pu1_out_ptr = pu1_out;
  369|  1.33k|    WORD16 i, j;
  370|  1.33k|    WORD16 i_macro;
  371|       |
  372|  12.0k|    for(i = 0; i < 8; i++)
  ------------------
  |  Branch (372:16): [True: 10.6k, False: 1.33k]
  ------------------
  373|  10.6k|    {
  374|  10.6k|        pu1_pred_ptr = pu1_pred;
  375|  10.6k|        pi2_rsd_ptr = pi2_rsd;
  376|  10.6k|        pu1_out = pu1_out_ptr;
  377|       |
  378|  96.1k|        for(j = 0; j < 8; j++)
  ------------------
  |  Branch (378:20): [True: 85.4k, False: 10.6k]
  ------------------
  379|  85.4k|        {
  380|  85.4k|            i_macro = *pi2_rsd_ptr;
  381|  85.4k|            i4_nnz_blk[j >> 2][i >> 2] |= !!i_macro;
  382|  85.4k|            i_macro += *pu1_pred_ptr;
  383|  85.4k|            *pu1_out = CLIP_U8(i_macro);
  ------------------
  |  |   58|  85.4k|#define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x))
  |  |  ------------------
  |  |  |  |   77|  85.4k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:31): [True: 0, False: 85.4k]
  |  |  |  |  |  Branch (77:54): [True: 0, False: 85.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  384|  85.4k|            pu1_pred_ptr += pred_strd;
  385|  85.4k|            pi2_rsd_ptr += rsd_strd;
  386|  85.4k|            pu1_out += out_strd;
  387|  85.4k|        }
  388|       |
  389|  10.6k|        pu1_out_ptr++;
  390|  10.6k|        pi2_rsd++;
  391|  10.6k|        pu1_pred++;
  392|  10.6k|    }
  393|       |
  394|  1.33k|    i4_nnz = i4_nnz_blk[0][0] | (i4_nnz_blk[1][0] << 4);
  395|  1.33k|    i4_nnz |= (i4_nnz_blk[0][1] << 1) | (i4_nnz_blk[1][1] << 5);
  396|       |
  397|  1.33k|    return i4_nnz;
  398|  1.33k|}

isvcd_one_to_one:
   72|    323|{
   73|    323|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
   74|    323|    UWORD8 *pu1_col_zero_flag_start, u1_col_mb_pred_mode, u1_num_blks, u1_sub_mb_num;
   75|    323|    UWORD8 u1_init_colzero_flag;
   76|    323|    UNUSED(ps_cur_mb_info);
  ------------------
  |  |   45|    323|#define UNUSED(x) ((void)(x))
  ------------------
   77|    323|    pu1_col_zero_flag_start = ps_col_pic->pu1_col_zero_flag + u2_sub_mb_ofst;
   78|    323|    u1_col_mb_pred_mode = pu1_col_zero_flag_start[ps_dec->u1_sub_mb_num];
   79|    323|    u1_init_colzero_flag = u1_col_mb_pred_mode & 1;
   80|    323|    u1_col_mb_pred_mode >>= 6;
   81|    323|    ps_direct->u1_vert_mv_scale = ONE_TO_ONE;
  ------------------
  |  |   47|    323|#define ONE_TO_ONE    0
  ------------------
   82|    323|    ps_direct->u1_col_zeroflag_change = (ps_svc_lyr_dec->u1_base_res_flag) ? 0 : 1;
  ------------------
  |  Branch (82:41): [True: 0, False: 323]
  ------------------
   83|       |
   84|    323|    if(u1_wd_x == MB_SIZE)
  ------------------
  |  |  554|    323|#define MB_SIZE             16
  ------------------
  |  Branch (84:8): [True: 313, False: 10]
  ------------------
   85|    313|    {
   86|    313|        ps_dec->u1_currB_type = (!!u1_col_mb_pred_mode);
   87|    313|        if(u1_col_mb_pred_mode == PRED_16x16)
  ------------------
  |  |  450|    313|#define PRED_16x16  0
  ------------------
  |  Branch (87:12): [True: 292, False: 21]
  ------------------
   88|    292|        {
   89|    292|            ps_direct->i1_num_partitions = 1;
   90|    292|            ps_direct->i4_mv_indices[0] = u2_sub_mb_ofst;
   91|    292|            ps_direct->i1_submb_num[0] = 0;
   92|    292|            ps_direct->i1_partitionsize[0] = PRED_16x16;
  ------------------
  |  |  450|    292|#define PRED_16x16  0
  ------------------
   93|       |
   94|    292|            return;
   95|    292|        }
   96|     21|        else if(u1_col_mb_pred_mode < PRED_8x8)
  ------------------
  |  |  453|     21|#define PRED_8x8    3
  ------------------
  |  Branch (96:17): [True: 9, False: 12]
  ------------------
   97|      9|        {
   98|      9|            ps_direct->i1_num_partitions = 2;
   99|      9|            ps_direct->i4_mv_indices[0] = u2_sub_mb_ofst;
  100|      9|            ps_direct->i1_submb_num[0] = 0;
  101|      9|            ps_direct->i1_partitionsize[0] = u1_col_mb_pred_mode;
  102|      9|            u1_sub_mb_num = (u1_col_mb_pred_mode == PRED_16x8) ? 8 : 2;
  ------------------
  |  |  451|      9|#define PRED_16x8   1
  ------------------
  |  Branch (102:29): [True: 0, False: 9]
  ------------------
  103|      9|            ps_direct->i1_submb_num[1] = u1_sub_mb_num;
  104|      9|            ps_direct->i4_mv_indices[1] = u2_sub_mb_ofst + ps_direct->i1_submb_num[1];
  105|      9|            ps_direct->i1_partitionsize[1] = u1_col_mb_pred_mode;
  106|      9|            if((pu1_col_zero_flag_start[u1_sub_mb_num] & 1) != u1_init_colzero_flag)
  ------------------
  |  Branch (106:16): [True: 0, False: 9]
  ------------------
  107|      0|                ps_direct->u1_col_zeroflag_change = 1;
  108|      9|            return;
  109|      9|        }
  110|     12|        else
  111|     12|        {
  112|     12|            u1_num_blks = 4;
  113|     12|        }
  114|    313|    }
  115|     10|    else
  116|     10|    {
  117|     10|        u1_num_blks = 1;
  118|     10|    }
  119|       |
  120|     22|    {
  121|     22|        const UWORD8 *pu1_top_lt_mb_part_idx;
  122|     22|        UWORD8 u1_col_sub_mb_pred_mode, uc_blk, u1_sub_blk, u1_submb_col = 0;
  123|     22|        UWORD8 u1_num_sub_blks, uc_direct8x8inf, *pu1_col_zero_flag, u1_sub_mb_num;
  124|     22|        const UWORD8 *pu1_num_sub_mb_part = (const UWORD8 *) gau1_ih264d_num_submb_part;
  125|     22|        UWORD8 i1_num_partitions = 0, partition_size;
  126|     22|        WORD32 mv_index;
  127|     22|        const UWORD8 *pu1_top_lt_sub_mb_idx = gau1_ih264d_submb_indx_mod_sp_drct;
  128|       |
  129|     22|        u1_sub_mb_num = ps_dec->u1_sub_mb_num;
  130|     22|        uc_direct8x8inf = ps_dec->ps_cur_slice->u1_direct_8x8_inference_flag;
  131|     22|        pu1_top_lt_mb_part_idx = gau1_ih264d_top_left_mb_part_indx_mod + (PRED_8x8 << 1) + 1;
  ------------------
  |  |  453|     22|#define PRED_8x8    3
  ------------------
  132|       |
  133|     80|        for(uc_blk = 0; uc_blk < u1_num_blks; uc_blk++)
  ------------------
  |  Branch (133:25): [True: 58, False: 22]
  ------------------
  134|     58|        {
  135|     58|            partition_size = PRED_8x8;
  ------------------
  |  |  453|     58|#define PRED_8x8    3
  ------------------
  136|     58|            pu1_top_lt_sub_mb_idx = gau1_ih264d_submb_indx_mod_sp_drct;
  137|     58|            if(uc_direct8x8inf == 1)
  ------------------
  |  Branch (137:16): [True: 2, False: 56]
  ------------------
  138|      2|            {
  139|      2|                u1_submb_col = u1_sub_mb_num | (u1_sub_mb_num >> 1);
  140|      2|                mv_index = u2_sub_mb_ofst + u1_submb_col;
  141|      2|                u1_num_sub_blks = 1;
  142|      2|            }
  143|     56|            else
  144|     56|            {
  145|       |                /* colMbPart is either 8x8, 8x4, 4x8, 4x4 */
  146|     56|                pu1_col_zero_flag = pu1_col_zero_flag_start + u1_sub_mb_num;
  147|     56|                u1_col_sub_mb_pred_mode = *pu1_col_zero_flag;
  148|     56|                u1_col_sub_mb_pred_mode = (u1_col_sub_mb_pred_mode & 0x30) >> 4;
  149|     56|                partition_size = (UWORD8) ((u1_col_sub_mb_pred_mode) | (PRED_8x8 << 2));
  ------------------
  |  |  453|     56|#define PRED_8x8    3
  ------------------
  150|     56|                mv_index = u2_sub_mb_ofst + u1_sub_mb_num;
  151|     56|                pu1_top_lt_sub_mb_idx += (u1_col_sub_mb_pred_mode << 1);
  152|     56|                u1_num_sub_blks = pu1_num_sub_mb_part[u1_col_sub_mb_pred_mode];
  153|     56|            }
  154|       |
  155|    212|            for(u1_sub_blk = 0; u1_sub_blk < u1_num_sub_blks; u1_sub_blk++, pu1_top_lt_sub_mb_idx++)
  ------------------
  |  Branch (155:33): [True: 154, False: 58]
  ------------------
  156|    154|            {
  157|    154|                u1_sub_mb_num += *pu1_top_lt_sub_mb_idx;
  158|    154|                mv_index += *pu1_top_lt_sub_mb_idx;
  159|    154|                ps_direct->i4_mv_indices[i1_num_partitions] = mv_index;
  160|    154|                ps_direct->i1_submb_num[i1_num_partitions] = u1_sub_mb_num;
  161|    154|                ps_direct->i1_partitionsize[i1_num_partitions] = partition_size;
  162|    154|                i1_num_partitions++;
  163|    154|                if(!uc_direct8x8inf) u1_submb_col = u1_sub_mb_num;
  ------------------
  |  Branch (163:20): [True: 152, False: 2]
  ------------------
  164|    154|                if((pu1_col_zero_flag_start[u1_submb_col] & 1) != u1_init_colzero_flag)
  ------------------
  |  Branch (164:20): [True: 0, False: 154]
  ------------------
  165|      0|                    ps_direct->u1_col_zeroflag_change = 1;
  166|    154|            }
  167|     58|            u1_sub_mb_num = *pu1_top_lt_mb_part_idx++;
  168|     58|        }
  169|     22|        ps_direct->i1_num_partitions = i1_num_partitions;
  170|     22|    }
  171|     22|}
isvcd_decode_spatial_direct:
  187|    323|{
  188|    323|    svc_dec_lyr_struct_t *ps_svc_lyr_dec = (svc_dec_lyr_struct_t *) ps_dec;
  189|    323|    mv_pred_t s_mv_pred = {0};
  190|    323|    mv_pred_t *ps_mv;
  191|    323|    UWORD8 u1_col_zero_flag, u1_direct_zero_pred_flag = 0;
  192|    323|    UWORD32 u4_sub_mb_num;
  193|    323|    UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  194|    323|    mv_pred_t *ps_mv_ntop_start;
  195|    323|    mv_pred_t *ps_mv_nmb_start = ps_dec->ps_mv_cur + (u4_mb_num << 4);
  196|    323|    UWORD8 partition_size, sub_partition, u1_mb_partw, u1_mb_parth;
  197|    323|    UWORD8 i;
  198|    323|    WORD8 i1_pred, i1_ref_frame0, i1_ref_frame1;
  199|    323|    struct pic_buffer_t *ps_ref_frame = NULL, *ps_col_pic, *ps_pic_buff0 = NULL,
  200|    323|                        *ps_pic_buff1 = NULL;
  201|       |
  202|    323|    UWORD8 u1_zero_pred_cond_f, u1_zero_pred_cond_b;
  203|    323|    WORD16 i2_spat_pred_mv[4] = {0};
  204|    323|    WORD16 *pi2_final_mv0, *pi2_final_mv1;
  205|    323|    UWORD16 ui2_mask_fwd = 0, ui2_mask_bwd = 0;
  206|    323|    UWORD32 *pui32_weight_ofsts = NULL;
  207|    323|    directmv_t s_mvdirect = {0};
  208|    323|    UWORD8 u1_colz;
  209|    323|    UWORD8 u1_final_ref_idx = 0;
  210|    323|    const UWORD8 *pu1_mb_parth = (const UWORD8 *) gau1_ih264d_mb_parth;
  211|    323|    const UWORD8 *pu1_mb_partw = (const UWORD8 *) gau1_ih264d_mb_partw;
  212|       |
  213|    323|    mv_pred_t s_temp_mv_pred = {0};
  214|    323|    ps_mv_ntop_start =
  215|    323|        ps_dec->ps_mv_cur + (u4_mb_num << 4) - (ps_dec->u2_frm_wd_in_mbs << (4 + u1_mbaff)) + 12;
  216|       |
  217|    323|    u1_direct_zero_pred_flag =
  218|    323|        ps_dec->pf_mvpred(ps_dec, ps_cur_mb_info, (ps_mv_nmb_start + ps_dec->u1_sub_mb_num),
  219|    323|                          ps_mv_ntop_start + (ps_dec->u1_sub_mb_num & 0x03), &s_mv_pred,
  220|    323|                          ps_dec->u1_sub_mb_num, (u1_wd_x >> 2), 0, 1, B_DIRECT_SPATIAL);
  ------------------
  |  |  489|    323|#define B_DIRECT_SPATIAL  26
  ------------------
  221|       |
  222|    323|    i2_spat_pred_mv[0] = s_mv_pred.i2_mv[0];
  223|    323|    i2_spat_pred_mv[1] = s_mv_pred.i2_mv[1];
  224|    323|    i2_spat_pred_mv[2] = s_mv_pred.i2_mv[2];
  225|    323|    i2_spat_pred_mv[3] = s_mv_pred.i2_mv[3];
  226|       |
  227|    323|    i1_ref_frame0 = s_mv_pred.i1_ref_frame[0];
  228|    323|    i1_ref_frame1 = s_mv_pred.i1_ref_frame[1];
  229|       |
  230|    323|    i1_ref_frame0 = (i1_ref_frame0 < 0) ? -1 : i1_ref_frame0;
  ------------------
  |  Branch (230:21): [True: 10, False: 313]
  ------------------
  231|    323|    i1_ref_frame1 = (i1_ref_frame1 < 0) ? -1 : i1_ref_frame1;
  ------------------
  |  Branch (231:21): [True: 9, False: 314]
  ------------------
  232|       |
  233|    323|    i1_pred = 0;
  234|       |
  235|    323|    {
  236|    323|        WORD8 u1_ref_idx, u1_ref_idx1;
  237|    323|        UWORD32 uc_Idx, uc_Idx1;
  238|    323|        UWORD8 u1_scale_ref =
  239|    323|            (ps_dec->ps_cur_slice->u1_mbaff_frame_flag && ps_cur_mb_info->u1_mb_field_decodingflag);
  ------------------
  |  Branch (239:14): [True: 0, False: 323]
  |  Branch (239:59): [True: 0, False: 0]
  ------------------
  240|    323|        u1_final_ref_idx = i1_ref_frame0;
  241|    323|        if(i1_ref_frame0 >= 0)
  ------------------
  |  Branch (241:12): [True: 313, False: 10]
  ------------------
  242|    313|        {
  243|       |            /* convert RefIdx if it is MbAff */
  244|    313|            u1_ref_idx = i1_ref_frame0;
  245|    313|            u1_ref_idx1 = i1_ref_frame0;
  246|    313|            if(u1_scale_ref)
  ------------------
  |  Branch (246:16): [True: 0, False: 313]
  ------------------
  247|      0|            {
  248|      0|                u1_ref_idx1 = u1_ref_idx >> 1;
  249|      0|                if((u1_ref_idx & 0x01) != (1 - ps_cur_mb_info->u1_topmb))
  ------------------
  |  Branch (249:20): [True: 0, False: 0]
  ------------------
  250|      0|                    u1_ref_idx1 += MAX_REF_BUFS;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  251|      0|            }
  252|       |            /* If i1_ref_frame0 < 0 then refIdxCol is obtained from ps_pic_buff1 */
  253|    313|            ps_pic_buff0 = ps_dec->ps_ref_pic_buf_lx[0][u1_ref_idx1];
  254|    313|            ps_ref_frame = ps_pic_buff0;
  255|    313|            i1_pred = PRED_L0;
  ------------------
  |  |  483|    313|#define PRED_L0   1
  ------------------
  256|    313|        }
  257|       |
  258|    323|        if(i1_ref_frame1 >= 0)
  ------------------
  |  Branch (258:12): [True: 314, False: 9]
  ------------------
  259|    314|        {
  260|       |            /* convert RefIdx if it is MbAff */
  261|    314|            u1_ref_idx = i1_ref_frame1;
  262|    314|            u1_ref_idx1 = i1_ref_frame1;
  263|    314|            if(u1_scale_ref)
  ------------------
  |  Branch (263:16): [True: 0, False: 314]
  ------------------
  264|      0|            {
  265|      0|                u1_ref_idx1 = u1_ref_idx >> 1;
  266|      0|                if((u1_ref_idx & 0x01) != (1 - ps_cur_mb_info->u1_topmb))
  ------------------
  |  Branch (266:20): [True: 0, False: 0]
  ------------------
  267|      0|                    u1_ref_idx1 += MAX_REF_BUFS;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  268|      0|            }
  269|    314|            ps_pic_buff1 = ps_dec->ps_ref_pic_buf_lx[1][u1_ref_idx1];
  270|    314|            i1_pred = i1_pred | PRED_L1;
  ------------------
  |  |  484|    314|#define PRED_L1   2
  ------------------
  271|    314|        }
  272|    323|        if(i1_ref_frame0 < 0)
  ------------------
  |  Branch (272:12): [True: 10, False: 313]
  ------------------
  273|     10|        {
  274|     10|            ps_ref_frame = ps_pic_buff1;
  275|     10|            u1_final_ref_idx = i1_ref_frame1;
  276|     10|        }
  277|       |
  278|    323|        u1_zero_pred_cond_f = (u1_direct_zero_pred_flag) || (i1_ref_frame0 < 0);
  ------------------
  |  Branch (278:31): [True: 52, False: 271]
  |  Branch (278:61): [True: 10, False: 261]
  ------------------
  279|    323|        u1_zero_pred_cond_b = (u1_direct_zero_pred_flag) || (i1_ref_frame1 < 0);
  ------------------
  |  Branch (279:31): [True: 52, False: 271]
  |  Branch (279:61): [True: 9, False: 262]
  ------------------
  280|       |
  281|    323|        if(ps_dec->ps_cur_pps->u1_wted_bipred_idc)
  ------------------
  |  Branch (281:12): [True: 202, False: 121]
  ------------------
  282|    202|        {
  283|    202|            uc_Idx = ((i1_ref_frame0 < 1) ? 0 : i1_ref_frame0) *
  ------------------
  |  Branch (283:23): [True: 202, False: 0]
  ------------------
  284|    202|                     ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1];
  285|    202|            if(u1_scale_ref) uc_Idx >>= 1;
  ------------------
  |  Branch (285:16): [True: 0, False: 202]
  ------------------
  286|    202|            uc_Idx1 = (i1_ref_frame1 < 0) ? 0 : i1_ref_frame1;
  ------------------
  |  Branch (286:23): [True: 2, False: 200]
  ------------------
  287|    202|            uc_Idx += (u1_scale_ref) ? (uc_Idx1 >> 1) : uc_Idx1;
  ------------------
  |  Branch (287:23): [True: 0, False: 202]
  ------------------
  288|    202|            pui32_weight_ofsts = (UWORD32 *) &ps_dec->pu4_wt_ofsts[2 * X3(uc_Idx)];
  ------------------
  |  |   92|    202|#define X3(a)   (((a) << 1) + (a))
  ------------------
  289|       |
  290|    202|            if(i1_ref_frame0 < 0) pui32_weight_ofsts += 1;
  ------------------
  |  Branch (290:16): [True: 10, False: 192]
  ------------------
  291|       |
  292|    202|            if(u1_scale_ref && (ps_dec->ps_cur_pps->u1_wted_bipred_idc == 2))
  ------------------
  |  Branch (292:16): [True: 0, False: 202]
  |  Branch (292:32): [True: 0, False: 0]
  ------------------
  293|      0|            {
  294|      0|                WORD16 i2_ref_idx;
  295|      0|                i2_ref_idx = MAX(i1_ref_frame0, 0);
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  296|      0|                i2_ref_idx *= (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1] << 1);
  297|      0|                i2_ref_idx += MAX(i1_ref_frame1, 0);
  ------------------
  |  |   60|      0|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  298|      0|                if(!ps_cur_mb_info->u1_topmb)
  ------------------
  |  Branch (298:20): [True: 0, False: 0]
  ------------------
  299|      0|                    i2_ref_idx += (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0] << 1) *
  300|      0|                                  (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[1] << 1);
  301|      0|                pui32_weight_ofsts = (UWORD32 *) &ps_dec->pu4_mbaff_wt_mat[2 * X3(i2_ref_idx)];
  ------------------
  |  |   92|      0|#define X3(a)   (((a) << 1) + (a))
  ------------------
  302|      0|            }
  303|    202|        }
  304|    323|    }
  305|       |
  306|    323|    s_temp_mv_pred.i1_ref_frame[0] = i1_ref_frame0;
  307|    323|    s_temp_mv_pred.i1_ref_frame[1] = i1_ref_frame1;
  308|    323|    s_temp_mv_pred.u1_col_ref_pic_idx = ps_ref_frame->u1_mv_buf_id;
  309|    323|    s_temp_mv_pred.u1_pic_type = ps_ref_frame->u1_pic_type;
  310|       |
  311|       |    /**********************************************************************/
  312|       |    /* Call the function which gets the number of partitions and          */
  313|       |    /* partition info of colocated Mb                                     */
  314|       |    /**********************************************************************/
  315|       |
  316|    323|    isvcd_one_to_one(ps_svc_lyr_dec, ps_dec->ps_col_pic, &s_mvdirect, u1_wd_x,
  317|    323|                     ps_dec->i4_submb_ofst, ps_cur_mb_info);
  318|       |
  319|    323|    ps_col_pic = ps_dec->ps_col_pic;
  320|    323|    if((s_mvdirect.u1_col_zeroflag_change == 0) || u1_direct_zero_pred_flag)
  ------------------
  |  Branch (320:8): [True: 0, False: 323]
  |  Branch (320:52): [True: 52, False: 271]
  ------------------
  321|     52|    {
  322|     52|        WORD16 i2_mv_x, i2_mv_y, i2_mvX1, i2_mvY1;
  323|       |        /* Most probable case */
  324|     52|        u1_col_zero_flag = *(ps_col_pic->pu1_col_zero_flag + s_mvdirect.i4_mv_indices[0]);
  325|     52|        u1_col_zero_flag = u1_col_zero_flag & 0x01;
  326|       |
  327|     52|        if(u1_zero_pred_cond_f || ((i1_ref_frame0 == 0) && (u1_col_zero_flag == 1)))
  ------------------
  |  Branch (327:12): [True: 52, False: 0]
  |  Branch (327:36): [True: 0, False: 0]
  |  Branch (327:60): [True: 0, False: 0]
  ------------------
  328|     52|        {
  329|     52|            i2_mv_x = 0;
  330|     52|            i2_mv_y = 0;
  331|     52|        }
  332|      0|        else
  333|      0|        {
  334|      0|            i2_mv_x = i2_spat_pred_mv[0];
  335|      0|            i2_mv_y = i2_spat_pred_mv[1];
  336|      0|        }
  337|       |
  338|     52|        if(u1_zero_pred_cond_b || ((i1_ref_frame1 == 0) && (u1_col_zero_flag == 1)))
  ------------------
  |  Branch (338:12): [True: 52, False: 0]
  |  Branch (338:36): [True: 0, False: 0]
  |  Branch (338:60): [True: 0, False: 0]
  ------------------
  339|     52|        {
  340|     52|            i2_mvX1 = 0;
  341|     52|            i2_mvY1 = 0;
  342|     52|        }
  343|      0|        else
  344|      0|        {
  345|      0|            i2_mvX1 = i2_spat_pred_mv[2];
  346|      0|            i2_mvY1 = i2_spat_pred_mv[3];
  347|      0|        }
  348|       |
  349|     52|        u4_sub_mb_num = ps_dec->u1_sub_mb_num;
  350|     52|        u1_mb_partw = (u1_wd_x >> 2);
  351|       |
  352|     52|        if(i1_ref_frame0 >= 0)
  ------------------
  |  Branch (352:12): [True: 52, False: 0]
  ------------------
  353|     52|        {
  354|     52|            {
  355|     52|                pred_info_pkd_t *ps_pred_pkd;
  356|     52|                WORD16 i2_mv[2];
  357|     52|                WORD8 i1_ref_idx = 0;
  358|       |
  359|     52|                i2_mv[0] = i2_mv_x;
  360|     52|                i2_mv[1] = i2_mv_y;
  361|       |
  362|     52|                ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  363|     52|                ih264d_fill_pred_info(i2_mv, u1_mb_partw, u1_mb_partw, u4_sub_mb_num, i1_pred,
  364|     52|                                      ps_pred_pkd, ps_pic_buff0->u1_pic_buf_id, i1_ref_idx,
  365|     52|                                      pui32_weight_ofsts, ps_pic_buff0->u1_pic_type);
  366|     52|                ps_dec->u4_pred_info_pkd_idx++;
  367|     52|                ps_cur_mb_info->u1_num_pred_parts++;
  368|     52|            }
  369|     52|        }
  370|       |
  371|     52|        if(i1_ref_frame1 >= 0)
  ------------------
  |  Branch (371:12): [True: 52, False: 0]
  ------------------
  372|     52|        {
  373|     52|            {
  374|     52|                pred_info_pkd_t *ps_pred_pkd;
  375|     52|                WORD16 i2_mv[2];
  376|     52|                WORD8 i1_ref_idx = 0;
  377|       |
  378|     52|                i2_mv[0] = i2_mvX1;
  379|     52|                i2_mv[1] = i2_mvY1;
  380|       |
  381|     52|                ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  382|     52|                ih264d_fill_pred_info(i2_mv, u1_mb_partw, u1_mb_partw, u4_sub_mb_num, i1_pred,
  383|     52|                                      ps_pred_pkd, ps_pic_buff1->u1_pic_buf_id, i1_ref_idx,
  384|     52|                                      pui32_weight_ofsts, ps_pic_buff1->u1_pic_type);
  385|     52|                ps_dec->u4_pred_info_pkd_idx++;
  386|     52|                ps_cur_mb_info->u1_num_pred_parts++;
  387|     52|            }
  388|     52|        }
  389|       |
  390|       |        /* Replication optimisation */
  391|     52|        s_temp_mv_pred.i2_mv[0] = i2_mv_x;
  392|     52|        s_temp_mv_pred.i2_mv[1] = i2_mv_y;
  393|     52|        s_temp_mv_pred.i2_mv[2] = i2_mvX1;
  394|     52|        s_temp_mv_pred.i2_mv[3] = i2_mvY1;
  395|       |
  396|       |        /* Calculating colocated zero information */
  397|     52|        {
  398|       |            /*************************************/
  399|       |            /* If(bit2 and bit3 set)             */
  400|       |            /* then                              */
  401|       |            /*  (bit0 and bit1) => submmbmode    */
  402|       |            /*  (bit2 and bit3) => mbmode        */
  403|       |            /* else                              */
  404|       |            /*  (bit0 and bit1) => mbmode        */
  405|       |            /*************************************/
  406|       |            /*UWORD8 u1_packed_mb_sub_mb_mode = sub_partition ?
  407|       |             (s_mvdirect.i1_partitionsize[0]) : ((s_mvdirect.i1_partitionsize[0]) <<
  408|       |             2);*/
  409|     52|            UWORD8 u1_packed_mb_sub_mb_mode = (u1_mb_partw == 2) ? 0x03 : 0;
  ------------------
  |  Branch (409:47): [True: 4, False: 48]
  ------------------
  410|       |
  411|     52|            if(i1_ref_frame0 < 0)
  ------------------
  |  Branch (411:16): [True: 0, False: 52]
  ------------------
  412|      0|            {
  413|      0|                i2_mv_x = i2_mvX1;
  414|      0|                i2_mv_y = i2_mvY1;
  415|      0|            }
  416|       |
  417|       |            /* Change from left shift 4 to 6 - Varun */
  418|     52|            u1_colz = (ps_cur_mb_info->u1_mb_field_decodingflag << 1) |
  419|     52|                      ((u1_final_ref_idx == 0) && (ABS(i2_mv_x) <= 1) && (ABS(i2_mv_y) <= 1));
  ------------------
  |  |  100|     52|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 0, False: 52]
  |  |  ------------------
  ------------------
                                    ((u1_final_ref_idx == 0) && (ABS(i2_mv_x) <= 1) && (ABS(i2_mv_y) <= 1));
  ------------------
  |  |  100|     52|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 0, False: 52]
  |  |  ------------------
  ------------------
  |  Branch (419:24): [True: 52, False: 0]
  |  Branch (419:51): [True: 52, False: 0]
  |  Branch (419:74): [True: 52, False: 0]
  ------------------
  420|     52|            u1_colz |= (u1_packed_mb_sub_mb_mode << 6);
  421|     52|        }
  422|     52|        ps_mv = ps_mv_nmb_start + u4_sub_mb_num;
  423|     52|        if(ps_mv)
  ------------------
  |  Branch (423:12): [True: 52, False: 0]
  ------------------
  424|     52|        {
  425|     52|            ih264d_rep_mv_colz(ps_dec, &s_temp_mv_pred, ps_mv, u4_sub_mb_num, u1_colz, u1_mb_partw,
  426|     52|                               u1_mb_partw);
  427|     52|        }
  428|      0|        else
  429|      0|        {
  430|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  431|      0|        }
  432|       |
  433|     52|        if(u1_wd_x == MB_SIZE) ps_dec->u1_currB_type = 0;
  ------------------
  |  |  554|     52|#define MB_SIZE             16
  ------------------
  |  Branch (433:12): [True: 48, False: 4]
  ------------------
  434|       |
  435|     52|        return OK;
  ------------------
  |  |  114|     52|#define OK        0
  ------------------
  436|     52|    }
  437|       |
  438|       |    /***************************************************************************/
  439|       |    /* If present MB is 16x16 and the partition of colocated Mb is >= PRED_8x8 */
  440|       |    /* i.e 8x8 or less than 8x8 partitions then set up DMA for (0,0) and       */
  441|       |    /* spatially predicted motion vector and do the multiplexing after         */
  442|       |    /* motion compensation                                                     */
  443|       |    /***************************************************************************/
  444|       |
  445|    271|    if((u1_wd_x == MB_SIZE) && (s_mvdirect.i1_num_partitions > 2))
  ------------------
  |  |  554|    271|#define MB_SIZE             16
  ------------------
  |  Branch (445:8): [True: 265, False: 6]
  |  Branch (445:32): [True: 12, False: 253]
  ------------------
  446|     12|    {
  447|     12|        ps_cur_mb_info->u1_Mux = 1;
  448|     12|        if(i1_ref_frame0 >= 0)
  ------------------
  |  Branch (448:12): [True: 12, False: 0]
  ------------------
  449|     12|        {
  450|     12|            {
  451|     12|                pred_info_pkd_t *ps_pred_pkd;
  452|     12|                WORD8 i1_ref_idx = 0;
  453|       |
  454|     12|                ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  455|     12|                ih264d_fill_pred_info(&(i2_spat_pred_mv[0]), 4, 4, 0, i1_pred, ps_pred_pkd,
  456|     12|                                      ps_pic_buff0->u1_pic_buf_id, i1_ref_idx, pui32_weight_ofsts,
  457|     12|                                      ps_pic_buff0->u1_pic_type);
  458|     12|                ps_dec->u4_pred_info_pkd_idx++;
  459|     12|                ps_cur_mb_info->u1_num_pred_parts++;
  460|     12|            }
  461|       |
  462|       |            /******    (0,0) Motion vectors DMA     *****/
  463|     12|            {
  464|     12|                pred_info_pkd_t *ps_pred_pkd;
  465|     12|                WORD16 i2_mv[2];
  466|     12|                WORD8 i1_ref_idx = 0;
  467|       |
  468|     12|                i2_mv[0] = 0;
  469|     12|                i2_mv[1] = 0;
  470|       |
  471|     12|                ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  472|     12|                ih264d_fill_pred_info(i2_mv, 4, 4, 0, i1_pred, ps_pred_pkd,
  473|     12|                                      ps_pic_buff0->u1_pic_buf_id, i1_ref_idx, pui32_weight_ofsts,
  474|     12|                                      ps_pic_buff0->u1_pic_type);
  475|     12|                ps_dec->u4_pred_info_pkd_idx++;
  476|     12|                ps_cur_mb_info->u1_num_pred_parts++;
  477|     12|            }
  478|     12|        }
  479|     12|        if(i1_ref_frame1 >= 0)
  ------------------
  |  Branch (479:12): [True: 12, False: 0]
  ------------------
  480|     12|        {
  481|     12|            {
  482|     12|                pred_info_pkd_t *ps_pred_pkd;
  483|     12|                WORD8 i1_ref_idx = 0;
  484|       |
  485|     12|                ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  486|     12|                ih264d_fill_pred_info(&(i2_spat_pred_mv[2]), 4, 4, 0, i1_pred, ps_pred_pkd,
  487|     12|                                      ps_pic_buff1->u1_pic_buf_id, i1_ref_idx, pui32_weight_ofsts,
  488|     12|                                      ps_pic_buff1->u1_pic_type);
  489|     12|                ps_dec->u4_pred_info_pkd_idx++;
  490|     12|                ps_cur_mb_info->u1_num_pred_parts++;
  491|     12|            }
  492|       |
  493|       |            /******    (0,0) Motion vectors DMA     *****/
  494|     12|            {
  495|     12|                pred_info_pkd_t *ps_pred_pkd;
  496|     12|                WORD16 i2_mv[2];
  497|     12|                WORD8 i1_ref_idx = 0;
  498|       |
  499|     12|                i2_mv[0] = 0;
  500|     12|                i2_mv[1] = 0;
  501|       |
  502|     12|                ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  503|     12|                ih264d_fill_pred_info(i2_mv, 4, 4, 0, i1_pred, ps_pred_pkd,
  504|     12|                                      ps_pic_buff1->u1_pic_buf_id, i1_ref_idx, pui32_weight_ofsts,
  505|     12|                                      ps_pic_buff1->u1_pic_type);
  506|     12|                ps_dec->u4_pred_info_pkd_idx++;
  507|     12|                ps_cur_mb_info->u1_num_pred_parts++;
  508|     12|            }
  509|     12|        }
  510|     12|    }
  511|       |
  512|    683|    for(i = 0; i < s_mvdirect.i1_num_partitions; i++)
  ------------------
  |  Branch (512:16): [True: 412, False: 271]
  ------------------
  513|    412|    {
  514|    412|        partition_size = s_mvdirect.i1_partitionsize[i];
  515|    412|        u4_sub_mb_num = s_mvdirect.i1_submb_num[i];
  516|       |
  517|    412|        sub_partition = partition_size >> 2;
  518|    412|        partition_size &= 0x3;
  519|    412|        u1_mb_partw = pu1_mb_partw[partition_size];
  520|    412|        u1_mb_parth = pu1_mb_parth[partition_size];
  521|    412|        if(sub_partition != 0)
  ------------------
  |  Branch (521:12): [True: 148, False: 264]
  ------------------
  522|    148|        {
  523|    148|            u1_mb_partw >>= 1;
  524|    148|            u1_mb_parth >>= 1;
  525|    148|        }
  526|       |
  527|    412|        u1_col_zero_flag = *(ps_col_pic->pu1_col_zero_flag + s_mvdirect.i4_mv_indices[i]);
  528|    412|        u1_col_zero_flag = u1_col_zero_flag & 0x01;
  529|       |
  530|       |        /*if(u1_col != u1_col_zero_flag)
  531|       |         u1_init = 1;*/
  532|       |
  533|    412|        pi2_final_mv0 = &i2_spat_pred_mv[0];
  534|    412|        pi2_final_mv1 = &i2_spat_pred_mv[2];
  535|       |
  536|    412|        if(ps_cur_mb_info->u1_Mux != 1)
  ------------------
  |  Branch (536:12): [True: 268, False: 144]
  ------------------
  537|    268|        {
  538|    268|            if(i1_ref_frame0 >= 0)
  ------------------
  |  Branch (538:16): [True: 258, False: 10]
  ------------------
  539|    258|            {
  540|    258|                {
  541|    258|                    pred_info_pkd_t *ps_pred_pkd;
  542|    258|                    WORD8 i1_ref_idx = 0;
  543|       |
  544|    258|                    ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  545|    258|                    ih264d_fill_pred_info(pi2_final_mv0, u1_mb_partw, u1_mb_parth, u4_sub_mb_num,
  546|    258|                                          i1_pred, ps_pred_pkd, ps_pic_buff0->u1_pic_buf_id,
  547|    258|                                          i1_ref_idx, pui32_weight_ofsts,
  548|    258|                                          ps_pic_buff0->u1_pic_type);
  549|    258|                    ps_dec->u4_pred_info_pkd_idx++;
  550|    258|                    ps_cur_mb_info->u1_num_pred_parts++;
  551|    258|                }
  552|    258|            }
  553|       |
  554|    268|            if(i1_ref_frame1 >= 0)
  ------------------
  |  Branch (554:16): [True: 259, False: 9]
  ------------------
  555|    259|            {
  556|    259|                pred_info_pkd_t *ps_pred_pkd;
  557|    259|                WORD8 i1_ref_idx = 0;
  558|       |
  559|    259|                ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  560|    259|                ih264d_fill_pred_info(pi2_final_mv1, u1_mb_partw, u1_mb_parth, u4_sub_mb_num,
  561|    259|                                      i1_pred, ps_pred_pkd, ps_pic_buff1->u1_pic_buf_id, i1_ref_idx,
  562|    259|                                      pui32_weight_ofsts, ps_pic_buff1->u1_pic_type);
  563|    259|                ps_dec->u4_pred_info_pkd_idx++;
  564|    259|                ps_cur_mb_info->u1_num_pred_parts++;
  565|    259|            }
  566|    268|        }
  567|       |
  568|       |        /* Replication optimisation */
  569|    412|        s_temp_mv_pred.i2_mv[0] = pi2_final_mv0[0];
  570|    412|        s_temp_mv_pred.i2_mv[1] = pi2_final_mv0[1];
  571|    412|        s_temp_mv_pred.i2_mv[2] = pi2_final_mv1[0];
  572|    412|        s_temp_mv_pred.i2_mv[3] = pi2_final_mv1[1];
  573|       |
  574|       |        /* Calculating colocated zero information */
  575|    412|        {
  576|    412|            WORD16 i2_mv_x = 0, i2_mv_y = 0;
  577|       |            /*************************************/
  578|       |            /* If(bit2 and bit3 set)             */
  579|       |            /* then                              */
  580|       |            /*  (bit0 and bit1) => submmbmode    */
  581|       |            /*  (bit2 and bit3) => mbmode        */
  582|       |            /* else                              */
  583|       |            /*  (bit0 and bit1) => mbmode        */
  584|       |            /*************************************/
  585|    412|            UWORD8 u1_packed_mb_sub_mb_mode = sub_partition
  ------------------
  |  Branch (585:47): [True: 148, False: 264]
  ------------------
  586|    412|                                                  ? (s_mvdirect.i1_partitionsize[i])
  587|    412|                                                  : ((s_mvdirect.i1_partitionsize[i]) << 2);
  588|       |
  589|    412|            if(i1_ref_frame0 >= 0)
  ------------------
  |  Branch (589:16): [True: 402, False: 10]
  ------------------
  590|    402|            {
  591|    402|                i2_mv_x = pi2_final_mv0[0];
  592|    402|                i2_mv_y = pi2_final_mv0[1];
  593|    402|            }
  594|     10|            else
  595|     10|            {
  596|     10|                i2_mv_x = pi2_final_mv1[0];
  597|     10|                i2_mv_y = pi2_final_mv1[1];
  598|     10|            }
  599|       |
  600|    412|            u1_colz = (ps_cur_mb_info->u1_mb_field_decodingflag << 1) |
  601|    412|                      ((u1_final_ref_idx == 0) && (ABS(i2_mv_x) <= 1) && (ABS(i2_mv_y) <= 1));
  ------------------
  |  |  100|    412|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 4, False: 408]
  |  |  ------------------
  ------------------
                                    ((u1_final_ref_idx == 0) && (ABS(i2_mv_x) <= 1) && (ABS(i2_mv_y) <= 1));
  ------------------
  |  |  100|    410|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 0, False: 410]
  |  |  ------------------
  ------------------
  |  Branch (601:24): [True: 412, False: 0]
  |  Branch (601:51): [True: 410, False: 2]
  |  Branch (601:74): [True: 400, False: 10]
  ------------------
  602|    412|            u1_colz |= (u1_packed_mb_sub_mb_mode << 4);
  603|    412|        }
  604|    412|        ps_mv = ps_mv_nmb_start + u4_sub_mb_num;
  605|    412|        if(ps_mv)
  ------------------
  |  Branch (605:12): [True: 412, False: 0]
  ------------------
  606|    412|        {
  607|    412|            ih264d_rep_mv_colz(ps_dec, &s_temp_mv_pred, ps_mv, u4_sub_mb_num, u1_colz, u1_mb_parth,
  608|    412|                               u1_mb_partw);
  609|    412|        }
  610|      0|        else
  611|      0|        {
  612|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  613|      0|        }
  614|    412|    }
  615|    271|    i = 0;
  616|    271|    if(i1_ref_frame0 >= 0) ps_cur_mb_info->u2_mask[i++] = ui2_mask_fwd;
  ------------------
  |  Branch (616:8): [True: 261, False: 10]
  ------------------
  617|    271|    if(i1_ref_frame1 >= 0) ps_cur_mb_info->u2_mask[i] = ui2_mask_bwd;
  ------------------
  |  Branch (617:8): [True: 262, False: 9]
  ------------------
  618|       |
  619|    271|    return OK;
  ------------------
  |  |  114|    271|#define OK        0
  ------------------
  620|    271|}

isvcd_retrive_infer_mode_mv:
   80|  14.7k|{
   81|  14.7k|    mode_motion_ctxt_t *ps_ctxt;
   82|  14.7k|    mv_pred_t *ps_motion_pred;
   83|  14.7k|    UWORD8 u1_tmp_lx = (u1_lx << 1);
   84|       |
   85|  14.7k|    ps_ctxt = (mode_motion_ctxt_t *) ps_svc_lyr_dec->pv_mode_mv_sample_ctxt;
   86|  14.7k|    ps_motion_pred = ps_ctxt->ps_motion_pred_struct;
   87|  14.7k|    ps_motion_pred += u1_sub_mb_num;
   88|  14.7k|    ps_mvpred->i2_mv[u1_tmp_lx] = ps_motion_pred->i2_mv[u1_tmp_lx];
   89|  14.7k|    ps_mvpred->i2_mv[u1_tmp_lx + 1] = ps_motion_pred->i2_mv[u1_tmp_lx + 1];
   90|       |
   91|  14.7k|    return;
   92|  14.7k|}
isvcd_interlyr_motion_mode_pred:
  109|   367k|{
  110|   367k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  111|   367k|    WORD32 i4_inter_layer_pred_req_flag;
  112|   367k|    WORD32 i4_listx;
  113|   367k|    WORD32 i4_mb_mode = -1;
  114|   367k|    i4_inter_layer_pred_req_flag = SVCD_FALSE;
  ------------------
  |  |   45|   367k|#define SVCD_FALSE 0
  ------------------
  115|   367k|    i4_listx = (ps_dec->ps_cur_slice->u1_slice_type == B_SLICE) ? 2 : 1;
  ------------------
  |  |  369|   367k|#define B_SLICE  1
  ------------------
  |  Branch (115:16): [True: 1.03k, False: 366k]
  ------------------
  116|       |    /* check Base mode flag and motion predcition flags */
  117|   367k|    if(1 == ps_svc_cur_mb_info->u1_base_mode_flag)
  ------------------
  |  Branch (117:8): [True: 4.17k, False: 363k]
  ------------------
  118|  4.17k|    {
  119|  4.17k|        i4_inter_layer_pred_req_flag = SVCD_TRUE;
  ------------------
  |  |   46|  4.17k|#define SVCD_TRUE 1
  ------------------
  120|  4.17k|    }
  121|   363k|    else
  122|   363k|    {
  123|   363k|        UWORD8 u1_mot_pred_flag;
  124|       |
  125|       |        /* get the packed the motion pred flag of list 0 */
  126|   363k|        u1_mot_pred_flag = ps_svc_cur_mb_info->au1_motion_pred_flag[0];
  127|       |
  128|       |        /* extract the last 4 bits */
  129|   363k|        u1_mot_pred_flag &= 0x0F;
  130|       |
  131|   363k|        if(0 != u1_mot_pred_flag)
  ------------------
  |  Branch (131:12): [True: 1.71k, False: 361k]
  ------------------
  132|  1.71k|        {
  133|  1.71k|            i4_inter_layer_pred_req_flag = SVCD_TRUE;
  ------------------
  |  |   46|  1.71k|#define SVCD_TRUE 1
  ------------------
  134|  1.71k|        }
  135|       |
  136|       |        /* check for list 1 flags if required */
  137|   363k|        if((2 == i4_listx) && (SVCD_FALSE == i4_inter_layer_pred_req_flag))
  ------------------
  |  |   45|    571|#define SVCD_FALSE 0
  ------------------
  |  Branch (137:12): [True: 571, False: 363k]
  |  Branch (137:31): [True: 563, False: 8]
  ------------------
  138|    563|        {
  139|       |            /* get the packed the motion pred flag of list 1 */
  140|    563|            u1_mot_pred_flag = ps_svc_cur_mb_info->au1_motion_pred_flag[1];
  141|       |
  142|       |            /* extract the last 4 bits */
  143|    563|            u1_mot_pred_flag &= 0x0F;
  144|       |
  145|    563|            if(0 != u1_mot_pred_flag)
  ------------------
  |  Branch (145:16): [True: 0, False: 563]
  ------------------
  146|      0|            {
  147|      0|                i4_inter_layer_pred_req_flag = SVCD_TRUE;
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
  148|      0|            }
  149|    563|        }
  150|   363k|    }
  151|       |
  152|   367k|    if(SVCD_TRUE == i4_inter_layer_pred_req_flag)
  ------------------
  |  |   46|   367k|#define SVCD_TRUE 1
  ------------------
  |  Branch (152:8): [True: 5.89k, False: 361k]
  ------------------
  153|  5.89k|    {
  154|  5.89k|        mode_motion_ctxt_t *ps_ctxt;
  155|  5.89k|        mode_motion_lyr_ctxt *ps_lyr_mem;
  156|       |
  157|  5.89k|        ps_ctxt = (mode_motion_ctxt_t *) ps_svc_lyr_dec->pv_mode_mv_sample_ctxt;
  158|       |        /* get the current layer ctxt */
  159|  5.89k|        ps_lyr_mem = &ps_ctxt->as_res_lyr_mem[ps_ctxt->i4_res_id];
  160|       |
  161|  5.89k|        {
  162|  5.89k|            ps_ctxt->i4_listx = i4_listx;
  163|       |
  164|  5.89k|            i4_mb_mode =
  165|  5.89k|                ps_lyr_mem->pf_inter_lyr_pred(ps_svc_lyr_dec->pv_mode_mv_sample_ctxt, ps_cur_mb_info,
  166|  5.89k|                                          ps_svc_cur_mb_info, ps_dec, ps_mb_part_info, ps_part);
  167|  5.89k|        }
  168|  5.89k|    }
  169|   367k|    return i4_mb_mode;
  170|   367k|}
isvcd_mv_pred_ref_tfr_nby2_epmb:
  182|  52.4k|{
  183|  52.4k|    svc_dec_lyr_struct_t *ps_svc_lyr_dec = (svc_dec_lyr_struct_t *) ps_dec;
  184|  52.4k|    parse_pmbarams_t *ps_mb_part_info;
  185|  52.4k|    parse_part_params_t *ps_part;
  186|  52.4k|    mv_pred_t *ps_mv_nmb, *ps_mv_nmb_start, *ps_mv_ntop, *ps_mv_ntop_start;
  187|  52.4k|    UWORD32 i, j;
  188|  52.4k|    const UWORD32 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  189|  52.4k|    dec_mb_info_t *ps_cur_mb_info;
  190|  52.4k|    dec_svc_mb_info_t *ps_svc_cur_mb_info;
  191|  52.4k|    WORD32 i2_mv_x, i2_mv_y;
  192|       |
  193|  52.4k|    ps_dec->i4_submb_ofst -= (u4_num_mbs - u4_mb_idx) << 4;
  194|  52.4k|    ps_mb_part_info = ps_dec->ps_parse_mb_data;
  195|  52.4k|    ps_part = ps_dec->ps_parse_part_params;
  196|       |
  197|       |    /* N/2 Mb MvPred and Transfer Setup Loop */
  198|   419k|    for(i = u4_mb_idx; i < u4_num_mbs; i++, ps_mb_part_info++)
  ------------------
  |  Branch (198:24): [True: 367k, False: 52.4k]
  ------------------
  199|   367k|    {
  200|   367k|        UWORD32 u1_colz;
  201|   367k|        UWORD32 u1_field;
  202|   367k|        mv_pred_t s_mvPred = {0};
  203|   367k|        mv_pred_t *ps_mv_pred = &s_mvPred;
  204|       |
  205|   367k|        *ps_mv_pred = ps_dec->s_default_mv_pred;
  206|       |
  207|   367k|        ps_dec->i4_submb_ofst += SUB_BLK_SIZE;
  ------------------
  |  |  562|   367k|#define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|   367k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  |  |               #define SUB_BLK_SIZE                  ((SUB_BLK_WIDTH) * (SUB_BLK_WIDTH))
  |  |  ------------------
  |  |  |  |  560|   367k|#define SUB_BLK_WIDTH                 4
  |  |  ------------------
  ------------------
  208|       |
  209|       |        /* Restore the slice scratch MbX and MbY context */
  210|   367k|        ps_cur_mb_info = ps_dec->ps_nmb_info + i;
  211|   367k|        ps_svc_cur_mb_info = ps_svc_lyr_dec->ps_svc_nmb_info + i;
  212|   367k|        u1_field = ps_cur_mb_info->u1_mb_field_decodingflag;
  213|       |
  214|   367k|        ps_mv_nmb_start = ps_dec->ps_mv_cur + (i << 4);
  215|   367k|        ps_dec->u2_mbx = ps_cur_mb_info->u2_mbx;
  216|   367k|        ps_dec->u2_mby = ps_cur_mb_info->u2_mby;
  217|   367k|        ps_dec->u2_mv_2mb[i & 0x1] = 0;
  218|       |
  219|       |        /* Look for MV Prediction and Reference Transfer in Non-I Mbs */
  220|   367k|        if(!ps_mb_part_info->u4_isI_mb)
  ------------------
  |  Branch (220:12): [True: 366k, False: 523]
  ------------------
  221|   366k|        {
  222|   366k|            UWORD32 u1_blk_no;
  223|   366k|            WORD32 i1_ref_idx, i1_ref_idx1;
  224|   366k|            UWORD32 u1_sub_mb_x, u1_sub_mb_y, u1_sub_mb_num;
  225|   366k|            UWORD32 u1_num_part, u1_num_ref, u1_wd, u1_ht;
  226|   366k|            UWORD32 *pu4_wt_offst, **ppu4_wt_ofst;
  227|   366k|            UWORD32 u1_scale_ref, u4_bot_mb;
  228|   366k|            WORD8 *pi1_ref_idx = ps_mb_part_info->i1_ref_idx[0];
  229|   366k|            pic_buffer_t *ps_ref_frame, **pps_ref_frame;
  230|   366k|            deblk_mb_t *ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + i;
  231|   366k|            WORD32 i4_mb_mode_svc;
  232|   366k|            UWORD8 u1_motion_pred_flag_l0 = ps_svc_cur_mb_info->au1_motion_pred_flag[0];
  233|       |
  234|       |            /* MB Level initialisations */
  235|   366k|            ps_dec->u4_num_pmbair = i >> u1_mbaff;
  236|   366k|            ps_dec->u4_mb_idx_mv = i;
  237|   366k|            ppu4_wt_ofst = ps_mb_part_info->pu4_wt_offst;
  238|   366k|            pps_ref_frame = ps_dec->ps_ref_pic_buf_lx[0];
  239|       |
  240|   366k|            i4_mb_mode_svc = isvcd_interlyr_motion_mode_pred(
  241|   366k|                ps_svc_lyr_dec, ps_cur_mb_info, ps_svc_cur_mb_info, ps_mb_part_info, ps_part);
  242|       |
  243|   366k|            if((-1 == i4_mb_mode_svc) || (SVC_INTER_MB == i4_mb_mode_svc))
  ------------------
  |  |  114|  3.70k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (243:16): [True: 363k, False: 3.70k]
  |  Branch (243:42): [True: 3.58k, False: 123]
  ------------------
  244|   366k|            {
  245|   366k|                ps_mv_ntop_start =
  246|   366k|                    ps_mv_nmb_start - (ps_dec->u2_frm_wd_in_mbs << (4 + u1_mbaff)) + 12;
  247|       |
  248|   366k|                u1_num_part = ps_mb_part_info->u1_num_part;
  249|   366k|                ps_cur_deblk_mb->u1_mb_type |= (u1_num_part > 1) << 1;
  250|   366k|                ps_cur_mb_info->u4_pred_info_pkd_idx = ps_dec->u4_pred_info_pkd_idx;
  251|   366k|                ps_cur_mb_info->u1_num_pred_parts = 0;
  252|       |
  253|       |                /****************************************************/
  254|       |                /* weighted u4_ofst pointer calculations, this loop  */
  255|       |                /* runs maximum 4 times, even in direct cases       */
  256|       |                /****************************************************/
  257|   366k|                u1_scale_ref = u1_mbaff & u1_field;
  258|       |
  259|   366k|                u4_bot_mb = 1 - ps_cur_mb_info->u1_topmb;
  260|   366k|                if(ps_dec->ps_cur_pps->u1_wted_pred_flag)
  ------------------
  |  Branch (260:20): [True: 267k, False: 98.7k]
  ------------------
  261|   267k|                {
  262|   267k|                    u1_num_ref = MIN(u1_num_part, 4);
  ------------------
  |  |   61|   267k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 265k, False: 2.32k]
  |  |  ------------------
  ------------------
  263|   543k|                    for(u1_blk_no = 0; u1_blk_no < u1_num_ref; u1_blk_no++)
  ------------------
  |  Branch (263:40): [True: 275k, False: 267k]
  ------------------
  264|   275k|                    {
  265|   275k|                        i1_ref_idx = pi1_ref_idx[u1_blk_no];
  266|   275k|                        if(u1_scale_ref) i1_ref_idx >>= 1;
  ------------------
  |  Branch (266:28): [True: 0, False: 275k]
  ------------------
  267|   275k|                        pu4_wt_offst = (UWORD32 *) &ps_dec->pu4_wt_ofsts[2 * X3(i1_ref_idx)];
  ------------------
  |  |   92|   275k|#define X3(a)   (((a) << 1) + (a))
  ------------------
  268|   275k|                        ppu4_wt_ofst[u1_blk_no] = pu4_wt_offst;
  269|   275k|                    }
  270|   267k|                }
  271|  98.7k|                else
  272|  98.7k|                {
  273|  98.7k|                    ppu4_wt_ofst[0] = NULL;
  274|  98.7k|                    ppu4_wt_ofst[1] = NULL;
  275|  98.7k|                    ppu4_wt_ofst[2] = NULL;
  276|  98.7k|                    ppu4_wt_ofst[3] = NULL;
  277|  98.7k|                }
  278|       |
  279|       |                /**************************************************/
  280|       |                /* Loop on Partitions                             */
  281|       |                /**************************************************/
  282|   753k|                for(j = 0; j < u1_num_part; j++, ps_part++)
  ------------------
  |  Branch (282:28): [True: 386k, False: 366k]
  ------------------
  283|   386k|                {
  284|   386k|                    u1_sub_mb_num = ps_part->u1_sub_mb_num;
  285|   386k|                    ps_dec->u1_sub_mb_num = u1_sub_mb_num;
  286|       |
  287|   386k|                    if(PART_NOT_DIRECT != ps_part->u1_is_direct)
  ------------------
  |  |  569|   386k|#define PART_NOT_DIRECT                0
  ------------------
  |  Branch (287:24): [True: 347k, False: 39.4k]
  ------------------
  288|   347k|                    {
  289|       |                        /* Mb Skip Mode */
  290|       |                        /* Setting the default and other members of MvPred Structure */
  291|   347k|                        s_mvPred.i2_mv[2] = -1;
  292|   347k|                        s_mvPred.i2_mv[3] = -1;
  293|   347k|                        s_mvPred.i1_ref_frame[0] = 0;
  294|   347k|                        i1_ref_idx = (u1_scale_ref && u4_bot_mb) ? MAX_REF_BUFS : 0;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  |  Branch (294:39): [True: 0, False: 347k]
  |  Branch (294:55): [True: 0, False: 0]
  ------------------
  295|   347k|                        ps_ref_frame = pps_ref_frame[i1_ref_idx];
  296|   347k|                        s_mvPred.u1_col_ref_pic_idx = ps_ref_frame->u1_mv_buf_id;
  297|   347k|                        s_mvPred.u1_pic_type = ps_ref_frame->u1_pic_type;
  298|   347k|                        pu4_wt_offst = (UWORD32 *) &ps_dec->pu4_wt_ofsts[0];
  299|       |
  300|   347k|                        ps_dec->pf_mvpred(ps_dec, ps_cur_mb_info, ps_mv_nmb_start, ps_mv_ntop_start,
  301|   347k|                                          &s_mvPred, 0, 4, 0, 1, MB_SKIP);
  ------------------
  |  |   59|   347k|#define MB_SKIP 255
  ------------------
  302|       |
  303|   347k|                        {
  304|   347k|                            pred_info_pkd_t *ps_pred_pkd;
  305|   347k|                            ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  306|   347k|                            ih264d_fill_pred_info(s_mvPred.i2_mv, 4, 4, 0, PRED_L0, ps_pred_pkd,
  ------------------
  |  |  483|   347k|#define PRED_L0   1
  ------------------
  307|   347k|                                                  ps_ref_frame->u1_pic_buf_id,
  308|   347k|                                                  (i1_ref_idx >> u1_scale_ref), pu4_wt_offst,
  309|   347k|                                                  ps_ref_frame->u1_pic_type);
  310|       |
  311|   347k|                            ps_dec->u4_pred_info_pkd_idx++;
  312|   347k|                            ps_cur_mb_info->u1_num_pred_parts++;
  313|   347k|                        }
  314|       |
  315|       |                        /* Storing colocated zero information */
  316|   347k|                        u1_colz = ((ABS(s_mvPred.i2_mv[0]) <= 1) && (ABS(s_mvPred.i2_mv[1]) <= 1)) +
  ------------------
  |  |  100|   347k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 22, False: 347k]
  |  |  ------------------
  ------------------
                                      u1_colz = ((ABS(s_mvPred.i2_mv[0]) <= 1) && (ABS(s_mvPred.i2_mv[1]) <= 1)) +
  ------------------
  |  |  100|   346k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 10, False: 346k]
  |  |  ------------------
  ------------------
  |  Branch (316:36): [True: 346k, False: 72]
  |  Branch (316:69): [True: 346k, False: 25]
  ------------------
  317|   347k|                                  (u1_field << 1);
  318|       |
  319|   347k|                        if(ps_mv_nmb_start)
  ------------------
  |  Branch (319:28): [True: 347k, False: 0]
  ------------------
  320|   347k|                        {
  321|   347k|                            ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb_start, 0, u1_colz, 4,
  322|   347k|                                               4);
  323|   347k|                        }
  324|      0|                        else
  325|      0|                        {
  326|      0|                            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  327|      0|                        }
  328|   347k|                    }
  329|  39.4k|                    else
  330|  39.4k|                    {
  331|  39.4k|                        u1_sub_mb_x = u1_sub_mb_num & 0x03;
  332|  39.4k|                        u1_sub_mb_y = u1_sub_mb_num >> 2;
  333|  39.4k|                        u1_blk_no = (u1_num_part < 4)
  ------------------
  |  Branch (333:37): [True: 17.8k, False: 21.6k]
  ------------------
  334|  39.4k|                                        ? j
  335|  39.4k|                                        : (((u1_sub_mb_y >> 1) << 1) + (u1_sub_mb_x >> 1));
  336|       |
  337|  39.4k|                        ps_mv_ntop = ps_mv_ntop_start + u1_sub_mb_x;
  338|  39.4k|                        ps_mv_nmb = ps_mv_nmb_start + u1_sub_mb_num;
  339|       |
  340|  39.4k|                        u1_wd = ps_part->u1_partwidth;
  341|  39.4k|                        u1_ht = ps_part->u1_partheight;
  342|       |
  343|       |                        /* Populate the colpic info and reference frames */
  344|  39.4k|                        i1_ref_idx = pi1_ref_idx[u1_blk_no];
  345|       |                        /********************************************************************/
  346|       |                        /* If reference index is inferred from the base layer and it is     */
  347|       |                        /* exceeding the number of active reference in the current layer.   */
  348|       |                        /* Then reference index is clipped to the max in the current layer  */
  349|       |                        /********************************************************************/
  350|  39.4k|                        if(ps_svc_cur_mb_info->u1_base_mode_flag == 1)
  ------------------
  |  Branch (350:28): [True: 6.05k, False: 33.4k]
  ------------------
  351|  6.05k|                        {
  352|  6.05k|                            if(i1_ref_idx > (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0] - 1))
  ------------------
  |  Branch (352:32): [True: 14, False: 6.04k]
  ------------------
  353|     14|                            {
  354|     14|                                i1_ref_idx = ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0] - 1;
  355|     14|                            }
  356|  6.05k|                        }
  357|  39.4k|                        s_mvPred.i1_ref_frame[0] = i1_ref_idx;
  358|       |
  359|  39.4k|                        if((1 != ps_svc_cur_mb_info->u1_base_mode_flag) &&
  ------------------
  |  Branch (359:28): [True: 33.4k, False: 6.05k]
  ------------------
  360|  33.4k|                           (0 == (u1_motion_pred_flag_l0 & (1 << u1_blk_no))))
  ------------------
  |  Branch (360:28): [True: 25.5k, False: 7.90k]
  ------------------
  361|  25.5k|                        {
  362|       |                            /********************************************************/
  363|       |                            /* Predict Mv                                           */
  364|       |                            /* Add Mv Residuals and store back                      */
  365|       |                            /********************************************************/
  366|  25.5k|                            ps_dec->pf_mvpred(ps_dec, ps_cur_mb_info, ps_mv_nmb, ps_mv_ntop,
  367|  25.5k|                                              &s_mvPred, u1_sub_mb_num, u1_wd, 0, 1,
  368|  25.5k|                                              ps_cur_mb_info->u1_mb_mc_mode);
  369|       |
  370|  25.5k|                            i2_mv_x = ps_mv_nmb->i2_mv[0];
  371|  25.5k|                            i2_mv_y = ps_mv_nmb->i2_mv[1];
  372|  25.5k|                            i2_mv_x += s_mvPred.i2_mv[0];
  373|  25.5k|                            i2_mv_y += s_mvPred.i2_mv[1];
  374|  25.5k|                            s_mvPred.i2_mv[0] = i2_mv_x;
  375|  25.5k|                            s_mvPred.i2_mv[1] = i2_mv_y;
  376|  25.5k|                        }
  377|  13.9k|                        else
  378|  13.9k|                        {
  379|  13.9k|                            isvcd_retrive_infer_mode_mv(ps_svc_lyr_dec, &s_mvPred, 0,
  380|  13.9k|                                                        u1_sub_mb_num);
  381|       |
  382|  13.9k|                            if(0 != (u1_motion_pred_flag_l0 & (1 << u1_blk_no)))
  ------------------
  |  Branch (382:32): [True: 7.90k, False: 6.05k]
  ------------------
  383|  7.90k|                            {
  384|  7.90k|                                i2_mv_x = ps_mv_nmb->i2_mv[0];
  385|  7.90k|                                i2_mv_y = ps_mv_nmb->i2_mv[1];
  386|  7.90k|                                i2_mv_x += s_mvPred.i2_mv[0];
  387|  7.90k|                                i2_mv_y += s_mvPred.i2_mv[1];
  388|  7.90k|                                s_mvPred.i2_mv[0] = i2_mv_x;
  389|  7.90k|                                s_mvPred.i2_mv[1] = i2_mv_y;
  390|  7.90k|                            }
  391|  13.9k|                            i2_mv_x = s_mvPred.i2_mv[0];
  392|  13.9k|                            i2_mv_y = s_mvPred.i2_mv[1];
  393|  13.9k|                        }
  394|       |                        /********************************************************/
  395|       |                        /* Transfer setup call                                  */
  396|       |                        /* convert RefIdx if it is MbAff                        */
  397|       |                        /* Pass Weight Offset and refFrame                      */
  398|       |                        /********************************************************/
  399|  39.4k|                        i1_ref_idx1 = i1_ref_idx >> u1_scale_ref;
  400|  39.4k|                        if(u1_scale_ref && ((i1_ref_idx & 0x01) != u4_bot_mb))
  ------------------
  |  Branch (400:28): [True: 0, False: 39.4k]
  |  Branch (400:44): [True: 0, False: 0]
  ------------------
  401|      0|                            i1_ref_idx1 += MAX_REF_BUFS;
  ------------------
  |  |   75|      0|#define MAX_REF_BUFS    32
  ------------------
  402|  39.4k|                        if(-1 == i1_ref_idx1) return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  |  Branch (402:28): [True: 0, False: 39.4k]
  ------------------
  403|  39.4k|                        ps_ref_frame = pps_ref_frame[i1_ref_idx1];
  404|  39.4k|                        pu4_wt_offst = ppu4_wt_ofst[u1_blk_no];
  405|       |
  406|  39.4k|                        {
  407|  39.4k|                            pred_info_pkd_t *ps_pred_pkd;
  408|  39.4k|                            ps_pred_pkd = ps_dec->ps_pred_pkd + ps_dec->u4_pred_info_pkd_idx;
  409|  39.4k|                            ih264d_fill_pred_info(s_mvPred.i2_mv, u1_wd, u1_ht, u1_sub_mb_num,
  410|  39.4k|                                                  PRED_L0, ps_pred_pkd, ps_ref_frame->u1_pic_buf_id,
  ------------------
  |  |  483|  39.4k|#define PRED_L0   1
  ------------------
  411|  39.4k|                                                  (i1_ref_idx >> u1_scale_ref), pu4_wt_offst,
  412|  39.4k|                                                  ps_ref_frame->u1_pic_type);
  413|       |
  414|  39.4k|                            ps_dec->u4_pred_info_pkd_idx++;
  415|  39.4k|                            ps_cur_mb_info->u1_num_pred_parts++;
  416|  39.4k|                        }
  417|       |
  418|       |                        /* Fill colocated info in MvPred structure */
  419|  39.4k|                        s_mvPred.u1_col_ref_pic_idx = ps_ref_frame->u1_mv_buf_id;
  420|  39.4k|                        s_mvPred.u1_pic_type = ps_ref_frame->u1_pic_type;
  421|       |
  422|       |                        /* Calculating colocated zero information */
  423|  39.4k|                        u1_colz = (u1_field << 1) |
  424|  39.4k|                                  ((i1_ref_idx == 0) && (ABS(i2_mv_x) <= 1) && (ABS(i2_mv_y) <= 1));
  ------------------
  |  |  100|  36.6k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 5.26k, False: 31.3k]
  |  |  ------------------
  ------------------
                                                ((i1_ref_idx == 0) && (ABS(i2_mv_x) <= 1) && (ABS(i2_mv_y) <= 1));
  ------------------
  |  |  100|  13.5k|#define ABS(x)          ((x) < 0 ? (-(x)) : (x))
  |  |  ------------------
  |  |  |  Branch (100:26): [True: 2.85k, False: 10.6k]
  |  |  ------------------
  ------------------
  |  Branch (424:36): [True: 36.6k, False: 2.83k]
  |  Branch (424:57): [True: 13.5k, False: 23.1k]
  |  Branch (424:80): [True: 9.05k, False: 4.45k]
  ------------------
  425|  39.4k|                        u1_colz |= ps_mb_part_info->u1_col_info[u1_blk_no];
  426|       |
  427|       |                        /* Replicate the motion vectors and colzero u4_flag  */
  428|       |                        /* for all sub-partitions                         */
  429|       |
  430|  39.4k|                        if(ps_mv_nmb)
  ------------------
  |  Branch (430:28): [True: 39.4k, False: 0]
  ------------------
  431|  39.4k|                        {
  432|  39.4k|                            ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb, u1_sub_mb_num, u1_colz,
  433|  39.4k|                                               u1_ht, u1_wd);
  434|  39.4k|                        }
  435|      0|                        else
  436|      0|                        {
  437|      0|                            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  438|      0|                        }
  439|  39.4k|                    }
  440|   386k|                }
  441|       |
  442|       |                /* to take care of 16 parttitions increment for base mode flag case*/
  443|   366k|                if(1 == ps_svc_cur_mb_info->u1_base_mode_flag)
  ------------------
  |  Branch (443:20): [True: 3.58k, False: 363k]
  ------------------
  444|  3.58k|                {
  445|  3.58k|                    ps_part += (MAX_NUM_MB_PART - u1_num_part);
  ------------------
  |  |   62|  3.58k|#define MAX_NUM_MB_PART NUM_MB_PARTS *NUM_SUB_MB_PARTS
  |  |  ------------------
  |  |  |  |   59|  3.58k|#define NUM_MB_PARTS 4
  |  |  ------------------
  |  |               #define MAX_NUM_MB_PART NUM_MB_PARTS *NUM_SUB_MB_PARTS
  |  |  ------------------
  |  |  |  |   60|  3.58k|#define NUM_SUB_MB_PARTS 4
  |  |  ------------------
  ------------------
  446|  3.58k|                }
  447|   366k|            }
  448|    123|            else
  449|    123|            {
  450|    123|                ps_cur_deblk_mb->u1_mb_type |= D_INTRA_IBL;
  ------------------
  |  |   72|    123|#define D_INTRA_IBL 16
  ------------------
  451|    123|                if((ps_svc_lyr_dec->u1_layer_identifier != TARGET_LAYER) &&
  ------------------
  |  |  110|    123|#define TARGET_LAYER 2
  ------------------
  |  Branch (451:20): [True: 0, False: 123]
  ------------------
  452|      0|                   (DBLK_ENABLED == ps_dec->ps_cur_slice->u1_disable_dblk_filter_idc))
  ------------------
  |  |  549|      0|#define DBLK_ENABLED                  0
  ------------------
  |  Branch (452:20): [True: 0, False: 0]
  ------------------
  453|      0|                {
  454|      0|                    ps_cur_deblk_mb->u1_deblocking_mode = MB_ENABLE_FILTERING;
  ------------------
  |  |   69|      0|#define MB_ENABLE_FILTERING           0x00
  ------------------
  455|      0|                }
  456|       |                /* to take care of 16 parttitions increment for base mode flag case*/
  457|    123|                if(1 != ps_svc_cur_mb_info->u1_base_mode_flag)
  ------------------
  |  Branch (457:20): [True: 0, False: 123]
  ------------------
  458|      0|                {
  459|      0|                    return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  460|      0|                }
  461|    123|                {
  462|    123|                    ps_part += (MAX_NUM_MB_PART);
  ------------------
  |  |   62|    123|#define MAX_NUM_MB_PART NUM_MB_PARTS *NUM_SUB_MB_PARTS
  |  |  ------------------
  |  |  |  |   59|    123|#define NUM_MB_PARTS 4
  |  |  ------------------
  |  |               #define MAX_NUM_MB_PART NUM_MB_PARTS *NUM_SUB_MB_PARTS
  |  |  ------------------
  |  |  |  |   60|    123|#define NUM_SUB_MB_PARTS 4
  |  |  ------------------
  ------------------
  463|    123|                }
  464|       |                /* Storing colocated zero information */
  465|    123|                if(ps_mv_nmb_start)
  ------------------
  |  Branch (465:20): [True: 123, False: 0]
  ------------------
  466|    123|                {
  467|    123|                    ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb_start, 0,
  468|    123|                                       (UWORD8) (u1_field << 1), 4, 4);
  469|    123|                }
  470|      0|                else
  471|      0|                {
  472|      0|                    return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  473|      0|                }
  474|    123|            }
  475|   366k|        }
  476|    523|        else
  477|    523|        {
  478|       |            /* Storing colocated zero information */
  479|    523|            if(ps_mv_nmb_start)
  ------------------
  |  Branch (479:16): [True: 523, False: 0]
  ------------------
  480|    523|            {
  481|    523|                ih264d_rep_mv_colz(ps_dec, &s_mvPred, ps_mv_nmb_start, 0, (UWORD8) (u1_field << 1),
  482|    523|                                   4, 4);
  483|    523|            }
  484|      0|            else
  485|      0|            {
  486|      0|                return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  487|      0|            }
  488|    523|        }
  489|   367k|    }
  490|       |
  491|  52.4k|    return OK;
  ------------------
  |  |  114|  52.4k|#define OK        0
  ------------------
  492|  52.4k|}
isvcd_update_intra_mb_inter_layer_info:
  507|  6.21k|{
  508|  6.21k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb =
  509|  6.21k|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start + ps_cur_mb_info->u2_mbx +
  510|  6.21k|        (ps_svc_lyr_dec->u2_inter_lyr_mb_prms_stride * (ps_cur_mb_info->u2_mby));
  511|       |
  512|  6.21k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_mb_mode = SVC_INTRA_MB;
  ------------------
  |  |  115|  6.21k|#define SVC_INTRA_MB (1 << 1)       /*!< P or B MBs decoded or inferred*/
  ------------------
  513|  6.21k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_tx_size = ps_cur_mb_info->u1_tran_form8x8;
  514|  6.21k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u2_luma_nnz = 0;
  515|  6.21k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz = 0;
  516|  6.21k|}
isvcd_update_ipcm_mb_inter_layer_info:
  532|     34|{
  533|     34|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_mb_mode = SVC_IPCM_MB;
  ------------------
  |  |  116|     34|#define SVC_IPCM_MB (1 << 2)        /*!< IPCM_MB  decoder or inferred*/
  ------------------
  534|     34|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_tx_size = ps_cur_mb_info->u1_tran_form8x8;
  535|     34|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u2_luma_nnz = 0;
  536|     34|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz = 0;
  537|     34|}
isvcd_update_ibl_mb_inter_layer_info:
  553|    123|{
  554|    123|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_mb_mode = SVC_IBL_MB;
  ------------------
  |  |  117|    123|#define SVC_IBL_MB (1 << 3)         /*!< I_BL MB always inferred */
  ------------------
  555|    123|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_tx_size = ps_cur_mb_info->u1_tran_form8x8;
  556|    123|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u2_luma_nnz = 0;
  557|    123|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz = 0;
  558|    123|}
isvcd_update_inter_mb_inter_layer_info:
  573|    965|{
  574|    965|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb =
  575|    965|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start + ps_cur_mb_info->u2_mbx +
  576|    965|        (ps_svc_lyr_dec->u2_inter_lyr_mb_prms_stride * (ps_cur_mb_info->u2_mby));
  577|    965|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_mb_mode =
  578|    965|        u1_inference_mode ? SVC_IBL_MB : SVC_INTER_MB;
  ------------------
  |  |  117|    123|#define SVC_IBL_MB (1 << 3)         /*!< I_BL MB always inferred */
  ------------------
                      u1_inference_mode ? SVC_IBL_MB : SVC_INTER_MB;
  ------------------
  |  |  114|  1.80k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (578:9): [True: 123, False: 842]
  ------------------
  579|    965|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_tx_size = ps_cur_mb_info->u1_tran_form8x8;
  580|    965|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u2_luma_nnz = ps_cur_mb_info->u2_luma_csbp;
  581|    965|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz =
  582|    965|        (UWORD8) ps_cur_mb_info->u2_chroma_csbp;
  583|    965|    if(CHECKBIT(ps_cur_mb_info->u1_yuv_dc_block_flag, 1))
  ------------------
  |  |   54|    965|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 72, False: 893]
  |  |  ------------------
  ------------------
  584|     72|    {
  585|       |        /* Four bits for Cb in DC only cbp */
  586|     72|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz |= 0x0F;
  587|     72|    }
  588|    965|    if(CHECKBIT(ps_cur_mb_info->u1_yuv_dc_block_flag, 2))
  ------------------
  |  |   54|    965|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 78, False: 887]
  |  |  ------------------
  ------------------
  589|     78|    {
  590|       |        /* Four bits for Cr in DC only cbp */
  591|     78|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz |= 0xF0;
  592|     78|    }
  593|    965|}
isvcd_process_inter_mb_no_rsd_pred_non_target:
  609|  8.02k|{
  610|  8.02k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  611|  8.02k|    UWORD16 u2_luma_stride, u2_chroma_stride;
  612|  8.02k|    WORD16 *pi2_y_coeff, *pi2_luma_res_ptr, *pi2_chroma_res_ptr;
  613|  8.02k|    UWORD32 u4_luma_dc_only_csbp = 0;
  614|  8.02k|    UWORD32 u4_luma_dc_only_cbp = 0;
  615|       |
  616|  8.02k|    if(0 != ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (616:8): [True: 0, False: 8.02k]
  ------------------
  617|      0|    {
  618|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  619|      0|    }
  620|  8.02k|    u2_luma_stride = ps_svc_lyr_dec->u2_residual_resample_luma_stride;
  621|  8.02k|    pi2_luma_res_ptr = ps_svc_lyr_dec->pi2_il_residual_resample_mb_luma_frm_start +
  622|  8.02k|                       (ps_cur_mb_info->u2_mbx << 4) +
  623|  8.02k|                       ((ps_cur_mb_info->u2_mby << 4) * u2_luma_stride);
  624|       |
  625|  8.02k|    u2_chroma_stride = ps_svc_lyr_dec->u2_residual_resample_chroma_stride;
  626|  8.02k|    pi2_chroma_res_ptr = ps_svc_lyr_dec->pi2_il_residual_resample_mb_chroma_frm_start +
  627|  8.02k|                         (ps_cur_mb_info->u2_mbx << 4) +
  628|  8.02k|                         ((ps_cur_mb_info->u2_mby << 3) * u2_chroma_stride);
  629|       |
  630|  8.02k|    if(!ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (630:8): [True: 4.47k, False: 3.55k]
  ------------------
  631|  4.47k|    {
  632|  4.47k|        u4_luma_dc_only_csbp = ih264d_unpack_luma_coeff4x4_mb(ps_dec, ps_cur_mb_info, 0);
  633|  4.47k|    }
  634|  3.55k|    else
  635|  3.55k|    {
  636|  3.55k|        if(!ps_dec->ps_cur_pps->u1_entropy_coding_mode)
  ------------------
  |  Branch (636:12): [True: 0, False: 3.55k]
  ------------------
  637|      0|        {
  638|      0|            u4_luma_dc_only_cbp = ih264d_unpack_luma_coeff4x4_mb(ps_dec, ps_cur_mb_info, 0);
  639|      0|        }
  640|  3.55k|        else
  641|  3.55k|        {
  642|  3.55k|            u4_luma_dc_only_cbp = ih264d_unpack_luma_coeff8x8_mb(ps_dec, ps_cur_mb_info);
  643|  3.55k|        }
  644|  3.55k|    }
  645|       |
  646|  8.02k|    pi2_y_coeff = ps_dec->pi2_coeff_data;
  647|       |    /* Inverse Transform and Reconstruction */
  648|  8.02k|    if(ps_cur_mb_info->u1_cbp & 0x0f)
  ------------------
  |  Branch (648:8): [True: 6.45k, False: 1.57k]
  ------------------
  649|  6.45k|    {
  650|  6.45k|        if(!ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (650:12): [True: 2.89k, False: 3.55k]
  ------------------
  651|  2.89k|        {
  652|  2.89k|            UWORD32 i;
  653|  2.89k|            WORD16 ai2_tmp[16] = {0};
  654|  49.2k|            for(i = 0; i < 16; i++)
  ------------------
  |  Branch (654:24): [True: 46.3k, False: 2.89k]
  ------------------
  655|  46.3k|            {
  656|  46.3k|                if(CHECKBIT(ps_cur_mb_info->u2_luma_csbp, i))
  ------------------
  |  |   54|  46.3k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 25.1k, False: 21.1k]
  |  |  ------------------
  ------------------
  657|  25.1k|                {
  658|  25.1k|                    WORD16 *pi2_level = pi2_y_coeff + (i << 4);
  659|  25.1k|                    WORD16 *pi2_out = pi2_luma_res_ptr + ((i & 0x3) * BLK_SIZE) +
  ------------------
  |  |  556|  25.1k|#define BLK_SIZE             4
  ------------------
  660|  25.1k|                                      (i >> 2) * (u2_luma_stride << 2);
  661|  25.1k|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  25.1k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
  662|  25.1k|                    {
  663|  25.1k|                        if(CHECKBIT(u4_luma_dc_only_csbp, i))
  ------------------
  |  |   54|  25.1k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 1.53k, False: 23.5k]
  |  |  ------------------
  ------------------
  664|  1.53k|                        {
  665|  1.53k|                            ps_svc_lyr_dec->pf_iquant_itrans_luma_4x4_dc(
  666|  1.53k|                                pi2_level, pi2_out, u2_luma_stride,
  667|  1.53k|                                gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6],
  668|  1.53k|                                (UWORD16 *) ps_dec->s_high_profile.i2_scalinglist4x4[3],
  669|  1.53k|                                ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0, NULL);
  670|  1.53k|                        }
  671|  23.5k|                        else
  672|  23.5k|                        {
  673|  23.5k|                            ps_svc_lyr_dec->pf_iquant_itrans_luma_4x4(
  674|  23.5k|                                pi2_level, pi2_out, u2_luma_stride,
  675|  23.5k|                                gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6],
  676|  23.5k|                                (UWORD16 *) ps_dec->s_high_profile.i2_scalinglist4x4[3],
  677|  23.5k|                                ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0, NULL);
  678|  23.5k|                        }
  679|  25.1k|                    }
  680|  25.1k|                }
  681|  46.3k|            }
  682|  2.89k|        }
  683|  3.55k|        else
  684|  3.55k|        {
  685|  3.55k|            WORD16 *pi2_scale_matrix_ptr;
  686|  3.55k|            WORD32 i;
  687|       |
  688|  3.55k|            pi2_scale_matrix_ptr = ps_dec->s_high_profile.i2_scalinglist8x8[1];
  689|       |
  690|  17.7k|            for(i = 0; i < 4; i++)
  ------------------
  |  Branch (690:24): [True: 14.2k, False: 3.55k]
  ------------------
  691|  14.2k|            {
  692|  14.2k|                WORD16 ai2_tmp[64] = {0};
  693|  14.2k|                WORD16 *pi16_levelBlock =
  694|  14.2k|                    pi2_y_coeff + (i << 6); /* move to the next 8x8 adding 64 */
  695|       |
  696|  14.2k|                WORD16 *pi2_out =
  697|  14.2k|                    pi2_luma_res_ptr + ((i & 0x1) * BLK8x8SIZE) + (i >> 1) * (u2_luma_stride << 3);
  ------------------
  |  |  555|  14.2k|#define BLK8x8SIZE          8
  ------------------
  698|  14.2k|                if(CHECKBIT(ps_cur_mb_info->u1_cbp, i))
  ------------------
  |  |   54|  14.2k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 8.41k, False: 5.80k]
  |  |  ------------------
  ------------------
  699|  8.41k|                {
  700|  8.41k|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  8.41k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
  701|  8.41k|                    {
  702|  8.41k|                        if(CHECKBIT(u4_luma_dc_only_cbp, i))
  ------------------
  |  |   54|  8.41k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 617, False: 7.80k]
  |  |  ------------------
  ------------------
  703|    617|                        {
  704|    617|                            ps_svc_lyr_dec->pf_iquant_itrans_luma_8x8_dc(
  705|    617|                                pi16_levelBlock, pi2_out, u2_luma_stride,
  706|    617|                                gau1_ih264d_dequant8x8_cavlc[ps_cur_mb_info->u1_qp_rem6],
  707|    617|                                (UWORD16 *) pi2_scale_matrix_ptr, ps_cur_mb_info->u1_qp_div6,
  708|    617|                                ai2_tmp, 0, NULL);
  709|    617|                        }
  710|  7.80k|                        else
  711|  7.80k|                        {
  712|  7.80k|                            ps_svc_lyr_dec->pf_iquant_itrans_luma_8x8(
  713|  7.80k|                                pi16_levelBlock, pi2_out, u2_luma_stride,
  714|  7.80k|                                gau1_ih264d_dequant8x8_cavlc[ps_cur_mb_info->u1_qp_rem6],
  715|  7.80k|                                (UWORD16 *) pi2_scale_matrix_ptr, ps_cur_mb_info->u1_qp_div6,
  716|  7.80k|                                ai2_tmp, 0, NULL);
  717|  7.80k|                        }
  718|  8.41k|                    }
  719|  8.41k|                }
  720|  14.2k|            }
  721|  3.55k|        }
  722|  6.45k|    }
  723|       |
  724|       |    /* Decode Chroma Block */
  725|  8.02k|    ih264d_unpack_chroma_coeff4x4_mb(ps_dec, ps_cur_mb_info);
  726|       |    /*--------------------------------------------------------------------*/
  727|       |    /* Chroma Blocks decoding                                             */
  728|       |    /*--------------------------------------------------------------------*/
  729|  8.02k|    {
  730|  8.02k|        UWORD8 u1_chroma_cbp = (UWORD8) (ps_cur_mb_info->u1_cbp >> 4);
  731|       |
  732|  8.02k|        if(u1_chroma_cbp != CBPC_ALLZERO)
  ------------------
  |  |  507|  8.02k|#define CBPC_ALLZERO    0
  ------------------
  |  Branch (732:12): [True: 1.99k, False: 6.03k]
  ------------------
  733|  1.99k|        {
  734|  1.99k|            UWORD32 u4_scale_u = ps_cur_mb_info->u1_qpc_div6;
  735|  1.99k|            UWORD32 u4_scale_v = ps_cur_mb_info->u1_qpcr_div6;
  736|  1.99k|            UWORD16 u2_chroma_csbp = ps_cur_mb_info->u2_chroma_csbp;
  737|       |
  738|  1.99k|            pi2_y_coeff = ps_dec->pi2_coeff_data;
  739|       |
  740|  1.99k|            {
  741|  1.99k|                UWORD32 i;
  742|  1.99k|                WORD16 ai2_tmp[16] = {0};
  743|  9.95k|                for(i = 0; i < 4; i++)
  ------------------
  |  Branch (743:28): [True: 7.96k, False: 1.99k]
  ------------------
  744|  7.96k|                {
  745|  7.96k|                    WORD16 *pi2_level = pi2_y_coeff + (i << 4);
  746|  7.96k|                    WORD16 *pi2_out = pi2_chroma_res_ptr +
  747|  7.96k|                                      ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR) +
  ------------------
  |  |  556|  7.96k|#define BLK_SIZE             4
  ------------------
                                                    ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR) +
  ------------------
  |  |  119|  7.96k|#define YUV420SP_FACTOR 2
  ------------------
  748|  7.96k|                                      (i >> 1) * (u2_chroma_stride << 2);
  749|  7.96k|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  7.96k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
  750|  7.96k|                    {
  751|  7.96k|                        if(CHECKBIT(u2_chroma_csbp, i))
  ------------------
  |  |   54|  7.96k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 928, False: 7.03k]
  |  |  ------------------
  ------------------
  752|    928|                        {
  753|    928|                            ps_svc_lyr_dec->pf_iquant_itrans_chroma_4x4(
  754|    928|                                pi2_level, pi2_out, u2_chroma_stride,
  755|    928|                                gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpc_rem6],
  756|    928|                                (UWORD16 *) ps_dec->s_high_profile.i2_scalinglist4x4[4], u4_scale_u,
  757|    928|                                ai2_tmp, pi2_level);
  758|    928|                        }
  759|  7.03k|                        else if(pi2_level[0] != 0)
  ------------------
  |  Branch (759:33): [True: 3.07k, False: 3.95k]
  ------------------
  760|  3.07k|                        {
  761|  3.07k|                            ps_svc_lyr_dec->pf_iquant_itrans_chroma_4x4_dc(
  762|  3.07k|                                pi2_level, pi2_out, u2_chroma_stride,
  763|  3.07k|                                gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpc_rem6],
  764|  3.07k|                                (UWORD16 *) ps_dec->s_high_profile.i2_scalinglist4x4[4], u4_scale_u,
  765|  3.07k|                                ai2_tmp, pi2_level);
  766|  3.07k|                        }
  767|  7.96k|                    }
  768|  7.96k|                }
  769|  1.99k|            }
  770|       |
  771|  1.99k|            pi2_y_coeff += MB_CHROM_SIZE;
  ------------------
  |  |  564|  1.99k|#define MB_CHROM_SIZE                 64
  ------------------
  772|  1.99k|            u2_chroma_csbp >>= 4;
  773|       |
  774|  1.99k|            {
  775|  1.99k|                UWORD32 i;
  776|  1.99k|                WORD16 ai2_tmp[16] = {0};
  777|  9.95k|                for(i = 0; i < 4; i++)
  ------------------
  |  Branch (777:28): [True: 7.96k, False: 1.99k]
  ------------------
  778|  7.96k|                {
  779|  7.96k|                    WORD16 *pi2_level = pi2_y_coeff + (i << 4);
  780|  7.96k|                    WORD16 *pi2_out = pi2_chroma_res_ptr + 1 +
  781|  7.96k|                                      ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR) +
  ------------------
  |  |  556|  7.96k|#define BLK_SIZE             4
  ------------------
                                                    ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR) +
  ------------------
  |  |  119|  7.96k|#define YUV420SP_FACTOR 2
  ------------------
  782|  7.96k|                                      (i >> 1) * (u2_chroma_stride << 2);
  783|  7.96k|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  7.96k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
  784|  7.96k|                    {
  785|  7.96k|                        if(CHECKBIT(u2_chroma_csbp, i))
  ------------------
  |  |   54|  7.96k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 1.32k, False: 6.63k]
  |  |  ------------------
  ------------------
  786|  1.32k|                        {
  787|  1.32k|                            ps_svc_lyr_dec->pf_iquant_itrans_chroma_4x4(
  788|  1.32k|                                pi2_level, pi2_out, u2_chroma_stride,
  789|  1.32k|                                gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpcr_rem6],
  790|  1.32k|                                (UWORD16 *) ps_dec->s_high_profile.i2_scalinglist4x4[5], u4_scale_v,
  791|  1.32k|                                ai2_tmp, pi2_level);
  792|  1.32k|                        }
  793|  6.63k|                        else if(pi2_level[0] != 0)
  ------------------
  |  Branch (793:33): [True: 3.34k, False: 3.29k]
  ------------------
  794|  3.34k|                        {
  795|  3.34k|                            ps_svc_lyr_dec->pf_iquant_itrans_chroma_4x4_dc(
  796|  3.34k|                                pi2_level, pi2_out, u2_chroma_stride,
  797|  3.34k|                                gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpcr_rem6],
  798|  3.34k|                                (UWORD16 *) ps_dec->s_high_profile.i2_scalinglist4x4[5], u4_scale_v,
  799|  3.34k|                                ai2_tmp, pi2_level);
  800|  3.34k|                        }
  801|  7.96k|                    }
  802|  7.96k|                }
  803|  1.99k|            }
  804|  1.99k|        }
  805|  8.02k|    }
  806|       |
  807|  8.02k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb =
  808|  8.02k|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start + ps_cur_mb_info->u2_mbx +
  809|  8.02k|        (ps_svc_lyr_dec->u2_inter_lyr_mb_prms_stride * (ps_cur_mb_info->u2_mby));
  810|  8.02k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_mb_mode =
  811|  8.02k|        u1_inference_mode ? SVC_IBL_MB : SVC_INTER_MB;
  ------------------
  |  |  117|      0|#define SVC_IBL_MB (1 << 3)         /*!< I_BL MB always inferred */
  ------------------
                      u1_inference_mode ? SVC_IBL_MB : SVC_INTER_MB;
  ------------------
  |  |  114|  16.0k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (811:9): [True: 0, False: 8.02k]
  ------------------
  812|  8.02k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_tx_size = ps_cur_mb_info->u1_tran_form8x8;
  813|  8.02k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u2_luma_nnz = ps_cur_mb_info->u2_luma_csbp;
  814|  8.02k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz =
  815|  8.02k|        (UWORD8) ps_cur_mb_info->u2_chroma_csbp;
  816|  8.02k|    if(CHECKBIT(ps_cur_mb_info->u1_yuv_dc_block_flag, 1))
  ------------------
  |  |   54|  8.02k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 1.01k, False: 7.01k]
  |  |  ------------------
  ------------------
  817|  1.01k|    {
  818|       |        /* Four bits for Cb in DC only cbp */
  819|  1.01k|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz |= 0x0F;
  820|  1.01k|    }
  821|  8.02k|    if(CHECKBIT(ps_cur_mb_info->u1_yuv_dc_block_flag, 2))
  ------------------
  |  |   54|  8.02k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 1.08k, False: 6.94k]
  |  |  ------------------
  ------------------
  822|  1.08k|    {
  823|       |        /* Four bits for Cr in DC only cbp */
  824|  1.08k|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz |= 0xF0;
  825|  1.08k|    }
  826|  8.02k|    return OK;
  ------------------
  |  |  114|  8.02k|#define OK        0
  ------------------
  827|  8.02k|}
isvcd_process_ii_mb:
 1120|  1.03k|{
 1121|  1.03k|    res_prms_t *ps_res_prms;
 1122|  1.03k|    WORD32 i4_status;
 1123|  1.03k|    UWORD8 u1_ii_mb_mode = 0;
 1124|  1.03k|    mb_coord_t s_mb_coord = {0};
 1125|  1.03k|    mem_element_t s_ref_mb_mode = {0};
 1126|  1.03k|    svc_dec_lyr_struct_t *ps_svc_dec_ref_layer;
 1127|       |
 1128|  1.03k|    ps_svc_dec_ref_layer = ps_svc_lyr_dec->ps_dec_svc_ref_layer;
 1129|  1.03k|    ps_res_prms = &ps_svc_lyr_dec->s_res_prms;
 1130|  1.03k|    s_mb_coord.u2_mb_x = ps_cur_mb_info->u2_mbx;
 1131|  1.03k|    s_mb_coord.u2_mb_y = ps_cur_mb_info->u2_mby;
 1132|       |
 1133|       |    /* Restricted resolution change has significance only */
 1134|       |    /* at resolution change layer                         */
 1135|  1.03k|    if(SVCD_FALSE == ps_res_prms->u1_rstrct_res_change_flag)
  ------------------
  |  |   45|  1.03k|#define SVCD_FALSE 0
  ------------------
  |  Branch (1135:8): [True: 1.03k, False: 0]
  ------------------
 1136|  1.03k|    {
 1137|  1.03k|        s_ref_mb_mode.pv_buffer = ps_svc_dec_ref_layer->ps_inter_lyr_mb_prms_frm_start;
 1138|  1.03k|        s_ref_mb_mode.i4_element_size = sizeof(inter_lyr_mb_prms_t);
 1139|  1.03k|        s_ref_mb_mode.i4_num_element_stride = ps_svc_dec_ref_layer->u2_inter_lyr_mb_prms_stride;
 1140|       |
 1141|  1.03k|        i4_status = isvcd_ii_pred_compute_flags_mb(ps_svc_lyr_dec->pv_ii_pred_ctxt, &s_ref_mb_mode,
 1142|  1.03k|                                                   &s_mb_coord, ps_cur_mb_info, ps_svc_cur_mb_info,
 1143|  1.03k|                                                   &u1_ii_mb_mode);
 1144|       |
 1145|  1.03k|        if(OK != i4_status)
  ------------------
  |  |  114|  1.03k|#define OK        0
  ------------------
  |  Branch (1145:12): [True: 0, False: 1.03k]
  ------------------
 1146|      0|        {
 1147|      0|            return i4_status;
 1148|      0|        }
 1149|  1.03k|    }
 1150|       |
 1151|  1.03k|    if(SVC_INTRA_INTER_MB == u1_ii_mb_mode)
  ------------------
  |  |  118|  1.03k|#define SVC_INTRA_INTER_MB (1 << 4) /*!< Intra Inter MB */
  ------------------
  |  Branch (1151:8): [True: 298, False: 740]
  ------------------
 1152|    298|    {
 1153|    298|        i4_status = isvcd_process_ibl_mb(ps_svc_lyr_dec, ps_cur_mb_info, u1_mb_num, 1);
 1154|    298|        if(OK != i4_status)
  ------------------
  |  |  114|    298|#define OK        0
  ------------------
  |  Branch (1154:12): [True: 0, False: 298]
  ------------------
 1155|      0|        {
 1156|      0|            return i4_status;
 1157|      0|        }
 1158|    298|        isvcd_ii_pred_mb(ps_svc_lyr_dec, ps_cur_mb_info);
 1159|    298|    }
 1160|  1.03k|    return OK;
  ------------------
  |  |  114|  1.03k|#define OK        0
  ------------------
 1161|  1.03k|}
isvcd_decode_recon_tfr_nmb_non_base_lyr:
 1177|  2.05k|{
 1178|  2.05k|    WORD32 i, j;
 1179|  2.05k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1180|  2.05k|    UWORD32 u1_end_of_row_next;
 1181|  2.05k|    dec_mb_info_t *ps_cur_mb_info;
 1182|  2.05k|    dec_svc_mb_info_t *ps_svc_cur_mb_info;
 1183|  2.05k|    UWORD16 *pu2_res_luma_csbp;
 1184|  2.05k|    const UWORD32 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
 1185|  2.05k|    const UWORD32 u1_slice_type = ps_dec->ps_cur_slice->u1_slice_type;
 1186|  2.05k|    const WORD32 u1_skip_th =
 1187|  2.05k|        ((u1_slice_type != I_SLICE) ? (ps_dec->u1_B ? B_8x8 : PRED_8x8R0) : -1);
  ------------------
  |  |  370|  2.05k|#define I_SLICE  2
  ------------------
                      ((u1_slice_type != I_SLICE) ? (ps_dec->u1_B ? B_8x8 : PRED_8x8R0) : -1);
  ------------------
  |  |  480|     89|#define B_8x8    22
  ------------------
                      ((u1_slice_type != I_SLICE) ? (ps_dec->u1_B ? B_8x8 : PRED_8x8R0) : -1);
  ------------------
  |  |  454|  1.96k|#define PRED_8x8R0  4
  ------------------
  |  Branch (1187:10): [True: 2.05k, False: 0]
  |  Branch (1187:40): [True: 89, False: 1.96k]
  ------------------
 1188|  2.05k|    const UWORD32 u1_ipcm_th = ((u1_slice_type != I_SLICE) ? (ps_dec->u1_B ? 23 : 5) : 0);
  ------------------
  |  |  370|  2.05k|#define I_SLICE  2
  ------------------
  |  Branch (1188:33): [True: 2.05k, False: 0]
  |  Branch (1188:63): [True: 89, False: 1.96k]
  ------------------
 1189|  2.05k|    WORD32 ret = OK;
  ------------------
  |  |  114|  2.05k|#define OK        0
  ------------------
 1190|       |
 1191|  2.05k|    if(!((0 == ps_svc_lyr_dec->u1_base_res_flag) ||
  ------------------
  |  Branch (1191:10): [True: 2.05k, False: 0]
  ------------------
 1192|      0|         ((1 == ps_svc_lyr_dec->u1_base_res_flag) &&
  ------------------
  |  Branch (1192:11): [True: 0, False: 0]
  ------------------
 1193|      0|          (1 == ps_svc_lyr_dec->ps_nal_svc_ext->u1_no_inter_layer_pred_flag))))
  ------------------
  |  Branch (1193:11): [True: 0, False: 0]
  ------------------
 1194|      0|    {
 1195|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1196|      0|    }
 1197|       |    /* N Mb MC Loop */
 1198|  10.0k|    for(i = u4_mb_idx; i < u4_num_mbs; i++)
  ------------------
  |  Branch (1198:24): [True: 7.99k, False: 2.05k]
  ------------------
 1199|  7.99k|    {
 1200|  7.99k|        ps_cur_mb_info = ps_dec->ps_nmb_info + i;
 1201|  7.99k|        ps_dec->u4_dma_buf_idx = 0;
 1202|  7.99k|        ps_dec->u4_pred_info_idx = 0;
 1203|       |
 1204|       |        /*Pointer assignment for Residual NNZ */
 1205|  7.99k|        pu2_res_luma_csbp = ps_svc_lyr_dec->pu2_frm_res_luma_csbp + ps_cur_mb_info->u2_mbx;
 1206|  7.99k|        pu2_res_luma_csbp += ps_cur_mb_info->u2_mby * ps_svc_lyr_dec->i4_frm_res_luma_csbp_stride;
 1207|       |
 1208|  7.99k|        if(ps_cur_mb_info->u1_mb_type <= u1_skip_th)
  ------------------
  |  Branch (1208:12): [True: 7.32k, False: 672]
  ------------------
 1209|  7.32k|        {
 1210|  7.32k|            {
 1211|  7.32k|                WORD32 pred_cnt = 0;
 1212|  7.32k|                pred_info_pkd_t *ps_pred_pkd;
 1213|  7.32k|                UWORD32 u4_pred_info_pkd_idx;
 1214|       |
 1215|  7.32k|                u4_pred_info_pkd_idx = ps_cur_mb_info->u4_pred_info_pkd_idx;
 1216|       |
 1217|  31.0k|                while(pred_cnt < ps_cur_mb_info->u1_num_pred_parts)
  ------------------
  |  Branch (1217:23): [True: 23.7k, False: 7.32k]
  ------------------
 1218|  23.7k|                {
 1219|  23.7k|                    ps_pred_pkd = ps_dec->ps_pred_pkd + u4_pred_info_pkd_idx;
 1220|       |
 1221|  23.7k|                    ps_dec->p_form_mb_part_info(ps_pred_pkd, ps_dec, ps_cur_mb_info->u2_mbx,
 1222|  23.7k|                                                ps_cur_mb_info->u2_mby, (i >> u1_mbaff),
 1223|  23.7k|                                                ps_cur_mb_info);
 1224|  23.7k|                    u4_pred_info_pkd_idx++;
 1225|  23.7k|                    pred_cnt++;
 1226|  23.7k|                }
 1227|  7.32k|            }
 1228|  7.32k|            if(ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER)
  ------------------
  |  |  110|  7.32k|#define TARGET_LAYER 2
  ------------------
  |  Branch (1228:16): [True: 7.32k, False: 0]
  ------------------
 1229|  7.32k|            {
 1230|  7.32k|                ps_dec->p_motion_compensate(ps_dec, ps_cur_mb_info);
 1231|  7.32k|            }
 1232|  7.32k|        }
 1233|    672|        else if(ps_cur_mb_info->u1_mb_type == MB_SKIP)
  ------------------
  |  |   59|    672|#define MB_SKIP 255
  ------------------
  |  Branch (1233:17): [True: 464, False: 208]
  ------------------
 1234|    464|        {
 1235|    464|            {
 1236|    464|                WORD32 pred_cnt = 0;
 1237|    464|                pred_info_pkd_t *ps_pred_pkd;
 1238|    464|                UWORD32 u4_pred_info_pkd_idx;
 1239|       |
 1240|    464|                u4_pred_info_pkd_idx = ps_cur_mb_info->u4_pred_info_pkd_idx;
 1241|       |
 1242|  1.07k|                while(pred_cnt < ps_cur_mb_info->u1_num_pred_parts)
  ------------------
  |  Branch (1242:23): [True: 609, False: 464]
  ------------------
 1243|    609|                {
 1244|    609|                    ps_pred_pkd = ps_dec->ps_pred_pkd + u4_pred_info_pkd_idx;
 1245|       |
 1246|    609|                    ps_dec->p_form_mb_part_info(ps_pred_pkd, ps_dec, ps_cur_mb_info->u2_mbx,
 1247|    609|                                                ps_cur_mb_info->u2_mby, (i >> u1_mbaff),
 1248|    609|                                                ps_cur_mb_info);
 1249|       |
 1250|    609|                    u4_pred_info_pkd_idx++;
 1251|    609|                    pred_cnt++;
 1252|    609|                }
 1253|    464|            }
 1254|    464|            if(ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER)
  ------------------
  |  |  110|    464|#define TARGET_LAYER 2
  ------------------
  |  Branch (1254:16): [True: 464, False: 0]
  ------------------
 1255|    464|            {
 1256|       |                /* Decode MB skip */
 1257|    464|                ps_dec->p_motion_compensate(ps_dec, ps_cur_mb_info);
 1258|    464|            }
 1259|       |
 1260|    464|            *pu2_res_luma_csbp = 0;
 1261|    464|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb =
 1262|    464|                ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start + ps_cur_mb_info->u2_mbx +
 1263|    464|                (ps_svc_lyr_dec->u2_inter_lyr_mb_prms_stride * (ps_cur_mb_info->u2_mby));
 1264|    464|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_mb_mode = SVC_INTER_MB;
  ------------------
  |  |  114|    464|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
 1265|    464|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_tx_size =
 1266|    464|                ps_cur_mb_info->u1_tran_form8x8;
 1267|    464|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u2_luma_nnz = 0;
 1268|    464|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz = 0;
 1269|    464|        }
 1270|  7.99k|    }
 1271|       |
 1272|       |    /* N Mb IQ IT RECON  Loop */
 1273|  10.0k|    for(j = u4_mb_idx; j < i; j++)
  ------------------
  |  Branch (1273:24): [True: 7.99k, False: 2.05k]
  ------------------
 1274|  7.99k|    {
 1275|  7.99k|        ps_cur_mb_info = ps_dec->ps_nmb_info + j;
 1276|  7.99k|        ps_svc_cur_mb_info = ps_svc_lyr_dec->ps_svc_nmb_info + j;
 1277|       |
 1278|  7.99k|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb =
 1279|  7.99k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start + ps_cur_mb_info->u2_mbx +
 1280|  7.99k|            (ps_svc_lyr_dec->u2_inter_lyr_mb_prms_stride * (ps_cur_mb_info->u2_mby));
 1281|       |
 1282|  7.99k|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_slice_id = (WORD8) ps_dec->u2_cur_slice_num;
 1283|       |
 1284|       |        /*Pointer assignment for Residual NNZ */
 1285|  7.99k|        pu2_res_luma_csbp = ps_svc_lyr_dec->pu2_frm_res_luma_csbp + ps_cur_mb_info->u2_mbx;
 1286|  7.99k|        pu2_res_luma_csbp += ps_cur_mb_info->u2_mby * ps_svc_lyr_dec->i4_frm_res_luma_csbp_stride;
 1287|       |
 1288|  7.99k|        if(ps_cur_mb_info->u1_mb_type <= u1_skip_th)
  ------------------
  |  Branch (1288:12): [True: 7.32k, False: 672]
  ------------------
 1289|  7.32k|        {
 1290|  7.32k|            if(ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER)
  ------------------
  |  |  110|  7.32k|#define TARGET_LAYER 2
  ------------------
  |  Branch (1290:16): [True: 7.32k, False: 0]
  ------------------
 1291|  7.32k|            {
 1292|       |                /* inter intra pred generation */
 1293|  7.32k|                if(SVCD_FALSE == ps_svc_lyr_dec->u1_dyadic_flag)
  ------------------
  |  |   45|  7.32k|#define SVCD_FALSE 0
  ------------------
  |  Branch (1293:20): [True: 446, False: 6.87k]
  ------------------
 1294|    446|                {
 1295|    446|                    ret =
 1296|    446|                        isvcd_process_ii_mb(ps_svc_lyr_dec, ps_cur_mb_info, ps_svc_cur_mb_info, j);
 1297|    446|                    if(ret != OK) return ret;
  ------------------
  |  |  114|    446|#define OK        0
  ------------------
  |  Branch (1297:24): [True: 0, False: 446]
  ------------------
 1298|    446|                }
 1299|  7.32k|                if(0 == ps_svc_cur_mb_info->u1_residual_prediction_flag)
  ------------------
  |  Branch (1299:20): [True: 268, False: 7.05k]
  ------------------
 1300|    268|                {
 1301|       |                    // IT + Recon
 1302|    268|                    ih264d_process_inter_mb(ps_dec, ps_cur_mb_info, j);
 1303|    268|                    isvcd_update_inter_mb_inter_layer_info(ps_svc_lyr_dec, ps_cur_mb_info, 0);
 1304|    268|                    *pu2_res_luma_csbp = ps_cur_mb_info->u2_luma_csbp;
 1305|    268|                }
 1306|  7.05k|                else
 1307|  7.05k|                {
 1308|       |                    // IT + Residual + Recon
 1309|  7.05k|                    ret = isvcd_process_inter_mb_rsd_pred_target_lyr(ps_svc_lyr_dec, ps_cur_mb_info,
 1310|  7.05k|                                                                     j, 0, pu2_res_luma_csbp);
 1311|  7.05k|                    if(ret != OK) return ret;
  ------------------
  |  |  114|  7.05k|#define OK        0
  ------------------
  |  Branch (1311:24): [True: 0, False: 7.05k]
  ------------------
 1312|  7.05k|                }
 1313|  7.32k|            }
 1314|      0|            else if(ps_svc_lyr_dec->u1_layer_identifier == MEDIAL_ENHANCEMENT_LAYER)
  ------------------
  |  |  109|      0|#define MEDIAL_ENHANCEMENT_LAYER 1
  ------------------
  |  Branch (1314:21): [True: 0, False: 0]
  ------------------
 1315|      0|            {
 1316|      0|                if(0 == ps_svc_cur_mb_info->u1_residual_prediction_flag)
  ------------------
  |  Branch (1316:20): [True: 0, False: 0]
  ------------------
 1317|      0|                {
 1318|       |                    // IT : to be consumed by Target
 1319|      0|                    ret = isvcd_process_inter_mb_no_rsd_pred_non_target(ps_svc_lyr_dec,
 1320|      0|                                                                        ps_cur_mb_info, 0);
 1321|      0|                    *pu2_res_luma_csbp = ps_cur_mb_info->u2_luma_csbp;
 1322|      0|                    if(ret != OK) return ret;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (1322:24): [True: 0, False: 0]
  ------------------
 1323|      0|                }
 1324|      0|                else
 1325|      0|                {
 1326|       |                    // IT + Residual : to be consumed by target
 1327|      0|                    ret = isvcd_process_inter_mb_rsd_pred_non_target(ps_svc_lyr_dec, ps_cur_mb_info,
 1328|      0|                                                                     0, pu2_res_luma_csbp);
 1329|      0|                    if(ret != OK) return ret;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (1329:24): [True: 0, False: 0]
  ------------------
 1330|      0|                }
 1331|      0|            }
 1332|      0|            else
 1333|      0|            {
 1334|      0|                return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1335|      0|            }
 1336|  7.32k|        }
 1337|    672|        else if((ps_cur_mb_info->u1_mb_type != MB_SKIP) && (ps_cur_mb_info->u1_mb_type != MB_INFER))
  ------------------
  |  |   59|    672|#define MB_SKIP 255
  ------------------
                      else if((ps_cur_mb_info->u1_mb_type != MB_SKIP) && (ps_cur_mb_info->u1_mb_type != MB_INFER))
  ------------------
  |  |  112|    208|#define MB_INFER 250
  ------------------
  |  Branch (1337:17): [True: 208, False: 464]
  |  Branch (1337:60): [True: 208, False: 0]
  ------------------
 1338|    208|        {
 1339|    208|            if((u1_ipcm_th + 25) != ps_cur_mb_info->u1_mb_type)
  ------------------
  |  Branch (1339:16): [True: 175, False: 33]
  ------------------
 1340|    175|            {
 1341|    175|                ps_cur_mb_info->u1_mb_type -= (u1_skip_th + 1);
 1342|    175|                ih264d_process_intra_mb(ps_dec, ps_cur_mb_info, j);
 1343|    175|                isvcd_update_intra_mb_inter_layer_info(ps_svc_lyr_dec, ps_cur_mb_info);
 1344|    175|            }
 1345|     33|            else
 1346|     33|            {
 1347|     33|                isvcd_update_ipcm_mb_inter_layer_info(ps_svc_lyr_dec, ps_cur_mb_info);
 1348|     33|            }
 1349|    208|            *pu2_res_luma_csbp = 0;
 1350|    208|        }
 1351|    464|        else if(ps_cur_mb_info->u1_mb_type == MB_INFER)
  ------------------
  |  |  112|    464|#define MB_INFER 250
  ------------------
  |  Branch (1351:17): [True: 0, False: 464]
  ------------------
 1352|      0|        {
 1353|       |            /* inter layer intra prediction : intra upsample, IQ, IT ,deblock */
 1354|       |            /* Intra resample for IBL mode */
 1355|      0|            ret = isvcd_process_ibl_mb(ps_svc_lyr_dec, ps_cur_mb_info, j, 0);
 1356|      0|            if(ret != OK) return ret;
  ------------------
  |  |  114|      0|#define OK        0
  ------------------
  |  Branch (1356:16): [True: 0, False: 0]
  ------------------
 1357|      0|            ih264d_process_inter_mb(ps_dec, ps_cur_mb_info, j);
 1358|      0|            isvcd_update_inter_mb_inter_layer_info(ps_svc_lyr_dec, ps_cur_mb_info, 1);
 1359|      0|            *pu2_res_luma_csbp = ps_cur_mb_info->u2_luma_csbp;
 1360|       |
 1361|      0|            ps_dec->pi1_left_pred_mode[0] = DC;
  ------------------
  |  |  431|      0|#define DC      2
  ------------------
 1362|      0|            ps_dec->pi1_left_pred_mode[1] = DC;
  ------------------
  |  |  431|      0|#define DC      2
  ------------------
 1363|      0|            ps_dec->pi1_left_pred_mode[2] = DC;
  ------------------
  |  |  431|      0|#define DC      2
  ------------------
 1364|      0|            ps_dec->pi1_left_pred_mode[3] = DC;
  ------------------
  |  |  431|      0|#define DC      2
  ------------------
 1365|       |
 1366|      0|            ps_cur_mb_info->ps_curmb->pi1_intrapredmodes[0] = DC;
  ------------------
  |  |  431|      0|#define DC      2
  ------------------
 1367|      0|            ps_cur_mb_info->ps_curmb->pi1_intrapredmodes[1] = DC;
  ------------------
  |  |  431|      0|#define DC      2
  ------------------
 1368|      0|            ps_cur_mb_info->ps_curmb->pi1_intrapredmodes[2] = DC;
  ------------------
  |  |  431|      0|#define DC      2
  ------------------
 1369|      0|            ps_cur_mb_info->ps_curmb->pi1_intrapredmodes[3] = DC;
  ------------------
  |  |  431|      0|#define DC      2
  ------------------
 1370|       |
 1371|      0|            isvcd_update_ibl_mb_inter_layer_info(ps_svc_lyr_dec, ps_cur_mb_info);
 1372|      0|        }
 1373|       |
 1374|  7.99k|        if(ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER)
  ------------------
  |  |  110|  7.99k|#define TARGET_LAYER 2
  ------------------
  |  Branch (1374:12): [True: 7.99k, False: 0]
  ------------------
 1375|  7.99k|        {
 1376|  7.99k|            if(ps_dec->u4_num_cores < 3)
  ------------------
  |  Branch (1376:16): [True: 7.99k, False: 0]
  ------------------
 1377|  7.99k|            {
 1378|  7.99k|                if(ps_dec->u4_app_disable_deblk_frm == 0)
  ------------------
  |  Branch (1378:20): [True: 7.99k, False: 0]
  ------------------
 1379|  7.99k|                    ps_svc_lyr_dec->pf_svc_compute_bs(ps_svc_lyr_dec, ps_cur_mb_info,
 1380|  7.99k|                                                      (UWORD16) (j >> u1_mbaff));
 1381|  7.99k|            }
 1382|  7.99k|        }
 1383|      0|        else if(ps_svc_lyr_dec->u1_layer_identifier == MEDIAL_ENHANCEMENT_LAYER)
  ------------------
  |  |  109|      0|#define MEDIAL_ENHANCEMENT_LAYER 1
  ------------------
  |  Branch (1383:17): [True: 0, False: 0]
  ------------------
 1384|      0|        {
 1385|      0|            if(ps_dec->u4_num_cores < 3)
  ------------------
  |  Branch (1385:16): [True: 0, False: 0]
  ------------------
 1386|      0|            {
 1387|      0|                if(ps_dec->u4_app_disable_deblk_frm == 0)
  ------------------
  |  Branch (1387:20): [True: 0, False: 0]
  ------------------
 1388|      0|                    ps_svc_lyr_dec->pf_svc_compute_bs(ps_svc_lyr_dec, ps_cur_mb_info,
 1389|      0|                                                      (UWORD16) (j >> u1_mbaff));
 1390|      0|            }
 1391|      0|        }
 1392|       |
 1393|  7.99k|        if(ps_dec->u4_use_intrapred_line_copy)
  ------------------
  |  Branch (1393:12): [True: 7.99k, False: 0]
  ------------------
 1394|  7.99k|        {
 1395|  7.99k|            ih264d_copy_intra_pred_line(ps_dec, ps_cur_mb_info, j);
 1396|  7.99k|        }
 1397|  7.99k|    }
 1398|       |
 1399|       |    /*MB deblocking*/
 1400|  2.05k|    if(ps_dec->u4_nmb_deblk == 1)
  ------------------
  |  Branch (1400:8): [True: 2.05k, False: 0]
  ------------------
 1401|  2.05k|    {
 1402|  2.05k|        UWORD32 u4_wd_y, u4_wd_uv;
 1403|  2.05k|        tfr_ctxt_t *ps_tfr_cxt = &(ps_dec->s_tran_addrecon);
 1404|  2.05k|        UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag;
 1405|  2.05k|        const WORD32 i4_cb_qp_idx_ofst = ps_dec->ps_cur_pps->i1_chroma_qp_index_offset;
 1406|  2.05k|        const WORD32 i4_cr_qp_idx_ofst = ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset;
 1407|       |
 1408|  2.05k|        u4_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag;
 1409|  2.05k|        u4_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag;
 1410|       |
 1411|  2.05k|        ps_cur_mb_info = ps_dec->ps_nmb_info + u4_mb_idx;
 1412|       |
 1413|  2.05k|        ps_dec->u4_deblk_mb_x = ps_cur_mb_info->u2_mbx;
 1414|  2.05k|        ps_dec->u4_deblk_mb_y = ps_cur_mb_info->u2_mby;
 1415|       |
 1416|  10.0k|        for(j = u4_mb_idx; j < i; j++)
  ------------------
  |  Branch (1416:28): [True: 7.99k, False: 2.05k]
  ------------------
 1417|  7.99k|        {
 1418|  7.99k|            if(ps_dec->u4_cur_deblk_mb_num > ps_dec->ps_cur_sps->u4_max_mb_addr)
  ------------------
  |  Branch (1418:16): [True: 0, False: 7.99k]
  ------------------
 1419|      0|            {
 1420|      0|                return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1421|      0|            }
 1422|  7.99k|            ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt, i4_cb_qp_idx_ofst, i4_cr_qp_idx_ofst,
 1423|  7.99k|                                       u4_wd_y, u4_wd_uv);
 1424|  7.99k|        }
 1425|  2.05k|    }
 1426|       |
 1427|  2.05k|    if(u4_tfr_n_mb)
  ------------------
  |  Branch (1427:8): [True: 2.05k, False: 0]
  ------------------
 1428|  2.05k|    {
 1429|       |        /****************************************************************/
 1430|       |        /* Check for End Of Row in Next iteration                       */
 1431|       |        /****************************************************************/
 1432|  2.05k|        u1_end_of_row_next =
 1433|  2.05k|            u4_num_mbs_next && (u4_num_mbs_next <= (ps_dec->u4_recon_mb_grp >> u1_mbaff));
  ------------------
  |  Branch (1433:13): [True: 2, False: 2.04k]
  |  Branch (1433:32): [True: 2, False: 0]
  ------------------
 1434|       |
 1435|       |        /****************************************************************/
 1436|       |        /* Transfer the Following things                                */
 1437|       |        /* N-Mb DeblkParams Data    ( To Ext DeblkParams Buffer )       */
 1438|       |        /* N-Mb Recon Data          ( To Ext Frame Buffer )             */
 1439|       |        /* N-Mb Intrapredline Data  ( Updated Internally)               */
 1440|       |        /* N-Mb MV Data             ( To Ext MV Buffer )                */
 1441|       |        /* N-Mb MVTop/TopRight Data ( To Int MV Top Scratch Buffers)    */
 1442|       |        /****************************************************************/
 1443|  2.05k|        ih264d_transfer_mb_group_data(ps_dec, u4_num_mbs, u4_end_of_row, u1_end_of_row_next);
 1444|  2.05k|        ps_dec->u4_num_mbs_prev_nmb = u4_num_mbs;
 1445|  2.05k|        ps_dec->u4_pred_info_idx = 0;
 1446|  2.05k|        ps_dec->u4_dma_buf_idx = 0;
 1447|  2.05k|    }
 1448|  2.05k|    return OK;
  ------------------
  |  |  114|  2.05k|#define OK        0
  ------------------
 1449|  2.05k|}
isvcd_decode_recon_tfr_nmb_base_lyr:
 1464|  28.1k|{
 1465|  28.1k|    WORD32 j;
 1466|  28.1k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1467|  28.1k|    UWORD32 u1_end_of_row_next;
 1468|  28.1k|    dec_mb_info_t *ps_cur_mb_info;
 1469|  28.1k|    const UWORD32 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
 1470|  28.1k|    const UWORD32 u1_slice_type = ps_dec->ps_cur_slice->u1_slice_type;
 1471|  28.1k|    const WORD32 u1_skip_th =
 1472|  28.1k|        ((u1_slice_type != I_SLICE) ? (ps_dec->u1_B ? B_8x8 : PRED_8x8R0) : -1);
  ------------------
  |  |  370|  28.1k|#define I_SLICE  2
  ------------------
                      ((u1_slice_type != I_SLICE) ? (ps_dec->u1_B ? B_8x8 : PRED_8x8R0) : -1);
  ------------------
  |  |  480|  8.30k|#define B_8x8    22
  ------------------
                      ((u1_slice_type != I_SLICE) ? (ps_dec->u1_B ? B_8x8 : PRED_8x8R0) : -1);
  ------------------
  |  |  454|  18.1k|#define PRED_8x8R0  4
  ------------------
  |  Branch (1472:10): [True: 26.4k, False: 1.63k]
  |  Branch (1472:40): [True: 8.30k, False: 18.1k]
  ------------------
 1473|  28.1k|    const UWORD32 u1_ipcm_th = ((u1_slice_type != I_SLICE) ? (ps_dec->u1_B ? 23 : 5) : 0);
  ------------------
  |  |  370|  28.1k|#define I_SLICE  2
  ------------------
  |  Branch (1473:33): [True: 26.4k, False: 1.63k]
  |  Branch (1473:63): [True: 8.30k, False: 18.1k]
  ------------------
 1474|  28.1k|    WORD32 ret = OK;
  ------------------
  |  |  114|  28.1k|#define OK        0
  ------------------
 1475|       |
 1476|  28.1k|    if(1 != ps_svc_lyr_dec->u1_base_res_flag)
  ------------------
  |  Branch (1476:8): [True: 0, False: 28.1k]
  ------------------
 1477|      0|    {
 1478|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1479|      0|    }
 1480|  28.1k|    if(ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER)
  ------------------
  |  |  110|  28.1k|#define TARGET_LAYER 2
  ------------------
  |  Branch (1480:8): [True: 0, False: 28.1k]
  ------------------
 1481|      0|    {
 1482|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1483|      0|    }
 1484|       |
 1485|       |    /* N Mb IQ IT + Residual Store for Inter / + Recon for Intra Loop */
 1486|  84.4k|    for(j = u1_mb_idx; j < u4_num_mbs; j++)
  ------------------
  |  Branch (1486:24): [True: 56.3k, False: 28.1k]
  ------------------
 1487|  56.3k|    {
 1488|  56.3k|        ps_dec->u4_dma_buf_idx = 0;
 1489|  56.3k|        ps_dec->u4_pred_info_idx = 0;
 1490|  56.3k|        ps_cur_mb_info = ps_dec->ps_nmb_info + j;
 1491|       |
 1492|  56.3k|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb =
 1493|  56.3k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start + ps_cur_mb_info->u2_mbx +
 1494|  56.3k|            (ps_svc_lyr_dec->u2_inter_lyr_mb_prms_stride * (ps_cur_mb_info->u2_mby));
 1495|       |
 1496|  56.3k|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_slice_id = (WORD8) ps_dec->u2_cur_slice_num;
 1497|       |
 1498|  56.3k|        if(ps_cur_mb_info->u1_mb_type == MB_SKIP)
  ------------------
  |  |   59|  56.3k|#define MB_SKIP 255
  ------------------
  |  Branch (1498:12): [True: 42.6k, False: 13.7k]
  ------------------
 1499|  42.6k|        {
 1500|  42.6k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_mb_mode = SVC_INTER_MB;
  ------------------
  |  |  114|  42.6k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
 1501|  42.6k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_tx_size =
 1502|  42.6k|                ps_cur_mb_info->u1_tran_form8x8;
 1503|  42.6k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u2_luma_nnz = 0;
 1504|  42.6k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz = 0;
 1505|  42.6k|        }
 1506|  13.7k|        else if(ps_cur_mb_info->u1_mb_type <= u1_skip_th)
  ------------------
  |  Branch (1506:17): [True: 8.02k, False: 5.69k]
  ------------------
 1507|  8.02k|        {
 1508|       |            /* Only IT : Store Residual (WORD16) for Higher Layers : Base layer*/
 1509|  8.02k|            ret = isvcd_process_inter_mb_no_rsd_pred_non_target(ps_svc_lyr_dec, ps_cur_mb_info, 0);
 1510|  8.02k|            if(ret != OK) return ret;
  ------------------
  |  |  114|  8.02k|#define OK        0
  ------------------
  |  Branch (1510:16): [True: 0, False: 8.02k]
  ------------------
 1511|  8.02k|        }
 1512|  5.69k|        else if(ps_cur_mb_info->u1_mb_type != MB_SKIP)
  ------------------
  |  |   59|  5.69k|#define MB_SKIP 255
  ------------------
  |  Branch (1512:17): [True: 5.69k, False: 0]
  ------------------
 1513|  5.69k|        {
 1514|  5.69k|            if((u1_ipcm_th + 25) != ps_cur_mb_info->u1_mb_type)
  ------------------
  |  Branch (1514:16): [True: 5.69k, False: 1]
  ------------------
 1515|  5.69k|            {
 1516|  5.69k|                ps_cur_mb_info->u1_mb_type -= (u1_skip_th + 1);
 1517|  5.69k|                ih264d_process_intra_mb(ps_dec, ps_cur_mb_info, j);
 1518|  5.69k|                isvcd_update_intra_mb_inter_layer_info(ps_svc_lyr_dec, ps_cur_mb_info);
 1519|  5.69k|            }
 1520|      1|            else
 1521|      1|            {
 1522|      1|                isvcd_update_ipcm_mb_inter_layer_info(ps_svc_lyr_dec, ps_cur_mb_info);
 1523|      1|            }
 1524|  5.69k|        }
 1525|       |
 1526|  56.3k|        if(ps_dec->u4_use_intrapred_line_copy)
  ------------------
  |  Branch (1526:12): [True: 56.3k, False: 0]
  ------------------
 1527|  56.3k|        {
 1528|  56.3k|            ih264d_copy_intra_pred_line(ps_dec, ps_cur_mb_info, j);
 1529|  56.3k|        }
 1530|  56.3k|    }
 1531|       |
 1532|       |    /*MB deblocking*/
 1533|  28.1k|    if(ps_dec->u4_nmb_deblk == 1)
  ------------------
  |  Branch (1533:8): [True: 28.1k, False: 0]
  ------------------
 1534|  28.1k|    {
 1535|  28.1k|        UWORD32 u4_wd_y, u4_wd_uv;
 1536|  28.1k|        tfr_ctxt_t *ps_tfr_cxt = &(ps_dec->s_tran_addrecon);
 1537|  28.1k|        UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag;
 1538|  28.1k|        const WORD32 i4_cb_qp_idx_ofst = ps_dec->ps_cur_pps->i1_chroma_qp_index_offset;
 1539|  28.1k|        const WORD32 i4_cr_qp_idx_ofst = ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset;
 1540|       |
 1541|  28.1k|        u4_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag;
 1542|  28.1k|        u4_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag;
 1543|       |
 1544|  28.1k|        ps_cur_mb_info = ps_dec->ps_nmb_info + u1_mb_idx;
 1545|       |
 1546|  28.1k|        ps_dec->u4_deblk_mb_x = ps_cur_mb_info->u2_mbx;
 1547|  28.1k|        ps_dec->u4_deblk_mb_y = ps_cur_mb_info->u2_mby;
 1548|       |
 1549|  84.4k|        for(j = u1_mb_idx; j < u4_num_mbs; j++)
  ------------------
  |  Branch (1549:28): [True: 56.3k, False: 28.1k]
  ------------------
 1550|  56.3k|        {
 1551|       |            /* IN SVC base layers only intra MB's Need to be deblocked*/
 1552|  56.3k|            deblk_mb_t *ps_top_mb, *ps_left_mb, *ps_cur_mb;
 1553|  56.3k|            ps_cur_mb = ps_dec->ps_cur_deblk_mb;
 1554|  56.3k|            if(!(ps_cur_mb->u1_deblocking_mode & MB_DISABLE_FILTERING))
  ------------------
  |  |   70|  56.3k|#define MB_DISABLE_FILTERING          0x01
  ------------------
  |  Branch (1554:16): [True: 5.69k, False: 50.6k]
  ------------------
 1555|  5.69k|            {
 1556|  5.69k|                if(ps_dec->u4_deblk_mb_x)
  ------------------
  |  Branch (1556:20): [True: 2.89k, False: 2.79k]
  ------------------
 1557|  2.89k|                {
 1558|  2.89k|                    ps_left_mb = ps_cur_mb - 1;
 1559|  2.89k|                }
 1560|  2.79k|                else
 1561|  2.79k|                {
 1562|  2.79k|                    ps_left_mb = NULL;
 1563|  2.79k|                }
 1564|  5.69k|                if(ps_dec->u4_deblk_mb_y != 0)
  ------------------
  |  Branch (1564:20): [True: 5.42k, False: 262]
  ------------------
 1565|  5.42k|                {
 1566|  5.42k|                    ps_top_mb = ps_cur_mb - (ps_dec->u2_frm_wd_in_mbs);
 1567|  5.42k|                }
 1568|    262|                else
 1569|    262|                {
 1570|    262|                    ps_top_mb = NULL;
 1571|    262|                }
 1572|       |
 1573|  5.69k|                if(ps_cur_mb->u1_deblocking_mode & MB_DISABLE_LEFT_EDGE) ps_left_mb = NULL;
  ------------------
  |  |   72|  5.69k|#define MB_DISABLE_LEFT_EDGE          0x04
  ------------------
  |  Branch (1573:20): [True: 214, False: 5.47k]
  ------------------
 1574|  5.69k|                if(ps_cur_mb->u1_deblocking_mode & MB_DISABLE_TOP_EDGE) ps_top_mb = NULL;
  ------------------
  |  |   71|  5.69k|#define MB_DISABLE_TOP_EDGE           0x02
  ------------------
  |  Branch (1574:20): [True: 18, False: 5.67k]
  ------------------
 1575|       |
 1576|       |                /* Top Horizontal Edge*/
 1577|  5.69k|                if(NULL != ps_top_mb)
  ------------------
  |  Branch (1577:20): [True: 5.42k, False: 262]
  ------------------
 1578|  5.42k|                {
 1579|  5.42k|                    if(!(ps_top_mb->u1_mb_type & D_INTRA_MB))
  ------------------
  |  |  382|  5.42k|#define D_INTRA_MB        1
  ------------------
  |  Branch (1579:24): [True: 1.19k, False: 4.23k]
  ------------------
 1580|  1.19k|                    {
 1581|  1.19k|                        ps_cur_mb->u4_bs_table[0] = 0;
 1582|  1.19k|                    }
 1583|  5.42k|                }
 1584|    262|                else
 1585|    262|                {
 1586|    262|                    ps_cur_mb->u4_bs_table[0] = 0;
 1587|    262|                }
 1588|       |
 1589|       |                /* Left Vertical Edge*/
 1590|  5.69k|                if(NULL != ps_left_mb)
  ------------------
  |  Branch (1590:20): [True: 2.89k, False: 2.79k]
  ------------------
 1591|  2.89k|                {
 1592|  2.89k|                    if(!(ps_left_mb->u1_mb_type & D_INTRA_MB))
  ------------------
  |  |  382|  2.89k|#define D_INTRA_MB        1
  ------------------
  |  Branch (1592:24): [True: 671, False: 2.22k]
  ------------------
 1593|    671|                    {
 1594|    671|                        ps_cur_mb->u4_bs_table[4] = 0;
 1595|    671|                    }
 1596|  2.89k|                }
 1597|  2.79k|                else
 1598|  2.79k|                {
 1599|  2.79k|                    ps_cur_mb->u4_bs_table[4] = 0;
 1600|  2.79k|                }
 1601|  5.69k|            }
 1602|       |
 1603|  56.3k|            if(ps_dec->u4_cur_deblk_mb_num > ps_dec->ps_cur_sps->u4_max_mb_addr)
  ------------------
  |  Branch (1603:16): [True: 0, False: 56.3k]
  ------------------
 1604|      0|            {
 1605|      0|                return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1606|      0|            }
 1607|       |
 1608|  56.3k|            ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt, i4_cb_qp_idx_ofst, i4_cr_qp_idx_ofst,
 1609|  56.3k|                                       u4_wd_y, u4_wd_uv);
 1610|  56.3k|        }
 1611|  28.1k|    }
 1612|       |
 1613|  28.1k|    if(u4_tfr_n_mb)
  ------------------
  |  Branch (1613:8): [True: 28.1k, False: 0]
  ------------------
 1614|  28.1k|    {
 1615|       |        /****************************************************************/
 1616|       |        /* Check for End Of Row in Next iteration                       */
 1617|       |        /****************************************************************/
 1618|  28.1k|        u1_end_of_row_next =
 1619|  28.1k|            u4_num_mbs_next && (u4_num_mbs_next <= (ps_dec->u4_recon_mb_grp >> u1_mbaff));
  ------------------
  |  Branch (1619:13): [True: 141, False: 27.9k]
  |  Branch (1619:32): [True: 141, False: 0]
  ------------------
 1620|       |
 1621|       |        /****************************************************************/
 1622|       |        /* Transfer the Following things                                */
 1623|       |        /* N-Mb DeblkParams Data    ( To Ext DeblkParams Buffer )       */
 1624|       |        /* N-Mb Recon Data          ( To Ext Frame Buffer )             */
 1625|       |        /* N-Mb Intrapredline Data  ( Updated Internally)               */
 1626|       |        /* N-Mb MV Data             ( To Ext MV Buffer )                */
 1627|       |        /* N-Mb MVTop/TopRight Data ( To Int MV Top Scratch Buffers)    */
 1628|       |        /****************************************************************/
 1629|  28.1k|        ih264d_transfer_mb_group_data(ps_dec, u4_num_mbs, u4_end_of_row, u1_end_of_row_next);
 1630|  28.1k|        ps_dec->u4_num_mbs_prev_nmb = u4_num_mbs;
 1631|  28.1k|        ps_dec->u4_pred_info_idx = 0;
 1632|  28.1k|        ps_dec->u4_dma_buf_idx = 0;
 1633|  28.1k|    }
 1634|  28.1k|    return OK;
  ------------------
  |  |  114|  28.1k|#define OK        0
  ------------------
 1635|  28.1k|}
isvcd_process_ibl_mb:
 1650|    421|{
 1651|    421|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1652|    421|    intra_sampling_ctxt_t *ps_ctxt;
 1653|    421|    svc_dec_lyr_struct_t *ps_svc_dec_ref_layer;
 1654|    421|    pic_buffer_t *ps_frame_buf = ps_dec->ps_cur_pic;
 1655|    421|    pic_buffer_t *ps_frame_buf_ref_layer;
 1656|    421|    intra_samp_lyr_ctxt *ps_lyr_ctxt;
 1657|    421|    mem_element_t s_ref_mb_mode = {0};
 1658|    421|    mem_element_t s_inp_luma = {0};
 1659|    421|    mem_element_t s_inp_chroma = {0};
 1660|    421|    mem_element_t s_out_luma = {0};
 1661|    421|    mem_element_t s_out_chroma = {0};
 1662|    421|    WORD32 i4_ref_x_luma, i4_ref_y_luma, i4_luma_incr = 0;
 1663|    421|    WORD32 i4_ref_x_chroma, i4_ref_y_chroma, i4_chroma_incr = 0;
 1664|    421|    UWORD32 u4_cur_y_stride, u4_cur_uv_stride;
 1665|    421|    UWORD32 u4_ref_y_stride, u4_ref_uv_stride;
 1666|    421|    WORD32 i4_ref_luma_instra_sample_correction_offset = 0;
 1667|    421|    WORD32 i4_ref_chroma_instra_sample_correction_offset = 0;
 1668|    421|    ref_mb_map_t *ps_x_off_len_luma;
 1669|    421|    ref_mb_map_t *ps_y_off_len_luma;
 1670|    421|    ref_mb_map_t *ps_x_off_len_chroma;
 1671|    421|    ref_mb_map_t *ps_y_off_len_chroma;
 1672|    421|    mb_coord_t s_mb_coord = {0};
 1673|    421|    WORD32 ret = OK;
  ------------------
  |  |  114|    421|#define OK        0
  ------------------
 1674|    421|    UNUSED(u4_mb_num);
  ------------------
  |  |   45|    421|#define UNUSED(x) ((void)(x))
  ------------------
 1675|       |
 1676|    421|    ps_ctxt = (intra_sampling_ctxt_t *) ps_svc_lyr_dec->pv_intra_sample_ctxt;
 1677|    421|    ps_svc_dec_ref_layer = ps_svc_lyr_dec->ps_dec_svc_ref_layer;
 1678|       |
 1679|    421|    ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_ctxt->i4_res_lyr_id];
 1680|    421|    u4_cur_y_stride = ps_dec->u2_frm_wd_y;
 1681|    421|    u4_cur_uv_stride = ps_dec->u2_frm_wd_uv;
 1682|    421|    u4_ref_y_stride = ps_svc_dec_ref_layer->s_dec.u2_frm_wd_y;
 1683|    421|    u4_ref_uv_stride = ps_svc_dec_ref_layer->s_dec.u2_frm_wd_uv;
 1684|       |
 1685|    421|    ps_frame_buf_ref_layer = ps_svc_dec_ref_layer->s_dec.ps_cur_pic;
 1686|    421|    if(0 == u1_inter_intra_mode)
  ------------------
  |  Branch (1686:8): [True: 123, False: 298]
  ------------------
 1687|    123|    {
 1688|    123|        s_out_luma.pv_buffer = ps_frame_buf->pu1_buf1 + (ps_cur_mb_info->u2_mbx << 4) +
 1689|    123|                               (u4_cur_y_stride * (ps_cur_mb_info->u2_mby << 4));
 1690|    123|        s_out_luma.i4_element_size = 1;
 1691|    123|        s_out_luma.i4_num_element_stride = u4_cur_y_stride;
 1692|       |
 1693|    123|        s_out_chroma.pv_buffer = ps_frame_buf->pu1_buf2 +
 1694|    123|                                 (ps_cur_mb_info->u2_mbx << 3) * YUV420SP_FACTOR +
  ------------------
  |  |  119|    123|#define YUV420SP_FACTOR 2
  ------------------
 1695|    123|                                 (u4_cur_uv_stride * (ps_cur_mb_info->u2_mby << 3));
 1696|    123|        s_out_chroma.i4_element_size = 1;
 1697|    123|        s_out_chroma.i4_num_element_stride = u4_cur_uv_stride;
 1698|    123|    }
 1699|    298|    else
 1700|    298|    {
 1701|    298|        if(SVCD_TRUE == ps_svc_lyr_dec->s_res_prms.u1_dyadic_flag)
  ------------------
  |  |   46|    298|#define SVCD_TRUE 1
  ------------------
  |  Branch (1701:12): [True: 0, False: 298]
  ------------------
 1702|      0|        {
 1703|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1704|      0|        }
 1705|       |
 1706|    298|        s_out_luma.pv_buffer = ps_svc_lyr_dec->pu1_ii_resamp_buffer_luma;
 1707|    298|        s_out_luma.i4_element_size = 1;
 1708|    298|        s_out_luma.i4_num_element_stride = MB_SIZE;
  ------------------
  |  |  554|    298|#define MB_SIZE             16
  ------------------
 1709|       |
 1710|    298|        s_out_chroma.pv_buffer = ps_svc_lyr_dec->pu1_ii_resamp_buffer_chroma;
 1711|    298|        s_out_chroma.i4_element_size = 1;
 1712|    298|        s_out_chroma.i4_num_element_stride = MB_SIZE;
  ------------------
  |  |  554|    298|#define MB_SIZE             16
  ------------------
 1713|    298|    }
 1714|       |
 1715|       |    /* get the projected locations buffer pointers */
 1716|    421|    {
 1717|    421|        intra_samp_map_ctxt_t *ps_luma_map, *ps_chroma_map;
 1718|       |
 1719|    421|        ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 1720|    421|        ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 1721|       |
 1722|    421|        ps_x_off_len_luma = ps_luma_map->ps_x_offset_length;
 1723|    421|        ps_y_off_len_luma = ps_luma_map->ps_y_offset_length;
 1724|    421|        ps_x_off_len_chroma = ps_chroma_map->ps_x_offset_length;
 1725|    421|        ps_y_off_len_chroma = ps_chroma_map->ps_y_offset_length;
 1726|    421|    }
 1727|    421|    i4_ref_x_luma = ps_svc_lyr_dec->ps_intsam_luma_map_horz[ps_cur_mb_info->u2_mbx].i2_offset;
 1728|    421|    i4_ref_y_luma = ps_svc_lyr_dec->ps_intsam_luma_map_vert[ps_cur_mb_info->u2_mby].i2_offset;
 1729|       |
 1730|    421|    i4_luma_incr = ps_x_off_len_luma[ps_cur_mb_info->u2_mbx].i2_offset - i4_ref_x_luma;
 1731|    421|    i4_luma_incr +=
 1732|    421|        (ps_y_off_len_luma[ps_cur_mb_info->u2_mby].i2_offset - i4_ref_y_luma) * u4_ref_y_stride;
 1733|       |
 1734|    421|    i4_ref_x_chroma = ps_svc_lyr_dec->ps_intsam_chroma_map_horz[ps_cur_mb_info->u2_mbx].i2_offset;
 1735|    421|    i4_ref_y_chroma = ps_svc_lyr_dec->ps_intsam_chroma_map_vert[ps_cur_mb_info->u2_mby].i2_offset;
 1736|       |
 1737|    421|    i4_chroma_incr = ps_x_off_len_chroma[ps_cur_mb_info->u2_mbx].i2_offset - i4_ref_x_chroma;
 1738|    421|    i4_chroma_incr <<= 1;
 1739|    421|    i4_chroma_incr += (ps_y_off_len_chroma[ps_cur_mb_info->u2_mby].i2_offset - i4_ref_y_chroma) *
 1740|    421|                      u4_ref_uv_stride;
 1741|    421|    if(SVCD_FALSE == ps_svc_lyr_dec->s_res_prms.u1_dyadic_flag)
  ------------------
  |  |   45|    421|#define SVCD_FALSE 0
  ------------------
  |  Branch (1741:8): [True: 421, False: 0]
  ------------------
 1742|    421|    {
 1743|    421|        i4_ref_x_luma = CLIP3(0, (ps_svc_dec_ref_layer->s_dec.u2_frm_wd_y - 1), i4_ref_x_luma);
  ------------------
  |  |   77|    421|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 137, False: 284]
  |  |  |  Branch (77:54): [True: 0, False: 284]
  |  |  ------------------
  ------------------
 1744|    421|        i4_ref_y_luma = CLIP3(0, (ps_svc_dec_ref_layer->s_dec.u2_frm_ht_y - 1), i4_ref_y_luma);
  ------------------
  |  |   77|    421|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 50, False: 371]
  |  |  |  Branch (77:54): [True: 0, False: 371]
  |  |  ------------------
  ------------------
 1745|    421|    }
 1746|       |
 1747|    421|    i4_ref_luma_instra_sample_correction_offset =
 1748|    421|        i4_ref_x_luma + (i4_ref_y_luma) * (WORD32) u4_ref_y_stride;
 1749|       |
 1750|    421|    s_inp_luma.pv_buffer = ps_frame_buf_ref_layer->pu1_buf1 + i4_luma_incr +
 1751|    421|                           i4_ref_luma_instra_sample_correction_offset;
 1752|    421|    s_inp_luma.i4_element_size = 1;
 1753|    421|    s_inp_luma.i4_num_element_stride = u4_ref_y_stride;
 1754|       |
 1755|    421|    if(SVCD_FALSE == ps_svc_lyr_dec->s_res_prms.u1_dyadic_flag)
  ------------------
  |  |   45|    421|#define SVCD_FALSE 0
  ------------------
  |  Branch (1755:8): [True: 421, False: 0]
  ------------------
 1756|    421|    {
 1757|    421|        i4_ref_x_chroma = CLIP3(0, (ps_svc_dec_ref_layer->s_dec.u2_frm_wd_uv - 1), i4_ref_x_chroma);
  ------------------
  |  |   77|    421|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 339, False: 82]
  |  |  |  Branch (77:54): [True: 0, False: 82]
  |  |  ------------------
  ------------------
 1758|    421|        i4_ref_y_chroma = CLIP3(0, (ps_svc_dec_ref_layer->s_dec.u2_frm_ht_uv - 1), i4_ref_y_chroma);
  ------------------
  |  |   77|    421|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 99, False: 322]
  |  |  |  Branch (77:54): [True: 0, False: 322]
  |  |  ------------------
  ------------------
 1759|    421|    }
 1760|    421|    i4_ref_chroma_instra_sample_correction_offset =
 1761|    421|        (i4_ref_x_chroma << 1) + (i4_ref_y_chroma) * (WORD32) u4_ref_uv_stride;
 1762|       |
 1763|    421|    s_inp_chroma.pv_buffer = ps_frame_buf_ref_layer->pu1_buf2 + i4_chroma_incr +
 1764|    421|                             i4_ref_chroma_instra_sample_correction_offset;
 1765|    421|    s_inp_chroma.i4_element_size = 1;
 1766|    421|    s_inp_chroma.i4_num_element_stride = u4_ref_uv_stride;
 1767|       |
 1768|    421|    s_ref_mb_mode.pv_buffer = ps_svc_dec_ref_layer->ps_inter_lyr_mb_prms_frm_start;
 1769|    421|    s_ref_mb_mode.i4_element_size = sizeof(inter_lyr_mb_prms_t);
 1770|    421|    s_ref_mb_mode.i4_num_element_stride = ps_svc_dec_ref_layer->u2_inter_lyr_mb_prms_stride;
 1771|       |
 1772|    421|    s_mb_coord.u2_mb_x = ps_cur_mb_info->u2_mbx;
 1773|    421|    s_mb_coord.u2_mb_y = ps_cur_mb_info->u2_mby;
 1774|       |
 1775|    421|    if(SVCD_TRUE == ps_svc_lyr_dec->s_res_prms.u1_dyadic_flag)
  ------------------
  |  |   46|    421|#define SVCD_TRUE 1
  ------------------
  |  Branch (1775:8): [True: 0, False: 421]
  ------------------
 1776|      0|    {
 1777|      0|        ret = isvcd_intra_resamp_mb_dyadic(ps_ctxt, &s_inp_luma, &s_inp_chroma, &s_ref_mb_mode,
 1778|      0|                                           &s_out_luma, &s_out_chroma, &s_mb_coord, ps_svc_lyr_dec);
 1779|      0|    }
 1780|    421|    else
 1781|    421|    {
 1782|    421|        ret = isvcd_intra_resamp_mb(ps_ctxt, &s_inp_luma, &s_inp_chroma, &s_ref_mb_mode,
 1783|    421|                                    &s_out_luma, &s_out_chroma, &s_mb_coord);
 1784|    421|    }
 1785|    421|    if(OK != ret) return ret;
  ------------------
  |  |  114|    421|#define OK        0
  ------------------
  |  Branch (1785:8): [True: 0, False: 421]
  ------------------
 1786|    421|    return OK;
  ------------------
  |  |  114|    421|#define OK        0
  ------------------
 1787|    421|}
isvcd_process_residual_resample_mb:
 1802|  19.2k|{
 1803|  19.2k|    residual_sampling_ctxt_t *ps_ctxt;
 1804|  19.2k|    svc_dec_lyr_struct_t *ps_svc_dec_ref_layer;
 1805|  19.2k|    res_lyr_ctxt *ps_lyr_ctxt;
 1806|  19.2k|    mem_element_t s_ref_mb_mode = {0};
 1807|  19.2k|    mem_element_t s_inp_luma = {0};
 1808|  19.2k|    mem_element_t s_inp_chroma = {0};
 1809|  19.2k|    mem_element_t s_out_luma = {0};
 1810|  19.2k|    mem_element_t s_out_chroma = {0};
 1811|       |
 1812|       |    /* projected locations pointer */
 1813|  19.2k|    ref_mb_map_t *ps_x_off_len_luma;
 1814|  19.2k|    ref_mb_map_t *ps_y_off_len_luma;
 1815|  19.2k|    ref_mb_map_t *ps_x_off_len_chroma;
 1816|  19.2k|    ref_mb_map_t *ps_y_off_len_chroma;
 1817|  19.2k|    WORD32 i4_ref_x_luma, i4_ref_y_luma;
 1818|  19.2k|    WORD32 i4_ref_x_chroma, i4_ref_y_chroma;
 1819|  19.2k|    WORD32 i4_ref_luma_ressam_correction_offset = 0;
 1820|  19.2k|    WORD32 i4_ref_chroma_ressam_correction_offset = 0;
 1821|  19.2k|    WORD32 i4_inp_luma_stride, i4_inp_chroma_stride;
 1822|  19.2k|    WORD32 i4_out_luma_stride, i4_out_chroma_stride;
 1823|  19.2k|    WORD32 i4_inp_luma_offset = 0, i4_inp_chroma_offset = 0;
 1824|  19.2k|    WORD32 ret;
 1825|       |
 1826|  19.2k|    ps_svc_dec_ref_layer = ps_svc_lyr_dec->ps_dec_svc_ref_layer;
 1827|  19.2k|    ps_ctxt = (residual_sampling_ctxt_t *) ps_svc_lyr_dec->pv_residual_sample_ctxt;
 1828|  19.2k|    ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_ctxt->i4_res_lyr_id];
 1829|       |
 1830|  19.2k|    i4_inp_luma_stride = ps_svc_dec_ref_layer->u2_residual_resample_luma_stride;
 1831|  19.2k|    i4_inp_chroma_stride = ps_svc_dec_ref_layer->u2_residual_resample_chroma_stride;
 1832|  19.2k|    i4_out_luma_stride = ps_svc_lyr_dec->u2_residual_resample_luma_stride;
 1833|  19.2k|    i4_out_chroma_stride = ps_svc_lyr_dec->u2_residual_resample_chroma_stride;
 1834|       |
 1835|  19.2k|    {
 1836|  19.2k|        residual_samp_map_ctxt_t *ps_luma_map, *ps_chroma_map;
 1837|       |
 1838|  19.2k|        ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 1839|  19.2k|        ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 1840|  19.2k|        ps_x_off_len_luma = ps_luma_map->ps_x_offset_length;
 1841|  19.2k|        ps_y_off_len_luma = ps_luma_map->ps_y_offset_length;
 1842|  19.2k|        ps_x_off_len_chroma = ps_chroma_map->ps_x_offset_length;
 1843|  19.2k|        ps_y_off_len_chroma = ps_chroma_map->ps_y_offset_length;
 1844|  19.2k|    }
 1845|  19.2k|    i4_ref_x_luma = ps_svc_lyr_dec->ps_ressam_luma_map_horz[ps_cur_mb_info->u2_mbx].i2_offset;
 1846|  19.2k|    i4_ref_y_luma = ps_svc_lyr_dec->ps_ressam_luma_map_vert[ps_cur_mb_info->u2_mby].i2_offset;
 1847|       |
 1848|  19.2k|    i4_ref_x_chroma = ps_svc_lyr_dec->ps_ressam_chroma_map_horz[ps_cur_mb_info->u2_mbx].i2_offset;
 1849|  19.2k|    i4_ref_y_chroma = ps_svc_lyr_dec->ps_ressam_chroma_map_vert[ps_cur_mb_info->u2_mby].i2_offset;
 1850|       |
 1851|  19.2k|    i4_ref_x_luma = CLIP3(0, (ps_lyr_ctxt->i4_ref_width - 1), i4_ref_x_luma);
  ------------------
  |  |   77|  19.2k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 4.44k, False: 14.8k]
  |  |  |  Branch (77:54): [True: 0, False: 14.8k]
  |  |  ------------------
  ------------------
 1852|  19.2k|    i4_ref_y_luma = CLIP3(0, (ps_lyr_ctxt->i4_ref_height - 1), i4_ref_y_luma);
  ------------------
  |  |   77|  19.2k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 1.52k, False: 17.7k]
  |  |  |  Branch (77:54): [True: 0, False: 17.7k]
  |  |  ------------------
  ------------------
 1853|  19.2k|    i4_ref_x_chroma = CLIP3(0, ((ps_lyr_ctxt->i4_ref_width >> 1) - 1), i4_ref_x_chroma);
  ------------------
  |  |   77|  19.2k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 4.44k, False: 14.8k]
  |  |  |  Branch (77:54): [True: 0, False: 14.8k]
  |  |  ------------------
  ------------------
 1854|  19.2k|    i4_ref_y_chroma = CLIP3(0, ((ps_lyr_ctxt->i4_ref_height >> 1) - 1), i4_ref_y_chroma);
  ------------------
  |  |   77|  19.2k|#define CLIP3(miny, maxy, y) (((y) < (miny))?(miny):(((y) > (maxy))?(maxy):(y)))
  |  |  ------------------
  |  |  |  Branch (77:31): [True: 1.52k, False: 17.7k]
  |  |  |  Branch (77:54): [True: 0, False: 17.7k]
  |  |  ------------------
  ------------------
 1855|       |
 1856|  19.2k|    {
 1857|  19.2k|        WORD32 i4_offset_x, i4_offset_y;
 1858|       |
 1859|  19.2k|        i4_offset_x = ps_x_off_len_luma[ps_cur_mb_info->u2_mbx].i2_offset;
 1860|  19.2k|        i4_offset_y = ps_y_off_len_luma[ps_cur_mb_info->u2_mby].i2_offset;
 1861|       |
 1862|       |        /* check for offsets inside frame dimensions */
 1863|  19.2k|        if(0 <= i4_offset_x)
  ------------------
  |  Branch (1863:12): [True: 14.8k, False: 4.44k]
  ------------------
 1864|  14.8k|        {
 1865|       |            /* validity of pointer passed */
 1866|  14.8k|            if(!(i4_offset_x >= i4_ref_x_luma))
  ------------------
  |  Branch (1866:16): [True: 0, False: 14.8k]
  ------------------
 1867|      0|            {
 1868|      0|                return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1869|      0|            }
 1870|  14.8k|            i4_inp_luma_offset += (i4_offset_x - i4_ref_x_luma);
 1871|  14.8k|        }
 1872|       |
 1873|  19.2k|        if(0 <= i4_offset_y)
  ------------------
  |  Branch (1873:12): [True: 17.7k, False: 1.52k]
  ------------------
 1874|  17.7k|        {
 1875|       |            /* validity of pointer passed */
 1876|  17.7k|            if(!(i4_offset_y >= i4_ref_y_luma))
  ------------------
  |  Branch (1876:16): [True: 0, False: 17.7k]
  ------------------
 1877|      0|            {
 1878|      0|                return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1879|      0|            }
 1880|  17.7k|            i4_inp_luma_offset += (i4_offset_y - i4_ref_y_luma) * i4_inp_luma_stride;
 1881|  17.7k|        }
 1882|       |
 1883|  19.2k|        i4_offset_x = ps_x_off_len_chroma[ps_cur_mb_info->u2_mbx].i2_offset;
 1884|  19.2k|        i4_offset_y = ps_y_off_len_chroma[ps_cur_mb_info->u2_mby].i2_offset;
 1885|       |
 1886|       |        /* check for offsets inside frame dimensions */
 1887|  19.2k|        if(0 <= i4_offset_x)
  ------------------
  |  Branch (1887:12): [True: 14.8k, False: 4.44k]
  ------------------
 1888|  14.8k|        {
 1889|       |            /* validity of pointer passed */
 1890|  14.8k|            if(!(i4_offset_x >= i4_ref_x_chroma))
  ------------------
  |  Branch (1890:16): [True: 0, False: 14.8k]
  ------------------
 1891|      0|            {
 1892|      0|                return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1893|      0|            }
 1894|  14.8k|            i4_inp_chroma_offset += (i4_offset_x - i4_ref_x_chroma) << 1;
 1895|  14.8k|        }
 1896|       |
 1897|  19.2k|        if(0 <= i4_offset_y)
  ------------------
  |  Branch (1897:12): [True: 17.7k, False: 1.52k]
  ------------------
 1898|  17.7k|        {
 1899|       |            /* validity of pointer passed */
 1900|  17.7k|            if(!(i4_offset_y >= i4_ref_y_chroma))
  ------------------
  |  Branch (1900:16): [True: 0, False: 17.7k]
  ------------------
 1901|      0|            {
 1902|      0|                return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1903|      0|            }
 1904|  17.7k|            i4_inp_chroma_offset += (i4_offset_y - i4_ref_y_chroma) * (i4_inp_chroma_stride << 1);
 1905|  17.7k|        }
 1906|  19.2k|    }
 1907|       |
 1908|  19.2k|    i4_ref_luma_ressam_correction_offset = i4_ref_x_luma + (i4_ref_y_luma) *i4_inp_luma_stride;
 1909|       |
 1910|  19.2k|    s_inp_luma.pv_buffer = ps_svc_dec_ref_layer->pi2_il_residual_resample_mb_luma_frm_start +
 1911|  19.2k|                           i4_inp_luma_offset + i4_ref_luma_ressam_correction_offset;
 1912|  19.2k|    s_inp_luma.i4_element_size = 1;
 1913|  19.2k|    s_inp_luma.i4_num_element_stride = i4_inp_luma_stride;
 1914|       |
 1915|  19.2k|    i4_ref_chroma_ressam_correction_offset =
 1916|  19.2k|        (i4_ref_x_chroma << 1) + (i4_ref_y_chroma) *i4_inp_chroma_stride;
 1917|       |
 1918|  19.2k|    s_inp_chroma.pv_buffer = ps_svc_dec_ref_layer->pi2_il_residual_resample_mb_chroma_frm_start +
 1919|  19.2k|                             i4_inp_chroma_offset + i4_ref_chroma_ressam_correction_offset;
 1920|  19.2k|    s_inp_chroma.i4_element_size = 1;
 1921|  19.2k|    s_inp_chroma.i4_num_element_stride = i4_inp_luma_stride;
 1922|       |
 1923|  19.2k|    s_ref_mb_mode.pv_buffer = ps_svc_dec_ref_layer->ps_inter_lyr_mb_prms_frm_start;
 1924|  19.2k|    s_ref_mb_mode.i4_element_size = sizeof(inter_lyr_mb_prms_t);
 1925|  19.2k|    s_ref_mb_mode.i4_num_element_stride = ps_svc_dec_ref_layer->u2_inter_lyr_mb_prms_stride;
 1926|       |
 1927|  19.2k|    s_out_luma.i4_element_size = 1;
 1928|  19.2k|    s_out_luma.pv_buffer =
 1929|  19.2k|        ps_svc_lyr_dec->pi2_il_residual_resample_mb_luma_frm_start +
 1930|  19.2k|        ((ps_cur_mb_info->u2_mbx << 4) +
 1931|  19.2k|         (i4_out_luma_stride * (ps_cur_mb_info->u2_mby << 4)) * s_out_luma.i4_element_size);
 1932|       |
 1933|  19.2k|    s_out_luma.i4_num_element_stride = i4_out_luma_stride;
 1934|       |
 1935|  19.2k|    s_out_chroma.i4_element_size = 1;
 1936|  19.2k|    s_out_chroma.pv_buffer =
 1937|  19.2k|        ps_svc_lyr_dec->pi2_il_residual_resample_mb_chroma_frm_start +
 1938|  19.2k|        ((ps_cur_mb_info->u2_mbx << 4) +
 1939|  19.2k|         (i4_out_chroma_stride * (ps_cur_mb_info->u2_mby << 3)) * s_out_chroma.i4_element_size);
 1940|  19.2k|    s_out_chroma.i4_num_element_stride = i4_out_chroma_stride;
 1941|       |
 1942|  19.2k|    ret = ps_lyr_ctxt->pf_residual_samp_mb(ps_ctxt, &s_inp_luma, &s_inp_chroma, &s_ref_mb_mode,
 1943|  19.2k|                                           &s_out_luma, &s_out_chroma, ps_cur_mb_info->u2_mbx,
 1944|  19.2k|                                           ps_cur_mb_info->u2_mby);
 1945|  19.2k|    if(ret != OK)
  ------------------
  |  |  114|  19.2k|#define OK        0
  ------------------
  |  Branch (1945:8): [True: 0, False: 19.2k]
  ------------------
 1946|      0|    {
 1947|      0|        return ret;
 1948|      0|    }
 1949|  19.2k|    return OK;
  ------------------
  |  |  114|  19.2k|#define OK        0
  ------------------
 1950|  19.2k|}
isvcd_process_inter_mb_rsd_pred_target_lyr:
 1968|  19.2k|{
 1969|  19.2k|    UWORD8 *pu1_rec_y, *pu1_rec_u;
 1970|  19.2k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 1971|  19.2k|    UWORD32 ui_rec_width, u4_recwidth_cr;
 1972|  19.2k|    UWORD16 u2_luma_stride, u2_chroma_stride;
 1973|  19.2k|    WORD16 *pi2_y_coeff, *pi2_luma_res_ptr, *pi2_chroma_res_ptr;
 1974|  19.2k|    UWORD32 u1_mb_field_decoding_flag;
 1975|  19.2k|    const UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
 1976|  19.2k|    UWORD32 uc_botMb;
 1977|  19.2k|    UWORD32 u4_num_pmbair;
 1978|  19.2k|    tfr_ctxt_t *ps_frame_buf = ps_dec->ps_frame_buf_ip_recon;
 1979|  19.2k|    UWORD32 u4_luma_dc_only_csbp = 0;
 1980|  19.2k|    UWORD32 u4_luma_dc_only_cbp = 0;
 1981|  19.2k|    UWORD16 u2_res_luma_csbp = 0;
 1982|  19.2k|    WORD32 ret;
 1983|       |
 1984|  19.2k|    if(0 != ps_dec->ps_cur_slice->u1_mbaff_frame_flag)
  ------------------
  |  Branch (1984:8): [True: 0, False: 19.2k]
  ------------------
 1985|      0|    {
 1986|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1987|      0|    }
 1988|  19.2k|    uc_botMb = 1 - ps_cur_mb_info->u1_topmb;
 1989|  19.2k|    u4_num_pmbair = (u4_mb_num >> u1_mbaff);
 1990|  19.2k|    u1_mb_field_decoding_flag = ps_cur_mb_info->u1_mb_field_decodingflag;
 1991|       |
 1992|  19.2k|    pu1_rec_y = ps_frame_buf->pu1_dest_y + (u4_num_pmbair << 4);
 1993|  19.2k|    pu1_rec_u = ps_frame_buf->pu1_dest_u + (u4_num_pmbair << 3) * YUV420SP_FACTOR;
  ------------------
  |  |  119|  19.2k|#define YUV420SP_FACTOR 2
  ------------------
 1994|  19.2k|    ui_rec_width = ps_dec->u2_frm_wd_y << u1_mb_field_decoding_flag;
 1995|  19.2k|    u4_recwidth_cr = ps_dec->u2_frm_wd_uv << u1_mb_field_decoding_flag;
 1996|       |
 1997|  19.2k|    u2_luma_stride = ps_svc_lyr_dec->u2_residual_resample_luma_stride;
 1998|  19.2k|    pi2_luma_res_ptr = ps_svc_lyr_dec->pi2_il_residual_resample_mb_luma_frm_start +
 1999|  19.2k|                       (ps_cur_mb_info->u2_mbx << 4) +
 2000|  19.2k|                       ((ps_cur_mb_info->u2_mby << 4) * u2_luma_stride);
 2001|       |
 2002|  19.2k|    u2_chroma_stride = ps_svc_lyr_dec->u2_residual_resample_chroma_stride;
 2003|  19.2k|    pi2_chroma_res_ptr = ps_svc_lyr_dec->pi2_il_residual_resample_mb_chroma_frm_start +
 2004|  19.2k|                         (ps_cur_mb_info->u2_mbx << 4) +
 2005|  19.2k|                         ((ps_cur_mb_info->u2_mby << 3) * u2_chroma_stride);
 2006|       |
 2007|  19.2k|    ret = isvcd_process_residual_resample_mb(ps_svc_lyr_dec, ps_cur_mb_info);
 2008|  19.2k|    if(ret != OK)
  ------------------
  |  |  114|  19.2k|#define OK        0
  ------------------
  |  Branch (2008:8): [True: 0, False: 19.2k]
  ------------------
 2009|      0|    {
 2010|      0|        return ret;
 2011|      0|    }
 2012|  19.2k|    if(u1_mbaff)
  ------------------
  |  Branch (2012:8): [True: 0, False: 19.2k]
  ------------------
 2013|      0|    {
 2014|      0|        if(uc_botMb)
  ------------------
  |  Branch (2014:12): [True: 0, False: 0]
  ------------------
 2015|      0|        {
 2016|      0|            pu1_rec_y += (u1_mb_field_decoding_flag ? (ui_rec_width >> 1) : (ui_rec_width << 4));
  ------------------
  |  Branch (2016:27): [True: 0, False: 0]
  ------------------
 2017|      0|            pu1_rec_u +=
 2018|      0|                (u1_mb_field_decoding_flag ? (u4_recwidth_cr >> 1) : (u4_recwidth_cr << 3));
  ------------------
  |  Branch (2018:18): [True: 0, False: 0]
  ------------------
 2019|      0|        }
 2020|      0|    }
 2021|       |
 2022|  19.2k|    if(!ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (2022:8): [True: 3.63k, False: 15.6k]
  ------------------
 2023|  3.63k|    {
 2024|  3.63k|        u4_luma_dc_only_csbp = ih264d_unpack_luma_coeff4x4_mb(ps_dec, ps_cur_mb_info, 0);
 2025|  3.63k|    }
 2026|  15.6k|    else
 2027|  15.6k|    {
 2028|  15.6k|        if(!ps_dec->ps_cur_pps->u1_entropy_coding_mode)
  ------------------
  |  Branch (2028:12): [True: 5, False: 15.6k]
  ------------------
 2029|      5|        {
 2030|      5|            u4_luma_dc_only_cbp = ih264d_unpack_luma_coeff4x4_mb(ps_dec, ps_cur_mb_info, 0);
 2031|      5|        }
 2032|  15.6k|        else
 2033|  15.6k|        {
 2034|  15.6k|            u4_luma_dc_only_cbp = ih264d_unpack_luma_coeff8x8_mb(ps_dec, ps_cur_mb_info);
 2035|  15.6k|        }
 2036|  15.6k|    }
 2037|       |
 2038|  19.2k|    *pu2_res_luma_csbp = 0;
 2039|  19.2k|    pi2_y_coeff = ps_dec->pi2_coeff_data;
 2040|       |
 2041|       |    /* Inverse Transform and Reconstruction */
 2042|  19.2k|    if(ps_cur_mb_info->u1_cbp & 0x0f)
  ------------------
  |  Branch (2042:8): [True: 18.4k, False: 834]
  ------------------
 2043|  18.4k|    {
 2044|  18.4k|        if(!ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (2044:12): [True: 2.80k, False: 15.6k]
  ------------------
 2045|  2.80k|        {
 2046|  2.80k|            UWORD32 i;
 2047|  2.80k|            WORD16 ai2_tmp[16] = {0};
 2048|  47.6k|            for(i = 0; i < 16; i++)
  ------------------
  |  Branch (2048:24): [True: 44.8k, False: 2.80k]
  ------------------
 2049|  44.8k|            {
 2050|  44.8k|                if(CHECKBIT(ps_cur_mb_info->u2_luma_csbp, i))
  ------------------
  |  |   54|  44.8k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 28.1k, False: 16.6k]
  |  |  ------------------
  ------------------
 2051|  28.1k|                {
 2052|  28.1k|                    WORD16 *pi2_level = pi2_y_coeff + (i << 4);
 2053|  28.1k|                    UWORD8 *pu1_pred_sblk =
 2054|  28.1k|                        pu1_rec_y + ((i & 0x3) * BLK_SIZE) + (i >> 2) * (ui_rec_width << 2);
  ------------------
  |  |  556|  28.1k|#define BLK_SIZE             4
  ------------------
 2055|  28.1k|                    WORD16 *pi2_out = pi2_luma_res_ptr + ((i & 0x3) * BLK_SIZE) +
  ------------------
  |  |  556|  28.1k|#define BLK_SIZE             4
  ------------------
 2056|  28.1k|                                      (i >> 2) * (u2_luma_stride << 2);
 2057|  28.1k|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  28.1k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
 2058|  28.1k|                    {
 2059|  28.1k|                        if(CHECKBIT(u4_luma_dc_only_csbp, i))
  ------------------
  |  |   54|  28.1k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 325, False: 27.7k]
  |  |  ------------------
  ------------------
 2060|    325|                        {
 2061|    325|                            u2_res_luma_csbp =
 2062|    325|                                ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_4x4_dc(
 2063|    325|                                    pi2_level, pu1_pred_sblk, pi2_out, pu1_pred_sblk, ui_rec_width,
 2064|    325|                                    u2_luma_stride, ui_rec_width,
 2065|    325|                                    gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6],
 2066|    325|                                    (UWORD16 *) ps_dec->s_high_profile.i2_scalinglist4x4[3],
 2067|    325|                                    ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0, NULL);
 2068|    325|                        }
 2069|  27.7k|                        else
 2070|  27.7k|                        {
 2071|  27.7k|                            u2_res_luma_csbp =
 2072|  27.7k|                                ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_4x4(
 2073|  27.7k|                                    pi2_level, pu1_pred_sblk, pi2_out, pu1_pred_sblk, ui_rec_width,
 2074|  27.7k|                                    u2_luma_stride, ui_rec_width,
 2075|  27.7k|                                    gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6],
 2076|  27.7k|                                    (UWORD16 *) ps_dec->s_high_profile.i2_scalinglist4x4[3],
 2077|  27.7k|                                    ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0, NULL);
 2078|  27.7k|                        }
 2079|  28.1k|                    }
 2080|  28.1k|                }
 2081|  16.6k|                else
 2082|  16.6k|                {
 2083|  16.6k|                    UWORD8 *pu1_pred_sblk =
 2084|  16.6k|                        pu1_rec_y + ((i & 0x3) * BLK_SIZE) + (i >> 2) * (ui_rec_width << 2);
  ------------------
  |  |  556|  16.6k|#define BLK_SIZE             4
  ------------------
 2085|  16.6k|                    WORD16 *pi2_out = pi2_luma_res_ptr + ((i & 0x3) * BLK_SIZE) +
  ------------------
  |  |  556|  16.6k|#define BLK_SIZE             4
  ------------------
 2086|  16.6k|                                      (i >> 2) * (u2_luma_stride << 2);
 2087|       |
 2088|  16.6k|                    u2_res_luma_csbp = ps_svc_lyr_dec->pf_pred_residual_recon_luma_4x4(
 2089|  16.6k|                        pu1_pred_sblk, pi2_out, pu1_pred_sblk, ui_rec_width, u2_luma_stride,
 2090|  16.6k|                        ui_rec_width);
 2091|  16.6k|                }
 2092|  44.8k|                *pu2_res_luma_csbp |= (u2_res_luma_csbp << i);
 2093|  44.8k|            }
 2094|  2.80k|        }
 2095|  15.6k|        else
 2096|  15.6k|        {
 2097|  15.6k|            WORD16 *pi2_scale_matrix_ptr;
 2098|  15.6k|            WORD32 i;
 2099|       |
 2100|  15.6k|            pi2_scale_matrix_ptr = ps_dec->s_high_profile.i2_scalinglist8x8[1];
 2101|       |
 2102|  78.2k|            for(i = 0; i < 4; i++)
  ------------------
  |  Branch (2102:24): [True: 62.6k, False: 15.6k]
  ------------------
 2103|  62.6k|            {
 2104|  62.6k|                WORD16 ai2_tmp[64] = {0};
 2105|  62.6k|                WORD16 *pi16_levelBlock =
 2106|  62.6k|                    pi2_y_coeff + (i << 6); /* move to the next 8x8 adding 64 */
 2107|       |
 2108|  62.6k|                UWORD8 *pu1_pred_sblk =
 2109|  62.6k|                    pu1_rec_y + ((i & 0x1) * BLK8x8SIZE) + (i >> 1) * (ui_rec_width << 3);
  ------------------
  |  |  555|  62.6k|#define BLK8x8SIZE          8
  ------------------
 2110|  62.6k|                WORD16 *pi2_out =
 2111|  62.6k|                    pi2_luma_res_ptr + ((i & 0x1) * BLK8x8SIZE) + (i >> 1) * (u2_luma_stride << 3);
  ------------------
  |  |  555|  62.6k|#define BLK8x8SIZE          8
  ------------------
 2112|  62.6k|                if(CHECKBIT(ps_cur_mb_info->u1_cbp, i))
  ------------------
  |  |   54|  62.6k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 58.3k, False: 4.29k]
  |  |  ------------------
  ------------------
 2113|  58.3k|                {
 2114|  58.3k|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  58.3k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
 2115|  58.3k|                    {
 2116|  58.3k|                        if(CHECKBIT(u4_luma_dc_only_cbp, i))
  ------------------
  |  |   54|  58.3k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 356, False: 57.9k]
  |  |  ------------------
  ------------------
 2117|    356|                        {
 2118|    356|                            u2_res_luma_csbp =
 2119|    356|                                ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_8x8_dc(
 2120|    356|                                    pi16_levelBlock, pu1_pred_sblk, pi2_out, pu1_pred_sblk,
 2121|    356|                                    ui_rec_width, u2_luma_stride, ui_rec_width,
 2122|    356|                                    gau1_ih264d_dequant8x8_cavlc[ps_cur_mb_info->u1_qp_rem6],
 2123|    356|                                    (UWORD16 *) pi2_scale_matrix_ptr, ps_cur_mb_info->u1_qp_div6,
 2124|    356|                                    ai2_tmp, 0, NULL);
 2125|    356|                        }
 2126|  57.9k|                        else
 2127|  57.9k|                        {
 2128|  57.9k|                            u2_res_luma_csbp =
 2129|  57.9k|                                ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_8x8(
 2130|  57.9k|                                    pi16_levelBlock, pu1_pred_sblk, pi2_out, pu1_pred_sblk,
 2131|  57.9k|                                    ui_rec_width, u2_luma_stride, ui_rec_width,
 2132|  57.9k|                                    gau1_ih264d_dequant8x8_cavlc[ps_cur_mb_info->u1_qp_rem6],
 2133|  57.9k|                                    (UWORD16 *) pi2_scale_matrix_ptr, ps_cur_mb_info->u1_qp_div6,
 2134|  57.9k|                                    ai2_tmp, 0, NULL);
 2135|  57.9k|                        }
 2136|  58.3k|                    }
 2137|  58.3k|                }
 2138|  4.29k|                else
 2139|  4.29k|                {
 2140|  4.29k|                    UWORD8 *pu1_pred_sblk =
 2141|  4.29k|                        pu1_rec_y + ((i & 0x1) * BLK8x8SIZE) + (i >> 1) * (ui_rec_width << 3);
  ------------------
  |  |  555|  4.29k|#define BLK8x8SIZE          8
  ------------------
 2142|  4.29k|                    WORD16 *pi2_out = pi2_luma_res_ptr + ((i & 0x1) * BLK8x8SIZE) +
  ------------------
  |  |  555|  4.29k|#define BLK8x8SIZE          8
  ------------------
 2143|  4.29k|                                      (i >> 1) * (u2_luma_stride << 3);
 2144|       |
 2145|  4.29k|                    u2_res_luma_csbp = ps_svc_lyr_dec->pf_pred_residual_recon_luma_8x8(
 2146|  4.29k|                        pu1_pred_sblk, pi2_out, pu1_pred_sblk, ui_rec_width, u2_luma_stride,
 2147|  4.29k|                        ui_rec_width);
 2148|  4.29k|                }
 2149|  62.6k|                *pu2_res_luma_csbp |= (u2_res_luma_csbp << (((i >> 1) << 3) + ((i & 0x01) << 1)));
 2150|  62.6k|            }
 2151|  15.6k|        }
 2152|  18.4k|    }
 2153|    834|    else
 2154|    834|    {
 2155|    834|        UWORD8 *pu1_pred_sblk = pu1_rec_y;
 2156|    834|        WORD16 *pi2_out = pi2_luma_res_ptr;
 2157|       |
 2158|    834|        *pu2_res_luma_csbp = ps_svc_lyr_dec->pf_pred_residual_recon_luma_16x16(
 2159|    834|            pu1_pred_sblk, pi2_out, pu1_pred_sblk, ui_rec_width, u2_luma_stride, ui_rec_width);
 2160|    834|    }
 2161|       |
 2162|       |    /* Decode Chroma Block */
 2163|  19.2k|    ih264d_unpack_chroma_coeff4x4_mb(ps_dec, ps_cur_mb_info);
 2164|       |    /*--------------------------------------------------------------------*/
 2165|       |    /* Chroma Blocks decoding                                             */
 2166|       |    /*--------------------------------------------------------------------*/
 2167|  19.2k|    {
 2168|  19.2k|        UWORD8 u1_chroma_cbp = (UWORD8) (ps_cur_mb_info->u1_cbp >> 4);
 2169|       |
 2170|  19.2k|        if(u1_chroma_cbp != CBPC_ALLZERO)
  ------------------
  |  |  507|  19.2k|#define CBPC_ALLZERO    0
  ------------------
  |  Branch (2170:12): [True: 11.7k, False: 7.55k]
  ------------------
 2171|  11.7k|        {
 2172|  11.7k|            UWORD32 u4_scale_u = ps_cur_mb_info->u1_qpc_div6;
 2173|  11.7k|            UWORD32 u4_scale_v = ps_cur_mb_info->u1_qpcr_div6;
 2174|  11.7k|            UWORD16 u2_chroma_csbp = ps_cur_mb_info->u2_chroma_csbp;
 2175|       |
 2176|  11.7k|            pi2_y_coeff = ps_dec->pi2_coeff_data;
 2177|       |
 2178|  11.7k|            {
 2179|  11.7k|                UWORD32 i;
 2180|  11.7k|                WORD16 ai2_tmp[16] = {0};
 2181|  58.6k|                for(i = 0; i < 4; i++)
  ------------------
  |  Branch (2181:28): [True: 46.9k, False: 11.7k]
  ------------------
 2182|  46.9k|                {
 2183|  46.9k|                    WORD16 *pi2_level = pi2_y_coeff + (i << 4);
 2184|  46.9k|                    UWORD8 *pu1_pred_sblk = pu1_rec_u + ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR) +
  ------------------
  |  |  556|  46.9k|#define BLK_SIZE             4
  ------------------
                                  UWORD8 *pu1_pred_sblk = pu1_rec_u + ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR) +
  ------------------
  |  |  119|  46.9k|#define YUV420SP_FACTOR 2
  ------------------
 2185|  46.9k|                                            (i >> 1) * (u4_recwidth_cr << 2);
 2186|  46.9k|                    WORD16 *pi2_out = pi2_chroma_res_ptr +
 2187|  46.9k|                                      ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR) +
  ------------------
  |  |  556|  46.9k|#define BLK_SIZE             4
  ------------------
                                                    ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR) +
  ------------------
  |  |  119|  46.9k|#define YUV420SP_FACTOR 2
  ------------------
 2188|  46.9k|                                      (i >> 1) * (u2_chroma_stride << 2);
 2189|  46.9k|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  46.9k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
 2190|  46.9k|                    {
 2191|  46.9k|                        if(CHECKBIT(u2_chroma_csbp, i))
  ------------------
  |  |   54|  46.9k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 1.86k, False: 45.0k]
  |  |  ------------------
  ------------------
 2192|  1.86k|                        {
 2193|  1.86k|                            ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_chroma_4x4(
 2194|  1.86k|                                pi2_level, pu1_pred_sblk, pi2_out, pu1_pred_sblk, u4_recwidth_cr,
 2195|  1.86k|                                u2_chroma_stride, u4_recwidth_cr,
 2196|  1.86k|                                gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpc_rem6],
 2197|  1.86k|                                (UWORD16 *) ps_dec->s_high_profile.i2_scalinglist4x4[4], u4_scale_u,
 2198|  1.86k|                                ai2_tmp, pi2_level);
 2199|  1.86k|                        }
 2200|  45.0k|                        else if(pi2_level[0] != 0)
  ------------------
  |  Branch (2200:33): [True: 39.9k, False: 5.15k]
  ------------------
 2201|  39.9k|                        {
 2202|  39.9k|                            ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_chroma_4x4_dc(
 2203|  39.9k|                                pi2_level, pu1_pred_sblk, pi2_out, pu1_pred_sblk, u4_recwidth_cr,
 2204|  39.9k|                                u2_chroma_stride, u4_recwidth_cr,
 2205|  39.9k|                                gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpc_rem6],
 2206|  39.9k|                                (UWORD16 *) ps_dec->s_high_profile.i2_scalinglist4x4[4], u4_scale_u,
 2207|  39.9k|                                ai2_tmp, pi2_level);
 2208|  39.9k|                        }
 2209|  5.15k|                        else
 2210|  5.15k|                        {
 2211|  5.15k|                            ps_svc_lyr_dec->pf_pred_residual_recon_chroma_4x4(
 2212|  5.15k|                                pu1_pred_sblk, pi2_out, pu1_pred_sblk, u4_recwidth_cr,
 2213|  5.15k|                                u2_chroma_stride, u4_recwidth_cr);
 2214|  5.15k|                        }
 2215|  46.9k|                    }
 2216|  46.9k|                }
 2217|  11.7k|            }
 2218|       |
 2219|  11.7k|            pi2_y_coeff += MB_CHROM_SIZE;
  ------------------
  |  |  564|  11.7k|#define MB_CHROM_SIZE                 64
  ------------------
 2220|  11.7k|            u2_chroma_csbp >>= 4;
 2221|       |
 2222|  11.7k|            {
 2223|  11.7k|                UWORD32 i;
 2224|  11.7k|                WORD16 ai2_tmp[16] = {0};
 2225|  58.6k|                for(i = 0; i < 4; i++)
  ------------------
  |  Branch (2225:28): [True: 46.9k, False: 11.7k]
  ------------------
 2226|  46.9k|                {
 2227|  46.9k|                    WORD16 *pi2_level = pi2_y_coeff + (i << 4);
 2228|  46.9k|                    UWORD8 *pu1_pred_sblk = pu1_rec_u + 1 +
 2229|  46.9k|                                            ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR) +
  ------------------
  |  |  556|  46.9k|#define BLK_SIZE             4
  ------------------
                                                          ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR) +
  ------------------
  |  |  119|  46.9k|#define YUV420SP_FACTOR 2
  ------------------
 2230|  46.9k|                                            (i >> 1) * (u4_recwidth_cr << 2);
 2231|  46.9k|                    WORD16 *pi2_out = pi2_chroma_res_ptr + 1 +
 2232|  46.9k|                                      ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR) +
  ------------------
  |  |  556|  46.9k|#define BLK_SIZE             4
  ------------------
                                                    ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR) +
  ------------------
  |  |  119|  46.9k|#define YUV420SP_FACTOR 2
  ------------------
 2233|  46.9k|                                      (i >> 1) * (u2_chroma_stride << 2);
 2234|  46.9k|                    PROFILE_DISABLE_IQ_IT_RECON()
  ------------------
  |  |   98|  46.9k|#define PROFILE_DISABLE_IQ_IT_RECON() ;
  ------------------
 2235|  46.9k|                    {
 2236|  46.9k|                        if(CHECKBIT(u2_chroma_csbp, i))
  ------------------
  |  |   54|  46.9k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 1.69k, False: 45.2k]
  |  |  ------------------
  ------------------
 2237|  1.69k|                        {
 2238|  1.69k|                            ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_chroma_4x4(
 2239|  1.69k|                                pi2_level, pu1_pred_sblk, pi2_out, pu1_pred_sblk, u4_recwidth_cr,
 2240|  1.69k|                                u2_chroma_stride, u4_recwidth_cr,
 2241|  1.69k|                                gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpcr_rem6],
 2242|  1.69k|                                (UWORD16 *) ps_dec->s_high_profile.i2_scalinglist4x4[5], u4_scale_v,
 2243|  1.69k|                                ai2_tmp, pi2_level);
 2244|  1.69k|                        }
 2245|  45.2k|                        else if(pi2_level[0] != 0)
  ------------------
  |  Branch (2245:33): [True: 40.7k, False: 4.52k]
  ------------------
 2246|  40.7k|                        {
 2247|  40.7k|                            ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_chroma_4x4_dc(
 2248|  40.7k|                                pi2_level, pu1_pred_sblk, pi2_out, pu1_pred_sblk, u4_recwidth_cr,
 2249|  40.7k|                                u2_chroma_stride, u4_recwidth_cr,
 2250|  40.7k|                                gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpcr_rem6],
 2251|  40.7k|                                (UWORD16 *) ps_dec->s_high_profile.i2_scalinglist4x4[5], u4_scale_v,
 2252|  40.7k|                                ai2_tmp, pi2_level);
 2253|  40.7k|                        }
 2254|  4.52k|                        else
 2255|  4.52k|                        {
 2256|  4.52k|                            ps_svc_lyr_dec->pf_pred_residual_recon_chroma_4x4(
 2257|  4.52k|                                pu1_pred_sblk, pi2_out, pu1_pred_sblk, u4_recwidth_cr,
 2258|  4.52k|                                u2_chroma_stride, u4_recwidth_cr);
 2259|  4.52k|                        }
 2260|  46.9k|                    }
 2261|  46.9k|                }
 2262|  11.7k|            }
 2263|  11.7k|        }
 2264|  7.55k|        else
 2265|  7.55k|        {
 2266|       |            /* Cr*/
 2267|  7.55k|            {
 2268|  7.55k|                UWORD8 *pu1_pred_sblk = pu1_rec_u;
 2269|  7.55k|                WORD16 *pi2_out = pi2_chroma_res_ptr;
 2270|       |
 2271|  7.55k|                ps_svc_lyr_dec->pf_pred_residual_recon_chroma_8x8(pu1_pred_sblk, pi2_out,
 2272|  7.55k|                                                                  pu1_pred_sblk, u4_recwidth_cr,
 2273|  7.55k|                                                                  u2_chroma_stride, u4_recwidth_cr);
 2274|  7.55k|            }
 2275|       |
 2276|       |            /* Cb*/
 2277|  7.55k|            {
 2278|  7.55k|                UWORD8 *pu1_pred_sblk = pu1_rec_u + 1;
 2279|  7.55k|                WORD16 *pi2_out = pi2_chroma_res_ptr + 1;
 2280|  7.55k|                ps_svc_lyr_dec->pf_pred_residual_recon_chroma_8x8(pu1_pred_sblk, pi2_out,
 2281|  7.55k|                                                                  pu1_pred_sblk, u4_recwidth_cr,
 2282|  7.55k|                                                                  u2_chroma_stride, u4_recwidth_cr);
 2283|  7.55k|            }
 2284|  7.55k|        }
 2285|  19.2k|    }
 2286|  19.2k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb =
 2287|  19.2k|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start + ps_cur_mb_info->u2_mbx +
 2288|  19.2k|        (ps_svc_lyr_dec->u2_inter_lyr_mb_prms_stride * (ps_cur_mb_info->u2_mby));
 2289|  19.2k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_mb_mode =
 2290|  19.2k|        u1_inference_mode ? SVC_IBL_MB : SVC_INTER_MB;
  ------------------
  |  |  117|      0|#define SVC_IBL_MB (1 << 3)         /*!< I_BL MB always inferred */
  ------------------
                      u1_inference_mode ? SVC_IBL_MB : SVC_INTER_MB;
  ------------------
  |  |  114|  38.5k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (2290:9): [True: 0, False: 19.2k]
  ------------------
 2291|  19.2k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_tx_size = ps_cur_mb_info->u1_tran_form8x8;
 2292|  19.2k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u2_luma_nnz = ps_cur_mb_info->u2_luma_csbp;
 2293|  19.2k|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz =
 2294|  19.2k|        (UWORD8) ps_cur_mb_info->u2_chroma_csbp;
 2295|  19.2k|    if(CHECKBIT(ps_cur_mb_info->u1_yuv_dc_block_flag, 1))
  ------------------
  |  |   54|  19.2k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 10.4k, False: 8.88k]
  |  |  ------------------
  ------------------
 2296|  10.4k|    {
 2297|       |        /* Four bits for Cb in DC only cbp */
 2298|  10.4k|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz |= 0x0F;
 2299|  10.4k|    }
 2300|  19.2k|    if(CHECKBIT(ps_cur_mb_info->u1_yuv_dc_block_flag, 2))
  ------------------
  |  |   54|  19.2k|#define CHECKBIT(a,i) ((a) &  (1 << i))
  |  |  ------------------
  |  |  |  Branch (54:23): [True: 10.5k, False: 8.74k]
  |  |  ------------------
  ------------------
 2301|  10.5k|    {
 2302|       |        /* Four bits for Cr in DC only cbp */
 2303|  10.5k|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz |= 0xF0;
 2304|  10.5k|    }
 2305|  19.2k|    return (0);
 2306|  19.2k|}

isvcd_residual_luma_dyadic:
  572|  6.73k|{
  573|  6.73k|    WORD16 *pi2_refarray_buffer;
  574|  6.73k|    WORD32 i4_blk_ctr;
  575|  6.73k|    residual_sampling_ctxt_t *ps_ctxt;
  576|       |
  577|  6.73k|    UNUSED(ps_ref_mb_mode);
  ------------------
  |  |   45|  6.73k|#define UNUSED(x) ((void)(x))
  ------------------
  578|  6.73k|    UNUSED(u2_mb_x);
  ------------------
  |  |   45|  6.73k|#define UNUSED(x) ((void)(x))
  ------------------
  579|  6.73k|    UNUSED(u2_mb_y);
  ------------------
  |  |   45|  6.73k|#define UNUSED(x) ((void)(x))
  ------------------
  580|       |
  581|  6.73k|    ps_ctxt = (residual_sampling_ctxt_t *) pv_residual_samp_ctxt;
  582|  6.73k|    pi2_refarray_buffer = ps_ctxt->pi2_refarray_buffer;
  583|       |
  584|       |    /* based on transform size the counter and interpolation width and */
  585|       |    /* height are intialised as follows                                */
  586|  6.73k|    if((i4_ref_tx_size) && (0 != i4_ref_nnz))
  ------------------
  |  Branch (586:8): [True: 0, False: 6.73k]
  |  Branch (586:28): [True: 0, False: 0]
  ------------------
  587|      0|    {
  588|      0|        WORD16 *pi2_ref_data_byte;
  589|      0|        WORD32 *pi4_ref_array;
  590|      0|        WORD32 i4_i, i4_j;
  591|       |
  592|      0|        pi2_ref_data_byte = pi2_inp_data;
  593|       |
  594|       |        /* ----------- Horizontal Interpolation ---------------- */
  595|      0|        pi4_ref_array = (WORD32 *) pi2_refarray_buffer;
  596|      0|        for(i4_i = 0; i4_i < BLOCK_HEIGHT; i4_i++)
  ------------------
  |  |   65|      0|#define BLOCK_HEIGHT 8
  ------------------
  |  Branch (596:23): [True: 0, False: 0]
  ------------------
  597|      0|        {
  598|      0|            WORD16 i2_coeff1, i2_coeff2;
  599|      0|            i2_coeff1 = (WORD16) (*pi2_ref_data_byte++);
  600|       |
  601|       |            /* populate the first inter sample */
  602|      0|            *pi4_ref_array++ = i2_coeff1 << 2;
  603|       |
  604|      0|            for(i4_j = 0; i4_j < 14; i4_j += 2)
  ------------------
  |  Branch (604:27): [True: 0, False: 0]
  ------------------
  605|      0|            {
  606|      0|                i2_coeff2 = (WORD16) (*pi2_ref_data_byte++);
  607|       |
  608|       |                /* populate 2 samples based on current coeffs */
  609|      0|                *pi4_ref_array++ = ((i2_coeff1 << 1) + (i2_coeff1) + (i2_coeff2));
  610|      0|                *pi4_ref_array++ = ((i2_coeff2 << 1) + (i2_coeff2) + (i2_coeff1));
  611|       |
  612|       |                /* store the coeff 2 to coeff 1 */
  613|       |                /* (used in next iteration)     */
  614|      0|                i2_coeff1 = i2_coeff2;
  615|      0|            }
  616|       |
  617|       |            /* populate the last inter sample */
  618|      0|            *pi4_ref_array++ = i2_coeff1 << 2;
  619|       |
  620|       |            /* vertical loop uopdates */
  621|      0|            pi2_ref_data_byte = pi2_inp_data + ((i4_i + 1) * i4_inp_data_stride);
  622|      0|        }
  623|       |
  624|       |        /* ----------- Vertical Interpolation ---------------- */
  625|      0|        pi4_ref_array = (WORD32 *) pi2_refarray_buffer;
  626|       |
  627|      0|        for(i4_i = 0; i4_i < MB_WIDTH; i4_i++)
  ------------------
  |  |   67|      0|#define MB_WIDTH 16
  ------------------
  |  Branch (627:23): [True: 0, False: 0]
  ------------------
  628|      0|        {
  629|      0|            WORD32 *pi4_ref_array_temp;
  630|      0|            WORD16 *pi2_out;
  631|      0|            WORD32 i4_horz_samp_1, i4_horz_samp_2;
  632|       |
  633|      0|            pi4_ref_array_temp = pi4_ref_array;
  634|      0|            pi2_out = pi2_out_res;
  635|      0|            i4_horz_samp_1 = *pi4_ref_array_temp;
  636|       |
  637|       |            /* populate the first inter sample */
  638|      0|            *pi2_out = (i4_horz_samp_1 + 2) >> 2;
  639|      0|            pi2_out += i4_out_res_stride;
  640|       |
  641|      0|            for(i4_j = 0; i4_j < 14; i4_j += 2)
  ------------------
  |  Branch (641:27): [True: 0, False: 0]
  ------------------
  642|      0|            {
  643|      0|                pi4_ref_array_temp += MB_WIDTH;
  ------------------
  |  |   67|      0|#define MB_WIDTH 16
  ------------------
  644|      0|                i4_horz_samp_2 = *pi4_ref_array_temp;
  645|       |
  646|       |                /* populate 2 samples based on current coeffs */
  647|      0|                *pi2_out = ((i4_horz_samp_1 << 1) + (i4_horz_samp_1) + (i4_horz_samp_2) + 8) >> 4;
  648|      0|                pi2_out += i4_out_res_stride;
  649|      0|                *pi2_out = ((i4_horz_samp_2 << 1) + (i4_horz_samp_2) + (i4_horz_samp_1) + 8) >> 4;
  650|      0|                pi2_out += i4_out_res_stride;
  651|       |
  652|       |                /* store the coeff 2 to coeff 1 */
  653|       |                /* (used in next iteration)     */
  654|      0|                i4_horz_samp_1 = i4_horz_samp_2;
  655|      0|            }
  656|       |
  657|       |            /* populate the first inter sample */
  658|      0|            *pi2_out = (i4_horz_samp_1 + 2) >> 2;
  659|       |
  660|       |            /* horizontal loop updates */
  661|      0|            pi4_ref_array++;
  662|      0|            pi2_out_res++;
  663|      0|        }
  664|      0|    }
  665|  6.73k|    else
  666|  6.73k|    {
  667|       |        /* ----------------------------------------------------------------- */
  668|       |        /* LOOP over number of blocks                                        */
  669|       |        /* ----------------------------------------------------------------- */
  670|  33.6k|        for(i4_blk_ctr = 0; i4_blk_ctr < 4; i4_blk_ctr++)
  ------------------
  |  Branch (670:29): [True: 26.9k, False: 6.73k]
  ------------------
  671|  26.9k|        {
  672|  26.9k|            WORD16 *pi2_ref_data_byte;
  673|  26.9k|            WORD32 *pi4_ref_array;
  674|  26.9k|            WORD32 i4_i;
  675|       |
  676|       |            /* if reference layer is not coded then no processing */
  677|  26.9k|            if(0 != (i4_ref_nnz & 0x1))
  ------------------
  |  Branch (677:16): [True: 0, False: 26.9k]
  ------------------
  678|      0|            {
  679|      0|                pi2_ref_data_byte = pi2_inp_data;
  680|       |
  681|       |                /* ----------- Horizontal Interpolation ---------------- */
  682|      0|                pi4_ref_array = (WORD32 *) pi2_refarray_buffer;
  683|       |
  684|      0|                for(i4_i = 0; i4_i < SUB_BLOCK_HEIGHT; i4_i++)
  ------------------
  |  |   62|      0|#define SUB_BLOCK_HEIGHT 4
  ------------------
  |  Branch (684:31): [True: 0, False: 0]
  ------------------
  685|      0|                {
  686|      0|                    WORD16 i2_coeff1, i2_coeff2;
  687|      0|                    i2_coeff1 = (WORD16) (*pi2_ref_data_byte++);
  688|       |
  689|       |                    /* populate the first inter sample */
  690|      0|                    *pi4_ref_array++ = i2_coeff1 << 2;
  691|       |
  692|      0|                    i2_coeff2 = (WORD16) (*pi2_ref_data_byte++);
  693|       |
  694|       |                    /* populate 2 samples based on current coeffs */
  695|      0|                    *pi4_ref_array++ = ((i2_coeff1 << 1) + (i2_coeff1) + (i2_coeff2));
  696|      0|                    *pi4_ref_array++ = ((i2_coeff2 << 1) + (i2_coeff2) + (i2_coeff1));
  697|       |
  698|      0|                    i2_coeff1 = (WORD16) (*pi2_ref_data_byte++);
  699|       |
  700|       |                    /* populate 2 samples based on current coeffs */
  701|      0|                    *pi4_ref_array++ = ((i2_coeff2 << 1) + (i2_coeff2) + (i2_coeff1));
  702|      0|                    *pi4_ref_array++ = ((i2_coeff1 << 1) + (i2_coeff1) + (i2_coeff2));
  703|       |
  704|      0|                    i2_coeff2 = (WORD16) (*pi2_ref_data_byte++);
  705|       |
  706|       |                    /* populate 2 samples based on current coeffs */
  707|      0|                    *pi4_ref_array++ = ((i2_coeff1 << 1) + (i2_coeff1) + (i2_coeff2));
  708|      0|                    *pi4_ref_array++ = ((i2_coeff2 << 1) + (i2_coeff2) + (i2_coeff1));
  709|       |
  710|       |                    /* populate the last inter sample */
  711|      0|                    *pi4_ref_array++ = i2_coeff2 << 2;
  712|       |
  713|       |                    /* vertical loop uopdates */
  714|      0|                    pi2_ref_data_byte = pi2_inp_data + ((i4_i + 1) * i4_inp_data_stride);
  715|      0|                }
  716|       |
  717|       |                /* ----------- Vertical Interpolation ---------------- */
  718|      0|                pi4_ref_array = (WORD32 *) pi2_refarray_buffer;
  719|       |
  720|      0|                for(i4_i = 0; i4_i < BLOCK_WIDTH; i4_i++)
  ------------------
  |  |   64|      0|#define BLOCK_WIDTH 8
  ------------------
  |  Branch (720:31): [True: 0, False: 0]
  ------------------
  721|      0|                {
  722|      0|                    WORD32 *pi4_ref_array_temp;
  723|      0|                    WORD16 *pi2_out;
  724|      0|                    WORD32 i4_horz_samp_1, i4_horz_samp_2;
  725|       |
  726|      0|                    pi4_ref_array_temp = pi4_ref_array;
  727|      0|                    pi2_out = pi2_out_res;
  728|      0|                    i4_horz_samp_1 = *pi4_ref_array_temp;
  729|       |
  730|       |                    /* populate the first inter sample */
  731|      0|                    *pi2_out = (i4_horz_samp_1 + 2) >> 2;
  732|      0|                    pi2_out += i4_out_res_stride;
  733|       |
  734|       |                    /* unroll loop count 1 */
  735|      0|                    pi4_ref_array_temp += BLOCK_WIDTH;
  ------------------
  |  |   64|      0|#define BLOCK_WIDTH 8
  ------------------
  736|      0|                    i4_horz_samp_2 = *pi4_ref_array_temp;
  737|       |
  738|       |                    /* populate 2 samples based on current coeffs */
  739|      0|                    *pi2_out =
  740|      0|                        ((i4_horz_samp_1 << 1) + (i4_horz_samp_1) + (i4_horz_samp_2) + 8) >> 4;
  741|      0|                    pi2_out += i4_out_res_stride;
  742|      0|                    *pi2_out =
  743|      0|                        ((i4_horz_samp_2 << 1) + (i4_horz_samp_2) + (i4_horz_samp_1) + 8) >> 4;
  744|      0|                    pi2_out += i4_out_res_stride;
  745|       |
  746|       |                    /* unroll loop count 2 */
  747|      0|                    pi4_ref_array_temp += BLOCK_WIDTH;
  ------------------
  |  |   64|      0|#define BLOCK_WIDTH 8
  ------------------
  748|      0|                    i4_horz_samp_1 = *pi4_ref_array_temp;
  749|       |
  750|       |                    /* populate 2 samples based on current coeffs */
  751|      0|                    *pi2_out =
  752|      0|                        ((i4_horz_samp_2 << 1) + (i4_horz_samp_2) + (i4_horz_samp_1) + 8) >> 4;
  753|      0|                    pi2_out += i4_out_res_stride;
  754|      0|                    *pi2_out =
  755|      0|                        ((i4_horz_samp_1 << 1) + (i4_horz_samp_1) + (i4_horz_samp_2) + 8) >> 4;
  756|      0|                    pi2_out += i4_out_res_stride;
  757|       |
  758|       |                    /* unroll loop count 3 */
  759|      0|                    pi4_ref_array_temp += BLOCK_WIDTH;
  ------------------
  |  |   64|      0|#define BLOCK_WIDTH 8
  ------------------
  760|      0|                    i4_horz_samp_2 = *pi4_ref_array_temp;
  761|       |
  762|       |                    /* populate 2 samples based on current coeffs */
  763|      0|                    *pi2_out =
  764|      0|                        ((i4_horz_samp_1 << 1) + (i4_horz_samp_1) + (i4_horz_samp_2) + 8) >> 4;
  765|      0|                    pi2_out += i4_out_res_stride;
  766|      0|                    *pi2_out =
  767|      0|                        ((i4_horz_samp_2 << 1) + (i4_horz_samp_2) + (i4_horz_samp_1) + 8) >> 4;
  768|      0|                    pi2_out += i4_out_res_stride;
  769|       |
  770|       |                    /* populate the last inter sample */
  771|      0|                    *pi2_out = (i4_horz_samp_2 + 2) >> 2;
  772|       |
  773|       |                    /* horizontal loop updates */
  774|      0|                    pi4_ref_array++;
  775|      0|                    pi2_out_res++;
  776|      0|                }
  777|      0|            }
  778|  26.9k|            else
  779|  26.9k|            {
  780|  26.9k|                pi2_out_res += BLOCK_WIDTH;
  ------------------
  |  |   64|  26.9k|#define BLOCK_WIDTH 8
  ------------------
  781|  26.9k|            }
  782|       |
  783|       |            /* Block level loop updates */
  784|  26.9k|            if(1 == i4_blk_ctr)
  ------------------
  |  Branch (784:16): [True: 6.73k, False: 20.2k]
  ------------------
  785|  6.73k|            {
  786|  6.73k|                pi2_inp_data -= SUB_BLOCK_WIDTH;
  ------------------
  |  |   61|  6.73k|#define SUB_BLOCK_WIDTH 4
  ------------------
  787|  6.73k|                pi2_inp_data += (i4_inp_data_stride * SUB_BLOCK_HEIGHT);
  ------------------
  |  |   62|  6.73k|#define SUB_BLOCK_HEIGHT 4
  ------------------
  788|  6.73k|                pi2_out_res -= MB_WIDTH;
  ------------------
  |  |   67|  6.73k|#define MB_WIDTH 16
  ------------------
  789|  6.73k|                pi2_out_res += (i4_out_res_stride * BLOCK_HEIGHT);
  ------------------
  |  |   65|  6.73k|#define BLOCK_HEIGHT 8
  ------------------
  790|  6.73k|                i4_ref_nnz >>= 2;
  791|  6.73k|            }
  792|  20.2k|            else
  793|  20.2k|            {
  794|  20.2k|                pi2_inp_data += SUB_BLOCK_WIDTH;
  ------------------
  |  |   61|  20.2k|#define SUB_BLOCK_WIDTH 4
  ------------------
  795|  20.2k|            }
  796|       |
  797|  26.9k|            i4_ref_nnz >>= 1;
  798|       |
  799|  26.9k|        } /* end of loop over all the blocks */
  800|  6.73k|    }
  801|  6.73k|    return;
  802|  6.73k|}
isvcd_ref_layer_ptr_incr:
  839|  2.11k|{
  840|  2.11k|    WORD32 i4_x, i4_y;
  841|  2.11k|    WORD32 i4_x_idx, i4_y_idx;
  842|  2.11k|    WORD32 i4_prev_x, i4_prev_y;
  843|  2.11k|    WORD32 i4_const_val;
  844|  2.11k|    WORD32 i4_pos_x, i4_pos_y;
  845|  2.11k|    WORD32 i4_trans_size;
  846|  2.11k|    WORD32 i4_act_ary_wd, i4_act_ary_ht;
  847|  2.11k|    WORD32 i4_and_const;
  848|  2.11k|    UWORD8 *pu1_incr_x, *pu1_incr_y;
  849|  2.11k|    WORD32 i4_mb_sft;
  850|  2.11k|    WORD32 i4_mb_x, i4_mb_y;
  851|  2.11k|    WORD8 *pi1_ref_mb_modes_incr;
  852|  2.11k|    WORD8 *pi1_ref_mb_modes_incr_temp;
  853|  2.11k|    inter_lyr_mb_prms_t *ps_inter_lyr_mb_prms;
  854|  2.11k|    WORD32 i4_mb_x_strt, i4_mb_y_strt;
  855|  2.11k|    WORD32 i4_mb_quard1_part_x, i4_mb_quard1_part_y;
  856|  2.11k|    WORD32 i4_x_ref, i4_y_ref;
  857|  2.11k|    WORD32 i4_tx_size, i4_tx_size_q0, i4_tx_size_q1, i4_tx_size_q2, i4_tx_size_q3;
  858|  2.11k|    WORD8 i1_mb_mode_q0, i1_mb_mode_q1, i1_mb_mode_q2, i1_mb_mode_q3;
  859|  2.11k|    WORD32 i4_mb_wd;
  860|  2.11k|    WORD32 i4_mb_ht;
  861|       |
  862|  2.11k|    i4_mb_wd = MB_WIDTH >> i4_chroma_flag;
  ------------------
  |  |   67|  2.11k|#define MB_WIDTH 16
  ------------------
  863|  2.11k|    i4_mb_ht = MB_HEIGHT >> i4_chroma_flag;
  ------------------
  |  |   68|  2.11k|#define MB_HEIGHT 16
  ------------------
  864|       |
  865|       |    /* Memset to 1 the increment buffers */
  866|  2.11k|    memset(pu1_ref_x_ptr_incr, 1, (i4_refary_wd * i4_refary_ht));
  867|  2.11k|    memset(pu1_ref_y_ptr_incr, 1, (i4_refary_wd * i4_refary_ht));
  868|       |
  869|       |    /* Initialise actual width and height */
  870|  2.11k|    i4_act_ary_wd = i4_refary_wd;
  871|  2.11k|    i4_act_ary_ht = i4_refary_ht;
  872|       |
  873|       |    /* Initialize x and y */
  874|  2.11k|    i4_x = 0;
  875|  2.11k|    i4_y = 0;
  876|  2.11k|    i4_prev_y = 0;
  877|  2.11k|    i4_mb_sft = (MB_WIDTH_SHIFT - i4_chroma_flag);
  ------------------
  |  |   70|  2.11k|#define MB_WIDTH_SHIFT 4
  ------------------
  878|       |
  879|       |    /* Loop over all MBs in the reference array */
  880|  2.11k|    if(0 == i4_chroma_flag)
  ------------------
  |  Branch (880:8): [True: 706, False: 1.41k]
  ------------------
  881|    706|    {
  882|    706|        i4_x_ref = i4_x_offset + 0;
  883|    706|        i4_y_ref = i4_y_offset + 0;
  884|    706|        i4_mb_x_strt = i4_x_ref % i4_mb_wd;
  885|    706|        i4_mb_y_strt = i4_y_ref % i4_mb_ht;
  886|    706|        i4_mb_quard1_part_x = i4_mb_wd - i4_mb_x_strt;
  887|    706|        i4_mb_quard1_part_y = i4_mb_ht - i4_mb_y_strt;
  888|       |
  889|    706|        if(!(i4_mb_quard1_part_x >= 0))
  ------------------
  |  Branch (889:12): [True: 0, False: 706]
  ------------------
  890|      0|        {
  891|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  892|      0|        }
  893|    706|        if(!(i4_mb_quard1_part_y >= 0))
  ------------------
  |  Branch (893:12): [True: 0, False: 706]
  ------------------
  894|      0|        {
  895|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  896|      0|        }
  897|       |
  898|       |        /* Take care of negative offsets */
  899|    706|        if(i4_x_ref > 0)
  ------------------
  |  Branch (899:12): [True: 533, False: 173]
  ------------------
  900|    533|        {
  901|    533|            i4_mb_x = (i4_x_ref >> i4_mb_sft);
  902|    533|        }
  903|    173|        else
  904|    173|        {
  905|    173|            i4_mb_x = 0;
  906|    173|        }
  907|    706|        if(i4_y_ref > 0)
  ------------------
  |  Branch (907:12): [True: 677, False: 29]
  ------------------
  908|    677|        {
  909|    677|            i4_mb_y = (i4_y_ref >> i4_mb_sft);
  910|    677|        }
  911|     29|        else
  912|     29|        {
  913|     29|            i4_mb_y = 0;
  914|     29|        }
  915|       |
  916|       |        /* get the location of the byte which has the current mb mode */
  917|    706|        pi1_ref_mb_modes_incr = pi1_ref_mb_modes + (i4_mb_y * i4_ref_mode_stride * i4_element_size);
  918|    706|        pi1_ref_mb_modes_incr += (i4_mb_x * i4_element_size);
  919|    706|        ps_inter_lyr_mb_prms = (inter_lyr_mb_prms_t *) pi1_ref_mb_modes_incr;
  920|    706|        i1_mb_mode_q0 = ps_inter_lyr_mb_prms->i1_mb_mode;
  921|    706|        i4_tx_size_q0 =
  922|    706|            (i1_mb_mode_q0 <= SVC_INTER_MB)
  ------------------
  |  |  114|    706|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (922:13): [True: 590, False: 116]
  ------------------
  923|    706|                ? ((ps_inter_lyr_mb_prms->i1_tx_size < 0) ? 1 : ps_inter_lyr_mb_prms->i1_tx_size)
  ------------------
  |  Branch (923:20): [True: 0, False: 590]
  ------------------
  924|    706|                : 1;
  925|       |
  926|    706|        pi1_ref_mb_modes_incr_temp = pi1_ref_mb_modes_incr;
  927|    706|        if(i4_mb_quard1_part_x > 0)
  ------------------
  |  Branch (927:12): [True: 706, False: 0]
  ------------------
  928|    706|        {
  929|    706|            pi1_ref_mb_modes_incr_temp = pi1_ref_mb_modes_incr + i4_element_size;
  930|    706|            ps_inter_lyr_mb_prms = (inter_lyr_mb_prms_t *) pi1_ref_mb_modes_incr_temp;
  931|    706|            i1_mb_mode_q1 = ps_inter_lyr_mb_prms->i1_mb_mode;
  932|    706|            i4_tx_size_q1 =
  933|    706|                (i1_mb_mode_q1 <= SVC_INTER_MB)
  ------------------
  |  |  114|    706|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (933:17): [True: 618, False: 88]
  ------------------
  934|    706|                    ? ((ps_inter_lyr_mb_prms->i1_tx_size < 0) ? 1
  ------------------
  |  Branch (934:24): [True: 245, False: 373]
  ------------------
  935|    618|                                                              : ps_inter_lyr_mb_prms->i1_tx_size)
  936|    706|                    : 1;
  937|    706|        }
  938|       |
  939|    706|        if(i4_mb_quard1_part_y > 0)
  ------------------
  |  Branch (939:12): [True: 706, False: 0]
  ------------------
  940|    706|        {
  941|    706|            pi1_ref_mb_modes_incr_temp =
  942|    706|                pi1_ref_mb_modes_incr + (i4_ref_mode_stride * i4_element_size);
  943|    706|            ps_inter_lyr_mb_prms = (inter_lyr_mb_prms_t *) pi1_ref_mb_modes_incr_temp;
  944|    706|            i1_mb_mode_q2 = ps_inter_lyr_mb_prms->i1_mb_mode;
  945|    706|            i4_tx_size_q2 =
  946|    706|                (i1_mb_mode_q2 <= SVC_INTER_MB)
  ------------------
  |  |  114|    706|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (946:17): [True: 605, False: 101]
  ------------------
  947|    706|                    ? ((ps_inter_lyr_mb_prms->i1_tx_size < 0) ? 1
  ------------------
  |  Branch (947:24): [True: 32, False: 573]
  ------------------
  948|    605|                                                              : ps_inter_lyr_mb_prms->i1_tx_size)
  949|    706|                    : 1;
  950|    706|        }
  951|       |
  952|    706|        if((i4_mb_quard1_part_x > 0) && (i4_mb_quard1_part_y > 0))
  ------------------
  |  Branch (952:12): [True: 706, False: 0]
  |  Branch (952:41): [True: 706, False: 0]
  ------------------
  953|    706|        {
  954|    706|            pi1_ref_mb_modes_incr_temp =
  955|    706|                pi1_ref_mb_modes_incr + (i4_ref_mode_stride * i4_element_size) + i4_element_size;
  956|    706|            ps_inter_lyr_mb_prms = (inter_lyr_mb_prms_t *) pi1_ref_mb_modes_incr_temp;
  957|    706|            i1_mb_mode_q3 = ps_inter_lyr_mb_prms->i1_mb_mode;
  958|    706|            i4_tx_size_q3 =
  959|    706|                (i1_mb_mode_q3 <= SVC_INTER_MB)
  ------------------
  |  |  114|    706|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (959:17): [True: 616, False: 90]
  ------------------
  960|    706|                    ? ((ps_inter_lyr_mb_prms->i1_tx_size < 0) ? 1
  ------------------
  |  Branch (960:24): [True: 275, False: 341]
  ------------------
  961|    616|                                                              : ps_inter_lyr_mb_prms->i1_tx_size)
  962|    706|                    : 1;
  963|    706|        }
  964|       |
  965|    706|        do
  966|  2.82k|        {
  967|  2.82k|            WORD32 i4_idx;
  968|  2.82k|            WORD32 i4_wd, i4_ht;
  969|  2.82k|            WORD32 i4_max_pos_x, i4_max_pos_y;
  970|       |
  971|  2.82k|            i4_prev_x = i4_x;
  972|  2.82k|            i4_x_ref = i4_x_offset + i4_x;
  973|  2.82k|            i4_y_ref = i4_y_offset + i4_y;
  974|  2.82k|            i4_tx_size = i4_tx_size_q0;
  975|  2.82k|            if(i4_x >= i4_mb_quard1_part_x)
  ------------------
  |  Branch (975:16): [True: 1.06k, False: 1.75k]
  ------------------
  976|  1.06k|            {
  977|  1.06k|                if(i4_y < i4_mb_quard1_part_y)
  ------------------
  |  Branch (977:20): [True: 562, False: 504]
  ------------------
  978|    562|                {
  979|    562|                    i4_tx_size = i4_tx_size_q1;
  980|    562|                }
  981|    504|                else if(i4_y >= i4_mb_quard1_part_y)
  ------------------
  |  Branch (981:25): [True: 504, False: 0]
  ------------------
  982|    504|                {
  983|    504|                    i4_tx_size = i4_tx_size_q3;
  984|    504|                }
  985|  1.06k|            }
  986|  1.75k|            else if(i4_x < i4_mb_quard1_part_x)
  ------------------
  |  Branch (986:21): [True: 1.75k, False: 0]
  ------------------
  987|  1.75k|            {
  988|  1.75k|                if(i4_y >= i4_mb_quard1_part_y)
  ------------------
  |  Branch (988:20): [True: 850, False: 908]
  ------------------
  989|    850|                {
  990|    850|                    i4_tx_size = i4_tx_size_q2;
  991|    850|                }
  992|  1.75k|            }
  993|       |
  994|       |            /* Get the transform size as 4 or 8 */
  995|  2.82k|            i4_trans_size = ((i4_tx_size + 1) << 2);
  996|  2.82k|            i4_const_val = i4_trans_size - 1;
  997|  2.82k|            i4_and_const = i4_const_val;
  998|       |
  999|       |            /* Fill horizontal tx block edges of current reference mb with 0 */
 1000|  2.82k|            pu1_incr_x = pu1_ref_x_ptr_incr + i4_x;
 1001|  2.82k|            pu1_incr_x += (i4_y * i4_refary_wd);
 1002|  2.82k|            i4_ht = (16 - (i4_y_ref & 0xF));
 1003|  2.82k|            i4_ht = MIN((i4_act_ary_ht - i4_y), i4_ht);
  ------------------
  |  |   61|  2.82k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 1.41k, False: 1.41k]
  |  |  ------------------
  ------------------
 1004|       |
 1005|  2.82k|            i4_x_idx = i4_x;
 1006|  2.82k|            i4_pos_x = i4_x_ref & 0xF;
 1007|  2.82k|            i4_max_pos_x = 16;
 1008|  2.82k|            i4_x += (16 - i4_pos_x);
 1009|       |
 1010|       |            /* Get the transform block edge pos */
 1011|  2.82k|            i4_idx = (i4_const_val - (i4_pos_x & i4_and_const));
 1012|  2.82k|            i4_x_idx += i4_idx;
 1013|       |
 1014|  6.69k|            while((i4_pos_x < i4_max_pos_x) && (i4_x_idx < i4_act_ary_wd))
  ------------------
  |  Branch (1014:19): [True: 5.28k, False: 1.41k]
  |  Branch (1014:48): [True: 3.87k, False: 1.41k]
  ------------------
 1015|  3.87k|            {
 1016|  3.87k|                WORD32 i4_i;
 1017|  3.87k|                UWORD8 *pu1_incr;
 1018|       |
 1019|  3.87k|                pu1_incr = pu1_incr_x + i4_idx;
 1020|  27.4k|                for(i4_i = 0; i4_i < i4_ht; i4_i++)
  ------------------
  |  Branch (1020:31): [True: 23.6k, False: 3.87k]
  ------------------
 1021|  23.6k|                {
 1022|       |                    /* Fill the block edge with 0s */
 1023|  23.6k|                    *pu1_incr = 0;
 1024|  23.6k|                    pu1_incr += i4_refary_wd;
 1025|  23.6k|                }
 1026|       |
 1027|       |                /* Updates */
 1028|  3.87k|                i4_pos_x += i4_trans_size;
 1029|  3.87k|                pu1_incr_x += i4_trans_size;
 1030|  3.87k|                i4_x_idx += MIN(i4_trans_size, (i4_act_ary_wd - i4_x_idx));
  ------------------
  |  |   61|  3.87k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 2.44k, False: 1.42k]
  |  |  ------------------
  ------------------
 1031|  3.87k|            }
 1032|       |
 1033|       |            /* Fill vertical tx block edges of current reference mb with 0 */
 1034|  2.82k|            pu1_incr_y = pu1_ref_y_ptr_incr + i4_prev_x;
 1035|  2.82k|            pu1_incr_y += (i4_y * i4_refary_wd);
 1036|  2.82k|            i4_wd = (16 - (i4_x_ref & 0xF));
 1037|  2.82k|            i4_wd = MIN((i4_act_ary_wd - i4_prev_x), i4_wd);
  ------------------
  |  |   61|  2.82k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 1.41k, False: 1.41k]
  |  |  ------------------
  ------------------
 1038|  2.82k|            i4_y_idx = i4_y;
 1039|  2.82k|            i4_pos_y = i4_y_ref & 0xF;
 1040|  2.82k|            i4_max_pos_y = 16;
 1041|  2.82k|            i4_y += (16 - i4_pos_y);
 1042|       |
 1043|       |            /* Get the transform block edge pos */
 1044|  2.82k|            i4_idx = (i4_const_val - (i4_pos_y & i4_and_const));
 1045|  2.82k|            i4_y_idx += i4_idx;
 1046|       |
 1047|  6.46k|            while((i4_pos_y < i4_max_pos_y) && (i4_y_idx < i4_act_ary_ht))
  ------------------
  |  Branch (1047:19): [True: 5.05k, False: 1.41k]
  |  Branch (1047:48): [True: 3.63k, False: 1.41k]
  ------------------
 1048|  3.63k|            {
 1049|  3.63k|                WORD32 i4_i;
 1050|  3.63k|                UWORD8 *pu1_incr;
 1051|       |
 1052|  3.63k|                pu1_incr = pu1_incr_y + i4_idx * i4_refary_wd;
 1053|  27.0k|                for(i4_i = 0; i4_i < i4_wd; i4_i++)
  ------------------
  |  Branch (1053:31): [True: 23.4k, False: 3.63k]
  ------------------
 1054|  23.4k|                {
 1055|       |                    /* Fill the block edge with 0s */
 1056|  23.4k|                    *pu1_incr = 0;
 1057|  23.4k|                    pu1_incr++;
 1058|  23.4k|                }
 1059|       |
 1060|       |                /* Updates */
 1061|  3.63k|                i4_pos_y += i4_trans_size;
 1062|  3.63k|                pu1_incr_y += i4_trans_size * i4_refary_wd;
 1063|  3.63k|                i4_y_idx += MIN(i4_trans_size, (i4_act_ary_ht - i4_y_idx));
  ------------------
  |  |   61|  3.63k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 2.17k, False: 1.45k]
  |  |  ------------------
  ------------------
 1064|  3.63k|            }
 1065|       |
 1066|       |            /* Loop updates */
 1067|  2.82k|            if(i4_x < i4_act_ary_wd)
  ------------------
  |  Branch (1067:16): [True: 1.41k, False: 1.41k]
  ------------------
 1068|  1.41k|            {
 1069|  1.41k|                i4_y = i4_prev_y;
 1070|  1.41k|            }
 1071|  1.41k|            else if(i4_y < i4_act_ary_ht)
  ------------------
  |  Branch (1071:21): [True: 706, False: 706]
  ------------------
 1072|    706|            {
 1073|    706|                i4_prev_y = i4_y;
 1074|    706|                i4_x = 0;
 1075|    706|            }
 1076|       |
 1077|  2.82k|        } while((i4_y < i4_act_ary_ht) || (i4_x < i4_act_ary_wd));
  ------------------
  |  Branch (1077:17): [True: 2.11k, False: 706]
  |  Branch (1077:43): [True: 0, False: 706]
  ------------------
 1078|       |
 1079|    706|    } /* End of if 0 == i4_chroma_flag */
 1080|  1.41k|    else
 1081|  1.41k|    {
 1082|       |        /* Set the transform size as 4 */
 1083|  1.41k|        i4_trans_size = 4;
 1084|  1.41k|        i4_const_val = 3;
 1085|       |
 1086|  1.41k|        do
 1087|  5.64k|        {
 1088|  5.64k|            WORD32 i4_x_ref, i4_y_ref;
 1089|  5.64k|            WORD32 i4_idx;
 1090|  5.64k|            WORD32 i4_wd, i4_ht;
 1091|  5.64k|            WORD32 i4_max_pos_x, i4_max_pos_y;
 1092|       |
 1093|  5.64k|            i4_prev_x = i4_x;
 1094|  5.64k|            i4_x_ref = i4_x_offset + i4_x;
 1095|  5.64k|            i4_y_ref = i4_y_offset + i4_y;
 1096|       |
 1097|       |            /* Fill horizontal tx block edges of current reference mb with 0 */
 1098|  5.64k|            pu1_incr_x = pu1_ref_x_ptr_incr + i4_x;
 1099|  5.64k|            pu1_incr_x += (i4_y * i4_refary_wd);
 1100|  5.64k|            i4_ht = (8 - (i4_y_ref & 0x7));
 1101|  5.64k|            i4_ht = MIN((i4_act_ary_ht - i4_y), i4_ht);
  ------------------
  |  |   61|  5.64k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 2.82k, False: 2.82k]
  |  |  ------------------
  ------------------
 1102|  5.64k|            i4_x_idx = i4_x;
 1103|  5.64k|            i4_pos_x = i4_x_ref & 0x7;
 1104|  5.64k|            i4_max_pos_x = 8;
 1105|  5.64k|            i4_x += (8 - i4_pos_x);
 1106|       |
 1107|       |            /* Get the transform block edge pos */
 1108|  5.64k|            i4_idx = (i4_const_val - (i4_pos_x & 0x3));
 1109|  5.64k|            i4_x_idx += i4_idx;
 1110|       |
 1111|  10.1k|            while((i4_pos_x < i4_max_pos_x) && (i4_x_idx < i4_act_ary_wd))
  ------------------
  |  Branch (1111:19): [True: 7.32k, False: 2.82k]
  |  Branch (1111:48): [True: 4.49k, False: 2.82k]
  ------------------
 1112|  4.49k|            {
 1113|  4.49k|                WORD32 i4_i;
 1114|  4.49k|                UWORD8 *pu1_incr;
 1115|       |
 1116|  4.49k|                pu1_incr = pu1_incr_x + i4_idx;
 1117|  19.3k|                for(i4_i = 0; i4_i < i4_ht; i4_i++)
  ------------------
  |  Branch (1117:31): [True: 14.8k, False: 4.49k]
  ------------------
 1118|  14.8k|                {
 1119|       |                    /* Fill the block edge with 0s */
 1120|  14.8k|                    *pu1_incr = 0;
 1121|  14.8k|                    pu1_incr += i4_refary_wd;
 1122|  14.8k|                }
 1123|       |
 1124|       |                /* Updates */
 1125|  4.49k|                i4_pos_x += i4_trans_size;
 1126|  4.49k|                pu1_incr_x += i4_trans_size;
 1127|  4.49k|                i4_x_idx += MIN(i4_trans_size, (i4_act_ary_wd - i4_x_idx));
  ------------------
  |  |   61|  4.49k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 1.67k, False: 2.82k]
  |  |  ------------------
  ------------------
 1128|  4.49k|            }
 1129|       |
 1130|       |            /* Fill vertical tx block edges of current reference mb with 0 */
 1131|  5.64k|            pu1_incr_y = pu1_ref_y_ptr_incr + i4_prev_x;
 1132|  5.64k|            pu1_incr_y += (i4_y * i4_refary_wd);
 1133|  5.64k|            i4_wd = (8 - (i4_x_ref & 0x7));
 1134|  5.64k|            i4_wd = MIN((i4_act_ary_wd - i4_prev_x), i4_wd);
  ------------------
  |  |   61|  5.64k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 2.82k, False: 2.82k]
  |  |  ------------------
  ------------------
 1135|  5.64k|            i4_y_idx = i4_y;
 1136|  5.64k|            i4_pos_y = i4_y_ref & 0x7;
 1137|  5.64k|            i4_max_pos_y = 8;
 1138|  5.64k|            i4_y += (8 - i4_pos_y);
 1139|       |
 1140|       |            /* Get the transform block edge pos */
 1141|  5.64k|            i4_idx = (i4_const_val - (i4_pos_y & 0x3));
 1142|  5.64k|            i4_y_idx += i4_idx;
 1143|       |
 1144|  10.1k|            while((i4_pos_y < i4_max_pos_y) && (i4_y_idx < i4_act_ary_ht))
  ------------------
  |  Branch (1144:19): [True: 7.35k, False: 2.82k]
  |  Branch (1144:48): [True: 4.52k, False: 2.82k]
  ------------------
 1145|  4.52k|            {
 1146|  4.52k|                WORD32 i4_i;
 1147|  4.52k|                UWORD8 *pu1_incr;
 1148|       |
 1149|  4.52k|                pu1_incr = pu1_incr_y + i4_idx * i4_refary_wd;
 1150|  19.4k|                for(i4_i = 0; i4_i < i4_wd; i4_i++)
  ------------------
  |  Branch (1150:31): [True: 14.9k, False: 4.52k]
  ------------------
 1151|  14.9k|                {
 1152|       |                    /* Fill the block edge with 0s */
 1153|  14.9k|                    *pu1_incr = 0;
 1154|  14.9k|                    pu1_incr++;
 1155|  14.9k|                }
 1156|       |
 1157|       |                /* Updates */
 1158|  4.52k|                i4_pos_y += i4_trans_size;
 1159|  4.52k|                pu1_incr_y += i4_trans_size * i4_refary_wd;
 1160|  4.52k|                i4_y_idx += MIN(i4_trans_size, (i4_act_ary_ht - i4_y_idx));
  ------------------
  |  |   61|  4.52k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 1.70k, False: 2.82k]
  |  |  ------------------
  ------------------
 1161|  4.52k|            }
 1162|       |
 1163|       |            /* Loop updates */
 1164|  5.64k|            if(i4_x < i4_act_ary_wd)
  ------------------
  |  Branch (1164:16): [True: 2.82k, False: 2.82k]
  ------------------
 1165|  2.82k|            {
 1166|  2.82k|                i4_y = i4_prev_y;
 1167|  2.82k|            }
 1168|  2.82k|            else if(i4_y < i4_act_ary_ht)
  ------------------
  |  Branch (1168:21): [True: 1.41k, False: 1.41k]
  ------------------
 1169|  1.41k|            {
 1170|  1.41k|                i4_prev_y = i4_y;
 1171|  1.41k|                i4_x = 0;
 1172|  1.41k|            }
 1173|       |
 1174|  5.64k|        } while((i4_y < i4_act_ary_ht) || (i4_x < i4_act_ary_wd));
  ------------------
  |  Branch (1174:17): [True: 4.23k, False: 1.41k]
  |  Branch (1174:43): [True: 0, False: 1.41k]
  ------------------
 1175|       |
 1176|  1.41k|    } /* End of chroma */
 1177|  2.11k|    return OK;
  ------------------
  |  |  114|  2.11k|#define OK        0
  ------------------
 1178|       |
 1179|  2.11k|} /* End of "isvcd_ref_layer_ptr_incr" */
isvcd_residual_reflayer_const_non_boundary_mb:
 1186|    672|{
 1187|    672|    WORD32 i4_x_ref, i4_y_ref;
 1188|    672|    WORD32 i4_x, i4_y;
 1189|    672|    WORD32 i4_ref_mb_type;
 1190|    672|    WORD16 *pi2_ref_data_byte;
 1191|    672|    WORD16 *pi2_ref_array_temp;
 1192|       |
 1193|  6.30k|    for(i4_y = 0; i4_y < i4_refarray_ht; i4_y++)
  ------------------
  |  Branch (1193:19): [True: 5.63k, False: 672]
  ------------------
 1194|  5.63k|    {
 1195|  55.5k|        for(i4_x = 0; i4_x < i4_refarray_wd; i4_x++)
  ------------------
  |  Branch (1195:23): [True: 49.9k, False: 5.63k]
  ------------------
 1196|  49.9k|        {
 1197|  49.9k|            i4_y_ref = i4_y;
 1198|  49.9k|            i4_x_ref = i4_x;
 1199|       |
 1200|  49.9k|            i4_ref_mb_type = i4_ref_mb_type_q0;
 1201|  49.9k|            if(i4_x >= i4_mb_quard1_part_x)
  ------------------
  |  Branch (1201:16): [True: 24.9k, False: 24.9k]
  ------------------
 1202|  24.9k|            {
 1203|  24.9k|                if(i4_y < i4_mb_quard1_part_y)
  ------------------
  |  Branch (1203:20): [True: 11.1k, False: 13.8k]
  ------------------
 1204|  11.1k|                {
 1205|  11.1k|                    i4_ref_mb_type = i4_ref_mb_type_q1;
 1206|  11.1k|                }
 1207|  13.8k|                else if(i4_y >= i4_mb_quard1_part_y)
  ------------------
  |  Branch (1207:25): [True: 13.8k, False: 0]
  ------------------
 1208|  13.8k|                {
 1209|  13.8k|                    i4_ref_mb_type = i4_ref_mb_type_q3;
 1210|  13.8k|                }
 1211|  24.9k|            }
 1212|  24.9k|            else if(i4_x < i4_mb_quard1_part_x)
  ------------------
  |  Branch (1212:21): [True: 24.9k, False: 0]
  ------------------
 1213|  24.9k|            {
 1214|  24.9k|                if(i4_y >= i4_mb_quard1_part_y)
  ------------------
  |  Branch (1214:20): [True: 13.8k, False: 11.1k]
  ------------------
 1215|  13.8k|                {
 1216|  13.8k|                    i4_ref_mb_type = i4_ref_mb_type_q2;
 1217|  13.8k|                }
 1218|  24.9k|            }
 1219|       |
 1220|       |            /****************************************************************/
 1221|       |            /* Reference layer Residual Buffer is maintained as 8-bit data  */
 1222|       |            /* Buffer and 1-bit sign bit packed buffer. Sign Byte is read   */
 1223|       |            /* and sign of the data sample is extracted depending upon bit  */
 1224|       |            /* postition.                                                   */
 1225|       |            /****************************************************************/
 1226|       |
 1227|       |            /* update the buffer pointers to appropriate locations */
 1228|  49.9k|            pi2_ref_array_temp = pi2_ref_array + i4_x;
 1229|  49.9k|            pi2_ref_array_temp += i4_y * i4_refarray_wd;
 1230|       |
 1231|       |            /* extract the residual value and fill the buffer */
 1232|  49.9k|            if(SVC_INTER_MB == i4_ref_mb_type)
  ------------------
  |  |  114|  49.9k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (1232:16): [True: 40.1k, False: 9.81k]
  ------------------
 1233|  40.1k|            {
 1234|       |                /* derive the reference data pointers */
 1235|  40.1k|                pi2_ref_data_byte = pi2_inp_data + (i4_x_ref << i4_chroma_flag);
 1236|  40.1k|                pi2_ref_data_byte += i4_y_ref * i4_inp_data_stride;
 1237|       |
 1238|       |                /* store the residual value */
 1239|  40.1k|                *pi2_ref_array_temp = (WORD16) (*pi2_ref_data_byte);
 1240|  40.1k|            }
 1241|  9.81k|            else
 1242|  9.81k|            {
 1243|       |                /* if non inter MB then store the 0 */
 1244|  9.81k|                *pi2_ref_array_temp = 0;
 1245|  9.81k|            }
 1246|  49.9k|        }
 1247|  5.63k|    }
 1248|    672|}
isvcd_residual_reflayer_const_boundary_mb:
 1258|  1.33k|{
 1259|  1.33k|    WORD32 i4_x_ref, i4_y_ref;
 1260|  1.33k|    WORD32 i4_x, i4_y;
 1261|  1.33k|    WORD16 *pi2_ref_data_byte;
 1262|  1.33k|    WORD16 *pi2_ref_array_temp;
 1263|       |
 1264|       |    /*Quard 0*/
 1265|  7.40k|    for(i4_y = 0; i4_y < i4_mb_quard1_part_y; i4_y++)
  ------------------
  |  Branch (1265:19): [True: 6.06k, False: 1.33k]
  ------------------
 1266|  6.06k|    {
 1267|  62.3k|        for(i4_x = 0; i4_x < i4_mb_quard1_part_x; i4_x++)
  ------------------
  |  Branch (1267:23): [True: 56.2k, False: 6.06k]
  ------------------
 1268|  56.2k|        {
 1269|  56.2k|            i4_y_ref = MAX(0, MIN(i4_ref_ht - 1, i4_y + i4_y_offset));
  ------------------
  |  |   60|   112k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 524, False: 55.7k]
  |  |  |  Branch (60:24): [True: 0, False: 56.2k]
  |  |  |  Branch (60:32): [True: 0, False: 55.7k]
  |  |  ------------------
  ------------------
 1270|  56.2k|            i4_x_ref = MAX(0, MIN(i4_ref_wd - 1, i4_x + i4_x_offset));
  ------------------
  |  |   60|   112k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 2.41k, False: 53.8k]
  |  |  |  Branch (60:24): [True: 0, False: 56.2k]
  |  |  |  Branch (60:32): [True: 0, False: 53.8k]
  |  |  ------------------
  ------------------
 1271|       |
 1272|       |            /****************************************************************/
 1273|       |            /* Reference layer Residual Buffer is maintained as 8-bit data  */
 1274|       |            /* Buffer and 1-bit sign bit packed buffer. Sign Byte is read   */
 1275|       |            /* and sign of the data sample is extracted depending upon bit  */
 1276|       |            /* postition.                                                   */
 1277|       |            /****************************************************************/
 1278|       |
 1279|       |            /* update the buffer pointers to appropriate locations */
 1280|  56.2k|            pi2_ref_array_temp = pi2_ref_array + i4_x;
 1281|  56.2k|            pi2_ref_array_temp += i4_y * i4_refarray_wd;
 1282|       |
 1283|       |            /* extract the residual value and fill the buffer */
 1284|  56.2k|            if(SVC_INTER_MB == i4_ref_mb_type_q0)
  ------------------
  |  |  114|  56.2k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (1284:16): [True: 48.0k, False: 8.13k]
  ------------------
 1285|  48.0k|            {
 1286|       |                /* input pointer will be pointing to (xoffset,yoffset) */
 1287|       |                /* So subtract the correction to reference location    */
 1288|  48.0k|                if(0 <= i4_x_offset)
  ------------------
  |  Branch (1288:20): [True: 24.9k, False: 23.1k]
  ------------------
 1289|  24.9k|                {
 1290|       |                    /* if only inside frame dimension */
 1291|  24.9k|                    i4_x_ref = i4_x_ref - i4_x_offset;
 1292|  24.9k|                }
 1293|       |
 1294|  48.0k|                if(0 <= i4_y_offset)
  ------------------
  |  Branch (1294:20): [True: 43.7k, False: 4.35k]
  ------------------
 1295|  43.7k|                {
 1296|       |                    /* if only inside frame dimension */
 1297|  43.7k|                    i4_y_ref = i4_y_ref - i4_y_offset;
 1298|  43.7k|                }
 1299|       |                /* derive the reference data pointers */
 1300|       |
 1301|  48.0k|                pi2_ref_data_byte = pi2_inp_data + (i4_x_ref << i4_chroma_flag);
 1302|  48.0k|                pi2_ref_data_byte += i4_y_ref * i4_inp_data_stride;
 1303|       |
 1304|       |                /* store the residual value */
 1305|  48.0k|                *pi2_ref_array_temp = (WORD16) (*pi2_ref_data_byte);
 1306|  48.0k|            }
 1307|  8.13k|            else
 1308|  8.13k|            {
 1309|       |                /* if non inter MB then store the 0 */
 1310|  8.13k|                *pi2_ref_array_temp = 0;
 1311|  8.13k|            }
 1312|  56.2k|        }
 1313|  6.06k|    }
 1314|       |
 1315|       |    /*Quard 1*/
 1316|  7.40k|    for(i4_y = 0; i4_y < i4_mb_quard1_part_y; i4_y++)
  ------------------
  |  Branch (1316:19): [True: 6.06k, False: 1.33k]
  ------------------
 1317|  6.06k|    {
 1318|  12.3k|        for(i4_x = i4_mb_quard1_part_x; i4_x < i4_refarray_wd; i4_x++)
  ------------------
  |  Branch (1318:41): [True: 6.29k, False: 6.06k]
  ------------------
 1319|  6.29k|        {
 1320|  6.29k|            i4_y_ref = MAX(0, MIN(i4_ref_ht - 1, i4_y + i4_y_offset));
  ------------------
  |  |   60|  12.5k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 204, False: 6.08k]
  |  |  |  Branch (60:24): [True: 0, False: 6.29k]
  |  |  |  Branch (60:32): [True: 0, False: 6.08k]
  |  |  ------------------
  ------------------
 1321|  6.29k|            i4_x_ref = MAX(0, MIN(i4_ref_wd - 1, i4_x + i4_x_offset));
  ------------------
  |  |   60|  12.5k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 6.29k]
  |  |  |  Branch (60:24): [True: 2.89k, False: 3.40k]
  |  |  |  Branch (60:32): [True: 2.89k, False: 3.40k]
  |  |  ------------------
  ------------------
 1322|       |
 1323|       |            /****************************************************************/
 1324|       |            /* Reference layer Residual Buffer is maintained as 8-bit data  */
 1325|       |            /* Buffer and 1-bit sign bit packed buffer. Sign Byte is read   */
 1326|       |            /* and sign of the data sample is extracted depending upon bit  */
 1327|       |            /* postition.                                                   */
 1328|       |            /****************************************************************/
 1329|       |
 1330|       |            /* update the buffer pointers to appropriate locations */
 1331|  6.29k|            pi2_ref_array_temp = pi2_ref_array + i4_x;
 1332|  6.29k|            pi2_ref_array_temp += i4_y * i4_refarray_wd;
 1333|       |
 1334|       |            /* extract the residual value and fill the buffer */
 1335|  6.29k|            if(SVC_INTER_MB == i4_ref_mb_type_q1)
  ------------------
  |  |  114|  6.29k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (1335:16): [True: 5.17k, False: 1.12k]
  ------------------
 1336|  5.17k|            {
 1337|       |                /* input pointer will be pointing to (xoffset,yoffset) */
 1338|       |                /* So subtract the correction to reference location    */
 1339|  5.17k|                if(0 <= i4_x_offset)
  ------------------
  |  Branch (1339:20): [True: 5.17k, False: 0]
  ------------------
 1340|  5.17k|                {
 1341|       |                    /* if only inside frame dimension */
 1342|  5.17k|                    i4_x_ref = i4_x_ref - i4_x_offset;
 1343|  5.17k|                }
 1344|  5.17k|                if(0 <= i4_y_offset)
  ------------------
  |  Branch (1344:20): [True: 2.78k, False: 2.38k]
  ------------------
 1345|  2.78k|                {
 1346|       |                    /* if only inside frame dimension */
 1347|  2.78k|                    i4_y_ref = i4_y_ref - i4_y_offset;
 1348|  2.78k|                }
 1349|       |                /* derive the reference data pointers */
 1350|       |
 1351|  5.17k|                pi2_ref_data_byte = pi2_inp_data + (i4_x_ref << i4_chroma_flag);
 1352|  5.17k|                pi2_ref_data_byte += i4_y_ref * i4_inp_data_stride;
 1353|       |
 1354|       |                /* store the residual value */
 1355|  5.17k|                *pi2_ref_array_temp = (WORD16) (*pi2_ref_data_byte);
 1356|  5.17k|            }
 1357|  1.12k|            else
 1358|  1.12k|            {
 1359|       |                /* if non inter MB then store the 0 */
 1360|  1.12k|                *pi2_ref_array_temp = 0;
 1361|  1.12k|            }
 1362|  6.29k|        }
 1363|  6.06k|    }
 1364|       |
 1365|       |    /*Quard 2*/
 1366|  6.69k|    for(i4_y = i4_mb_quard1_part_y; i4_y < i4_refarray_ht; i4_y++)
  ------------------
  |  Branch (1366:37): [True: 5.35k, False: 1.33k]
  ------------------
 1367|  5.35k|    {
 1368|  56.7k|        for(i4_x = 0; i4_x < i4_mb_quard1_part_x; i4_x++)
  ------------------
  |  Branch (1368:23): [True: 51.4k, False: 5.35k]
  ------------------
 1369|  51.4k|        {
 1370|  51.4k|            i4_y_ref = MAX(0, MIN(i4_ref_ht - 1, i4_y + i4_y_offset));
  ------------------
  |  |   60|   102k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 51.4k]
  |  |  |  Branch (60:24): [True: 706, False: 50.6k]
  |  |  |  Branch (60:32): [True: 706, False: 50.6k]
  |  |  ------------------
  ------------------
 1371|  51.4k|            i4_x_ref = MAX(0, MIN(i4_ref_wd - 1, i4_x + i4_x_offset));
  ------------------
  |  |   60|   102k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 1.93k, False: 49.4k]
  |  |  |  Branch (60:24): [True: 0, False: 51.4k]
  |  |  |  Branch (60:32): [True: 0, False: 49.4k]
  |  |  ------------------
  ------------------
 1372|       |
 1373|       |            /****************************************************************/
 1374|       |            /* Reference layer Residual Buffer is maintained as 8-bit data  */
 1375|       |            /* Buffer and 1-bit sign bit packed buffer. Sign Byte is read   */
 1376|       |            /* and sign of the data sample is extracted depending upon bit  */
 1377|       |            /* postition.                                                   */
 1378|       |            /****************************************************************/
 1379|       |
 1380|       |            /* update the buffer pointers to appropriate locations */
 1381|  51.4k|            pi2_ref_array_temp = pi2_ref_array + i4_x;
 1382|  51.4k|            pi2_ref_array_temp += i4_y * i4_refarray_wd;
 1383|       |
 1384|       |            /* extract the residual value and fill the buffer */
 1385|  51.4k|            if(SVC_INTER_MB == i4_ref_mb_type_q2)
  ------------------
  |  |  114|  51.4k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (1385:16): [True: 48.3k, False: 3.07k]
  ------------------
 1386|  48.3k|            {
 1387|       |                /* input pointer will be pointing to (xoffset,yoffset) */
 1388|       |                /* So subtract the correction to reference location    */
 1389|  48.3k|                if(0 <= i4_x_offset)
  ------------------
  |  Branch (1389:20): [True: 26.0k, False: 22.3k]
  ------------------
 1390|  26.0k|                {
 1391|       |                    /* if only inside frame dimension */
 1392|  26.0k|                    i4_x_ref = i4_x_ref - i4_x_offset;
 1393|  26.0k|                }
 1394|  48.3k|                if(0 <= i4_y_offset)
  ------------------
  |  Branch (1394:20): [True: 48.3k, False: 0]
  ------------------
 1395|  48.3k|                {
 1396|       |                    /* if only inside frame dimension */
 1397|  48.3k|                    i4_y_ref = i4_y_ref - i4_y_offset;
 1398|  48.3k|                }
 1399|       |                /* derive the reference data pointers */
 1400|  48.3k|                pi2_ref_data_byte = pi2_inp_data + (i4_x_ref << i4_chroma_flag);
 1401|  48.3k|                pi2_ref_data_byte += i4_y_ref * i4_inp_data_stride;
 1402|       |
 1403|       |                /* store the residual value */
 1404|  48.3k|                *pi2_ref_array_temp = (WORD16) (*pi2_ref_data_byte);
 1405|  48.3k|            }
 1406|  3.07k|            else
 1407|  3.07k|            {
 1408|       |                /* if non inter MB then store the 0 */
 1409|  3.07k|                *pi2_ref_array_temp = 0;
 1410|  3.07k|            }
 1411|  51.4k|        }
 1412|  5.35k|    }
 1413|       |
 1414|       |    /*Quard 3*/
 1415|  6.69k|    for(i4_y = i4_mb_quard1_part_y; i4_y < i4_refarray_ht; i4_y++)
  ------------------
  |  Branch (1415:37): [True: 5.35k, False: 1.33k]
  ------------------
 1416|  5.35k|    {
 1417|  8.91k|        for(i4_x = i4_mb_quard1_part_x; i4_x < i4_refarray_wd; i4_x++)
  ------------------
  |  Branch (1417:41): [True: 3.55k, False: 5.35k]
  ------------------
 1418|  3.55k|        {
 1419|  3.55k|            i4_y_ref = MAX(0, MIN(i4_ref_ht - 1, i4_y + i4_y_offset));
  ------------------
  |  |   60|  7.11k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 3.55k]
  |  |  |  Branch (60:24): [True: 186, False: 3.37k]
  |  |  |  Branch (60:32): [True: 186, False: 3.37k]
  |  |  ------------------
  ------------------
 1420|  3.55k|            i4_x_ref = MAX(0, MIN(i4_ref_wd - 1, i4_x + i4_x_offset));
  ------------------
  |  |   60|  7.11k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 0, False: 3.55k]
  |  |  |  Branch (60:24): [True: 3.37k, False: 180]
  |  |  |  Branch (60:32): [True: 3.37k, False: 180]
  |  |  ------------------
  ------------------
 1421|       |
 1422|       |            /****************************************************************/
 1423|       |            /* Reference layer Residual Buffer is maintained as 8-bit data  */
 1424|       |            /* Buffer and 1-bit sign bit packed buffer. Sign Byte is read   */
 1425|       |            /* and sign of the data sample is extracted depending upon bit  */
 1426|       |            /* postition.                                                   */
 1427|       |            /****************************************************************/
 1428|       |
 1429|       |            /* update the buffer pointers to appropriate locations */
 1430|  3.55k|            pi2_ref_array_temp = pi2_ref_array + i4_x;
 1431|  3.55k|            pi2_ref_array_temp += i4_y * i4_refarray_wd;
 1432|       |
 1433|       |            /* extract the residual value and fill the buffer */
 1434|  3.55k|            if(SVC_INTER_MB == i4_ref_mb_type_q3)
  ------------------
  |  |  114|  3.55k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  |  Branch (1434:16): [True: 3.55k, False: 0]
  ------------------
 1435|  3.55k|            {
 1436|       |                /* input pointer will be pointing to (xoffset,yoffset) */
 1437|       |                /* So subtract the correction to reference location    */
 1438|  3.55k|                if(0 <= i4_x_offset)
  ------------------
  |  Branch (1438:20): [True: 3.55k, False: 0]
  ------------------
 1439|  3.55k|                {
 1440|       |                    /* if only inside frame dimension */
 1441|  3.55k|                    i4_x_ref = i4_x_ref - i4_x_offset;
 1442|  3.55k|                }
 1443|  3.55k|                if(0 <= i4_y_offset)
  ------------------
  |  Branch (1443:20): [True: 3.55k, False: 0]
  ------------------
 1444|  3.55k|                {
 1445|       |                    /* if only inside frame dimension */
 1446|  3.55k|                    i4_y_ref = i4_y_ref - i4_y_offset;
 1447|  3.55k|                }
 1448|       |                /* derive the reference data pointers */
 1449|  3.55k|                pi2_ref_data_byte = pi2_inp_data + (i4_x_ref << i4_chroma_flag);
 1450|  3.55k|                pi2_ref_data_byte += i4_y_ref * i4_inp_data_stride;
 1451|       |
 1452|       |                /* store the residual value */
 1453|  3.55k|                *pi2_ref_array_temp = (WORD16) (*pi2_ref_data_byte);
 1454|  3.55k|            }
 1455|      0|            else
 1456|      0|            {
 1457|       |                /* if non inter MB then store the 0 */
 1458|      0|                *pi2_ref_array_temp = 0;
 1459|      0|            }
 1460|  3.55k|        }
 1461|  5.35k|    }
 1462|  1.33k|}
isvcd_residual_reflayer_const:
 1502|  2.11k|{
 1503|  2.11k|    residual_sampling_ctxt_t *ps_ctxt;
 1504|  2.11k|    res_lyr_ctxt *ps_lyr_ctxt;
 1505|  2.11k|    WORD8 *pi1_ref_mb_modes;
 1506|  2.11k|    WORD32 i4_ref_mode_stride;
 1507|  2.11k|    WORD32 i4_element_size;
 1508|  2.11k|    WORD32 i4_ref_wd;
 1509|  2.11k|    WORD32 i4_ref_ht;
 1510|  2.11k|    WORD32 i4_x_offset;
 1511|  2.11k|    WORD32 i4_y_offset;
 1512|  2.11k|    WORD32 i4_refarray_wd;
 1513|  2.11k|    WORD32 i4_refarray_ht;
 1514|  2.11k|    WORD8 i1_edge_mb;
 1515|  2.11k|    WORD16 *pi2_ref_array;
 1516|  2.11k|    WORD32 i4_mb_sft;
 1517|  2.11k|    WORD32 i4_mb_x, i4_mb_y;
 1518|  2.11k|    WORD32 i4_mb_x_strt, i4_mb_y_strt;
 1519|  2.11k|    WORD32 i4_mb_quard1_part_x, i4_mb_quard1_part_y;
 1520|  2.11k|    WORD8 *pi1_ref_mb_modes_incr;
 1521|  2.11k|    WORD8 *pi1_ref_mb_modes_incr_temp;
 1522|  2.11k|    inter_lyr_mb_prms_t *ps_inter_lyr_mb_prms;
 1523|       |
 1524|  2.11k|    WORD32 i4_mb_wd;
 1525|  2.11k|    WORD32 i4_mb_ht;
 1526|  2.11k|    WORD32 i4_x_ref, i4_y_ref;
 1527|  2.11k|    WORD32 i4_ref_mb_type_q0, i4_ref_mb_type_q1, i4_ref_mb_type_q2, i4_ref_mb_type_q3;
 1528|  2.11k|    WORD8 i1_mb_mode_q0, i1_mb_mode_q1, i1_mb_mode_q2, i1_mb_mode_q3;
 1529|  2.11k|    WORD32 ret;
 1530|       |
 1531|  2.11k|    ps_ctxt = (residual_sampling_ctxt_t *) pv_residual_samp_ctxt;
 1532|  2.11k|    ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_ctxt->i4_res_lyr_id];
 1533|  2.11k|    pi2_ref_array = ps_ctxt->pi2_refarray_buffer;
 1534|       |
 1535|  2.11k|    pi1_ref_mb_modes = (WORD8 *) ps_ref_mb_mode->pv_buffer;
 1536|  2.11k|    i4_ref_mode_stride = ps_ref_mb_mode->i4_num_element_stride;
 1537|  2.11k|    i4_element_size = ps_ref_mb_mode->i4_element_size;
 1538|       |
 1539|  2.11k|    if(NULL == pi1_ref_mb_modes)
  ------------------
  |  Branch (1539:8): [True: 0, False: 2.11k]
  ------------------
 1540|      0|    {
 1541|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1542|      0|    }
 1543|       |
 1544|  2.11k|    i4_mb_wd = MB_WIDTH >> i4_chroma_flag;
  ------------------
  |  |   67|  2.11k|#define MB_WIDTH 16
  ------------------
 1545|  2.11k|    i4_mb_ht = MB_HEIGHT >> i4_chroma_flag;
  ------------------
  |  |   68|  2.11k|#define MB_HEIGHT 16
  ------------------
 1546|       |
 1547|       |    /* ----------------------------------------------------------------- */
 1548|       |    /* Deriving the parameters required for further processing           */
 1549|       |    /* ----------------------------------------------------------------- */
 1550|  2.11k|    {
 1551|  2.11k|        ref_mb_map_t *ps_x_off_len;
 1552|  2.11k|        ref_mb_map_t *ps_y_off_len;
 1553|  2.11k|        WORD32 i4_mbaddr_x;
 1554|  2.11k|        WORD32 i4_mbaddr_y;
 1555|  2.11k|        WORD32 i4_base_width;
 1556|  2.11k|        WORD32 i4_base_height;
 1557|  2.11k|        residual_samp_map_ctxt_t *ps_map_ctxt;
 1558|       |
 1559|  2.11k|        if(1 == i4_chroma_flag)
  ------------------
  |  Branch (1559:12): [True: 1.41k, False: 706]
  ------------------
 1560|  1.41k|            ps_map_ctxt = &ps_lyr_ctxt->s_chroma_map_ctxt;
 1561|    706|        else
 1562|    706|            ps_map_ctxt = &ps_lyr_ctxt->s_luma_map_ctxt;
 1563|       |
 1564|  2.11k|        i4_mbaddr_y = ps_coord->u2_mb_y;
 1565|  2.11k|        i4_mbaddr_x = ps_coord->u2_mb_x;
 1566|  2.11k|        i4_base_width = ps_lyr_ctxt->i4_ref_width;
 1567|  2.11k|        i4_base_height = ps_lyr_ctxt->i4_ref_height;
 1568|  2.11k|        i4_ref_wd = i4_base_width >> i4_chroma_flag;
 1569|  2.11k|        i4_ref_ht = i4_base_height >> i4_chroma_flag;
 1570|       |
 1571|       |        /* --------------------------------------------------------------------- */
 1572|       |        /* Extracting information from the mapping context                       */
 1573|       |        /* --------------------------------------------------------------------- */
 1574|  2.11k|        ps_x_off_len = ps_map_ctxt->ps_x_offset_length;
 1575|  2.11k|        ps_y_off_len = ps_map_ctxt->ps_y_offset_length;
 1576|  2.11k|        i4_x_offset = ps_x_off_len[i4_mbaddr_x].i2_offset;
 1577|  2.11k|        i4_y_offset = ps_y_off_len[i4_mbaddr_y].i2_offset;
 1578|  2.11k|        i4_refarray_wd = ps_x_off_len[i4_mbaddr_x].i2_length;
 1579|  2.11k|        i4_refarray_ht = ps_y_off_len[i4_mbaddr_y].i2_length;
 1580|  2.11k|    }
 1581|       |
 1582|       |    /* Call the module to fill the increments based on transform blocks */
 1583|  2.11k|    ret = isvcd_ref_layer_ptr_incr(pi1_ref_mb_modes, i4_ref_mode_stride, i4_element_size,
 1584|  2.11k|                                   i4_x_offset, i4_y_offset, i4_refarray_wd, i4_refarray_ht,
 1585|  2.11k|                                   ps_ctxt->pu1_ref_x_ptr_incr, ps_ctxt->pu1_ref_y_ptr_incr,
 1586|  2.11k|                                   i4_chroma_flag);
 1587|       |
 1588|  2.11k|    if(ret != OK)
  ------------------
  |  |  114|  2.11k|#define OK        0
  ------------------
  |  Branch (1588:8): [True: 0, False: 2.11k]
  ------------------
 1589|      0|    {
 1590|      0|        return ret;
 1591|      0|    }
 1592|  2.11k|    i4_mb_sft = (MB_WIDTH_SHIFT - i4_chroma_flag);
  ------------------
  |  |   70|  2.11k|#define MB_WIDTH_SHIFT 4
  ------------------
 1593|       |
 1594|       |    /* --------------------------------------------------------------------- */
 1595|       |    /* MB Level Resampling for the MB - Pointers sent for MB in both layers  */
 1596|       |    /* This has been written according to the dyadic case                    */
 1597|       |    /* --------------------------------------------------------------------- */
 1598|  2.11k|    i4_y_ref = MAX(0, MIN(i4_ref_ht - 1, 0 + i4_y_offset));
  ------------------
  |  |   60|  4.23k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 87, False: 2.03k]
  |  |  |  Branch (60:24): [True: 0, False: 2.11k]
  |  |  |  Branch (60:32): [True: 0, False: 2.03k]
  |  |  ------------------
  ------------------
 1599|  2.11k|    i4_x_ref = MAX(0, MIN(i4_ref_wd - 1, 0 + i4_x_offset));
  ------------------
  |  |   60|  4.23k|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 519, False: 1.59k]
  |  |  |  Branch (60:24): [True: 0, False: 2.11k]
  |  |  |  Branch (60:32): [True: 0, False: 1.59k]
  |  |  ------------------
  ------------------
 1600|  2.11k|    i4_mb_x_strt = i4_x_ref % i4_mb_wd;
 1601|  2.11k|    i4_mb_y_strt = i4_y_ref % i4_mb_ht;
 1602|       |
 1603|  2.11k|    i4_mb_quard1_part_x = i4_mb_wd - i4_mb_x_strt;
 1604|  2.11k|    i4_mb_quard1_part_y = i4_mb_ht - i4_mb_y_strt;
 1605|  2.11k|    if(!(i4_mb_quard1_part_x >= 0))
  ------------------
  |  Branch (1605:8): [True: 0, False: 2.11k]
  ------------------
 1606|      0|    {
 1607|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1608|      0|    }
 1609|  2.11k|    if(!(i4_mb_quard1_part_y >= 0))
  ------------------
  |  Branch (1609:8): [True: 0, False: 2.11k]
  ------------------
 1610|      0|    {
 1611|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 1612|      0|    }
 1613|       |
 1614|  2.11k|    i4_mb_x = (i4_x_ref >> i4_mb_sft);
 1615|  2.11k|    i4_mb_y = (i4_y_ref >> i4_mb_sft);
 1616|       |
 1617|       |    /* get the location of the byte which has the current mb mode */
 1618|  2.11k|    pi1_ref_mb_modes_incr = pi1_ref_mb_modes + (i4_mb_y * i4_ref_mode_stride * i4_element_size);
 1619|  2.11k|    pi1_ref_mb_modes_incr += (i4_mb_x * i4_element_size);
 1620|  2.11k|    ps_inter_lyr_mb_prms = (inter_lyr_mb_prms_t *) pi1_ref_mb_modes_incr;
 1621|  2.11k|    i1_mb_mode_q0 = ps_inter_lyr_mb_prms->i1_mb_mode;
 1622|  2.11k|    i1_mb_mode_q1 = i1_mb_mode_q0;
 1623|  2.11k|    i1_mb_mode_q2 = i1_mb_mode_q0;
 1624|  2.11k|    i1_mb_mode_q3 = i1_mb_mode_q0;
 1625|       |
 1626|  2.11k|    pi1_ref_mb_modes_incr_temp = pi1_ref_mb_modes_incr;
 1627|  2.11k|    if(i4_mb_quard1_part_x > 0)
  ------------------
  |  Branch (1627:8): [True: 2.11k, False: 0]
  ------------------
 1628|  2.11k|    {
 1629|  2.11k|        pi1_ref_mb_modes_incr_temp = pi1_ref_mb_modes_incr + i4_element_size;
 1630|  2.11k|        ps_inter_lyr_mb_prms = (inter_lyr_mb_prms_t *) pi1_ref_mb_modes_incr_temp;
 1631|  2.11k|        i1_mb_mode_q1 = ps_inter_lyr_mb_prms->i1_mb_mode;
 1632|  2.11k|    }
 1633|       |
 1634|  2.11k|    if(i4_mb_quard1_part_y > 0)
  ------------------
  |  Branch (1634:8): [True: 2.11k, False: 0]
  ------------------
 1635|  2.11k|    {
 1636|  2.11k|        pi1_ref_mb_modes_incr_temp = pi1_ref_mb_modes_incr + (i4_ref_mode_stride * i4_element_size);
 1637|  2.11k|        ps_inter_lyr_mb_prms = (inter_lyr_mb_prms_t *) pi1_ref_mb_modes_incr_temp;
 1638|  2.11k|        i1_mb_mode_q2 = ps_inter_lyr_mb_prms->i1_mb_mode;
 1639|  2.11k|    }
 1640|       |
 1641|  2.11k|    if((i4_mb_quard1_part_x > 0) && (i4_mb_quard1_part_y > 0))
  ------------------
  |  Branch (1641:8): [True: 2.11k, False: 0]
  |  Branch (1641:37): [True: 2.11k, False: 0]
  ------------------
 1642|  2.11k|    {
 1643|  2.11k|        pi1_ref_mb_modes_incr_temp =
 1644|  2.11k|            pi1_ref_mb_modes_incr + (i4_ref_mode_stride * i4_element_size) + i4_element_size;
 1645|  2.11k|        ps_inter_lyr_mb_prms = (inter_lyr_mb_prms_t *) pi1_ref_mb_modes_incr_temp;
 1646|  2.11k|        i1_mb_mode_q3 = ps_inter_lyr_mb_prms->i1_mb_mode;
 1647|  2.11k|    }
 1648|       |
 1649|  2.11k|    i4_ref_mb_type_q0 = (i1_mb_mode_q0 <= SVC_INTER_MB) ? SVC_INTER_MB : SVC_INTRA_MB;
  ------------------
  |  |  114|  2.11k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
                  i4_ref_mb_type_q0 = (i1_mb_mode_q0 <= SVC_INTER_MB) ? SVC_INTER_MB : SVC_INTRA_MB;
  ------------------
  |  |  114|  1.77k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
                  i4_ref_mb_type_q0 = (i1_mb_mode_q0 <= SVC_INTER_MB) ? SVC_INTER_MB : SVC_INTRA_MB;
  ------------------
  |  |  115|  2.46k|#define SVC_INTRA_MB (1 << 1)       /*!< P or B MBs decoded or inferred*/
  ------------------
  |  Branch (1649:25): [True: 1.77k, False: 348]
  ------------------
 1650|  2.11k|    i4_ref_mb_type_q1 = (i1_mb_mode_q1 <= SVC_INTER_MB) ? SVC_INTER_MB : SVC_INTRA_MB;
  ------------------
  |  |  114|  2.11k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
                  i4_ref_mb_type_q1 = (i1_mb_mode_q1 <= SVC_INTER_MB) ? SVC_INTER_MB : SVC_INTRA_MB;
  ------------------
  |  |  114|  1.85k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
                  i4_ref_mb_type_q1 = (i1_mb_mode_q1 <= SVC_INTER_MB) ? SVC_INTER_MB : SVC_INTRA_MB;
  ------------------
  |  |  115|  2.38k|#define SVC_INTRA_MB (1 << 1)       /*!< P or B MBs decoded or inferred*/
  ------------------
  |  Branch (1650:25): [True: 1.85k, False: 264]
  ------------------
 1651|  2.11k|    i4_ref_mb_type_q2 = (i1_mb_mode_q2 <= SVC_INTER_MB) ? SVC_INTER_MB : SVC_INTRA_MB;
  ------------------
  |  |  114|  2.11k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
                  i4_ref_mb_type_q2 = (i1_mb_mode_q2 <= SVC_INTER_MB) ? SVC_INTER_MB : SVC_INTRA_MB;
  ------------------
  |  |  114|  1.81k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
                  i4_ref_mb_type_q2 = (i1_mb_mode_q2 <= SVC_INTER_MB) ? SVC_INTER_MB : SVC_INTRA_MB;
  ------------------
  |  |  115|  2.42k|#define SVC_INTRA_MB (1 << 1)       /*!< P or B MBs decoded or inferred*/
  ------------------
  |  Branch (1651:25): [True: 1.81k, False: 303]
  ------------------
 1652|  2.11k|    i4_ref_mb_type_q3 = (i1_mb_mode_q3 <= SVC_INTER_MB) ? SVC_INTER_MB : SVC_INTRA_MB;
  ------------------
  |  |  114|  2.11k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
                  i4_ref_mb_type_q3 = (i1_mb_mode_q3 <= SVC_INTER_MB) ? SVC_INTER_MB : SVC_INTRA_MB;
  ------------------
  |  |  114|  1.84k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
                  i4_ref_mb_type_q3 = (i1_mb_mode_q3 <= SVC_INTER_MB) ? SVC_INTER_MB : SVC_INTRA_MB;
  ------------------
  |  |  115|  2.38k|#define SVC_INTRA_MB (1 << 1)       /*!< P or B MBs decoded or inferred*/
  ------------------
  |  Branch (1652:25): [True: 1.84k, False: 270]
  ------------------
 1653|       |
 1654|  2.11k|    i1_edge_mb = (ps_coord->u2_mb_x == 0 || ps_coord->u2_mb_y == 0 ||
  ------------------
  |  Branch (1654:19): [True: 519, False: 1.59k]
  |  Branch (1654:45): [True: 87, False: 1.51k]
  ------------------
 1655|  1.51k|                  (ps_coord->u2_mb_x == ((ps_lyr_ctxt->i4_curr_width >> MB_WIDTH_SHIFT) - 1)) ||
  ------------------
  |  |   70|  1.51k|#define MB_WIDTH_SHIFT 4
  ------------------
  |  Branch (1655:19): [True: 687, False: 825]
  ------------------
 1656|    825|                  (ps_coord->u2_mb_y == ((ps_lyr_ctxt->i4_curr_height >> MB_HEIGHT_SHIFT) - 1)));
  ------------------
  |  |   71|    825|#define MB_HEIGHT_SHIFT 4
  ------------------
  |  Branch (1656:19): [True: 45, False: 780]
  ------------------
 1657|  2.11k|    if(i1_edge_mb)
  ------------------
  |  Branch (1657:8): [True: 1.33k, False: 780]
  ------------------
 1658|  1.33k|    {
 1659|  1.33k|        ps_ctxt->pf_residual_reflayer_const_boundary_mb(
 1660|  1.33k|            pi2_inp_data, i4_inp_data_stride, pi2_ref_array, i4_refarray_wd, i4_refarray_ht,
 1661|  1.33k|            i4_ref_wd, i4_ref_ht, i4_x_offset, i4_y_offset, i4_ref_mb_type_q0, i4_ref_mb_type_q1,
 1662|  1.33k|            i4_ref_mb_type_q2, i4_ref_mb_type_q3, i4_mb_quard1_part_x, i4_mb_quard1_part_y,
 1663|  1.33k|            i4_chroma_flag);
 1664|  1.33k|    }
 1665|    780|    else
 1666|    780|    {
 1667|    780|        ps_ctxt->pf_residual_reflayer_const_non_boundary_mb(
 1668|    780|            pi2_inp_data, i4_inp_data_stride, pi2_ref_array, i4_refarray_wd, i4_refarray_ht,
 1669|    780|            i4_ref_mb_type_q0, i4_ref_mb_type_q1, i4_ref_mb_type_q2, i4_ref_mb_type_q3,
 1670|    780|            i4_mb_quard1_part_x, i4_mb_quard1_part_y, i4_chroma_flag);
 1671|    780|    }
 1672|       |    /* store the values into the place holders */
 1673|  2.11k|    *pi4_refarr_wd = i4_refarray_wd;
 1674|       |
 1675|  2.11k|    return OK;
  ------------------
  |  |  114|  2.11k|#define OK        0
  ------------------
 1676|  2.11k|}
isvcd_interpolate_residual:
 1709|  1.81k|{
 1710|  1.81k|    residual_sampling_ctxt_t *ps_ctxt;
 1711|  1.81k|    residual_samp_map_ctxt_t *ps_map_ctxt;
 1712|  1.81k|    res_lyr_ctxt *ps_lyr_ctxt;
 1713|  1.81k|    ref_pixel_map_t *ps_x_pos_phase;
 1714|  1.81k|    ref_pixel_map_t *ps_y_pos_phase;
 1715|       |
 1716|  1.81k|    WORD32 i4_x, i4_y;
 1717|  1.81k|    WORD32 i4_frm_mb_x, i4_frm_mb_y;
 1718|  1.81k|    WORD32 i4_temp_array_ht;
 1719|  1.81k|    WORD32 i4_mb_wd;
 1720|  1.81k|    WORD32 i4_mb_ht;
 1721|  1.81k|    WORD16 *pi2_ref_array;
 1722|  1.81k|    UWORD8 *pu1_ref_x_ptr_incr, *pu1_ref_y_ptr_incr;
 1723|       |
 1724|  1.81k|    ps_ctxt = (residual_sampling_ctxt_t *) pv_residual_samp_ctxt;
 1725|  1.81k|    ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_ctxt->i4_res_lyr_id];
 1726|  1.81k|    pi2_ref_array = ps_ctxt->pi2_refarray_buffer;
 1727|  1.81k|    pu1_ref_x_ptr_incr = ps_ctxt->pu1_ref_x_ptr_incr;
 1728|  1.81k|    pu1_ref_y_ptr_incr = ps_ctxt->pu1_ref_y_ptr_incr;
 1729|       |
 1730|       |    /* --------------------------------------------------------------------- */
 1731|       |    /* Extracting information from the mapping context                       */
 1732|       |    /* --------------------------------------------------------------------- */
 1733|  1.81k|    if(1 == i4_chroma_flag)
  ------------------
  |  Branch (1733:8): [True: 1.21k, False: 606]
  ------------------
 1734|  1.21k|        ps_map_ctxt = &ps_lyr_ctxt->s_chroma_map_ctxt;
 1735|    606|    else
 1736|    606|        ps_map_ctxt = &ps_lyr_ctxt->s_luma_map_ctxt;
 1737|       |
 1738|  1.81k|    i4_mb_wd = MB_WIDTH >> i4_chroma_flag;
  ------------------
  |  |   67|  1.81k|#define MB_WIDTH 16
  ------------------
 1739|  1.81k|    i4_mb_ht = MB_HEIGHT >> i4_chroma_flag;
  ------------------
  |  |   68|  1.81k|#define MB_HEIGHT 16
  ------------------
 1740|       |
 1741|  1.81k|    ps_x_pos_phase = ps_map_ctxt->ps_x_pos_phase;
 1742|  1.81k|    ps_y_pos_phase = ps_map_ctxt->ps_y_pos_phase;
 1743|  1.81k|    i4_temp_array_ht = i4_mb_ht;
 1744|  1.81k|    i4_frm_mb_y = u2_mb_y * i4_mb_ht;
 1745|  1.81k|    i4_frm_mb_x = u2_mb_x * i4_mb_wd;
 1746|       |
 1747|       |    /* --------------------------------------------------------------------- */
 1748|       |    /* Loop for interpolation                                                */
 1749|       |    /* --------------------------------------------------------------------- */
 1750|  21.2k|    for(i4_y = 0; i4_y < (i4_temp_array_ht); i4_y++)
  ------------------
  |  Branch (1750:19): [True: 19.3k, False: 1.81k]
  ------------------
 1751|  19.3k|    {
 1752|   252k|        for(i4_x = 0; i4_x < (i4_mb_wd); i4_x++)
  ------------------
  |  Branch (1752:23): [True: 232k, False: 19.3k]
  ------------------
 1753|   232k|        {
 1754|   232k|            WORD32 i4_i;
 1755|   232k|            WORD32 i4_y_ref;
 1756|   232k|            WORD32 i4_y_phase;
 1757|   232k|            WORD32 i4_x_ref;
 1758|   232k|            WORD32 i4_x_phase;
 1759|   232k|            WORD32 i4_x_ref_round;
 1760|   232k|            WORD16 *pi2_out_curr;
 1761|   232k|            WORD32 ai4_temp_pred[2] = {0};
 1762|   232k|            UWORD8 *pu1_ref_y_ptr_incr_temp;
 1763|   232k|            WORD32 *pi4_temp_pred;
 1764|   232k|            UWORD8 u1_incr_y;
 1765|   232k|            WORD16 i2_res;
 1766|       |
 1767|       |            /* derive the current output pointer */
 1768|   232k|            pi2_out_curr = pi2_out + (i4_x << i4_chroma_flag) + (i4_y * i4_out_stride);
 1769|       |
 1770|       |            /* -------------------------------------------------------------- */
 1771|       |            /* Finding the offset                                             */
 1772|       |            /* -------------------------------------------------------------- */
 1773|   232k|            i4_y_ref = ps_y_pos_phase[i4_y + i4_frm_mb_y].i2_ref_pos;
 1774|   232k|            i4_y_phase = ps_y_pos_phase[i4_y + i4_frm_mb_y].i2_phase;
 1775|   232k|            i4_x_ref = ps_x_pos_phase[i4_x + i4_frm_mb_x].i2_ref_pos;
 1776|   232k|            i4_x_phase = ps_x_pos_phase[i4_x + i4_frm_mb_x].i2_phase;
 1777|       |
 1778|       |            /* horizontal processing*/
 1779|   698k|            for(i4_i = 0; i4_i < 2; i4_i++)
  ------------------
  |  Branch (1779:27): [True: 465k, False: 232k]
  ------------------
 1780|   465k|            {
 1781|   465k|                UWORD8 *pu1_ref_x_ptr_incr_temp;
 1782|   465k|                UWORD8 u1_incr;
 1783|   465k|                WORD16 *pi2_ref_array_1, *pi2_ref_array_2;
 1784|       |
 1785|       |                /* derive appropriate pointers */
 1786|   465k|                pu1_ref_x_ptr_incr_temp = pu1_ref_x_ptr_incr + i4_x_ref;
 1787|   465k|                pu1_ref_x_ptr_incr_temp += ((i4_y_ref + i4_i) * i4_refarray_wd);
 1788|   465k|                u1_incr = *pu1_ref_x_ptr_incr_temp;
 1789|   465k|                pi2_ref_array_1 = pi2_ref_array + i4_x_ref;
 1790|   465k|                pi2_ref_array_1 += ((i4_y_ref + i4_i) * i4_refarray_wd);
 1791|       |
 1792|   465k|                if(!u1_incr)
  ------------------
  |  Branch (1792:20): [True: 145k, False: 319k]
  ------------------
 1793|   145k|                {
 1794|   145k|                    pi2_ref_array_1 += (i4_x_phase >> 3);
 1795|   145k|                }
 1796|       |
 1797|   465k|                pi2_ref_array_2 = pi2_ref_array_1 + u1_incr;
 1798|   465k|                ai4_temp_pred[i4_i] =
 1799|   465k|                    (16 - i4_x_phase) * (*pi2_ref_array_1) + i4_x_phase * (*pi2_ref_array_2);
 1800|   465k|            }
 1801|       |
 1802|       |            /* vertical processing */
 1803|   232k|            i4_x_ref_round = (i4_x_ref + (i4_x_phase >> 3));
 1804|   232k|            pu1_ref_y_ptr_incr_temp =
 1805|   232k|                pu1_ref_y_ptr_incr + i4_x_ref_round + (i4_y_ref * i4_refarray_wd);
 1806|   232k|            u1_incr_y = *pu1_ref_y_ptr_incr_temp;
 1807|       |
 1808|   232k|            pi4_temp_pred = &ai4_temp_pred[0];
 1809|   232k|            if(!u1_incr_y)
  ------------------
  |  Branch (1809:16): [True: 73.0k, False: 159k]
  ------------------
 1810|  73.0k|            {
 1811|  73.0k|                pi4_temp_pred += (i4_y_phase >> 3);
 1812|  73.0k|            }
 1813|       |
 1814|   232k|            i2_res = (((16 - i4_y_phase) * pi4_temp_pred[0] +
 1815|   232k|                       i4_y_phase * pi4_temp_pred[u1_incr_y] + 128) >>
 1816|   232k|                      8);
 1817|       |
 1818|       |            /* store back the final residual */
 1819|   232k|            *pi2_out_curr = i2_res;
 1820|   232k|        } /* end of loop over width */
 1821|  19.3k|    }     /* end of loop over height */
 1822|       |
 1823|  1.81k|    return;
 1824|  1.81k|} /* End of Interpolation Function */
isvcd_residual_samp_mb:
 1859|    706|{
 1860|       |    /* --------------------------------------------------------------------- */
 1861|       |    /* I/O buffer params                                                     */
 1862|       |    /* --------------------------------------------------------------------- */
 1863|    706|    residual_sampling_ctxt_t *ps_ctxt = (residual_sampling_ctxt_t *) pv_residual_samp_ctxt;
 1864|    706|    WORD16 *pi2_inp;
 1865|    706|    WORD16 *pi2_out;
 1866|    706|    WORD32 i4_inp_stride;
 1867|    706|    WORD32 i4_out_stride;
 1868|    706|    WORD32 i4_refarray_wd;
 1869|    706|    mb_coord_t s_mb_coord = {0};
 1870|    706|    WORD32 ret;
 1871|    706|    s_mb_coord.u2_mb_x = u2_mb_x;
 1872|    706|    s_mb_coord.u2_mb_y = u2_mb_y;
 1873|       |
 1874|       |    /* --------------------------------------------------------------------- */
 1875|       |    /* LUMA PROCESSING                                                        */
 1876|       |    /* --------------------------------------------------------------------- */
 1877|    706|    pi2_inp = (WORD16 *) ps_ref_luma->pv_buffer;
 1878|    706|    pi2_out = (WORD16 *) ps_out_luma->pv_buffer;
 1879|    706|    i4_inp_stride = ps_ref_luma->i4_num_element_stride;
 1880|    706|    i4_out_stride = ps_out_luma->i4_num_element_stride;
 1881|       |
 1882|       |    /* ------- Constructing refSampleArray ----------------------- */
 1883|    706|    ret = isvcd_residual_reflayer_const(pv_residual_samp_ctxt, pi2_inp, i4_inp_stride,
 1884|    706|                                        ps_ref_mb_mode, &i4_refarray_wd, &s_mb_coord, 0);
 1885|       |
 1886|    706|    if(ret != OK) return ret;
  ------------------
  |  |  114|    706|#define OK        0
  ------------------
  |  Branch (1886:8): [True: 0, False: 706]
  ------------------
 1887|       |    /* ---- Interpolation process for Residual prediction     ------ */
 1888|    706|    ps_ctxt->pf_interpolate_residual(pv_residual_samp_ctxt, pi2_out, i4_out_stride, i4_refarray_wd,
 1889|    706|                                     s_mb_coord.u2_mb_x, s_mb_coord.u2_mb_y, 0);
 1890|       |
 1891|       |    /* --------------------------------------------------------------------- */
 1892|       |    /* CHROMA PROCESSING                                                       */
 1893|       |    /* --------------------------------------------------------------------- */
 1894|       |    /* CB */
 1895|    706|    pi2_inp = (WORD16 *) ps_ref_chroma->pv_buffer;
 1896|    706|    pi2_out = (WORD16 *) ps_out_chroma->pv_buffer;
 1897|    706|    i4_inp_stride = ps_ref_chroma->i4_num_element_stride;
 1898|    706|    i4_out_stride = ps_out_chroma->i4_num_element_stride;
 1899|       |
 1900|       |    /* ------- Constructing refSampleArray ----------------------- */
 1901|    706|    ret = isvcd_residual_reflayer_const(pv_residual_samp_ctxt, pi2_inp, i4_inp_stride,
 1902|    706|                                        ps_ref_mb_mode, &i4_refarray_wd, &s_mb_coord, 1);
 1903|       |
 1904|    706|    if(ret != OK) return ret;
  ------------------
  |  |  114|    706|#define OK        0
  ------------------
  |  Branch (1904:8): [True: 0, False: 706]
  ------------------
 1905|       |    /* ---- Interpolation process for Residual prediction     ------ */
 1906|    706|    ps_ctxt->pf_interpolate_residual(pv_residual_samp_ctxt, pi2_out, i4_out_stride, i4_refarray_wd,
 1907|    706|                                     s_mb_coord.u2_mb_x, s_mb_coord.u2_mb_y, 1);
 1908|       |
 1909|       |    /* CR */
 1910|    706|    pi2_inp += 1;
 1911|    706|    pi2_out += 1;
 1912|       |
 1913|       |    /* ------- Constructing refSampleArray ----------------------- */
 1914|    706|    ret = isvcd_residual_reflayer_const(pv_residual_samp_ctxt, pi2_inp, i4_inp_stride,
 1915|    706|                                        ps_ref_mb_mode, &i4_refarray_wd, &s_mb_coord, 1);
 1916|       |
 1917|    706|    if(ret != OK) return ret;
  ------------------
  |  |  114|    706|#define OK        0
  ------------------
  |  Branch (1917:8): [True: 0, False: 706]
  ------------------
 1918|       |    /* ---- Interpolation process for Residual prediction --------- */
 1919|    706|    ps_ctxt->pf_interpolate_residual(pv_residual_samp_ctxt, pi2_out, i4_out_stride, i4_refarray_wd,
 1920|    706|                                     s_mb_coord.u2_mb_x, s_mb_coord.u2_mb_y, 1);
 1921|    706|    return OK;
  ------------------
  |  |  114|    706|#define OK        0
  ------------------
 1922|    706|}
isvcd_residual_samp_mb_dyadic:
 1957|  18.5k|{
 1958|  18.5k|    residual_sampling_ctxt_t *ps_ctxt;
 1959|  18.5k|    res_lyr_ctxt *ps_lyr_ctxt;
 1960|       |    /* --------------------------------------------------------------------- */
 1961|       |    /* I/O buffer params                                                     */
 1962|       |    /* --------------------------------------------------------------------- */
 1963|  18.5k|    WORD16 *pi2_inp;
 1964|  18.5k|    WORD16 *pi2_out;
 1965|  18.5k|    WORD32 i4_inp_stride;
 1966|  18.5k|    WORD32 i4_out_stride;
 1967|  18.5k|    WORD32 i4_luma_nnz;
 1968|  18.5k|    WORD32 i4_chroma_nnz;
 1969|  18.5k|    WORD32 i4_tx_size;
 1970|       |
 1971|  18.5k|    ps_ctxt = (residual_sampling_ctxt_t *) pv_residual_samp_ctxt;
 1972|  18.5k|    ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_ctxt->i4_res_lyr_id];
 1973|       |
 1974|       |    /* --------------------------------------------------------------------- */
 1975|       |    /* LUMA PROCESSING                                                        */
 1976|       |    /* --------------------------------------------------------------------- */
 1977|  18.5k|    pi2_inp = (WORD16 *) ps_ref_luma->pv_buffer;
 1978|  18.5k|    pi2_out = (WORD16 *) ps_out_luma->pv_buffer;
 1979|  18.5k|    i4_inp_stride = ps_ref_luma->i4_num_element_stride;
 1980|  18.5k|    i4_out_stride = ps_out_luma->i4_num_element_stride;
 1981|       |
 1982|  18.5k|    {
 1983|  18.5k|        WORD32 i4_offset_x, i4_offset_y;
 1984|  18.5k|        residual_samp_map_ctxt_t *ps_luma_map;
 1985|  18.5k|        ref_mb_map_t *ps_x_off_len_luma;
 1986|  18.5k|        ref_mb_map_t *ps_y_off_len_luma;
 1987|       |
 1988|  18.5k|        ps_luma_map = &ps_lyr_ctxt->s_luma_map_ctxt;
 1989|  18.5k|        ps_x_off_len_luma = ps_luma_map->ps_x_offset_length;
 1990|  18.5k|        ps_y_off_len_luma = ps_luma_map->ps_y_offset_length;
 1991|       |
 1992|       |        /* get the actual offset for the buffers */
 1993|  18.5k|        i4_offset_x = ps_x_off_len_luma[u2_mb_x].i2_offset;
 1994|  18.5k|        i4_offset_y = ps_y_off_len_luma[u2_mb_y].i2_offset;
 1995|       |
 1996|  18.5k|        {
 1997|  18.5k|            inter_lyr_mb_prms_t *ps_inter_lyr_mb_prms;
 1998|  18.5k|            WORD32 i4_mb_x, i4_mb_y;
 1999|  18.5k|            UWORD16 u2_luma_mask = 0x0033;
 2000|  18.5k|            UWORD8 u1_chrm_mask = 0x11;
 2001|  18.5k|            WORD32 i4_luma_rt_sft_amt = 0;
 2002|  18.5k|            WORD32 i4_chrm_rt_sft_amt = 0;
 2003|       |
 2004|  18.5k|            i4_mb_x = ((i4_offset_x + 1) >> MB_WIDTH_SHIFT);
  ------------------
  |  |   70|  18.5k|#define MB_WIDTH_SHIFT 4
  ------------------
 2005|  18.5k|            i4_mb_y = ((i4_offset_y + 1) >> MB_HEIGHT_SHIFT);
  ------------------
  |  |   71|  18.5k|#define MB_HEIGHT_SHIFT 4
  ------------------
 2006|       |
 2007|       |            /* get the location of the byte which has the current mb mode */
 2008|  18.5k|            ps_inter_lyr_mb_prms = (inter_lyr_mb_prms_t *) ps_ref_mb_mode->pv_buffer;
 2009|  18.5k|            ps_inter_lyr_mb_prms += i4_mb_x;
 2010|  18.5k|            ps_inter_lyr_mb_prms += i4_mb_y * ps_ref_mb_mode->i4_num_element_stride;
 2011|       |
 2012|       |            /* get the approp block in base layer in horz direction */
 2013|  18.5k|            if(0 != ((i4_offset_x + 1) & 15))
  ------------------
  |  Branch (2013:16): [True: 9.56k, False: 9.01k]
  ------------------
 2014|  9.56k|            {
 2015|  9.56k|                u2_luma_mask <<= 2;
 2016|  9.56k|                i4_luma_rt_sft_amt += 2;
 2017|  9.56k|                u1_chrm_mask <<= 1;
 2018|  9.56k|                i4_chrm_rt_sft_amt += 1;
 2019|  9.56k|            }
 2020|       |            /* get the approp block in base layer in vert direction */
 2021|  18.5k|            if(0 != ((i4_offset_y + 1) & 15))
  ------------------
  |  Branch (2021:16): [True: 9.28k, False: 9.29k]
  ------------------
 2022|  9.28k|            {
 2023|  9.28k|                u2_luma_mask <<= 8;
 2024|  9.28k|                i4_luma_rt_sft_amt += 8;
 2025|       |
 2026|  9.28k|                u1_chrm_mask <<= 2;
 2027|  9.28k|                i4_chrm_rt_sft_amt += 2;
 2028|  9.28k|            }
 2029|       |
 2030|       |            /* extract the nnz and store it */
 2031|  18.5k|            i4_luma_nnz = (ps_inter_lyr_mb_prms->u2_luma_nnz & u2_luma_mask) >> i4_luma_rt_sft_amt;
 2032|  18.5k|            i4_chroma_nnz =
 2033|  18.5k|                (ps_inter_lyr_mb_prms->u1_chroma_nnz & u1_chrm_mask) >> i4_chrm_rt_sft_amt;
 2034|  18.5k|            i4_tx_size =
 2035|  18.5k|                (ps_inter_lyr_mb_prms->i1_tx_size < 0) ? 1 : ps_inter_lyr_mb_prms->i1_tx_size;
  ------------------
  |  Branch (2035:17): [True: 0, False: 18.5k]
  ------------------
 2036|  18.5k|        }
 2037|       |
 2038|       |        /* since in dyadic case the window width and height will be 10x10   */
 2039|       |        /* and the window start offsets will be always 1 column left and    */
 2040|       |        /* 1 row above the block boundary. so the pointer and the required  */
 2041|       |        /* positions are appropriately modified                             */
 2042|  18.5k|        if(i4_offset_x >= 0)
  ------------------
  |  Branch (2042:12): [True: 14.3k, False: 4.27k]
  ------------------
 2043|  14.3k|        {
 2044|  14.3k|            pi2_inp++;
 2045|  14.3k|        }
 2046|       |
 2047|  18.5k|        if(i4_offset_y >= 0)
  ------------------
  |  Branch (2047:12): [True: 17.0k, False: 1.49k]
  ------------------
 2048|  17.0k|        {
 2049|  17.0k|            pi2_inp += i4_inp_stride;
 2050|  17.0k|        }
 2051|       |
 2052|  18.5k|        ps_ctxt->pf_residual_luma_dyadic(pv_residual_samp_ctxt, pi2_inp, i4_inp_stride, pi2_out,
 2053|  18.5k|                                         i4_out_stride, ps_ref_mb_mode, u2_mb_x, u2_mb_y,
 2054|  18.5k|                                         i4_luma_nnz, i4_tx_size);
 2055|  18.5k|    }
 2056|       |
 2057|       |    /* --------------------------------------------------------------------- */
 2058|       |    /* CHROMA PROCESSING                                                       */
 2059|       |    /* --------------------------------------------------------------------- */
 2060|       |    /* CB */
 2061|  18.5k|    pi2_inp = (WORD16 *) ps_ref_chroma->pv_buffer;
 2062|  18.5k|    pi2_out = (WORD16 *) ps_out_chroma->pv_buffer;
 2063|  18.5k|    i4_inp_stride = ps_ref_chroma->i4_num_element_stride;
 2064|  18.5k|    i4_out_stride = ps_out_chroma->i4_num_element_stride;
 2065|       |
 2066|       |    /* choose the appropriate chroma processing routine */
 2067|  18.5k|    if(SVCD_FALSE == ps_lyr_ctxt->i4_chrm_alt_proc)
  ------------------
  |  |   45|  18.5k|#define SVCD_FALSE 0
  ------------------
  |  Branch (2067:8): [True: 18.5k, False: 0]
  ------------------
 2068|  18.5k|    {
 2069|  18.5k|        WORD32 i4_offset_x, i4_offset_y;
 2070|  18.5k|        residual_samp_map_ctxt_t *ps_chroma_map;
 2071|  18.5k|        ref_mb_map_t *ps_x_off_len_chroma;
 2072|  18.5k|        ref_mb_map_t *ps_y_off_len_chroma;
 2073|       |
 2074|  18.5k|        ps_chroma_map = &ps_lyr_ctxt->s_chroma_map_ctxt;
 2075|  18.5k|        ps_x_off_len_chroma = ps_chroma_map->ps_x_offset_length;
 2076|  18.5k|        ps_y_off_len_chroma = ps_chroma_map->ps_y_offset_length;
 2077|       |
 2078|       |        /* get the actual offset for the buffers */
 2079|  18.5k|        i4_offset_x = ps_x_off_len_chroma[u2_mb_x].i2_offset;
 2080|  18.5k|        i4_offset_y = ps_y_off_len_chroma[u2_mb_y].i2_offset;
 2081|       |
 2082|       |        /* since in dyadic case the window width and height will be 6x6     */
 2083|       |        /* and the window start offsets will be always 1 column left and    */
 2084|       |        /* 1 row above the block boundary. so the pointer and the required  */
 2085|       |        /* positions are appropriately modified                             */
 2086|  18.5k|        if(i4_offset_x >= 0)
  ------------------
  |  Branch (2086:12): [True: 14.3k, False: 4.27k]
  ------------------
 2087|  14.3k|        {
 2088|  14.3k|            pi2_inp += 2;
 2089|  14.3k|        }
 2090|       |
 2091|  18.5k|        if(i4_offset_y >= 0)
  ------------------
  |  Branch (2091:12): [True: 17.0k, False: 1.49k]
  ------------------
 2092|  17.0k|        {
 2093|  17.0k|            pi2_inp += i4_inp_stride;
 2094|  17.0k|        }
 2095|       |
 2096|  18.5k|        if(0 != (i4_chroma_nnz & 0x01))
  ------------------
  |  Branch (2096:12): [True: 0, False: 18.5k]
  ------------------
 2097|      0|        {
 2098|      0|            ps_ctxt->pf_residual_chroma_dyadic(pv_residual_samp_ctxt, pi2_inp, i4_inp_stride,
 2099|      0|                                               pi2_out, i4_out_stride);
 2100|      0|        }
 2101|  18.5k|    }
 2102|      0|    else
 2103|      0|    {
 2104|      0|        ps_ctxt->pf_residual_chroma_dyadic_alt(pv_residual_samp_ctxt, u2_mb_x, u2_mb_y,
 2105|      0|                                               ps_ref_mb_mode, pi2_inp, i4_inp_stride, pi2_out,
 2106|      0|                                               i4_out_stride, SVCD_FALSE);
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
 2107|      0|    }
 2108|       |
 2109|       |    /* CR */
 2110|  18.5k|    pi2_inp += 1;
 2111|  18.5k|    pi2_out += 1;
 2112|       |
 2113|  18.5k|    if(SVCD_FALSE == ps_lyr_ctxt->i4_chrm_alt_proc)
  ------------------
  |  |   45|  18.5k|#define SVCD_FALSE 0
  ------------------
  |  Branch (2113:8): [True: 18.5k, False: 0]
  ------------------
 2114|  18.5k|    {
 2115|  18.5k|        if(0 != (i4_chroma_nnz & 0x10))
  ------------------
  |  Branch (2115:12): [True: 0, False: 18.5k]
  ------------------
 2116|      0|        {
 2117|      0|            ps_ctxt->pf_residual_chroma_dyadic(pv_residual_samp_ctxt, pi2_inp, i4_inp_stride,
 2118|      0|                                               pi2_out, i4_out_stride);
 2119|      0|        }
 2120|  18.5k|    }
 2121|      0|    else
 2122|      0|    {
 2123|      0|        ps_ctxt->pf_residual_chroma_dyadic_alt(pv_residual_samp_ctxt, u2_mb_x, u2_mb_y,
 2124|      0|                                               ps_ref_mb_mode, pi2_inp, i4_inp_stride, pi2_out,
 2125|      0|                                               i4_out_stride, SVCD_TRUE);
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 2126|      0|    }
 2127|  18.5k|    return OK;
  ------------------
  |  |  114|  18.5k|#define OK        0
  ------------------
 2128|  18.5k|}
isvcd_residual_samp_populate_list:
 2157|  1.44k|{
 2158|       |    /* --------------------------------------------------------------------- */
 2159|       |    /* Local variables required for finding the mapping between the layers     */
 2160|       |    /* --------------------------------------------------------------------- */
 2161|  1.44k|    UWORD32 u4_shift_x;
 2162|  1.44k|    UWORD32 u4_shift_y;
 2163|  1.44k|    UWORD32 u4_scale_x;
 2164|  1.44k|    UWORD32 u4_scale_y;
 2165|  1.44k|    WORD32 i4_offset_x;
 2166|  1.44k|    WORD32 i4_offset_y;
 2167|  1.44k|    WORD32 i4_add_x;
 2168|  1.44k|    WORD32 i4_add_y;
 2169|  1.44k|    WORD32 i4_delta_x;
 2170|  1.44k|    WORD32 i4_delta_y;
 2171|  1.44k|    WORD32 i4_refphase_x;
 2172|  1.44k|    WORD32 i4_refphase_y;
 2173|  1.44k|    WORD32 i4_phase_x;
 2174|  1.44k|    WORD32 i4_phase_y;
 2175|  1.44k|    WORD32 i4_sub_wd;
 2176|  1.44k|    WORD32 i4_sub_ht;
 2177|  1.44k|    WORD32 i4_mb_wd;
 2178|  1.44k|    WORD32 i4_mb_ht;
 2179|       |    /* --------------------------------------------------------------------- */
 2180|       |    /* Local Pointer Declaration for arrays in Mapping context                 */
 2181|       |    /* --------------------------------------------------------------------- */
 2182|  1.44k|    ref_mb_map_t *ps_x_off_len;
 2183|  1.44k|    ref_mb_map_t *ps_y_off_len;
 2184|  1.44k|    UWORD32 i4_ref_wd;
 2185|  1.44k|    UWORD32 i4_ref_ht;
 2186|  1.44k|    UWORD32 i4_scaled_wd;
 2187|  1.44k|    UWORD32 i4_scaled_ht;
 2188|  1.44k|    WORD32 i4_curr_lyr_width;
 2189|  1.44k|    WORD32 i4_curr_lyr_height;
 2190|       |
 2191|       |    /* --------------------------------------------------------------------- */
 2192|       |    /* Local Flag Declaration                                                 */
 2193|       |    /* --------------------------------------------------------------------- */
 2194|  1.44k|    WORD32 i4_ref_layer_field_pic_flag;
 2195|  1.44k|    WORD32 i4_field_pic_flag;
 2196|  1.44k|    WORD32 i4_frame_mbs_only_flag;
 2197|  1.44k|    WORD32 i4_ref_layer_frame_Mbs_only_flag;
 2198|  1.44k|    WORD32 i4_field_Mb_flag;
 2199|  1.44k|    WORD32 i4_bot_field_flag;
 2200|       |
 2201|       |    /* --------------------------------------------------------------------- */
 2202|       |    /* Cropping Parameters Declaration                                         */
 2203|       |    /* --------------------------------------------------------------------- */
 2204|  1.44k|    WORD32 i4_scaled_ref_layer_left_offset;
 2205|  1.44k|    WORD32 i4_scaled_ref_layer_top_offset;
 2206|       |
 2207|       |    /* --------------------------------------------------------------------- */
 2208|       |    /* Hardcoding flag information    (assuming no field support) */
 2209|       |    /* --------------------------------------------------------------------- */
 2210|  1.44k|    i4_ref_layer_field_pic_flag = SVCD_FALSE;
  ------------------
  |  |   45|  1.44k|#define SVCD_FALSE 0
  ------------------
 2211|  1.44k|    i4_field_pic_flag = SVCD_FALSE;
  ------------------
  |  |   45|  1.44k|#define SVCD_FALSE 0
  ------------------
 2212|  1.44k|    i4_frame_mbs_only_flag = SVCD_TRUE;
  ------------------
  |  |   46|  1.44k|#define SVCD_TRUE 1
  ------------------
 2213|  1.44k|    i4_field_Mb_flag = SVCD_FALSE;
  ------------------
  |  |   45|  1.44k|#define SVCD_FALSE 0
  ------------------
 2214|  1.44k|    i4_bot_field_flag = SVCD_FALSE;
  ------------------
  |  |   45|  1.44k|#define SVCD_FALSE 0
  ------------------
 2215|  1.44k|    i4_ref_layer_frame_Mbs_only_flag = SVCD_TRUE;
  ------------------
  |  |   46|  1.44k|#define SVCD_TRUE 1
  ------------------
 2216|       |
 2217|       |    /* --------------------------------------------------------------------- */
 2218|       |    /* Pointer and Paramater are intialized    - Chroma and Luma */
 2219|       |    /* --------------------------------------------------------------------- */
 2220|  1.44k|    {
 2221|  1.44k|        WORD32 i4_base_width;
 2222|  1.44k|        WORD32 i4_base_height;
 2223|  1.44k|        WORD32 i4_ref_layer_chroma_phase_x_plus1_flag;
 2224|  1.44k|        WORD32 i4_ref_layer_chroma_phase_y_plus1;
 2225|  1.44k|        WORD32 i4_chroma_phase_x_plus1_flag;
 2226|  1.44k|        WORD32 i4_chroma_phase_y_plus1;
 2227|       |
 2228|       |        /* ------------------------------------------------------------- */
 2229|       |        /* HARD CODED FOR 420                                             */
 2230|       |        /* ------------------------------------------------------------- */
 2231|  1.44k|        WORD32 i4_sub_wd_chroma = 2;
 2232|  1.44k|        WORD32 i4_sub_ht_chroma = 2;
 2233|       |
 2234|  1.44k|        i4_base_width = ps_ref_res_prms->i4_res_width;
 2235|  1.44k|        i4_base_height = ps_ref_res_prms->i4_res_height;
 2236|       |
 2237|  1.44k|        i4_ref_layer_chroma_phase_x_plus1_flag =
 2238|  1.44k|            ps_curr_res_prms->i1_ref_lyr_chroma_phase_x_plus1_flag;
 2239|  1.44k|        i4_ref_layer_chroma_phase_y_plus1 = ps_curr_res_prms->i1_ref_lyr_chroma_phase_y_plus1;
 2240|  1.44k|        i4_chroma_phase_x_plus1_flag =
 2241|  1.44k|            ps_subset_sps->s_sps_svc_ext.u1_seq_ref_layer_chroma_phase_x_plus1_flag;
 2242|  1.44k|        i4_chroma_phase_y_plus1 =
 2243|  1.44k|            ps_subset_sps->s_sps_svc_ext.u1_seq_ref_layer_chroma_phase_y_plus1;
 2244|  1.44k|        i4_scaled_ref_layer_left_offset = ps_curr_res_prms->s_ref_lyr_scaled_offset.i2_left;
 2245|  1.44k|        i4_scaled_ref_layer_top_offset = ps_curr_res_prms->s_ref_lyr_scaled_offset.i2_top;
 2246|       |
 2247|       |        /* ----------------------------------------------------------------- */
 2248|       |        /* Computing Effective Frame Dimensions                                 */
 2249|       |        /* ------------------------------------------------------------------*/
 2250|  1.44k|        i4_ref_wd = (i4_base_width >> i4_chroma_flag);
 2251|  1.44k|        i4_ref_ht = (i4_base_height >> i4_chroma_flag) * (1 + i4_ref_layer_field_pic_flag);
 2252|  1.44k|        i4_scaled_wd = ps_curr_res_prms->u2_scaled_ref_width;
 2253|  1.44k|        i4_scaled_ht = ps_curr_res_prms->u2_scaled_ref_height;
 2254|  1.44k|        i4_scaled_wd = (i4_scaled_wd >> i4_chroma_flag);
 2255|  1.44k|        i4_scaled_ht = (i4_scaled_ht >> i4_chroma_flag) * (1 + i4_field_pic_flag);
 2256|       |
 2257|  1.44k|        if(1 == i4_chroma_flag)
  ------------------
  |  Branch (2257:12): [True: 720, False: 720]
  ------------------
 2258|    720|        {
 2259|    720|            i4_refphase_x = i4_ref_layer_chroma_phase_x_plus1_flag - 1;
 2260|    720|            i4_refphase_y = i4_ref_layer_chroma_phase_y_plus1 - 1;
 2261|    720|            i4_phase_x = i4_chroma_phase_x_plus1_flag - 1;
 2262|    720|            i4_phase_y = i4_chroma_phase_y_plus1 - 1;
 2263|    720|            i4_sub_wd = i4_sub_wd_chroma;
 2264|    720|            i4_sub_ht = i4_sub_ht_chroma;
 2265|    720|            i4_mb_wd = MB_WIDTH >> 1;
  ------------------
  |  |   67|    720|#define MB_WIDTH 16
  ------------------
 2266|    720|            i4_mb_ht = MB_HEIGHT >> 1;
  ------------------
  |  |   68|    720|#define MB_HEIGHT 16
  ------------------
 2267|    720|        }
 2268|    720|        else
 2269|    720|        {
 2270|    720|            i4_refphase_x = 0;
 2271|    720|            i4_refphase_y = 0;
 2272|    720|            i4_phase_x = 0;
 2273|    720|            i4_phase_y = 0;
 2274|    720|            i4_sub_wd = 1;
 2275|    720|            i4_sub_ht = 1;
 2276|    720|            i4_mb_wd = MB_WIDTH;
  ------------------
  |  |   67|    720|#define MB_WIDTH 16
  ------------------
 2277|    720|            i4_mb_ht = MB_HEIGHT;
  ------------------
  |  |   68|    720|#define MB_HEIGHT 16
  ------------------
 2278|    720|        }
 2279|  1.44k|    }
 2280|       |
 2281|       |    /* --------------------------------------------------------------------- */
 2282|       |    /* Derive shift x and y based on level idd                               */
 2283|       |    /* --------------------------------------------------------------------- */
 2284|  1.44k|    if(ps_sps->u1_level_idc <= 30)
  ------------------
  |  Branch (2284:8): [True: 1.44k, False: 0]
  ------------------
 2285|  1.44k|    {
 2286|  1.44k|        u4_shift_x = 16;
 2287|  1.44k|        u4_shift_y = 16;
 2288|  1.44k|    }
 2289|      0|    else
 2290|      0|    {
 2291|      0|        u4_shift_x = 31 - isvcd_get_ceil_log2(i4_ref_wd);
 2292|      0|        u4_shift_y = 31 - isvcd_get_ceil_log2(i4_ref_ht);
 2293|      0|    }
 2294|       |
 2295|       |    /* --------------------------------------------------------------------- */
 2296|       |    /* The following condition is not true in our case for time being         */
 2297|       |    /* --------------------------------------------------------------------- */
 2298|  1.44k|    if((SVCD_FALSE == i4_frame_mbs_only_flag) || (SVCD_FALSE == i4_ref_layer_frame_Mbs_only_flag))
  ------------------
  |  |   45|  1.44k|#define SVCD_FALSE 0
  ------------------
                  if((SVCD_FALSE == i4_frame_mbs_only_flag) || (SVCD_FALSE == i4_ref_layer_frame_Mbs_only_flag))
  ------------------
  |  |   45|  1.44k|#define SVCD_FALSE 0
  ------------------
  |  Branch (2298:8): [True: 0, False: 1.44k]
  |  Branch (2298:50): [True: 0, False: 1.44k]
  ------------------
 2299|      0|    {
 2300|      0|        i4_phase_y = i4_phase_y + 4 * i4_bot_field_flag;
 2301|       |
 2302|      0|        if(1 == i4_ref_layer_frame_Mbs_only_flag)
  ------------------
  |  Branch (2302:12): [True: 0, False: 0]
  ------------------
 2303|      0|            i4_refphase_y = (2 * i4_refphase_y) + 2;
 2304|      0|        else
 2305|      0|            i4_refphase_y = i4_refphase_y + (4 * i4_bot_field_flag);
 2306|      0|    }
 2307|       |
 2308|       |    /* --------------------------------------------------------------------- */
 2309|       |    /* Dx and Dy Computation - Ratio of the base and enhance layer width     */
 2310|       |    /* --------------------------------------------------------------------- */
 2311|  1.44k|    u4_scale_x = ((i4_ref_wd << u4_shift_x) + (i4_scaled_wd >> 1)) / (i4_scaled_wd);
 2312|       |
 2313|  1.44k|    u4_scale_y = ((i4_ref_ht << u4_shift_y) + (i4_scaled_ht >> 1)) / (i4_scaled_ht);
 2314|       |
 2315|  1.44k|    i4_offset_x = i4_scaled_ref_layer_left_offset / i4_sub_wd;
 2316|  1.44k|    i4_add_x = (((i4_ref_wd * (2 + i4_phase_x)) << (u4_shift_x - 2)) + (i4_scaled_wd >> 1)) /
 2317|  1.44k|                   i4_scaled_wd +
 2318|  1.44k|               (1 << (u4_shift_x - 5));
 2319|  1.44k|    i4_delta_x = 4 * (2 + i4_refphase_x);
 2320|       |
 2321|  1.44k|    if((SVCD_TRUE == i4_frame_mbs_only_flag) && (SVCD_TRUE == i4_ref_layer_frame_Mbs_only_flag))
  ------------------
  |  |   46|  1.44k|#define SVCD_TRUE 1
  ------------------
                  if((SVCD_TRUE == i4_frame_mbs_only_flag) && (SVCD_TRUE == i4_ref_layer_frame_Mbs_only_flag))
  ------------------
  |  |   46|  1.44k|#define SVCD_TRUE 1
  ------------------
  |  Branch (2321:8): [True: 1.44k, False: 0]
  |  Branch (2321:49): [True: 1.44k, False: 0]
  ------------------
 2322|  1.44k|    {
 2323|  1.44k|        i4_offset_y = i4_scaled_ref_layer_top_offset / i4_sub_ht;
 2324|  1.44k|        i4_add_y = (((i4_ref_ht * (2 + i4_phase_y)) << (u4_shift_y - 2)) + (i4_scaled_ht >> 1)) /
 2325|  1.44k|                       i4_scaled_ht +
 2326|  1.44k|                   (1 << (u4_shift_y - 5));
 2327|  1.44k|        i4_delta_y = 4 * (2 + i4_refphase_y);
 2328|  1.44k|    }
 2329|      0|    else
 2330|      0|    {
 2331|      0|        i4_offset_y = i4_scaled_ref_layer_top_offset / (2 * i4_sub_ht);
 2332|      0|        i4_add_y = (((i4_ref_ht * (2 + i4_phase_y)) << (u4_shift_y - 3)) + (i4_scaled_ht >> 1)) /
 2333|      0|                       i4_scaled_ht +
 2334|      0|                   (1 << (u4_shift_y - 5));
 2335|      0|        i4_delta_y = 2 * (2 + i4_refphase_y);
 2336|      0|    }
 2337|       |
 2338|       |    /* --------------------------------------------------------------------- */
 2339|       |    /* Intializing Local Pointers    - Chroma and Luma                       */
 2340|       |    /* --------------------------------------------------------------------- */
 2341|  1.44k|    ps_x_off_len = ps_map_ctxt->ps_x_offset_length;
 2342|  1.44k|    ps_y_off_len = ps_map_ctxt->ps_y_offset_length;
 2343|  1.44k|    i4_curr_lyr_width = ps_curr_res_prms->i4_res_width >> i4_chroma_flag;
 2344|  1.44k|    i4_curr_lyr_height = ps_curr_res_prms->i4_res_height >> i4_chroma_flag;
 2345|       |
 2346|  1.44k|    {
 2347|  1.44k|        WORD32 i4_i, i4_j;
 2348|       |
 2349|       |        /* ----------------------------------------------------------------- */
 2350|       |        /* Computation of offsetX refArrayW Xmin and Xmax Lists               */
 2351|       |        /* ----------------------------------------------------------------- */
 2352|  7.04k|        for(i4_i = 0; i4_i < i4_curr_lyr_width; i4_i = i4_i + i4_mb_wd)
  ------------------
  |  Branch (2352:23): [True: 5.60k, False: 1.44k]
  ------------------
 2353|  5.60k|        {
 2354|  5.60k|            WORD32 i4_x_refmin16;
 2355|  5.60k|            WORD32 i4_x_refmax16;
 2356|  5.60k|            WORD32 i4_x_offset;
 2357|       |
 2358|  5.60k|            i4_x_refmin16 = (WORD64) (((WORD64) ((i4_i - i4_offset_x) * u4_scale_x) + i4_add_x) >>
 2359|  5.60k|                                      ((WORD32) (u4_shift_x - 4))) -
 2360|  5.60k|                            i4_delta_x;
 2361|       |
 2362|  5.60k|            i4_x_refmax16 =
 2363|  5.60k|                (WORD64) (((WORD64) (i4_i + i4_mb_wd - 1 - i4_offset_x) * u4_scale_x + i4_add_x) >>
 2364|  5.60k|                          ((WORD32) (u4_shift_x - 4))) -
 2365|  5.60k|                i4_delta_x;
 2366|       |
 2367|       |            /* AC205 */
 2368|  5.60k|            i4_x_offset = i4_x_refmin16 >> 4;
 2369|  5.60k|            ps_x_off_len->i2_offset = i4_x_offset;
 2370|  5.60k|            ps_x_off_len->i2_length = (i4_x_refmax16 >> 4) - i4_x_offset + 2;
 2371|       |
 2372|       |            /* increment the pointer */
 2373|  5.60k|            ps_x_off_len++;
 2374|       |
 2375|  5.60k|        } /* end of loop over current layer width */
 2376|       |
 2377|       |        /* ----------------------------------------------------------------- */
 2378|       |        /* Computation of offsetY refArrayH Ymin and Ymax Lists              */
 2379|       |        /* ----------------------------------------------------------------- */
 2380|  17.8k|        for(i4_j = 0; i4_j < i4_curr_lyr_height; i4_j = i4_j + i4_mb_ht)
  ------------------
  |  Branch (2380:23): [True: 16.4k, False: 1.44k]
  ------------------
 2381|  16.4k|        {
 2382|  16.4k|            WORD32 i4_y_refmin16;
 2383|  16.4k|            WORD32 i4_y_refmax16;
 2384|  16.4k|            WORD32 i4_y_offset;
 2385|       |
 2386|  16.4k|            i4_y_refmin16 = (WORD64) (((WORD64) (i4_j - i4_offset_y) * u4_scale_y + i4_add_y) >>
 2387|  16.4k|                                      ((WORD32) (u4_shift_y - 4))) -
 2388|  16.4k|                            i4_delta_y;
 2389|       |
 2390|  16.4k|            i4_y_refmax16 =
 2391|  16.4k|                (WORD64) (((WORD64) (i4_j + i4_mb_ht - 1 - i4_offset_y) * u4_scale_y + i4_add_y) >>
 2392|  16.4k|                          ((WORD32) (u4_shift_y - 4))) -
 2393|  16.4k|                i4_delta_y;
 2394|       |
 2395|       |            /* AC205 */
 2396|  16.4k|            i4_y_offset = i4_y_refmin16 >> 4;
 2397|  16.4k|            ps_y_off_len->i2_offset = i4_y_offset;
 2398|  16.4k|            ps_y_off_len->i2_length = (i4_y_refmax16 >> 4) - i4_y_offset + 2;
 2399|       |
 2400|       |            /* increment the pointer */
 2401|  16.4k|            ps_y_off_len++;
 2402|       |
 2403|  16.4k|        } /* end of loop over current layer height */
 2404|  1.44k|    }
 2405|       |
 2406|       |    /* --------------------------------------------------------------------- */
 2407|       |    /* Computation of Xref and Xphase List as per standard                     */
 2408|       |    /* --------------------------------------------------------------------- */
 2409|  1.44k|    ps_x_off_len = ps_map_ctxt->ps_x_offset_length;
 2410|  1.44k|    ps_y_off_len = ps_map_ctxt->ps_y_offset_length;
 2411|       |
 2412|  1.44k|    {
 2413|  1.44k|        WORD32 i4_xc;
 2414|  1.44k|        WORD32 i4_offset_x_index;
 2415|  1.44k|        ref_pixel_map_t *ps_x_pos_phase;
 2416|       |
 2417|  1.44k|        ps_x_pos_phase = ps_map_ctxt->ps_x_pos_phase;
 2418|       |
 2419|  68.6k|        for(i4_xc = 0; i4_xc < i4_curr_lyr_width; i4_xc++)
  ------------------
  |  Branch (2419:24): [True: 67.2k, False: 1.44k]
  ------------------
 2420|  67.2k|        {
 2421|  67.2k|            WORD32 i4_x_offset;
 2422|  67.2k|            WORD32 i4_x_ref16;
 2423|       |
 2424|  67.2k|            i4_offset_x_index = i4_xc / i4_mb_wd;
 2425|  67.2k|            i4_x_offset = ps_x_off_len[i4_offset_x_index].i2_offset;
 2426|  67.2k|            i4_x_ref16 = (WORD64) (((WORD64) (i4_xc - i4_offset_x) * u4_scale_x + i4_add_x) >>
 2427|  67.2k|                                   ((WORD32) (u4_shift_x - 4))) -
 2428|  67.2k|                         i4_delta_x;
 2429|       |
 2430|       |            /* store the values */
 2431|  67.2k|            ps_x_pos_phase->i2_ref_pos = (i4_x_ref16 >> 4) - i4_x_offset;
 2432|  67.2k|            ps_x_pos_phase->i2_phase = (i4_x_ref16 - (16 * i4_x_offset)) & 15;
 2433|       |
 2434|       |            /* increment the pointer */
 2435|  67.2k|            ps_x_pos_phase++;
 2436|  67.2k|        } /* end of loop over scaled width */
 2437|  1.44k|    }
 2438|       |
 2439|       |    /* --------------------------------------------------------------------- */
 2440|       |    /* Computation of Yref and Yphase List as per standard                     */
 2441|       |    /* --------------------------------------------------------------------- */
 2442|  1.44k|    {
 2443|  1.44k|        WORD32 i4_yc;
 2444|  1.44k|        WORD32 i4_offset_y_index;
 2445|  1.44k|        ref_pixel_map_t *ps_y_pos_phase;
 2446|       |
 2447|  1.44k|        ps_y_pos_phase = ps_map_ctxt->ps_y_pos_phase;
 2448|       |
 2449|   198k|        for(i4_yc = 0; i4_yc < i4_curr_lyr_height; i4_yc++)
  ------------------
  |  Branch (2449:24): [True: 197k, False: 1.44k]
  ------------------
 2450|   197k|        {
 2451|   197k|            WORD32 i4_y_offset;
 2452|   197k|            WORD32 i4_y_ref16;
 2453|       |
 2454|   197k|            i4_offset_y_index = i4_yc / i4_mb_ht;
 2455|   197k|            i4_y_offset = ps_y_off_len[i4_offset_y_index].i2_offset;
 2456|       |
 2457|   197k|            if((SVCD_FALSE == i4_frame_mbs_only_flag) ||
  ------------------
  |  |   45|   197k|#define SVCD_FALSE 0
  ------------------
  |  Branch (2457:16): [True: 0, False: 197k]
  ------------------
 2458|   197k|               (SVCD_FALSE == i4_ref_layer_frame_Mbs_only_flag))
  ------------------
  |  |   45|   197k|#define SVCD_FALSE 0
  ------------------
  |  Branch (2458:16): [True: 0, False: 197k]
  ------------------
 2459|      0|            {
 2460|      0|                i4_yc = i4_yc >> (1 - i4_field_Mb_flag);
 2461|      0|            }
 2462|       |
 2463|   197k|            i4_y_ref16 = (WORD64) ((((WORD64) (i4_yc - i4_offset_y) * u4_scale_y + i4_add_y) >>
 2464|   197k|                                    ((WORD32) (u4_shift_y - 4))) -
 2465|   197k|                                   i4_delta_y);
 2466|   197k|            ps_y_pos_phase->i2_ref_pos = (i4_y_ref16 >> 4) - i4_y_offset;
 2467|   197k|            ps_y_pos_phase->i2_phase = (i4_y_ref16 - (16 * i4_y_offset)) & 15;
 2468|       |
 2469|       |            /* increment the pointer */
 2470|   197k|            ps_y_pos_phase++;
 2471|   197k|        } /* end of loop over scaled height */
 2472|  1.44k|    }
 2473|  1.44k|    return;
 2474|  1.44k|}
isvcd_residual_samp_res_init:
 2501|  4.09k|{
 2502|  4.09k|    residual_sampling_ctxt_t *ps_ctxt;
 2503|  4.09k|    res_lyr_ctxt *ps_lyr_ctxt;
 2504|  4.09k|    dec_seq_params_t *ps_sps;
 2505|  4.09k|    dec_svc_seq_params_t *ps_subset_sps;
 2506|  4.09k|    svc_dec_lyr_struct_t *ps_svc_lyr_dec = (svc_dec_lyr_struct_t *) pv_svc_dec;
 2507|  4.09k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
 2508|       |
 2509|  4.09k|    void *pv_residual_samp_ctxt = ps_svc_lyr_dec->pv_residual_sample_ctxt;
 2510|  4.09k|    res_prms_t *ps_curr_lyr_res_prms = &ps_svc_lyr_dec->s_res_prms;
 2511|  4.09k|    ref_mb_map_t **pps_luma_map_horz = &ps_svc_lyr_dec->ps_ressam_luma_map_horz;
 2512|  4.09k|    ref_mb_map_t **pps_chroma_map_horz = &ps_svc_lyr_dec->ps_ressam_chroma_map_horz;
 2513|  4.09k|    ref_mb_map_t **pps_luma_map_vert = &ps_svc_lyr_dec->ps_ressam_luma_map_vert;
 2514|  4.09k|    ref_mb_map_t **pps_chroma_map_vert = &ps_svc_lyr_dec->ps_ressam_chroma_map_vert;
 2515|       |
 2516|  4.09k|    if((NULL == pv_residual_samp_ctxt) || (NULL == ps_curr_lyr_res_prms) ||
  ------------------
  |  Branch (2516:8): [True: 0, False: 4.09k]
  |  Branch (2516:43): [True: 0, False: 4.09k]
  ------------------
 2517|  4.09k|       (NULL == pps_luma_map_horz) || (NULL == pps_chroma_map_horz) ||
  ------------------
  |  Branch (2517:8): [True: 0, False: 4.09k]
  |  Branch (2517:39): [True: 0, False: 4.09k]
  ------------------
 2518|  4.09k|       (NULL == pps_luma_map_vert) || (NULL == pps_chroma_map_vert))
  ------------------
  |  Branch (2518:8): [True: 0, False: 4.09k]
  |  Branch (2518:39): [True: 0, False: 4.09k]
  ------------------
 2519|      0|    {
 2520|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 2521|      0|    }
 2522|       |
 2523|  4.09k|    ps_ctxt = (residual_sampling_ctxt_t *) pv_residual_samp_ctxt;
 2524|       |
 2525|       |    /* if called for base resolution store deafult values */
 2526|  4.09k|    if(SVCD_TRUE == ps_svc_lyr_dec->u1_base_res_flag)
  ------------------
  |  |   46|  4.09k|#define SVCD_TRUE 1
  ------------------
  |  Branch (2526:8): [True: 3.37k, False: 720]
  ------------------
 2527|  3.37k|    {
 2528|  3.37k|        *pps_luma_map_horz = NULL;
 2529|  3.37k|        *pps_chroma_map_horz = NULL;
 2530|  3.37k|        *pps_luma_map_vert = NULL;
 2531|  3.37k|        *pps_chroma_map_vert = NULL;
 2532|  3.37k|        ps_ctxt->i4_res_lyr_id = -1;
 2533|  3.37k|        ps_ctxt->i4_ref_width = ps_curr_lyr_res_prms->i4_res_width;
 2534|  3.37k|        ps_ctxt->i4_ref_height = ps_curr_lyr_res_prms->i4_res_height;
 2535|  3.37k|        return OK;
  ------------------
  |  |  114|  3.37k|#define OK        0
  ------------------
 2536|  3.37k|    }
 2537|       |
 2538|       |    /* derive the current sps */
 2539|    720|    ps_sps = ps_dec->ps_cur_sps;
 2540|    720|    ps_subset_sps = ps_svc_lyr_dec->ps_cur_subset_sps;
 2541|       |
 2542|       |    /* store the res id appropriately */
 2543|    720|    ps_ctxt->i4_res_lyr_id = ps_svc_lyr_dec->u1_layer_id - 1;
 2544|       |
 2545|       |    /* get the current layer ctxt */
 2546|    720|    ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_svc_lyr_dec->u1_layer_id - 1];
 2547|       |
 2548|       |    /* get the width and heights */
 2549|    720|    ps_lyr_ctxt->i4_curr_width = ps_curr_lyr_res_prms->i4_res_width;
 2550|    720|    ps_lyr_ctxt->i4_curr_height = ps_curr_lyr_res_prms->i4_res_height;
 2551|    720|    ps_lyr_ctxt->i4_ref_width = ps_ctxt->i4_ref_width;
 2552|    720|    ps_lyr_ctxt->i4_ref_height = ps_ctxt->i4_ref_height;
 2553|       |
 2554|       |    /* store the strcuture pointer containing projected locations */
 2555|    720|    *pps_luma_map_horz = ps_lyr_ctxt->s_luma_map_ctxt.ps_x_offset_length;
 2556|    720|    *pps_chroma_map_horz = ps_lyr_ctxt->s_chroma_map_ctxt.ps_x_offset_length;
 2557|    720|    *pps_luma_map_vert = ps_lyr_ctxt->s_luma_map_ctxt.ps_y_offset_length;
 2558|    720|    *pps_chroma_map_vert = ps_lyr_ctxt->s_chroma_map_ctxt.ps_y_offset_length;
 2559|       |
 2560|       |    /* check for recomputation of mapping required */
 2561|    720|    if(SVCD_TRUE == ps_curr_lyr_res_prms->u1_remap_req_flag)
  ------------------
  |  |   46|    720|#define SVCD_TRUE 1
  ------------------
  |  Branch (2561:8): [True: 720, False: 0]
  ------------------
 2562|    720|    {
 2563|    720|        res_prms_t s_ref_res_prms = {0};
 2564|       |
 2565|       |        /* store the reference layer resolution width and height */
 2566|    720|        s_ref_res_prms.i4_res_width = ps_ctxt->i4_ref_width;
 2567|    720|        s_ref_res_prms.i4_res_height = ps_ctxt->i4_ref_height;
 2568|       |
 2569|       |        /* call the frame level projections calculation function */
 2570|    720|        isvcd_residual_samp_populate_list(&ps_lyr_ctxt->s_luma_map_ctxt, ps_sps, ps_subset_sps,
 2571|    720|                                          ps_curr_lyr_res_prms, &s_ref_res_prms, 0);
 2572|    720|        isvcd_residual_samp_populate_list(&ps_lyr_ctxt->s_chroma_map_ctxt, ps_sps, ps_subset_sps,
 2573|    720|                                          ps_curr_lyr_res_prms, &s_ref_res_prms, 1);
 2574|       |
 2575|       |        /* default values for flags */
 2576|    720|        ps_lyr_ctxt->pf_residual_samp_mb = &isvcd_residual_samp_mb;
 2577|    720|        ps_lyr_ctxt->i4_chrm_horz_int_mode = 0;
 2578|    720|        ps_lyr_ctxt->i4_chrm_vert_int_mode = 0;
 2579|    720|        ps_lyr_ctxt->i4_chrm_alt_proc = SVCD_FALSE;
  ------------------
  |  |   45|    720|#define SVCD_FALSE 0
  ------------------
 2580|       |
 2581|       |        /* Store the Dyadic flag */
 2582|    720|        ps_lyr_ctxt->i4_dyadic_flag = ps_curr_lyr_res_prms->u1_dyadic_flag;
 2583|       |
 2584|       |        /* set the appropriate chroma processing routine based on */
 2585|       |        /* phase values */
 2586|    720|        if(SVCD_TRUE == ps_curr_lyr_res_prms->u1_dyadic_flag)
  ------------------
  |  |   46|    720|#define SVCD_TRUE 1
  ------------------
  |  Branch (2586:12): [True: 640, False: 80]
  ------------------
 2587|    640|        {
 2588|    640|            WORD32 i4_ref_layer_chroma_phase_x_plus1_flag;
 2589|    640|            WORD32 i4_ref_layer_chroma_phase_y_plus1;
 2590|    640|            WORD32 i4_chroma_phase_x_plus1_flag;
 2591|    640|            WORD32 i4_chroma_phase_y_plus1;
 2592|       |
 2593|    640|            ps_lyr_ctxt->pf_residual_samp_mb = &isvcd_residual_samp_mb_dyadic;
 2594|    640|            i4_ref_layer_chroma_phase_x_plus1_flag =
 2595|    640|                ps_curr_lyr_res_prms->i1_ref_lyr_chroma_phase_x_plus1_flag;
 2596|    640|            i4_ref_layer_chroma_phase_y_plus1 =
 2597|    640|                ps_curr_lyr_res_prms->i1_ref_lyr_chroma_phase_y_plus1;
 2598|    640|            i4_chroma_phase_x_plus1_flag =
 2599|    640|                ps_subset_sps->s_sps_svc_ext.u1_seq_ref_layer_chroma_phase_x_plus1_flag;
 2600|    640|            i4_chroma_phase_y_plus1 =
 2601|    640|                ps_subset_sps->s_sps_svc_ext.u1_seq_ref_layer_chroma_phase_y_plus1;
 2602|    640|            if((0 == i4_ref_layer_chroma_phase_x_plus1_flag) && (1 == i4_chroma_phase_x_plus1_flag))
  ------------------
  |  Branch (2602:16): [True: 596, False: 44]
  |  Branch (2602:65): [True: 0, False: 596]
  ------------------
 2603|      0|            {
 2604|      0|                ps_lyr_ctxt->i4_chrm_horz_int_mode = 1;
 2605|      0|                ps_lyr_ctxt->i4_chrm_alt_proc = SVCD_TRUE;
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 2606|      0|            }
 2607|       |
 2608|    640|            if((0 == i4_ref_layer_chroma_phase_y_plus1) && (1 == i4_chroma_phase_y_plus1))
  ------------------
  |  Branch (2608:16): [True: 289, False: 351]
  |  Branch (2608:60): [True: 0, False: 289]
  ------------------
 2609|      0|            {
 2610|      0|                ps_lyr_ctxt->i4_chrm_vert_int_mode = 1;
 2611|      0|                ps_lyr_ctxt->i4_chrm_alt_proc = SVCD_TRUE;
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 2612|      0|            }
 2613|       |
 2614|    640|            if((0 == i4_ref_layer_chroma_phase_y_plus1) && (2 == i4_chroma_phase_y_plus1))
  ------------------
  |  Branch (2614:16): [True: 289, False: 351]
  |  Branch (2614:60): [True: 0, False: 289]
  ------------------
 2615|      0|            {
 2616|      0|                ps_lyr_ctxt->i4_chrm_vert_int_mode = 1;
 2617|      0|                ps_lyr_ctxt->i4_chrm_alt_proc = SVCD_TRUE;
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 2618|      0|            }
 2619|       |
 2620|    640|            if((2 == i4_ref_layer_chroma_phase_y_plus1) && (0 == i4_chroma_phase_y_plus1))
  ------------------
  |  Branch (2620:16): [True: 52, False: 588]
  |  Branch (2620:60): [True: 0, False: 52]
  ------------------
 2621|      0|            {
 2622|      0|                ps_lyr_ctxt->i4_chrm_vert_int_mode = 2;
 2623|      0|                ps_lyr_ctxt->i4_chrm_alt_proc = SVCD_TRUE;
  ------------------
  |  |   46|      0|#define SVCD_TRUE 1
  ------------------
 2624|      0|            }
 2625|    640|        }
 2626|    720|    }
 2627|      0|    else
 2628|      0|    {
 2629|       |        /* should take false value */
 2630|      0|        if(SVCD_FALSE != ps_curr_lyr_res_prms->u1_remap_req_flag)
  ------------------
  |  |   45|      0|#define SVCD_FALSE 0
  ------------------
  |  Branch (2630:12): [True: 0, False: 0]
  ------------------
 2631|      0|        {
 2632|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 2633|      0|        }
 2634|      0|    }
 2635|       |
 2636|       |    /* store the current layer width and height to context */
 2637|    720|    ps_ctxt->i4_ref_width = ps_curr_lyr_res_prms->i4_res_width;
 2638|    720|    ps_ctxt->i4_ref_height = ps_curr_lyr_res_prms->i4_res_height;
 2639|       |
 2640|       |    /* assert on max ranges of width and shift values */
 2641|    720|    if((ps_lyr_ctxt->i4_curr_width > H264_MAX_FRAME_WIDTH) ||
  ------------------
  |  |   39|    720|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
  |  Branch (2641:8): [True: 0, False: 720]
  ------------------
 2642|    720|       (ps_lyr_ctxt->i4_ref_width > H264_MAX_FRAME_WIDTH) ||
  ------------------
  |  |   39|    720|#define H264_MAX_FRAME_WIDTH                4096
  ------------------
  |  Branch (2642:8): [True: 0, False: 720]
  ------------------
 2643|    720|       (ps_lyr_ctxt->i4_curr_height > H264_MAX_FRAME_HEIGHT) ||
  ------------------
  |  |   40|    720|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
  |  Branch (2643:8): [True: 0, False: 720]
  ------------------
 2644|    720|       (ps_lyr_ctxt->i4_ref_height > H264_MAX_FRAME_HEIGHT))
  ------------------
  |  |   40|    720|#define H264_MAX_FRAME_HEIGHT               4096
  ------------------
  |  Branch (2644:8): [True: 0, False: 720]
  ------------------
 2645|      0|    {
 2646|      0|        return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
 2647|      0|    }
 2648|    720|    return OK;
  ------------------
  |  |  114|    720|#define OK        0
  ------------------
 2649|    720|}

isvcd_compute_bs_non_mbaff_thread:
   91|  13.1k|{
   92|  13.1k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
   93|       |    /* Mvpred and Nnz for top and Courrent */
   94|  13.1k|    mv_pred_t *ps_cur_mv_pred, *ps_top_mv_pred = NULL, *ps_left_mv_pred;
   95|       |    /* deblk_mb_t Params */
   96|  13.1k|    deblk_mb_t *ps_cur_mb_params; /*< Parameters of current MacroBlock */
   97|  13.1k|    deblkmb_neighbour_t *ps_deblk_top_mb;
   98|       |
   99|       |    /* Reference Index to POC mapping*/
  100|  13.1k|    void **apv_map_ref_idx_to_poc;
  101|  13.1k|    UWORD32 u4_leftmbtype;
  102|       |
  103|  13.1k|    UWORD16 u2_left_csbp, u2_top_csbp, u2_cur_csbp;
  104|       |
  105|       |    /* Set of flags */
  106|  13.1k|    UWORD32 u4_cur_mb_intra, u1_top_mb_typ, u4_cur_mb_fld;
  107|  13.1k|    UWORD32 u4_cur_mb_ibl;
  108|  13.1k|    UWORD32 u1_cur_mb_type;
  109|  13.1k|    UWORD32 *pu4_bs_table;
  110|       |
  111|  13.1k|    UWORD16 *pu2_curr_res_luma_csbp;
  112|  13.1k|    UWORD16 *pu2_left_res_luma_csbp;
  113|  13.1k|    UWORD16 *pu2_top_res_luma_csbp;
  114|       |
  115|       |    /* Neighbour availability */
  116|       |    /* Initialization */
  117|  13.1k|    const UWORD32 u2_mbx = ps_cur_mb_info->u2_mbx;
  118|  13.1k|    const UWORD32 u2_mby = ps_cur_mb_info->u2_mby;
  119|  13.1k|    const UWORD32 u1_pingpong = u2_mbx & 0x01;
  120|       |
  121|  13.1k|    PROFILE_DISABLE_BOUNDARY_STRENGTH()
  ------------------
  |  |  125|  13.1k|#define PROFILE_DISABLE_BOUNDARY_STRENGTH() ;
  ------------------
  122|  13.1k|    ps_deblk_top_mb = ps_dec->ps_deblk_top_mb + u2_mbx;
  123|       |
  124|       |    /* Pointer assignment for Current DeblkMB, Current Mv Pred  */
  125|  13.1k|    ps_cur_mb_params = ps_dec->ps_deblk_pic + u4_mb_num;
  126|  13.1k|    ps_cur_mv_pred = ps_dec->s_cur_pic.ps_mv + (u4_mb_num << 4);
  127|       |
  128|       |    /*Pointer assignment for Residual NNZ */
  129|  13.1k|    pu2_curr_res_luma_csbp = ps_svc_lyr_dec->pu2_frm_res_luma_csbp + ps_cur_mb_info->u2_mbx;
  130|  13.1k|    pu2_curr_res_luma_csbp += ps_cur_mb_info->u2_mby * ps_svc_lyr_dec->i4_frm_res_luma_csbp_stride;
  131|       |
  132|  13.1k|    pu2_left_res_luma_csbp = pu2_curr_res_luma_csbp - (ps_cur_mb_info->u2_mbx != 0);
  133|  13.1k|    pu2_top_res_luma_csbp = pu2_curr_res_luma_csbp - ((ps_cur_mb_info->u2_mby != 0) *
  134|  13.1k|                                                      ps_svc_lyr_dec->i4_frm_res_luma_csbp_stride);
  135|       |
  136|  13.1k|    apv_map_ref_idx_to_poc = (void **) ps_dec->ps_computebs_cur_slice->ppv_map_ref_idx_to_poc + 1;
  137|  13.1k|    u1_cur_mb_type = ps_cur_mb_params->u1_mb_type;
  138|  13.1k|    u1_top_mb_typ = ps_deblk_top_mb->u1_mb_type;
  139|  13.1k|    ps_deblk_top_mb->u1_mb_type = u1_cur_mb_type;
  140|       |
  141|  13.1k|    ps_cur_mb_params->u1_topmb_qp = ps_deblk_top_mb->u1_mb_qp;
  142|  13.1k|    ps_deblk_top_mb->u1_mb_qp = ps_cur_mb_params->u1_mb_qp;
  143|  13.1k|    ps_cur_mb_params->u1_left_mb_qp = ps_dec->deblk_left_mb[1].u1_mb_qp;
  144|  13.1k|    ps_dec->deblk_left_mb[1].u1_mb_qp = ps_cur_mb_params->u1_mb_qp;
  145|       |
  146|       |    /* if no deblocking required for current Mb then continue */
  147|       |    /* Check next Mbs   in Mb group                           */
  148|  13.1k|    if(ps_cur_mb_params->u1_deblocking_mode & MB_DISABLE_FILTERING)
  ------------------
  |  |   70|  13.1k|#define MB_DISABLE_FILTERING          0x01
  ------------------
  |  Branch (148:8): [True: 0, False: 13.1k]
  ------------------
  149|      0|    {
  150|      0|        void **pu4_map_ref_idx_to_poc_l1 = apv_map_ref_idx_to_poc + POC_LIST_L0_TO_L1_DIFF;
  ------------------
  |  |   86|      0|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  ------------------
  |  |  |  |  600|      0|#define MAX_FRAMES              16
  |  |  ------------------
  ------------------
  151|      0|        {
  152|       |            /* Store Parameter for Top MvPred refernce frame Address */
  153|      0|            void **ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress;
  154|      0|            WORD8 *p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame;
  155|      0|            WORD8 *p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame;
  156|       |
  157|       |            /* Store Left addresses for Next Mb   */
  158|      0|            void **ppv_left_mv_pred_addr = ps_dec->ps_left_mvpred_addr[!u1_pingpong][1].u4_add;
  159|      0|            WORD8 *p1_refleft0 = (ps_cur_mv_pred + 3)->i1_ref_frame;
  160|       |
  161|      0|            ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]];
  162|      0|            ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]];
  163|       |
  164|      0|            ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
  165|      0|            ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
  166|      0|            ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
  167|      0|            ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
  168|       |
  169|      0|            ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refleft0[0]];
  170|      0|            ppv_left_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refleft0[1]];
  171|       |
  172|       |            /* Storing the leftMbtype for next Mb */
  173|      0|            ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type;
  174|      0|        }
  175|       |
  176|      0|        return;
  177|      0|    }
  178|       |
  179|       |    /* Flag for extra left Edge */
  180|  13.1k|    ps_cur_mb_params->u1_single_call = 1;
  181|       |
  182|       |    /* Update the Left deblk_mb_t and Left MvPred Parameters */
  183|  13.1k|    if(!u2_mbx)
  ------------------
  |  Branch (183:8): [True: 3.02k, False: 10.0k]
  ------------------
  184|  3.02k|    {
  185|  3.02k|        u4_leftmbtype = 0;
  186|       |
  187|       |        /* Initialize the ps_left_mv_pred with Junk but Valid Location */
  188|       |        /* to avoid invalid memory access                           */
  189|       |        /* this is read only pointer                                */
  190|  3.02k|        ps_left_mv_pred = ps_cur_mv_pred + 3;
  191|  3.02k|    }
  192|  10.0k|    else
  193|  10.0k|    {
  194|  10.0k|        u4_leftmbtype = ps_dec->deblk_left_mb[1].u1_mb_type;
  195|       |
  196|       |        /* Come to Left Most Edge of the MB */
  197|  10.0k|        ps_left_mv_pred = ps_cur_mv_pred - (1 << 4) + 3;
  198|  10.0k|    }
  199|       |
  200|  13.1k|    if(!u2_mby) u1_top_mb_typ = 0;
  ------------------
  |  Branch (200:8): [True: 1.08k, False: 12.0k]
  ------------------
  201|       |
  202|       |    /* MvPred Pointer Calculation */
  203|  13.1k|    ps_top_mv_pred = ps_cur_mv_pred - (ps_dec->u2_frm_wd_in_mbs << 4) + 12;
  204|  13.1k|    u4_cur_mb_intra = u1_cur_mb_type & D_INTRA_MB;
  ------------------
  |  |  382|  13.1k|#define D_INTRA_MB        1
  ------------------
  205|  13.1k|    u4_cur_mb_ibl = u1_cur_mb_type & D_INTRA_IBL;
  ------------------
  |  |   72|  13.1k|#define D_INTRA_IBL 16
  ------------------
  206|  13.1k|    u4_cur_mb_fld = !!(u1_cur_mb_type & D_FLD_MB);
  ------------------
  |  |  386|  13.1k|#define D_FLD_MB          0x80
  ------------------
  207|       |    /* Compute BS function */
  208|  13.1k|    pu4_bs_table = ps_cur_mb_params->u4_bs_table;
  209|       |
  210|  13.1k|    u2_cur_csbp = ps_cur_mb_info->ps_curmb->u2_luma_csbp;
  211|  13.1k|    u2_left_csbp = ps_cur_mb_info->ps_left_mb->u2_luma_csbp;
  212|  13.1k|    u2_top_csbp = ps_cur_mb_info->ps_top_mb->u2_luma_csbp;
  213|       |
  214|       |    /* Compute BS function */
  215|  13.1k|    if((ps_dec->ps_cur_sps->u1_profile_idc == HIGH_PROFILE_IDC) ||
  ------------------
  |  |  278|  13.1k|#define HIGH_PROFILE_IDC   100
  ------------------
  |  Branch (215:8): [True: 0, False: 13.1k]
  ------------------
  216|  13.1k|       (ps_dec->ps_cur_sps->u1_profile_idc == HIGH_PROFILE_IDC) ||
  ------------------
  |  |  278|  13.1k|#define HIGH_PROFILE_IDC   100
  ------------------
  |  Branch (216:8): [True: 0, False: 13.1k]
  ------------------
  217|  13.1k|       (ps_dec->ps_cur_sps->u1_profile_idc == SCALABLE_HIGH_PROFILE_IDC) ||
  ------------------
  |  |   60|  13.1k|#define SCALABLE_HIGH_PROFILE_IDC 86
  ------------------
  |  Branch (217:8): [True: 11.0k, False: 2.06k]
  ------------------
  218|  2.06k|       (ps_dec->ps_cur_sps->u1_profile_idc == SCALABLE_BASELINE_PROFILE_IDC))
  ------------------
  |  |   59|  2.06k|#define SCALABLE_BASELINE_PROFILE_IDC 83
  ------------------
  |  Branch (218:8): [True: 0, False: 2.06k]
  ------------------
  219|  11.0k|    {
  220|  11.0k|        if(ps_cur_mb_info->u1_tran_form8x8 == 1)
  ------------------
  |  Branch (220:12): [True: 9.37k, False: 1.66k]
  ------------------
  221|  9.37k|        {
  222|  9.37k|            u2_cur_csbp = ih264d_update_csbp_8x8(ps_cur_mb_info->ps_curmb->u2_luma_csbp);
  223|  9.37k|            ps_cur_mb_info->ps_curmb->u2_luma_csbp = u2_cur_csbp;
  224|  9.37k|        }
  225|  11.0k|    }
  226|  13.1k|    u2_cur_csbp |= *pu2_curr_res_luma_csbp;
  227|  13.1k|    u2_left_csbp |= *pu2_left_res_luma_csbp;
  228|  13.1k|    u2_top_csbp |= *pu2_top_res_luma_csbp;
  229|       |
  230|  13.1k|    if(u4_cur_mb_intra)
  ------------------
  |  Branch (230:8): [True: 1.20k, False: 11.9k]
  ------------------
  231|  1.20k|    {
  232|  1.20k|        pu4_bs_table[4] = 0x04040404;
  233|  1.20k|        pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404;
  ------------------
  |  Branch (233:27): [True: 0, False: 1.20k]
  ------------------
  234|  1.20k|        pu4_bs_table[1] = 0x03030303;
  235|  1.20k|        pu4_bs_table[2] = 0x03030303;
  236|  1.20k|        pu4_bs_table[3] = 0x03030303;
  237|  1.20k|        pu4_bs_table[5] = 0x03030303;
  238|  1.20k|        pu4_bs_table[6] = 0x03030303;
  239|  1.20k|        pu4_bs_table[7] = 0x03030303;
  240|  1.20k|    }
  241|  11.9k|    else
  242|  11.9k|    {
  243|  11.9k|        isvcd_fill_bs_ibl(ps_cur_mb_params, u1_top_mb_typ, u4_leftmbtype, ps_cur_mb_info,
  244|  11.9k|                          pu2_curr_res_luma_csbp, pu2_left_res_luma_csbp, pu2_top_res_luma_csbp);
  245|       |
  246|  11.9k|        if(!u4_cur_mb_ibl)
  ------------------
  |  Branch (246:12): [True: 11.8k, False: 71]
  ------------------
  247|  11.8k|        {
  248|  11.8k|            UWORD32 u4_is_non16x16 = !!(u1_cur_mb_type & D_PRED_NON_16x16);
  ------------------
  |  |  383|  11.8k|#define D_PRED_NON_16x16  2
  ------------------
  249|  11.8k|            UWORD32 u4_is_b = (ps_dec->ps_computebs_cur_slice->slice_type == B_SLICE);
  ------------------
  |  |  369|  11.8k|#define B_SLICE  1
  ------------------
  250|  11.8k|            UWORD32 u4_bs_0, u4_bs_4;
  251|       |
  252|  11.8k|            u4_bs_0 = pu4_bs_table[0];
  253|  11.8k|            u4_bs_4 = pu4_bs_table[4];
  254|       |
  255|  11.8k|            ih264d_fill_bs2_horz_vert(pu4_bs_table, u2_left_csbp, u2_top_csbp, u2_cur_csbp,
  256|  11.8k|                                      gau4_ih264d_packed_bs2, gau2_ih264d_4x4_v2h_reorder);
  257|       |
  258|  11.8k|            if(u4_leftmbtype & D_INTRA_MB)
  ------------------
  |  |  382|  11.8k|#define D_INTRA_MB        1
  ------------------
  |  Branch (258:16): [True: 254, False: 11.5k]
  ------------------
  259|    254|            {
  260|    254|                pu4_bs_table[4] = 0x04040404;
  261|    254|            }
  262|  11.5k|            else if(u4_leftmbtype & D_INTRA_IBL)
  ------------------
  |  |   72|  11.5k|#define D_INTRA_IBL 16
  ------------------
  |  Branch (262:21): [True: 36, False: 11.5k]
  ------------------
  263|     36|            {
  264|     36|                pu4_bs_table[4] = u4_bs_4;
  265|     36|            }
  266|       |
  267|  11.8k|            if(u1_top_mb_typ & D_INTRA_MB)
  ------------------
  |  |  382|  11.8k|#define D_INTRA_MB        1
  ------------------
  |  Branch (267:16): [True: 261, False: 11.5k]
  ------------------
  268|    261|            {
  269|    261|                pu4_bs_table[0] = u4_cur_mb_fld ? 0x03030303 : 0x04040404;
  ------------------
  |  Branch (269:35): [True: 0, False: 261]
  ------------------
  270|    261|            }
  271|  11.5k|            else if(u1_top_mb_typ & D_INTRA_IBL)
  ------------------
  |  |   72|  11.5k|#define D_INTRA_IBL 16
  ------------------
  |  Branch (271:21): [True: 59, False: 11.5k]
  ------------------
  272|     59|            {
  273|     59|                pu4_bs_table[0] = u4_bs_0;
  274|     59|            }
  275|       |
  276|  11.8k|            ps_dec->pf_fill_bs1[u4_is_b][u4_is_non16x16](
  277|  11.8k|                ps_cur_mv_pred, ps_top_mv_pred, apv_map_ref_idx_to_poc, pu4_bs_table,
  278|  11.8k|                ps_left_mv_pred, &(ps_dec->ps_left_mvpred_addr[u1_pingpong][1]),
  279|  11.8k|                ps_cur_mb_info->ps_top_mb->u4_pic_addrress, (4 >> u4_cur_mb_fld));
  280|  11.8k|        }
  281|  11.9k|    }
  282|       |
  283|  13.1k|    {
  284|  13.1k|        void **pu4_map_ref_idx_to_poc_l1 = apv_map_ref_idx_to_poc + POC_LIST_L0_TO_L1_DIFF;
  ------------------
  |  |   86|  13.1k|#define POC_LIST_L0_TO_L1_DIFF  (( 2*MAX_FRAMES) + 1)
  |  |  ------------------
  |  |  |  |  600|  13.1k|#define MAX_FRAMES              16
  |  |  ------------------
  ------------------
  285|  13.1k|        {
  286|       |            /* Store Parameter for Top MvPred refernce frame Address */
  287|  13.1k|            void **ppv_top_mv_pred_addr = ps_cur_mb_info->ps_curmb->u4_pic_addrress;
  288|  13.1k|            WORD8 *p1_refTop0 = (ps_cur_mv_pred + 12)->i1_ref_frame;
  289|  13.1k|            WORD8 *p1_refTop1 = (ps_cur_mv_pred + 14)->i1_ref_frame;
  290|       |
  291|       |            /* Store Left addresses for Next Mb   */
  292|  13.1k|            void **ppv_left_mv_pred_addr = ps_dec->ps_left_mvpred_addr[!u1_pingpong][1].u4_add;
  293|  13.1k|            WORD8 *p1_refleft0 = (ps_cur_mv_pred + 3)->i1_ref_frame;
  294|       |
  295|  13.1k|            ppv_top_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refTop0[0]];
  296|  13.1k|            ppv_top_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refTop0[1]];
  297|       |
  298|  13.1k|            ppv_left_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
  299|  13.1k|            ppv_top_mv_pred_addr[2] = apv_map_ref_idx_to_poc[p1_refTop1[0]];
  300|  13.1k|            ppv_left_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
  301|  13.1k|            ppv_top_mv_pred_addr[3] = pu4_map_ref_idx_to_poc_l1[p1_refTop1[1]];
  302|       |
  303|  13.1k|            ppv_left_mv_pred_addr[0] = apv_map_ref_idx_to_poc[p1_refleft0[0]];
  304|  13.1k|            ppv_left_mv_pred_addr[1] = pu4_map_ref_idx_to_poc_l1[p1_refleft0[1]];
  305|       |
  306|       |            /* Storing the leftMbtype for next Mb */
  307|  13.1k|            ps_dec->deblk_left_mb[1].u1_mb_type = ps_cur_mb_params->u1_mb_type;
  308|  13.1k|        }
  309|  13.1k|    }
  310|       |
  311|       |    /* For transform 8x8 disable deblocking of the intrernal edges of a 8x8 block */
  312|  13.1k|    if(ps_cur_mb_info->u1_tran_form8x8)
  ------------------
  |  Branch (312:8): [True: 9.45k, False: 3.65k]
  ------------------
  313|  9.45k|    {
  314|  9.45k|        pu4_bs_table[1] = 0;
  315|  9.45k|        pu4_bs_table[3] = 0;
  316|  9.45k|        pu4_bs_table[5] = 0;
  317|  9.45k|        pu4_bs_table[7] = 0;
  318|  9.45k|    }
  319|  13.1k|}

isvcd_decode_recon_tfr_nmb_thread:
   76|  4.50k|{
   77|  4.50k|    WORD32 i, j;
   78|  4.50k|    dec_mb_info_t *ps_cur_mb_info;
   79|  4.50k|    dec_svc_mb_info_t *ps_svc_cur_mb_info;
   80|  4.50k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
   81|  4.50k|    const UWORD32 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
   82|  4.50k|    UWORD32 u1_slice_type, u1_B;
   83|  4.50k|    WORD32 u1_skip_th;
   84|  4.50k|    UWORD32 u1_ipcm_th;
   85|  4.50k|    UWORD32 u4_cond;
   86|  4.50k|    UWORD16 u2_slice_num, u2_cur_dec_mb_num;
   87|  4.50k|    UWORD32 u4_mb_num;
   88|  4.50k|    WORD32 nop_cnt = 8 * 128;
   89|  4.50k|    UWORD16 *pu2_res_luma_csbp;
   90|  4.50k|    WORD32 ret;
   91|  4.50k|    u1_slice_type = ps_dec->ps_decode_cur_slice->slice_type;
   92|       |
   93|  4.50k|    u1_B = (u1_slice_type == B_SLICE);
  ------------------
  |  |  369|  4.50k|#define B_SLICE  1
  ------------------
   94|  4.50k|    u1_skip_th = ((u1_slice_type != I_SLICE) ? (u1_B ? B_8x8 : PRED_8x8R0) : -1);
  ------------------
  |  |  370|  4.50k|#define I_SLICE  2
  ------------------
                  u1_skip_th = ((u1_slice_type != I_SLICE) ? (u1_B ? B_8x8 : PRED_8x8R0) : -1);
  ------------------
  |  |  480|    191|#define B_8x8    22
  ------------------
                  u1_skip_th = ((u1_slice_type != I_SLICE) ? (u1_B ? B_8x8 : PRED_8x8R0) : -1);
  ------------------
  |  |  454|  4.31k|#define PRED_8x8R0  4
  ------------------
  |  Branch (94:19): [True: 4.50k, False: 0]
  |  Branch (94:49): [True: 191, False: 4.31k]
  ------------------
   95|  4.50k|    u1_ipcm_th = ((u1_slice_type != I_SLICE) ? (u1_B ? 23 : 5) : 0);
  ------------------
  |  |  370|  4.50k|#define I_SLICE  2
  ------------------
  |  Branch (95:19): [True: 4.50k, False: 0]
  |  Branch (95:49): [True: 191, False: 4.31k]
  ------------------
   96|  4.50k|    u2_cur_dec_mb_num = ps_dec->cur_dec_mb_num;
   97|       |
   98|  26.2k|    while(1)
  ------------------
  |  Branch (98:11): [True: 26.2k, Folded]
  ------------------
   99|  26.2k|    {
  100|  26.2k|        UWORD32 u4_max_mb =
  101|  26.2k|            (UWORD32) (ps_dec->i2_dec_thread_mb_y + (1 << u1_mbaff)) * ps_dec->u2_frm_wd_in_mbs - 1;
  102|  26.2k|        u4_mb_num = u2_cur_dec_mb_num;
  103|       |        /*introducing 1 MB delay*/
  104|  26.2k|        u4_mb_num = MIN(u4_mb_num + u4_num_mbs + 1, u4_max_mb);
  ------------------
  |  |   61|  26.2k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 0, False: 26.2k]
  |  |  ------------------
  ------------------
  105|       |
  106|  26.2k|        CHECK_MB_MAP_BYTE(u4_mb_num, ps_dec->pu1_dec_mb_map, u4_cond);
  ------------------
  |  |   80|  26.2k|#define CHECK_MB_MAP_BYTE(u4_mb_num, mb_map, u4_cond)                                               \
  |  |   81|  26.2k|{                                                                                                   \
  |  |   82|  26.2k|        volatile UWORD8 *pu1_mb_flag;                                                               \
  |  |   83|  26.2k|                                                                                                    \
  |  |   84|  26.2k|        pu1_mb_flag    = (UWORD8 *)mb_map + (u4_mb_num );                                           \
  |  |   85|  26.2k|                                                                                                    \
  |  |   86|  26.2k|        u4_cond = (*pu1_mb_flag);                                                                   \
  |  |   87|  26.2k|}
  ------------------
  107|  26.2k|        if(u4_cond)
  ------------------
  |  Branch (107:12): [True: 4.47k, False: 21.7k]
  ------------------
  108|  4.47k|        {
  109|  4.47k|            break;
  110|  4.47k|        }
  111|  21.7k|        else
  112|  21.7k|        {
  113|  21.7k|            if(nop_cnt > 0)
  ------------------
  |  Branch (113:16): [True: 17.6k, False: 4.16k]
  ------------------
  114|  17.6k|            {
  115|  17.6k|                nop_cnt -= 128;
  116|  17.6k|                NOP(128);
  ------------------
  |  |   87|  2.27M|#define NOP(nop_cnt) {UWORD32 nop_i; for (nop_i = 0; nop_i < nop_cnt; nop_i++) asm("nop");}
  |  |  ------------------
  |  |  |  Branch (87:54): [True: 2.25M, False: 17.6k]
  |  |  ------------------
  ------------------
  117|  17.6k|            }
  118|  4.16k|            else
  119|  4.16k|            {
  120|  4.16k|                if(ps_dec->u4_output_present && (2 == ps_dec->u4_num_cores) &&
  ------------------
  |  Branch (120:20): [True: 4.11k, False: 52]
  |  Branch (120:49): [True: 4.11k, False: 0]
  ------------------
  121|  4.11k|                   (ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht))
  ------------------
  |  Branch (121:20): [True: 2.63k, False: 1.47k]
  ------------------
  122|  2.63k|                {
  123|  2.63k|                    ps_dec->u4_fmt_conv_num_rows =
  124|  2.63k|                        MIN(FMT_CONV_NUM_ROWS,
  ------------------
  |  |   61|  2.63k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 2.42k, False: 213]
  |  |  ------------------
  ------------------
  125|  2.63k|                            (ps_dec->s_disp_frame_info.u4_y_ht - ps_dec->u4_fmt_conv_cur_row));
  126|  2.63k|                    ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op), ps_dec->u4_fmt_conv_cur_row,
  127|  2.63k|                                          ps_dec->u4_fmt_conv_num_rows);
  128|  2.63k|                    ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
  129|  2.63k|                }
  130|  1.52k|                else
  131|  1.52k|                {
  132|  1.52k|                    nop_cnt = 8 * 128;
  133|  1.52k|                    ithread_yield();
  134|  1.52k|                }
  135|  4.16k|                if(1 == ps_svc_lyr_dec->u1_error_in_cur_frame)
  ------------------
  |  Branch (135:20): [True: 27, False: 4.13k]
  ------------------
  136|     27|                {
  137|     27|                    return NOT_OK;
  ------------------
  |  |  116|     27|#define NOT_OK    -1
  ------------------
  138|     27|                }
  139|  4.16k|            }
  140|  21.7k|        }
  141|  26.2k|    }
  142|       |
  143|       |    /* N Mb MC Loop */
  144|  21.6k|    for(i = 0; i < u4_num_mbs; i++)
  ------------------
  |  Branch (144:16): [True: 17.2k, False: 4.39k]
  ------------------
  145|  17.2k|    {
  146|  17.2k|        u4_mb_num = u2_cur_dec_mb_num;
  147|  17.2k|        GET_SLICE_NUM_MAP(ps_dec->pu2_slice_num_map, u2_cur_dec_mb_num, u2_slice_num);
  ------------------
  |  |  156|  17.2k|#define GET_SLICE_NUM_MAP(slice_map, mb_number,u2_slice_num)                                                  \
  |  |  157|  17.2k|{                                                                                                   \
  |  |  158|  17.2k|        volatile UWORD16 *pu2_slice_map;                                                               \
  |  |  159|  17.2k|                                                                                                    \
  |  |  160|  17.2k|        pu2_slice_map    = (UWORD16 *)slice_map + (mb_number);                                         \
  |  |  161|  17.2k|        u2_slice_num = (*pu2_slice_map) ;                                                               \
  |  |  162|  17.2k|}
  ------------------
  148|       |
  149|  17.2k|        if(u2_slice_num != ps_dec->u2_cur_slice_num_dec_thread)
  ------------------
  |  Branch (149:12): [True: 81, False: 17.1k]
  ------------------
  150|     81|        {
  151|     81|            ps_dec->u4_cur_slice_decode_done = 1;
  152|     81|            break;
  153|     81|        }
  154|       |
  155|  17.1k|        ps_cur_mb_info = &ps_dec->ps_frm_mb_info[u2_cur_dec_mb_num];
  156|       |
  157|  17.1k|        ps_dec->u4_dma_buf_idx = 0;
  158|  17.1k|        ps_dec->u4_pred_info_idx = 0;
  159|       |
  160|       |        /*Pointer assignment for Residual NNZ */
  161|  17.1k|        pu2_res_luma_csbp = ps_svc_lyr_dec->pu2_frm_res_luma_csbp + ps_cur_mb_info->u2_mbx;
  162|  17.1k|        pu2_res_luma_csbp += ps_cur_mb_info->u2_mby * ps_svc_lyr_dec->i4_frm_res_luma_csbp_stride;
  163|       |
  164|  17.1k|        if(ps_cur_mb_info->u1_mb_type <= u1_skip_th)
  ------------------
  |  Branch (164:12): [True: 12.8k, False: 4.35k]
  ------------------
  165|  12.8k|        {
  166|  12.8k|            WORD32 pred_cnt = 0;
  167|  12.8k|            pred_info_pkd_t *ps_pred_pkd;
  168|  12.8k|            UWORD32 u4_pred_info_pkd_idx;
  169|       |
  170|  12.8k|            u4_pred_info_pkd_idx = ps_cur_mb_info->u4_pred_info_pkd_idx;
  171|       |
  172|  29.2k|            while(pred_cnt < ps_cur_mb_info->u1_num_pred_parts)
  ------------------
  |  Branch (172:19): [True: 16.4k, False: 12.8k]
  ------------------
  173|  16.4k|            {
  174|  16.4k|                ps_pred_pkd = ps_dec->ps_pred_pkd + u4_pred_info_pkd_idx;
  175|       |
  176|  16.4k|                ps_dec->p_form_mb_part_info_thread(ps_pred_pkd, ps_dec, ps_cur_mb_info->u2_mbx,
  177|  16.4k|                                                   ps_cur_mb_info->u2_mby, (i >> u1_mbaff),
  178|  16.4k|                                                   ps_cur_mb_info);
  179|       |
  180|  16.4k|                u4_pred_info_pkd_idx++;
  181|  16.4k|                pred_cnt++;
  182|  16.4k|            }
  183|  12.8k|            ps_dec->p_mc_dec_thread(ps_dec, ps_cur_mb_info);
  184|  12.8k|        }
  185|  4.35k|        else if(ps_cur_mb_info->u1_mb_type == MB_SKIP)
  ------------------
  |  |  456|  4.35k|#define MB_SKIP     255
  ------------------
  |  Branch (185:17): [True: 3.88k, False: 471]
  ------------------
  186|  3.88k|        {
  187|  3.88k|            WORD32 pred_cnt = 0;
  188|  3.88k|            pred_info_pkd_t *ps_pred_pkd;
  189|  3.88k|            UWORD32 u4_pred_info_pkd_idx;
  190|       |
  191|  3.88k|            u4_pred_info_pkd_idx = ps_cur_mb_info->u4_pred_info_pkd_idx;
  192|       |
  193|  7.93k|            while(pred_cnt < ps_cur_mb_info->u1_num_pred_parts)
  ------------------
  |  Branch (193:19): [True: 4.05k, False: 3.88k]
  ------------------
  194|  4.05k|            {
  195|  4.05k|                ps_pred_pkd = ps_dec->ps_pred_pkd + u4_pred_info_pkd_idx;
  196|       |
  197|  4.05k|                ps_dec->p_form_mb_part_info_thread(ps_pred_pkd, ps_dec, ps_cur_mb_info->u2_mbx,
  198|  4.05k|                                                   ps_cur_mb_info->u2_mby, (i >> u1_mbaff),
  199|  4.05k|                                                   ps_cur_mb_info);
  200|       |
  201|  4.05k|                u4_pred_info_pkd_idx++;
  202|  4.05k|                pred_cnt++;
  203|  4.05k|            }
  204|       |            /* Decode MB skip */
  205|  3.88k|            ps_dec->p_mc_dec_thread(ps_dec, ps_cur_mb_info);
  206|       |
  207|  3.88k|            *pu2_res_luma_csbp = 0;
  208|  3.88k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb =
  209|  3.88k|                ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start + ps_cur_mb_info->u2_mbx +
  210|  3.88k|                (ps_svc_lyr_dec->u2_inter_lyr_mb_prms_stride * (ps_cur_mb_info->u2_mby));
  211|  3.88k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_mb_mode = SVC_INTER_MB;
  ------------------
  |  |  114|  3.88k|#define SVC_INTER_MB (1 << 0)       /*!< Intra MBs other than IPCM and I_BL */
  ------------------
  212|  3.88k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_tx_size =
  213|  3.88k|                ps_cur_mb_info->u1_tran_form8x8;
  214|  3.88k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u2_luma_nnz = 0;
  215|  3.88k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->u1_chroma_nnz = 0;
  216|  3.88k|        }
  217|       |
  218|  17.1k|        u2_cur_dec_mb_num++;
  219|  17.1k|    }
  220|       |
  221|       |    /* N Mb IQ IT RECON  Loop */
  222|  21.6k|    for(j = 0; j < i; j++)
  ------------------
  |  Branch (222:16): [True: 17.1k, False: 4.47k]
  ------------------
  223|  17.1k|    {
  224|  17.1k|        ps_cur_mb_info = &ps_dec->ps_frm_mb_info[ps_dec->cur_dec_mb_num];
  225|  17.1k|        ps_svc_cur_mb_info = &ps_svc_lyr_dec->ps_svc_frm_mb_info[ps_dec->cur_dec_mb_num];
  226|       |
  227|  17.1k|        if(NULL == ps_cur_mb_info->ps_curmb)
  ------------------
  |  Branch (227:12): [True: 0, False: 17.1k]
  ------------------
  228|      0|        {
  229|      0|            return NOT_OK;
  ------------------
  |  |  116|      0|#define NOT_OK    -1
  ------------------
  230|      0|        }
  231|       |
  232|       |        /*Pointer assignment for Residual NNZ */
  233|  17.1k|        pu2_res_luma_csbp = ps_svc_lyr_dec->pu2_frm_res_luma_csbp + ps_cur_mb_info->u2_mbx;
  234|  17.1k|        pu2_res_luma_csbp += ps_cur_mb_info->u2_mby * ps_svc_lyr_dec->i4_frm_res_luma_csbp_stride;
  235|       |
  236|  17.1k|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb =
  237|  17.1k|            ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start + ps_cur_mb_info->u2_mbx +
  238|  17.1k|            (ps_svc_lyr_dec->u2_inter_lyr_mb_prms_stride * (ps_cur_mb_info->u2_mby));
  239|       |
  240|  17.1k|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_cur_mb->i1_slice_id = (WORD8) ps_dec->u2_cur_slice_num;
  241|       |
  242|  17.1k|        if((ps_dec->u4_num_cores == 2) || !ps_dec->i1_recon_in_thread3_flag)
  ------------------
  |  Branch (242:12): [True: 17.1k, False: 0]
  |  Branch (242:43): [True: 0, False: 0]
  ------------------
  243|  17.1k|        {
  244|  17.1k|            if(ps_cur_mb_info->u1_mb_type <= u1_skip_th)
  ------------------
  |  Branch (244:16): [True: 12.8k, False: 4.35k]
  ------------------
  245|  12.8k|            {
  246|  12.8k|                {
  247|       |                    /* inter intra pred generation */
  248|  12.8k|                    if(SVCD_FALSE == ps_svc_lyr_dec->u1_dyadic_flag)
  ------------------
  |  |   45|  12.8k|#define SVCD_FALSE 0
  ------------------
  |  Branch (248:24): [True: 592, False: 12.2k]
  ------------------
  249|    592|                    {
  250|    592|                        ret = isvcd_process_ii_mb(ps_svc_lyr_dec, ps_cur_mb_info,
  251|    592|                                                  ps_svc_cur_mb_info, j);
  252|    592|                        if(ret != OK) return ret;
  ------------------
  |  |  114|    592|#define OK        0
  ------------------
  |  Branch (252:28): [True: 0, False: 592]
  ------------------
  253|    592|                    }
  254|  12.8k|                    if(0 == ps_svc_cur_mb_info->u1_residual_prediction_flag)
  ------------------
  |  Branch (254:24): [True: 574, False: 12.2k]
  ------------------
  255|    574|                    {
  256|       |                        /* IT + Recon */
  257|    574|                        ih264d_process_inter_mb(ps_dec, ps_cur_mb_info, j);
  258|    574|                        isvcd_update_inter_mb_inter_layer_info(ps_svc_lyr_dec, ps_cur_mb_info, 0);
  259|    574|                        *pu2_res_luma_csbp = ps_cur_mb_info->u2_luma_csbp;
  260|    574|                    }
  261|  12.2k|                    else
  262|  12.2k|                    {
  263|       |                        /* IT + Residual + Recon */
  264|  12.2k|                        ret = isvcd_process_inter_mb_rsd_pred_target_lyr(
  265|  12.2k|                            ps_svc_lyr_dec, ps_cur_mb_info, j, 0, pu2_res_luma_csbp);
  266|  12.2k|                        if(ret != OK) return ret;
  ------------------
  |  |  114|  12.2k|#define OK        0
  ------------------
  |  Branch (266:28): [True: 0, False: 12.2k]
  ------------------
  267|  12.2k|                    }
  268|  12.8k|                }
  269|  12.8k|            }
  270|       |
  271|  4.35k|            else if((ps_cur_mb_info->u1_mb_type != MB_SKIP) &&
  ------------------
  |  |  456|  4.35k|#define MB_SKIP     255
  ------------------
  |  Branch (271:21): [True: 471, False: 3.88k]
  ------------------
  272|    471|                    (ps_cur_mb_info->u1_mb_type != MB_INFER))
  ------------------
  |  |  112|    471|#define MB_INFER 250
  ------------------
  |  Branch (272:21): [True: 348, False: 123]
  ------------------
  273|    348|            {
  274|    348|                if((u1_ipcm_th + 25) != ps_cur_mb_info->u1_mb_type)
  ------------------
  |  Branch (274:20): [True: 348, False: 0]
  ------------------
  275|    348|                {
  276|    348|                    ps_cur_mb_info->u1_mb_type -= (u1_skip_th + 1);
  277|    348|                    ih264d_process_intra_mb(ps_dec, ps_cur_mb_info, j);
  278|    348|                    isvcd_update_intra_mb_inter_layer_info(ps_svc_lyr_dec, ps_cur_mb_info);
  279|    348|                }
  280|      0|                else
  281|      0|                {
  282|      0|                    isvcd_update_ipcm_mb_inter_layer_info(ps_svc_lyr_dec, ps_cur_mb_info);
  283|      0|                }
  284|    348|                *pu2_res_luma_csbp = 0;
  285|    348|            }
  286|  4.00k|            else if(ps_cur_mb_info->u1_mb_type == MB_INFER)
  ------------------
  |  |  112|  4.00k|#define MB_INFER 250
  ------------------
  |  Branch (286:21): [True: 123, False: 3.88k]
  ------------------
  287|    123|            {
  288|       |                /* inter layer intra prediction : intra upsample, IQ, IT ,deblock */
  289|    123|                {
  290|       |                    /* Intra resample for IBL mode */
  291|    123|                    ret = isvcd_process_ibl_mb(ps_svc_lyr_dec, ps_cur_mb_info, j, 0);
  292|    123|                    if(ret != OK) return ret;
  ------------------
  |  |  114|    123|#define OK        0
  ------------------
  |  Branch (292:24): [True: 0, False: 123]
  ------------------
  293|       |                    /* Pass intra resample as pred to Recon generation */
  294|    123|                    ih264d_process_inter_mb(ps_dec, ps_cur_mb_info, j);
  295|    123|                    isvcd_update_inter_mb_inter_layer_info(ps_svc_lyr_dec, ps_cur_mb_info, 1);
  296|    123|                    *pu2_res_luma_csbp = ps_cur_mb_info->u2_luma_csbp;
  297|    123|                }
  298|    123|                ps_dec->pi1_left_pred_mode[0] = DC;
  ------------------
  |  |  431|    123|#define DC      2
  ------------------
  299|    123|                ps_dec->pi1_left_pred_mode[1] = DC;
  ------------------
  |  |  431|    123|#define DC      2
  ------------------
  300|    123|                ps_dec->pi1_left_pred_mode[2] = DC;
  ------------------
  |  |  431|    123|#define DC      2
  ------------------
  301|    123|                ps_dec->pi1_left_pred_mode[3] = DC;
  ------------------
  |  |  431|    123|#define DC      2
  ------------------
  302|       |
  303|    123|                ps_cur_mb_info->ps_curmb->pi1_intrapredmodes[0] = DC;
  ------------------
  |  |  431|    123|#define DC      2
  ------------------
  304|    123|                ps_cur_mb_info->ps_curmb->pi1_intrapredmodes[1] = DC;
  ------------------
  |  |  431|    123|#define DC      2
  ------------------
  305|    123|                ps_cur_mb_info->ps_curmb->pi1_intrapredmodes[2] = DC;
  ------------------
  |  |  431|    123|#define DC      2
  ------------------
  306|    123|                ps_cur_mb_info->ps_curmb->pi1_intrapredmodes[3] = DC;
  ------------------
  |  |  431|    123|#define DC      2
  ------------------
  307|       |
  308|    123|                isvcd_update_ibl_mb_inter_layer_info(ps_svc_lyr_dec, ps_cur_mb_info);
  309|    123|            }
  310|       |
  311|  17.1k|            if(ps_dec->u4_use_intrapred_line_copy == 1)
  ------------------
  |  Branch (311:16): [True: 17.1k, False: 0]
  ------------------
  312|  17.1k|                ih264d_copy_intra_pred_line(ps_dec, ps_cur_mb_info, j);
  313|  17.1k|        }
  314|       |
  315|  17.1k|        DATA_SYNC();
  ------------------
  |  |  116|  17.1k|#define DATA_SYNC()  __sync_synchronize()
  ------------------
  316|       |
  317|  17.1k|        u4_mb_num = ps_cur_mb_info->u2_mbx + ps_dec->u2_frm_wd_in_mbs * ps_cur_mb_info->u2_mby;
  318|  17.1k|        UPDATE_MB_MAP_MBNUM_BYTE(ps_dec->pu1_recon_mb_map, u4_mb_num);
  ------------------
  |  |  136|  17.1k|#define UPDATE_MB_MAP_MBNUM_BYTE(mb_map, u4_mb_number)                                                  \
  |  |  137|  17.1k|{                                                                                                   \
  |  |  138|  17.1k|        volatile UWORD8 *pu1_mb_flag;                                                                       \
  |  |  139|  17.1k|                                                                                                    \
  |  |  140|  17.1k|        pu1_mb_flag    = (UWORD8 *)mb_map + (u4_mb_number);                                                     \
  |  |  141|  17.1k|        /*                                                                                          \
  |  |  142|  17.1k|         * In case of MbAff, update the mb_map only if the entire MB is done. We can check that     \
  |  |  143|  17.1k|         * by checking if Y is odd, implying that this is the second row in the MbAff MB            \
  |  |  144|  17.1k|         */                                                                                         \
  |  |  145|  17.1k|        (*pu1_mb_flag) = 1;                                                             \
  |  |  146|  17.1k|}
  ------------------
  319|  17.1k|        ps_dec->cur_dec_mb_num++;
  320|  17.1k|    }
  321|       |
  322|       |    /*N MB deblocking*/
  323|  4.47k|    if(ps_dec->u4_nmb_deblk == 1)
  ------------------
  |  Branch (323:8): [True: 0, False: 4.47k]
  ------------------
  324|      0|    {
  325|      0|        UWORD32 u4_wd_y, u4_wd_uv;
  326|      0|        tfr_ctxt_t *ps_tfr_cxt = &(ps_dec->s_tran_addrecon);
  327|      0|        UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag;
  328|      0|        const WORD32 i4_cb_qp_idx_ofst = ps_dec->ps_cur_pps->i1_chroma_qp_index_offset;
  329|      0|        const WORD32 i4_cr_qp_idx_ofst = ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset;
  330|       |
  331|      0|        u4_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag;
  332|      0|        u4_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag;
  333|       |
  334|      0|        ps_cur_mb_info = &ps_dec->ps_frm_mb_info[ps_dec->u4_cur_deblk_mb_num];
  335|       |
  336|      0|        ps_dec->u4_deblk_mb_x = ps_cur_mb_info->u2_mbx;
  337|      0|        ps_dec->u4_deblk_mb_y = ps_cur_mb_info->u2_mby;
  338|       |
  339|      0|        for(j = 0; j < i; j++)
  ------------------
  |  Branch (339:20): [True: 0, False: 0]
  ------------------
  340|      0|        {
  341|      0|            ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt, i4_cb_qp_idx_ofst, i4_cr_qp_idx_ofst,
  342|      0|                                       u4_wd_y, u4_wd_uv);
  343|      0|        }
  344|      0|    }
  345|       |
  346|       |    /*handle the last mb in picture case*/
  347|  4.47k|    if(ps_dec->cur_dec_mb_num > ps_dec->ps_cur_sps->u4_max_mb_addr)
  ------------------
  |  Branch (347:8): [True: 358, False: 4.11k]
  ------------------
  348|    358|        ps_dec->u4_cur_slice_decode_done = 1;
  349|       |
  350|  4.47k|    if(i != u4_num_mbs)
  ------------------
  |  Branch (350:8): [True: 81, False: 4.39k]
  ------------------
  351|     81|    {
  352|     81|        u4_end_of_row = 0;
  353|       |        /*Number of MB's left in row*/
  354|     81|        u4_num_mbs_next = u4_num_mbs_next + ((u4_num_mbs - i) >> u1_mbaff);
  355|     81|    }
  356|       |
  357|  4.47k|    ih264d_decode_tfr_nmb(ps_dec, (i), u4_num_mbs_next, u4_end_of_row);
  358|       |
  359|  4.47k|    return OK;
  ------------------
  |  |  114|  4.47k|#define OK        0
  ------------------
  360|  4.47k|}
isvcd_decode_slice_thread:
  381|    476|{
  382|    476|    UWORD32 u4_num_mbs_next, u4_num_mbsleft, u4_end_of_row = 0;
  383|    476|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  384|    476|    const UWORD32 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs;
  385|    476|    UWORD32 u4_mbaff, u4_num_mbs;
  386|       |
  387|    476|    UWORD16 u2_first_mb_in_slice;
  388|    476|    UWORD16 i16_mb_x, i16_mb_y;
  389|    476|    UWORD8 u1_field_pic;
  390|    476|    UWORD32 u4_frame_stride, x_offset, y_offset;
  391|    476|    WORD32 ret;
  392|    476|    tfr_ctxt_t *ps_trns_addr;
  393|       |
  394|       |    /*check for mb map of first mb in slice to ensure slice header is parsed*/
  395|  2.80k|    while(1)
  ------------------
  |  Branch (395:11): [True: 2.80k, Folded]
  ------------------
  396|  2.80k|    {
  397|  2.80k|        UWORD32 u4_mb_num = ps_dec->cur_dec_mb_num;
  398|  2.80k|        UWORD32 u4_cond = 0;
  399|  2.80k|        WORD32 nop_cnt = 8 * 128;
  400|  2.80k|        CHECK_MB_MAP_BYTE(u4_mb_num, ps_dec->pu1_dec_mb_map, u4_cond);
  ------------------
  |  |   80|  2.80k|#define CHECK_MB_MAP_BYTE(u4_mb_num, mb_map, u4_cond)                                               \
  |  |   81|  2.80k|{                                                                                                   \
  |  |   82|  2.80k|        volatile UWORD8 *pu1_mb_flag;                                                               \
  |  |   83|  2.80k|                                                                                                    \
  |  |   84|  2.80k|        pu1_mb_flag    = (UWORD8 *)mb_map + (u4_mb_num );                                           \
  |  |   85|  2.80k|                                                                                                    \
  |  |   86|  2.80k|        u4_cond = (*pu1_mb_flag);                                                                   \
  |  |   87|  2.80k|}
  ------------------
  401|  2.80k|        if(u4_cond)
  ------------------
  |  Branch (401:12): [True: 466, False: 2.33k]
  ------------------
  402|    466|        {
  403|    466|            break;
  404|    466|        }
  405|  2.33k|        else
  406|  2.33k|        {
  407|  2.33k|            if(nop_cnt > 0)
  ------------------
  |  Branch (407:16): [True: 2.33k, False: 0]
  ------------------
  408|  2.33k|            {
  409|  2.33k|                nop_cnt -= 128;
  410|  2.33k|                NOP(128);
  ------------------
  |  |   87|   301k|#define NOP(nop_cnt) {UWORD32 nop_i; for (nop_i = 0; nop_i < nop_cnt; nop_i++) asm("nop");}
  |  |  ------------------
  |  |  |  Branch (87:54): [True: 299k, False: 2.33k]
  |  |  ------------------
  ------------------
  411|  2.33k|            }
  412|      0|            else if(ps_dec->u4_output_present && (2 == ps_dec->u4_num_cores) &&
  ------------------
  |  Branch (412:21): [True: 0, False: 0]
  |  Branch (412:50): [True: 0, False: 0]
  ------------------
  413|      0|                    (ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht))
  ------------------
  |  Branch (413:21): [True: 0, False: 0]
  ------------------
  414|      0|            {
  415|      0|                ps_dec->u4_fmt_conv_num_rows =
  416|      0|                    MIN(FMT_CONV_NUM_ROWS,
  ------------------
  |  |   61|      0|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  417|      0|                        (ps_dec->s_disp_frame_info.u4_y_ht - ps_dec->u4_fmt_conv_cur_row));
  418|      0|                ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op), ps_dec->u4_fmt_conv_cur_row,
  419|      0|                                      ps_dec->u4_fmt_conv_num_rows);
  420|      0|                ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
  421|      0|            }
  422|      0|            else
  423|      0|            {
  424|      0|                nop_cnt = 8 * 128;
  425|      0|                ithread_yield();
  426|      0|            }
  427|  2.33k|            if(1 == ps_svc_lyr_dec->u1_error_in_cur_frame)
  ------------------
  |  Branch (427:16): [True: 10, False: 2.32k]
  ------------------
  428|     10|            {
  429|     10|                return NOT_OK;
  ------------------
  |  |  116|     10|#define NOT_OK    -1
  ------------------
  430|     10|            }
  431|  2.32k|            DEBUG_THREADS_PRINTF(
  432|  2.32k|                "waiting for mb mapcur_dec_mb_num = %d,ps_dec->u2_cur_mb_addr  = "
  433|  2.32k|                "%d\n",
  434|  2.32k|                u2_cur_dec_mb_num, ps_dec->u2_cur_mb_addr);
  435|  2.32k|        }
  436|  2.80k|    }
  437|       |
  438|    466|    u4_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag;
  439|    466|    u2_first_mb_in_slice = ps_dec->ps_decode_cur_slice->u4_first_mb_in_slice;
  440|    466|    i16_mb_x = MOD(u2_first_mb_in_slice, i2_pic_wdin_mbs);
  ------------------
  |  |   64|    466|#define MOD(x,y) ((x)%(y))
  ------------------
  441|    466|    i16_mb_y = DIV(u2_first_mb_in_slice, i2_pic_wdin_mbs);
  ------------------
  |  |   65|    466|#define DIV(x,y) ((x)/(y))
  ------------------
  442|    466|    i16_mb_y <<= u4_mbaff;
  443|    466|    ps_dec->i2_dec_thread_mb_y = i16_mb_y;
  444|    466|    ps_dec->cur_dec_mb_num = u2_first_mb_in_slice << u4_mbaff;
  445|       |
  446|    466|    if((ps_dec->u4_num_cores == 2) || !ps_dec->i1_recon_in_thread3_flag)
  ------------------
  |  Branch (446:8): [True: 466, False: 0]
  |  Branch (446:39): [True: 0, False: 0]
  ------------------
  447|    466|    {
  448|    466|        ps_dec->pv_proc_tu_coeff_data =
  449|    466|            (void *) ps_dec->ps_decode_cur_slice->pv_tu_coeff_data_start;
  450|    466|    }
  451|       |
  452|       |    // recalculate recon pointers
  453|    466|    u1_field_pic = ps_dec->ps_cur_slice->u1_field_pic_flag;
  454|    466|    u4_frame_stride = ps_dec->u2_frm_wd_y << u1_field_pic;
  455|    466|    x_offset = i16_mb_x << 4;
  456|    466|    y_offset = (i16_mb_y * u4_frame_stride) << 4;
  457|       |
  458|    466|    ps_trns_addr = &(ps_dec->s_tran_addrecon);
  459|       |
  460|    466|    ps_trns_addr->pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1 + x_offset + y_offset;
  461|       |
  462|    466|    u4_frame_stride = ps_dec->u2_frm_wd_uv << u1_field_pic;
  463|    466|    x_offset >>= 1;
  464|    466|    y_offset = (i16_mb_y * u4_frame_stride) << 3;
  465|    466|    x_offset *= YUV420SP_FACTOR;
  ------------------
  |  |  119|    466|#define YUV420SP_FACTOR 2
  ------------------
  466|       |
  467|    466|    ps_trns_addr->pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2 + x_offset + y_offset;
  468|    466|    ps_trns_addr->pu1_dest_v = ps_dec->s_cur_pic.pu1_buf3 + x_offset + y_offset;
  469|       |
  470|    466|    ps_trns_addr->pu1_mb_y = ps_trns_addr->pu1_dest_y;
  471|    466|    ps_trns_addr->pu1_mb_u = ps_trns_addr->pu1_dest_u;
  472|    466|    ps_trns_addr->pu1_mb_v = ps_trns_addr->pu1_dest_v;
  473|       |
  474|       |    /* Initialise MC and formMbPartInfo fn ptrs one time based on profile_idc */
  475|    466|    {
  476|    466|        ps_dec->p_mc_dec_thread = ih264d_motion_compensate_bp;
  477|    466|        ps_dec->p_form_mb_part_info_thread = ih264d_form_mb_part_info_bp;
  478|    466|    }
  479|    466|    {
  480|    466|        UWORD8 uc_nofield_nombaff;
  481|    466|        uc_nofield_nombaff = ((ps_dec->ps_cur_slice->u1_field_pic_flag == 0) &&
  ------------------
  |  Branch (481:31): [True: 466, False: 0]
  ------------------
  482|    466|                              (ps_dec->ps_cur_slice->u1_mbaff_frame_flag == 0) &&
  ------------------
  |  Branch (482:31): [True: 466, False: 0]
  ------------------
  483|    466|                              (ps_dec->ps_decode_cur_slice->slice_type != B_SLICE) &&
  ------------------
  |  |  369|    466|#define B_SLICE  1
  ------------------
  |  Branch (483:31): [True: 446, False: 20]
  ------------------
  484|    446|                              (ps_dec->ps_cur_pps->u1_wted_pred_flag == 0));
  ------------------
  |  Branch (484:31): [True: 87, False: 359]
  ------------------
  485|       |
  486|    466|        if(uc_nofield_nombaff == 0)
  ------------------
  |  Branch (486:12): [True: 379, False: 87]
  ------------------
  487|    379|        {
  488|    379|            ps_dec->p_mc_dec_thread = ih264d_motion_compensate_mp;
  489|    379|            ps_dec->p_form_mb_part_info_thread = ih264d_form_mb_part_info_mp;
  490|    379|        }
  491|    466|    }
  492|       |
  493|    466|    ps_dec->u4_cur_slice_decode_done = 0;
  494|       |
  495|  4.94k|    while(ps_dec->u4_cur_slice_decode_done != 1)
  ------------------
  |  Branch (495:11): [True: 4.50k, False: 439]
  ------------------
  496|  4.50k|    {
  497|  4.50k|        u4_num_mbsleft = ((i2_pic_wdin_mbs - i16_mb_x) << u4_mbaff);
  498|       |
  499|  4.50k|        if(u4_num_mbsleft <= ps_dec->u4_recon_mb_grp)
  ------------------
  |  Branch (499:12): [True: 4.50k, False: 0]
  ------------------
  500|  4.50k|        {
  501|  4.50k|            u4_num_mbs = u4_num_mbsleft;
  502|       |
  503|       |            /*Indicate number of mb's left in a row*/
  504|  4.50k|            u4_num_mbs_next = 0;
  505|  4.50k|            u4_end_of_row = 1;
  506|  4.50k|            i16_mb_x = 0;
  507|  4.50k|        }
  508|      0|        else
  509|      0|        {
  510|      0|            u4_num_mbs = ps_dec->u4_recon_mb_grp;
  511|       |
  512|       |            /*Indicate number of mb's left in a row*/
  513|      0|            u4_num_mbs_next = i2_pic_wdin_mbs - i16_mb_x - (ps_dec->u4_recon_mb_grp >> u4_mbaff);
  514|      0|            i16_mb_x += (u4_num_mbs >> u4_mbaff);
  515|      0|            u4_end_of_row = 0;
  516|      0|        }
  517|  4.50k|        if(ps_svc_lyr_dec->u1_layer_identifier == TARGET_LAYER)
  ------------------
  |  |  110|  4.50k|#define TARGET_LAYER 2
  ------------------
  |  Branch (517:12): [True: 4.50k, False: 0]
  ------------------
  518|  4.50k|        {
  519|  4.50k|            ret = isvcd_decode_recon_tfr_nmb_thread(ps_svc_lyr_dec, u4_num_mbs, u4_num_mbs_next,
  520|  4.50k|                                                    u4_end_of_row);
  521|  4.50k|        }
  522|  4.50k|        if(ret != OK) return ret;
  ------------------
  |  |  114|  4.50k|#define OK        0
  ------------------
  |  Branch (522:12): [True: 27, False: 4.47k]
  ------------------
  523|  4.50k|    }
  524|    439|    return OK;
  ------------------
  |  |  114|    439|#define OK        0
  ------------------
  525|    466|}
isvcd_decode_picture_thread:
  546|    395|{
  547|    395|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  548|    395|    WORD32 ret;
  549|    395|    ithread_set_name("isvcd_decode_picture_thread");
  550|    395|    while(1)
  ------------------
  |  Branch (550:11): [True: 395, Folded]
  ------------------
  551|    395|    {
  552|       |#ifdef KEEP_THREADS_ACTIVE
  553|       |        ret = ithread_mutex_lock(ps_dec->apv_proc_start_mutex[0]);
  554|       |        if(OK != ret) break;
  555|       |
  556|       |        while(ps_dec->ai4_process_start[0] != PROC_START)
  557|       |        {
  558|       |            ithread_cond_wait(ps_dec->apv_proc_start_condition[0], ps_dec->apv_proc_start_mutex[0]);
  559|       |        }
  560|       |        ps_dec->ai4_process_start[0] = PROC_IN_PROGRESS;
  561|       |
  562|       |        ret = ithread_mutex_unlock(ps_dec->apv_proc_start_mutex[0]);
  563|       |        if(OK != ret || ps_dec->i4_break_threads == 1) break;
  564|       |#endif
  565|    476|        while(1)
  ------------------
  |  Branch (565:15): [True: 476, Folded]
  ------------------
  566|    476|        {
  567|       |            /*Complete all writes before processing next slice*/
  568|       |
  569|    476|            DEBUG_THREADS_PRINTF(" Entering decode slice svc ext\n");
  570|       |
  571|    476|            ret = isvcd_decode_slice_thread(ps_svc_lyr_dec);
  572|    476|            if(OK != ret) break;
  ------------------
  |  |  114|    476|#define OK        0
  ------------------
  |  Branch (572:16): [True: 37, False: 439]
  ------------------
  573|    439|            DEBUG_THREADS_PRINTF(" Exit  isvcd_decode_slice_thread\n");
  574|       |
  575|    439|            if(ps_dec->cur_dec_mb_num > ps_dec->ps_cur_sps->u4_max_mb_addr)
  ------------------
  |  Branch (575:16): [True: 358, False: 81]
  ------------------
  576|    358|            {
  577|       |                /*Last slice in frame*/
  578|    358|                break;
  579|    358|            }
  580|     81|            else
  581|     81|            {
  582|     81|                ps_dec->ps_decode_cur_slice++;
  583|     81|                ps_dec->u2_cur_slice_num_dec_thread++;
  584|     81|            }
  585|    439|        }
  586|    395|        if(ps_dec->u4_output_present && (2 == ps_dec->u4_num_cores) &&
  ------------------
  |  Branch (586:12): [True: 334, False: 61]
  |  Branch (586:41): [True: 334, False: 0]
  ------------------
  587|    334|           (ps_dec->u4_fmt_conv_cur_row < ps_dec->s_disp_frame_info.u4_y_ht))
  ------------------
  |  Branch (587:12): [True: 121, False: 213]
  ------------------
  588|    121|        {
  589|    121|            ps_dec->u4_fmt_conv_num_rows =
  590|    121|                (ps_dec->s_disp_frame_info.u4_y_ht - ps_dec->u4_fmt_conv_cur_row);
  591|    121|            ih264d_format_convert(ps_dec, &(ps_dec->s_disp_op), ps_dec->u4_fmt_conv_cur_row,
  592|    121|                                  ps_dec->u4_fmt_conv_num_rows);
  593|    121|            ps_dec->u4_fmt_conv_cur_row += ps_dec->u4_fmt_conv_num_rows;
  594|    121|        }
  595|       |#ifdef KEEP_THREADS_ACTIVE
  596|       |        ret = ithread_mutex_lock(ps_dec->apv_proc_done_mutex[0]);
  597|       |        if(OK != ret) break;
  598|       |
  599|       |        ps_dec->ai4_process_done[0] = PROC_DONE;
  600|       |        ithread_cond_signal(ps_dec->apv_proc_done_condition[0]);
  601|       |
  602|       |        ret = ithread_mutex_unlock(ps_dec->apv_proc_done_mutex[0]);
  603|       |        if(OK != ret) break;
  604|       |#else
  605|    395|        break;
  606|    395|#endif
  607|    395|    }
  608|    395|}

isvcd_free_dynamic_bufs:
   84|  2.34k|{
   85|  2.34k|    WORD32 i;
   86|  2.34k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
   87|       |    /* Free any avc dynamic buffers that are allocated */
   88|  2.34k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_dec->pu1_bits_buf_dynamic);
  ------------------
  |  |   43|  2.34k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.34k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 0, False: 2.34k]
  |  |  ------------------
  ------------------
   89|  2.34k|    ih264d_free_dynamic_bufs(ps_dec);
   90|  2.34k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_svc_lyr_dec->pu1_crop_wnd_flag);
  ------------------
  |  |   43|  2.34k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.34k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.18k]
  |  |  ------------------
  ------------------
   91|  2.34k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_svc_lyr_dec->ps_inter_lyr_mb_prms_base);
  ------------------
  |  |   43|  2.34k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.34k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.18k]
  |  |  ------------------
  ------------------
   92|  2.34k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_svc_lyr_dec->ps_il_pred_mv_bank_buf_base);
  ------------------
  |  |   43|  2.34k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.34k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.18k]
  |  |  ------------------
  ------------------
   93|  2.34k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_svc_lyr_dec->pi2_il_residual_resample_luma_base);
  ------------------
  |  |   43|  2.34k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.34k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.18k]
  |  |  ------------------
  ------------------
   94|  2.34k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_svc_lyr_dec->pi2_il_residual_resample_chroma_base);
  ------------------
  |  |   43|  2.34k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.34k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.18k]
  |  |  ------------------
  ------------------
   95|  2.34k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_svc_lyr_dec->ps_svc_frm_mb_info);
  ------------------
  |  |   43|  2.34k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.34k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.18k]
  |  |  ------------------
  ------------------
   96|  2.34k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_svc_lyr_dec->pu2_frm_res_luma_csbp);
  ------------------
  |  |   43|  2.34k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.34k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.18k]
  |  |  ------------------
  ------------------
   97|  2.34k|    PS_DEC_ALIGNED_FREE(ps_dec, ps_svc_lyr_dec->pu1_svc_base_mode_flag);
  ------------------
  |  |   43|  2.34k|#define PS_DEC_ALIGNED_FREE(ps_dec, y) \
  |  |   44|  2.34k|if(y) {ps_dec->pf_aligned_free(ps_dec->pv_mem_ctxt, ((void *)y)); (y) = NULL;}
  |  |  ------------------
  |  |  |  Branch (44:4): [True: 160, False: 2.18k]
  |  |  ------------------
  ------------------
   98|       |
   99|  2.34k|    memset(ps_dec->ps_pic_buf_base, 0, sizeof(struct pic_buffer_t) * (H264_MAX_REF_PICS * 2));
  ------------------
  |  |  534|  2.34k|#define H264_MAX_REF_PICS         16
  ------------------
  100|   152k|    for(i = 0; i < MAX_DISP_BUFS_NEW; i++)
  ------------------
  |  |   76|   152k|#define MAX_DISP_BUFS_NEW 64
  ------------------
  |  Branch (100:16): [True: 150k, False: 2.34k]
  ------------------
  101|   150k|    {
  102|       |        ps_dec->apv_buf_id_pic_buf_map[i] = NULL;
  103|   150k|    }
  104|  2.34k|    return 0;
  105|  2.34k|}
isvcd_allocate_dynamic_bufs:
  123|    160|{
  124|    160|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  125|    160|    WORD16 i16_status = 0;
  126|    160|    UWORD8 uc_frmOrFld = (1 - ps_dec->ps_cur_sps->u1_frame_mbs_only_flag);
  127|    160|    dec_seq_params_t *ps_sps = ps_dec->ps_cur_sps;
  128|    160|    UWORD32 u4_total_mbs = ps_sps->u4_total_num_of_mbs << uc_frmOrFld;
  129|    160|    WORD32 size;
  130|    160|    void *pv_buf;
  131|    160|    void *pv_mem_ctxt = ps_dec->pv_mem_ctxt;
  132|    160|    size = u4_total_mbs;
  133|       |
  134|    160|    i16_status = ih264d_allocate_dynamic_bufs(ps_dec);
  135|       |
  136|    160|    if(i16_status != OK)
  ------------------
  |  |  114|    160|#define OK        0
  ------------------
  |  Branch (136:8): [True: 0, False: 160]
  ------------------
  137|      0|    {
  138|       |        /* Free any dynamic buffers that are allocated */
  139|      0|        ih264d_free_dynamic_bufs(ps_dec);
  140|      0|        ps_dec->i4_error_code = IVD_MEM_ALLOC_FAILED;
  141|      0|        return IVD_MEM_ALLOC_FAILED;
  142|      0|    }
  143|    160|    if(u4_total_mbs == 0)
  ------------------
  |  Branch (143:8): [True: 0, False: 160]
  ------------------
  144|      0|    {
  145|      0|        return IVD_MEM_ALLOC_FAILED;
  146|      0|    }
  147|       |
  148|       |    /* Allocate frame level mb info */
  149|    160|    size = sizeof(dec_svc_mb_info_t) * u4_total_mbs;
  150|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
  151|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
  152|    160|    ps_svc_lyr_dec->ps_svc_frm_mb_info = pv_buf;
  153|    160|    memset(ps_svc_lyr_dec->ps_svc_frm_mb_info, 0, size);
  154|       |
  155|       |    /* Allocate frame level residual luma csbp info */
  156|    160|    size = sizeof(UWORD16) * u4_total_mbs;
  157|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
  158|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
  159|    160|    ps_svc_lyr_dec->pu2_frm_res_luma_csbp = pv_buf;
  160|    160|    memset(ps_svc_lyr_dec->pu2_frm_res_luma_csbp, 0, size);
  161|    160|    ps_svc_lyr_dec->i4_frm_res_luma_csbp_stride = ps_dec->u2_frm_wd_in_mbs;
  162|       |
  163|       |    /* Allocate frame level residual luma csbp info */
  164|    160|    size = sizeof(UWORD8) * u4_total_mbs;
  165|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
  166|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
  167|    160|    ps_svc_lyr_dec->pu1_svc_base_mode_flag = pv_buf;
  168|    160|    memset(ps_svc_lyr_dec->pu1_svc_base_mode_flag, 0, size);
  169|    160|    ps_svc_lyr_dec->i4_frm_svc_base_mode_cabac_stride = ps_dec->u2_frm_wd_in_mbs;
  170|    160|    ps_svc_lyr_dec->i4_frm_svc_base_mode_cabac_size = u4_total_mbs;
  171|       |
  172|       |    /* Allocate frame level crop windows flags */
  173|    160|    size = sizeof(UWORD8) * u4_total_mbs;
  174|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
  175|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
  176|    160|    ps_svc_lyr_dec->pu1_crop_wnd_flag = pv_buf;
  177|    160|    memset(ps_svc_lyr_dec->pu1_crop_wnd_flag, 0, size);
  178|       |
  179|       |    /**********************************/
  180|       |    /*Creation of Inter layer buffers */
  181|       |    /**********************************/
  182|       |
  183|       |    /* MB type buffer : one element per MB */
  184|    160|    size = (ps_dec->u2_frm_wd_in_mbs + 2) * (ps_dec->u2_frm_ht_in_mbs + 2) *
  185|    160|           sizeof(inter_lyr_mb_prms_t);
  186|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
  187|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
  188|    160|    memset(pv_buf, -1, size);
  189|    160|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_base = pv_buf;
  190|    160|    ps_svc_lyr_dec->u2_inter_lyr_mb_prms_stride = ps_dec->u2_frm_wd_in_mbs + 2;
  191|    160|    ps_svc_lyr_dec->ps_inter_lyr_mb_prms_frm_start =
  192|    160|        ps_svc_lyr_dec->ps_inter_lyr_mb_prms_base + 1 + ps_svc_lyr_dec->u2_inter_lyr_mb_prms_stride;
  193|       |
  194|    160|    ps_svc_lyr_dec->u4_inter_lyr_mb_prms_size = (ps_dec->u2_frm_wd_in_mbs + 2) *
  195|    160|                                                (ps_dec->u2_frm_ht_in_mbs + 2) *
  196|    160|                                                sizeof(inter_lyr_mb_prms_t);
  197|       |
  198|       |    /* Luma Residual data at each layer : dafault 0*/
  199|    160|    size = ((ps_dec->u2_pic_wd + 4) * (ps_dec->u2_pic_ht + 4)) * sizeof(WORD16);
  200|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
  201|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
  202|    160|    memset(pv_buf, 0, size);
  203|    160|    ps_svc_lyr_dec->pi2_il_residual_resample_luma_base = pv_buf;
  204|    160|    ps_svc_lyr_dec->u2_residual_resample_luma_stride = (ps_dec->u2_pic_wd + 4);
  205|    160|    ps_svc_lyr_dec->pi2_il_residual_resample_mb_luma_frm_start =
  206|    160|        ps_svc_lyr_dec->pi2_il_residual_resample_luma_base + 2 +
  207|    160|        (2 * ps_svc_lyr_dec->u2_residual_resample_luma_stride);
  208|    160|    ps_svc_lyr_dec->u4_residual_resample_luma_size =
  209|    160|        ((ps_dec->u2_pic_wd + 4) * (ps_dec->u2_pic_ht + 4)) * sizeof(WORD16);
  210|       |
  211|       |    /* Chroma Residual data at each layer : dafault 0*/
  212|    160|    size = (((4 + ps_dec->u2_pic_wd) * ((4 + ps_dec->u2_pic_ht) >> 1)) * sizeof(WORD16));
  213|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
  214|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
  215|    160|    memset(pv_buf, 0, size);
  216|    160|    ps_svc_lyr_dec->pi2_il_residual_resample_chroma_base = pv_buf;
  217|    160|    ps_svc_lyr_dec->u2_residual_resample_chroma_stride = (ps_dec->u2_pic_wd + 4);
  218|    160|    ps_svc_lyr_dec->pi2_il_residual_resample_mb_chroma_frm_start =
  219|    160|        ps_svc_lyr_dec->pi2_il_residual_resample_chroma_base + 2 +
  220|    160|        ps_svc_lyr_dec->u2_residual_resample_chroma_stride;
  221|    160|    ps_svc_lyr_dec->u4_residual_resample_chroma_size =
  222|    160|        (((4 + ps_dec->u2_pic_wd) * ((4 + ps_dec->u2_pic_ht) >> 1)) * sizeof(WORD16));
  223|       |
  224|       |    /* mv bank buffer : 16 elements per MB: each at 4x4 block level */
  225|    160|    size = ((ps_dec->u2_pic_wd) * (ps_dec->u2_pic_ht >> 4)) * sizeof(mv_pred_t);
  226|    160|    pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);
  227|    160|    RETURN_IF((NULL == pv_buf), IV_FAIL);
  ------------------
  |  |   44|    160|#define RETURN_IF(cond, retval) if(cond) {return (retval);}
  |  |  ------------------
  |  |  |  Branch (44:36): [True: 0, False: 160]
  |  |  ------------------
  ------------------
  228|    160|    memset(pv_buf, 0, size);
  229|    160|    ps_svc_lyr_dec->ps_il_pred_mv_bank_buf_base = pv_buf;
  230|       |
  231|       |    /*syntax for SVC related bin ctxt tables*/
  232|    160|    {
  233|    160|        bin_ctxt_model_t *const p_cabac_ctxt_table_t = ps_dec->p_cabac_ctxt_table_t;
  234|       |
  235|    160|        ps_svc_lyr_dec->ps_base_mode_flag = p_cabac_ctxt_table_t + CABAC_BASE_MODE_FLAG;
  236|    160|        ps_svc_lyr_dec->ps_motion_prediction_flag_l0 = p_cabac_ctxt_table_t + CABAC_MOT_PRED_FLAG0;
  237|    160|        ps_svc_lyr_dec->ps_motion_prediction_flag_l1 = p_cabac_ctxt_table_t + CABAC_MOT_PRED_FLAG1;
  238|    160|        ps_svc_lyr_dec->ps_residual_prediction_flag = p_cabac_ctxt_table_t + CABAC_RES_PRED_FLAG;
  239|    160|    }
  240|    160|    return (i16_status);
  241|    160|}
isvcd_decode_pic_order_cnt:
  261|  4.28k|{
  262|  4.28k|    WORD64 i8_pic_msb;
  263|  4.28k|    WORD32 i4_top_field_order_cnt = 0, i4_bottom_field_order_cnt = 0;
  264|  4.28k|    dec_seq_params_t *ps_seq = ps_dec->ps_cur_sps;
  265|  4.28k|    WORD32 i4_prev_frame_num_ofst;
  266|       |
  267|  4.28k|    switch(ps_seq->u1_pic_order_cnt_type)
  268|  4.28k|    {
  269|  4.02k|        case 0:
  ------------------
  |  Branch (269:9): [True: 4.02k, False: 263]
  ------------------
  270|       |            /* POC TYPE 0 */
  271|  4.02k|            if(u1_is_idr_slice)
  ------------------
  |  Branch (271:16): [True: 3.52k, False: 499]
  ------------------
  272|  3.52k|            {
  273|  3.52k|                ps_prev_poc->i4_pic_order_cnt_msb = 0;
  274|  3.52k|                ps_prev_poc->i4_pic_order_cnt_lsb = 0;
  275|  3.52k|            }
  276|  4.02k|            if(ps_prev_poc->u1_mmco_equalto5)
  ------------------
  |  Branch (276:16): [True: 0, False: 4.02k]
  ------------------
  277|      0|            {
  278|      0|                if(ps_prev_poc->u1_bot_field != 1)
  ------------------
  |  Branch (278:20): [True: 0, False: 0]
  ------------------
  279|      0|                {
  280|      0|                    ps_prev_poc->i4_pic_order_cnt_msb = 0;
  281|      0|                    ps_prev_poc->i4_pic_order_cnt_lsb = ps_prev_poc->i4_top_field_order_count;
  282|      0|                }
  283|      0|                else
  284|      0|                {
  285|      0|                    ps_prev_poc->i4_pic_order_cnt_msb = 0;
  286|      0|                    ps_prev_poc->i4_pic_order_cnt_lsb = 0;
  287|      0|                }
  288|      0|            }
  289|       |
  290|  4.02k|            if((ps_cur_poc->i4_pic_order_cnt_lsb < ps_prev_poc->i4_pic_order_cnt_lsb) &&
  ------------------
  |  Branch (290:16): [True: 51, False: 3.97k]
  ------------------
  291|     51|               ((ps_prev_poc->i4_pic_order_cnt_lsb - ps_cur_poc->i4_pic_order_cnt_lsb) >=
  ------------------
  |  Branch (291:16): [True: 31, False: 20]
  ------------------
  292|     51|                (ps_seq->i4_max_pic_order_cntLsb >> 1)))
  293|     31|            {
  294|     31|                i8_pic_msb =
  295|     31|                    (WORD64) ps_prev_poc->i4_pic_order_cnt_msb + ps_seq->i4_max_pic_order_cntLsb;
  296|     31|            }
  297|  3.99k|            else if((ps_cur_poc->i4_pic_order_cnt_lsb > ps_prev_poc->i4_pic_order_cnt_lsb) &&
  ------------------
  |  Branch (297:21): [True: 3.75k, False: 242]
  ------------------
  298|  3.75k|                    ((ps_cur_poc->i4_pic_order_cnt_lsb - ps_prev_poc->i4_pic_order_cnt_lsb) >=
  ------------------
  |  Branch (298:21): [True: 1.85k, False: 1.89k]
  ------------------
  299|  3.75k|                     (ps_seq->i4_max_pic_order_cntLsb >> 1)))
  300|  1.85k|            {
  301|  1.85k|                i8_pic_msb =
  302|  1.85k|                    (WORD64) ps_prev_poc->i4_pic_order_cnt_msb - ps_seq->i4_max_pic_order_cntLsb;
  303|  1.85k|            }
  304|  2.13k|            else
  305|  2.13k|            {
  306|  2.13k|                i8_pic_msb = ps_prev_poc->i4_pic_order_cnt_msb;
  307|  2.13k|            }
  308|       |
  309|  4.02k|            if(!u1_field_pic_flag || !u1_bottom_field_flag)
  ------------------
  |  Branch (309:16): [True: 4.02k, False: 0]
  |  Branch (309:38): [True: 0, False: 0]
  ------------------
  310|  4.02k|            {
  311|  4.02k|                WORD64 i8_result = i8_pic_msb + ps_cur_poc->i4_pic_order_cnt_lsb;
  312|  4.02k|                if(IS_OUT_OF_RANGE_S32(i8_result))
  ------------------
  |  |   58|  4.02k|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 4.02k]
  |  |  |  Branch (58:54): [True: 0, False: 4.02k]
  |  |  ------------------
  ------------------
  313|      0|                {
  314|      0|                    return ERROR_INV_POC;
  315|      0|                }
  316|  4.02k|                i4_top_field_order_cnt = (WORD32) i8_result;
  317|  4.02k|            }
  318|       |
  319|  4.02k|            if(!u1_field_pic_flag)
  ------------------
  |  Branch (319:16): [True: 4.02k, False: 0]
  ------------------
  320|  4.02k|            {
  321|  4.02k|                WORD64 i8_result =
  322|  4.02k|                    (WORD64) i4_top_field_order_cnt + ps_cur_poc->i4_delta_pic_order_cnt_bottom;
  323|  4.02k|                if(IS_OUT_OF_RANGE_S32(i8_result))
  ------------------
  |  |   58|  4.02k|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 4.02k]
  |  |  |  Branch (58:54): [True: 0, False: 4.02k]
  |  |  ------------------
  ------------------
  324|      0|                {
  325|      0|                    return ERROR_INV_POC;
  326|      0|                }
  327|  4.02k|                i4_bottom_field_order_cnt = (WORD32) i8_result;
  328|  4.02k|            }
  329|      0|            else if(u1_bottom_field_flag)
  ------------------
  |  Branch (329:21): [True: 0, False: 0]
  ------------------
  330|      0|            {
  331|      0|                WORD64 i8_result = i8_pic_msb + ps_cur_poc->i4_pic_order_cnt_lsb;
  332|      0|                if(IS_OUT_OF_RANGE_S32(i8_result))
  ------------------
  |  |   58|      0|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 0]
  |  |  |  Branch (58:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  333|      0|                {
  334|      0|                    return ERROR_INV_POC;
  335|      0|                }
  336|      0|                i4_bottom_field_order_cnt = (WORD32) i8_result;
  337|      0|            }
  338|       |
  339|  4.02k|            if(IS_OUT_OF_RANGE_S32(i8_pic_msb))
  ------------------
  |  |   58|  4.02k|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 4.02k]
  |  |  |  Branch (58:54): [True: 0, False: 4.02k]
  |  |  ------------------
  ------------------
  340|      0|            {
  341|      0|                return ERROR_INV_POC;
  342|      0|            }
  343|  4.02k|            ps_cur_poc->i4_pic_order_cnt_msb = (WORD32) i8_pic_msb;
  344|  4.02k|            break;
  345|       |
  346|    242|        case 1:
  ------------------
  |  Branch (346:9): [True: 242, False: 4.04k]
  ------------------
  347|    242|        {
  348|       |            /* POC TYPE 1 */
  349|    242|            UWORD8 i;
  350|    242|            WORD32 prev_frame_num;
  351|    242|            WORD32 frame_num_ofst;
  352|    242|            WORD32 abs_frm_num;
  353|    242|            WORD32 poc_cycle_cnt, frame_num_in_poc_cycle;
  354|    242|            WORD64 i8_expected_delta_poc_cycle;
  355|    242|            WORD32 expected_poc;
  356|    242|            WORD64 i8_result;
  357|       |
  358|    242|            prev_frame_num = (WORD32) ps_cur_slice->u2_frame_num;
  359|    242|            if(!u1_is_idr_slice)
  ------------------
  |  Branch (359:16): [True: 66, False: 176]
  ------------------
  360|     66|            {
  361|     66|                if(ps_cur_slice->u1_mmco_equalto5)
  ------------------
  |  Branch (361:20): [True: 1, False: 65]
  ------------------
  362|      1|                {
  363|      1|                    prev_frame_num = 0;
  364|      1|                    i4_prev_frame_num_ofst = 0;
  365|      1|                }
  366|     65|                else
  367|     65|                {
  368|     65|                    i4_prev_frame_num_ofst = ps_prev_poc->i4_prev_frame_num_ofst;
  369|     65|                }
  370|     66|            }
  371|    176|            else
  372|    176|                i4_prev_frame_num_ofst = 0;
  373|       |
  374|       |            /* 1. Derivation for FrameNumOffset */
  375|    242|            if(u1_is_idr_slice)
  ------------------
  |  Branch (375:16): [True: 176, False: 66]
  ------------------
  376|    176|            {
  377|    176|                frame_num_ofst = 0;
  378|    176|                ps_cur_poc->i4_delta_pic_order_cnt[0] = 0;
  379|    176|                ps_cur_poc->i4_delta_pic_order_cnt[1] = 0;
  380|    176|            }
  381|     66|            else if(prev_frame_num > ((WORD32) u2_frame_num))
  ------------------
  |  Branch (381:21): [True: 25, False: 41]
  ------------------
  382|     25|            {
  383|     25|                WORD64 i8_result =
  384|     25|                    i4_prev_frame_num_ofst + (WORD64) ps_seq->u2_u4_max_pic_num_minus1 + 1;
  385|     25|                if(IS_OUT_OF_RANGE_S32(i8_result))
  ------------------
  |  |   58|     25|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 25]
  |  |  |  Branch (58:54): [True: 0, False: 25]
  |  |  ------------------
  ------------------
  386|      0|                {
  387|      0|                    return ERROR_INV_FRAME_NUM;
  388|      0|                }
  389|     25|                frame_num_ofst = (WORD32) i8_result;
  390|     25|            }
  391|     41|            else
  392|     41|                frame_num_ofst = i4_prev_frame_num_ofst;
  393|       |
  394|       |            /* 2. Derivation for absFrameNum */
  395|    242|            if(0 != ps_seq->u1_num_ref_frames_in_pic_order_cnt_cycle)
  ------------------
  |  Branch (395:16): [True: 126, False: 116]
  ------------------
  396|    126|            {
  397|    126|                WORD64 i8_result = frame_num_ofst + (WORD64) u2_frame_num;
  398|    126|                if(IS_OUT_OF_RANGE_S32(i8_result))
  ------------------
  |  |   58|    126|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 126]
  |  |  |  Branch (58:54): [True: 0, False: 126]
  |  |  ------------------
  ------------------
  399|      0|                {
  400|      0|                    return ERROR_INV_FRAME_NUM;
  401|      0|                }
  402|    126|                abs_frm_num = (WORD32) i8_result;
  403|    126|            }
  404|    116|            else
  405|    116|                abs_frm_num = 0;
  406|    242|            if((u1_nal_ref_idc == 0) && (abs_frm_num > 0)) abs_frm_num = abs_frm_num - 1;
  ------------------
  |  Branch (406:16): [True: 3, False: 239]
  |  Branch (406:41): [True: 3, False: 0]
  ------------------
  407|       |
  408|       |            /* 4. expectedDeltaPerPicOrderCntCycle is derived as */
  409|    242|            i8_expected_delta_poc_cycle = 0;
  410|  1.49k|            for(i = 0; i < ps_seq->u1_num_ref_frames_in_pic_order_cnt_cycle; i++)
  ------------------
  |  Branch (410:24): [True: 1.25k, False: 242]
  ------------------
  411|  1.25k|            {
  412|  1.25k|                i8_expected_delta_poc_cycle += ps_seq->i4_ofst_for_ref_frame[i];
  413|  1.25k|            }
  414|       |
  415|       |            /* 3. When absFrameNum > 0, picOrderCntCycleCnt and
  416|       |            frame_num_in_poc_cycle are derived as : */
  417|       |            /* 5. expectedPicOrderCnt is derived as : */
  418|    242|            if(abs_frm_num > 0)
  ------------------
  |  Branch (418:16): [True: 126, False: 116]
  ------------------
  419|    126|            {
  420|    126|                poc_cycle_cnt =
  421|    126|                    DIV((abs_frm_num - 1), ps_seq->u1_num_ref_frames_in_pic_order_cnt_cycle);
  ------------------
  |  |   65|    126|#define DIV(x,y) ((x)/(y))
  ------------------
  422|    126|                frame_num_in_poc_cycle =
  423|    126|                    MOD((abs_frm_num - 1), ps_seq->u1_num_ref_frames_in_pic_order_cnt_cycle);
  ------------------
  |  |   64|    126|#define MOD(x,y) ((x)%(y))
  ------------------
  424|       |
  425|    126|                i8_result = poc_cycle_cnt * i8_expected_delta_poc_cycle;
  426|       |
  427|    676|                for(i = 0; i <= frame_num_in_poc_cycle; i++)
  ------------------
  |  Branch (427:28): [True: 550, False: 126]
  ------------------
  428|    550|                {
  429|    550|                    i8_result = i8_result + ps_seq->i4_ofst_for_ref_frame[i];
  430|    550|                }
  431|       |
  432|    126|                if(IS_OUT_OF_RANGE_S32(i8_result)) return ERROR_INV_POC;
  ------------------
  |  |   58|    126|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 3, False: 123]
  |  |  |  Branch (58:54): [True: 0, False: 123]
  |  |  ------------------
  ------------------
  433|       |
  434|    123|                expected_poc = (WORD32) i8_result;
  435|    123|            }
  436|    116|            else
  437|    116|                expected_poc = 0;
  438|       |
  439|    239|            if(u1_nal_ref_idc == 0)
  ------------------
  |  Branch (439:16): [True: 3, False: 236]
  ------------------
  440|      3|            {
  441|      3|                i8_result = (WORD64) expected_poc + ps_seq->i4_ofst_for_non_ref_pic;
  442|       |
  443|      3|                if(IS_OUT_OF_RANGE_S32(i8_result)) return ERROR_INV_POC;
  ------------------
  |  |   58|      3|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 3]
  |  |  |  Branch (58:54): [True: 0, False: 3]
  |  |  ------------------
  ------------------
  444|       |
  445|      3|                expected_poc = (WORD32) i8_result;
  446|      3|            }
  447|       |
  448|       |            /* 6. TopFieldOrderCnt or BottomFieldOrderCnt are derived as */
  449|    239|            if(!u1_field_pic_flag)
  ------------------
  |  Branch (449:16): [True: 239, False: 0]
  ------------------
  450|    239|            {
  451|    239|                i8_result = (WORD64) expected_poc + ps_cur_poc->i4_delta_pic_order_cnt[0];
  452|       |
  453|    239|                if(IS_OUT_OF_RANGE_S32(i8_result)) return ERROR_INV_POC;
  ------------------
  |  |   58|    239|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 239]
  |  |  |  Branch (58:54): [True: 0, False: 239]
  |  |  ------------------
  ------------------
  454|    239|                i4_top_field_order_cnt = (WORD32) i8_result;
  455|       |
  456|    239|                i8_result = (WORD64) i4_top_field_order_cnt +
  457|    239|                            ps_seq->i4_ofst_for_top_to_bottom_field +
  458|    239|                            ps_cur_poc->i4_delta_pic_order_cnt[1];
  459|       |
  460|    239|                if(IS_OUT_OF_RANGE_S32(i8_result)) return ERROR_INV_POC;
  ------------------
  |  |   58|    239|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 239]
  |  |  |  Branch (58:54): [True: 8, False: 231]
  |  |  ------------------
  ------------------
  461|    231|                i4_bottom_field_order_cnt = (WORD32) i8_result;
  462|    231|            }
  463|      0|            else if(!u1_bottom_field_flag)
  ------------------
  |  Branch (463:21): [True: 0, False: 0]
  ------------------
  464|      0|            {
  465|      0|                i8_result = (WORD64) expected_poc + ps_cur_poc->i4_delta_pic_order_cnt[0];
  466|       |
  467|      0|                if(IS_OUT_OF_RANGE_S32(i8_result)) return ERROR_INV_POC;
  ------------------
  |  |   58|      0|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 0]
  |  |  |  Branch (58:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  468|      0|                i4_top_field_order_cnt = (WORD32) i8_result;
  469|      0|            }
  470|      0|            else
  471|      0|            {
  472|      0|                i8_result = (WORD64) expected_poc + ps_seq->i4_ofst_for_top_to_bottom_field +
  473|      0|                            ps_cur_poc->i4_delta_pic_order_cnt[0];
  474|       |
  475|      0|                if(IS_OUT_OF_RANGE_S32(i8_result)) return ERROR_INV_POC;
  ------------------
  |  |   58|      0|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 0]
  |  |  |  Branch (58:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  476|      0|                i4_bottom_field_order_cnt = (WORD32) i8_result;
  477|      0|            }
  478|       |            /* Copy the current POC info into Previous POC structure */
  479|    231|            ps_cur_poc->i4_prev_frame_num_ofst = frame_num_ofst;
  480|    231|        }
  481|       |
  482|      0|        break;
  483|     21|        case 2:
  ------------------
  |  Branch (483:9): [True: 21, False: 4.26k]
  ------------------
  484|     21|        {
  485|       |            /* POC TYPE 2 */
  486|     21|            WORD32 prev_frame_num;
  487|     21|            WORD32 frame_num_ofst;
  488|     21|            WORD32 tmp_poc;
  489|       |
  490|     21|            prev_frame_num = (WORD32) ps_cur_slice->u2_frame_num;
  491|     21|            if(!u1_is_idr_slice)
  ------------------
  |  Branch (491:16): [True: 0, False: 21]
  ------------------
  492|      0|            {
  493|      0|                if(ps_cur_slice->u1_mmco_equalto5)
  ------------------
  |  Branch (493:20): [True: 0, False: 0]
  ------------------
  494|      0|                {
  495|      0|                    prev_frame_num = 0;
  496|      0|                    i4_prev_frame_num_ofst = 0;
  497|      0|                }
  498|      0|                else
  499|      0|                    i4_prev_frame_num_ofst = ps_prev_poc->i4_prev_frame_num_ofst;
  500|      0|            }
  501|     21|            else
  502|     21|                i4_prev_frame_num_ofst = 0;
  503|       |
  504|       |            /* 1. Derivation for FrameNumOffset */
  505|     21|            if(u1_is_idr_slice)
  ------------------
  |  Branch (505:16): [True: 21, False: 0]
  ------------------
  506|     21|            {
  507|     21|                frame_num_ofst = 0;
  508|     21|                ps_cur_poc->i4_delta_pic_order_cnt[0] = 0;
  509|     21|                ps_cur_poc->i4_delta_pic_order_cnt[1] = 0;
  510|     21|            }
  511|      0|            else if(prev_frame_num > ((WORD32) u2_frame_num))
  ------------------
  |  Branch (511:21): [True: 0, False: 0]
  ------------------
  512|      0|            {
  513|      0|                WORD64 i8_result =
  514|      0|                    i4_prev_frame_num_ofst + (WORD64) ps_seq->u2_u4_max_pic_num_minus1 + 1;
  515|      0|                if(IS_OUT_OF_RANGE_S32(i8_result))
  ------------------
  |  |   58|      0|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 0]
  |  |  |  Branch (58:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  516|      0|                {
  517|      0|                    return ERROR_INV_FRAME_NUM;
  518|      0|                }
  519|      0|                frame_num_ofst = (WORD32) i8_result;
  520|      0|            }
  521|      0|            else
  522|      0|                frame_num_ofst = i4_prev_frame_num_ofst;
  523|       |
  524|       |            /* 2. Derivation for tempPicOrderCnt */
  525|     21|            if(u1_is_idr_slice)
  ------------------
  |  Branch (525:16): [True: 21, False: 0]
  ------------------
  526|     21|                tmp_poc = 0;
  527|      0|            else if(u1_nal_ref_idc == 0)
  ------------------
  |  Branch (527:21): [True: 0, False: 0]
  ------------------
  528|      0|            {
  529|      0|                WORD64 i8_result = ((frame_num_ofst + (WORD64) u2_frame_num) << 1) - 1;
  530|      0|                if(IS_OUT_OF_RANGE_S32(i8_result))
  ------------------
  |  |   58|      0|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 0]
  |  |  |  Branch (58:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  531|      0|                {
  532|      0|                    return ERROR_INV_POC;
  533|      0|                }
  534|      0|                tmp_poc = (WORD32) i8_result;
  535|      0|            }
  536|      0|            else
  537|      0|            {
  538|      0|                WORD64 i8_result = (frame_num_ofst + (WORD64) u2_frame_num) << 1;
  539|      0|                if(IS_OUT_OF_RANGE_S32(i8_result))
  ------------------
  |  |   58|      0|#define IS_OUT_OF_RANGE_S32(a) (((a) < INT32_MIN) || ((a) > INT32_MAX))
  |  |  ------------------
  |  |  |  Branch (58:33): [True: 0, False: 0]
  |  |  |  Branch (58:54): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  540|      0|                {
  541|      0|                    return ERROR_INV_POC;
  542|      0|                }
  543|      0|                tmp_poc = (WORD32) i8_result;
  544|      0|            }
  545|       |
  546|       |            /* 6. TopFieldOrderCnt or BottomFieldOrderCnt are derived as */
  547|     21|            if(!u1_field_pic_flag)
  ------------------
  |  Branch (547:16): [True: 21, False: 0]
  ------------------
  548|     21|            {
  549|     21|                i4_top_field_order_cnt = tmp_poc;
  550|     21|                i4_bottom_field_order_cnt = tmp_poc;
  551|     21|            }
  552|      0|            else if(!u1_bottom_field_flag)
  ------------------
  |  Branch (552:21): [True: 0, False: 0]
  ------------------
  553|      0|                i4_top_field_order_cnt = tmp_poc;
  554|      0|            else
  555|      0|                i4_bottom_field_order_cnt = tmp_poc;
  556|       |
  557|       |            /* Copy the current POC info into Previous POC structure */
  558|     21|            ps_prev_poc->i4_prev_frame_num_ofst = frame_num_ofst;
  559|     21|            ps_cur_poc->i4_prev_frame_num_ofst = frame_num_ofst;
  560|     21|        }
  561|      0|        break;
  562|      0|        default:
  ------------------
  |  Branch (562:9): [True: 0, False: 4.28k]
  ------------------
  563|      0|            return ERROR_INV_POC_TYPE_T;
  564|      0|            break;
  565|  4.28k|    }
  566|       |
  567|  4.27k|    if(!u1_field_pic_flag)  // or a complementary field pair
  ------------------
  |  Branch (567:8): [True: 4.27k, False: 0]
  ------------------
  568|  4.27k|    {
  569|  4.27k|        *pi4_poc = MIN(i4_top_field_order_cnt, i4_bottom_field_order_cnt);
  ------------------
  |  |   61|  4.27k|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 493, False: 3.78k]
  |  |  ------------------
  ------------------
  570|  4.27k|        ps_pps->i4_top_field_order_cnt = i4_top_field_order_cnt;
  571|  4.27k|        ps_pps->i4_bottom_field_order_cnt = i4_bottom_field_order_cnt;
  572|  4.27k|    }
  573|      0|    else if(!u1_bottom_field_flag)
  ------------------
  |  Branch (573:13): [True: 0, False: 0]
  ------------------
  574|      0|    {
  575|      0|        *pi4_poc = i4_top_field_order_cnt;
  576|      0|        ps_pps->i4_top_field_order_cnt = i4_top_field_order_cnt;
  577|      0|    }
  578|      0|    else
  579|      0|    {
  580|      0|        *pi4_poc = i4_bottom_field_order_cnt;
  581|      0|        ps_pps->i4_bottom_field_order_cnt = i4_bottom_field_order_cnt;
  582|      0|    }
  583|       |
  584|  4.27k|    ps_pps->i4_avg_poc = *pi4_poc;
  585|       |
  586|  4.27k|    return OK;
  ------------------
  |  |  114|  4.27k|#define OK        0
  ------------------
  587|  4.28k|}
isvcd_init_dpb_ref_bufs:
  762|  2.04k|{
  763|  2.04k|    UWORD8 i;
  764|  2.04k|    struct pic_buffer_t *ps_init_dpb;
  765|  2.04k|    ps_init_dpb = ps_dec->ps_dpb_mgr->ps_init_dpb[0][0];
  766|   133k|    for(i = 0; i < 2 * MAX_REF_BUFS; i++)
  ------------------
  |  |   75|   133k|#define MAX_REF_BUFS    32
  ------------------
  |  Branch (766:16): [True: 131k, False: 2.04k]
  ------------------
  767|   131k|    {
  768|   131k|        memset(ps_init_dpb, 0, sizeof(struct pic_buffer_t));
  769|   131k|        ps_init_dpb->pu1_buf1 = NULL;
  770|   131k|        ps_init_dpb->u1_long_term_frm_idx = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|   131k|#define MAX_REF_BUFS    32
  ------------------
  771|   131k|        ps_dec->ps_dpb_mgr->ps_init_dpb[0][i] = ps_init_dpb;
  772|   131k|        ps_dec->ps_dpb_mgr->ps_mod_dpb[0][i] = ps_init_dpb;
  773|   131k|        ps_init_dpb++;
  774|   131k|    }
  775|       |
  776|  2.04k|    ps_init_dpb = ps_dec->ps_dpb_mgr->ps_init_dpb[1][0];
  777|   133k|    for(i = 0; i < 2 * MAX_REF_BUFS; i++)
  ------------------
  |  |   75|   133k|#define MAX_REF_BUFS    32
  ------------------
  |  Branch (777:16): [True: 131k, False: 2.04k]
  ------------------
  778|   131k|    {
  779|   131k|        memset(ps_init_dpb, 0, sizeof(struct pic_buffer_t));
  780|   131k|        ps_init_dpb->pu1_buf1 = NULL;
  781|   131k|        ps_init_dpb->u1_long_term_frm_idx = MAX_REF_BUFS + 1;
  ------------------
  |  |   75|   131k|#define MAX_REF_BUFS    32
  ------------------
  782|   131k|        ps_dec->ps_dpb_mgr->ps_init_dpb[1][i] = ps_init_dpb;
  783|   131k|        ps_dec->ps_dpb_mgr->ps_mod_dpb[1][i] = ps_init_dpb;
  784|   131k|        ps_init_dpb++;
  785|   131k|    }
  786|  2.04k|}
isvcd_init_pic:
  805|  4.10k|{
  806|  4.10k|    dec_struct_t *ps_dec = &ps_svc_lyr_dec->s_dec;
  807|  4.10k|    dec_seq_params_t *ps_seq = ps_dec->ps_cur_sps;
  808|  4.10k|    prev_seq_params_t *ps_prev_seq_params = &ps_dec->s_prev_seq_params;
  809|  4.10k|    WORD32 ret;
  810|       |
  811|  4.10k|    ps_dec->ps_cur_slice->u2_frame_num = u2_frame_num;
  812|  4.10k|    ps_dec->ps_cur_slice->i4_poc = i4_poc;
  813|  4.10k|    ps_dec->ps_cur_pps = ps_pps;
  814|  4.10k|    ps_dec->ps_cur_pps->pv_codec_handle = ps_dec;
  815|       |
  816|  4.10k|    ps_dec->ps_dpb_mgr->i4_max_frm_num = ps_seq->u2_u4_max_pic_num_minus1 + 1;
  817|       |
  818|  4.10k|    ps_dec->ps_dpb_mgr->u2_pic_ht = ps_dec->u2_pic_ht;
  819|  4.10k|    ps_dec->ps_dpb_mgr->u2_pic_wd = ps_dec->u2_pic_wd;
  820|  4.10k|    ps_dec->i4_pic_type = NA_SLICE;
  ------------------
  |  |  367|  4.10k|#define NA_SLICE -1
  ------------------
  821|  4.10k|    ps_dec->i4_frametype = IV_NA_FRAME;
  822|  4.10k|    ps_dec->i4_content_type = IV_CONTENTTYPE_NA;
  823|       |
  824|       |    /*--------------------------------------------------------------------*/
  825|       |    /* Get the value of MaxMbAddress and frmheight in Mbs                 */
  826|       |    /*--------------------------------------------------------------------*/
  827|  4.10k|    ps_seq->u4_max_mb_addr =
  828|  4.10k|        ((UWORD32)ps_seq->u2_frm_wd_in_mbs *
  829|  4.10k|         ((UWORD32)ps_dec->u2_pic_ht >> (4 + ps_dec->ps_cur_slice->u1_field_pic_flag))) -
  830|  4.10k|        1;
  831|  4.10k|    ps_dec->u2_frm_ht_in_mbs = (ps_dec->u2_pic_ht >> (4 + ps_dec->ps_cur_slice->u1_field_pic_flag));
  832|       |
  833|       |    /***************************************************************************/
  834|       |    /* If change in Level or the required PicBuffers i4_size is more than the  */
  835|       |    /* current one FREE the current PicBuffers and allocate affresh            */
  836|       |    /***************************************************************************/
  837|  4.10k|    if(!ps_dec->u1_init_dec_flag)
  ------------------
  |  Branch (837:8): [True: 160, False: 3.94k]
  ------------------
  838|    160|    {
  839|    160|        ps_dec->u1_max_dec_frame_buffering = ih264d_get_dpb_size(ps_seq);
  840|       |
  841|    160|        ps_dec->i4_display_delay = ps_dec->u1_max_dec_frame_buffering;
  842|    160|        if((1 == ps_seq->u1_vui_parameters_present_flag) &&
  ------------------
  |  Branch (842:12): [True: 37, False: 123]
  ------------------
  843|     37|           (1 == ps_seq->s_vui.u1_bitstream_restriction_flag))
  ------------------
  |  Branch (843:12): [True: 1, False: 36]
  ------------------
  844|      1|        {
  845|      1|            if(ps_seq->u1_frame_mbs_only_flag == 1)
  ------------------
  |  Branch (845:16): [True: 1, False: 0]
  ------------------
  846|      1|                ps_dec->i4_display_delay = ps_seq->s_vui.u4_num_reorder_frames + 1;
  847|      0|            else
  848|      0|                ps_dec->i4_display_delay = ps_seq->s_vui.u4_num_reorder_frames * 2 + 2;
  849|      1|        }
  850|       |
  851|    160|        if(IVD_DECODE_FRAME_OUT == ps_dec->e_frm_out_mode) ps_dec->i4_display_delay = 0;
  ------------------
  |  Branch (851:12): [True: 0, False: 160]
  ------------------
  852|       |
  853|    160|        if(ps_dec->u4_share_disp_buf == 0)
  ------------------
  |  Branch (853:12): [True: 160, False: 0]
  ------------------
  854|    160|        {
  855|    160|            if(ps_seq->u1_frame_mbs_only_flag == 1)
  ------------------
  |  Branch (855:16): [True: 160, False: 0]
  ------------------
  856|    160|                ps_dec->u1_pic_bufs = ps_dec->i4_display_delay + ps_seq->u1_num_ref_frames + 1;
  857|      0|            else
  858|      0|                ps_dec->u1_pic_bufs = ps_dec->i4_display_delay + ps_seq->u1_num_ref_frames * 2 + 2;
  859|    160|        }
  860|      0|        else
  861|      0|        {
  862|      0|            ps_dec->u1_pic_bufs = (WORD32) ps_dec->u4_num_disp_bufs;
  863|      0|        }
  864|       |
  865|       |        /* Ensure at least two buffers are allocated */
  866|    160|        ps_dec->u1_pic_bufs = MAX(ps_dec->u1_pic_bufs, 2);
  ------------------
  |  |   60|    160|#define MAX(a,b) ((a > b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (60:19): [True: 160, False: 0]
  |  |  ------------------
  ------------------
  867|       |
  868|    160|        if(ps_dec->u4_share_disp_buf == 0)
  ------------------
  |  Branch (868:12): [True: 160, False: 0]
  ------------------
  869|    160|            ps_dec->u1_pic_bufs = MIN(ps_dec->u1_pic_bufs, (H264_MAX_REF_PICS * 2));
  ------------------
  |  |   61|    160|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 155, False: 5]
  |  |  ------------------
  ------------------
  870|       |
  871|    160|        ps_dec->u1_max_dec_frame_buffering =
  872|    160|            MIN(ps_dec->u1_max_dec_frame_buffering, ps_dec->u1_pic_bufs);
  ------------------
  |  |   61|    160|#define MIN(a,b) ((a < b)?(a):(b))
  |  |  ------------------
  |  |  |  Branch (61:19): [True: 159, False: 1]
  |  |  ------------------
  ------------------
  873|       |
  874|       |        /* Temporary hack to run Tractor Cav/Cab/MbAff Profiler streams  also for
  875|       |         * CAFI1_SVA_C.264 in conformance*/
  876|    160|        if(ps_dec->u1_init_dec_flag)
  ------------------
  |  Branch (876:12): [True: 0, False: 160]
  ------------------
  877|      0|        {
  878|      0|            ih264d_release_pics_in_dpb((void *) ps_dec, ps_dec->u1_pic_bufs);
  879|      0|            ih264d_release_display_bufs(ps_dec);
  880|      0|            ih264d_reset_ref_bufs(ps_dec->ps_dpb_mgr);
  881|      0|        }
  882|       |
  883|       |        /*********************************************************************/
  884|       |        /* Configuring decoder parameters based on level and then            */
  885|       |        /* fresh pointer initialisation in decoder scratch and state buffers */
  886|       |        /*********************************************************************/
  887|    160|        if(!ps_dec->u1_init_dec_flag || ((ps_seq->u1_level_idc < H264_LEVEL_3_0) ^
  ------------------
  |  |  298|      0|#define H264_LEVEL_3_0     30
  ------------------
  |  Branch (887:12): [True: 160, False: 0]
  |  Branch (887:41): [True: 0, False: 0]
  ------------------
  888|      0|                                         (ps_prev_seq_params->u1_level_idc < H264_LEVEL_3_0)))
  ------------------
  |  |  298|      0|#define H264_LEVEL_3_0     30
  ------------------
  889|    160|        {
  890|    160|            ret = ih264d_init_dec_mb_grp(ps_dec);
  891|    160|            if(ret != OK) return ret;
  ------------------
  |  |  114|    160|#define OK        0
  ------------------
  |  Branch (891:16): [True: 0, False: 160]
  ------------------
  892|    160|        }
  893|       |
  894|    160|        ret = isvcd_allocate_dynamic_bufs(ps_svc_lyr_dec);
  895|       |
  896|    160|        if(ret != OK)
  ------------------
  |  |  114|    160|#define OK        0
  ------------------
  |  Branch (896:12): [True: 0, False: 160]
  ------------------
  897|      0|        {
  898|       |            /* Free any dynamic buffers that are allocated */
  899|      0|            isvcd_free_dynamic_bufs(ps_svc_lyr_dec);
  900|      0|            ps_dec->i4_error_code = IVD_MEM_ALLOC_FAILED;
  901|      0|            return IVD_MEM_ALLOC_FAILED;
  902|      0|        }
  903|       |
  904|    160|        ih264d_init_ref_bufs((dpb_manager_t *)ps_dec->ps_dpb_mgr);
  905|    160|        isvcd_init_dpb_ref_bufs(ps_dec);
  906|       |
  907|    160|        ret = ih264d_create_pic_buffers(ps_dec->u1_pic_bufs, ps_dec);
  908|    160|        if(ret != OK) return ret;
  ------------------
  |  |  114|    160|#define OK        0
  ------------------
  |  Branch (908:12): [True: 0, False: 160]
  ------------------
  909|       |
  910|    160|        ret = ih264d_create_mv_bank(ps_dec, ps_dec->u2_pic_wd, ps_dec->u2_pic_ht);
  911|    160|        if(ret != OK) return ret;
  ------------------
  |  |  114|    160|#define OK        0
  ------------------
  |  Branch (911:12): [True: 0, False: 160]
  ------------------
  912|       |
  913|       |        /* In shared mode, set all of them as used by display */
  914|    160|        if(ps_dec->u4_share_disp_buf == 1)
  ------------------
  |  Branch (914:12): [True: 0, False: 160]
  ------------------
  915|      0|        {
  916|      0|            WORD32 i;
  917|       |
  918|      0|            for(i = 0; i < ps_dec->u1_pic_bufs; i++)
  ------------------
  |  Branch (918:24): [True: 0, False: 0]
  ------------------
  919|      0|            {
  920|      0|                ih264_buf_mgr_set_status((buf_mgr_t *) ps_dec->pv_pic_buf_mgr, i, BUF_MGR_IO);
  ------------------
  |  |   53|      0|#define BUF_MGR_IO           (1 << 3)
  ------------------
  921|      0|            }
  922|      0|        }
  923|       |
  924|    160|        ps_dec->u1_init_dec_flag = 1;
  925|    160|        ps_prev_seq_params->u2_frm_wd_in_mbs = ps_seq->u2_frm_wd_in_mbs;
  926|    160|        ps_prev_seq_params->u1_level_idc = ps_seq->u1_level_idc;
  927|    160|        ps_prev_seq_params->u1_profile_idc = ps_seq->u1_profile_idc;
  928|    160|        ps_prev_seq_params->u2_frm_ht_in_mbs = ps_seq->u2_frm_ht_in_mbs;
  929|    160|        ps_prev_seq_params->u1_frame_mbs_only_flag = ps_seq->u1_frame_mbs_only_flag;
  930|    160|        ps_prev_seq_params->u1_direct_8x8_inference_flag = ps_seq->u1_direct_8x8_inference_flag;
  931|       |
  932|    160|        ps_dec->i4_cur_display_seq = 0;
  933|    160|        ps_dec->i4_prev_max_display_seq = 0;
  934|    160|        ps_dec->i4_max_poc = 0;
  935|       |
  936|    160|        {
  937|       |            /* 0th entry of CtxtIncMbMap will be always be containing default values
  938|       |            for CABAC context representing MB not available */
  939|    160|            ctxt_inc_mb_info_t *p_DefCtxt = ps_dec->p_ctxt_inc_mb_map - 1;
  940|    160|            UWORD8 *pu1_temp;
  941|    160|            WORD8 i;
  942|    160|            p_DefCtxt->u1_mb_type = CAB_SKIP;
  ------------------
  |  |  402|    160|#define CAB_SKIP          0x10 /* 0001 0000 */
  ------------------
  943|       |
  944|    160|            p_DefCtxt->u1_cbp = 0x0f;
  945|    160|            p_DefCtxt->u1_intra_chroma_pred_mode = 0;
  946|       |
  947|    160|            p_DefCtxt->u1_yuv_dc_csbp = 0x7;
  948|       |
  949|    160|            p_DefCtxt->u1_transform8x8_ctxt = 0;
  950|       |
  951|    160|            pu1_temp = (UWORD8 *) p_DefCtxt->i1_ref_idx;
  952|    800|            for(i = 0; i < 4; i++, pu1_temp++) (*pu1_temp) = 0;
  ------------------
  |  Branch (952:24): [True: 640, False: 160]
  ------------------
  953|    160|            pu1_temp = (UWORD8 *) p_DefCtxt->u1_mv;
  954|  2.72k|            for(i = 0; i < 16; i++, pu1_temp++) (*pu1_temp) = 0;
  ------------------
  |  Branch (954:24): [True: 2.56k, False: 160]
  ------------------
  955|    160|            ps_dec->ps_def_ctxt_mb_info = p_DefCtxt;
  956|    160|        }
  957|    160|    }
  958|       |    /* reset DBP commands read u4_flag */
  959|  4.10k|    ps_dec->ps_dpb_cmds->u1_dpb_commands_read = 0;
  960|       |
  961|  4.10k|    return OK;
  ------------------
  |  |  114|  4.10k|#define OK        0
  ------------------
  962|  4.10k|}

isvcd_parse_vui_ext_parametres:
   68|    201|{
   69|    201|    UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
   70|    201|    UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
   71|    201|    WORD32 ret;
   72|    201|    UWORD32 u4_i;
   73|       |
   74|    201|    ps_svc_vui_ext->u4_vui_ext_num_entries_minus1 = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf);
   75|    201|    if(ps_svc_vui_ext->u4_vui_ext_num_entries_minus1 > 1023)
  ------------------
  |  Branch (75:8): [True: 3, False: 198]
  ------------------
   76|      3|    {
   77|      3|        return ERROR_INV_SPS_PPS_T;
   78|      3|    }
   79|       |
   80|    770|    for(u4_i = 0; u4_i <= ps_svc_vui_ext->u4_vui_ext_num_entries_minus1; u4_i++)
  ------------------
  |  Branch (80:19): [True: 579, False: 191]
  ------------------
   81|    579|    {
   82|    579|        ps_svc_vui_ext->u1_vui_ext_dependency_id[u4_i] = ih264d_get_bits_h264(ps_bitstrm, 3);
   83|    579|        ps_svc_vui_ext->u1_vui_ext_quality_id[u4_i] = ih264d_get_bits_h264(ps_bitstrm, 4);
   84|    579|        ps_svc_vui_ext->u1_vui_ext_temporal_id[u4_i] = ih264d_get_bits_h264(ps_bitstrm, 3);
   85|    579|        ps_svc_vui_ext->u1_vui_ext_timing_info_present_flag[u4_i] = ih264d_get_bit_h264(ps_bitstrm);
   86|       |
   87|    579|        if(1 == ps_svc_vui_ext->u1_vui_ext_timing_info_present_flag[u4_i])
  ------------------
  |  Branch (87:12): [True: 30, False: 549]
  ------------------
   88|     30|        {
   89|     30|            ps_svc_vui_ext->u4_vui_ext_num_units_in_tick[u4_i] =
   90|     30|                ih264d_get_bits_h264(ps_bitstrm, 32);
   91|     30|            ps_svc_vui_ext->u4_vui_ext_time_scale[u4_i] = ih264d_get_bits_h264(ps_bitstrm, 32);
   92|     30|            ps_svc_vui_ext->u1_vui_ext_fixed_frame_rate_flag[u4_i] =
   93|     30|                ih264d_get_bit_h264(ps_bitstrm);
   94|     30|        }
   95|       |
   96|    579|        ps_svc_vui_ext->u1_vui_ext_nal_hrd_params_present_flag[u4_i] =
   97|    579|            ih264d_get_bit_h264(ps_bitstrm);
   98|    579|        if(ps_svc_vui_ext->u1_vui_ext_nal_hrd_params_present_flag[u4_i])
  ------------------
  |  Branch (98:12): [True: 28, False: 551]
  ------------------
   99|     28|        {
  100|     28|            ret = ih264d_parse_hrd_parametres(&ps_svc_vui_ext->s_nal_hrd[u4_i], ps_bitstrm);
  101|     28|            if(ret != OK) return ret;
  ------------------
  |  |  114|     28|#define OK        0
  ------------------
  |  Branch (101:16): [True: 0, False: 28]
  ------------------
  102|     28|        }
  103|    579|        ps_svc_vui_ext->u1_vui_ext_vcl_hrd_params_present_flag[u4_i] =
  104|    579|            ih264d_get_bit_h264(ps_bitstrm);
  105|    579|        if(ps_svc_vui_ext->u1_vui_ext_vcl_hrd_params_present_flag[u4_i])
  ------------------
  |  Branch (105:12): [True: 34, False: 545]
  ------------------
  106|     34|        {
  107|     34|            ret = ih264d_parse_hrd_parametres(&ps_svc_vui_ext->s_vcl_hrd[u4_i], ps_bitstrm);
  108|     34|            if(ret != OK) return ret;
  ------------------
  |  |  114|     34|#define OK        0
  ------------------
  |  Branch (108:16): [True: 7, False: 27]
  ------------------
  109|     34|        }
  110|    572|        if(ps_svc_vui_ext->u1_vui_ext_nal_hrd_params_present_flag[u4_i] ||
  ------------------
  |  Branch (110:12): [True: 21, False: 551]
  ------------------
  111|    551|           ps_svc_vui_ext->u1_vui_ext_vcl_hrd_params_present_flag[u4_i])
  ------------------
  |  Branch (111:12): [True: 9, False: 542]
  ------------------
  112|     30|        {
  113|     30|            ps_svc_vui_ext->u1_vui_ext_low_delay_hrd_flag[u4_i] = ih264d_get_bit_h264(ps_bitstrm);
  114|     30|        }
  115|    572|        ps_svc_vui_ext->u1_vui_ext_pic_struct_present_flag[u4_i] = ih264d_get_bit_h264(ps_bitstrm);
  116|    572|    }
  117|    191|    return OK;
  ------------------
  |  |  114|    191|#define OK        0
  ------------------
  118|    198|}

ih264d_init_arch:
   85|  1.88k|{
   86|  1.88k|#ifdef DEFAULT_ARCH
   87|  1.88k|#if DEFAULT_ARCH == D_ARCH_X86_SSE42
   88|  1.88k|    ps_codec->e_processor_arch = ARCH_X86_SSE42;
   89|       |#elif DEFAULT_ARCH == D_ARCH_X86_SSSE3
   90|       |    ps_codec->e_processor_arch = ARCH_X86_SSSE3;
   91|       |#elif DEFAULT_ARCH == D_ARCH_X86_AVX2
   92|       |    ps_codec->e_processor_arch = ARCH_X86_AVX2;
   93|       |#else
   94|       |    ps_codec->e_processor_arch = ARCH_X86_GENERIC;
   95|       |#endif
   96|       |#else
   97|       |    ps_codec->e_processor_arch = ARCH_X86_SSE42;
   98|       |#endif
   99|       |
  100|  1.88k|}

ih264d_init_function_ptr_sse42:
   83|  2.13k|{
   84|  2.13k|    ps_codec->pf_default_weighted_pred_luma = ih264_default_weighted_pred_luma_sse42;
   85|  2.13k|    ps_codec->pf_default_weighted_pred_chroma = ih264_default_weighted_pred_chroma_sse42;
   86|  2.13k|    ps_codec->pf_weighted_pred_luma = ih264_weighted_pred_luma_sse42;
   87|  2.13k|    ps_codec->pf_weighted_pred_chroma = ih264_weighted_pred_chroma_sse42;
   88|  2.13k|    ps_codec->pf_weighted_bi_pred_luma = ih264_weighted_bi_pred_luma_sse42;
   89|  2.13k|    ps_codec->pf_weighted_bi_pred_chroma = ih264_weighted_bi_pred_chroma_sse42;
   90|       |
   91|  2.13k|    ps_codec->pf_iquant_itrans_recon_luma_4x4 = ih264_iquant_itrans_recon_4x4_sse42;
   92|  2.13k|    ps_codec->pf_iquant_itrans_recon_chroma_4x4 = ih264_iquant_itrans_recon_chroma_4x4_sse42;
   93|  2.13k|    ps_codec->pf_ihadamard_scaling_4x4 = ih264_ihadamard_scaling_4x4_sse42;
   94|  2.13k|    return;
   95|  2.13k|}

ih264d_init_function_ptr_ssse3:
   83|  2.19k|{
   84|       |
   85|       |
   86|       |
   87|       |    /* Init function pointers for intra pred leaf level functions luma
   88|       |     * Intra 16x16 */
   89|  2.19k|    ps_codec->apf_intra_pred_luma_16x16[0] = ih264_intra_pred_luma_16x16_mode_vert_ssse3;
   90|  2.19k|    ps_codec->apf_intra_pred_luma_16x16[1] = ih264_intra_pred_luma_16x16_mode_horz_ssse3;
   91|  2.19k|    ps_codec->apf_intra_pred_luma_16x16[2] = ih264_intra_pred_luma_16x16_mode_dc_ssse3;
   92|  2.19k|    ps_codec->apf_intra_pred_luma_16x16[3] = ih264_intra_pred_luma_16x16_mode_plane_ssse3;
   93|       |
   94|       |    /* Init function pointers for intra pred leaf level functions luma
   95|       |     * Intra 4x4 */
   96|  2.19k|    ps_codec->apf_intra_pred_luma_4x4[0] = ih264_intra_pred_luma_4x4_mode_vert_ssse3;
   97|  2.19k|    ps_codec->apf_intra_pred_luma_4x4[1] = ih264_intra_pred_luma_4x4_mode_horz_ssse3;
   98|  2.19k|    ps_codec->apf_intra_pred_luma_4x4[2] = ih264_intra_pred_luma_4x4_mode_dc_ssse3;
   99|  2.19k|    ps_codec->apf_intra_pred_luma_4x4[3] = ih264_intra_pred_luma_4x4_mode_diag_dl_ssse3;
  100|  2.19k|    ps_codec->apf_intra_pred_luma_4x4[4] = ih264_intra_pred_luma_4x4_mode_diag_dr_ssse3;
  101|  2.19k|    ps_codec->apf_intra_pred_luma_4x4[5] = ih264_intra_pred_luma_4x4_mode_vert_r_ssse3;
  102|  2.19k|    ps_codec->apf_intra_pred_luma_4x4[6] = ih264_intra_pred_luma_4x4_mode_horz_d_ssse3;
  103|  2.19k|    ps_codec->apf_intra_pred_luma_4x4[7] = ih264_intra_pred_luma_4x4_mode_vert_l_ssse3;
  104|  2.19k|    ps_codec->apf_intra_pred_luma_4x4[8] = ih264_intra_pred_luma_4x4_mode_horz_u_ssse3;
  105|       |
  106|       |    /* Init function pointers for intra pred leaf level functions luma
  107|       |     * Intra 8x8 */
  108|  2.19k|    ps_codec->apf_intra_pred_luma_8x8[0] = ih264_intra_pred_luma_8x8_mode_vert_ssse3;
  109|  2.19k|    ps_codec->apf_intra_pred_luma_8x8[1] = ih264_intra_pred_luma_8x8_mode_horz_ssse3;
  110|  2.19k|    ps_codec->apf_intra_pred_luma_8x8[2] = ih264_intra_pred_luma_8x8_mode_dc_ssse3;
  111|  2.19k|    ps_codec->apf_intra_pred_luma_8x8[3] = ih264_intra_pred_luma_8x8_mode_diag_dl_ssse3;
  112|  2.19k|    ps_codec->apf_intra_pred_luma_8x8[4] = ih264_intra_pred_luma_8x8_mode_diag_dr_ssse3;
  113|  2.19k|    ps_codec->apf_intra_pred_luma_8x8[5] = ih264_intra_pred_luma_8x8_mode_vert_r_ssse3;
  114|  2.19k|    ps_codec->apf_intra_pred_luma_8x8[6] = ih264_intra_pred_luma_8x8_mode_horz_d_ssse3;
  115|  2.19k|    ps_codec->apf_intra_pred_luma_8x8[7] = ih264_intra_pred_luma_8x8_mode_vert_l_ssse3;
  116|  2.19k|    ps_codec->apf_intra_pred_luma_8x8[8] = ih264_intra_pred_luma_8x8_mode_horz_u_ssse3;
  117|       |
  118|  2.19k|    ps_codec->pf_intra_pred_ref_filtering = ih264_intra_pred_luma_8x8_mode_ref_filtering;
  119|       |
  120|       |    /* Init function pointers for intra pred leaf level functions chroma
  121|       |     * Intra 8x8 */
  122|  2.19k|    ps_codec->apf_intra_pred_chroma[0] = ih264_intra_pred_chroma_8x8_mode_vert_ssse3;
  123|  2.19k|    ps_codec->apf_intra_pred_chroma[1] = ih264_intra_pred_chroma_8x8_mode_horz_ssse3;
  124|  2.19k|    ps_codec->apf_intra_pred_chroma[2] = ih264_intra_pred_chroma_8x8_mode_dc;
  125|  2.19k|    ps_codec->apf_intra_pred_chroma[3] = ih264_intra_pred_chroma_8x8_mode_plane_ssse3;
  126|       |
  127|       |
  128|  2.19k|    ps_codec->pf_pad_left_luma = ih264_pad_left_luma_ssse3;
  129|  2.19k|    ps_codec->pf_pad_left_chroma = ih264_pad_left_chroma_ssse3;
  130|  2.19k|    ps_codec->pf_pad_right_luma = ih264_pad_right_luma_ssse3;
  131|  2.19k|    ps_codec->pf_pad_right_chroma = ih264_pad_right_chroma_ssse3;
  132|       |
  133|       |
  134|  2.19k|    ps_codec->pf_iquant_itrans_recon_luma_4x4 = ih264_iquant_itrans_recon_4x4_ssse3;
  135|  2.19k|    ps_codec->pf_iquant_itrans_recon_luma_4x4_dc = ih264_iquant_itrans_recon_4x4_dc_ssse3;
  136|  2.19k|    ps_codec->pf_iquant_itrans_recon_luma_8x8 = ih264_iquant_itrans_recon_8x8_ssse3;
  137|  2.19k|    ps_codec->pf_iquant_itrans_recon_luma_8x8_dc = ih264_iquant_itrans_recon_8x8_dc_ssse3;
  138|       |
  139|  2.19k|    ps_codec->pf_iquant_itrans_recon_chroma_4x4_dc = ih264_iquant_itrans_recon_chroma_4x4_dc_ssse3;
  140|       |
  141|       |    /* Init fn ptr luma deblocking */
  142|  2.19k|    ps_codec->pf_deblk_luma_vert_bs4 = ih264_deblk_luma_vert_bs4_ssse3;
  143|  2.19k|    ps_codec->pf_deblk_luma_vert_bslt4 = ih264_deblk_luma_vert_bslt4_ssse3;
  144|  2.19k|    ps_codec->pf_deblk_luma_vert_bs4_mbaff = ih264_deblk_luma_vert_bs4_mbaff_ssse3;
  145|  2.19k|    ps_codec->pf_deblk_luma_vert_bslt4_mbaff = ih264_deblk_luma_vert_bslt4_mbaff_ssse3;
  146|       |
  147|  2.19k|    ps_codec->pf_deblk_luma_horz_bs4 = ih264_deblk_luma_horz_bs4_ssse3;
  148|  2.19k|    ps_codec->pf_deblk_luma_horz_bslt4 = ih264_deblk_luma_horz_bslt4_ssse3;
  149|       |
  150|       |    /* Init fn ptr chroma deblocking */
  151|  2.19k|    ps_codec->pf_deblk_chroma_vert_bs4 = ih264_deblk_chroma_vert_bs4_ssse3;
  152|  2.19k|    ps_codec->pf_deblk_chroma_horz_bs4 = ih264_deblk_chroma_horz_bs4_ssse3;
  153|  2.19k|    ps_codec->pf_deblk_chroma_vert_bs4_mbaff = ih264_deblk_chroma_vert_bs4_mbaff_ssse3;
  154|  2.19k|    ps_codec->pf_deblk_chroma_vert_bslt4 = ih264_deblk_chroma_vert_bslt4_ssse3;
  155|  2.19k|    ps_codec->pf_deblk_chroma_horz_bslt4 = ih264_deblk_chroma_horz_bslt4_ssse3;
  156|  2.19k|    ps_codec->pf_deblk_chroma_vert_bslt4_mbaff = ih264_deblk_chroma_vert_bslt4_mbaff_ssse3;
  157|       |
  158|       |    /* Inter pred leaf level functions */
  159|       |
  160|  2.19k|    ps_codec->apf_inter_pred_luma[0] = ih264_inter_pred_luma_copy_ssse3;
  161|  2.19k|    ps_codec->apf_inter_pred_luma[1] = ih264_inter_pred_luma_horz_qpel_ssse3;
  162|  2.19k|    ps_codec->apf_inter_pred_luma[2] = ih264_inter_pred_luma_horz_ssse3;
  163|  2.19k|    ps_codec->apf_inter_pred_luma[3] = ih264_inter_pred_luma_horz_qpel_ssse3;
  164|  2.19k|    ps_codec->apf_inter_pred_luma[4] = ih264_inter_pred_luma_vert_qpel_ssse3;
  165|  2.19k|    ps_codec->apf_inter_pred_luma[5] = ih264_inter_pred_luma_horz_qpel_vert_qpel_ssse3;
  166|  2.19k|    ps_codec->apf_inter_pred_luma[6] = ih264_inter_pred_luma_horz_hpel_vert_qpel_ssse3;
  167|  2.19k|    ps_codec->apf_inter_pred_luma[7] = ih264_inter_pred_luma_horz_qpel_vert_qpel_ssse3;
  168|  2.19k|    ps_codec->apf_inter_pred_luma[8] = ih264_inter_pred_luma_vert_ssse3;
  169|  2.19k|    ps_codec->apf_inter_pred_luma[9] = ih264_inter_pred_luma_horz_qpel_vert_hpel_ssse3;
  170|  2.19k|    ps_codec->apf_inter_pred_luma[10] = ih264_inter_pred_luma_horz_hpel_vert_hpel_ssse3;
  171|  2.19k|    ps_codec->apf_inter_pred_luma[11] = ih264_inter_pred_luma_horz_qpel_vert_hpel_ssse3;
  172|  2.19k|    ps_codec->apf_inter_pred_luma[12] = ih264_inter_pred_luma_vert_qpel_ssse3;
  173|  2.19k|    ps_codec->apf_inter_pred_luma[13] = ih264_inter_pred_luma_horz_qpel_vert_qpel_ssse3;
  174|  2.19k|    ps_codec->apf_inter_pred_luma[14] = ih264_inter_pred_luma_horz_hpel_vert_qpel_ssse3;
  175|  2.19k|    ps_codec->apf_inter_pred_luma[15] = ih264_inter_pred_luma_horz_qpel_vert_qpel_ssse3;
  176|       |
  177|  2.19k|    ps_codec->pf_inter_pred_chroma = ih264_inter_pred_chroma_ssse3;
  178|       |
  179|       |
  180|  2.19k|    return;
  181|  2.19k|}

isvcd_init_function_ptr:
   69|  2.34k|{
   70|  2.34k|    isvcd_init_function_ptr_generic(ps_svc_lyr_dec);
   71|  2.34k|    switch(ps_svc_lyr_dec->s_dec.e_processor_arch)
   72|  2.34k|    {
   73|    156|        case ARCH_X86_GENERIC:
  ------------------
  |  Branch (73:9): [True: 156, False: 2.19k]
  ------------------
   74|    156|            isvcd_init_function_ptr_generic(ps_svc_lyr_dec);
   75|    156|            break;
   76|     54|        case ARCH_X86_SSSE3:
  ------------------
  |  Branch (76:9): [True: 54, False: 2.29k]
  ------------------
   77|     54|            ih264d_init_function_ptr_ssse3(&ps_svc_lyr_dec->s_dec);
   78|     54|            break;
   79|  1.95k|        case ARCH_X86_SSE42:
  ------------------
  |  Branch (79:9): [True: 1.95k, False: 396]
  ------------------
   80|  2.13k|        default:
  ------------------
  |  Branch (80:9): [True: 186, False: 2.16k]
  ------------------
   81|  2.13k|            ih264d_init_function_ptr_ssse3(&ps_svc_lyr_dec->s_dec);
   82|  2.13k|            isvcd_init_function_ptr_sse42(ps_svc_lyr_dec);
   83|  2.13k|            break;
   84|  2.34k|    }
   85|  2.34k|}

isvcd_init_function_ptr_sse42:
   73|  2.13k|{
   74|  2.13k|    dec_struct_t *ps_codec = &ps_svc_lyr_dec->s_dec;
   75|  2.13k|    residual_sampling_ctxt_t *ps_resd_samp_ctx;
   76|  2.13k|    intra_sampling_ctxt_t *ps_intra_samp_ctxt;
   77|       |    /* call default init func prt sse42 */
   78|  2.13k|    ih264d_init_function_ptr_sse42(ps_codec);
   79|       |
   80|  2.13k|    ps_resd_samp_ctx = (residual_sampling_ctxt_t *) ps_svc_lyr_dec->pv_residual_sample_ctxt;
   81|  2.13k|    ps_intra_samp_ctxt = (intra_sampling_ctxt_t *) ps_svc_lyr_dec->pv_intra_sample_ctxt;
   82|       |
   83|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_4x4 =
   84|  2.13k|        isvcd_iquant_itrans_residual_recon_4x4_sse42;
   85|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_4x4_dc =
   86|  2.13k|        isvcd_iquant_itrans_residual_recon_4x4_dc_sse42;
   87|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_8x8 =
   88|  2.13k|        isvcd_iquant_itrans_residual_recon_8x8_sse42;
   89|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_8x8_dc =
   90|  2.13k|        isvcd_iquant_itrans_residual_recon_8x8_dc_sse42;
   91|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_chroma_4x4 =
   92|  2.13k|        isvcd_iquant_itrans_residual_recon_chroma_4x4_sse42;
   93|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_chroma_4x4_dc =
   94|  2.13k|        isvcd_iquant_itrans_residual_recon_chroma_4x4_dc_sse42;
   95|       |
   96|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_luma_4x4 = isvcd_iquant_itrans_residual_4x4_sse42;
   97|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_luma_4x4_dc =
   98|  2.13k|        isvcd_iquant_itrans_residual_4x4_dc_sse42;
   99|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_luma_8x8 = isvcd_iquant_itrans_residual_8x8_sse42;
  100|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_luma_8x8_dc =
  101|  2.13k|        isvcd_iquant_itrans_residual_8x8_dc_sse42;
  102|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_chroma_4x4 =
  103|  2.13k|        isvcd_iquant_itrans_residual_chroma_4x4_sse42;
  104|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_residual_chroma_4x4_dc =
  105|  2.13k|        isvcd_iquant_itrans_residual_chroma_4x4_dc_sse42;
  106|       |
  107|  2.13k|    ps_svc_lyr_dec->pf_pred_residual_recon_luma_4x4 = isvcd_pred_residual_recon_4x4_sse42;
  108|  2.13k|    ps_svc_lyr_dec->pf_pred_residual_recon_luma_8x8 = isvcd_pred_residual_recon_8x8_sse42;
  109|  2.13k|    ps_svc_lyr_dec->pf_pred_residual_recon_luma_16x16 = isvcd_pred_residual_recon_16x16_sse42;
  110|  2.13k|    ps_svc_lyr_dec->pf_pred_residual_recon_chroma_4x4 = isvcd_pred_residual_recon_chroma_4x4_sse42;
  111|  2.13k|    ps_svc_lyr_dec->pf_pred_residual_recon_chroma_8x8 = isvcd_pred_residual_recon_chroma_8x8_sse42;
  112|       |
  113|  2.13k|    ps_svc_lyr_dec->pf_residual_luma_4x4 = isvcd_residual_luma_4x4_sse42;
  114|  2.13k|    ps_svc_lyr_dec->pf_residual_luma_8x8 = isvcd_residual_luma_8x8_sse42;
  115|  2.13k|    ps_svc_lyr_dec->pf_residual_luma_16x16 = isvcd_residual_luma_16x16_sse42;
  116|  2.13k|    ps_svc_lyr_dec->pf_residual_chroma_cb_cr_8x8 = isvcd_residual_chroma_cb_cr_8x8_sse42;
  117|       |
  118|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_luma_4x4 = isvcd_iquant_itrans_4x4_sse42;
  119|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_luma_4x4_dc = isvcd_iquant_itrans_4x4_dc_sse42;
  120|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_luma_8x8 = isvcd_iquant_itrans_8x8_sse42;
  121|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_luma_8x8_dc = isvcd_iquant_itrans_8x8_dc_sse42;
  122|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_chroma_4x4 = isvcd_iquant_itrans_chroma_4x4_sse42;
  123|  2.13k|    ps_svc_lyr_dec->pf_iquant_itrans_chroma_4x4_dc = isvcd_iquant_itrans_chroma_4x4_dc_sse42;
  124|       |
  125|  2.13k|    ps_intra_samp_ctxt->pf_interpolate_base_luma_dyadic = isvcd_interpolate_base_luma_dyadic_sse42;
  126|  2.13k|    ps_intra_samp_ctxt->pf_interpolate_intra_base = isvcd_interpolate_intra_base_sse42;
  127|       |
  128|  2.13k|    ps_intra_samp_ctxt->pf_vert_chroma_interpol[0] = isvcd_vert_interpol_chroma_dyadic_1_sse42;
  129|  2.13k|    ps_intra_samp_ctxt->pf_vert_chroma_interpol[1] = isvcd_vert_interpol_chroma_dyadic_2_sse42;
  130|  2.13k|    ps_intra_samp_ctxt->pf_vert_chroma_interpol[2] = isvcd_vert_interpol_chroma_dyadic_3_sse42;
  131|       |
  132|  2.13k|    ps_intra_samp_ctxt->pf_horz_chroma_interpol[0] = isvcd_horz_interpol_chroma_dyadic_1_sse42;
  133|  2.13k|    ps_intra_samp_ctxt->pf_horz_chroma_interpol[1] = isvcd_horz_interpol_chroma_dyadic_2_sse42;
  134|       |
  135|  2.13k|    ps_resd_samp_ctx->pf_residual_luma_dyadic = isvcd_residual_luma_dyadic_sse42;
  136|  2.13k|    ps_resd_samp_ctx->pf_interpolate_residual = isvcd_interpolate_residual_sse42;
  137|  2.13k|    ps_resd_samp_ctx->pf_residual_reflayer_const_non_boundary_mb =
  138|  2.13k|        isvcd_residual_reflayer_const_non_boundary_mb_sse42;
  139|       |
  140|  2.13k|    return;
  141|  2.13k|}

isvcd_iquant_itrans_residual_recon_4x4_sse42:
   82|  5.25k|{
   83|  5.25k|    WORD32 i4_nnz = 0;
   84|  5.25k|    WORD32 row_0, row_1, row_2, row_3;
   85|  5.25k|    UWORD32 *pu4_out = (UWORD32 *) pu1_out;
   86|  5.25k|    __m128i src_r0_r1, src_r2_r3;
   87|  5.25k|    __m128i src_r0, src_r1, src_r2, src_r3;
   88|  5.25k|    __m128i scalemat_r0_r1, scalemat_r2_r3;
   89|  5.25k|    __m128i pred_r0, pred_r1, pred_r2, pred_r3;
   90|  5.25k|    __m128i rsd_r0, rsd_r1, rsd_r2, rsd_r3;
   91|  5.25k|    __m128i sign_reg, dequant_r0_r1, dequant_r2_r3;
   92|  5.25k|    __m128i zero_8x16b = _mm_setzero_si128();  // all bits reset to zero
   93|  5.25k|    __m128i temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
   94|  5.25k|    __m128i resq_r0, resq_r1, resq_r2, resq_r3;
   95|  5.25k|    __m128i add_rshift = _mm_set1_epi32((u4_qp_div_6 < 4) ? (1 << (3 - u4_qp_div_6)) : 0);
  ------------------
  |  Branch (95:41): [True: 2.49k, False: 2.76k]
  ------------------
   96|  5.25k|    __m128i value_32 = _mm_set1_epi32(32);
   97|  5.25k|    __m128i dupmax_8x16b = _mm_set1_epi16(RSD_MAX);
  ------------------
  |  |  772|  5.25k|#define RSD_MAX 255
  ------------------
   98|  5.25k|    __m128i dupmin_8x16b = _mm_set1_epi16(RSD_MIN);
  ------------------
  |  |  773|  5.25k|#define RSD_MIN -255
  ------------------
   99|       |
  100|  5.25k|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|  5.25k|#define UNUSED(x) ((void)(x))
  ------------------
  101|       |
  102|       |    /*************************************************************/
  103|       |    /* Dequantization of coefficients. Will be replaced by SIMD  */
  104|       |    /* operations on platform                                    */
  105|       |    /*************************************************************/
  106|       |    // a00 a01 a02 a03 a10 a11 a12 a13 -- the source matrix 0th,1st row
  107|  5.25k|    src_r0_r1 = _mm_loadu_si128((__m128i *) (pi2_src));
  108|       |    // a20 a21 a22 a23 a30 a31 a32 a33 --the source matrix 2nd,3rd row
  109|  5.25k|    src_r2_r3 = _mm_loadu_si128((__m128i *) (pi2_src + 8));
  110|       |    // b00 b01 b02 b03 b10 b11 b12 b13 -- the scaling matrix 0th,1st row
  111|  5.25k|    scalemat_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat));
  112|       |    // b20 b21 b22 b23 b30 b31 b32 b33 -- the scaling matrix 2nd,3rd row
  113|  5.25k|    scalemat_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat + 8));
  114|       |    // q00 q01 q02 q03 q10 q11 q12 q13 -- all 16 bits
  115|  5.25k|    dequant_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat));
  116|       |    // q20 q21 q22 q23 q30 q31 q32 q33 -- all 16 bits
  117|  5.25k|    dequant_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat + 8));
  118|       |    // b00*q00 b01*q01 b02*q02 b03*q03 b10*q10 b11*q11 b12*q12 b13*q13 -- 16 bit result
  119|  5.25k|    temp0 = _mm_mullo_epi16(scalemat_r0_r1, dequant_r0_r1);
  120|       |    // b00*q00 b01*q01 b02*q02 b03*q03 b10*q10 b11*q11 b12*q12 b13*q13 -- 16 bit result
  121|  5.25k|    temp1 = _mm_mullo_epi16(scalemat_r2_r3, dequant_r2_r3);
  122|       |    // b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long
  123|  5.25k|    temp4 = _mm_unpacklo_epi16(temp0, zero_8x16b);
  124|       |    // b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long
  125|  5.25k|    temp5 = _mm_unpackhi_epi16(temp0, zero_8x16b);
  126|       |    // b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long
  127|  5.25k|    temp6 = _mm_unpacklo_epi16(temp1, zero_8x16b);
  128|       |    // b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long
  129|  5.25k|    temp7 = _mm_unpackhi_epi16(temp1, zero_8x16b);
  130|  5.25k|    src_r0 = _mm_unpacklo_epi16(src_r0_r1, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  131|  5.25k|    src_r1 = _mm_unpackhi_epi16(src_r0_r1, zero_8x16b);  // a10 0 a11 0 a12 0 a13 0 -- 16 bit long
  132|  5.25k|    src_r2 = _mm_unpacklo_epi16(src_r2_r3, zero_8x16b);  // a20 0 a21 0 a22 0 a23 0 -- 16 bit long
  133|  5.25k|    src_r3 = _mm_unpackhi_epi16(src_r2_r3, zero_8x16b);  // a30 0 a31 0 a32 0 a33 0 -- 16 bit long
  134|       |    // a00*b00*q00 a10*b10*q10 a20*b20*q20 a30*b30 q30 -- 32 bits long
  135|  5.25k|    temp4 = _mm_madd_epi16(src_r0, temp4);
  136|  5.25k|    temp5 = _mm_madd_epi16(src_r1, temp5);
  137|  5.25k|    temp6 = _mm_madd_epi16(src_r2, temp6);
  138|  5.25k|    temp7 = _mm_madd_epi16(src_r3, temp7);
  139|       |
  140|  5.25k|    if(u4_qp_div_6 >= 4)
  ------------------
  |  Branch (140:8): [True: 2.76k, False: 2.49k]
  ------------------
  141|  2.76k|    {
  142|  2.76k|        resq_r0 = _mm_slli_epi32(temp4, u4_qp_div_6 - 4);
  143|  2.76k|        resq_r1 = _mm_slli_epi32(temp5, u4_qp_div_6 - 4);
  144|  2.76k|        resq_r2 = _mm_slli_epi32(temp6, u4_qp_div_6 - 4);
  145|  2.76k|        resq_r3 = _mm_slli_epi32(temp7, u4_qp_div_6 - 4);
  146|  2.76k|    }
  147|  2.49k|    else
  148|  2.49k|    {
  149|  2.49k|        temp4 = _mm_add_epi32(temp4, add_rshift);
  150|  2.49k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  151|  2.49k|        temp6 = _mm_add_epi32(temp6, add_rshift);
  152|  2.49k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  153|  2.49k|        resq_r0 = _mm_srai_epi32(temp4, 4 - u4_qp_div_6);
  154|  2.49k|        resq_r1 = _mm_srai_epi32(temp5, 4 - u4_qp_div_6);
  155|  2.49k|        resq_r2 = _mm_srai_epi32(temp6, 4 - u4_qp_div_6);
  156|  2.49k|        resq_r3 = _mm_srai_epi32(temp7, 4 - u4_qp_div_6);
  157|  2.49k|    }
  158|       |
  159|  5.25k|    if(iq_start_idx == 1) resq_r0 = _mm_insert_epi32(resq_r0, (WORD32) pi2_dc_ld_addr[0], 0);
  ------------------
  |  Branch (159:8): [True: 0, False: 5.25k]
  ------------------
  160|       |    /* Perform Inverse transform */
  161|       |    /*-------------------------------------------------------------*/
  162|       |    /* IDCT [ Horizontal transformation ]                          */
  163|       |    /*-------------------------------------------------------------*/
  164|       |    // Matrix transpose
  165|       |    /*
  166|       |     *  a0 a1 a2 a3
  167|       |     *  b0 b1 b2 b3
  168|       |     *  c0 c1 c2 c3
  169|       |     *  d0 d1 d2 d3
  170|       |     */
  171|  5.25k|    temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);  // a0 b0 a1 b1
  172|  5.25k|    temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);  // c0 d0 c1 d1
  173|  5.25k|    temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);  // a2 b2 a3 b3
  174|  5.25k|    temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);  // c2 d2 c3 d3
  175|  5.25k|    resq_r0 = _mm_unpacklo_epi64(temp1, temp3);    // a0 b0 c0 d0
  176|  5.25k|    resq_r1 = _mm_unpackhi_epi64(temp1, temp3);    // a1 b1 c1 d1
  177|  5.25k|    resq_r2 = _mm_unpacklo_epi64(temp2, temp4);    // a2 b2 c2 d2
  178|  5.25k|    resq_r3 = _mm_unpackhi_epi64(temp2, temp4);    // a3 b3 c3 d3
  179|       |    // Transform starts -- horizontal transform
  180|       |    /*------------------------------------------------------------------*/
  181|       |    /* z0 = w0 + w2                                             */
  182|  5.25k|    temp0 = _mm_add_epi32(resq_r0, resq_r2);
  183|       |    /* z1 = w0 - w2                                             */
  184|  5.25k|    temp1 = _mm_sub_epi32(resq_r0, resq_r2);
  185|       |    /* z2 = (w1 >> 1) - w3                                      */
  186|  5.25k|    temp2 = _mm_srai_epi32(resq_r1, 1);     //(w1>>1)
  187|  5.25k|    temp2 = _mm_sub_epi32(temp2, resq_r3);  //(w1>>1) - w3
  188|       |    /* z3 = w1 + (w3 >> 1)                                      */
  189|  5.25k|    temp3 = _mm_srai_epi32(resq_r3, 1);  //(w3>>1) + w1
  190|  5.25k|    temp3 = _mm_add_epi32(temp3, resq_r1);
  191|       |    /*----------------------------------------------------------*/
  192|       |    /* x0 = z0 + z3                                             */
  193|  5.25k|    resq_r0 = _mm_add_epi32(temp0, temp3);
  194|       |    /* x1 = z1 + z2                                             */
  195|  5.25k|    resq_r1 = _mm_add_epi32(temp1, temp2);
  196|       |    /* x2 = z1 - z2                                             */
  197|  5.25k|    resq_r2 = _mm_sub_epi32(temp1, temp2);
  198|       |    /* x3 = z0 - z3                                             */
  199|  5.25k|    resq_r3 = _mm_sub_epi32(temp0, temp3);
  200|       |    // Matrix transpose
  201|       |    /*
  202|       |     *  a0 b0 c0 d0
  203|       |     *  a1 b1 c1 d1
  204|       |     *  a2 b2 c2 d2
  205|       |     *  a3 b3 c3 d3
  206|       |     */
  207|  5.25k|    temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);  // a0 a1 b0 b1
  208|  5.25k|    temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);  // a2 a3 b2 b3
  209|  5.25k|    temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);  // c0 c1 d0 d1
  210|  5.25k|    temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);  // c2 c3 d2 d3
  211|  5.25k|    resq_r0 = _mm_unpacklo_epi64(temp1, temp3);    // a0 a1 a2 a3
  212|  5.25k|    resq_r1 = _mm_unpackhi_epi64(temp1, temp3);    // b0 b1 b2 b3
  213|  5.25k|    resq_r2 = _mm_unpacklo_epi64(temp2, temp4);    // c0 c1 c2 c3
  214|  5.25k|    resq_r3 = _mm_unpackhi_epi64(temp2, temp4);    // d0 d1 d2 d3
  215|       |    // Transform ends -- horizontal transform
  216|       |
  217|       |    // Load pred buffer
  218|       |    // p00 p01 p02 p03 0 0 0 0 0 0 0 0 -- all 8 bits
  219|  5.25k|    pred_r0 = _mm_loadl_epi64((__m128i *) (&pu1_pred[0]));
  220|       |    // p10 p11 p12 p13 0 0 0 0 0 0 0 0 -- all 8 bits
  221|  5.25k|    pred_r1 = _mm_loadl_epi64((__m128i *) (&pu1_pred[pred_strd]));
  222|       |    // p20 p21 p22 p23 0 0 0 0 0 0 0 0 -- all 8 bits
  223|  5.25k|    pred_r2 = _mm_loadl_epi64((__m128i *) (&pu1_pred[2 * pred_strd]));
  224|       |    // p30 p31 p32 p33 0 0 0 0 0 0 0 0 -- all 8 bits
  225|  5.25k|    pred_r3 = _mm_loadl_epi64((__m128i *) (&pu1_pred[3 * pred_strd]));
  226|       |
  227|  5.25k|    pred_r0 = _mm_cvtepu8_epi32(pred_r0);  // p00 p01 p02 p03 -- all 32 bits
  228|  5.25k|    pred_r1 = _mm_cvtepu8_epi32(pred_r1);  // p10 p11 p12 p13 -- all 32 bits
  229|  5.25k|    pred_r2 = _mm_cvtepu8_epi32(pred_r2);  // p20 p21 p22 p23 -- all 32 bits
  230|  5.25k|    pred_r3 = _mm_cvtepu8_epi32(pred_r3);  // p30 p31 p32 p33 -- all 32 bits
  231|       |
  232|       |    // Load resd buffer
  233|  5.25k|    rsd_r0 = _mm_loadl_epi64((__m128i *) (&pi2_rsd[0]));
  234|  5.25k|    rsd_r1 = _mm_loadl_epi64((__m128i *) (&pi2_rsd[rsd_strd]));
  235|  5.25k|    rsd_r2 = _mm_loadl_epi64((__m128i *) (&pi2_rsd[2 * rsd_strd]));
  236|  5.25k|    rsd_r3 = _mm_loadl_epi64((__m128i *) (&pi2_rsd[3 * rsd_strd]));
  237|       |
  238|  5.25k|    rsd_r0 = _mm_cvtepi16_epi32(rsd_r0);
  239|  5.25k|    rsd_r1 = _mm_cvtepi16_epi32(rsd_r1);
  240|  5.25k|    rsd_r2 = _mm_cvtepi16_epi32(rsd_r2);
  241|  5.25k|    rsd_r3 = _mm_cvtepi16_epi32(rsd_r3);
  242|       |
  243|       |    /*--------------------------------------------------------------*/
  244|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6      */
  245|       |    /*                                                              */
  246|       |    /* Add the prediction and store it back to same buffer          */
  247|       |    /*--------------------------------------------------------------*/
  248|       |    /* z0j = y0j + y2j                                                        */
  249|  5.25k|    temp0 = _mm_add_epi32(resq_r0, resq_r2);
  250|       |    /* z1j = y0j - y2j                                                        */
  251|  5.25k|    temp1 = _mm_sub_epi32(resq_r0, resq_r2);
  252|       |    /* z2j = (y1j>>1) - y3j */
  253|  5.25k|    temp2 = _mm_srai_epi32(resq_r1, 1);  //(y1j>>1)
  254|  5.25k|    temp2 = _mm_sub_epi32(temp2, resq_r3);
  255|       |    /* z3j = y1j + (y3j>>1) */
  256|  5.25k|    temp3 = _mm_srai_epi32(resq_r3, 1);  //(y3j>>1)
  257|  5.25k|    temp3 = _mm_add_epi32(temp3, resq_r1);
  258|       |
  259|       |    /* x0j = z0j + z3j                                                        */
  260|  5.25k|    temp4 = _mm_add_epi32(temp0, temp3);
  261|  5.25k|    temp4 = _mm_add_epi32(temp4, value_32);
  262|  5.25k|    temp4 = _mm_srai_epi32(temp4, 6);
  263|       |
  264|  5.25k|    row_0 = _mm_test_all_ones(_mm_cmpeq_epi32(temp4, zero_8x16b));  // return 1 if all zeros, else 0
  265|  5.25k|    temp4 = _mm_add_epi32(temp4, rsd_r0);
  266|  5.25k|    temp4 = _mm_min_epi16(dupmax_8x16b, temp4);
  267|  5.25k|    temp4 = _mm_max_epi16(dupmin_8x16b, temp4);
  268|  5.25k|    temp4 = _mm_add_epi32(temp4, pred_r0);
  269|       |    /* x1j = z1j + z2j                                                        */
  270|  5.25k|    temp5 = _mm_add_epi32(temp1, temp2);
  271|  5.25k|    temp5 = _mm_add_epi32(temp5, value_32);
  272|  5.25k|    temp5 = _mm_srai_epi32(temp5, 6);
  273|       |
  274|  5.25k|    row_1 = _mm_test_all_ones(_mm_cmpeq_epi32(temp5, zero_8x16b));  // return 1 if all zeros, else 0
  275|  5.25k|    temp5 = _mm_add_epi32(temp5, rsd_r1);
  276|  5.25k|    temp5 = _mm_min_epi16(dupmax_8x16b, temp5);
  277|  5.25k|    temp5 = _mm_max_epi16(dupmin_8x16b, temp5);
  278|  5.25k|    temp5 = _mm_add_epi32(temp5, pred_r1);
  279|       |    /* x2j = z1j - z2j                                                        */
  280|  5.25k|    temp6 = _mm_sub_epi32(temp1, temp2);
  281|  5.25k|    temp6 = _mm_add_epi32(temp6, value_32);
  282|  5.25k|    temp6 = _mm_srai_epi32(temp6, 6);
  283|       |
  284|  5.25k|    row_2 = _mm_test_all_ones(_mm_cmpeq_epi32(temp6, zero_8x16b));  // return 1 if all zeros, else 0
  285|  5.25k|    temp6 = _mm_add_epi32(temp6, rsd_r2);
  286|  5.25k|    temp6 = _mm_min_epi16(dupmax_8x16b, temp6);
  287|  5.25k|    temp6 = _mm_max_epi16(dupmin_8x16b, temp6);
  288|  5.25k|    temp6 = _mm_add_epi32(temp6, pred_r2);
  289|       |    /* x3j = z0j - z3j                                                        */
  290|  5.25k|    temp7 = _mm_sub_epi32(temp0, temp3);
  291|  5.25k|    temp7 = _mm_add_epi32(temp7, value_32);
  292|  5.25k|    temp7 = _mm_srai_epi32(temp7, 6);
  293|       |
  294|  5.25k|    row_3 = _mm_test_all_ones(_mm_cmpeq_epi32(temp7, zero_8x16b));  // return 1 if all zeros, else 0
  295|  5.25k|    temp7 = _mm_add_epi32(temp7, rsd_r3);
  296|  5.25k|    temp7 = _mm_min_epi16(dupmax_8x16b, temp7);
  297|  5.25k|    temp7 = _mm_max_epi16(dupmin_8x16b, temp7);
  298|  5.25k|    temp7 = _mm_add_epi32(temp7, pred_r3);
  299|       |
  300|       |    // 32-bit to 16-bit conversion
  301|  5.25k|    temp0 = _mm_packs_epi32(temp4, temp5);
  302|  5.25k|    temp1 = _mm_packs_epi32(temp6, temp7);
  303|       |    /*------------------------------------------------------------------*/
  304|       |    // Clipping the results to 8 bits
  305|  5.25k|    sign_reg = _mm_cmpgt_epi16(temp0, zero_8x16b);  // sign check
  306|  5.25k|    temp0 = _mm_and_si128(temp0, sign_reg);
  307|  5.25k|    sign_reg = _mm_cmpgt_epi16(temp1, zero_8x16b);
  308|  5.25k|    temp1 = _mm_and_si128(temp1, sign_reg);
  309|       |
  310|  5.25k|    resq_r0 = _mm_packus_epi16(temp0, temp1);
  311|  5.25k|    resq_r1 = _mm_srli_si128(resq_r0, 4);
  312|  5.25k|    resq_r2 = _mm_srli_si128(resq_r1, 4);
  313|  5.25k|    resq_r3 = _mm_srli_si128(resq_r2, 4);
  314|       |
  315|  5.25k|    *pu4_out = _mm_cvtsi128_si32(resq_r0);
  316|  5.25k|    pu1_out += out_strd;
  317|  5.25k|    pu4_out = (UWORD32 *) (pu1_out);
  318|  5.25k|    *(pu4_out) = _mm_cvtsi128_si32(resq_r1);
  319|  5.25k|    pu1_out += out_strd;
  320|  5.25k|    pu4_out = (UWORD32 *) (pu1_out);
  321|  5.25k|    *(pu4_out) = _mm_cvtsi128_si32(resq_r2);
  322|  5.25k|    pu1_out += out_strd;
  323|  5.25k|    pu4_out = (UWORD32 *) (pu1_out);
  324|  5.25k|    *(pu4_out) = _mm_cvtsi128_si32(resq_r3);
  325|       |
  326|  5.25k|    i4_nnz = !(row_0 && row_1 && row_2 && row_3);
  ------------------
  |  Branch (326:16): [True: 452, False: 4.80k]
  |  Branch (326:25): [True: 207, False: 245]
  |  Branch (326:34): [True: 159, False: 48]
  |  Branch (326:43): [True: 124, False: 35]
  ------------------
  327|  5.25k|    return i4_nnz;
  328|  5.25k|}
isvcd_iquant_itrans_residual_recon_8x8_sse42:
  357|  40.9k|{
  358|  40.9k|    __m128i rsd_r01_b0, rsd_r23_b0, rsd_r45_b2, rsd_r67_b2;
  359|  40.9k|    __m128i rsd_r01_b1, rsd_r23_b1, rsd_r45_b3, rsd_r67_b3;
  360|       |
  361|  40.9k|    WORD32 row_01_b0, row_23_b0, row_45_b2, row_67_b2;
  362|  40.9k|    WORD32 row_01_b1, row_23_b1, row_45_b3, row_67_b3;
  363|  40.9k|    WORD32 i4_nnz, i4_nnz_b0, i4_nnz_b1, i4_nnz_b2, i4_nnz_b3;
  364|  40.9k|    __m128i src_r0;
  365|  40.9k|    __m128i scalemat_r0;
  366|  40.9k|    __m128i zero_8x16b = _mm_setzero_si128();  // all bits reset to zero
  367|  40.9k|    __m128i value_32 = _mm_set1_epi32(32);
  368|  40.9k|    __m128i add_rshift = _mm_set1_epi32((qp_div < 6) ? (1 << (5 - qp_div)) : 0);
  ------------------
  |  Branch (368:41): [True: 29.0k, False: 11.9k]
  ------------------
  369|  40.9k|    __m128i dequant_r0;
  370|  40.9k|    __m128i predload_r;
  371|  40.9k|    __m128i pred_r0_1, pred_r1_1, pred_r2_1, pred_r3_1, pred_r4_1, pred_r5_1, pred_r6_1, pred_r7_1;
  372|       |
  373|  40.9k|    __m128i rsd_r0, rsd_r1, rsd_r2, rsd_r3, rsd_r4, rsd_r5, rsd_r6, rsd_r7;
  374|  40.9k|    __m128i sign_reg;
  375|  40.9k|    __m128i src_r0_1, src_r0_2;
  376|  40.9k|    __m128i scalemat_r0_1, scalemat_r0_2;
  377|  40.9k|    __m128i temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8;
  378|  40.9k|    __m128i temp10, temp11, temp12, temp13, temp14, temp15, temp16, temp17, temp18, temp19, temp20;
  379|       |    // To store dequantization results
  380|  40.9k|    __m128i resq_r0_1, resq_r0_2, resq_r1_1, resq_r1_2, resq_r2_1, resq_r2_2, resq_r3_1, resq_r3_2,
  381|  40.9k|        resq_r4_1, resq_r4_2, resq_r5_1, resq_r5_2, resq_r6_1, resq_r6_2, resq_r7_1, resq_r7_2;
  382|  40.9k|    __m128i dupmax_8x16b = _mm_set1_epi16(RSD_MAX);
  ------------------
  |  |  772|  40.9k|#define RSD_MAX 255
  ------------------
  383|  40.9k|    __m128i dupmin_8x16b = _mm_set1_epi16(RSD_MIN);
  ------------------
  |  |  773|  40.9k|#define RSD_MIN -255
  ------------------
  384|       |
  385|  40.9k|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|  40.9k|#define UNUSED(x) ((void)(x))
  ------------------
  386|  40.9k|    UNUSED(iq_start_idx);
  ------------------
  |  |   45|  40.9k|#define UNUSED(x) ((void)(x))
  ------------------
  387|  40.9k|    UNUSED(pi2_dc_ld_addr);
  ------------------
  |  |   45|  40.9k|#define UNUSED(x) ((void)(x))
  ------------------
  388|       |
  389|       |    /*************************************************************/
  390|       |    /* Dequantization of coefficients. Will be replaced by SIMD  */
  391|       |    /* operations on platform. Note : DC coeff is not scaled     */
  392|       |    /*************************************************************/
  393|       |
  394|       |    // Row 0 processing
  395|       |    // a00 a01 a02 a03 a04 a05 a06 a07 -- the source matrix 0th row
  396|  40.9k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src));
  397|       |    // b00 b01 b02 b03 b04 b05 b06 b07 -- the scaling matrix 0th row
  398|  40.9k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat));
  399|       |    // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  400|  40.9k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[0]));
  401|  40.9k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  402|  40.9k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);  // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  403|       |    // b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  404|  40.9k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  405|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  406|  40.9k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  407|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  408|  40.9k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  409|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  410|  40.9k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  411|       |    // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  412|  40.9k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  413|       |
  414|  40.9k|    if(qp_div >= 6)
  ------------------
  |  Branch (414:8): [True: 11.9k, False: 29.0k]
  ------------------
  415|  11.9k|    {
  416|  11.9k|        resq_r0_1 = _mm_slli_epi32(temp5, qp_div - 6);
  417|  11.9k|        resq_r0_2 = _mm_slli_epi32(temp7, qp_div - 6);
  418|  11.9k|    }
  419|  29.0k|    else
  420|  29.0k|    {
  421|  29.0k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  422|  29.0k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  423|  29.0k|        resq_r0_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  424|  29.0k|        resq_r0_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  425|  29.0k|    }
  426|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 16
  427|       |    // bit long
  428|  40.9k|    resq_r0_1 = _mm_packs_epi32(resq_r0_1, resq_r0_2);
  429|       |    // Row 1 processing
  430|       |    // a00 a01 a02 a03 a04 a05 a06 a07 a08 --the source matrix 1st row
  431|  40.9k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 8));
  432|       |    // b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 1st row
  433|  40.9k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 8));
  434|       |    // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  435|  40.9k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[8]));
  436|       |    // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  437|  40.9k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);
  438|       |    // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  439|  40.9k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);
  440|       |    // b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  441|  40.9k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  442|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  443|  40.9k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  444|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  445|  40.9k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  446|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  447|  40.9k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  448|       |    // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  449|  40.9k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  450|  40.9k|    if(qp_div >= 6)
  ------------------
  |  Branch (450:8): [True: 11.9k, False: 29.0k]
  ------------------
  451|  11.9k|    {
  452|  11.9k|        resq_r1_1 = _mm_slli_epi32(temp5, qp_div - 6);
  453|  11.9k|        resq_r1_2 = _mm_slli_epi32(temp7, qp_div - 6);
  454|  11.9k|    }
  455|  29.0k|    else
  456|  29.0k|    {
  457|  29.0k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  458|  29.0k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  459|  29.0k|        resq_r1_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  460|  29.0k|        resq_r1_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  461|  29.0k|    }
  462|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 16
  463|       |    // bit long
  464|  40.9k|    resq_r1_1 = _mm_packs_epi32(resq_r1_1, resq_r1_2);
  465|       |    // Row 2 processing
  466|       |    // a00 a01 a02 a03 a04 a05 a06 a07 a08 --the source matrix 2nd row
  467|  40.9k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 16));
  468|       |    // b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 2nd row
  469|  40.9k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 16));
  470|       |    // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  471|  40.9k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[16]));
  472|  40.9k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  473|  40.9k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);  // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  474|       |    // b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  475|  40.9k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  476|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  477|  40.9k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  478|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  479|  40.9k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  480|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  481|  40.9k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  482|       |    // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  483|  40.9k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  484|  40.9k|    if(qp_div >= 6)
  ------------------
  |  Branch (484:8): [True: 11.9k, False: 29.0k]
  ------------------
  485|  11.9k|    {
  486|  11.9k|        resq_r2_1 = _mm_slli_epi32(temp5, qp_div - 6);
  487|  11.9k|        resq_r2_2 = _mm_slli_epi32(temp7, qp_div - 6);
  488|  11.9k|    }
  489|  29.0k|    else
  490|  29.0k|    {
  491|  29.0k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  492|  29.0k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  493|  29.0k|        resq_r2_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  494|  29.0k|        resq_r2_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  495|  29.0k|    }
  496|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 -- 16 bit long
  497|  40.9k|    resq_r2_1 = _mm_packs_epi32(resq_r2_1, resq_r2_2);
  498|       |    // Row 3 processing
  499|       |    // a00 a01 a02 a03 a04 a05 a06 a07 a08 --the source matrix 3rd row
  500|  40.9k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 24));
  501|       |    // b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 3rd row
  502|  40.9k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 24));
  503|       |    // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  504|  40.9k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[24]));
  505|  40.9k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  506|  40.9k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);  // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  507|       |    // b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  508|  40.9k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  509|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  510|  40.9k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  511|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  512|  40.9k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  513|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 - 32 bits long
  514|  40.9k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  515|       |    // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  516|  40.9k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  517|  40.9k|    if(qp_div >= 6)
  ------------------
  |  Branch (517:8): [True: 11.9k, False: 29.0k]
  ------------------
  518|  11.9k|    {
  519|  11.9k|        resq_r3_1 = _mm_slli_epi32(temp5, qp_div - 6);
  520|  11.9k|        resq_r3_2 = _mm_slli_epi32(temp7, qp_div - 6);
  521|  11.9k|    }
  522|  29.0k|    else
  523|  29.0k|    {
  524|  29.0k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  525|  29.0k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  526|  29.0k|        resq_r3_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  527|  29.0k|        resq_r3_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  528|  29.0k|    }
  529|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 .... -- 16 bit long
  530|  40.9k|    resq_r3_1 = _mm_packs_epi32(resq_r3_1, resq_r3_2);
  531|       |    // Row 4 processing
  532|       |    // a00 a01 a02 a03 a04 a05 a06 a07 a08 --the source matrix 4th row
  533|  40.9k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 32));
  534|       |    // b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 4th row
  535|  40.9k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 32));
  536|       |    // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  537|  40.9k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[32]));
  538|  40.9k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  539|  40.9k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);  // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  540|       |    // b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  541|  40.9k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  542|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  543|  40.9k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  544|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  545|  40.9k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  546|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  547|  40.9k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  548|       |    // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  549|  40.9k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  550|  40.9k|    if(qp_div >= 6)
  ------------------
  |  Branch (550:8): [True: 11.9k, False: 29.0k]
  ------------------
  551|  11.9k|    {
  552|  11.9k|        resq_r4_1 = _mm_slli_epi32(temp5, qp_div - 6);
  553|  11.9k|        resq_r4_2 = _mm_slli_epi32(temp7, qp_div - 6);
  554|  11.9k|    }
  555|  29.0k|    else
  556|  29.0k|    {
  557|  29.0k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  558|  29.0k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  559|  29.0k|        resq_r4_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  560|  29.0k|        resq_r4_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  561|  29.0k|    }
  562|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5  -- 16 bit long
  563|  40.9k|    resq_r4_1 = _mm_packs_epi32(resq_r4_1, resq_r4_2);
  564|       |    // Row 5 processing
  565|       |    // a00 a01 a02 a03 a04 a05 a06 a07 a08 --the source matrix 5th row
  566|  40.9k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 40));
  567|       |    //
  568|       |    // b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 5th row
  569|  40.9k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 40));
  570|       |    // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  571|  40.9k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[40]));
  572|  40.9k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  573|  40.9k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);  // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  574|       |    // b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  575|  40.9k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  576|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  577|  40.9k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  578|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  579|  40.9k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  580|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  581|  40.9k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  582|       |    // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  583|  40.9k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  584|  40.9k|    if(qp_div >= 6)
  ------------------
  |  Branch (584:8): [True: 11.9k, False: 29.0k]
  ------------------
  585|  11.9k|    {
  586|  11.9k|        resq_r5_1 = _mm_slli_epi32(temp5, qp_div - 6);
  587|  11.9k|        resq_r5_2 = _mm_slli_epi32(temp7, qp_div - 6);
  588|  11.9k|    }
  589|  29.0k|    else
  590|  29.0k|    {
  591|  29.0k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  592|  29.0k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  593|  29.0k|        resq_r5_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  594|  29.0k|        resq_r5_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  595|  29.0k|    }
  596|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 -- 16 bit long
  597|  40.9k|    resq_r5_1 = _mm_packs_epi32(resq_r5_1, resq_r5_2);
  598|       |    // Row 6 processing
  599|       |    // a00 a01 a02 a03 a04 a05 a06 a07 a08 --the source matrix 6th row
  600|  40.9k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 48));
  601|       |    // b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 6th row
  602|  40.9k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 48));
  603|       |    // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  604|  40.9k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[48]));
  605|  40.9k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  606|  40.9k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);  // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  607|       |    // b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  608|  40.9k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  609|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  610|  40.9k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  611|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  612|  40.9k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  613|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  614|  40.9k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  615|       |    // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  616|  40.9k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  617|  40.9k|    if(qp_div >= 6)
  ------------------
  |  Branch (617:8): [True: 11.9k, False: 29.0k]
  ------------------
  618|  11.9k|    {
  619|  11.9k|        resq_r6_1 = _mm_slli_epi32(temp5, qp_div - 6);
  620|  11.9k|        resq_r6_2 = _mm_slli_epi32(temp7, qp_div - 6);
  621|  11.9k|    }
  622|  29.0k|    else
  623|  29.0k|    {
  624|  29.0k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  625|  29.0k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  626|  29.0k|        resq_r6_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  627|  29.0k|        resq_r6_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  628|  29.0k|    }
  629|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 -- 16 bit long
  630|  40.9k|    resq_r6_1 = _mm_packs_epi32(resq_r6_1, resq_r6_2);
  631|       |    // Row 7 processing
  632|       |    // a00 a01 a02 a03 a04 a05 a06 a07 a08 --the source matrix 7th row
  633|  40.9k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 56));
  634|       |    // b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 7th row
  635|  40.9k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 56));
  636|       |    // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  637|  40.9k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[56]));
  638|  40.9k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  639|  40.9k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);  // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  640|       |    // b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  641|  40.9k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  642|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  643|  40.9k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  644|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  645|  40.9k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  646|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  647|  40.9k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  648|       |    // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  649|  40.9k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  650|  40.9k|    if(qp_div >= 6)
  ------------------
  |  Branch (650:8): [True: 11.9k, False: 29.0k]
  ------------------
  651|  11.9k|    {
  652|  11.9k|        resq_r7_1 = _mm_slli_epi32(temp5, qp_div - 6);
  653|  11.9k|        resq_r7_2 = _mm_slli_epi32(temp7, qp_div - 6);
  654|  11.9k|    }
  655|  29.0k|    else
  656|  29.0k|    {
  657|  29.0k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  658|  29.0k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  659|  29.0k|        resq_r7_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  660|  29.0k|        resq_r7_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  661|  29.0k|    }
  662|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 -- 16 bit long
  663|  40.9k|    resq_r7_1 = _mm_packs_epi32(resq_r7_1, resq_r7_2);
  664|       |
  665|       |    /* Perform Inverse transform */
  666|       |    /*--------------------------------------------------------------------*/
  667|       |    /* IDCT [ Horizontal transformation ]                                 */
  668|       |    /*--------------------------------------------------------------------*/
  669|       |    // Matrix transpose
  670|       |    /*
  671|       |     *  a0 a1 a2 a3 a4 a5 a6 a7
  672|       |     *  b0 b1 b2 b3 b4 b5 b6 b7
  673|       |     *  c0 c1 c2 c3 c4 c5 c6 c7
  674|       |     *  d0 d1 d2 d3 d4 d5 d6 d7
  675|       |     */
  676|  40.9k|    temp1 = _mm_unpacklo_epi16(resq_r0_1, resq_r1_1);  // a0 b0 a1 b1 a2 b2 a3 b3
  677|  40.9k|    temp3 = _mm_unpacklo_epi16(resq_r2_1, resq_r3_1);  // c0 d0 c1 d1 c2 d2 c3 d3
  678|  40.9k|    temp2 = _mm_unpackhi_epi16(resq_r0_1, resq_r1_1);  // a4 b4 a5 b5 a6 b6 a7 b7
  679|  40.9k|    temp4 = _mm_unpackhi_epi16(resq_r2_1, resq_r3_1);  // c4 d4 c5 d5 c6 d6 c7 d7
  680|  40.9k|    resq_r0_1 = _mm_unpacklo_epi32(temp1, temp3);      // a0 b0 c0 d0 a1 b1 c1 d1
  681|  40.9k|    resq_r1_1 = _mm_unpackhi_epi32(temp1, temp3);      // a2 b2 c2 d2 a3 b3 c3 d3
  682|  40.9k|    resq_r2_1 = _mm_unpacklo_epi32(temp2, temp4);      // a4 b4 c4 d4 a5 b5 c5 d5
  683|  40.9k|    resq_r3_1 = _mm_unpackhi_epi32(temp2, temp4);      // a6 b6 c6 d6 a7 b7 c7 d7
  684|       |    /*
  685|       |     * e0 e1 e2 e3 e4 e5 e6 e7
  686|       |     * f0 f1 f2 f3 f4 f5 f6 f7
  687|       |     * g0 g1 g2 g3 g4 g5 g6 g7
  688|       |     * h0 h1 h2 h3 h4 h5 h6 h7
  689|       |     */
  690|  40.9k|    temp1 = _mm_unpacklo_epi16(resq_r4_1, resq_r5_1);  // e0 f0 e1 f1 e2 f2 e2 f3
  691|  40.9k|    temp3 = _mm_unpacklo_epi16(resq_r6_1, resq_r7_1);  // g0 h0 g1 h1 g2 h2 g3 h3
  692|  40.9k|    temp2 = _mm_unpackhi_epi16(resq_r4_1, resq_r5_1);  // e4 f4 e5 f5 e6 f6 e7 f7
  693|  40.9k|    temp4 = _mm_unpackhi_epi16(resq_r6_1, resq_r7_1);  // g4 h4 g5 h5 g6 h6 g7 h7
  694|  40.9k|    resq_r4_1 = _mm_unpacklo_epi32(temp1, temp3);      // e0 f0 g0 h0 e1 f1 g1 h1
  695|  40.9k|    resq_r5_1 = _mm_unpackhi_epi32(temp1, temp3);      // e2 f2 g2 h2 e3 f3 g3 h3
  696|  40.9k|    resq_r6_1 = _mm_unpacklo_epi32(temp2, temp4);      // e4 f4 g4 h4 e5 f5 g5 h5
  697|  40.9k|    resq_r7_1 = _mm_unpackhi_epi32(temp2, temp4);      // e6 f6 g6 h6 e7 f7 g7 h7
  698|       |    /*
  699|       |     * a0 b0 c0 d0 a1 b1 c1 d1
  700|       |     * a2 b2 c2 d2 a3 b3 c3 d3
  701|       |     * a4 b4 c4 d4 a5 b5 c5 d5
  702|       |     * a6 b6 c6 d6 a7 b7 c7 d7
  703|       |     * e0 f0 g0 h0 e1 f1 g1 h1
  704|       |     * e2 f2 g2 h2 e3 f3 g3 h3
  705|       |     * e4 f4 g4 h4 e5 f5 g5 h5
  706|       |     * e6 f6 g6 h6 e7 f7 g7 h7
  707|       |     */
  708|  40.9k|    resq_r0_2 = _mm_unpacklo_epi64(resq_r0_1, resq_r4_1);  // a0 b0 c0 d0 e0 f0 g0 h0
  709|  40.9k|    resq_r1_2 = _mm_unpackhi_epi64(resq_r0_1, resq_r4_1);  // a1 b1 c1 d1 e1 f1 g1 h1
  710|  40.9k|    resq_r2_2 = _mm_unpacklo_epi64(resq_r1_1, resq_r5_1);  // a2 b2 c2 d2 e2 f2 g2 h2
  711|  40.9k|    resq_r3_2 = _mm_unpackhi_epi64(resq_r1_1, resq_r5_1);  // a3 b3 c3 d3 e3 f3 g3 h3
  712|  40.9k|    resq_r4_2 = _mm_unpacklo_epi64(resq_r2_1, resq_r6_1);  // a4 b4 c4 d4 e4 f4 g4 h4
  713|  40.9k|    resq_r5_2 = _mm_unpackhi_epi64(resq_r2_1, resq_r6_1);  // a5 b5 c5 d5 e5 f5 g5 h5
  714|  40.9k|    resq_r6_2 = _mm_unpacklo_epi64(resq_r3_1, resq_r7_1);  // a6 b6 c6 d6 e6 f6 g6 h6
  715|  40.9k|    resq_r7_2 = _mm_unpackhi_epi64(resq_r3_1, resq_r7_1);  // a7 b7 c7 d7 e7 f7 g7 h7
  716|       |
  717|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r1_2);
  718|  40.9k|    resq_r1_1 = _mm_unpacklo_epi16(resq_r1_2, sign_reg);  // a1 b1 c1 d1 -- 32 bit
  719|  40.9k|    resq_r1_2 = _mm_unpackhi_epi16(resq_r1_2, sign_reg);  // e1 f1 g1 h1 -- 32 bit
  720|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r3_2);
  721|  40.9k|    resq_r3_1 = _mm_unpacklo_epi16(resq_r3_2, sign_reg);  // a3 b3 c3 d3 -- 32 bit
  722|  40.9k|    resq_r3_2 = _mm_unpackhi_epi16(resq_r3_2, sign_reg);  // e3 f3 g3 h3 -- 32 bit
  723|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r5_2);
  724|  40.9k|    resq_r5_1 = _mm_unpacklo_epi16(resq_r5_2, sign_reg);  // a5 b5 c5 d5 -- 32 bit
  725|  40.9k|    resq_r5_2 = _mm_unpackhi_epi16(resq_r5_2, sign_reg);  // e5 f5 g5 h5 -- 32 bit
  726|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r7_2);
  727|  40.9k|    resq_r7_1 = _mm_unpacklo_epi16(resq_r7_2, sign_reg);  // a7 b7 c7 d7 -- 32 bit
  728|  40.9k|    resq_r7_2 = _mm_unpackhi_epi16(resq_r7_2, sign_reg);  // e7 f7 g7 h7 -- 32 bit
  729|       |    // Transform starts -- horizontal transform
  730|       |    /*------------------------------------------------------------------*/
  731|       |    /* y0 = w0 + w4                                                     */
  732|  40.9k|    temp1 = _mm_add_epi16(resq_r0_2, resq_r4_2);
  733|       |    /* y2 = w0 - w4                                                      */
  734|  40.9k|    temp3 = _mm_sub_epi16(resq_r0_2, resq_r4_2);
  735|       |    /* y1 = -w3 + w5 - w7 - (w7 >> 1)                                   */
  736|  40.9k|    temp2 = _mm_sub_epi32(resq_r5_1, resq_r3_1);  //-w3+w5
  737|  40.9k|    temp10 = _mm_sub_epi32(resq_r5_2, resq_r3_2);
  738|  40.9k|    temp4 = _mm_sub_epi32(temp2, resq_r7_1);      //-w3+w5-w7
  739|  40.9k|    temp12 = _mm_sub_epi32(temp10, resq_r7_2);
  740|  40.9k|    temp5 = _mm_srai_epi32(resq_r7_1, 1);         // w7>>1
  741|  40.9k|    temp13 = _mm_srai_epi32(resq_r7_2, 1);
  742|  40.9k|    temp2 = _mm_sub_epi32(temp4, temp5);          //-w3+w5-w7 -(w7>>1)
  743|  40.9k|    temp10 = _mm_sub_epi32(temp12, temp13);
  744|  40.9k|    temp2 = _mm_packs_epi32(temp2, temp10);
  745|       |    /* y3 = w1 + w7 - w3 - (w3 >> 1)                                    */
  746|  40.9k|    temp4 = _mm_add_epi32(resq_r1_1, resq_r7_1);  // w1+w7
  747|  40.9k|    temp12 = _mm_add_epi32(resq_r1_2, resq_r7_2);
  748|  40.9k|    temp4 = _mm_sub_epi32(temp4, resq_r3_1);      // w1+w7-w3
  749|  40.9k|    temp12 = _mm_sub_epi32(temp12, resq_r3_2);
  750|  40.9k|    temp5 = _mm_srai_epi32(resq_r3_1, 1);         // w3>>1
  751|  40.9k|    temp13 = _mm_srai_epi32(resq_r3_2, 1);
  752|  40.9k|    temp4 = _mm_sub_epi32(temp4, temp5);          // w1+w7-w3-(w3>>1)
  753|  40.9k|    temp12 = _mm_sub_epi32(temp12, temp13);
  754|  40.9k|    temp4 = _mm_packs_epi32(temp4, temp12);
  755|       |    /* y4 = (w2 >> 1) - w6                                              */
  756|  40.9k|    temp5 = _mm_srai_epi16(resq_r2_2, 1);     // w2>>1
  757|  40.9k|    temp5 = _mm_sub_epi16(temp5, resq_r6_2);  //(w2>>1)-w6
  758|       |    /* y5 = -w1 + w7 + w5 + (w5 >> 1)                                   */
  759|  40.9k|    temp6 = _mm_sub_epi32(resq_r7_1, resq_r1_1);  // w7-w1
  760|  40.9k|    temp14 = _mm_sub_epi32(resq_r7_2, resq_r1_2);
  761|  40.9k|    temp6 = _mm_add_epi32(temp6, resq_r5_1);      // w7-w1+w5
  762|  40.9k|    temp14 = _mm_add_epi32(temp14, resq_r5_2);
  763|  40.9k|    temp7 = _mm_srai_epi32(resq_r5_1, 1);         // w5>>1
  764|  40.9k|    temp15 = _mm_srai_epi32(resq_r5_2, 1);
  765|  40.9k|    temp6 = _mm_add_epi32(temp6, temp7);          // w7-w1_w5+(w5>>1)
  766|  40.9k|    temp14 = _mm_add_epi32(temp14, temp15);
  767|  40.9k|    temp6 = _mm_packs_epi32(temp6, temp14);
  768|       |    /* y6 = w2 + (w6 >> 1)                                              */
  769|  40.9k|    temp7 = _mm_srai_epi16(resq_r6_2, 1);     // w6>>1
  770|  40.9k|    temp7 = _mm_add_epi16(temp7, resq_r2_2);  //(w6>>1)+w2
  771|       |    /* y7 = w3 + w5 + w1 + (w1 >> 1)                                    */
  772|  40.9k|    temp8 = _mm_add_epi32(resq_r3_1, resq_r5_1);  // w3+w5
  773|  40.9k|    temp16 = _mm_add_epi32(resq_r3_2, resq_r5_2);
  774|  40.9k|    temp8 = _mm_add_epi32(temp8, resq_r1_1);      // w3+w5+w1
  775|  40.9k|    temp16 = _mm_add_epi32(temp16, resq_r1_2);
  776|  40.9k|    temp17 = _mm_srai_epi32(resq_r1_1, 1);        // w1>>1
  777|  40.9k|    temp18 = _mm_srai_epi32(resq_r1_2, 1);
  778|  40.9k|    temp8 = _mm_add_epi32(temp8, temp17);         // w3+w5+w1+(w1>>1)
  779|  40.9k|    temp16 = _mm_add_epi32(temp16, temp18);
  780|  40.9k|    temp8 = _mm_packs_epi32(temp8, temp16);
  781|       |    /*------------------------------------------------------------------*/
  782|       |    /*------------------------------------------------------------------*/
  783|       |    /* z0 = y0 + y6                                                        */
  784|  40.9k|    resq_r0_1 = _mm_add_epi16(temp1, temp7);
  785|       |    /* z1 = y1 + (y7 >> 2)                                                */
  786|  40.9k|    resq_r1_1 = _mm_srai_epi16(temp8, 2);
  787|  40.9k|    resq_r1_1 = _mm_add_epi16(resq_r1_1, temp2);
  788|       |    /* z2 = y2 + y4                                                        */
  789|  40.9k|    resq_r2_1 = _mm_add_epi16(temp3, temp5);
  790|       |    /* z3 = y3 + (y5 >> 2)                                                */
  791|  40.9k|    resq_r3_1 = _mm_srai_epi16(temp6, 2);
  792|  40.9k|    resq_r3_1 = _mm_add_epi16(resq_r3_1, temp4);
  793|       |    /* z4 = y2 - y4                                                        */
  794|  40.9k|    resq_r4_1 = _mm_sub_epi16(temp3, temp5);
  795|       |    /* z5 = (y3 >> 2) - y5                                                 */
  796|  40.9k|    resq_r5_1 = _mm_srai_epi16(temp4, 2);
  797|  40.9k|    resq_r5_1 = _mm_sub_epi16(resq_r5_1, temp6);
  798|       |    /* z6 = y0 - y6                                                     */
  799|  40.9k|    resq_r6_1 = _mm_sub_epi16(temp1, temp7);
  800|       |    /* z7 = y7 - (y1 >> 2)                                                 */
  801|  40.9k|    resq_r7_1 = _mm_srai_epi16(temp2, 2);
  802|  40.9k|    resq_r7_1 = _mm_sub_epi16(temp8, resq_r7_1);
  803|       |    /*------------------------------------------------------------------*/
  804|       |    /*------------------------------------------------------------------*/
  805|       |    /* x0 = z0 + z7                                                        */
  806|  40.9k|    temp1 = _mm_add_epi16(resq_r0_1, resq_r7_1);
  807|       |    /* x1 = z2 + z5                                                        */
  808|  40.9k|    temp2 = _mm_add_epi16(resq_r2_1, resq_r5_1);
  809|       |    /* x2 = z4 + z3                                                        */
  810|  40.9k|    temp3 = _mm_add_epi16(resq_r4_1, resq_r3_1);
  811|       |    /* x3 = z6 + z1                                                        */
  812|  40.9k|    temp4 = _mm_add_epi16(resq_r6_1, resq_r1_1);
  813|       |    /* x4 = z6 - z1                                                        */
  814|  40.9k|    temp5 = _mm_sub_epi16(resq_r6_1, resq_r1_1);
  815|       |    /* x5 = z4 - z3                                                        */
  816|  40.9k|    temp6 = _mm_sub_epi16(resq_r4_1, resq_r3_1);
  817|       |    /* x6 = z2 - z5                                                        */
  818|  40.9k|    temp7 = _mm_sub_epi16(resq_r2_1, resq_r5_1);
  819|       |    /* x7 = z0 - z7                                                        */
  820|  40.9k|    temp8 = _mm_sub_epi16(resq_r0_1, resq_r7_1);
  821|       |    /*------------------------------------------------------------------*/
  822|       |    // Matrix transpose
  823|       |    /*
  824|       |     *  a0 b0 c0 d0 e0 f0 g0 h0
  825|       |     *  a1 b1 c1 d1 e1 f1 g1 h1
  826|       |     *  a2 b2 c2 d2 e2 f2 g2 h2
  827|       |     *  a3 b3 c3 d3 e3 f3 g3 h3
  828|       |     */
  829|  40.9k|    temp17 = _mm_unpacklo_epi16(temp1, temp2);       // a0 a1 b0 b1 c0 c1 d0 d1
  830|  40.9k|    temp19 = _mm_unpacklo_epi16(temp3, temp4);       // a2 a3 b2 b3 c2 c3 d2 d3
  831|  40.9k|    temp18 = _mm_unpackhi_epi16(temp1, temp2);       // e0 e1 f0 f1 g0 g1 h0 h1
  832|  40.9k|    temp20 = _mm_unpackhi_epi16(temp3, temp4);       // e2 e3 f2 f3 g2 g3 h2 h3
  833|       |
  834|  40.9k|    resq_r0_1 = _mm_unpacklo_epi32(temp17, temp19);  // a0 a1 a2 a3 b0 b1 b2 b3
  835|  40.9k|    resq_r1_1 = _mm_unpackhi_epi32(temp17, temp19);  // c0 c1 c2 c3 d0 d1 d2 d3
  836|  40.9k|    resq_r2_1 = _mm_unpacklo_epi32(temp18, temp20);  // e0 e1 e2 e3 f0 f1 f2 f3
  837|  40.9k|    resq_r3_1 = _mm_unpackhi_epi32(temp18, temp20);  // g0 g2 g2 g3 h0 h1 h2 h3
  838|       |    /*
  839|       |     *  a4 b4 c4 d4 e4 f4 g4 h4
  840|       |     *  a5 b5 c5 d5 e5 f5 g5 h5
  841|       |     *  a6 b6 c6 d6 e6 f6 g6 h6
  842|       |     *  a7 b7 c7 d7 e7 f7 g7 h7
  843|       |     */
  844|  40.9k|    temp17 = _mm_unpacklo_epi16(temp5, temp6);       // a4 a5 b4 b5 c4 c5 d4 d5
  845|  40.9k|    temp19 = _mm_unpacklo_epi16(temp7, temp8);       // a6 a7 b6 b7 c6 c7 d6 d7
  846|  40.9k|    temp18 = _mm_unpackhi_epi16(temp5, temp6);       // e4 e5 f4 f5 g4 g5 h4 h5
  847|  40.9k|    temp20 = _mm_unpackhi_epi16(temp7, temp8);       // e6 e7 f6 f7 g6 g7 h6 h7
  848|       |
  849|  40.9k|    resq_r4_1 = _mm_unpacklo_epi32(temp17, temp19);  // a4 a5 a6 a7 b4 b5 b6 b7
  850|  40.9k|    resq_r5_1 = _mm_unpackhi_epi32(temp17, temp19);  // c4 c5 c6 c7 d4 d5 d6 d7
  851|  40.9k|    resq_r6_1 = _mm_unpacklo_epi32(temp18, temp20);  // e4 e5 e6 e7 f4 f5 f6 f7
  852|  40.9k|    resq_r7_1 = _mm_unpackhi_epi32(temp18, temp20);  // g4 g5 g6 g7 h4 h5 h6 h7
  853|       |    /*  a0 a1 a2 a3 b0 b1 b2 b3
  854|       |     *  c0 c1 c2 c3 d0 d1 d2 d3
  855|       |     *  e0 e1 e2 e3 f0 f1 f2 f3
  856|       |     *  g0 g2 g2 g3 h0 h1 h2 h3
  857|       |     *  a4 a5 a6 a7 b4 b5 b6 b7
  858|       |     *  c4 c5 c6 c7 d4 d5 d6 d7
  859|       |     *  e4 e5 e6 e7 f4 f5 f6 f7
  860|       |     *  g4 g5 g6 g7 h4 h5 h6 h7
  861|       |     */
  862|  40.9k|    resq_r0_2 = _mm_unpacklo_epi64(resq_r0_1, resq_r4_1);  // a0 a1 a2 a3 a4 a5 a6 a7
  863|  40.9k|    resq_r1_2 = _mm_unpackhi_epi64(resq_r0_1, resq_r4_1);  // b0 b1 b2 b3 b4 b5 b6 b7
  864|  40.9k|    resq_r2_2 = _mm_unpacklo_epi64(resq_r1_1, resq_r5_1);  // c0 c1 c2 c3 c4 c5 c6 c7
  865|  40.9k|    resq_r3_2 = _mm_unpackhi_epi64(resq_r1_1, resq_r5_1);  // d0 d1 d2 d3 d4 d5 d6 d7
  866|  40.9k|    resq_r4_2 = _mm_unpacklo_epi64(resq_r2_1, resq_r6_1);  // e0 e1 e2 e3 e4 e5 e6 e7
  867|  40.9k|    resq_r5_2 = _mm_unpackhi_epi64(resq_r2_1, resq_r6_1);  // f0 f1 f2 f3 f4 f5 f6 f7
  868|  40.9k|    resq_r6_2 = _mm_unpacklo_epi64(resq_r3_1, resq_r7_1);  // g0 g1 g2 g3 g4 g5 g6 g7
  869|  40.9k|    resq_r7_2 = _mm_unpackhi_epi64(resq_r3_1, resq_r7_1);  // h0 h1 h2 h3 h4 h5 h6 h7
  870|       |
  871|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r1_2);
  872|  40.9k|    resq_r1_1 = _mm_unpacklo_epi16(resq_r1_2, sign_reg);  // a1 b1 c1 d1 -- 32 bit
  873|  40.9k|    resq_r1_2 = _mm_unpackhi_epi16(resq_r1_2, sign_reg);  // e1 f1 g1 h1 -- 32 bit
  874|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r3_2);
  875|  40.9k|    resq_r3_1 = _mm_unpacklo_epi16(resq_r3_2, sign_reg);  // a3 b3 c3 d3 -- 32 bit
  876|  40.9k|    resq_r3_2 = _mm_unpackhi_epi16(resq_r3_2, sign_reg);  // e3 f3 g3 h3 -- 32 bit
  877|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r5_2);
  878|  40.9k|    resq_r5_1 = _mm_unpacklo_epi16(resq_r5_2, sign_reg);  // a5 b5 c5 d5 -- 32 bit
  879|  40.9k|    resq_r5_2 = _mm_unpackhi_epi16(resq_r5_2, sign_reg);  // e5 f5 g5 h5 -- 32 bit
  880|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r7_2);
  881|  40.9k|    resq_r7_1 = _mm_unpacklo_epi16(resq_r7_2, sign_reg);  // a7 b7 c7 d7 -- 32 bit
  882|  40.9k|    resq_r7_2 = _mm_unpackhi_epi16(resq_r7_2, sign_reg);  // e7 f7 g7 h7 -- 32 bit
  883|       |
  884|  40.9k|    zero_8x16b = _mm_setzero_si128();                     // all bits reset to zero
  885|       |    // Load pred buffer row 0
  886|       |    // p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  887|  40.9k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[0]));
  888|       |    // p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  889|  40.9k|    pred_r0_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b);
  890|       |    // Load pred buffer row 1
  891|       |    // p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  892|  40.9k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[pred_strd]));
  893|       |    // p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  894|  40.9k|    pred_r1_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b);
  895|       |    // Load pred buffer row 2
  896|       |    // p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  897|  40.9k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[2 * pred_strd]));
  898|       |    // p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  899|  40.9k|    pred_r2_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b);
  900|       |    // Load pred buffer row 3
  901|       |    // p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  902|  40.9k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[3 * pred_strd]));
  903|       |    // p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  904|  40.9k|    pred_r3_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b);
  905|       |    // Load pred buffer row 4
  906|       |    // p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  907|  40.9k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[4 * pred_strd]));
  908|       |    // p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  909|  40.9k|    pred_r4_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b);
  910|       |    // Load pred buffer row 5
  911|       |    // p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bit
  912|  40.9k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[5 * pred_strd]));
  913|       |    // p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  914|  40.9k|    pred_r5_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b);
  915|       |    // Load pred buffer row 6
  916|       |    // p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  917|  40.9k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[6 * pred_strd]));
  918|       |    // p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  919|  40.9k|    pred_r6_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b);
  920|       |    // Load pred buffer row 7
  921|       |    // p0 p1 p2 p3 p4 p5 p6 p7 0 0 0 0 0 0 0 0 -- all 8 bits
  922|  40.9k|    predload_r = _mm_loadl_epi64((__m128i *) (&pu1_pred[7 * pred_strd]));
  923|       |    // p0 p1 p2 p3 p4 p5 p6 p7 -- all 16 bits
  924|  40.9k|    pred_r7_1 = _mm_unpacklo_epi8(predload_r, zero_8x16b);
  925|       |
  926|  40.9k|    rsd_r0 = _mm_loadu_si128((__m128i *) (&pi2_rsd[0]));
  927|  40.9k|    rsd_r1 = _mm_loadu_si128((__m128i *) (&pi2_rsd[1 * rsd_strd]));
  928|  40.9k|    rsd_r2 = _mm_loadu_si128((__m128i *) (&pi2_rsd[2 * rsd_strd]));
  929|  40.9k|    rsd_r3 = _mm_loadu_si128((__m128i *) (&pi2_rsd[3 * rsd_strd]));
  930|  40.9k|    rsd_r4 = _mm_loadu_si128((__m128i *) (&pi2_rsd[4 * rsd_strd]));
  931|  40.9k|    rsd_r5 = _mm_loadu_si128((__m128i *) (&pi2_rsd[5 * rsd_strd]));
  932|  40.9k|    rsd_r6 = _mm_loadu_si128((__m128i *) (&pi2_rsd[6 * rsd_strd]));
  933|  40.9k|    rsd_r7 = _mm_loadu_si128((__m128i *) (&pi2_rsd[7 * rsd_strd]));
  934|       |
  935|       |    /*--------------------------------------------------------------------*/
  936|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6            */
  937|       |    /*                                                                    */
  938|       |    /* Add the prediction and store it back to reconstructed frame buffer */
  939|       |    /* [Prediction buffer itself in this case]                            */
  940|       |    /*--------------------------------------------------------------------*/
  941|       |
  942|       |    /* y0j = w0j + w4j                                                     */
  943|  40.9k|    temp1 = _mm_add_epi16(resq_r0_2, resq_r4_2);
  944|       |    /* y2j = w0j - w4j                                                      */
  945|  40.9k|    temp3 = _mm_sub_epi16(resq_r0_2, resq_r4_2);
  946|       |    /* y1j = -w3j + w5j - w7j - (w7j >> 1)                                   */
  947|  40.9k|    temp2 = _mm_sub_epi32(resq_r5_1, resq_r3_1);  //-w3+w5
  948|  40.9k|    temp10 = _mm_sub_epi32(resq_r5_2, resq_r3_2);
  949|  40.9k|    temp4 = _mm_sub_epi32(temp2, resq_r7_1);      //-w3+w5-w7
  950|  40.9k|    temp12 = _mm_sub_epi32(temp10, resq_r7_2);
  951|  40.9k|    temp5 = _mm_srai_epi32(resq_r7_1, 1);         // w7>>1
  952|  40.9k|    temp13 = _mm_srai_epi32(resq_r7_2, 1);
  953|  40.9k|    temp2 = _mm_sub_epi32(temp4, temp5);          //-w3+w5-w7 -(w7>>1)
  954|  40.9k|    temp10 = _mm_sub_epi32(temp12, temp13);
  955|  40.9k|    temp2 = _mm_packs_epi32(temp2, temp10);
  956|       |    /* y3j = w1j + w7j - w3j - (w3j >> 1)                                    */
  957|  40.9k|    temp4 = _mm_add_epi32(resq_r1_1, resq_r7_1);  // w1+w7
  958|  40.9k|    temp12 = _mm_add_epi32(resq_r1_2, resq_r7_2);
  959|  40.9k|    temp4 = _mm_sub_epi32(temp4, resq_r3_1);      // w1+w7-w3
  960|  40.9k|    temp12 = _mm_sub_epi32(temp12, resq_r3_2);
  961|  40.9k|    temp5 = _mm_srai_epi32(resq_r3_1, 1);         // w3>>1
  962|  40.9k|    temp13 = _mm_srai_epi32(resq_r3_2, 1);
  963|  40.9k|    temp4 = _mm_sub_epi32(temp4, temp5);          // w1+w7-w3-(w3>>1)
  964|  40.9k|    temp12 = _mm_sub_epi32(temp12, temp13);
  965|  40.9k|    temp4 = _mm_packs_epi32(temp4, temp12);
  966|       |    /* y4j = (w2j >> 1) - w6j                                              */
  967|  40.9k|    temp5 = _mm_srai_epi16(resq_r2_2, 1);     // w2>>1
  968|  40.9k|    temp5 = _mm_sub_epi16(temp5, resq_r6_2);  //(w2>>1)-w6
  969|       |    /* y5j = -w1j + w7j + w5j + (w5j >> 1)                                   */
  970|  40.9k|    temp6 = _mm_sub_epi32(resq_r7_1, resq_r1_1);  // w7-w1
  971|  40.9k|    temp14 = _mm_sub_epi32(resq_r7_2, resq_r1_2);
  972|  40.9k|    temp6 = _mm_add_epi32(temp6, resq_r5_1);      // w7-w1+w5
  973|  40.9k|    temp14 = _mm_add_epi32(temp14, resq_r5_2);
  974|  40.9k|    temp7 = _mm_srai_epi32(resq_r5_1, 1);         // w5>>1
  975|  40.9k|    temp15 = _mm_srai_epi32(resq_r5_2, 1);
  976|  40.9k|    temp6 = _mm_add_epi32(temp6, temp7);          // w7-w1_w5+(w5>>1)
  977|  40.9k|    temp14 = _mm_add_epi32(temp14, temp15);
  978|  40.9k|    temp6 = _mm_packs_epi32(temp6, temp14);
  979|       |    /* y6j = w2j + (w6j >> 1)                                              */
  980|  40.9k|    temp7 = _mm_srai_epi16(resq_r6_2, 1);     // w6>>1
  981|  40.9k|    temp7 = _mm_add_epi16(temp7, resq_r2_2);  //(w6>>1)+w2
  982|       |    /* y7j = w3j + w5j + w1j + (w1j >> 1)                                    */
  983|  40.9k|    temp8 = _mm_add_epi32(resq_r3_1, resq_r5_1);  // w3+w5
  984|  40.9k|    temp16 = _mm_add_epi32(resq_r3_2, resq_r5_2);
  985|  40.9k|    temp8 = _mm_add_epi32(temp8, resq_r1_1);      // w3+w5+w1
  986|  40.9k|    temp16 = _mm_add_epi32(temp16, resq_r1_2);
  987|  40.9k|    temp17 = _mm_srai_epi32(resq_r1_1, 1);        // w1>>1
  988|  40.9k|    temp18 = _mm_srai_epi32(resq_r1_2, 1);
  989|  40.9k|    temp8 = _mm_add_epi32(temp8, temp17);         // w3+w5+w1+(w1>>1)
  990|  40.9k|    temp16 = _mm_add_epi32(temp16, temp18);
  991|  40.9k|    temp8 = _mm_packs_epi32(temp8, temp16);
  992|       |    /*------------------------------------------------------------------*/
  993|       |    /*------------------------------------------------------------------*/
  994|       |    /* z0j = y0j + y6j                                                        */
  995|  40.9k|    resq_r0_1 = _mm_add_epi16(temp1, temp7);
  996|       |    /* z1j = y1j + (y7j >> 2)                                                */
  997|  40.9k|    resq_r1_1 = _mm_srai_epi16(temp8, 2);
  998|  40.9k|    resq_r1_1 = _mm_add_epi16(resq_r1_1, temp2);
  999|       |    /* z2j = y2j + y4j                                                        */
 1000|  40.9k|    resq_r2_1 = _mm_add_epi16(temp3, temp5);
 1001|       |    /* z3j = y3j + (y5j >> 2)                                                */
 1002|  40.9k|    resq_r3_1 = _mm_srai_epi16(temp6, 2);
 1003|  40.9k|    resq_r3_1 = _mm_add_epi16(resq_r3_1, temp4);
 1004|       |    /* z4j = y2j - y4j                                                        */
 1005|  40.9k|    resq_r4_1 = _mm_sub_epi16(temp3, temp5);
 1006|       |    /* z5j = (y3j >> 2) - y5j                                                 */
 1007|  40.9k|    resq_r5_1 = _mm_srai_epi16(temp4, 2);
 1008|  40.9k|    resq_r5_1 = _mm_sub_epi16(resq_r5_1, temp6);
 1009|       |    /* z6j = y0j - y6j                                                     */
 1010|  40.9k|    resq_r6_1 = _mm_sub_epi16(temp1, temp7);
 1011|       |    /* z7j = y7j - (y1j >> 2)                                                 */
 1012|  40.9k|    resq_r7_1 = _mm_srai_epi16(temp2, 2);
 1013|  40.9k|    resq_r7_1 = _mm_sub_epi16(temp8, resq_r7_1);
 1014|       |    /*------------------------------------------------------------------*/
 1015|       |
 1016|       |    /*------------------------------------------------------------------*/
 1017|       |    /* x0j = z0j + z7j                                                        */
 1018|  40.9k|    temp1 = _mm_add_epi16(resq_r0_1, resq_r7_1);
 1019|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp1);
 1020|  40.9k|    temp10 = _mm_unpacklo_epi16(temp1, sign_reg);
 1021|  40.9k|    temp11 = _mm_unpackhi_epi16(temp1, sign_reg);
 1022|  40.9k|    temp10 = _mm_add_epi32(temp10, value_32);
 1023|  40.9k|    temp11 = _mm_add_epi32(temp11, value_32);
 1024|  40.9k|    temp10 = _mm_srai_epi32(temp10, 6);
 1025|  40.9k|    temp11 = _mm_srai_epi32(temp11, 6);
 1026|  40.9k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1027|  40.9k|    rsd_r0 = _mm_add_epi16(temp10, rsd_r0);
 1028|  40.9k|    rsd_r0 = _mm_min_epi16(dupmax_8x16b, rsd_r0);
 1029|  40.9k|    rsd_r0 = _mm_max_epi16(dupmin_8x16b, rsd_r0);
 1030|  40.9k|    temp1 = _mm_add_epi16(rsd_r0, pred_r0_1);
 1031|       |    /* x1j = z2j + z5j                                                        */
 1032|  40.9k|    temp2 = _mm_add_epi16(resq_r2_1, resq_r5_1);
 1033|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp2);
 1034|  40.9k|    temp10 = _mm_unpacklo_epi16(temp2, sign_reg);
 1035|  40.9k|    temp11 = _mm_unpackhi_epi16(temp2, sign_reg);
 1036|  40.9k|    temp10 = _mm_add_epi32(temp10, value_32);
 1037|  40.9k|    temp11 = _mm_add_epi32(temp11, value_32);
 1038|  40.9k|    temp10 = _mm_srai_epi32(temp10, 6);
 1039|  40.9k|    temp11 = _mm_srai_epi32(temp11, 6);
 1040|  40.9k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1041|  40.9k|    rsd_r1 = _mm_add_epi16(temp10, rsd_r1);
 1042|  40.9k|    rsd_r1 = _mm_min_epi16(dupmax_8x16b, rsd_r1);
 1043|  40.9k|    rsd_r1 = _mm_max_epi16(dupmin_8x16b, rsd_r1);
 1044|  40.9k|    temp2 = _mm_add_epi16(rsd_r1, pred_r1_1);
 1045|       |    /* x2j = z4j + z3j                                                        */
 1046|  40.9k|    temp3 = _mm_add_epi16(resq_r4_1, resq_r3_1);
 1047|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp3);
 1048|  40.9k|    temp10 = _mm_unpacklo_epi16(temp3, sign_reg);
 1049|  40.9k|    temp11 = _mm_unpackhi_epi16(temp3, sign_reg);
 1050|  40.9k|    temp10 = _mm_add_epi32(temp10, value_32);
 1051|  40.9k|    temp11 = _mm_add_epi32(temp11, value_32);
 1052|  40.9k|    temp10 = _mm_srai_epi32(temp10, 6);
 1053|  40.9k|    temp11 = _mm_srai_epi32(temp11, 6);
 1054|  40.9k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1055|  40.9k|    rsd_r2 = _mm_add_epi16(temp10, rsd_r2);
 1056|  40.9k|    rsd_r2 = _mm_min_epi16(dupmax_8x16b, rsd_r2);
 1057|  40.9k|    rsd_r2 = _mm_max_epi16(dupmin_8x16b, rsd_r2);
 1058|  40.9k|    temp3 = _mm_add_epi16(rsd_r2, pred_r2_1);
 1059|       |    /* x3j = z6j + z1j                                                        */
 1060|  40.9k|    temp4 = _mm_add_epi16(resq_r6_1, resq_r1_1);
 1061|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp4);
 1062|  40.9k|    temp10 = _mm_unpacklo_epi16(temp4, sign_reg);
 1063|  40.9k|    temp11 = _mm_unpackhi_epi16(temp4, sign_reg);
 1064|  40.9k|    temp10 = _mm_add_epi32(temp10, value_32);
 1065|  40.9k|    temp11 = _mm_add_epi32(temp11, value_32);
 1066|  40.9k|    temp10 = _mm_srai_epi32(temp10, 6);
 1067|  40.9k|    temp11 = _mm_srai_epi32(temp11, 6);
 1068|  40.9k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1069|  40.9k|    rsd_r3 = _mm_add_epi16(temp10, rsd_r3);
 1070|  40.9k|    rsd_r3 = _mm_min_epi16(dupmax_8x16b, rsd_r3);
 1071|  40.9k|    rsd_r3 = _mm_max_epi16(dupmin_8x16b, rsd_r3);
 1072|  40.9k|    temp4 = _mm_add_epi16(rsd_r3, pred_r3_1);
 1073|       |    /* x4j = z6j - z1j                                                        */
 1074|  40.9k|    temp5 = _mm_sub_epi16(resq_r6_1, resq_r1_1);
 1075|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp5);
 1076|  40.9k|    temp10 = _mm_unpacklo_epi16(temp5, sign_reg);
 1077|  40.9k|    temp11 = _mm_unpackhi_epi16(temp5, sign_reg);
 1078|  40.9k|    temp10 = _mm_add_epi32(temp10, value_32);
 1079|  40.9k|    temp11 = _mm_add_epi32(temp11, value_32);
 1080|  40.9k|    temp10 = _mm_srai_epi32(temp10, 6);
 1081|  40.9k|    temp11 = _mm_srai_epi32(temp11, 6);
 1082|  40.9k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1083|  40.9k|    rsd_r4 = _mm_add_epi16(temp10, rsd_r4);
 1084|  40.9k|    rsd_r4 = _mm_min_epi16(dupmax_8x16b, rsd_r4);
 1085|  40.9k|    rsd_r4 = _mm_max_epi16(dupmin_8x16b, rsd_r4);
 1086|  40.9k|    temp5 = _mm_add_epi16(rsd_r4, pred_r4_1);
 1087|       |    /* x5j = z4j - z3j                                                        */
 1088|  40.9k|    temp6 = _mm_sub_epi16(resq_r4_1, resq_r3_1);
 1089|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp6);
 1090|  40.9k|    temp10 = _mm_unpacklo_epi16(temp6, sign_reg);
 1091|  40.9k|    temp11 = _mm_unpackhi_epi16(temp6, sign_reg);
 1092|  40.9k|    temp10 = _mm_add_epi32(temp10, value_32);
 1093|  40.9k|    temp11 = _mm_add_epi32(temp11, value_32);
 1094|  40.9k|    temp10 = _mm_srai_epi32(temp10, 6);
 1095|  40.9k|    temp11 = _mm_srai_epi32(temp11, 6);
 1096|  40.9k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1097|  40.9k|    rsd_r5 = _mm_add_epi16(temp10, rsd_r5);
 1098|  40.9k|    rsd_r5 = _mm_min_epi16(dupmax_8x16b, rsd_r5);
 1099|  40.9k|    rsd_r5 = _mm_max_epi16(dupmin_8x16b, rsd_r5);
 1100|  40.9k|    temp6 = _mm_add_epi16(rsd_r5, pred_r5_1);
 1101|       |    /* x6j = z2j - z5j                                                        */
 1102|  40.9k|    temp7 = _mm_sub_epi16(resq_r2_1, resq_r5_1);
 1103|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp7);
 1104|  40.9k|    temp10 = _mm_unpacklo_epi16(temp7, sign_reg);
 1105|  40.9k|    temp11 = _mm_unpackhi_epi16(temp7, sign_reg);
 1106|  40.9k|    temp10 = _mm_add_epi32(temp10, value_32);
 1107|  40.9k|    temp11 = _mm_add_epi32(temp11, value_32);
 1108|  40.9k|    temp10 = _mm_srai_epi32(temp10, 6);
 1109|  40.9k|    temp11 = _mm_srai_epi32(temp11, 6);
 1110|  40.9k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1111|  40.9k|    rsd_r6 = _mm_add_epi16(temp10, rsd_r6);
 1112|  40.9k|    rsd_r6 = _mm_min_epi16(dupmax_8x16b, rsd_r6);
 1113|  40.9k|    rsd_r6 = _mm_max_epi16(dupmin_8x16b, rsd_r6);
 1114|  40.9k|    temp7 = _mm_add_epi16(rsd_r6, pred_r6_1);
 1115|       |    /* x7j = z0j - z7j                                                        */
 1116|  40.9k|    temp8 = _mm_sub_epi16(resq_r0_1, resq_r7_1);
 1117|  40.9k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp8);
 1118|  40.9k|    temp10 = _mm_unpacklo_epi16(temp8, sign_reg);
 1119|  40.9k|    temp11 = _mm_unpackhi_epi16(temp8, sign_reg);
 1120|  40.9k|    temp10 = _mm_add_epi32(temp10, value_32);
 1121|  40.9k|    temp11 = _mm_add_epi32(temp11, value_32);
 1122|  40.9k|    temp10 = _mm_srai_epi32(temp10, 6);
 1123|  40.9k|    temp11 = _mm_srai_epi32(temp11, 6);
 1124|  40.9k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1125|  40.9k|    rsd_r7 = _mm_add_epi16(temp10, rsd_r7);
 1126|  40.9k|    rsd_r7 = _mm_min_epi16(dupmax_8x16b, rsd_r7);
 1127|  40.9k|    rsd_r7 = _mm_max_epi16(dupmin_8x16b, rsd_r7);
 1128|  40.9k|    temp8 = _mm_add_epi16(rsd_r7, pred_r7_1);
 1129|       |
 1130|  40.9k|    rsd_r01_b0 = _mm_unpacklo_epi64(rsd_r0, rsd_r1);
 1131|  40.9k|    rsd_r23_b0 = _mm_unpacklo_epi64(rsd_r2, rsd_r3);
 1132|  40.9k|    rsd_r45_b2 = _mm_unpacklo_epi64(rsd_r4, rsd_r5);
 1133|  40.9k|    rsd_r67_b2 = _mm_unpacklo_epi64(rsd_r6, rsd_r7);
 1134|       |
 1135|  40.9k|    rsd_r01_b1 = _mm_unpackhi_epi64(rsd_r0, rsd_r1);
 1136|  40.9k|    rsd_r23_b1 = _mm_unpackhi_epi64(rsd_r2, rsd_r3);
 1137|  40.9k|    rsd_r45_b3 = _mm_unpackhi_epi64(rsd_r4, rsd_r5);
 1138|  40.9k|    rsd_r67_b3 = _mm_unpackhi_epi64(rsd_r6, rsd_r7);
 1139|       |
 1140|  40.9k|    row_01_b0 = _mm_test_all_ones(
 1141|  40.9k|        _mm_cmpeq_epi16(rsd_r01_b0, zero_8x16b));  // return 1 if all zeros, else 0
 1142|  40.9k|    row_23_b0 = _mm_test_all_ones(
 1143|  40.9k|        _mm_cmpeq_epi16(rsd_r23_b0, zero_8x16b));  // return 1 if all zeros, else 0
 1144|  40.9k|    row_45_b2 = _mm_test_all_ones(
 1145|  40.9k|        _mm_cmpeq_epi16(rsd_r45_b2, zero_8x16b));  // return 1 if all zeros, else 0
 1146|  40.9k|    row_67_b2 = _mm_test_all_ones(
 1147|  40.9k|        _mm_cmpeq_epi16(rsd_r67_b2, zero_8x16b));  // return 1 if all zeros, else 0
 1148|       |
 1149|  40.9k|    row_01_b1 = _mm_test_all_ones(
 1150|  40.9k|        _mm_cmpeq_epi16(rsd_r01_b1, zero_8x16b));  // return 1 if all zeros, else 0
 1151|  40.9k|    row_23_b1 = _mm_test_all_ones(
 1152|  40.9k|        _mm_cmpeq_epi16(rsd_r23_b1, zero_8x16b));  // return 1 if all zeros, else 0
 1153|  40.9k|    row_45_b3 = _mm_test_all_ones(
 1154|  40.9k|        _mm_cmpeq_epi16(rsd_r45_b3, zero_8x16b));  // return 1 if all zeros, else 0
 1155|  40.9k|    row_67_b3 = _mm_test_all_ones(
 1156|  40.9k|        _mm_cmpeq_epi16(rsd_r67_b3, zero_8x16b));  // return 1 if all zeros, else 0
 1157|       |
 1158|       |    /*------------------------------------------------------------------*/
 1159|       |    // Clipping the results to 8 bits
 1160|  40.9k|    sign_reg = _mm_cmpgt_epi16(temp1, zero_8x16b);  // sign check
 1161|  40.9k|    temp1 = _mm_and_si128(temp1, sign_reg);
 1162|  40.9k|    sign_reg = _mm_cmpgt_epi16(temp2, zero_8x16b);  // sign check
 1163|  40.9k|    temp2 = _mm_and_si128(temp2, sign_reg);
 1164|  40.9k|    sign_reg = _mm_cmpgt_epi16(temp3, zero_8x16b);  // sign check
 1165|  40.9k|    temp3 = _mm_and_si128(temp3, sign_reg);
 1166|  40.9k|    sign_reg = _mm_cmpgt_epi16(temp4, zero_8x16b);  // sign check
 1167|  40.9k|    temp4 = _mm_and_si128(temp4, sign_reg);
 1168|  40.9k|    sign_reg = _mm_cmpgt_epi16(temp5, zero_8x16b);  // sign check
 1169|  40.9k|    temp5 = _mm_and_si128(temp5, sign_reg);
 1170|  40.9k|    sign_reg = _mm_cmpgt_epi16(temp6, zero_8x16b);  // sign check
 1171|  40.9k|    temp6 = _mm_and_si128(temp6, sign_reg);
 1172|  40.9k|    sign_reg = _mm_cmpgt_epi16(temp7, zero_8x16b);  // sign check
 1173|  40.9k|    temp7 = _mm_and_si128(temp7, sign_reg);
 1174|  40.9k|    sign_reg = _mm_cmpgt_epi16(temp8, zero_8x16b);  // sign check
 1175|  40.9k|    temp8 = _mm_and_si128(temp8, sign_reg);
 1176|       |
 1177|  40.9k|    resq_r0_2 = _mm_packus_epi16(temp1, zero_8x16b);
 1178|  40.9k|    resq_r1_2 = _mm_packus_epi16(temp2, zero_8x16b);
 1179|  40.9k|    resq_r2_2 = _mm_packus_epi16(temp3, zero_8x16b);
 1180|  40.9k|    resq_r3_2 = _mm_packus_epi16(temp4, zero_8x16b);
 1181|  40.9k|    resq_r4_2 = _mm_packus_epi16(temp5, zero_8x16b);
 1182|  40.9k|    resq_r5_2 = _mm_packus_epi16(temp6, zero_8x16b);
 1183|  40.9k|    resq_r6_2 = _mm_packus_epi16(temp7, zero_8x16b);
 1184|  40.9k|    resq_r7_2 = _mm_packus_epi16(temp8, zero_8x16b);
 1185|       |
 1186|  40.9k|    _mm_storel_epi64((__m128i *) (&pu1_out[0]), resq_r0_2);
 1187|  40.9k|    _mm_storel_epi64((__m128i *) (&pu1_out[out_strd]), resq_r1_2);
 1188|  40.9k|    _mm_storel_epi64((__m128i *) (&pu1_out[2 * out_strd]), resq_r2_2);
 1189|  40.9k|    _mm_storel_epi64((__m128i *) (&pu1_out[3 * out_strd]), resq_r3_2);
 1190|  40.9k|    _mm_storel_epi64((__m128i *) (&pu1_out[4 * out_strd]), resq_r4_2);
 1191|  40.9k|    _mm_storel_epi64((__m128i *) (&pu1_out[5 * out_strd]), resq_r5_2);
 1192|  40.9k|    _mm_storel_epi64((__m128i *) (&pu1_out[6 * out_strd]), resq_r6_2);
 1193|  40.9k|    _mm_storel_epi64((__m128i *) (&pu1_out[7 * out_strd]), resq_r7_2);
 1194|       |
 1195|  40.9k|    i4_nnz_b0 = (!(row_01_b0 && row_23_b0));
  ------------------
  |  Branch (1195:20): [True: 5.78k, False: 35.1k]
  |  Branch (1195:33): [True: 2.49k, False: 3.28k]
  ------------------
 1196|  40.9k|    i4_nnz_b1 = (!(row_01_b1 && row_23_b1)) << 1;
  ------------------
  |  Branch (1196:20): [True: 6.09k, False: 34.8k]
  |  Branch (1196:33): [True: 2.92k, False: 3.17k]
  ------------------
 1197|  40.9k|    i4_nnz_b2 = (!(row_45_b2 && row_67_b2)) << 4;
  ------------------
  |  Branch (1197:20): [True: 2.96k, False: 38.0k]
  |  Branch (1197:33): [True: 2.75k, False: 205]
  ------------------
 1198|  40.9k|    i4_nnz_b3 = (!(row_45_b3 && row_67_b3)) << 5;
  ------------------
  |  Branch (1198:20): [True: 2.69k, False: 38.2k]
  |  Branch (1198:33): [True: 2.55k, False: 136]
  ------------------
 1199|       |
 1200|  40.9k|    i4_nnz = (i4_nnz_b0 | i4_nnz_b1 | i4_nnz_b2 | i4_nnz_b3);
 1201|  40.9k|    return i4_nnz;
 1202|  40.9k|}
isvcd_iquant_itrans_residual_recon_4x4_dc_sse42:
 1231|    181|{
 1232|    181|    __m128i pred_16x8b_0, pred_8x16b_0, rsd_8x16b_0, out_8x16b_0, out_16x8b_0;
 1233|    181|    __m128i pred_16x8b_1, pred_8x16b_1, rsd_8x16b_1, out_8x16b_1, out_16x8b_1;
 1234|    181|    __m128i pred_16x8b_2, pred_8x16b_2, rsd_8x16b_2, out_8x16b_2, out_16x8b_2;
 1235|    181|    __m128i pred_16x8b_3, pred_8x16b_3, rsd_8x16b_3, out_8x16b_3, out_16x8b_3;
 1236|    181|    __m128i rsd_8x16b_01, rsd_8x16b_23;
 1237|       |
 1238|    181|    __m128i i_macro_8x16b, dupmax_8x16b, dupmin_8x16b;
 1239|    181|    __m128i zero_8x16b = _mm_setzero_si128();
 1240|    181|    WORD32 i4_nnz, row_01, row_23;
 1241|    181|    WORD32 q0;
 1242|    181|    WORD16 i_macro;
 1243|    181|    WORD16 rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
  ------------------
  |  Branch (1243:23): [True: 8, False: 173]
  ------------------
 1244|    181|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|    181|#define UNUSED(x) ((void)(x))
  ------------------
 1245|       |
 1246|    181|    if(iq_start_idx == 0)
  ------------------
  |  Branch (1246:8): [True: 181, False: 0]
  ------------------
 1247|    181|    {
 1248|    181|        q0 = pi2_src[0];
 1249|    181|        INV_QUANT(q0, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|    181|                {\
  |  |  104|    181|                    i4_value *= quant_scale;\
  |  |  105|    181|                    i4_value *= weight_scale;\
  |  |  106|    181|                    i4_value += rndfactor;\
  |  |  107|    181|                    i4_value <<= u4_qp_div_6;\
  |  |  108|    181|                    i4_value >>= qbits;\
  |  |  109|    181|                }
  ------------------
 1250|    181|    }
 1251|      0|    else
 1252|      0|    {
 1253|      0|        q0 = pi2_dc_ld_addr[0];  // Restoring dc value for intra case3
 1254|      0|    }
 1255|    181|    i_macro = ((q0 + 32) >> 6);
 1256|       |
 1257|    181|    i_macro_8x16b = _mm_set1_epi16(i_macro);
 1258|    181|    dupmax_8x16b = _mm_set1_epi16(RSD_MAX);
  ------------------
  |  |  772|    181|#define RSD_MAX 255
  ------------------
 1259|    181|    dupmin_8x16b = _mm_set1_epi16(RSD_MIN);
  ------------------
  |  |  773|    181|#define RSD_MIN -255
  ------------------
 1260|       |
 1261|    181|    pred_16x8b_0 = _mm_loadu_si128((__m128i *) (pu1_pred));
 1262|    181|    pred_16x8b_1 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd));
 1263|    181|    pred_16x8b_2 = _mm_loadu_si128((__m128i *) (pu1_pred + (pred_strd << 1)));
 1264|    181|    pred_16x8b_3 = _mm_loadu_si128((__m128i *) (pu1_pred + (pred_strd << 1) + pred_strd));
 1265|       |
 1266|    181|    pred_8x16b_0 = _mm_cvtepu8_epi16(pred_16x8b_0);
 1267|    181|    pred_8x16b_1 = _mm_cvtepu8_epi16(pred_16x8b_1);
 1268|    181|    pred_8x16b_2 = _mm_cvtepu8_epi16(pred_16x8b_2);
 1269|    181|    pred_8x16b_3 = _mm_cvtepu8_epi16(pred_16x8b_3);
 1270|       |
 1271|    181|    rsd_8x16b_0 = _mm_loadu_si128((__m128i *) (pi2_rsd));
 1272|    181|    rsd_8x16b_1 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd));
 1273|    181|    rsd_8x16b_2 = _mm_loadu_si128((__m128i *) (pi2_rsd + (rsd_strd << 1)));
 1274|    181|    rsd_8x16b_3 = _mm_loadu_si128((__m128i *) (pi2_rsd + (rsd_strd << 1) + rsd_strd));
 1275|       |
 1276|    181|    rsd_8x16b_0 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_0);
 1277|    181|    rsd_8x16b_1 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_1);
 1278|    181|    rsd_8x16b_2 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_2);
 1279|    181|    rsd_8x16b_3 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_3);
 1280|       |
 1281|    181|    rsd_8x16b_0 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_0);
 1282|    181|    rsd_8x16b_0 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_0);
 1283|    181|    rsd_8x16b_1 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_1);
 1284|    181|    rsd_8x16b_1 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_1);
 1285|    181|    rsd_8x16b_2 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_2);
 1286|    181|    rsd_8x16b_2 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_2);
 1287|    181|    rsd_8x16b_3 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_3);
 1288|    181|    rsd_8x16b_3 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_3);
 1289|       |
 1290|    181|    rsd_8x16b_01 = _mm_unpacklo_epi64(rsd_8x16b_0, rsd_8x16b_1);
 1291|    181|    rsd_8x16b_23 = _mm_unpacklo_epi64(rsd_8x16b_2, rsd_8x16b_3);
 1292|       |
 1293|    181|    row_01 = _mm_test_all_ones(
 1294|    181|        _mm_cmpeq_epi16(rsd_8x16b_01, zero_8x16b));  // return 1 if all zeros, else 0
 1295|    181|    row_23 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_23, zero_8x16b));
 1296|       |
 1297|    181|    out_8x16b_0 = _mm_add_epi16(pred_8x16b_0, rsd_8x16b_0);
 1298|    181|    out_8x16b_1 = _mm_add_epi16(pred_8x16b_1, rsd_8x16b_1);
 1299|    181|    out_8x16b_2 = _mm_add_epi16(pred_8x16b_2, rsd_8x16b_2);
 1300|    181|    out_8x16b_3 = _mm_add_epi16(pred_8x16b_3, rsd_8x16b_3);
 1301|       |
 1302|    181|    out_16x8b_0 = _mm_packus_epi16(out_8x16b_0, zero_8x16b);
 1303|    181|    out_16x8b_1 = _mm_packus_epi16(out_8x16b_1, zero_8x16b);
 1304|    181|    out_16x8b_2 = _mm_packus_epi16(out_8x16b_2, zero_8x16b);
 1305|    181|    out_16x8b_3 = _mm_packus_epi16(out_8x16b_3, zero_8x16b);
 1306|       |
 1307|    181|    *((WORD32 *) (pu1_out)) = _mm_cvtsi128_si32(out_16x8b_0);
 1308|    181|    *((WORD32 *) (pu1_out + out_strd)) = _mm_cvtsi128_si32(out_16x8b_1);
 1309|    181|    *((WORD32 *) (pu1_out + (out_strd << 1))) = _mm_cvtsi128_si32(out_16x8b_2);
 1310|    181|    *((WORD32 *) (pu1_out + (out_strd * 3))) = _mm_cvtsi128_si32(out_16x8b_3);
 1311|       |
 1312|    181|    i4_nnz = !(row_01 && row_23);
  ------------------
  |  Branch (1312:16): [True: 8, False: 173]
  |  Branch (1312:26): [True: 8, False: 0]
  ------------------
 1313|    181|    return i4_nnz;
 1314|    181|}
isvcd_iquant_itrans_residual_recon_8x8_dc_sse42:
 1343|    181|{
 1344|    181|    __m128i pred_16x8b_0, pred_8x16b_0, rsd_8x16b_0, out_8x16b_0, out_16x8b_0;
 1345|    181|    __m128i pred_16x8b_1, pred_8x16b_1, rsd_8x16b_1, out_8x16b_1, out_16x8b_1;
 1346|    181|    __m128i pred_16x8b_2, pred_8x16b_2, rsd_8x16b_2, out_8x16b_2, out_16x8b_2;
 1347|    181|    __m128i pred_16x8b_3, pred_8x16b_3, rsd_8x16b_3, out_8x16b_3, out_16x8b_3;
 1348|    181|    __m128i pred_16x8b_4, pred_8x16b_4, rsd_8x16b_4, out_8x16b_4, out_16x8b_4;
 1349|    181|    __m128i pred_16x8b_5, pred_8x16b_5, rsd_8x16b_5, out_8x16b_5, out_16x8b_5;
 1350|    181|    __m128i pred_16x8b_6, pred_8x16b_6, rsd_8x16b_6, out_8x16b_6, out_16x8b_6;
 1351|    181|    __m128i pred_16x8b_7, pred_8x16b_7, rsd_8x16b_7, out_8x16b_7, out_16x8b_7;
 1352|    181|    __m128i rsd_8x16b_01_b0, rsd_8x16b_23_b0, rsd_8x16b_45_b2, rsd_8x16b_67_b2;
 1353|    181|    __m128i rsd_8x16b_01_b1, rsd_8x16b_23_b1, rsd_8x16b_45_b3, rsd_8x16b_67_b3;
 1354|       |
 1355|    181|    WORD32 row_01_b0, row_23_b0, row_45_b2, row_67_b2;
 1356|    181|    WORD32 row_01_b1, row_23_b1, row_45_b3, row_67_b3;
 1357|    181|    WORD32 i4_nnz, i4_nnz_b0, i4_nnz_b1, i4_nnz_b2, i4_nnz_b3;
 1358|       |
 1359|    181|    __m128i zero_8x16b = _mm_setzero_si128();
 1360|       |
 1361|    181|    WORD32 pred_strd2 = (pred_strd << 1);
 1362|    181|    WORD32 pred_strd4 = (pred_strd << 2);
 1363|    181|    WORD32 rsd_strd2 = (rsd_strd << 1);
 1364|    181|    WORD32 rsd_strd4 = (rsd_strd << 2);
 1365|    181|    WORD32 out_strd2 = (out_strd << 1);
 1366|    181|    WORD32 out_strd4 = (out_strd << 2);
 1367|       |
 1368|    181|    __m128i i_macro_8x16b, dupmax_8x16b, dupmin_8x16b;
 1369|    181|    WORD32 q;
 1370|    181|    WORD16 i_macro;
 1371|    181|    WORD32 rnd_fact = (qp_div < 6) ? (1 << (5 - qp_div)) : 0;
  ------------------
  |  Branch (1371:23): [True: 157, False: 24]
  ------------------
 1372|    181|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|    181|#define UNUSED(x) ((void)(x))
  ------------------
 1373|    181|    UNUSED(iq_start_idx);
  ------------------
  |  |   45|    181|#define UNUSED(x) ((void)(x))
  ------------------
 1374|    181|    UNUSED(pi2_dc_ld_addr);
  ------------------
  |  |   45|    181|#define UNUSED(x) ((void)(x))
  ------------------
 1375|       |    /*************************************************************/
 1376|       |    /* Dequantization of coefficients. Will be replaced by SIMD  */
 1377|       |    /* operations on platform. Note : DC coeff is not scaled     */
 1378|       |    /*************************************************************/
 1379|    181|    q = pi2_src[0];
 1380|    181|    INV_QUANT(q, pu2_iscale_mat[0], pu2_weigh_mat[0], qp_div, rnd_fact, 6);
  ------------------
  |  |  103|    181|                {\
  |  |  104|    181|                    i4_value *= quant_scale;\
  |  |  105|    181|                    i4_value *= weight_scale;\
  |  |  106|    181|                    i4_value += rndfactor;\
  |  |  107|    181|                    i4_value <<= u4_qp_div_6;\
  |  |  108|    181|                    i4_value >>= qbits;\
  |  |  109|    181|                }
  ------------------
 1381|    181|    i_macro = (q + 32) >> 6;
 1382|       |
 1383|    181|    i_macro_8x16b = _mm_set1_epi16(i_macro);
 1384|    181|    dupmax_8x16b = _mm_set1_epi16(RSD_MAX);
  ------------------
  |  |  772|    181|#define RSD_MAX 255
  ------------------
 1385|    181|    dupmin_8x16b = _mm_set1_epi16(RSD_MIN);
  ------------------
  |  |  773|    181|#define RSD_MIN -255
  ------------------
 1386|       |
 1387|    181|    pred_16x8b_0 = _mm_loadu_si128((__m128i *) (pu1_pred));
 1388|    181|    pred_16x8b_1 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd));
 1389|    181|    pred_16x8b_2 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd2));
 1390|    181|    pred_16x8b_3 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd2 + pred_strd));
 1391|    181|    pred_16x8b_4 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4));
 1392|    181|    pred_16x8b_5 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd));
 1393|    181|    pred_16x8b_6 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd2));
 1394|    181|    pred_16x8b_7 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd2 + pred_strd));
 1395|       |
 1396|    181|    pred_8x16b_0 = _mm_cvtepu8_epi16(pred_16x8b_0);
 1397|    181|    pred_8x16b_1 = _mm_cvtepu8_epi16(pred_16x8b_1);
 1398|    181|    pred_8x16b_2 = _mm_cvtepu8_epi16(pred_16x8b_2);
 1399|    181|    pred_8x16b_3 = _mm_cvtepu8_epi16(pred_16x8b_3);
 1400|    181|    pred_8x16b_4 = _mm_cvtepu8_epi16(pred_16x8b_4);
 1401|    181|    pred_8x16b_5 = _mm_cvtepu8_epi16(pred_16x8b_5);
 1402|    181|    pred_8x16b_6 = _mm_cvtepu8_epi16(pred_16x8b_6);
 1403|    181|    pred_8x16b_7 = _mm_cvtepu8_epi16(pred_16x8b_7);
 1404|       |
 1405|    181|    rsd_8x16b_0 = _mm_loadu_si128((__m128i *) (pi2_rsd));
 1406|    181|    rsd_8x16b_1 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd));
 1407|    181|    rsd_8x16b_2 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd2));
 1408|    181|    rsd_8x16b_3 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd2 + rsd_strd));
 1409|    181|    rsd_8x16b_4 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4));
 1410|    181|    rsd_8x16b_5 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd));
 1411|    181|    rsd_8x16b_6 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd2));
 1412|    181|    rsd_8x16b_7 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd2 + rsd_strd));
 1413|       |
 1414|    181|    rsd_8x16b_0 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_0);
 1415|    181|    rsd_8x16b_1 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_1);
 1416|    181|    rsd_8x16b_2 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_2);
 1417|    181|    rsd_8x16b_3 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_3);
 1418|    181|    rsd_8x16b_4 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_4);
 1419|    181|    rsd_8x16b_5 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_5);
 1420|    181|    rsd_8x16b_6 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_6);
 1421|    181|    rsd_8x16b_7 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_7);
 1422|       |
 1423|    181|    rsd_8x16b_0 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_0);
 1424|    181|    rsd_8x16b_0 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_0);
 1425|    181|    rsd_8x16b_1 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_1);
 1426|    181|    rsd_8x16b_1 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_1);
 1427|    181|    rsd_8x16b_2 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_2);
 1428|    181|    rsd_8x16b_2 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_2);
 1429|    181|    rsd_8x16b_3 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_3);
 1430|    181|    rsd_8x16b_3 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_3);
 1431|    181|    rsd_8x16b_4 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_4);
 1432|    181|    rsd_8x16b_4 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_4);
 1433|    181|    rsd_8x16b_5 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_5);
 1434|    181|    rsd_8x16b_5 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_5);
 1435|    181|    rsd_8x16b_6 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_6);
 1436|    181|    rsd_8x16b_6 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_6);
 1437|    181|    rsd_8x16b_7 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_7);
 1438|    181|    rsd_8x16b_7 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_7);
 1439|       |
 1440|    181|    rsd_8x16b_01_b0 = _mm_unpacklo_epi64(rsd_8x16b_0, rsd_8x16b_1);
 1441|    181|    rsd_8x16b_23_b0 = _mm_unpacklo_epi64(rsd_8x16b_2, rsd_8x16b_3);
 1442|    181|    rsd_8x16b_01_b1 = _mm_unpackhi_epi64(rsd_8x16b_0, rsd_8x16b_1);
 1443|    181|    rsd_8x16b_23_b1 = _mm_unpackhi_epi64(rsd_8x16b_2, rsd_8x16b_3);
 1444|       |
 1445|    181|    rsd_8x16b_45_b2 = _mm_unpacklo_epi64(rsd_8x16b_4, rsd_8x16b_5);
 1446|    181|    rsd_8x16b_67_b2 = _mm_unpacklo_epi64(rsd_8x16b_6, rsd_8x16b_7);
 1447|    181|    rsd_8x16b_45_b3 = _mm_unpackhi_epi64(rsd_8x16b_4, rsd_8x16b_5);
 1448|    181|    rsd_8x16b_67_b3 = _mm_unpackhi_epi64(rsd_8x16b_6, rsd_8x16b_7);
 1449|       |
 1450|    181|    row_01_b0 = _mm_test_all_ones(rsd_8x16b_01_b0);  // return 1 if all zeros, else 0
 1451|    181|    row_23_b0 = _mm_test_all_ones(rsd_8x16b_23_b0);
 1452|    181|    row_01_b1 = _mm_test_all_ones(rsd_8x16b_01_b1);
 1453|    181|    row_23_b1 = _mm_test_all_ones(rsd_8x16b_23_b1);
 1454|       |
 1455|    181|    row_45_b2 = _mm_test_all_ones(rsd_8x16b_45_b2);
 1456|    181|    row_67_b2 = _mm_test_all_ones(rsd_8x16b_67_b2);
 1457|    181|    row_45_b3 = _mm_test_all_ones(rsd_8x16b_45_b3);
 1458|    181|    row_67_b3 = _mm_test_all_ones(rsd_8x16b_67_b3);
 1459|       |
 1460|    181|    out_8x16b_0 = _mm_add_epi16(pred_8x16b_0, rsd_8x16b_0);
 1461|    181|    out_8x16b_1 = _mm_add_epi16(pred_8x16b_1, rsd_8x16b_1);
 1462|    181|    out_8x16b_2 = _mm_add_epi16(pred_8x16b_2, rsd_8x16b_2);
 1463|    181|    out_8x16b_3 = _mm_add_epi16(pred_8x16b_3, rsd_8x16b_3);
 1464|    181|    out_8x16b_4 = _mm_add_epi16(pred_8x16b_4, rsd_8x16b_4);
 1465|    181|    out_8x16b_5 = _mm_add_epi16(pred_8x16b_5, rsd_8x16b_5);
 1466|    181|    out_8x16b_6 = _mm_add_epi16(pred_8x16b_6, rsd_8x16b_6);
 1467|    181|    out_8x16b_7 = _mm_add_epi16(pred_8x16b_7, rsd_8x16b_7);
 1468|       |
 1469|    181|    out_16x8b_0 = _mm_packus_epi16(out_8x16b_0, zero_8x16b);
 1470|    181|    out_16x8b_1 = _mm_packus_epi16(out_8x16b_1, zero_8x16b);
 1471|    181|    out_16x8b_2 = _mm_packus_epi16(out_8x16b_2, zero_8x16b);
 1472|    181|    out_16x8b_3 = _mm_packus_epi16(out_8x16b_3, zero_8x16b);
 1473|    181|    out_16x8b_4 = _mm_packus_epi16(out_8x16b_4, zero_8x16b);
 1474|    181|    out_16x8b_5 = _mm_packus_epi16(out_8x16b_5, zero_8x16b);
 1475|    181|    out_16x8b_6 = _mm_packus_epi16(out_8x16b_6, zero_8x16b);
 1476|    181|    out_16x8b_7 = _mm_packus_epi16(out_8x16b_7, zero_8x16b);
 1477|       |
 1478|    181|    _mm_storel_epi64((__m128i *) (pu1_out), out_16x8b_0);
 1479|    181|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd), out_16x8b_1);
 1480|    181|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd2), out_16x8b_2);
 1481|    181|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd2 + out_strd), out_16x8b_3);
 1482|    181|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4), out_16x8b_4);
 1483|    181|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd), out_16x8b_5);
 1484|    181|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd2), out_16x8b_6);
 1485|    181|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd2 + out_strd), out_16x8b_7);
 1486|       |
 1487|    181|    i4_nnz_b0 = (!(row_01_b0 && row_23_b0));
  ------------------
  |  Branch (1487:20): [True: 36, False: 145]
  |  Branch (1487:33): [True: 36, False: 0]
  ------------------
 1488|    181|    i4_nnz_b1 = (!(row_01_b1 && row_23_b1)) << 1;
  ------------------
  |  Branch (1488:20): [True: 36, False: 145]
  |  Branch (1488:33): [True: 36, False: 0]
  ------------------
 1489|    181|    i4_nnz_b2 = (!(row_45_b2 && row_67_b2)) << 4;
  ------------------
  |  Branch (1489:20): [True: 36, False: 145]
  |  Branch (1489:33): [True: 36, False: 0]
  ------------------
 1490|    181|    i4_nnz_b3 = (!(row_45_b3 && row_67_b3)) << 5;
  ------------------
  |  Branch (1490:20): [True: 36, False: 145]
  |  Branch (1490:33): [True: 36, False: 0]
  ------------------
 1491|       |
 1492|    181|    i4_nnz = (i4_nnz_b0 | i4_nnz_b1 | i4_nnz_b2 | i4_nnz_b3);
 1493|    181|    return i4_nnz;
 1494|    181|}
isvcd_iquant_itrans_residual_recon_chroma_4x4_dc_sse42:
 1523|  57.0k|{
 1524|  57.0k|    __m128i pred_16x8b_0, pred_8x16b_0, rsd_8x16b_0, rsd_16x8b_0, out_16x8b_0;
 1525|  57.0k|    __m128i pred_16x8b_1, pred_8x16b_1, rsd_8x16b_1, rsd_16x8b_1, out_16x8b_1;
 1526|  57.0k|    __m128i pred_16x8b_2, pred_8x16b_2, rsd_8x16b_2, rsd_16x8b_2, out_16x8b_2;
 1527|  57.0k|    __m128i pred_16x8b_3, pred_8x16b_3, rsd_8x16b_3, rsd_16x8b_3, out_16x8b_3;
 1528|       |
 1529|  57.0k|    __m128i i_macro_8x16b, dupmax_8x16b, dupmin_8x16b;
 1530|  57.0k|    __m128i chroma_mask, chroma_mask2;
 1531|  57.0k|    __m128i zero_8x16b = _mm_setzero_si128();
 1532|  57.0k|    WORD32 q0;
 1533|  57.0k|    WORD16 i_macro;
 1534|  57.0k|    UNUSED(pi2_src);
  ------------------
  |  |   45|  57.0k|#define UNUSED(x) ((void)(x))
  ------------------
 1535|  57.0k|    UNUSED(pu2_iscal_mat);
  ------------------
  |  |   45|  57.0k|#define UNUSED(x) ((void)(x))
  ------------------
 1536|  57.0k|    UNUSED(pu2_weigh_mat);
  ------------------
  |  |   45|  57.0k|#define UNUSED(x) ((void)(x))
  ------------------
 1537|  57.0k|    UNUSED(u4_qp_div_6);
  ------------------
  |  |   45|  57.0k|#define UNUSED(x) ((void)(x))
  ------------------
 1538|  57.0k|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|  57.0k|#define UNUSED(x) ((void)(x))
  ------------------
 1539|       |
 1540|  57.0k|    q0 = pi2_dc_src[0];  // Restoring dc value for intra case3
 1541|  57.0k|    i_macro = ((q0 + 32) >> 6);
 1542|       |
 1543|  57.0k|    i_macro_8x16b = _mm_set1_epi16(i_macro);
 1544|  57.0k|    dupmax_8x16b = _mm_set1_epi16(RSD_MAX);
  ------------------
  |  |  772|  57.0k|#define RSD_MAX 255
  ------------------
 1545|  57.0k|    dupmin_8x16b = _mm_set1_epi16(RSD_MIN);
  ------------------
  |  |  773|  57.0k|#define RSD_MIN -255
  ------------------
 1546|       |
 1547|  57.0k|    pred_16x8b_0 = _mm_loadu_si128((__m128i *) (pu1_pred));
 1548|  57.0k|    pred_16x8b_1 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd));
 1549|  57.0k|    pred_16x8b_2 = _mm_loadu_si128((__m128i *) (pu1_pred + (pred_strd << 1)));
 1550|  57.0k|    pred_16x8b_3 = _mm_loadu_si128((__m128i *) (pu1_pred + (pred_strd << 1) + pred_strd));
 1551|       |
 1552|  57.0k|    pred_8x16b_0 = _mm_cvtepu8_epi16(pred_16x8b_0);
 1553|  57.0k|    pred_8x16b_1 = _mm_cvtepu8_epi16(pred_16x8b_1);
 1554|  57.0k|    pred_8x16b_2 = _mm_cvtepu8_epi16(pred_16x8b_2);
 1555|  57.0k|    pred_8x16b_3 = _mm_cvtepu8_epi16(pred_16x8b_3);
 1556|       |
 1557|  57.0k|    rsd_8x16b_0 = _mm_loadu_si128((__m128i *) (pi2_rsd));
 1558|  57.0k|    rsd_8x16b_1 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd));
 1559|  57.0k|    rsd_8x16b_2 = _mm_loadu_si128((__m128i *) (pi2_rsd + (rsd_strd << 1)));
 1560|  57.0k|    rsd_8x16b_3 = _mm_loadu_si128((__m128i *) (pi2_rsd + (rsd_strd << 1) + rsd_strd));
 1561|       |
 1562|  57.0k|    rsd_8x16b_0 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_0);
 1563|  57.0k|    rsd_8x16b_1 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_1);
 1564|  57.0k|    rsd_8x16b_2 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_2);
 1565|  57.0k|    rsd_8x16b_3 = _mm_add_epi16(i_macro_8x16b, rsd_8x16b_3);
 1566|       |
 1567|  57.0k|    rsd_8x16b_0 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_0);
 1568|  57.0k|    rsd_8x16b_0 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_0);
 1569|  57.0k|    rsd_8x16b_1 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_1);
 1570|  57.0k|    rsd_8x16b_1 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_1);
 1571|  57.0k|    rsd_8x16b_2 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_2);
 1572|  57.0k|    rsd_8x16b_2 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_2);
 1573|  57.0k|    rsd_8x16b_3 = _mm_min_epi16(dupmax_8x16b, rsd_8x16b_3);
 1574|  57.0k|    rsd_8x16b_3 = _mm_max_epi16(dupmin_8x16b, rsd_8x16b_3);
 1575|       |
 1576|  57.0k|    rsd_8x16b_0 = _mm_add_epi16(pred_8x16b_0, rsd_8x16b_0);
 1577|  57.0k|    rsd_8x16b_1 = _mm_add_epi16(pred_8x16b_1, rsd_8x16b_1);
 1578|  57.0k|    rsd_8x16b_2 = _mm_add_epi16(pred_8x16b_2, rsd_8x16b_2);
 1579|  57.0k|    rsd_8x16b_3 = _mm_add_epi16(pred_8x16b_3, rsd_8x16b_3);
 1580|       |
 1581|  57.0k|    chroma_mask = _mm_set1_epi16(0xFF00);
 1582|  57.0k|    chroma_mask2 = _mm_set1_epi16(0x00FF);
 1583|  57.0k|    out_16x8b_0 = _mm_loadu_si128((__m128i *) (&pu1_out[0]));
 1584|  57.0k|    out_16x8b_1 = _mm_loadu_si128((__m128i *) (&pu1_out[out_strd]));
 1585|  57.0k|    out_16x8b_2 = _mm_loadu_si128((__m128i *) (&pu1_out[(out_strd << 1)]));
 1586|  57.0k|    out_16x8b_3 = _mm_loadu_si128((__m128i *) (&pu1_out[(out_strd << 1) + out_strd]));
 1587|       |
 1588|  57.0k|    out_16x8b_0 = _mm_and_si128(out_16x8b_0, chroma_mask);
 1589|  57.0k|    out_16x8b_1 = _mm_and_si128(out_16x8b_1, chroma_mask);
 1590|  57.0k|    out_16x8b_2 = _mm_and_si128(out_16x8b_2, chroma_mask);
 1591|  57.0k|    out_16x8b_3 = _mm_and_si128(out_16x8b_3, chroma_mask);
 1592|       |
 1593|  57.0k|    rsd_16x8b_0 = _mm_packus_epi16(rsd_8x16b_0, zero_8x16b);
 1594|  57.0k|    rsd_16x8b_1 = _mm_packus_epi16(rsd_8x16b_1, zero_8x16b);
 1595|  57.0k|    rsd_16x8b_2 = _mm_packus_epi16(rsd_8x16b_2, zero_8x16b);
 1596|  57.0k|    rsd_16x8b_3 = _mm_packus_epi16(rsd_8x16b_3, zero_8x16b);
 1597|       |
 1598|  57.0k|    rsd_8x16b_0 = _mm_and_si128(rsd_16x8b_0, chroma_mask2);
 1599|  57.0k|    rsd_8x16b_1 = _mm_and_si128(rsd_16x8b_1, chroma_mask2);
 1600|  57.0k|    rsd_8x16b_2 = _mm_and_si128(rsd_16x8b_2, chroma_mask2);
 1601|  57.0k|    rsd_8x16b_3 = _mm_and_si128(rsd_16x8b_3, chroma_mask2);
 1602|       |
 1603|  57.0k|    out_16x8b_0 = _mm_add_epi8(rsd_8x16b_0, out_16x8b_0);
 1604|  57.0k|    out_16x8b_1 = _mm_add_epi8(rsd_8x16b_1, out_16x8b_1);
 1605|  57.0k|    out_16x8b_2 = _mm_add_epi8(rsd_8x16b_2, out_16x8b_2);
 1606|  57.0k|    out_16x8b_3 = _mm_add_epi8(rsd_8x16b_3, out_16x8b_3);
 1607|       |
 1608|  57.0k|    _mm_storel_epi64((__m128i *) (pu1_out), out_16x8b_0);
 1609|  57.0k|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd), out_16x8b_1);
 1610|  57.0k|    _mm_storel_epi64((__m128i *) (pu1_out + (out_strd << 1)), out_16x8b_2);
 1611|  57.0k|    _mm_storel_epi64((__m128i *) (pu1_out + (out_strd * 3)), out_16x8b_3);
 1612|  57.0k|}
isvcd_iquant_itrans_residual_recon_chroma_4x4_sse42:
 1641|  1.34k|{
 1642|  1.34k|    __m128i src_r0_r1, src_r2_r3;
 1643|  1.34k|    __m128i src_r0, src_r1, src_r2, src_r3;
 1644|  1.34k|    __m128i scalemat_r0_r1, scalemat_r2_r3;
 1645|  1.34k|    __m128i pred_r0, pred_r1, pred_r2, pred_r3;
 1646|  1.34k|    __m128i rsd_r0, rsd_r1, rsd_r2, rsd_r3;
 1647|  1.34k|    __m128i dequant_r0_r1, dequant_r2_r3;
 1648|  1.34k|    __m128i zero_8x16b = _mm_setzero_si128();  // all bits reset to zero
 1649|  1.34k|    __m128i temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
 1650|  1.34k|    __m128i resq_r0, resq_r1, resq_r2, resq_r3;
 1651|  1.34k|    __m128i add_rshift = _mm_set1_epi32((u4_qp_div_6 < 4) ? (1 << (3 - u4_qp_div_6)) : 0);
  ------------------
  |  Branch (1651:41): [True: 453, False: 895]
  ------------------
 1652|  1.34k|    __m128i value_32 = _mm_set1_epi32(32);
 1653|  1.34k|    __m128i chroma_mask = _mm_set1_epi16(0xFF00);
 1654|  1.34k|    __m128i chroma_mask2 = _mm_set1_epi16(0x00FF);
 1655|  1.34k|    __m128i dupmax_8x16b = _mm_set1_epi16(RSD_MAX);
  ------------------
  |  |  772|  1.34k|#define RSD_MAX 255
  ------------------
 1656|  1.34k|    __m128i dupmin_8x16b = _mm_set1_epi16(RSD_MIN);
  ------------------
  |  |  773|  1.34k|#define RSD_MIN -255
  ------------------
 1657|       |
 1658|  1.34k|    __m128i out_16x8b_0, out_16x8b_1, out_16x8b_2, out_16x8b_3;
 1659|       |
 1660|  1.34k|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|  1.34k|#define UNUSED(x) ((void)(x))
  ------------------
 1661|       |
 1662|       |    /*************************************************************/
 1663|       |    /* Dequantization of coefficients. Will be replaced by SIMD  */
 1664|       |    /* operations on platform                                    */
 1665|       |    /*************************************************************/
 1666|       |    // a00 a01 a02 a03 a10 a11 a12 a13  -- the source matrix 0th,1st row
 1667|  1.34k|    src_r0_r1 = _mm_loadu_si128((__m128i *) (pi2_src));
 1668|       |    // a20 a21 a22 a23 a30 a31 a32 a33 --  the source matrix 2nd,3rd row
 1669|  1.34k|    src_r2_r3 = _mm_loadu_si128((__m128i *) (pi2_src + 8));
 1670|       |    // b00 b01 b02 b03 b10 b11 b12 b13 -- the  scaling matrix 0th,1st row
 1671|  1.34k|    scalemat_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat));
 1672|       |    // b20 b21 b22 b23 b30 b31 b32 b33 -- the  scaling matrix 2nd,3rd row
 1673|  1.34k|    scalemat_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat + 8));
 1674|       |    // q00 q01 q02 q03 q10 q11  q12 q13 -- all 16 bits
 1675|  1.34k|    dequant_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat));
 1676|       |    // q20 q21 q22 q23 q30 q31 q32 q33 -- all 16 bits
 1677|  1.34k|    dequant_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat + 8));
 1678|       |
 1679|       |    // b00*q00 b01*q01 b02*q02 b03*q03 b10*q10  b11*q11 b12*q12 b13*q13 -- 16 bit result
 1680|  1.34k|    temp0 = _mm_mullo_epi16(scalemat_r0_r1, dequant_r0_r1);
 1681|       |    // b00*q00 b01*q01 b02*q02 b03*q03 b10*q10 b11*q11 b12*q12 b13*q13 -- 16 bit result
 1682|  1.34k|    temp1 = _mm_mullo_epi16(scalemat_r2_r3, dequant_r2_r3);
 1683|       |    // b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long
 1684|  1.34k|    temp4 = _mm_unpacklo_epi16(temp0, zero_8x16b);
 1685|       |    // b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long
 1686|  1.34k|    temp5 = _mm_unpackhi_epi16(temp0, zero_8x16b);
 1687|       |    // b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long
 1688|  1.34k|    temp6 = _mm_unpacklo_epi16(temp1, zero_8x16b);
 1689|       |    // b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long
 1690|  1.34k|    temp7 = _mm_unpackhi_epi16(temp1, zero_8x16b);
 1691|       |
 1692|  1.34k|    src_r0 = _mm_unpacklo_epi16(src_r0_r1, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
 1693|  1.34k|    src_r1 = _mm_unpackhi_epi16(src_r0_r1, zero_8x16b);  // a10 0 a11 0 a12 0 a13 0 -- 16 bit long
 1694|  1.34k|    src_r2 = _mm_unpacklo_epi16(src_r2_r3, zero_8x16b);  // a20 0 a21 0 a22 0 a23 0 -- 16 bit long
 1695|  1.34k|    src_r3 = _mm_unpackhi_epi16(src_r2_r3, zero_8x16b);  // a30 0 a31 0 a32 0 a33 0 -- 16 bit long
 1696|       |
 1697|       |    // a00*b00*q00 a10*b10*q10 a20*b20*q20 a30*b30 q30 -- 32 bits long
 1698|  1.34k|    temp4 = _mm_madd_epi16(src_r0, temp4);
 1699|  1.34k|    temp5 = _mm_madd_epi16(src_r1, temp5);
 1700|  1.34k|    temp6 = _mm_madd_epi16(src_r2, temp6);
 1701|  1.34k|    temp7 = _mm_madd_epi16(src_r3, temp7);
 1702|       |
 1703|  1.34k|    if(u4_qp_div_6 >= 4)
  ------------------
  |  Branch (1703:8): [True: 895, False: 453]
  ------------------
 1704|    895|    {
 1705|    895|        resq_r0 = _mm_slli_epi32(temp4, u4_qp_div_6 - 4);
 1706|    895|        resq_r1 = _mm_slli_epi32(temp5, u4_qp_div_6 - 4);
 1707|    895|        resq_r2 = _mm_slli_epi32(temp6, u4_qp_div_6 - 4);
 1708|    895|        resq_r3 = _mm_slli_epi32(temp7, u4_qp_div_6 - 4);
 1709|    895|    }
 1710|    453|    else
 1711|    453|    {
 1712|    453|        temp4 = _mm_add_epi32(temp4, add_rshift);
 1713|    453|        temp5 = _mm_add_epi32(temp5, add_rshift);
 1714|    453|        temp6 = _mm_add_epi32(temp6, add_rshift);
 1715|    453|        temp7 = _mm_add_epi32(temp7, add_rshift);
 1716|    453|        resq_r0 = _mm_srai_epi32(temp4, 4 - u4_qp_div_6);
 1717|    453|        resq_r1 = _mm_srai_epi32(temp5, 4 - u4_qp_div_6);
 1718|    453|        resq_r2 = _mm_srai_epi32(temp6, 4 - u4_qp_div_6);
 1719|    453|        resq_r3 = _mm_srai_epi32(temp7, 4 - u4_qp_div_6);
 1720|    453|    }
 1721|       |
 1722|  1.34k|    resq_r0 = _mm_insert_epi32(resq_r0, (WORD32) pi2_dc_src[0], 0);
 1723|       |    /* Perform Inverse transform */
 1724|       |    /*-------------------------------------------------------------*/
 1725|       |    /* IDCT [ Horizontal transformation ]                          */
 1726|       |    /*-------------------------------------------------------------*/
 1727|       |    // Matrix transpose
 1728|       |    /*
 1729|       |     *  a0 a1 a2 a3
 1730|       |     *  b0 b1 b2 b3
 1731|       |     *  c0 c1 c2 c3
 1732|       |     *  d0 d1 d2 d3
 1733|       |     */
 1734|  1.34k|    temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);  // a0 b0 a1 b1
 1735|  1.34k|    temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);  // c0 d0 c1 d1
 1736|  1.34k|    temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);  // a2 b2 a3 b3
 1737|  1.34k|    temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);  // c2 d2 c3 d3
 1738|  1.34k|    resq_r0 = _mm_unpacklo_epi64(temp1, temp3);    // a0 b0 c0 d0
 1739|  1.34k|    resq_r1 = _mm_unpackhi_epi64(temp1, temp3);    // a1 b1 c1 d1
 1740|  1.34k|    resq_r2 = _mm_unpacklo_epi64(temp2, temp4);    // a2 b2 c2 d2
 1741|  1.34k|    resq_r3 = _mm_unpackhi_epi64(temp2, temp4);    // a3 b3 c3 d3
 1742|       |    // Transform starts -- horizontal transform
 1743|       |    /*------------------------------------------------------------------*/
 1744|       |    /* z0 = w0 + w2                                             */
 1745|  1.34k|    temp0 = _mm_add_epi32(resq_r0, resq_r2);
 1746|       |    /* z1 = w0 - w2                                             */
 1747|  1.34k|    temp1 = _mm_sub_epi32(resq_r0, resq_r2);
 1748|       |    /* z2 = (w1 >> 1) - w3                                      */
 1749|  1.34k|    temp2 = _mm_srai_epi32(resq_r1, 1);     //(w1>>1)
 1750|  1.34k|    temp2 = _mm_sub_epi32(temp2, resq_r3);  //(w1>>1) - w3
 1751|       |    /* z3 = w1 + (w3 >> 1)                                      */
 1752|  1.34k|    temp3 = _mm_srai_epi32(resq_r3, 1);  //(w3>>1) + w1
 1753|  1.34k|    temp3 = _mm_add_epi32(temp3, resq_r1);
 1754|       |    /*----------------------------------------------------------*/
 1755|       |    /* x0 = z0 + z3                                             */
 1756|  1.34k|    resq_r0 = _mm_add_epi32(temp0, temp3);
 1757|       |    /* x1 = z1 + z2                                             */
 1758|  1.34k|    resq_r1 = _mm_add_epi32(temp1, temp2);
 1759|       |    /* x2 = z1 - z2                                             */
 1760|  1.34k|    resq_r2 = _mm_sub_epi32(temp1, temp2);
 1761|       |    /* x3 = z0 - z3                                             */
 1762|  1.34k|    resq_r3 = _mm_sub_epi32(temp0, temp3);
 1763|       |    // Matrix transpose
 1764|       |    /*
 1765|       |     *  a0 b0 c0 d0
 1766|       |     *  a1 b1 c1 d1
 1767|       |     *  a2 b2 c2 d2
 1768|       |     *  a3 b3 c3 d3
 1769|       |     */
 1770|  1.34k|    temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);  // a0 a1 b0 b1
 1771|  1.34k|    temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);  // a2 a3 b2 b3
 1772|  1.34k|    temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);  // c0 c1 d0 d1
 1773|  1.34k|    temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);  // c2 c3 d2 d3
 1774|  1.34k|    resq_r0 = _mm_unpacklo_epi64(temp1, temp3);    // a0 a1 a2 a3
 1775|  1.34k|    resq_r1 = _mm_unpackhi_epi64(temp1, temp3);    // b0 b1 b2 b3
 1776|  1.34k|    resq_r2 = _mm_unpacklo_epi64(temp2, temp4);    // c0 c1 c2 c3
 1777|  1.34k|    resq_r3 = _mm_unpackhi_epi64(temp2, temp4);    // d0 d1 d2 d3
 1778|       |    // Transform ends -- horizontal transform
 1779|       |
 1780|       |    // Load pred buffer
 1781|       |    // p00 p01 p02 p03 0 0 0 0 0 0 0 0 -- all 8 bits
 1782|  1.34k|    pred_r0 = _mm_loadl_epi64((__m128i *) (&pu1_pred[0]));
 1783|       |    // p10 p11 p12 p13 0 0 0 0 0 0 0 0 -- all 8 bits
 1784|  1.34k|    pred_r1 = _mm_loadl_epi64((__m128i *) (&pu1_pred[pred_strd]));
 1785|       |    // p20 p21 p22 p23 0 0 0 0 0 0 0 0 -- all 8 bits
 1786|  1.34k|    pred_r2 = _mm_loadl_epi64((__m128i *) (&pu1_pred[2 * pred_strd]));
 1787|       |    // p30 p31 p32 p33 0 0 0 0 0 0 0 0 -- all 8 bits
 1788|  1.34k|    pred_r3 = _mm_loadl_epi64((__m128i *) (&pu1_pred[3 * pred_strd]));
 1789|       |
 1790|  1.34k|    pred_r0 = _mm_cvtepu8_epi16(pred_r0);  // p00 p01 p02 p03 -- all 16 bits
 1791|  1.34k|    pred_r1 = _mm_cvtepu8_epi16(pred_r1);  // p10 p11 p12 p13 -- all 16 bits
 1792|  1.34k|    pred_r2 = _mm_cvtepu8_epi16(pred_r2);  // p20 p21 p22 p23 -- all 16 bits
 1793|  1.34k|    pred_r3 = _mm_cvtepu8_epi16(pred_r3);  // p30 p31 p32 p33 -- all 16 bits
 1794|       |
 1795|       |    // Load resd buffer
 1796|  1.34k|    rsd_r0 = _mm_loadu_si128((__m128i *) (&pi2_rsd[0]));
 1797|  1.34k|    rsd_r1 = _mm_loadu_si128((__m128i *) (&pi2_rsd[rsd_strd]));
 1798|  1.34k|    rsd_r2 = _mm_loadu_si128((__m128i *) (&pi2_rsd[2 * rsd_strd]));
 1799|  1.34k|    rsd_r3 = _mm_loadu_si128((__m128i *) (&pi2_rsd[3 * rsd_strd]));
 1800|       |
 1801|       |    /*--------------------------------------------------------------*/
 1802|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6      */
 1803|       |    /*                                                              */
 1804|       |    /* Add the prediction and store it back to same buffer          */
 1805|       |    /*--------------------------------------------------------------*/
 1806|       |    /* z0j = y0j + y2j                                                        */
 1807|  1.34k|    temp0 = _mm_add_epi32(resq_r0, resq_r2);
 1808|       |    /* z1j = y0j - y2j                                                        */
 1809|  1.34k|    temp1 = _mm_sub_epi32(resq_r0, resq_r2);
 1810|       |    /* z2j = (y1j>>1) - y3j */
 1811|  1.34k|    temp2 = _mm_srai_epi32(resq_r1, 1);  //(y1j>>1)
 1812|  1.34k|    temp2 = _mm_sub_epi32(temp2, resq_r3);
 1813|       |    /* z3j = y1j + (y3j>>1) */
 1814|  1.34k|    temp3 = _mm_srai_epi32(resq_r3, 1);  //(y3j>>1)
 1815|  1.34k|    temp3 = _mm_add_epi32(temp3, resq_r1);
 1816|       |
 1817|       |    /* x0j = z0j + z3j                                                        */
 1818|  1.34k|    temp4 = _mm_add_epi32(temp0, temp3);
 1819|  1.34k|    temp4 = _mm_add_epi32(temp4, value_32);
 1820|  1.34k|    temp4 = _mm_srai_epi32(temp4, 6);
 1821|  1.34k|    temp4 = _mm_add_epi16(temp4, rsd_r0);
 1822|  1.34k|    temp4 = _mm_min_epi16(dupmax_8x16b, temp4);
 1823|  1.34k|    temp4 = _mm_max_epi16(dupmin_8x16b, temp4);
 1824|  1.34k|    temp4 = _mm_add_epi16(temp4, pred_r0);
 1825|       |    /* x1j = z1j + z2j                                                        */
 1826|  1.34k|    temp5 = _mm_add_epi32(temp1, temp2);
 1827|  1.34k|    temp5 = _mm_add_epi32(temp5, value_32);
 1828|  1.34k|    temp5 = _mm_srai_epi32(temp5, 6);
 1829|  1.34k|    temp5 = _mm_add_epi16(temp5, rsd_r1);
 1830|  1.34k|    temp5 = _mm_min_epi16(dupmax_8x16b, temp5);
 1831|  1.34k|    temp5 = _mm_max_epi16(dupmin_8x16b, temp5);
 1832|  1.34k|    temp5 = _mm_add_epi16(temp5, pred_r1);
 1833|       |    /* x2j = z1j - z2j                                                        */
 1834|  1.34k|    temp6 = _mm_sub_epi32(temp1, temp2);
 1835|  1.34k|    temp6 = _mm_add_epi32(temp6, value_32);
 1836|  1.34k|    temp6 = _mm_srai_epi32(temp6, 6);
 1837|  1.34k|    temp6 = _mm_add_epi16(temp6, rsd_r2);
 1838|  1.34k|    temp6 = _mm_min_epi16(dupmax_8x16b, temp6);
 1839|  1.34k|    temp6 = _mm_max_epi16(dupmin_8x16b, temp6);
 1840|  1.34k|    temp6 = _mm_add_epi16(temp6, pred_r2);
 1841|       |    /* x3j = z0j - z3j                                                        */
 1842|  1.34k|    temp7 = _mm_sub_epi32(temp0, temp3);
 1843|  1.34k|    temp7 = _mm_add_epi32(temp7, value_32);
 1844|  1.34k|    temp7 = _mm_srai_epi32(temp7, 6);
 1845|  1.34k|    temp7 = _mm_add_epi16(temp7, rsd_r3);
 1846|  1.34k|    temp7 = _mm_min_epi16(dupmax_8x16b, temp7);
 1847|  1.34k|    temp7 = _mm_max_epi16(dupmin_8x16b, temp7);
 1848|  1.34k|    temp7 = _mm_add_epi16(temp7, pred_r3);
 1849|       |
 1850|  1.34k|    out_16x8b_0 = _mm_loadu_si128((__m128i *) (&pu1_out[0]));
 1851|  1.34k|    out_16x8b_1 = _mm_loadu_si128((__m128i *) (&pu1_out[out_strd]));
 1852|  1.34k|    out_16x8b_2 = _mm_loadu_si128((__m128i *) (&pu1_out[(out_strd << 1)]));
 1853|  1.34k|    out_16x8b_3 = _mm_loadu_si128((__m128i *) (&pu1_out[(out_strd << 1) + out_strd]));
 1854|       |
 1855|  1.34k|    out_16x8b_0 = _mm_and_si128(out_16x8b_0, chroma_mask);
 1856|  1.34k|    out_16x8b_1 = _mm_and_si128(out_16x8b_1, chroma_mask);
 1857|  1.34k|    out_16x8b_2 = _mm_and_si128(out_16x8b_2, chroma_mask);
 1858|  1.34k|    out_16x8b_3 = _mm_and_si128(out_16x8b_3, chroma_mask);
 1859|       |
 1860|  1.34k|    temp4 = _mm_packus_epi16(temp4, zero_8x16b);
 1861|  1.34k|    temp5 = _mm_packus_epi16(temp5, zero_8x16b);
 1862|  1.34k|    temp6 = _mm_packus_epi16(temp6, zero_8x16b);
 1863|  1.34k|    temp7 = _mm_packus_epi16(temp7, zero_8x16b);
 1864|       |
 1865|  1.34k|    temp4 = _mm_and_si128(temp4, chroma_mask2);
 1866|  1.34k|    temp5 = _mm_and_si128(temp5, chroma_mask2);
 1867|  1.34k|    temp6 = _mm_and_si128(temp6, chroma_mask2);
 1868|  1.34k|    temp7 = _mm_and_si128(temp7, chroma_mask2);
 1869|       |
 1870|  1.34k|    out_16x8b_0 = _mm_add_epi8(temp4, out_16x8b_0);
 1871|  1.34k|    out_16x8b_1 = _mm_add_epi8(temp5, out_16x8b_1);
 1872|  1.34k|    out_16x8b_2 = _mm_add_epi8(temp6, out_16x8b_2);
 1873|  1.34k|    out_16x8b_3 = _mm_add_epi8(temp7, out_16x8b_3);
 1874|       |
 1875|  1.34k|    _mm_storel_epi64((__m128i *) (pu1_out), out_16x8b_0);
 1876|  1.34k|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd), out_16x8b_1);
 1877|  1.34k|    _mm_storel_epi64((__m128i *) (pu1_out + (out_strd << 1)), out_16x8b_2);
 1878|  1.34k|    _mm_storel_epi64((__m128i *) (pu1_out + (out_strd * 3)), out_16x8b_3);
 1879|  1.34k|}

isvcd_iquant_itrans_4x4_dc_sse42:
   84|    277|{
   85|    277|    WORD32 q0;
   86|    277|    WORD16 rnd_fact = (u4_qp_div_6 < 4) ? 1 << (3 - u4_qp_div_6) : 0;
  ------------------
  |  Branch (86:23): [True: 23, False: 254]
  ------------------
   87|    277|    __m128i dupmax_8x16b = _mm_set1_epi16(RSD_MAX);
  ------------------
  |  |  772|    277|#define RSD_MAX 255
  ------------------
   88|    277|    __m128i dupmin_8x16b = _mm_set1_epi16(RSD_MIN);
  ------------------
  |  |  773|    277|#define RSD_MIN -255
  ------------------
   89|    277|    __m128i i_macro;
   90|    277|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|    277|#define UNUSED(x) ((void)(x))
  ------------------
   91|       |
   92|    277|    if(iq_start_idx == 0)
  ------------------
  |  Branch (92:8): [True: 277, False: 0]
  ------------------
   93|    277|    {
   94|    277|        q0 = pi2_src[0];
   95|    277|        INV_QUANT(q0, pu2_iscal_mat[0], pu2_weigh_mat[0], u4_qp_div_6, rnd_fact, 4);
  ------------------
  |  |  103|    277|                {\
  |  |  104|    277|                    i4_value *= quant_scale;\
  |  |  105|    277|                    i4_value *= weight_scale;\
  |  |  106|    277|                    i4_value += rndfactor;\
  |  |  107|    277|                    i4_value <<= u4_qp_div_6;\
  |  |  108|    277|                    i4_value >>= qbits;\
  |  |  109|    277|                }
  ------------------
   96|    277|    }
   97|      0|    else
   98|      0|    {
   99|      0|        q0 = pi2_dc_ld_addr[0];  // Restoring dc value for intra case3
  100|      0|    }
  101|       |
  102|    277|    i_macro = _mm_set1_epi16((q0 + 32) >> 6);
  103|    277|    i_macro = _mm_min_epi16(dupmax_8x16b, i_macro);
  104|    277|    i_macro = _mm_max_epi16(dupmin_8x16b, i_macro);
  105|       |
  106|    277|    _mm_storel_epi64((__m128i *) pi2_out, i_macro);
  107|    277|    pi2_out += out_strd;
  108|    277|    _mm_storel_epi64((__m128i *) pi2_out, i_macro);
  109|    277|    pi2_out += out_strd;
  110|    277|    _mm_storel_epi64((__m128i *) pi2_out, i_macro);
  111|    277|    pi2_out += out_strd;
  112|    277|    _mm_storel_epi64((__m128i *) pi2_out, i_macro);
  113|    277|}
isvcd_iquant_itrans_8x8_dc_sse42:
  142|     95|{
  143|     95|    WORD32 q;
  144|     95|    WORD32 rnd_fact = (qp_div < 6) ? (1 << (5 - qp_div)) : 0;
  ------------------
  |  Branch (144:23): [True: 88, False: 7]
  ------------------
  145|     95|    __m128i dupmin_8x16b, dupmax_8x16b, i_macro;
  146|       |
  147|     95|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|     95|#define UNUSED(x) ((void)(x))
  ------------------
  148|     95|    UNUSED(iq_start_idx);
  ------------------
  |  |   45|     95|#define UNUSED(x) ((void)(x))
  ------------------
  149|     95|    UNUSED(pi2_dc_ld_addr);
  ------------------
  |  |   45|     95|#define UNUSED(x) ((void)(x))
  ------------------
  150|       |
  151|     95|    q = pi2_src[0];
  152|     95|    INV_QUANT(q, pu2_iscale_mat[0], pu2_weigh_mat[0], qp_div, rnd_fact, 6);
  ------------------
  |  |  103|     95|                {\
  |  |  104|     95|                    i4_value *= quant_scale;\
  |  |  105|     95|                    i4_value *= weight_scale;\
  |  |  106|     95|                    i4_value += rndfactor;\
  |  |  107|     95|                    i4_value <<= u4_qp_div_6;\
  |  |  108|     95|                    i4_value >>= qbits;\
  |  |  109|     95|                }
  ------------------
  153|       |
  154|     95|    i_macro = _mm_set1_epi16((q + 32) >> 6);
  155|     95|    dupmax_8x16b = _mm_set1_epi16(RSD_MAX);
  ------------------
  |  |  772|     95|#define RSD_MAX 255
  ------------------
  156|     95|    dupmin_8x16b = _mm_set1_epi16(RSD_MIN);
  ------------------
  |  |  773|     95|#define RSD_MIN -255
  ------------------
  157|       |
  158|     95|    i_macro = _mm_min_epi16(dupmax_8x16b, i_macro);
  159|     95|    i_macro = _mm_max_epi16(dupmin_8x16b, i_macro);
  160|       |
  161|     95|    _mm_storeu_si128((__m128i *) pi2_out, i_macro);
  162|     95|    pi2_out += out_strd;
  163|     95|    _mm_storeu_si128((__m128i *) pi2_out, i_macro);
  164|     95|    pi2_out += out_strd;
  165|     95|    _mm_storeu_si128((__m128i *) pi2_out, i_macro);
  166|     95|    pi2_out += out_strd;
  167|     95|    _mm_storeu_si128((__m128i *) pi2_out, i_macro);
  168|     95|    pi2_out += out_strd;
  169|     95|    _mm_storeu_si128((__m128i *) pi2_out, i_macro);
  170|     95|    pi2_out += out_strd;
  171|     95|    _mm_storeu_si128((__m128i *) pi2_out, i_macro);
  172|     95|    pi2_out += out_strd;
  173|     95|    _mm_storeu_si128((__m128i *) pi2_out, i_macro);
  174|     95|    pi2_out += out_strd;
  175|     95|    _mm_storeu_si128((__m128i *) pi2_out, i_macro);
  176|     95|}
isvcd_iquant_itrans_chroma_4x4_dc_sse42:
  204|  1.43k|{
  205|  1.43k|    __m128i src_r0, src_r1, src_r2, src_r3;
  206|  1.43k|    __m128i i_macro = _mm_set1_epi16((pi2_dc_src[0] + 32) >> 6);
  207|  1.43k|    __m128i chroma_mask_even, chroma_mask_odd;
  208|  1.43k|    __m128i dupmax_8x16b = _mm_set1_epi16(RSD_MAX);
  ------------------
  |  |  772|  1.43k|#define RSD_MAX 255
  ------------------
  209|  1.43k|    __m128i dupmin_8x16b = _mm_set1_epi16(RSD_MIN);
  ------------------
  |  |  773|  1.43k|#define RSD_MIN -255
  ------------------
  210|       |
  211|  1.43k|    UNUSED(pi2_src);
  ------------------
  |  |   45|  1.43k|#define UNUSED(x) ((void)(x))
  ------------------
  212|  1.43k|    UNUSED(pu2_iscal_mat);
  ------------------
  |  |   45|  1.43k|#define UNUSED(x) ((void)(x))
  ------------------
  213|  1.43k|    UNUSED(pu2_weigh_mat);
  ------------------
  |  |   45|  1.43k|#define UNUSED(x) ((void)(x))
  ------------------
  214|  1.43k|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|  1.43k|#define UNUSED(x) ((void)(x))
  ------------------
  215|  1.43k|    UNUSED(u4_qp_div_6);
  ------------------
  |  |   45|  1.43k|#define UNUSED(x) ((void)(x))
  ------------------
  216|       |
  217|  1.43k|    i_macro = _mm_min_epi16(dupmax_8x16b, i_macro);
  218|  1.43k|    i_macro = _mm_max_epi16(dupmin_8x16b, i_macro);
  219|       |
  220|       |    // a00 a01 a02 a03 a10 a11 a12 a13 -- the source matrix 0th,1st row
  221|  1.43k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_out));
  222|       |    // a20 a21 a22 a23 a30 a31 a32 a33  -- the source matrix 2nd,3rd row
  223|  1.43k|    src_r1 = _mm_loadu_si128((__m128i *) (pi2_out + (1 * out_strd)));
  224|  1.43k|    src_r2 = _mm_loadu_si128((__m128i *) (pi2_out + (2 * out_strd)));
  225|  1.43k|    src_r3 = _mm_loadu_si128((__m128i *) (pi2_out + (3 * out_strd)));
  226|       |
  227|  1.43k|    chroma_mask_even =
  228|  1.43k|        _mm_set_epi16(0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff);
  229|  1.43k|    chroma_mask_odd = _mm_set_epi16(0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000);
  230|       |
  231|  1.43k|    src_r0 = _mm_and_si128(src_r0, chroma_mask_odd);  // 0 src1 0 src2 0 ...
  232|  1.43k|    src_r1 = _mm_and_si128(src_r1, chroma_mask_odd);
  233|  1.43k|    src_r2 = _mm_and_si128(src_r2, chroma_mask_odd);
  234|  1.43k|    src_r3 = _mm_and_si128(src_r3, chroma_mask_odd);
  235|       |
  236|  1.43k|    i_macro = _mm_and_si128(i_macro, chroma_mask_even);  // macro 0 macro 0 ..
  237|       |
  238|  1.43k|    src_r0 = _mm_add_epi16(src_r0, i_macro);             // macro  src1 macro src2 macro ...
  239|  1.43k|    src_r1 = _mm_add_epi16(src_r1, i_macro);
  240|  1.43k|    src_r2 = _mm_add_epi16(src_r2, i_macro);
  241|  1.43k|    src_r3 = _mm_add_epi16(src_r3, i_macro);
  242|       |
  243|  1.43k|    _mm_storeu_si128((__m128i *) (&pi2_out[0]), src_r0);
  244|  1.43k|    _mm_storeu_si128((__m128i *) (&pi2_out[out_strd]), src_r1);
  245|  1.43k|    _mm_storeu_si128((__m128i *) (&pi2_out[2 * out_strd]), src_r2);
  246|  1.43k|    _mm_storeu_si128((__m128i *) (&pi2_out[3 * out_strd]), src_r3);
  247|  1.43k|}
isvcd_iquant_itrans_4x4_sse42:
  275|  4.39k|{
  276|  4.39k|    __m128i src_r0_r1, src_r2_r3;
  277|  4.39k|    __m128i src_r0, src_r1, src_r2, src_r3;
  278|  4.39k|    __m128i scalemat_r0_r1, scalemat_r2_r3;
  279|  4.39k|    __m128i dequant_r0_r1, dequant_r2_r3;
  280|  4.39k|    __m128i zero_8x16b = _mm_setzero_si128();  // all bits reset to zero
  281|  4.39k|    __m128i temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
  282|  4.39k|    __m128i resq_r0, resq_r1, resq_r2, resq_r3;
  283|  4.39k|    __m128i add_rshift = _mm_set1_epi32((u4_qp_div_6 < 4) ? (1 << (3 - u4_qp_div_6)) : 0);
  ------------------
  |  Branch (283:41): [True: 886, False: 3.50k]
  ------------------
  284|  4.39k|    __m128i value_32 = _mm_set1_epi32(32);
  285|  4.39k|    __m128i dupmax_4x32b = _mm_set1_epi32(RSD_MAX);
  ------------------
  |  |  772|  4.39k|#define RSD_MAX 255
  ------------------
  286|  4.39k|    __m128i dupmin_4x32b = _mm_set1_epi32(RSD_MIN);
  ------------------
  |  |  773|  4.39k|#define RSD_MIN -255
  ------------------
  287|  4.39k|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|  4.39k|#define UNUSED(x) ((void)(x))
  ------------------
  288|       |
  289|       |    /*************************************************************/
  290|       |    /* Dequantization of coefficients. Will be replaced by SIMD  */
  291|       |    /* operations on platform                                    */
  292|       |    /*************************************************************/
  293|       |    // a00 a01 a02 a03 a10 a11 a12 a13 -- the source matrix 0th,1st row
  294|  4.39k|    src_r0_r1 = _mm_loadu_si128((__m128i *) (pi2_src));
  295|       |    // a20 a21 a22 a23 a30 a31 a32 a33 -- the source matrix 2nd,3rd row
  296|  4.39k|    src_r2_r3 = _mm_loadu_si128((__m128i *) (pi2_src + 8));
  297|       |    // b00 b01 b02 b03 b10 b11 b12 b13 -- the scaling matrix 0th,1st row
  298|  4.39k|    scalemat_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat));
  299|       |    // b20 b21 b22 b23 b30 b31 b32 b33 -- the scaling matrix 2nd,3rd row
  300|  4.39k|    scalemat_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat + 8));
  301|       |    // q00 q01 q02 q03 q10 q11 q12 q13 -- all 16 bits
  302|  4.39k|    dequant_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat));
  303|       |    // q20 q21 q22 q23 q30 q31 q32 q33 -- all 16 bits
  304|  4.39k|    dequant_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat + 8));
  305|       |
  306|       |    // b00*q00 b01*q01 b02*q02 b03*q03 b10*q10 b11*q11 b12*q12 b13*q13 -- 16 bit result
  307|  4.39k|    temp0 = _mm_mullo_epi16(scalemat_r0_r1, dequant_r0_r1);
  308|       |    // b00*q00 b01*q01 b02*q02 b03*q03 b10*q10 b11*q11 b12*q12 b13*q13 -- 16 bit result
  309|  4.39k|    temp1 = _mm_mullo_epi16(scalemat_r2_r3, dequant_r2_r3);
  310|       |
  311|       |    // b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long
  312|  4.39k|    temp4 = _mm_unpacklo_epi16(temp0, zero_8x16b);
  313|       |    // b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long
  314|  4.39k|    temp5 = _mm_unpackhi_epi16(temp0, zero_8x16b);
  315|       |    // b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long
  316|  4.39k|    temp6 = _mm_unpacklo_epi16(temp1, zero_8x16b);
  317|       |    // b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long
  318|  4.39k|    temp7 = _mm_unpackhi_epi16(temp1, zero_8x16b);
  319|       |
  320|  4.39k|    src_r0 = _mm_unpacklo_epi16(src_r0_r1, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  321|  4.39k|    src_r1 = _mm_unpackhi_epi16(src_r0_r1, zero_8x16b);  // a10 0 a11 0 a12 0 a13 0 -- 16 bit long
  322|  4.39k|    src_r2 = _mm_unpacklo_epi16(src_r2_r3, zero_8x16b);  // a20 0 a21 0 a22 0 a23 0 -- 16 bit long
  323|  4.39k|    src_r3 = _mm_unpackhi_epi16(src_r2_r3, zero_8x16b);  // a30 0 a31 0 a32 0 a33 0 -- 16 bit long
  324|       |
  325|       |    // a00*b00*q00 a10*b10*q10 a20*b20*q20 a30*b30 q30 -- 32 bits long
  326|  4.39k|    temp4 = _mm_madd_epi16(src_r0, temp4);
  327|  4.39k|    temp5 = _mm_madd_epi16(src_r1, temp5);
  328|  4.39k|    temp6 = _mm_madd_epi16(src_r2, temp6);
  329|  4.39k|    temp7 = _mm_madd_epi16(src_r3, temp7);
  330|       |
  331|  4.39k|    if(u4_qp_div_6 >= 4)
  ------------------
  |  Branch (331:8): [True: 3.50k, False: 886]
  ------------------
  332|  3.50k|    {
  333|  3.50k|        resq_r0 = _mm_slli_epi32(temp4, u4_qp_div_6 - 4);
  334|  3.50k|        resq_r1 = _mm_slli_epi32(temp5, u4_qp_div_6 - 4);
  335|  3.50k|        resq_r2 = _mm_slli_epi32(temp6, u4_qp_div_6 - 4);
  336|  3.50k|        resq_r3 = _mm_slli_epi32(temp7, u4_qp_div_6 - 4);
  337|  3.50k|    }
  338|    886|    else
  339|    886|    {
  340|    886|        temp4 = _mm_add_epi32(temp4, add_rshift);
  341|    886|        temp5 = _mm_add_epi32(temp5, add_rshift);
  342|    886|        temp6 = _mm_add_epi32(temp6, add_rshift);
  343|    886|        temp7 = _mm_add_epi32(temp7, add_rshift);
  344|    886|        resq_r0 = _mm_srai_epi32(temp4, 4 - u4_qp_div_6);
  345|    886|        resq_r1 = _mm_srai_epi32(temp5, 4 - u4_qp_div_6);
  346|    886|        resq_r2 = _mm_srai_epi32(temp6, 4 - u4_qp_div_6);
  347|    886|        resq_r3 = _mm_srai_epi32(temp7, 4 - u4_qp_div_6);
  348|    886|    }
  349|       |
  350|  4.39k|    if(iq_start_idx == 1) resq_r0 = _mm_insert_epi32(resq_r0, (WORD32) pi2_dc_ld_addr[0], 0);
  ------------------
  |  Branch (350:8): [True: 0, False: 4.39k]
  ------------------
  351|       |    /* Perform Inverse transform */
  352|       |    /*-------------------------------------------------------------*/
  353|       |    /* IDCT [ Horizontal transformation ]                          */
  354|       |    /*-------------------------------------------------------------*/
  355|       |    // Matrix transpose
  356|       |    /*
  357|       |     *  a0 a1 a2 a3
  358|       |     *  b0 b1 b2 b3
  359|       |     *  c0 c1 c2 c3
  360|       |     *  d0 d1 d2 d3
  361|       |     */
  362|  4.39k|    temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);  // a0 b0 a1 b1
  363|  4.39k|    temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);  // c0 d0 c1 d1
  364|  4.39k|    temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);  // a2 b2 a3 b3
  365|  4.39k|    temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);  // c2 d2 c3 d3
  366|  4.39k|    resq_r0 = _mm_unpacklo_epi64(temp1, temp3);    // a0 b0 c0 d0
  367|  4.39k|    resq_r1 = _mm_unpackhi_epi64(temp1, temp3);    // a1 b1 c1 d1
  368|  4.39k|    resq_r2 = _mm_unpacklo_epi64(temp2, temp4);    // a2 b2 c2 d2
  369|  4.39k|    resq_r3 = _mm_unpackhi_epi64(temp2, temp4);    // a3 b3 c3 d3
  370|       |    // Transform starts -- horizontal transform
  371|       |    /*------------------------------------------------------------------*/
  372|       |    /* z0 = w0 + w2                                             */
  373|  4.39k|    temp0 = _mm_add_epi32(resq_r0, resq_r2);
  374|       |    /* z1 = w0 - w2                                             */
  375|  4.39k|    temp1 = _mm_sub_epi32(resq_r0, resq_r2);
  376|       |    /* z2 = (w1 >> 1) - w3                                      */
  377|  4.39k|    temp2 = _mm_srai_epi32(resq_r1, 1);     //(w1>>1)
  378|  4.39k|    temp2 = _mm_sub_epi32(temp2, resq_r3);  //(w1>>1) - w3
  379|       |    /* z3 = w1 + (w3 >> 1)                                      */
  380|  4.39k|    temp3 = _mm_srai_epi32(resq_r3, 1);  //(w3>>1) + w1
  381|  4.39k|    temp3 = _mm_add_epi32(temp3, resq_r1);
  382|       |    /*----------------------------------------------------------*/
  383|       |    /* x0 = z0 + z3                                             */
  384|  4.39k|    resq_r0 = _mm_add_epi32(temp0, temp3);
  385|       |    /* x1 = z1 + z2                                             */
  386|  4.39k|    resq_r1 = _mm_add_epi32(temp1, temp2);
  387|       |    /* x2 = z1 - z2                                             */
  388|  4.39k|    resq_r2 = _mm_sub_epi32(temp1, temp2);
  389|       |    /* x3 = z0 - z3                                             */
  390|  4.39k|    resq_r3 = _mm_sub_epi32(temp0, temp3);
  391|       |    // Matrix transpose
  392|       |    /*
  393|       |     *  a0 b0 c0 d0
  394|       |     *  a1 b1 c1 d1
  395|       |     *  a2 b2 c2 d2
  396|       |     *  a3 b3 c3 d3
  397|       |     */
  398|  4.39k|    temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);  // a0 a1 b0 b1
  399|  4.39k|    temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);  // a2 a3 b2 b3
  400|  4.39k|    temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);  // c0 c1 d0 d1
  401|  4.39k|    temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);  // c2 c3 d2 d3
  402|  4.39k|    resq_r0 = _mm_unpacklo_epi64(temp1, temp3);    // a0 a1 a2 a3
  403|  4.39k|    resq_r1 = _mm_unpackhi_epi64(temp1, temp3);    // b0 b1 b2 b3
  404|  4.39k|    resq_r2 = _mm_unpacklo_epi64(temp2, temp4);    // c0 c1 c2 c3
  405|  4.39k|    resq_r3 = _mm_unpackhi_epi64(temp2, temp4);    // d0 d1 d2 d3
  406|       |    // Transform ends -- horizontal transform
  407|       |
  408|       |    /*--------------------------------------------------------------*/
  409|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6      */
  410|       |    /*                                                              */
  411|       |    /* Add the prediction and store it back to same buffer          */
  412|       |    /*--------------------------------------------------------------*/
  413|       |    /* z0j = y0j + y2j                                                        */
  414|  4.39k|    temp0 = _mm_add_epi32(resq_r0, resq_r2);
  415|       |    /* z1j = y0j - y2j                                                        */
  416|  4.39k|    temp1 = _mm_sub_epi32(resq_r0, resq_r2);
  417|       |    /* z2j = (y1j>>1) - y3j */
  418|  4.39k|    temp2 = _mm_srai_epi32(resq_r1, 1);  //(y1j>>1)
  419|  4.39k|    temp2 = _mm_sub_epi32(temp2, resq_r3);
  420|       |    /* z3j = y1j + (y3j>>1) */
  421|  4.39k|    temp3 = _mm_srai_epi32(resq_r3, 1);  //(y3j>>1)
  422|  4.39k|    temp3 = _mm_add_epi32(temp3, resq_r1);
  423|       |
  424|       |    /* x0j = z0j + z3j                                                        */
  425|  4.39k|    temp4 = _mm_add_epi32(temp0, temp3);
  426|  4.39k|    temp4 = _mm_add_epi32(temp4, value_32);
  427|  4.39k|    temp4 = _mm_srai_epi32(temp4, 6);
  428|  4.39k|    temp4 = _mm_min_epi32(dupmax_4x32b, temp4);
  429|  4.39k|    temp4 = _mm_max_epi32(dupmin_4x32b, temp4);
  430|       |
  431|       |    /* x1j = z1j + z2j                                                        */
  432|  4.39k|    temp5 = _mm_add_epi32(temp1, temp2);
  433|  4.39k|    temp5 = _mm_add_epi32(temp5, value_32);
  434|  4.39k|    temp5 = _mm_srai_epi32(temp5, 6);
  435|  4.39k|    temp5 = _mm_min_epi32(dupmax_4x32b, temp5);
  436|  4.39k|    temp5 = _mm_max_epi32(dupmin_4x32b, temp5);
  437|       |
  438|       |    /* x2j = z1j - z2j                                                        */
  439|  4.39k|    temp6 = _mm_sub_epi32(temp1, temp2);
  440|  4.39k|    temp6 = _mm_add_epi32(temp6, value_32);
  441|  4.39k|    temp6 = _mm_srai_epi32(temp6, 6);
  442|  4.39k|    temp6 = _mm_min_epi32(dupmax_4x32b, temp6);
  443|  4.39k|    temp6 = _mm_max_epi32(dupmin_4x32b, temp6);
  444|       |
  445|       |    /* x3j = z0j - z3j                                                        */
  446|  4.39k|    temp7 = _mm_sub_epi32(temp0, temp3);
  447|  4.39k|    temp7 = _mm_add_epi32(temp7, value_32);
  448|  4.39k|    temp7 = _mm_srai_epi32(temp7, 6);
  449|  4.39k|    temp7 = _mm_min_epi32(dupmax_4x32b, temp7);
  450|  4.39k|    temp7 = _mm_max_epi32(dupmin_4x32b, temp7);
  451|       |
  452|       |    // 32-bit to 16-bit conversion
  453|  4.39k|    temp0 = _mm_packs_epi32(temp4, temp5);
  454|  4.39k|    temp1 = _mm_packs_epi32(temp6, temp7);
  455|       |
  456|  4.39k|    resq_r0 = temp0;
  457|  4.39k|    resq_r1 = _mm_srli_si128(temp0, 8);
  458|  4.39k|    resq_r2 = temp1;
  459|  4.39k|    resq_r3 = _mm_srli_si128(temp1, 8);
  460|       |
  461|  4.39k|    _mm_storel_epi64((__m128i *) pi2_out, resq_r0);
  462|  4.39k|    pi2_out += out_strd;
  463|  4.39k|    _mm_storel_epi64((__m128i *) pi2_out, resq_r1);
  464|  4.39k|    pi2_out += out_strd;
  465|  4.39k|    _mm_storel_epi64((__m128i *) pi2_out, resq_r2);
  466|  4.39k|    pi2_out += out_strd;
  467|  4.39k|    _mm_storel_epi64((__m128i *) pi2_out, resq_r3);
  468|  4.39k|}
isvcd_iquant_itrans_8x8_sse42:
  497|  1.15k|{
  498|  1.15k|    __m128i src_r0;
  499|  1.15k|    __m128i scalemat_r0;
  500|  1.15k|    __m128i zero_8x16b = _mm_setzero_si128();  // all bits reset to zero
  501|  1.15k|    __m128i value_32 = _mm_set1_epi32(32);
  502|  1.15k|    __m128i add_rshift = _mm_set1_epi32((qp_div < 6) ? (1 << (5 - qp_div)) : 0);
  ------------------
  |  Branch (502:41): [True: 1.05k, False: 95]
  ------------------
  503|  1.15k|    __m128i dequant_r0;
  504|  1.15k|    __m128i sign_reg;
  505|  1.15k|    __m128i src_r0_1, src_r0_2;
  506|  1.15k|    __m128i scalemat_r0_1, scalemat_r0_2;
  507|  1.15k|    __m128i temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8;
  508|  1.15k|    __m128i temp10, temp11, temp12, temp13, temp14, temp15, temp16, temp17, temp18, temp19, temp20;
  509|       |    // To store dequantization results
  510|  1.15k|    __m128i resq_r0_1, resq_r0_2, resq_r1_1, resq_r1_2, resq_r2_1, resq_r2_2, resq_r3_1, resq_r3_2,
  511|  1.15k|        resq_r4_1, resq_r4_2, resq_r5_1, resq_r5_2, resq_r6_1, resq_r6_2, resq_r7_1, resq_r7_2;
  512|  1.15k|    __m128i dupmax_4x32b = _mm_set1_epi32(RSD_MAX);
  ------------------
  |  |  772|  1.15k|#define RSD_MAX 255
  ------------------
  513|  1.15k|    __m128i dupmin_4x32b = _mm_set1_epi32(RSD_MIN);
  ------------------
  |  |  773|  1.15k|#define RSD_MIN -255
  ------------------
  514|       |
  515|  1.15k|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|  1.15k|#define UNUSED(x) ((void)(x))
  ------------------
  516|  1.15k|    UNUSED(iq_start_idx);
  ------------------
  |  |   45|  1.15k|#define UNUSED(x) ((void)(x))
  ------------------
  517|  1.15k|    UNUSED(pi2_dc_ld_addr);
  ------------------
  |  |   45|  1.15k|#define UNUSED(x) ((void)(x))
  ------------------
  518|       |
  519|       |    /*************************************************************/
  520|       |    /* Dequantization of coefficients. Will be replaced by SIMD  */
  521|       |    /* operations on platform. Note : DC coeff is not scaled     */
  522|       |    /*************************************************************/
  523|       |
  524|       |    // Row 0 processing
  525|       |    // a00 a01 a02 a03 a04 a05 a06 a07 -- the source matrix 0th row
  526|  1.15k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src));
  527|       |    // b00 b01 b02 b03 b04 b05 b06 b07 -- the scaling matrix 0th row
  528|  1.15k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat));
  529|  1.15k|    dequant_r0 =
  530|  1.15k|        _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[0]));  // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  531|  1.15k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);     // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  532|  1.15k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);     // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  533|       |    // b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  534|  1.15k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  535|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  536|  1.15k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  537|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  538|  1.15k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  539|       |
  540|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  541|  1.15k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  542|       |    // a04*b04*q4 a05*b05*q5 a06*b06*q6  a07*b07*q7 -- 32 bits long
  543|  1.15k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  544|       |
  545|  1.15k|    if(qp_div >= 6)
  ------------------
  |  Branch (545:8): [True: 95, False: 1.05k]
  ------------------
  546|     95|    {
  547|     95|        resq_r0_1 = _mm_slli_epi32(temp5, qp_div - 6);
  548|     95|        resq_r0_2 = _mm_slli_epi32(temp7, qp_div - 6);
  549|     95|    }
  550|  1.05k|    else
  551|  1.05k|    {
  552|  1.05k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  553|  1.05k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  554|  1.05k|        resq_r0_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  555|  1.05k|        resq_r0_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  556|  1.05k|    }
  557|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 16
  558|       |    // bit long
  559|  1.15k|    resq_r0_1 = _mm_packs_epi32(resq_r0_1, resq_r0_2);
  560|       |    // Row 1 processing
  561|       |    // a00 a01 a02 a03 a04 a05 a06 a07 a08 -- the source matrix 1st row
  562|  1.15k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 8));
  563|       |    // b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 1st row
  564|  1.15k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 8));
  565|       |    // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  566|  1.15k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[8]));
  567|  1.15k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  568|  1.15k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);  // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  569|       |    // b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  570|  1.15k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  571|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  572|  1.15k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  573|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  574|  1.15k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  575|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  576|  1.15k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  577|       |    // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  578|  1.15k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  579|  1.15k|    if(qp_div >= 6)
  ------------------
  |  Branch (579:8): [True: 95, False: 1.05k]
  ------------------
  580|     95|    {
  581|     95|        resq_r1_1 = _mm_slli_epi32(temp5, qp_div - 6);
  582|     95|        resq_r1_2 = _mm_slli_epi32(temp7, qp_div - 6);
  583|     95|    }
  584|  1.05k|    else
  585|  1.05k|    {
  586|  1.05k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  587|  1.05k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  588|  1.05k|        resq_r1_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  589|  1.05k|        resq_r1_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  590|  1.05k|    }
  591|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7
  592|  1.15k|    resq_r1_1 = _mm_packs_epi32(resq_r1_1, resq_r1_2);
  593|       |    // Row 2 processing
  594|       |    // a00 a01 a02 a03 a04 a05 a06 a07 a08 -- the source matrix 2nd row
  595|  1.15k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 16));
  596|       |    // b00 b01 b02 b03 b04 b05 b06 b07 b08-- the scaling matrix 2nd row
  597|  1.15k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 16));
  598|       |    // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  599|  1.15k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[16]));
  600|  1.15k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  601|  1.15k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);  // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  602|       |    // b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  603|  1.15k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  604|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  605|  1.15k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  606|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  607|  1.15k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  608|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  609|  1.15k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  610|       |    // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  611|  1.15k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  612|  1.15k|    if(qp_div >= 6)
  ------------------
  |  Branch (612:8): [True: 95, False: 1.05k]
  ------------------
  613|     95|    {
  614|     95|        resq_r2_1 = _mm_slli_epi32(temp5, qp_div - 6);
  615|     95|        resq_r2_2 = _mm_slli_epi32(temp7, qp_div - 6);
  616|     95|    }
  617|  1.05k|    else
  618|  1.05k|    {
  619|  1.05k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  620|  1.05k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  621|  1.05k|        resq_r2_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  622|  1.05k|        resq_r2_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  623|  1.05k|    }
  624|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7
  625|  1.15k|    resq_r2_1 = _mm_packs_epi32(resq_r2_1, resq_r2_2);
  626|       |    // Row 3 processing
  627|       |    // a00 a01 a02 a03 a04 a05 a06 a07 a08 -- the source matrix 3rd row
  628|  1.15k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 24));
  629|       |    // b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 3rd row
  630|  1.15k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 24));
  631|       |    // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  632|  1.15k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[24]));
  633|  1.15k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  634|       |    // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  635|  1.15k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);
  636|       |    // b00*q0 b01*q1 b02*q2 b03*q3 b04*q4  b05*q5 b06*q6 b07*q7 -- 16 bit result
  637|  1.15k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  638|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  639|  1.15k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  640|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  641|  1.15k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  642|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 - 32 bits long
  643|  1.15k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  644|       |    // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  645|  1.15k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  646|  1.15k|    if(qp_div >= 6)
  ------------------
  |  Branch (646:8): [True: 95, False: 1.05k]
  ------------------
  647|     95|    {
  648|     95|        resq_r3_1 = _mm_slli_epi32(temp5, qp_div - 6);
  649|     95|        resq_r3_2 = _mm_slli_epi32(temp7, qp_div - 6);
  650|     95|    }
  651|  1.05k|    else
  652|  1.05k|    {
  653|  1.05k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  654|  1.05k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  655|  1.05k|        resq_r3_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  656|  1.05k|        resq_r3_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  657|  1.05k|    }
  658|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4  a05*b05*q5 a06*b06*q6 a07*b07*q7
  659|  1.15k|    resq_r3_1 = _mm_packs_epi32(resq_r3_1, resq_r3_2);
  660|       |    // Row 4 processing
  661|       |    // a00 a01 a02 a03 a04 a05 a06 a07 a08 --  the source matrix 4th row
  662|  1.15k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 32));
  663|       |    // b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 4th row
  664|  1.15k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 32));
  665|  1.15k|    dequant_r0 = _mm_loadu_si128(
  666|  1.15k|        (__m128i *) (&pu2_weigh_mat[32]));              // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  667|  1.15k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  668|  1.15k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);  // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  669|       |    // b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result
  670|  1.15k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  671|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  672|  1.15k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  673|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  674|  1.15k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  675|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  676|  1.15k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  677|       |    // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  678|  1.15k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  679|  1.15k|    if(qp_div >= 6)
  ------------------
  |  Branch (679:8): [True: 95, False: 1.05k]
  ------------------
  680|     95|    {
  681|     95|        resq_r4_1 = _mm_slli_epi32(temp5, qp_div - 6);
  682|     95|        resq_r4_2 = _mm_slli_epi32(temp7, qp_div - 6);
  683|     95|    }
  684|  1.05k|    else
  685|  1.05k|    {
  686|  1.05k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  687|  1.05k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  688|  1.05k|        resq_r4_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  689|  1.05k|        resq_r4_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  690|  1.05k|    }
  691|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7
  692|  1.15k|    resq_r4_1 = _mm_packs_epi32(resq_r4_1, resq_r4_2);
  693|       |    // Row 5 processing
  694|       |    // a00 a01 a02 a03 a04 a05 a06 a07 a08 -- the source matrix 5th row
  695|  1.15k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 40));
  696|       |    // b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 5th row
  697|  1.15k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 40));
  698|       |    // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  699|  1.15k|    dequant_r0 = _mm_loadu_si128((__m128i *) (&pu2_weigh_mat[40]));
  700|  1.15k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  701|  1.15k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);  // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  702|       |    // b00*q0 b01*q1 b02*q2 b03*q3 b04*q4  b05*q5 b06*q6 b07*q7 -- 16 bit result
  703|  1.15k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  704|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  705|  1.15k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  706|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  707|  1.15k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  708|       |    // a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long
  709|  1.15k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  710|       |    // a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long
  711|  1.15k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  712|  1.15k|    if(qp_div >= 6)
  ------------------
  |  Branch (712:8): [True: 95, False: 1.05k]
  ------------------
  713|     95|    {
  714|     95|        resq_r5_1 = _mm_slli_epi32(temp5, qp_div - 6);
  715|     95|        resq_r5_2 = _mm_slli_epi32(temp7, qp_div - 6);
  716|     95|    }
  717|  1.05k|    else
  718|  1.05k|    {
  719|  1.05k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  720|  1.05k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  721|  1.05k|        resq_r5_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  722|  1.05k|        resq_r5_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  723|  1.05k|    }
  724|       |    /* a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 */
  725|  1.15k|    resq_r5_1 = _mm_packs_epi32(resq_r5_1, resq_r5_2);
  726|       |    // Row 6 processing
  727|       |    /* a00 a01 a02 a03 a04 a05 a06 a07 a08 -- the source matrix 6th row */
  728|  1.15k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 48));
  729|       |    /* b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 6th row */
  730|  1.15k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 48));
  731|  1.15k|    dequant_r0 = _mm_loadu_si128(
  732|  1.15k|        (__m128i *) (&pu2_weigh_mat[48]));              // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  733|  1.15k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  734|  1.15k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);  // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  735|       |    /* b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result */
  736|  1.15k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  737|       |    // b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long
  738|  1.15k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  739|       |    // b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long
  740|  1.15k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  741|       |    /* a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long */
  742|  1.15k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  743|       |    /* a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long */
  744|  1.15k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  745|  1.15k|    if(qp_div >= 6)
  ------------------
  |  Branch (745:8): [True: 95, False: 1.05k]
  ------------------
  746|     95|    {
  747|     95|        resq_r6_1 = _mm_slli_epi32(temp5, qp_div - 6);
  748|     95|        resq_r6_2 = _mm_slli_epi32(temp7, qp_div - 6);
  749|     95|    }
  750|  1.05k|    else
  751|  1.05k|    {
  752|  1.05k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  753|  1.05k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  754|  1.05k|        resq_r6_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  755|  1.05k|        resq_r6_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  756|  1.05k|    }
  757|       |    /* a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 */
  758|  1.15k|    resq_r6_1 = _mm_packs_epi32(resq_r6_1, resq_r6_2);
  759|       |    // Row 7 processing
  760|       |    /* a00 a01 a02 a03 a04 a05 a06 a07 a08 -- the source matrix 7th row */
  761|  1.15k|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_src + 56));
  762|       |    /* b00 b01 b02 b03 b04 b05 b06 b07 b08 -- the scaling matrix 7th row */
  763|  1.15k|    scalemat_r0 = _mm_loadu_si128((__m128i *) (pu2_iscale_mat + 56));
  764|  1.15k|    dequant_r0 = _mm_loadu_si128(
  765|  1.15k|        (__m128i *) (&pu2_weigh_mat[56]));              // q0 q1 q2 q3 q4 q5 q6 q7 -- all 16 bits
  766|  1.15k|    src_r0_1 = _mm_unpacklo_epi16(src_r0, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
  767|  1.15k|    src_r0_2 = _mm_unpackhi_epi16(src_r0, zero_8x16b);  // a04 0 a05 0 a06 0 a07 0 -- 16 bit long
  768|       |
  769|       |    /* b00*q0 b01*q1 b02*q2 b03*q3 b04*q4 b05*q5 b06*q6 b07*q7 -- 16 bit result */
  770|  1.15k|    temp10 = _mm_mullo_epi16(scalemat_r0, dequant_r0);
  771|       |    /* b00*q0 0 b01*q1 0 b02*q2 0 b03*q3 0 -- 16 bit long */
  772|  1.15k|    scalemat_r0_1 = _mm_unpacklo_epi16(temp10, zero_8x16b);
  773|       |    /* b04*q4 0 b05*q5 0 b06*q6 0 b07*q7 0 -- 16 bit long */
  774|  1.15k|    scalemat_r0_2 = _mm_unpackhi_epi16(temp10, zero_8x16b);
  775|       |    /* a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 -- 32 bits long */
  776|  1.15k|    temp5 = _mm_madd_epi16(src_r0_1, scalemat_r0_1);
  777|       |    /* a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 -- 32 bits long */
  778|  1.15k|    temp7 = _mm_madd_epi16(src_r0_2, scalemat_r0_2);
  779|  1.15k|    if(qp_div >= 6)
  ------------------
  |  Branch (779:8): [True: 95, False: 1.05k]
  ------------------
  780|     95|    {
  781|     95|        resq_r7_1 = _mm_slli_epi32(temp5, qp_div - 6);
  782|     95|        resq_r7_2 = _mm_slli_epi32(temp7, qp_div - 6);
  783|     95|    }
  784|  1.05k|    else
  785|  1.05k|    {
  786|  1.05k|        temp5 = _mm_add_epi32(temp5, add_rshift);
  787|  1.05k|        temp7 = _mm_add_epi32(temp7, add_rshift);
  788|  1.05k|        resq_r7_1 = _mm_srai_epi32(temp5, 6 - qp_div);
  789|  1.05k|        resq_r7_2 = _mm_srai_epi32(temp7, 6 - qp_div);
  790|  1.05k|    }
  791|       |    /* a00*b00*q0 a01*b01*q1 a02*b02*q2 a03*b03*q3 a04*b04*q4 a05*b05*q5 a06*b06*q6 a07*b07*q7 */
  792|  1.15k|    resq_r7_1 = _mm_packs_epi32(resq_r7_1, resq_r7_2);
  793|       |    /* Perform Inverse transform */
  794|       |    /*--------------------------------------------------------------------*/
  795|       |    /* IDCT [ Horizontal transformation ]                                 */
  796|       |    /*--------------------------------------------------------------------*/
  797|       |    // Matrix transpose
  798|       |    /*
  799|       |     *  a0 a1 a2 a3 a4 a5 a6 a7
  800|       |     *  b0 b1 b2 b3 b4 b5 b6 b7
  801|       |     *  c0 c1 c2 c3 c4 c5 c6 c7
  802|       |     *  d0 d1 d2 d3 d4 d5 d6 d7
  803|       |     */
  804|  1.15k|    temp1 = _mm_unpacklo_epi16(resq_r0_1, resq_r1_1);  // a0 b0 a1 b1 a2 b2 a3 b3
  805|  1.15k|    temp3 = _mm_unpacklo_epi16(resq_r2_1, resq_r3_1);  // c0 d0 c1 d1 c2 d2 c3 d3
  806|  1.15k|    temp2 = _mm_unpackhi_epi16(resq_r0_1, resq_r1_1);  // a4 b4 a5 b5 a6 b6 a7 b7
  807|  1.15k|    temp4 = _mm_unpackhi_epi16(resq_r2_1, resq_r3_1);  // c4 d4 c5 d5 c6 d6 c7 d7
  808|  1.15k|    resq_r0_1 = _mm_unpacklo_epi32(temp1, temp3);      // a0 b0 c0 d0 a1 b1 c1 d1
  809|  1.15k|    resq_r1_1 = _mm_unpackhi_epi32(temp1, temp3);      // a2 b2 c2 d2 a3 b3 c3 d3
  810|  1.15k|    resq_r2_1 = _mm_unpacklo_epi32(temp2, temp4);      // a4 b4 c4 d4 a5 b5 c5 d5
  811|  1.15k|    resq_r3_1 = _mm_unpackhi_epi32(temp2, temp4);      // a6 b6 c6 d6 a7 b7 c7 d7
  812|       |    /*
  813|       |     * e0 e1 e2 e3 e4 e5 e6 e7
  814|       |     * f0 f1 f2 f3 f4 f5 f6 f7
  815|       |     * g0 g1 g2 g3 g4 g5 g6 g7
  816|       |     * h0 h1 h2 h3 h4 h5 h6 h7
  817|       |     */
  818|  1.15k|    temp1 = _mm_unpacklo_epi16(resq_r4_1, resq_r5_1);  // e0 f0 e1 f1 e2 f2 e2 f3
  819|  1.15k|    temp3 = _mm_unpacklo_epi16(resq_r6_1, resq_r7_1);  // g0 h0 g1 h1 g2 h2 g3 h3
  820|  1.15k|    temp2 = _mm_unpackhi_epi16(resq_r4_1, resq_r5_1);  // e4 f4 e5 f5 e6 f6 e7 f7
  821|  1.15k|    temp4 = _mm_unpackhi_epi16(resq_r6_1, resq_r7_1);  // g4 h4 g5 h5 g6 h6 g7 h7
  822|  1.15k|    resq_r4_1 = _mm_unpacklo_epi32(temp1, temp3);      // e0 f0 g0 h0 e1 f1 g1 h1
  823|  1.15k|    resq_r5_1 = _mm_unpackhi_epi32(temp1, temp3);      // e2 f2 g2 h2 e3 f3 g3 h3
  824|  1.15k|    resq_r6_1 = _mm_unpacklo_epi32(temp2, temp4);      // e4 f4 g4 h4 e5 f5 g5 h5
  825|  1.15k|    resq_r7_1 = _mm_unpackhi_epi32(temp2, temp4);      // e6 f6 g6 h6 e7 f7 g7 h7
  826|       |    /*
  827|       |     * a0 b0 c0 d0 a1 b1 c1 d1
  828|       |     * a2 b2 c2 d2 a3 b3 c3 d3
  829|       |     * a4 b4 c4 d4 a5 b5 c5 d5
  830|       |     * a6 b6 c6 d6 a7 b7 c7 d7
  831|       |     * e0 f0 g0 h0 e1 f1 g1 h1
  832|       |     * e2 f2 g2 h2 e3 f3 g3 h3
  833|       |     * e4 f4 g4 h4 e5 f5 g5 h5
  834|       |     * e6 f6 g6 h6 e7 f7 g7 h7
  835|       |     */
  836|  1.15k|    resq_r0_2 = _mm_unpacklo_epi64(resq_r0_1, resq_r4_1);  // a0 b0 c0 d0 e0 f0 g0 h0
  837|  1.15k|    resq_r1_2 = _mm_unpackhi_epi64(resq_r0_1, resq_r4_1);  // a1 b1 c1 d1 e1 f1 g1 h1
  838|  1.15k|    resq_r2_2 = _mm_unpacklo_epi64(resq_r1_1, resq_r5_1);  // a2 b2 c2 d2 e2 f2 g2 h2
  839|  1.15k|    resq_r3_2 = _mm_unpackhi_epi64(resq_r1_1, resq_r5_1);  // a3 b3 c3 d3 e3 f3 g3 h3
  840|  1.15k|    resq_r4_2 = _mm_unpacklo_epi64(resq_r2_1, resq_r6_1);  // a4 b4 c4 d4 e4 f4 g4 h4
  841|  1.15k|    resq_r5_2 = _mm_unpackhi_epi64(resq_r2_1, resq_r6_1);  // a5 b5 c5 d5 e5 f5 g5 h5
  842|  1.15k|    resq_r6_2 = _mm_unpacklo_epi64(resq_r3_1, resq_r7_1);  // a6 b6 c6 d6 e6 f6 g6 h6
  843|  1.15k|    resq_r7_2 = _mm_unpackhi_epi64(resq_r3_1, resq_r7_1);  // a7 b7 c7 d7 e7 f7 g7 h7
  844|       |
  845|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r1_2);
  846|  1.15k|    resq_r1_1 = _mm_unpacklo_epi16(resq_r1_2, sign_reg);  // a1 b1 c1 d1 -- 32 bit
  847|  1.15k|    resq_r1_2 = _mm_unpackhi_epi16(resq_r1_2, sign_reg);  // e1 f1 g1 h1 -- 32 bit
  848|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r3_2);
  849|  1.15k|    resq_r3_1 = _mm_unpacklo_epi16(resq_r3_2, sign_reg);  // a3 b3 c3 d3 -- 32 bit
  850|  1.15k|    resq_r3_2 = _mm_unpackhi_epi16(resq_r3_2, sign_reg);  // e3 f3 g3 h3 -- 32 bit
  851|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r5_2);
  852|  1.15k|    resq_r5_1 = _mm_unpacklo_epi16(resq_r5_2, sign_reg);  // a5 b5 c5 d5 -- 32 bit
  853|  1.15k|    resq_r5_2 = _mm_unpackhi_epi16(resq_r5_2, sign_reg);  // e5 f5 g5 h5 -- 32 bit
  854|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r7_2);
  855|  1.15k|    resq_r7_1 = _mm_unpacklo_epi16(resq_r7_2, sign_reg);  // a7 b7 c7 d7 -- 32 bit
  856|  1.15k|    resq_r7_2 = _mm_unpackhi_epi16(resq_r7_2, sign_reg);  // e7 f7 g7 h7 -- 32 bit
  857|       |    // Transform starts -- horizontal transform
  858|       |    /*------------------------------------------------------------------*/
  859|       |    /* y0 = w0 + w4                                                     */
  860|  1.15k|    temp1 = _mm_add_epi16(resq_r0_2, resq_r4_2);
  861|       |    /* y2 = w0 - w4                                                      */
  862|  1.15k|    temp3 = _mm_sub_epi16(resq_r0_2, resq_r4_2);
  863|       |    /* y1 = -w3 + w5 - w7 - (w7 >> 1)                                   */
  864|  1.15k|    temp2 = _mm_sub_epi32(resq_r5_1, resq_r3_1);  //-w3+w5
  865|  1.15k|    temp10 = _mm_sub_epi32(resq_r5_2, resq_r3_2);
  866|  1.15k|    temp4 = _mm_sub_epi32(temp2, resq_r7_1);      //-w3+w5-w7
  867|  1.15k|    temp12 = _mm_sub_epi32(temp10, resq_r7_2);
  868|  1.15k|    temp5 = _mm_srai_epi32(resq_r7_1, 1);         // w7>>1
  869|  1.15k|    temp13 = _mm_srai_epi32(resq_r7_2, 1);
  870|  1.15k|    temp2 = _mm_sub_epi32(temp4, temp5);          //-w3+w5-w7 -(w7>>1)
  871|  1.15k|    temp10 = _mm_sub_epi32(temp12, temp13);
  872|  1.15k|    temp2 = _mm_packs_epi32(temp2, temp10);
  873|       |    /* y3 = w1 + w7 - w3 - (w3 >> 1)                                    */
  874|  1.15k|    temp4 = _mm_add_epi32(resq_r1_1, resq_r7_1);  // w1+w7
  875|  1.15k|    temp12 = _mm_add_epi32(resq_r1_2, resq_r7_2);
  876|  1.15k|    temp4 = _mm_sub_epi32(temp4, resq_r3_1);      // w1+w7-w3
  877|  1.15k|    temp12 = _mm_sub_epi32(temp12, resq_r3_2);
  878|  1.15k|    temp5 = _mm_srai_epi32(resq_r3_1, 1);         // w3>>1
  879|  1.15k|    temp13 = _mm_srai_epi32(resq_r3_2, 1);
  880|  1.15k|    temp4 = _mm_sub_epi32(temp4, temp5);          // w1+w7-w3-(w3>>1)
  881|  1.15k|    temp12 = _mm_sub_epi32(temp12, temp13);
  882|  1.15k|    temp4 = _mm_packs_epi32(temp4, temp12);
  883|       |    /* y4 = (w2 >> 1) - w6                                              */
  884|  1.15k|    temp5 = _mm_srai_epi16(resq_r2_2, 1);     // w2>>1
  885|  1.15k|    temp5 = _mm_sub_epi16(temp5, resq_r6_2);  //(w2>>1)-w6
  886|       |    /* y5 = -w1 + w7 + w5 + (w5 >> 1)                                   */
  887|  1.15k|    temp6 = _mm_sub_epi32(resq_r7_1, resq_r1_1);  // w7-w1
  888|  1.15k|    temp14 = _mm_sub_epi32(resq_r7_2, resq_r1_2);
  889|  1.15k|    temp6 = _mm_add_epi32(temp6, resq_r5_1);      // w7-w1+w5
  890|  1.15k|    temp14 = _mm_add_epi32(temp14, resq_r5_2);
  891|  1.15k|    temp7 = _mm_srai_epi32(resq_r5_1, 1);         // w5>>1
  892|  1.15k|    temp15 = _mm_srai_epi32(resq_r5_2, 1);
  893|  1.15k|    temp6 = _mm_add_epi32(temp6, temp7);          // w7-w1_w5+(w5>>1)
  894|  1.15k|    temp14 = _mm_add_epi32(temp14, temp15);
  895|  1.15k|    temp6 = _mm_packs_epi32(temp6, temp14);
  896|       |    /* y6 = w2 + (w6 >> 1)                                              */
  897|  1.15k|    temp7 = _mm_srai_epi16(resq_r6_2, 1);     // w6>>1
  898|  1.15k|    temp7 = _mm_add_epi16(temp7, resq_r2_2);  //(w6>>1)+w2
  899|       |    /* y7 = w3 + w5 + w1 + (w1 >> 1)                                    */
  900|  1.15k|    temp8 = _mm_add_epi32(resq_r3_1, resq_r5_1);  // w3+w5
  901|  1.15k|    temp16 = _mm_add_epi32(resq_r3_2, resq_r5_2);
  902|  1.15k|    temp8 = _mm_add_epi32(temp8, resq_r1_1);      // w3+w5+w1
  903|  1.15k|    temp16 = _mm_add_epi32(temp16, resq_r1_2);
  904|  1.15k|    temp17 = _mm_srai_epi32(resq_r1_1, 1);        // w1>>1
  905|  1.15k|    temp18 = _mm_srai_epi32(resq_r1_2, 1);
  906|  1.15k|    temp8 = _mm_add_epi32(temp8, temp17);         // w3+w5+w1+(w1>>1)
  907|  1.15k|    temp16 = _mm_add_epi32(temp16, temp18);
  908|  1.15k|    temp8 = _mm_packs_epi32(temp8, temp16);
  909|       |    /*------------------------------------------------------------------*/
  910|       |    /*------------------------------------------------------------------*/
  911|       |    /* z0 = y0 + y6                                                        */
  912|  1.15k|    resq_r0_1 = _mm_add_epi16(temp1, temp7);
  913|       |    /* z1 = y1 + (y7 >> 2)                                                */
  914|  1.15k|    resq_r1_1 = _mm_srai_epi16(temp8, 2);
  915|  1.15k|    resq_r1_1 = _mm_add_epi16(resq_r1_1, temp2);
  916|       |    /* z2 = y2 + y4                                                        */
  917|  1.15k|    resq_r2_1 = _mm_add_epi16(temp3, temp5);
  918|       |    /* z3 = y3 + (y5 >> 2)                                                */
  919|  1.15k|    resq_r3_1 = _mm_srai_epi16(temp6, 2);
  920|  1.15k|    resq_r3_1 = _mm_add_epi16(resq_r3_1, temp4);
  921|       |    /* z4 = y2 - y4                                                        */
  922|  1.15k|    resq_r4_1 = _mm_sub_epi16(temp3, temp5);
  923|       |    /* z5 = (y3 >> 2) - y5                                                 */
  924|  1.15k|    resq_r5_1 = _mm_srai_epi16(temp4, 2);
  925|  1.15k|    resq_r5_1 = _mm_sub_epi16(resq_r5_1, temp6);
  926|       |    /* z6 = y0 - y6                                                     */
  927|  1.15k|    resq_r6_1 = _mm_sub_epi16(temp1, temp7);
  928|       |    /* z7 = y7 - (y1 >> 2)                                                 */
  929|  1.15k|    resq_r7_1 = _mm_srai_epi16(temp2, 2);
  930|  1.15k|    resq_r7_1 = _mm_sub_epi16(temp8, resq_r7_1);
  931|       |    /*------------------------------------------------------------------*/
  932|       |    /*------------------------------------------------------------------*/
  933|       |    /* x0 = z0 + z7                                                        */
  934|  1.15k|    temp1 = _mm_add_epi16(resq_r0_1, resq_r7_1);
  935|       |    /* x1 = z2 + z5                                                        */
  936|  1.15k|    temp2 = _mm_add_epi16(resq_r2_1, resq_r5_1);
  937|       |    /* x2 = z4 + z3                                                        */
  938|  1.15k|    temp3 = _mm_add_epi16(resq_r4_1, resq_r3_1);
  939|       |    /* x3 = z6 + z1                                                        */
  940|  1.15k|    temp4 = _mm_add_epi16(resq_r6_1, resq_r1_1);
  941|       |    /* x4 = z6 - z1                                                        */
  942|  1.15k|    temp5 = _mm_sub_epi16(resq_r6_1, resq_r1_1);
  943|       |    /* x5 = z4 - z3                                                        */
  944|  1.15k|    temp6 = _mm_sub_epi16(resq_r4_1, resq_r3_1);
  945|       |    /* x6 = z2 - z5                                                        */
  946|  1.15k|    temp7 = _mm_sub_epi16(resq_r2_1, resq_r5_1);
  947|       |    /* x7 = z0 - z7                                                        */
  948|  1.15k|    temp8 = _mm_sub_epi16(resq_r0_1, resq_r7_1);
  949|       |    /*------------------------------------------------------------------*/
  950|       |    // Matrix transpose
  951|       |    /*
  952|       |     *  a0 b0 c0 d0 e0 f0 g0 h0
  953|       |     *  a1 b1 c1 d1 e1 f1 g1 h1
  954|       |     *  a2 b2 c2 d2 e2 f2 g2 h2
  955|       |     *  a3 b3 c3 d3 e3 f3 g3 h3
  956|       |     */
  957|  1.15k|    temp17 = _mm_unpacklo_epi16(temp1, temp2);       // a0 a1 b0 b1 c0 c1 d0 d1
  958|  1.15k|    temp19 = _mm_unpacklo_epi16(temp3, temp4);       // a2 a3 b2 b3 c2 c3 d2 d3
  959|  1.15k|    temp18 = _mm_unpackhi_epi16(temp1, temp2);       // e0 e1 f0 f1 g0 g1 h0 h1
  960|  1.15k|    temp20 = _mm_unpackhi_epi16(temp3, temp4);       // e2 e3 f2 f3 g2 g3 h2 h3
  961|       |
  962|  1.15k|    resq_r0_1 = _mm_unpacklo_epi32(temp17, temp19);  // a0 a1 a2 a3 b0 b1 b2 b3
  963|  1.15k|    resq_r1_1 = _mm_unpackhi_epi32(temp17, temp19);  // c0 c1 c2 c3 d0 d1 d2 d3
  964|  1.15k|    resq_r2_1 = _mm_unpacklo_epi32(temp18, temp20);  // e0 e1 e2 e3 f0 f1 f2 f3
  965|  1.15k|    resq_r3_1 = _mm_unpackhi_epi32(temp18, temp20);  // g0 g2 g2 g3 h0 h1 h2 h3
  966|       |    /*
  967|       |     *  a4 b4 c4 d4 e4 f4 g4 h4
  968|       |     *  a5 b5 c5 d5 e5 f5 g5 h5
  969|       |     *  a6 b6 c6 d6 e6 f6 g6 h6
  970|       |     *  a7 b7 c7 d7 e7 f7 g7 h7
  971|       |     */
  972|  1.15k|    temp17 = _mm_unpacklo_epi16(temp5, temp6);       // a4 a5 b4 b5 c4 c5 d4 d5
  973|  1.15k|    temp19 = _mm_unpacklo_epi16(temp7, temp8);       // a6 a7 b6 b7 c6 c7 d6 d7
  974|  1.15k|    temp18 = _mm_unpackhi_epi16(temp5, temp6);       // e4 e5 f4 f5 g4 g5 h4 h5
  975|  1.15k|    temp20 = _mm_unpackhi_epi16(temp7, temp8);       // e6 e7 f6 f7 g6 g7 h6 h7
  976|       |
  977|  1.15k|    resq_r4_1 = _mm_unpacklo_epi32(temp17, temp19);  // a4 a5 a6 a7 b4 b5 b6 b7
  978|  1.15k|    resq_r5_1 = _mm_unpackhi_epi32(temp17, temp19);  // c4 c5 c6 c7 d4 d5 d6 d7
  979|  1.15k|    resq_r6_1 = _mm_unpacklo_epi32(temp18, temp20);  // e4 e5 e6 e7 f4 f5 f6 f7
  980|  1.15k|    resq_r7_1 = _mm_unpackhi_epi32(temp18, temp20);  // g4 g5 g6 g7 h4 h5 h6 h7
  981|       |    /*  a0 a1 a2 a3 b0 b1 b2 b3
  982|       |     *  c0 c1 c2 c3 d0 d1 d2 d3
  983|       |     *  e0 e1 e2 e3 f0 f1 f2 f3
  984|       |     *  g0 g2 g2 g3 h0 h1 h2 h3
  985|       |     *  a4 a5 a6 a7 b4 b5 b6 b7
  986|       |     *  c4 c5 c6 c7 d4 d5 d6 d7
  987|       |     *  e4 e5 e6 e7 f4 f5 f6 f7
  988|       |     *  g4 g5 g6 g7 h4 h5 h6 h7
  989|       |     */
  990|  1.15k|    resq_r0_2 = _mm_unpacklo_epi64(resq_r0_1, resq_r4_1);  // a0 a1 a2 a3 a4 a5 a6 a7
  991|  1.15k|    resq_r1_2 = _mm_unpackhi_epi64(resq_r0_1, resq_r4_1);  // b0 b1 b2 b3 b4 b5 b6 b7
  992|  1.15k|    resq_r2_2 = _mm_unpacklo_epi64(resq_r1_1, resq_r5_1);  // c0 c1 c2 c3 c4 c5 c6 c7
  993|  1.15k|    resq_r3_2 = _mm_unpackhi_epi64(resq_r1_1, resq_r5_1);  // d0 d1 d2 d3 d4 d5 d6 d7
  994|  1.15k|    resq_r4_2 = _mm_unpacklo_epi64(resq_r2_1, resq_r6_1);  // e0 e1 e2 e3 e4 e5 e6 e7
  995|  1.15k|    resq_r5_2 = _mm_unpackhi_epi64(resq_r2_1, resq_r6_1);  // f0 f1 f2 f3 f4 f5 f6 f7
  996|  1.15k|    resq_r6_2 = _mm_unpacklo_epi64(resq_r3_1, resq_r7_1);  // g0 g1 g2 g3 g4 g5 g6 g7
  997|  1.15k|    resq_r7_2 = _mm_unpackhi_epi64(resq_r3_1, resq_r7_1);  // h0 h1 h2 h3 h4 h5 h6 h7
  998|       |
  999|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r1_2);
 1000|  1.15k|    resq_r1_1 = _mm_unpacklo_epi16(resq_r1_2, sign_reg);  // a1 b1 c1 d1 -- 32 bit
 1001|  1.15k|    resq_r1_2 = _mm_unpackhi_epi16(resq_r1_2, sign_reg);  // e1 f1 g1 h1 -- 32 bit
 1002|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r3_2);
 1003|  1.15k|    resq_r3_1 = _mm_unpacklo_epi16(resq_r3_2, sign_reg);  // a3 b3 c3 d3 -- 32 bit
 1004|  1.15k|    resq_r3_2 = _mm_unpackhi_epi16(resq_r3_2, sign_reg);  // e3 f3 g3 h3 -- 32 bit
 1005|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r5_2);
 1006|  1.15k|    resq_r5_1 = _mm_unpacklo_epi16(resq_r5_2, sign_reg);  // a5 b5 c5 d5 -- 32 bit
 1007|  1.15k|    resq_r5_2 = _mm_unpackhi_epi16(resq_r5_2, sign_reg);  // e5 f5 g5 h5 -- 32 bit
 1008|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, resq_r7_2);
 1009|  1.15k|    resq_r7_1 = _mm_unpacklo_epi16(resq_r7_2, sign_reg);  // a7 b7 c7 d7 -- 32 bit
 1010|  1.15k|    resq_r7_2 = _mm_unpackhi_epi16(resq_r7_2, sign_reg);  // e7 f7 g7 h7 -- 32 bit
 1011|       |
 1012|       |    /*--------------------------------------------------------------------*/
 1013|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6            */
 1014|       |    /*                                                                    */
 1015|       |
 1016|       |    /* y0j = w0j + w4j                                                     */
 1017|  1.15k|    temp1 = _mm_add_epi16(resq_r0_2, resq_r4_2);
 1018|       |    /* y2j = w0j - w4j                                                      */
 1019|  1.15k|    temp3 = _mm_sub_epi16(resq_r0_2, resq_r4_2);
 1020|       |    /* y1j = -w3j + w5j - w7j - (w7j >> 1)                                   */
 1021|  1.15k|    temp2 = _mm_sub_epi32(resq_r5_1, resq_r3_1);  //-w3+w5
 1022|  1.15k|    temp10 = _mm_sub_epi32(resq_r5_2, resq_r3_2);
 1023|  1.15k|    temp4 = _mm_sub_epi32(temp2, resq_r7_1);      //-w3+w5-w7
 1024|  1.15k|    temp12 = _mm_sub_epi32(temp10, resq_r7_2);
 1025|  1.15k|    temp5 = _mm_srai_epi32(resq_r7_1, 1);         // w7>>1
 1026|  1.15k|    temp13 = _mm_srai_epi32(resq_r7_2, 1);
 1027|  1.15k|    temp2 = _mm_sub_epi32(temp4, temp5);          //-w3+w5-w7 -(w7>>1)
 1028|  1.15k|    temp10 = _mm_sub_epi32(temp12, temp13);
 1029|  1.15k|    temp2 = _mm_packs_epi32(temp2, temp10);
 1030|       |    /* y3j = w1j + w7j - w3j - (w3j >> 1)                                    */
 1031|  1.15k|    temp4 = _mm_add_epi32(resq_r1_1, resq_r7_1);  // w1+w7
 1032|  1.15k|    temp12 = _mm_add_epi32(resq_r1_2, resq_r7_2);
 1033|  1.15k|    temp4 = _mm_sub_epi32(temp4, resq_r3_1);      // w1+w7-w3
 1034|  1.15k|    temp12 = _mm_sub_epi32(temp12, resq_r3_2);
 1035|  1.15k|    temp5 = _mm_srai_epi32(resq_r3_1, 1);         // w3>>1
 1036|  1.15k|    temp13 = _mm_srai_epi32(resq_r3_2, 1);
 1037|  1.15k|    temp4 = _mm_sub_epi32(temp4, temp5);          // w1+w7-w3-(w3>>1)
 1038|  1.15k|    temp12 = _mm_sub_epi32(temp12, temp13);
 1039|  1.15k|    temp4 = _mm_packs_epi32(temp4, temp12);
 1040|       |    /* y4j = (w2j >> 1) - w6j                                              */
 1041|  1.15k|    temp5 = _mm_srai_epi16(resq_r2_2, 1);     // w2>>1
 1042|  1.15k|    temp5 = _mm_sub_epi16(temp5, resq_r6_2);  //(w2>>1)-w6
 1043|       |    /* y5j = -w1j + w7j + w5j + (w5j >> 1)                                   */
 1044|  1.15k|    temp6 = _mm_sub_epi32(resq_r7_1, resq_r1_1);  // w7-w1
 1045|  1.15k|    temp14 = _mm_sub_epi32(resq_r7_2, resq_r1_2);
 1046|  1.15k|    temp6 = _mm_add_epi32(temp6, resq_r5_1);      // w7-w1+w5
 1047|  1.15k|    temp14 = _mm_add_epi32(temp14, resq_r5_2);
 1048|  1.15k|    temp7 = _mm_srai_epi32(resq_r5_1, 1);         // w5>>1
 1049|  1.15k|    temp15 = _mm_srai_epi32(resq_r5_2, 1);
 1050|  1.15k|    temp6 = _mm_add_epi32(temp6, temp7);          // w7-w1_w5+(w5>>1)
 1051|  1.15k|    temp14 = _mm_add_epi32(temp14, temp15);
 1052|  1.15k|    temp6 = _mm_packs_epi32(temp6, temp14);
 1053|       |    /* y6j = w2j + (w6j >> 1)                                              */
 1054|  1.15k|    temp7 = _mm_srai_epi16(resq_r6_2, 1);     // w6>>1
 1055|  1.15k|    temp7 = _mm_add_epi16(temp7, resq_r2_2);  //(w6>>1)+w2
 1056|       |    /* y7j = w3j + w5j + w1j + (w1j >> 1)                                    */
 1057|  1.15k|    temp8 = _mm_add_epi32(resq_r3_1, resq_r5_1);  // w3+w5
 1058|  1.15k|    temp16 = _mm_add_epi32(resq_r3_2, resq_r5_2);
 1059|  1.15k|    temp8 = _mm_add_epi32(temp8, resq_r1_1);      // w3+w5+w1
 1060|  1.15k|    temp16 = _mm_add_epi32(temp16, resq_r1_2);
 1061|  1.15k|    temp17 = _mm_srai_epi32(resq_r1_1, 1);        // w1>>1
 1062|  1.15k|    temp18 = _mm_srai_epi32(resq_r1_2, 1);
 1063|  1.15k|    temp8 = _mm_add_epi32(temp8, temp17);         // w3+w5+w1+(w1>>1)
 1064|  1.15k|    temp16 = _mm_add_epi32(temp16, temp18);
 1065|  1.15k|    temp8 = _mm_packs_epi32(temp8, temp16);
 1066|       |    /*------------------------------------------------------------------*/
 1067|       |    /*------------------------------------------------------------------*/
 1068|       |    /* z0j = y0j + y6j                                                        */
 1069|  1.15k|    resq_r0_1 = _mm_add_epi16(temp1, temp7);
 1070|       |    /* z1j = y1j + (y7j >> 2)                                                */
 1071|  1.15k|    resq_r1_1 = _mm_srai_epi16(temp8, 2);
 1072|  1.15k|    resq_r1_1 = _mm_add_epi16(resq_r1_1, temp2);
 1073|       |    /* z2j = y2j + y4j                                                        */
 1074|  1.15k|    resq_r2_1 = _mm_add_epi16(temp3, temp5);
 1075|       |    /* z3j = y3j + (y5j >> 2)                                                */
 1076|  1.15k|    resq_r3_1 = _mm_srai_epi16(temp6, 2);
 1077|  1.15k|    resq_r3_1 = _mm_add_epi16(resq_r3_1, temp4);
 1078|       |    /* z4j = y2j - y4j                                                        */
 1079|  1.15k|    resq_r4_1 = _mm_sub_epi16(temp3, temp5);
 1080|       |    /* z5j = (y3j >> 2) - y5j                                                 */
 1081|  1.15k|    resq_r5_1 = _mm_srai_epi16(temp4, 2);
 1082|  1.15k|    resq_r5_1 = _mm_sub_epi16(resq_r5_1, temp6);
 1083|       |    /* z6j = y0j - y6j                                                     */
 1084|  1.15k|    resq_r6_1 = _mm_sub_epi16(temp1, temp7);
 1085|       |    /* z7j = y7j - (y1j >> 2)                                                 */
 1086|  1.15k|    resq_r7_1 = _mm_srai_epi16(temp2, 2);
 1087|  1.15k|    resq_r7_1 = _mm_sub_epi16(temp8, resq_r7_1);
 1088|       |    /*------------------------------------------------------------------*/
 1089|       |
 1090|       |    /*------------------------------------------------------------------*/
 1091|       |    /* x0j = z0j + z7j                                                        */
 1092|  1.15k|    temp1 = _mm_add_epi16(resq_r0_1, resq_r7_1);
 1093|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp1);
 1094|  1.15k|    temp10 = _mm_unpacklo_epi16(temp1, sign_reg);
 1095|  1.15k|    temp11 = _mm_unpackhi_epi16(temp1, sign_reg);
 1096|  1.15k|    temp10 = _mm_add_epi32(temp10, value_32);
 1097|  1.15k|    temp11 = _mm_add_epi32(temp11, value_32);
 1098|  1.15k|    temp10 = _mm_srai_epi32(temp10, 6);
 1099|  1.15k|    temp10 = _mm_min_epi32(dupmax_4x32b, temp10);
 1100|  1.15k|    temp10 = _mm_max_epi32(dupmin_4x32b, temp10);
 1101|  1.15k|    temp11 = _mm_srai_epi32(temp11, 6);
 1102|  1.15k|    temp11 = _mm_min_epi32(dupmax_4x32b, temp11);
 1103|  1.15k|    temp11 = _mm_max_epi32(dupmin_4x32b, temp11);
 1104|  1.15k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1105|  1.15k|    temp1 = temp10;  //_mm_add_epi16(temp10, pred_r0_1);
 1106|       |    /* x1j = z2j + z5j                                                        */
 1107|  1.15k|    temp2 = _mm_add_epi16(resq_r2_1, resq_r5_1);
 1108|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp2);
 1109|  1.15k|    temp10 = _mm_unpacklo_epi16(temp2, sign_reg);
 1110|  1.15k|    temp11 = _mm_unpackhi_epi16(temp2, sign_reg);
 1111|  1.15k|    temp10 = _mm_add_epi32(temp10, value_32);
 1112|  1.15k|    temp11 = _mm_add_epi32(temp11, value_32);
 1113|  1.15k|    temp10 = _mm_srai_epi32(temp10, 6);
 1114|  1.15k|    temp10 = _mm_min_epi32(dupmax_4x32b, temp10);
 1115|  1.15k|    temp10 = _mm_max_epi32(dupmin_4x32b, temp10);
 1116|  1.15k|    temp11 = _mm_srai_epi32(temp11, 6);
 1117|  1.15k|    temp11 = _mm_min_epi32(dupmax_4x32b, temp11);
 1118|  1.15k|    temp11 = _mm_max_epi32(dupmin_4x32b, temp11);
 1119|  1.15k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1120|  1.15k|    temp2 = temp10;  //_mm_add_epi16(temp10, pred_r1_1);
 1121|       |    /* x2j = z4j + z3j                                                        */
 1122|  1.15k|    temp3 = _mm_add_epi16(resq_r4_1, resq_r3_1);
 1123|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp3);
 1124|  1.15k|    temp10 = _mm_unpacklo_epi16(temp3, sign_reg);
 1125|  1.15k|    temp11 = _mm_unpackhi_epi16(temp3, sign_reg);
 1126|  1.15k|    temp10 = _mm_add_epi32(temp10, value_32);
 1127|  1.15k|    temp11 = _mm_add_epi32(temp11, value_32);
 1128|  1.15k|    temp10 = _mm_srai_epi32(temp10, 6);
 1129|  1.15k|    temp10 = _mm_min_epi32(dupmax_4x32b, temp10);
 1130|  1.15k|    temp10 = _mm_max_epi32(dupmin_4x32b, temp10);
 1131|  1.15k|    temp11 = _mm_srai_epi32(temp11, 6);
 1132|  1.15k|    temp11 = _mm_min_epi32(dupmax_4x32b, temp11);
 1133|  1.15k|    temp11 = _mm_max_epi32(dupmin_4x32b, temp11);
 1134|  1.15k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1135|  1.15k|    temp3 = temp10;  //_mm_add_epi16(temp10, pred_r2_1);
 1136|       |    /* x3j = z6j + z1j                                                        */
 1137|  1.15k|    temp4 = _mm_add_epi16(resq_r6_1, resq_r1_1);
 1138|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp4);
 1139|  1.15k|    temp10 = _mm_unpacklo_epi16(temp4, sign_reg);
 1140|  1.15k|    temp11 = _mm_unpackhi_epi16(temp4, sign_reg);
 1141|  1.15k|    temp10 = _mm_add_epi32(temp10, value_32);
 1142|  1.15k|    temp11 = _mm_add_epi32(temp11, value_32);
 1143|  1.15k|    temp10 = _mm_srai_epi32(temp10, 6);
 1144|  1.15k|    temp10 = _mm_min_epi32(dupmax_4x32b, temp10);
 1145|  1.15k|    temp10 = _mm_max_epi32(dupmin_4x32b, temp10);
 1146|  1.15k|    temp11 = _mm_srai_epi32(temp11, 6);
 1147|  1.15k|    temp11 = _mm_min_epi32(dupmax_4x32b, temp11);
 1148|  1.15k|    temp11 = _mm_max_epi32(dupmin_4x32b, temp11);
 1149|  1.15k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1150|  1.15k|    temp4 = temp10;  //_mm_add_epi16(temp10, pred_r3_1);
 1151|       |    /* x4j = z6j - z1j                                                        */
 1152|  1.15k|    temp5 = _mm_sub_epi16(resq_r6_1, resq_r1_1);
 1153|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp5);
 1154|  1.15k|    temp10 = _mm_unpacklo_epi16(temp5, sign_reg);
 1155|  1.15k|    temp11 = _mm_unpackhi_epi16(temp5, sign_reg);
 1156|  1.15k|    temp10 = _mm_add_epi32(temp10, value_32);
 1157|  1.15k|    temp11 = _mm_add_epi32(temp11, value_32);
 1158|  1.15k|    temp10 = _mm_srai_epi32(temp10, 6);
 1159|  1.15k|    temp10 = _mm_min_epi32(dupmax_4x32b, temp10);
 1160|  1.15k|    temp10 = _mm_max_epi32(dupmin_4x32b, temp10);
 1161|  1.15k|    temp11 = _mm_srai_epi32(temp11, 6);
 1162|  1.15k|    temp11 = _mm_min_epi32(dupmax_4x32b, temp11);
 1163|  1.15k|    temp11 = _mm_max_epi32(dupmin_4x32b, temp11);
 1164|  1.15k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1165|  1.15k|    temp5 = temp10;  //_mm_add_epi16(temp10, pred_r4_1);
 1166|       |    /* x5j = z4j - z3j                                                        */
 1167|  1.15k|    temp6 = _mm_sub_epi16(resq_r4_1, resq_r3_1);
 1168|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp6);
 1169|  1.15k|    temp10 = _mm_unpacklo_epi16(temp6, sign_reg);
 1170|  1.15k|    temp11 = _mm_unpackhi_epi16(temp6, sign_reg);
 1171|  1.15k|    temp10 = _mm_add_epi32(temp10, value_32);
 1172|  1.15k|    temp11 = _mm_add_epi32(temp11, value_32);
 1173|  1.15k|    temp10 = _mm_srai_epi32(temp10, 6);
 1174|  1.15k|    temp10 = _mm_min_epi32(dupmax_4x32b, temp10);
 1175|  1.15k|    temp10 = _mm_max_epi32(dupmin_4x32b, temp10);
 1176|  1.15k|    temp11 = _mm_srai_epi32(temp11, 6);
 1177|  1.15k|    temp11 = _mm_min_epi32(dupmax_4x32b, temp11);
 1178|  1.15k|    temp11 = _mm_max_epi32(dupmin_4x32b, temp11);
 1179|  1.15k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1180|  1.15k|    temp6 = temp10;  //_mm_add_epi16(temp10, pred_r5_1);
 1181|       |    /* x6j = z2j - z5j                                                        */
 1182|  1.15k|    temp7 = _mm_sub_epi16(resq_r2_1, resq_r5_1);
 1183|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp7);
 1184|  1.15k|    temp10 = _mm_unpacklo_epi16(temp7, sign_reg);
 1185|  1.15k|    temp11 = _mm_unpackhi_epi16(temp7, sign_reg);
 1186|  1.15k|    temp10 = _mm_add_epi32(temp10, value_32);
 1187|  1.15k|    temp11 = _mm_add_epi32(temp11, value_32);
 1188|  1.15k|    temp10 = _mm_srai_epi32(temp10, 6);
 1189|  1.15k|    temp10 = _mm_min_epi32(dupmax_4x32b, temp10);
 1190|  1.15k|    temp10 = _mm_max_epi32(dupmin_4x32b, temp10);
 1191|  1.15k|    temp11 = _mm_srai_epi32(temp11, 6);
 1192|  1.15k|    temp11 = _mm_min_epi32(dupmax_4x32b, temp11);
 1193|  1.15k|    temp11 = _mm_max_epi32(dupmin_4x32b, temp11);
 1194|  1.15k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1195|  1.15k|    temp7 = temp10;  //_mm_add_epi16(temp10, pred_r6_1);
 1196|       |    /* x7j = z0j - z7j                                                        */
 1197|  1.15k|    temp8 = _mm_sub_epi16(resq_r0_1, resq_r7_1);
 1198|  1.15k|    sign_reg = _mm_cmpgt_epi16(zero_8x16b, temp8);
 1199|  1.15k|    temp10 = _mm_unpacklo_epi16(temp8, sign_reg);
 1200|  1.15k|    temp11 = _mm_unpackhi_epi16(temp8, sign_reg);
 1201|  1.15k|    temp10 = _mm_add_epi32(temp10, value_32);
 1202|  1.15k|    temp11 = _mm_add_epi32(temp11, value_32);
 1203|  1.15k|    temp10 = _mm_srai_epi32(temp10, 6);
 1204|  1.15k|    temp10 = _mm_min_epi32(dupmax_4x32b, temp10);
 1205|  1.15k|    temp10 = _mm_max_epi32(dupmin_4x32b, temp10);
 1206|  1.15k|    temp11 = _mm_srai_epi32(temp11, 6);
 1207|  1.15k|    temp11 = _mm_min_epi32(dupmax_4x32b, temp11);
 1208|  1.15k|    temp11 = _mm_max_epi32(dupmin_4x32b, temp11);
 1209|  1.15k|    temp10 = _mm_packs_epi32(temp10, temp11);
 1210|  1.15k|    temp8 = temp10;  //_mm_add_epi16(temp10, pred_r7_1);
 1211|       |
 1212|  1.15k|    _mm_storeu_si128((__m128i *) (&pi2_out[0]), temp1);
 1213|  1.15k|    _mm_storeu_si128((__m128i *) (&pi2_out[out_strd]), temp2);
 1214|  1.15k|    _mm_storeu_si128((__m128i *) (&pi2_out[2 * out_strd]), temp3);
 1215|  1.15k|    _mm_storeu_si128((__m128i *) (&pi2_out[3 * out_strd]), temp4);
 1216|  1.15k|    _mm_storeu_si128((__m128i *) (&pi2_out[4 * out_strd]), temp5);
 1217|  1.15k|    _mm_storeu_si128((__m128i *) (&pi2_out[5 * out_strd]), temp6);
 1218|  1.15k|    _mm_storeu_si128((__m128i *) (&pi2_out[6 * out_strd]), temp7);
 1219|  1.15k|    _mm_storeu_si128((__m128i *) (&pi2_out[7 * out_strd]), temp8);
 1220|  1.15k|}
isvcd_iquant_itrans_chroma_4x4_sse42:
 1249|    382|{
 1250|    382|    __m128i src_r0_r1, src_r2_r3;
 1251|    382|    __m128i src_r0, src_r1, src_r2, src_r3;
 1252|    382|    __m128i scalemat_r0_r1, scalemat_r2_r3;
 1253|    382|    __m128i dequant_r0_r1, dequant_r2_r3;
 1254|    382|    __m128i zero_8x16b = _mm_setzero_si128();  // all bits reset to zero
 1255|    382|    __m128i temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
 1256|    382|    __m128i resq_r0, resq_r1, resq_r2, resq_r3;
 1257|    382|    __m128i add_rshift = _mm_set1_epi32((u4_qp_div_6 < 4) ? (1 << (3 - u4_qp_div_6)) : 0);
  ------------------
  |  Branch (1257:41): [True: 137, False: 245]
  ------------------
 1258|    382|    __m128i value_32 = _mm_set1_epi32(32);
 1259|    382|    __m128i dupmax_4x32b = _mm_set1_epi32(RSD_MAX);
  ------------------
  |  |  772|    382|#define RSD_MAX 255
  ------------------
 1260|    382|    __m128i dupmin_4x32b = _mm_set1_epi32(RSD_MIN);
  ------------------
  |  |  773|    382|#define RSD_MIN -255
  ------------------
 1261|       |
 1262|    382|    __m128i chroma_mask_even =
 1263|    382|        _mm_set_epi16(0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff);
 1264|    382|    __m128i chroma_mask_odd =
 1265|    382|        _mm_set_epi16(0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000);
 1266|       |
 1267|    382|    UNUSED(pi2_tmp);
  ------------------
  |  |   45|    382|#define UNUSED(x) ((void)(x))
  ------------------
 1268|       |
 1269|       |    /*************************************************************/
 1270|       |    /* Dequantization of coefficients. Will be replaced by SIMD  */
 1271|       |    /* operations on platform                                    */
 1272|       |    /*************************************************************/
 1273|       |    // a00 a01 a02 a03 a10 a11 a12 a13 -- the source matrix 0th,1st row
 1274|    382|    src_r0_r1 = _mm_loadu_si128((__m128i *) (pi2_src));
 1275|       |    // a20 a21 a22 a23 a30 a31 a32 a33 --the source matrix 2nd,3rd row
 1276|    382|    src_r2_r3 = _mm_loadu_si128((__m128i *) (pi2_src + 8));
 1277|       |    // b00 b01 b02 b03 b10 b11 b12 b13 -- the scaling matrix 0th,1st row
 1278|    382|    scalemat_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat));
 1279|       |    // b20 b21 b22 b23 b30 b31 b32 b33 -- the scaling matrix 2nd,3rd row
 1280|    382|    scalemat_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_iscal_mat + 8));
 1281|       |    // q00 q01 q02 q03 q10 q11 q12 q13 -- all 16 bits
 1282|    382|    dequant_r0_r1 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat));
 1283|       |    // q20 q21 q22 q23 q30 q31 q32 q33 -- all 16 bits
 1284|    382|    dequant_r2_r3 = _mm_loadu_si128((__m128i *) (pu2_weigh_mat + 8));
 1285|       |    // b00*q00 b01*q01 b02*q02 b03*q03 b10*q10 b11*q11 b12*q12 b13*q13 -- 16 bit result
 1286|    382|    temp0 = _mm_mullo_epi16(scalemat_r0_r1, dequant_r0_r1);
 1287|       |    // b00*q00 b01*q01 b02*q02 b03*q03 b10*q10 b11*q11 b12*q12 b13*q13 -- 16 bit result
 1288|    382|    temp1 = _mm_mullo_epi16(scalemat_r2_r3, dequant_r2_r3);
 1289|       |    // b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long
 1290|    382|    temp4 = _mm_unpacklo_epi16(temp0, zero_8x16b);
 1291|       |    // b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long
 1292|    382|    temp5 = _mm_unpackhi_epi16(temp0, zero_8x16b);
 1293|       |    // b00*q00 0 b01*q01 0 b02*q02 0 b03*q03 0 -- 16 bit long
 1294|    382|    temp6 = _mm_unpacklo_epi16(temp1, zero_8x16b);
 1295|       |    // b10*q10 0 b11*q11 0 b12*q12 0 b13*q13 0 -- 16 bit long
 1296|    382|    temp7 = _mm_unpackhi_epi16(temp1, zero_8x16b);
 1297|       |
 1298|    382|    src_r0 = _mm_unpacklo_epi16(src_r0_r1, zero_8x16b);  // a00 0 a01 0 a02 0 a03 0 -- 16 bit long
 1299|    382|    src_r1 = _mm_unpackhi_epi16(src_r0_r1, zero_8x16b);  // a10 0 a11 0 a12 0 a13 0 -- 16 bit long
 1300|    382|    src_r2 = _mm_unpacklo_epi16(src_r2_r3, zero_8x16b);  // a20 0 a21 0 a22 0 a23 0 -- 16 bit long
 1301|    382|    src_r3 = _mm_unpackhi_epi16(src_r2_r3, zero_8x16b);  // a30 0 a31 0 a32 0 a33 0 -- 16 bit long
 1302|       |
 1303|       |    // a00*b00*q00 a10*b10*q10 a20*b20*q20 a30*b30 q30 -- 32 bits long
 1304|    382|    temp4 = _mm_madd_epi16(src_r0, temp4);
 1305|    382|    temp5 = _mm_madd_epi16(src_r1, temp5);
 1306|    382|    temp6 = _mm_madd_epi16(src_r2, temp6);
 1307|    382|    temp7 = _mm_madd_epi16(src_r3, temp7);
 1308|       |
 1309|    382|    if(u4_qp_div_6 >= 4)
  ------------------
  |  Branch (1309:8): [True: 245, False: 137]
  ------------------
 1310|    245|    {
 1311|    245|        resq_r0 = _mm_slli_epi32(temp4, u4_qp_div_6 - 4);
 1312|    245|        resq_r1 = _mm_slli_epi32(temp5, u4_qp_div_6 - 4);
 1313|    245|        resq_r2 = _mm_slli_epi32(temp6, u4_qp_div_6 - 4);
 1314|    245|        resq_r3 = _mm_slli_epi32(temp7, u4_qp_div_6 - 4);
 1315|    245|    }
 1316|    137|    else
 1317|    137|    {
 1318|    137|        temp4 = _mm_add_epi32(temp4, add_rshift);
 1319|    137|        temp5 = _mm_add_epi32(temp5, add_rshift);
 1320|    137|        temp6 = _mm_add_epi32(temp6, add_rshift);
 1321|    137|        temp7 = _mm_add_epi32(temp7, add_rshift);
 1322|    137|        resq_r0 = _mm_srai_epi32(temp4, 4 - u4_qp_div_6);
 1323|    137|        resq_r1 = _mm_srai_epi32(temp5, 4 - u4_qp_div_6);
 1324|    137|        resq_r2 = _mm_srai_epi32(temp6, 4 - u4_qp_div_6);
 1325|    137|        resq_r3 = _mm_srai_epi32(temp7, 4 - u4_qp_div_6);
 1326|    137|    }
 1327|       |
 1328|    382|    resq_r0 = _mm_insert_epi32(resq_r0, (WORD32) pi2_dc_src[0], 0);
 1329|       |    /* Perform Inverse transform */
 1330|       |    /*-------------------------------------------------------------*/
 1331|       |    /* IDCT [ Horizontal transformation ]                          */
 1332|       |    /*-------------------------------------------------------------*/
 1333|       |    // Matrix transpose
 1334|       |    /*
 1335|       |     *  a0 a1 a2 a3
 1336|       |     *  b0 b1 b2 b3
 1337|       |     *  c0 c1 c2 c3
 1338|       |     *  d0 d1 d2 d3
 1339|       |     */
 1340|    382|    temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);  // a0 b0 a1 b1
 1341|    382|    temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);  // c0 d0 c1 d1
 1342|    382|    temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);  // a2 b2 a3 b3
 1343|    382|    temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);  // c2 d2 c3 d3
 1344|    382|    resq_r0 = _mm_unpacklo_epi64(temp1, temp3);    // a0 b0 c0 d0
 1345|    382|    resq_r1 = _mm_unpackhi_epi64(temp1, temp3);    // a1 b1 c1 d1
 1346|    382|    resq_r2 = _mm_unpacklo_epi64(temp2, temp4);    // a2 b2 c2 d2
 1347|    382|    resq_r3 = _mm_unpackhi_epi64(temp2, temp4);    // a3 b3 c3 d3
 1348|       |    // Transform starts -- horizontal transform
 1349|       |    /*------------------------------------------------------------------*/
 1350|       |    /* z0 = w0 + w2                                             */
 1351|    382|    temp0 = _mm_add_epi32(resq_r0, resq_r2);
 1352|       |    /* z1 = w0 - w2                                             */
 1353|    382|    temp1 = _mm_sub_epi32(resq_r0, resq_r2);
 1354|       |    /* z2 = (w1 >> 1) - w3                                      */
 1355|    382|    temp2 = _mm_srai_epi32(resq_r1, 1);     //(w1>>1)
 1356|    382|    temp2 = _mm_sub_epi32(temp2, resq_r3);  //(w1>>1) - w3
 1357|       |    /* z3 = w1 + (w3 >> 1)                                      */
 1358|    382|    temp3 = _mm_srai_epi32(resq_r3, 1);  //(w3>>1) + w1
 1359|    382|    temp3 = _mm_add_epi32(temp3, resq_r1);
 1360|       |    /*----------------------------------------------------------*/
 1361|       |    /* x0 = z0 + z3                                             */
 1362|    382|    resq_r0 = _mm_add_epi32(temp0, temp3);
 1363|       |    /* x1 = z1 + z2                                             */
 1364|    382|    resq_r1 = _mm_add_epi32(temp1, temp2);
 1365|       |    /* x2 = z1 - z2                                             */
 1366|    382|    resq_r2 = _mm_sub_epi32(temp1, temp2);
 1367|       |    /* x3 = z0 - z3                                             */
 1368|    382|    resq_r3 = _mm_sub_epi32(temp0, temp3);
 1369|       |    // Matrix transpose
 1370|       |    /*
 1371|       |     *  a0 b0 c0 d0
 1372|       |     *  a1 b1 c1 d1
 1373|       |     *  a2 b2 c2 d2
 1374|       |     *  a3 b3 c3 d3
 1375|       |     */
 1376|    382|    temp1 = _mm_unpacklo_epi32(resq_r0, resq_r1);  // a0 a1 b0 b1
 1377|    382|    temp3 = _mm_unpacklo_epi32(resq_r2, resq_r3);  // a2 a3 b2 b3
 1378|    382|    temp2 = _mm_unpackhi_epi32(resq_r0, resq_r1);  // c0 c1 d0 d1
 1379|    382|    temp4 = _mm_unpackhi_epi32(resq_r2, resq_r3);  // c2 c3 d2 d3
 1380|    382|    resq_r0 = _mm_unpacklo_epi64(temp1, temp3);    // a0 a1 a2 a3
 1381|    382|    resq_r1 = _mm_unpackhi_epi64(temp1, temp3);    // b0 b1 b2 b3
 1382|    382|    resq_r2 = _mm_unpacklo_epi64(temp2, temp4);    // c0 c1 c2 c3
 1383|    382|    resq_r3 = _mm_unpackhi_epi64(temp2, temp4);    // d0 d1 d2 d3
 1384|       |    // Transform ends -- horizontal transform
 1385|       |
 1386|       |    /*--------------------------------------------------------------*/
 1387|       |    /* IDCT [ Vertical transformation] and Xij = (xij + 32)>>6      */
 1388|       |    /* Add the prediction and store it back to same buffer          */
 1389|       |    /*--------------------------------------------------------------*/
 1390|       |    /* z0j = y0j + y2j                                                        */
 1391|    382|    temp0 = _mm_add_epi32(resq_r0, resq_r2);
 1392|       |    /* z1j = y0j - y2j                                                        */
 1393|    382|    temp1 = _mm_sub_epi32(resq_r0, resq_r2);
 1394|       |    /* z2j = (y1j>>1) - y3j */
 1395|    382|    temp2 = _mm_srai_epi32(resq_r1, 1);  //(y1j>>1)
 1396|    382|    temp2 = _mm_sub_epi32(temp2, resq_r3);
 1397|       |    /* z3j = y1j + (y3j>>1) */
 1398|    382|    temp3 = _mm_srai_epi32(resq_r3, 1);  //(y3j>>1)
 1399|    382|    temp3 = _mm_add_epi32(temp3, resq_r1);
 1400|       |
 1401|       |    /* x0j = z0j + z3j                                                        */
 1402|    382|    temp4 = _mm_add_epi32(temp0, temp3);
 1403|    382|    temp4 = _mm_add_epi32(temp4, value_32);
 1404|    382|    temp4 = _mm_srai_epi32(temp4, 6);
 1405|    382|    temp4 = _mm_min_epi32(dupmax_4x32b, temp4);
 1406|    382|    temp4 = _mm_max_epi32(dupmin_4x32b, temp4);
 1407|       |
 1408|       |    /* x1j = z1j + z2j                                                        */
 1409|    382|    temp5 = _mm_add_epi32(temp1, temp2);
 1410|    382|    temp5 = _mm_add_epi32(temp5, value_32);
 1411|    382|    temp5 = _mm_srai_epi32(temp5, 6);
 1412|    382|    temp5 = _mm_min_epi32(dupmax_4x32b, temp5);
 1413|    382|    temp5 = _mm_max_epi32(dupmin_4x32b, temp5);
 1414|       |
 1415|       |    /* x2j = z1j - z2j                                                        */
 1416|    382|    temp6 = _mm_sub_epi32(temp1, temp2);
 1417|    382|    temp6 = _mm_add_epi32(temp6, value_32);
 1418|    382|    temp6 = _mm_srai_epi32(temp6, 6);
 1419|    382|    temp6 = _mm_min_epi32(dupmax_4x32b, temp6);
 1420|    382|    temp6 = _mm_max_epi32(dupmin_4x32b, temp6);
 1421|       |
 1422|       |    /* x3j = z0j - z3j                                                        */
 1423|    382|    temp7 = _mm_sub_epi32(temp0, temp3);
 1424|    382|    temp7 = _mm_add_epi32(temp7, value_32);
 1425|    382|    temp7 = _mm_srai_epi32(temp7, 6);
 1426|    382|    temp7 = _mm_min_epi32(dupmax_4x32b, temp7);
 1427|    382|    temp7 = _mm_max_epi32(dupmin_4x32b, temp7);
 1428|       |
 1429|       |    // 32-bit to 16-bit conversion
 1430|    382|    temp0 = _mm_packs_epi32(temp4, temp5);
 1431|    382|    temp1 = _mm_packs_epi32(temp6, temp7);
 1432|       |
 1433|    382|    resq_r0 = temp0;
 1434|    382|    resq_r1 = _mm_srli_si128(temp0, 8);
 1435|    382|    resq_r2 = temp1;
 1436|    382|    resq_r3 = _mm_srli_si128(temp1, 8);
 1437|       |
 1438|       |    // a00 a01 a02 a03 a10 a11 a12 a13 -- the source matrix 0th,1st row
 1439|    382|    src_r0 = _mm_loadu_si128((__m128i *) (pi2_out));
 1440|       |    // a20 a21 a22 a23 a30 a31 a32 a33 -- the source matrix 2nd,3rd row
 1441|    382|    src_r1 = _mm_loadu_si128((__m128i *) (pi2_out + (1 * out_strd)));
 1442|       |
 1443|    382|    src_r2 = _mm_loadu_si128((__m128i *) (pi2_out + (2 * out_strd)));
 1444|    382|    src_r3 = _mm_loadu_si128((__m128i *) (pi2_out + (3 * out_strd)));
 1445|       |
 1446|    382|    resq_r0 = _mm_and_si128(temp4, chroma_mask_even);  // macro 0 macro 0 ..
 1447|    382|    resq_r1 = _mm_and_si128(temp5, chroma_mask_even);
 1448|    382|    resq_r2 = _mm_and_si128(temp6, chroma_mask_even);
 1449|    382|    resq_r3 = _mm_and_si128(temp7, chroma_mask_even);
 1450|       |
 1451|    382|    src_r0 = _mm_and_si128(src_r0, chroma_mask_odd);  // 0 src1 0 src2 0 ...
 1452|    382|    src_r1 = _mm_and_si128(src_r1, chroma_mask_odd);
 1453|    382|    src_r2 = _mm_and_si128(src_r2, chroma_mask_odd);
 1454|    382|    src_r3 = _mm_and_si128(src_r3, chroma_mask_odd);
 1455|       |
 1456|    382|    src_r0 = _mm_add_epi16(src_r0, resq_r0);  // macro  src1 macro src2 macro ...
 1457|    382|    src_r1 = _mm_add_epi16(src_r1, resq_r1);
 1458|    382|    src_r2 = _mm_add_epi16(src_r2, resq_r2);
 1459|    382|    src_r3 = _mm_add_epi16(src_r3, resq_r3);
 1460|       |
 1461|    382|    _mm_storeu_si128((__m128i *) (&pi2_out[0]), src_r0);
 1462|    382|    _mm_storeu_si128((__m128i *) (&pi2_out[out_strd]), src_r1);
 1463|    382|    _mm_storeu_si128((__m128i *) (&pi2_out[2 * out_strd]), src_r2);
 1464|    382|    _mm_storeu_si128((__m128i *) (&pi2_out[3 * out_strd]), src_r3);
 1465|    382|}

isvcd_pred_residual_recon_4x4_sse42:
   83|  2.67k|{
   84|  2.67k|    __m128i pred_16x8b_0, pred_8x16b_0, rsd_8x16b_0, out_8x16b_0, out_16x8b_0;
   85|  2.67k|    __m128i pred_16x8b_1, pred_8x16b_1, rsd_8x16b_1, out_8x16b_1, out_16x8b_1;
   86|  2.67k|    __m128i pred_16x8b_2, pred_8x16b_2, rsd_8x16b_2, out_8x16b_2, out_16x8b_2;
   87|  2.67k|    __m128i pred_16x8b_3, pred_8x16b_3, rsd_8x16b_3, out_8x16b_3, out_16x8b_3;
   88|  2.67k|    __m128i rsd_8x16b_01, rsd_8x16b_23;
   89|       |
   90|  2.67k|    __m128i zero_8x16b = _mm_setzero_si128();
   91|  2.67k|    WORD32 i4_nnz, row_01, row_23;
   92|       |
   93|  2.67k|    pred_16x8b_0 = _mm_loadu_si128((__m128i *) (pu1_pred));
   94|  2.67k|    pred_16x8b_1 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd));
   95|  2.67k|    pred_16x8b_2 = _mm_loadu_si128((__m128i *) (pu1_pred + (pred_strd << 1)));
   96|  2.67k|    pred_16x8b_3 = _mm_loadu_si128((__m128i *) (pu1_pred + (pred_strd << 1) + pred_strd));
   97|       |
   98|  2.67k|    pred_8x16b_0 = _mm_cvtepu8_epi16(pred_16x8b_0);
   99|  2.67k|    pred_8x16b_1 = _mm_cvtepu8_epi16(pred_16x8b_1);
  100|  2.67k|    pred_8x16b_2 = _mm_cvtepu8_epi16(pred_16x8b_2);
  101|  2.67k|    pred_8x16b_3 = _mm_cvtepu8_epi16(pred_16x8b_3);
  102|       |
  103|  2.67k|    rsd_8x16b_0 = _mm_loadu_si128((__m128i *) (pi2_rsd));
  104|  2.67k|    rsd_8x16b_1 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd));
  105|  2.67k|    rsd_8x16b_2 = _mm_loadu_si128((__m128i *) (pi2_rsd + (rsd_strd << 1)));
  106|  2.67k|    rsd_8x16b_3 = _mm_loadu_si128((__m128i *) (pi2_rsd + (rsd_strd << 1) + rsd_strd));
  107|       |
  108|  2.67k|    rsd_8x16b_01 = _mm_unpacklo_epi64(rsd_8x16b_0, rsd_8x16b_1);
  109|  2.67k|    rsd_8x16b_23 = _mm_unpacklo_epi64(rsd_8x16b_2, rsd_8x16b_3);
  110|       |
  111|  2.67k|    row_01 = _mm_test_all_ones(
  112|  2.67k|        _mm_cmpeq_epi16(rsd_8x16b_01, zero_8x16b));  // return 1 if all zeros, else 0
  113|  2.67k|    row_23 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_23, zero_8x16b));
  114|       |
  115|  2.67k|    out_8x16b_0 = _mm_add_epi16(pred_8x16b_0, rsd_8x16b_0);
  116|  2.67k|    out_8x16b_1 = _mm_add_epi16(pred_8x16b_1, rsd_8x16b_1);
  117|  2.67k|    out_8x16b_2 = _mm_add_epi16(pred_8x16b_2, rsd_8x16b_2);
  118|  2.67k|    out_8x16b_3 = _mm_add_epi16(pred_8x16b_3, rsd_8x16b_3);
  119|       |
  120|  2.67k|    out_16x8b_0 = _mm_packus_epi16(out_8x16b_0, zero_8x16b);
  121|  2.67k|    out_16x8b_1 = _mm_packus_epi16(out_8x16b_1, zero_8x16b);
  122|  2.67k|    out_16x8b_2 = _mm_packus_epi16(out_8x16b_2, zero_8x16b);
  123|  2.67k|    out_16x8b_3 = _mm_packus_epi16(out_8x16b_3, zero_8x16b);
  124|       |
  125|  2.67k|    *((WORD32 *) (pu1_out)) = _mm_cvtsi128_si32(out_16x8b_0);
  126|  2.67k|    *((WORD32 *) (pu1_out + out_strd)) = _mm_cvtsi128_si32(out_16x8b_1);
  127|  2.67k|    *((WORD32 *) (pu1_out + (out_strd << 1))) = _mm_cvtsi128_si32(out_16x8b_2);
  128|  2.67k|    *((WORD32 *) (pu1_out + (out_strd * 3))) = _mm_cvtsi128_si32(out_16x8b_3);
  129|  2.67k|    i4_nnz = !(row_01 && row_23);
  ------------------
  |  Branch (129:16): [True: 2.67k, False: 2]
  |  Branch (129:26): [True: 2.67k, False: 0]
  ------------------
  130|       |
  131|  2.67k|    return i4_nnz;
  132|  2.67k|}
isvcd_pred_residual_recon_8x8_sse42:
  158|  2.96k|{
  159|  2.96k|    __m128i pred_16x8b_0, pred_8x16b_0, rsd_8x16b_0, out_8x16b_0, out_16x8b_0;
  160|  2.96k|    __m128i pred_16x8b_1, pred_8x16b_1, rsd_8x16b_1, out_8x16b_1, out_16x8b_1;
  161|  2.96k|    __m128i pred_16x8b_2, pred_8x16b_2, rsd_8x16b_2, out_8x16b_2, out_16x8b_2;
  162|  2.96k|    __m128i pred_16x8b_3, pred_8x16b_3, rsd_8x16b_3, out_8x16b_3, out_16x8b_3;
  163|  2.96k|    __m128i pred_16x8b_4, pred_8x16b_4, rsd_8x16b_4, out_8x16b_4, out_16x8b_4;
  164|  2.96k|    __m128i pred_16x8b_5, pred_8x16b_5, rsd_8x16b_5, out_8x16b_5, out_16x8b_5;
  165|  2.96k|    __m128i pred_16x8b_6, pred_8x16b_6, rsd_8x16b_6, out_8x16b_6, out_16x8b_6;
  166|  2.96k|    __m128i pred_16x8b_7, pred_8x16b_7, rsd_8x16b_7, out_8x16b_7, out_16x8b_7;
  167|  2.96k|    __m128i rsd_8x16b_01_b0, rsd_8x16b_23_b0, rsd_8x16b_45_b2, rsd_8x16b_67_b2;
  168|  2.96k|    __m128i rsd_8x16b_01_b1, rsd_8x16b_23_b1, rsd_8x16b_45_b3, rsd_8x16b_67_b3;
  169|       |
  170|  2.96k|    WORD32 row_01_b0, row_23_b0, row_45_b2, row_67_b2;
  171|  2.96k|    WORD32 row_01_b1, row_23_b1, row_45_b3, row_67_b3;
  172|  2.96k|    WORD32 i4_nnz, i4_nnz_b0, i4_nnz_b1, i4_nnz_b2, i4_nnz_b3;
  173|       |
  174|  2.96k|    __m128i zero_8x16b = _mm_setzero_si128();
  175|       |
  176|  2.96k|    WORD32 pred_strd2 = (pred_strd << 1);
  177|  2.96k|    WORD32 pred_strd4 = (pred_strd << 2);
  178|  2.96k|    WORD32 rsd_strd2 = (rsd_strd << 1);
  179|  2.96k|    WORD32 rsd_strd4 = (rsd_strd << 2);
  180|  2.96k|    WORD32 out_strd2 = (out_strd << 1);
  181|  2.96k|    WORD32 out_strd4 = (out_strd << 2);
  182|       |
  183|  2.96k|    pred_16x8b_0 = _mm_loadu_si128((__m128i *) (pu1_pred));
  184|  2.96k|    pred_16x8b_1 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd));
  185|  2.96k|    pred_16x8b_2 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd2));
  186|  2.96k|    pred_16x8b_3 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd2 + pred_strd));
  187|  2.96k|    pred_16x8b_4 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4));
  188|  2.96k|    pred_16x8b_5 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd));
  189|  2.96k|    pred_16x8b_6 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd2));
  190|  2.96k|    pred_16x8b_7 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd2 + pred_strd));
  191|       |
  192|  2.96k|    pred_8x16b_0 = _mm_cvtepu8_epi16(pred_16x8b_0);
  193|  2.96k|    pred_8x16b_1 = _mm_cvtepu8_epi16(pred_16x8b_1);
  194|  2.96k|    pred_8x16b_2 = _mm_cvtepu8_epi16(pred_16x8b_2);
  195|  2.96k|    pred_8x16b_3 = _mm_cvtepu8_epi16(pred_16x8b_3);
  196|  2.96k|    pred_8x16b_4 = _mm_cvtepu8_epi16(pred_16x8b_4);
  197|  2.96k|    pred_8x16b_5 = _mm_cvtepu8_epi16(pred_16x8b_5);
  198|  2.96k|    pred_8x16b_6 = _mm_cvtepu8_epi16(pred_16x8b_6);
  199|  2.96k|    pred_8x16b_7 = _mm_cvtepu8_epi16(pred_16x8b_7);
  200|       |
  201|  2.96k|    rsd_8x16b_0 = _mm_loadu_si128((__m128i *) (pi2_rsd));
  202|  2.96k|    rsd_8x16b_1 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd));
  203|  2.96k|    rsd_8x16b_2 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd2));
  204|  2.96k|    rsd_8x16b_3 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd2 + rsd_strd));
  205|  2.96k|    rsd_8x16b_4 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4));
  206|  2.96k|    rsd_8x16b_5 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd));
  207|  2.96k|    rsd_8x16b_6 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd2));
  208|  2.96k|    rsd_8x16b_7 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd2 + rsd_strd));
  209|       |
  210|  2.96k|    rsd_8x16b_01_b0 = _mm_unpacklo_epi64(rsd_8x16b_0, rsd_8x16b_1);
  211|  2.96k|    rsd_8x16b_23_b0 = _mm_unpacklo_epi64(rsd_8x16b_2, rsd_8x16b_3);
  212|  2.96k|    rsd_8x16b_01_b1 = _mm_unpackhi_epi64(rsd_8x16b_0, rsd_8x16b_1);
  213|  2.96k|    rsd_8x16b_23_b1 = _mm_unpackhi_epi64(rsd_8x16b_2, rsd_8x16b_3);
  214|       |
  215|  2.96k|    rsd_8x16b_45_b2 = _mm_unpacklo_epi64(rsd_8x16b_4, rsd_8x16b_5);
  216|  2.96k|    rsd_8x16b_67_b2 = _mm_unpacklo_epi64(rsd_8x16b_6, rsd_8x16b_7);
  217|  2.96k|    rsd_8x16b_45_b3 = _mm_unpackhi_epi64(rsd_8x16b_4, rsd_8x16b_5);
  218|  2.96k|    rsd_8x16b_67_b3 = _mm_unpackhi_epi64(rsd_8x16b_6, rsd_8x16b_7);
  219|       |
  220|  2.96k|    row_01_b0 = _mm_test_all_ones(
  221|  2.96k|        _mm_cmpeq_epi16(rsd_8x16b_01_b0, zero_8x16b));  // return 1 if all zeros, else 0
  222|  2.96k|    row_23_b0 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_23_b0, zero_8x16b));
  223|  2.96k|    row_01_b1 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_01_b1, zero_8x16b));
  224|  2.96k|    row_23_b1 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_23_b1, zero_8x16b));
  225|  2.96k|    row_45_b2 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_45_b2, zero_8x16b));
  226|  2.96k|    row_67_b2 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_67_b2, zero_8x16b));
  227|  2.96k|    row_45_b3 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_45_b3, zero_8x16b));
  228|  2.96k|    row_67_b3 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_67_b3, zero_8x16b));
  229|       |
  230|  2.96k|    out_8x16b_0 = _mm_add_epi16(pred_8x16b_0, rsd_8x16b_0);
  231|  2.96k|    out_8x16b_1 = _mm_add_epi16(pred_8x16b_1, rsd_8x16b_1);
  232|  2.96k|    out_8x16b_2 = _mm_add_epi16(pred_8x16b_2, rsd_8x16b_2);
  233|  2.96k|    out_8x16b_3 = _mm_add_epi16(pred_8x16b_3, rsd_8x16b_3);
  234|  2.96k|    out_8x16b_4 = _mm_add_epi16(pred_8x16b_4, rsd_8x16b_4);
  235|  2.96k|    out_8x16b_5 = _mm_add_epi16(pred_8x16b_5, rsd_8x16b_5);
  236|  2.96k|    out_8x16b_6 = _mm_add_epi16(pred_8x16b_6, rsd_8x16b_6);
  237|  2.96k|    out_8x16b_7 = _mm_add_epi16(pred_8x16b_7, rsd_8x16b_7);
  238|       |
  239|  2.96k|    out_16x8b_0 = _mm_packus_epi16(out_8x16b_0, zero_8x16b);
  240|  2.96k|    out_16x8b_1 = _mm_packus_epi16(out_8x16b_1, zero_8x16b);
  241|  2.96k|    out_16x8b_2 = _mm_packus_epi16(out_8x16b_2, zero_8x16b);
  242|  2.96k|    out_16x8b_3 = _mm_packus_epi16(out_8x16b_3, zero_8x16b);
  243|  2.96k|    out_16x8b_4 = _mm_packus_epi16(out_8x16b_4, zero_8x16b);
  244|  2.96k|    out_16x8b_5 = _mm_packus_epi16(out_8x16b_5, zero_8x16b);
  245|  2.96k|    out_16x8b_6 = _mm_packus_epi16(out_8x16b_6, zero_8x16b);
  246|  2.96k|    out_16x8b_7 = _mm_packus_epi16(out_8x16b_7, zero_8x16b);
  247|       |
  248|  2.96k|    _mm_storel_epi64((__m128i *) (pu1_out), out_16x8b_0);
  249|  2.96k|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd), out_16x8b_1);
  250|  2.96k|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd2), out_16x8b_2);
  251|  2.96k|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd2 + out_strd), out_16x8b_3);
  252|  2.96k|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4), out_16x8b_4);
  253|  2.96k|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd), out_16x8b_5);
  254|  2.96k|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd2), out_16x8b_6);
  255|  2.96k|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd2 + out_strd), out_16x8b_7);
  256|       |
  257|  2.96k|    i4_nnz_b0 = (!(row_01_b0 && row_23_b0));
  ------------------
  |  Branch (257:20): [True: 2.96k, False: 0]
  |  Branch (257:33): [True: 2.96k, False: 0]
  ------------------
  258|  2.96k|    i4_nnz_b1 = (!(row_01_b1 && row_23_b1)) << 1;
  ------------------
  |  Branch (258:20): [True: 2.96k, False: 0]
  |  Branch (258:33): [True: 2.96k, False: 0]
  ------------------
  259|  2.96k|    i4_nnz_b2 = (!(row_45_b2 && row_67_b2)) << 4;
  ------------------
  |  Branch (259:20): [True: 2.96k, False: 0]
  |  Branch (259:33): [True: 2.96k, False: 0]
  ------------------
  260|  2.96k|    i4_nnz_b3 = (!(row_45_b3 && row_67_b3)) << 5;
  ------------------
  |  Branch (260:20): [True: 2.96k, False: 0]
  |  Branch (260:33): [True: 2.96k, False: 0]
  ------------------
  261|       |
  262|  2.96k|    i4_nnz = (i4_nnz_b0 | i4_nnz_b1 | i4_nnz_b2 | i4_nnz_b3);
  263|  2.96k|    return i4_nnz;
  264|  2.96k|}
isvcd_pred_residual_recon_16x16_sse42:
  290|    411|{
  291|    411|    __m128i pred_16x8b_0, pred_8x16b_0, rsd_8x16b_0, out_8x16b_0, out_16x8b_0;
  292|    411|    __m128i pred_16x8b_1, pred_8x16b_1, rsd_8x16b_1, out_8x16b_1, out_16x8b_1;
  293|    411|    __m128i pred_16x8b_2, pred_8x16b_2, rsd_8x16b_2, out_8x16b_2, out_16x8b_2;
  294|    411|    __m128i pred_16x8b_3, pred_8x16b_3, rsd_8x16b_3, out_8x16b_3, out_16x8b_3;
  295|    411|    __m128i pred_16x8b_4, pred_8x16b_4, rsd_8x16b_4, out_8x16b_4, out_16x8b_4;
  296|    411|    __m128i pred_16x8b_5, pred_8x16b_5, rsd_8x16b_5, out_8x16b_5, out_16x8b_5;
  297|    411|    __m128i pred_16x8b_6, pred_8x16b_6, rsd_8x16b_6, out_8x16b_6, out_16x8b_6;
  298|    411|    __m128i pred_16x8b_7, pred_8x16b_7, rsd_8x16b_7, out_8x16b_7, out_16x8b_7;
  299|    411|    __m128i rsd_8x16b_01_b0, rsd_8x16b_23_b0, rsd_8x16b_45_b2, rsd_8x16b_67_b2;
  300|    411|    __m128i rsd_8x16b_01_b1, rsd_8x16b_23_b1, rsd_8x16b_45_b3, rsd_8x16b_67_b3;
  301|       |
  302|    411|    WORD32 row_01_b0, row_23_b0, row_45_b2, row_67_b2;
  303|    411|    WORD32 row_01_b1, row_23_b1, row_45_b3, row_67_b3;
  304|    411|    WORD32 i4_nnz, i4_nnz_b0, i4_nnz_b1, i4_nnz_b2, i4_nnz_b3;
  305|       |
  306|    411|    __m128i zero_8x16b = _mm_setzero_si128();
  307|       |
  308|    411|    WORD32 pred_strd2 = (pred_strd << 1);
  309|    411|    WORD32 pred_strd4 = (pred_strd << 2);
  310|    411|    WORD32 rsd_strd2 = (rsd_strd << 1);
  311|    411|    WORD32 rsd_strd4 = (rsd_strd << 2);
  312|    411|    WORD32 out_strd2 = (out_strd << 1);
  313|    411|    WORD32 out_strd4 = (out_strd << 2);
  314|       |
  315|    411|    pred_16x8b_0 = _mm_loadu_si128((__m128i *) (pu1_pred));
  316|    411|    pred_16x8b_1 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd));
  317|    411|    pred_16x8b_2 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd2));
  318|    411|    pred_16x8b_3 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd2 + pred_strd));
  319|    411|    pred_16x8b_4 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4));
  320|    411|    pred_16x8b_5 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd));
  321|    411|    pred_16x8b_6 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd2));
  322|    411|    pred_16x8b_7 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd2 + pred_strd));
  323|       |
  324|    411|    pred_8x16b_0 = _mm_cvtepu8_epi16(pred_16x8b_0);
  325|    411|    pred_8x16b_1 = _mm_cvtepu8_epi16(pred_16x8b_1);
  326|    411|    pred_8x16b_2 = _mm_cvtepu8_epi16(pred_16x8b_2);
  327|    411|    pred_8x16b_3 = _mm_cvtepu8_epi16(pred_16x8b_3);
  328|    411|    pred_8x16b_4 = _mm_cvtepu8_epi16(pred_16x8b_4);
  329|    411|    pred_8x16b_5 = _mm_cvtepu8_epi16(pred_16x8b_5);
  330|    411|    pred_8x16b_6 = _mm_cvtepu8_epi16(pred_16x8b_6);
  331|    411|    pred_8x16b_7 = _mm_cvtepu8_epi16(pred_16x8b_7);
  332|       |
  333|    411|    rsd_8x16b_0 = _mm_loadu_si128((__m128i *) (pi2_rsd));
  334|    411|    rsd_8x16b_1 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd));
  335|    411|    rsd_8x16b_2 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd2));
  336|    411|    rsd_8x16b_3 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd2 + rsd_strd));
  337|    411|    rsd_8x16b_4 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4));
  338|    411|    rsd_8x16b_5 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd));
  339|    411|    rsd_8x16b_6 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd2));
  340|    411|    rsd_8x16b_7 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd2 + rsd_strd));
  341|       |
  342|    411|    rsd_8x16b_01_b0 = _mm_unpacklo_epi64(rsd_8x16b_0, rsd_8x16b_1);
  343|    411|    rsd_8x16b_23_b0 = _mm_unpacklo_epi64(rsd_8x16b_2, rsd_8x16b_3);
  344|    411|    rsd_8x16b_01_b1 = _mm_unpackhi_epi64(rsd_8x16b_0, rsd_8x16b_1);
  345|    411|    rsd_8x16b_23_b1 = _mm_unpackhi_epi64(rsd_8x16b_2, rsd_8x16b_3);
  346|       |
  347|    411|    rsd_8x16b_45_b2 = _mm_unpacklo_epi64(rsd_8x16b_4, rsd_8x16b_5);
  348|    411|    rsd_8x16b_67_b2 = _mm_unpacklo_epi64(rsd_8x16b_6, rsd_8x16b_7);
  349|    411|    rsd_8x16b_45_b3 = _mm_unpackhi_epi64(rsd_8x16b_4, rsd_8x16b_5);
  350|    411|    rsd_8x16b_67_b3 = _mm_unpackhi_epi64(rsd_8x16b_6, rsd_8x16b_7);
  351|       |
  352|    411|    row_01_b0 = _mm_test_all_ones(
  353|    411|        _mm_cmpeq_epi16(rsd_8x16b_01_b0, zero_8x16b));  // return 1 if all zeros, else 0
  354|    411|    row_23_b0 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_23_b0, zero_8x16b));
  355|    411|    row_01_b1 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_01_b1, zero_8x16b));
  356|    411|    row_23_b1 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_23_b1, zero_8x16b));
  357|    411|    row_45_b2 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_45_b2, zero_8x16b));
  358|    411|    row_67_b2 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_67_b2, zero_8x16b));
  359|    411|    row_45_b3 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_45_b3, zero_8x16b));
  360|    411|    row_67_b3 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_67_b3, zero_8x16b));
  361|       |
  362|    411|    out_8x16b_0 = _mm_add_epi16(pred_8x16b_0, rsd_8x16b_0);
  363|    411|    out_8x16b_1 = _mm_add_epi16(pred_8x16b_1, rsd_8x16b_1);
  364|    411|    out_8x16b_2 = _mm_add_epi16(pred_8x16b_2, rsd_8x16b_2);
  365|    411|    out_8x16b_3 = _mm_add_epi16(pred_8x16b_3, rsd_8x16b_3);
  366|    411|    out_8x16b_4 = _mm_add_epi16(pred_8x16b_4, rsd_8x16b_4);
  367|    411|    out_8x16b_5 = _mm_add_epi16(pred_8x16b_5, rsd_8x16b_5);
  368|    411|    out_8x16b_6 = _mm_add_epi16(pred_8x16b_6, rsd_8x16b_6);
  369|    411|    out_8x16b_7 = _mm_add_epi16(pred_8x16b_7, rsd_8x16b_7);
  370|       |
  371|    411|    out_16x8b_0 = _mm_packus_epi16(out_8x16b_0, zero_8x16b);
  372|    411|    out_16x8b_1 = _mm_packus_epi16(out_8x16b_1, zero_8x16b);
  373|    411|    out_16x8b_2 = _mm_packus_epi16(out_8x16b_2, zero_8x16b);
  374|    411|    out_16x8b_3 = _mm_packus_epi16(out_8x16b_3, zero_8x16b);
  375|    411|    out_16x8b_4 = _mm_packus_epi16(out_8x16b_4, zero_8x16b);
  376|    411|    out_16x8b_5 = _mm_packus_epi16(out_8x16b_5, zero_8x16b);
  377|    411|    out_16x8b_6 = _mm_packus_epi16(out_8x16b_6, zero_8x16b);
  378|    411|    out_16x8b_7 = _mm_packus_epi16(out_8x16b_7, zero_8x16b);
  379|       |
  380|    411|    _mm_storel_epi64((__m128i *) (pu1_out), out_16x8b_0);
  381|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd), out_16x8b_1);
  382|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd2), out_16x8b_2);
  383|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd2 + out_strd), out_16x8b_3);
  384|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4), out_16x8b_4);
  385|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd), out_16x8b_5);
  386|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd2), out_16x8b_6);
  387|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd2 + out_strd), out_16x8b_7);
  388|       |
  389|    411|    i4_nnz_b0 = (!(row_01_b0 && row_23_b0));
  ------------------
  |  Branch (389:20): [True: 411, False: 0]
  |  Branch (389:33): [True: 411, False: 0]
  ------------------
  390|    411|    i4_nnz_b1 = (!(row_01_b1 && row_23_b1)) << 1;
  ------------------
  |  Branch (390:20): [True: 411, False: 0]
  |  Branch (390:33): [True: 411, False: 0]
  ------------------
  391|    411|    i4_nnz_b2 = (!(row_45_b2 && row_67_b2)) << 4;
  ------------------
  |  Branch (391:20): [True: 411, False: 0]
  |  Branch (391:33): [True: 411, False: 0]
  ------------------
  392|    411|    i4_nnz_b3 = (!(row_45_b3 && row_67_b3)) << 5;
  ------------------
  |  Branch (392:20): [True: 411, False: 0]
  |  Branch (392:33): [True: 411, False: 0]
  ------------------
  393|       |
  394|    411|    i4_nnz = (i4_nnz_b0 | i4_nnz_b1 | i4_nnz_b2 | i4_nnz_b3);
  395|       |
  396|    411|    pu1_pred += 8;
  397|    411|    pi2_rsd += 8;
  398|    411|    pu1_out += 8;
  399|       |
  400|    411|    pred_16x8b_0 = _mm_loadu_si128((__m128i *) (pu1_pred));
  401|    411|    pred_16x8b_1 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd));
  402|    411|    pred_16x8b_2 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd2));
  403|    411|    pred_16x8b_3 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd2 + pred_strd));
  404|    411|    pred_16x8b_4 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4));
  405|    411|    pred_16x8b_5 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd));
  406|    411|    pred_16x8b_6 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd2));
  407|    411|    pred_16x8b_7 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd2 + pred_strd));
  408|       |
  409|    411|    pred_8x16b_0 = _mm_cvtepu8_epi16(pred_16x8b_0);
  410|    411|    pred_8x16b_1 = _mm_cvtepu8_epi16(pred_16x8b_1);
  411|    411|    pred_8x16b_2 = _mm_cvtepu8_epi16(pred_16x8b_2);
  412|    411|    pred_8x16b_3 = _mm_cvtepu8_epi16(pred_16x8b_3);
  413|    411|    pred_8x16b_4 = _mm_cvtepu8_epi16(pred_16x8b_4);
  414|    411|    pred_8x16b_5 = _mm_cvtepu8_epi16(pred_16x8b_5);
  415|    411|    pred_8x16b_6 = _mm_cvtepu8_epi16(pred_16x8b_6);
  416|    411|    pred_8x16b_7 = _mm_cvtepu8_epi16(pred_16x8b_7);
  417|       |
  418|    411|    rsd_8x16b_0 = _mm_loadu_si128((__m128i *) (pi2_rsd));
  419|    411|    rsd_8x16b_1 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd));
  420|    411|    rsd_8x16b_2 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd2));
  421|    411|    rsd_8x16b_3 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd2 + rsd_strd));
  422|    411|    rsd_8x16b_4 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4));
  423|    411|    rsd_8x16b_5 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd));
  424|    411|    rsd_8x16b_6 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd2));
  425|    411|    rsd_8x16b_7 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd2 + rsd_strd));
  426|       |
  427|    411|    rsd_8x16b_01_b0 = _mm_unpacklo_epi64(rsd_8x16b_0, rsd_8x16b_1);
  428|    411|    rsd_8x16b_23_b0 = _mm_unpacklo_epi64(rsd_8x16b_2, rsd_8x16b_3);
  429|    411|    rsd_8x16b_01_b1 = _mm_unpackhi_epi64(rsd_8x16b_0, rsd_8x16b_1);
  430|    411|    rsd_8x16b_23_b1 = _mm_unpackhi_epi64(rsd_8x16b_2, rsd_8x16b_3);
  431|       |
  432|    411|    rsd_8x16b_45_b2 = _mm_unpacklo_epi64(rsd_8x16b_4, rsd_8x16b_5);
  433|    411|    rsd_8x16b_67_b2 = _mm_unpacklo_epi64(rsd_8x16b_6, rsd_8x16b_7);
  434|    411|    rsd_8x16b_45_b3 = _mm_unpackhi_epi64(rsd_8x16b_4, rsd_8x16b_5);
  435|    411|    rsd_8x16b_67_b3 = _mm_unpackhi_epi64(rsd_8x16b_6, rsd_8x16b_7);
  436|       |
  437|    411|    row_01_b0 = _mm_test_all_ones(
  438|    411|        _mm_cmpeq_epi16(rsd_8x16b_01_b0, zero_8x16b));  // return 1 if all zeros, else 0
  439|    411|    row_23_b0 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_23_b0, zero_8x16b));
  440|    411|    row_01_b1 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_01_b1, zero_8x16b));
  441|    411|    row_23_b1 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_23_b1, zero_8x16b));
  442|    411|    row_45_b2 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_45_b2, zero_8x16b));
  443|    411|    row_67_b2 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_67_b2, zero_8x16b));
  444|    411|    row_45_b3 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_45_b3, zero_8x16b));
  445|    411|    row_67_b3 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_67_b3, zero_8x16b));
  446|       |
  447|    411|    out_8x16b_0 = _mm_add_epi16(pred_8x16b_0, rsd_8x16b_0);
  448|    411|    out_8x16b_1 = _mm_add_epi16(pred_8x16b_1, rsd_8x16b_1);
  449|    411|    out_8x16b_2 = _mm_add_epi16(pred_8x16b_2, rsd_8x16b_2);
  450|    411|    out_8x16b_3 = _mm_add_epi16(pred_8x16b_3, rsd_8x16b_3);
  451|    411|    out_8x16b_4 = _mm_add_epi16(pred_8x16b_4, rsd_8x16b_4);
  452|    411|    out_8x16b_5 = _mm_add_epi16(pred_8x16b_5, rsd_8x16b_5);
  453|    411|    out_8x16b_6 = _mm_add_epi16(pred_8x16b_6, rsd_8x16b_6);
  454|    411|    out_8x16b_7 = _mm_add_epi16(pred_8x16b_7, rsd_8x16b_7);
  455|       |
  456|    411|    out_16x8b_0 = _mm_packus_epi16(out_8x16b_0, zero_8x16b);
  457|    411|    out_16x8b_1 = _mm_packus_epi16(out_8x16b_1, zero_8x16b);
  458|    411|    out_16x8b_2 = _mm_packus_epi16(out_8x16b_2, zero_8x16b);
  459|    411|    out_16x8b_3 = _mm_packus_epi16(out_8x16b_3, zero_8x16b);
  460|    411|    out_16x8b_4 = _mm_packus_epi16(out_8x16b_4, zero_8x16b);
  461|    411|    out_16x8b_5 = _mm_packus_epi16(out_8x16b_5, zero_8x16b);
  462|    411|    out_16x8b_6 = _mm_packus_epi16(out_8x16b_6, zero_8x16b);
  463|    411|    out_16x8b_7 = _mm_packus_epi16(out_8x16b_7, zero_8x16b);
  464|       |
  465|    411|    _mm_storel_epi64((__m128i *) (pu1_out), out_16x8b_0);
  466|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd), out_16x8b_1);
  467|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd2), out_16x8b_2);
  468|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd2 + out_strd), out_16x8b_3);
  469|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4), out_16x8b_4);
  470|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd), out_16x8b_5);
  471|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd2), out_16x8b_6);
  472|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd2 + out_strd), out_16x8b_7);
  473|       |
  474|    411|    i4_nnz_b0 = (!(row_01_b0 && row_23_b0)) << 2;
  ------------------
  |  Branch (474:20): [True: 411, False: 0]
  |  Branch (474:33): [True: 411, False: 0]
  ------------------
  475|    411|    i4_nnz_b1 = (!(row_01_b1 && row_23_b1)) << 3;
  ------------------
  |  Branch (475:20): [True: 411, False: 0]
  |  Branch (475:33): [True: 411, False: 0]
  ------------------
  476|    411|    i4_nnz_b2 = (!(row_45_b2 && row_67_b2)) << 6;
  ------------------
  |  Branch (476:20): [True: 411, False: 0]
  |  Branch (476:33): [True: 411, False: 0]
  ------------------
  477|    411|    i4_nnz_b3 = (!(row_45_b3 && row_67_b3)) << 7;
  ------------------
  |  Branch (477:20): [True: 411, False: 0]
  |  Branch (477:33): [True: 411, False: 0]
  ------------------
  478|       |
  479|    411|    i4_nnz |= (i4_nnz_b0 | i4_nnz_b1 | i4_nnz_b2 | i4_nnz_b3);
  480|       |
  481|    411|    pu1_pred -= 8;
  482|    411|    pi2_rsd -= 8;
  483|    411|    pu1_out -= 8;
  484|       |
  485|    411|    pu1_pred += (pred_strd << 3);
  486|    411|    pi2_rsd += (rsd_strd << 3);
  487|    411|    pu1_out += (out_strd << 3);
  488|       |
  489|    411|    pred_16x8b_0 = _mm_loadu_si128((__m128i *) (pu1_pred));
  490|    411|    pred_16x8b_1 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd));
  491|    411|    pred_16x8b_2 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd2));
  492|    411|    pred_16x8b_3 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd2 + pred_strd));
  493|    411|    pred_16x8b_4 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4));
  494|    411|    pred_16x8b_5 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd));
  495|    411|    pred_16x8b_6 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd2));
  496|    411|    pred_16x8b_7 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd2 + pred_strd));
  497|       |
  498|    411|    pred_8x16b_0 = _mm_cvtepu8_epi16(pred_16x8b_0);
  499|    411|    pred_8x16b_1 = _mm_cvtepu8_epi16(pred_16x8b_1);
  500|    411|    pred_8x16b_2 = _mm_cvtepu8_epi16(pred_16x8b_2);
  501|    411|    pred_8x16b_3 = _mm_cvtepu8_epi16(pred_16x8b_3);
  502|    411|    pred_8x16b_4 = _mm_cvtepu8_epi16(pred_16x8b_4);
  503|    411|    pred_8x16b_5 = _mm_cvtepu8_epi16(pred_16x8b_5);
  504|    411|    pred_8x16b_6 = _mm_cvtepu8_epi16(pred_16x8b_6);
  505|    411|    pred_8x16b_7 = _mm_cvtepu8_epi16(pred_16x8b_7);
  506|       |
  507|    411|    rsd_8x16b_0 = _mm_loadu_si128((__m128i *) (pi2_rsd));
  508|    411|    rsd_8x16b_1 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd));
  509|    411|    rsd_8x16b_2 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd2));
  510|    411|    rsd_8x16b_3 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd2 + rsd_strd));
  511|    411|    rsd_8x16b_4 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4));
  512|    411|    rsd_8x16b_5 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd));
  513|    411|    rsd_8x16b_6 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd2));
  514|    411|    rsd_8x16b_7 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd2 + rsd_strd));
  515|       |
  516|    411|    rsd_8x16b_01_b0 = _mm_unpacklo_epi64(rsd_8x16b_0, rsd_8x16b_1);
  517|    411|    rsd_8x16b_23_b0 = _mm_unpacklo_epi64(rsd_8x16b_2, rsd_8x16b_3);
  518|    411|    rsd_8x16b_01_b1 = _mm_unpackhi_epi64(rsd_8x16b_0, rsd_8x16b_1);
  519|    411|    rsd_8x16b_23_b1 = _mm_unpackhi_epi64(rsd_8x16b_2, rsd_8x16b_3);
  520|       |
  521|    411|    rsd_8x16b_45_b2 = _mm_unpacklo_epi64(rsd_8x16b_4, rsd_8x16b_5);
  522|    411|    rsd_8x16b_67_b2 = _mm_unpacklo_epi64(rsd_8x16b_6, rsd_8x16b_7);
  523|    411|    rsd_8x16b_45_b3 = _mm_unpackhi_epi64(rsd_8x16b_4, rsd_8x16b_5);
  524|    411|    rsd_8x16b_67_b3 = _mm_unpackhi_epi64(rsd_8x16b_6, rsd_8x16b_7);
  525|       |
  526|    411|    row_01_b0 = _mm_test_all_ones(
  527|    411|        _mm_cmpeq_epi16(rsd_8x16b_01_b0, zero_8x16b));  // return 1 if all zeros, else 0
  528|    411|    row_23_b0 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_23_b0, zero_8x16b));
  529|    411|    row_01_b1 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_01_b1, zero_8x16b));
  530|    411|    row_23_b1 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_23_b1, zero_8x16b));
  531|    411|    row_45_b2 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_45_b2, zero_8x16b));
  532|    411|    row_67_b2 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_67_b2, zero_8x16b));
  533|    411|    row_45_b3 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_45_b3, zero_8x16b));
  534|    411|    row_67_b3 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_67_b3, zero_8x16b));
  535|       |
  536|    411|    out_8x16b_0 = _mm_add_epi16(pred_8x16b_0, rsd_8x16b_0);
  537|    411|    out_8x16b_1 = _mm_add_epi16(pred_8x16b_1, rsd_8x16b_1);
  538|    411|    out_8x16b_2 = _mm_add_epi16(pred_8x16b_2, rsd_8x16b_2);
  539|    411|    out_8x16b_3 = _mm_add_epi16(pred_8x16b_3, rsd_8x16b_3);
  540|    411|    out_8x16b_4 = _mm_add_epi16(pred_8x16b_4, rsd_8x16b_4);
  541|    411|    out_8x16b_5 = _mm_add_epi16(pred_8x16b_5, rsd_8x16b_5);
  542|    411|    out_8x16b_6 = _mm_add_epi16(pred_8x16b_6, rsd_8x16b_6);
  543|    411|    out_8x16b_7 = _mm_add_epi16(pred_8x16b_7, rsd_8x16b_7);
  544|       |
  545|    411|    out_16x8b_0 = _mm_packus_epi16(out_8x16b_0, zero_8x16b);
  546|    411|    out_16x8b_1 = _mm_packus_epi16(out_8x16b_1, zero_8x16b);
  547|    411|    out_16x8b_2 = _mm_packus_epi16(out_8x16b_2, zero_8x16b);
  548|    411|    out_16x8b_3 = _mm_packus_epi16(out_8x16b_3, zero_8x16b);
  549|    411|    out_16x8b_4 = _mm_packus_epi16(out_8x16b_4, zero_8x16b);
  550|    411|    out_16x8b_5 = _mm_packus_epi16(out_8x16b_5, zero_8x16b);
  551|    411|    out_16x8b_6 = _mm_packus_epi16(out_8x16b_6, zero_8x16b);
  552|    411|    out_16x8b_7 = _mm_packus_epi16(out_8x16b_7, zero_8x16b);
  553|       |
  554|    411|    _mm_storel_epi64((__m128i *) (pu1_out), out_16x8b_0);
  555|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd), out_16x8b_1);
  556|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd2), out_16x8b_2);
  557|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd2 + out_strd), out_16x8b_3);
  558|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4), out_16x8b_4);
  559|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd), out_16x8b_5);
  560|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd2), out_16x8b_6);
  561|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd2 + out_strd), out_16x8b_7);
  562|       |
  563|    411|    i4_nnz_b0 = (!(row_01_b0 && row_23_b0)) << 8;
  ------------------
  |  Branch (563:20): [True: 411, False: 0]
  |  Branch (563:33): [True: 411, False: 0]
  ------------------
  564|    411|    i4_nnz_b1 = (!(row_01_b1 && row_23_b1)) << 9;
  ------------------
  |  Branch (564:20): [True: 411, False: 0]
  |  Branch (564:33): [True: 411, False: 0]
  ------------------
  565|    411|    i4_nnz_b2 = (!(row_45_b2 && row_67_b2)) << 12;
  ------------------
  |  Branch (565:20): [True: 411, False: 0]
  |  Branch (565:33): [True: 411, False: 0]
  ------------------
  566|    411|    i4_nnz_b3 = (!(row_45_b3 && row_67_b3)) << 13;
  ------------------
  |  Branch (566:20): [True: 411, False: 0]
  |  Branch (566:33): [True: 411, False: 0]
  ------------------
  567|       |
  568|    411|    i4_nnz |= (i4_nnz_b0 | i4_nnz_b1 | i4_nnz_b2 | i4_nnz_b3);
  569|       |
  570|    411|    pu1_pred += 8;
  571|    411|    pi2_rsd += 8;
  572|    411|    pu1_out += 8;
  573|       |
  574|    411|    pred_16x8b_0 = _mm_loadu_si128((__m128i *) (pu1_pred));
  575|    411|    pred_16x8b_1 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd));
  576|    411|    pred_16x8b_2 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd2));
  577|    411|    pred_16x8b_3 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd2 + pred_strd));
  578|    411|    pred_16x8b_4 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4));
  579|    411|    pred_16x8b_5 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd));
  580|    411|    pred_16x8b_6 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd2));
  581|    411|    pred_16x8b_7 = _mm_loadu_si128((__m128i *) (pu1_pred + pred_strd4 + pred_strd2 + pred_strd));
  582|       |
  583|    411|    pred_8x16b_0 = _mm_cvtepu8_epi16(pred_16x8b_0);
  584|    411|    pred_8x16b_1 = _mm_cvtepu8_epi16(pred_16x8b_1);
  585|    411|    pred_8x16b_2 = _mm_cvtepu8_epi16(pred_16x8b_2);
  586|    411|    pred_8x16b_3 = _mm_cvtepu8_epi16(pred_16x8b_3);
  587|    411|    pred_8x16b_4 = _mm_cvtepu8_epi16(pred_16x8b_4);
  588|    411|    pred_8x16b_5 = _mm_cvtepu8_epi16(pred_16x8b_5);
  589|    411|    pred_8x16b_6 = _mm_cvtepu8_epi16(pred_16x8b_6);
  590|    411|    pred_8x16b_7 = _mm_cvtepu8_epi16(pred_16x8b_7);
  591|       |
  592|    411|    rsd_8x16b_0 = _mm_loadu_si128((__m128i *) (pi2_rsd));
  593|    411|    rsd_8x16b_1 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd));
  594|    411|    rsd_8x16b_2 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd2));
  595|    411|    rsd_8x16b_3 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd2 + rsd_strd));
  596|    411|    rsd_8x16b_4 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4));
  597|    411|    rsd_8x16b_5 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd));
  598|    411|    rsd_8x16b_6 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd2));
  599|    411|    rsd_8x16b_7 = _mm_loadu_si128((__m128i *) (pi2_rsd + rsd_strd4 + rsd_strd2 + rsd_strd));
  600|       |
  601|    411|    rsd_8x16b_01_b0 = _mm_unpacklo_epi64(rsd_8x16b_0, rsd_8x16b_1);
  602|    411|    rsd_8x16b_23_b0 = _mm_unpacklo_epi64(rsd_8x16b_2, rsd_8x16b_3);
  603|    411|    rsd_8x16b_01_b1 = _mm_unpackhi_epi64(rsd_8x16b_0, rsd_8x16b_1);
  604|    411|    rsd_8x16b_23_b1 = _mm_unpackhi_epi64(rsd_8x16b_2, rsd_8x16b_3);
  605|       |
  606|    411|    rsd_8x16b_45_b2 = _mm_unpacklo_epi64(rsd_8x16b_4, rsd_8x16b_5);
  607|    411|    rsd_8x16b_67_b2 = _mm_unpacklo_epi64(rsd_8x16b_6, rsd_8x16b_7);
  608|    411|    rsd_8x16b_45_b3 = _mm_unpackhi_epi64(rsd_8x16b_4, rsd_8x16b_5);
  609|    411|    rsd_8x16b_67_b3 = _mm_unpackhi_epi64(rsd_8x16b_6, rsd_8x16b_7);
  610|       |
  611|    411|    row_01_b0 = _mm_test_all_ones(
  612|    411|        _mm_cmpeq_epi16(rsd_8x16b_01_b0, zero_8x16b));  // return 1 if all zeros, else 0
  613|    411|    row_23_b0 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_23_b0, zero_8x16b));
  614|    411|    row_01_b1 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_01_b1, zero_8x16b));
  615|    411|    row_23_b1 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_23_b1, zero_8x16b));
  616|    411|    row_45_b2 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_45_b2, zero_8x16b));
  617|    411|    row_67_b2 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_67_b2, zero_8x16b));
  618|    411|    row_45_b3 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_45_b3, zero_8x16b));
  619|    411|    row_67_b3 = _mm_test_all_ones(_mm_cmpeq_epi16(rsd_8x16b_67_b3, zero_8x16b));
  620|       |
  621|    411|    out_8x16b_0 = _mm_add_epi16(pred_8x16b_0, rsd_8x16b_0);
  622|    411|    out_8x16b_1 = _mm_add_epi16(pred_8x16b_1, rsd_8x16b_1);
  623|    411|    out_8x16b_2 = _mm_add_epi16(pred_8x16b_2, rsd_8x16b_2);
  624|    411|    out_8x16b_3 = _mm_add_epi16(pred_8x16b_3, rsd_8x16b_3);
  625|    411|    out_8x16b_4 = _mm_add_epi16(pred_8x16b_4, rsd_8x16b_4);
  626|    411|    out_8x16b_5 = _mm_add_epi16(pred_8x16b_5, rsd_8x16b_5);
  627|    411|    out_8x16b_6 = _mm_add_epi16(pred_8x16b_6, rsd_8x16b_6);
  628|    411|    out_8x16b_7 = _mm_add_epi16(pred_8x16b_7, rsd_8x16b_7);
  629|       |
  630|    411|    out_16x8b_0 = _mm_packus_epi16(out_8x16b_0, zero_8x16b);
  631|    411|    out_16x8b_1 = _mm_packus_epi16(out_8x16b_1, zero_8x16b);
  632|    411|    out_16x8b_2 = _mm_packus_epi16(out_8x16b_2, zero_8x16b);
  633|    411|    out_16x8b_3 = _mm_packus_epi16(out_8x16b_3, zero_8x16b);
  634|    411|    out_16x8b_4 = _mm_packus_epi16(out_8x16b_4, zero_8x16b);
  635|    411|    out_16x8b_5 = _mm_packus_epi16(out_8x16b_5, zero_8x16b);
  636|    411|    out_16x8b_6 = _mm_packus_epi16(out_8x16b_6, zero_8x16b);
  637|    411|    out_16x8b_7 = _mm_packus_epi16(out_8x16b_7, zero_8x16b);
  638|       |
  639|    411|    _mm_storel_epi64((__m128i *) (pu1_out), out_16x8b_0);
  640|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd), out_16x8b_1);
  641|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd2), out_16x8b_2);
  642|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd2 + out_strd), out_16x8b_3);
  643|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4), out_16x8b_4);
  644|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd), out_16x8b_5);
  645|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd2), out_16x8b_6);
  646|    411|    _mm_storel_epi64((__m128i *) (pu1_out + out_strd4 + out_strd2 + out_strd), out_16x8b_7);
  647|       |
  648|    411|    i4_nnz_b0 = (!(row_01_b0 && row_23_b0)) << 10;
  ------------------
  |  Branch (648:20): [True: 411, False: 0]
  |  Branch (648:33): [True: 411, False: 0]
  ------------------
  649|    411|    i4_nnz_b1 = (!(row_01_b1 && row_23_b1)) << 11;
  ------------------
  |  Branch (649:20): [True: 411, False: 0]
  |  Branch (649:33): [True: 411, False: 0]
  ------------------
  650|    411|    i4_nnz_b2 = (!(row_45_b2 && row_67_b2)) << 14;
  ------------------
  |  Branch (650:20): [True: 411, False: 0]
  |  Branch (650:33): [True: 411, False: 0]
  ------------------
  651|    411|    i4_nnz_b3 = (!(row_45_b3 && row_67_b3)) << 15;
  ------------------
  |  Branch (651:20): [True: 411, False: 0]
  |  Branch (651:33): [True: 411, False: 0]
  ------------------
  652|       |
  653|    411|    i4_nnz |= (i4_nnz_b0 | i4_nnz_b1 | i4_nnz_b2 | i4_nnz_b3);
  654|    411|    return i4_nnz;
  655|    411|}
isvcd_pred_residual_recon_chroma_4x4_sse42:
  681|  2.60k|{
  682|  2.60k|    __m128i src_r0, src_r1, src_r2, src_r3;
  683|  2.60k|    __m128i pred_r0, pred_r1, pred_r2, pred_r3;
  684|  2.60k|    __m128i pred0, pred1, pred2, pred3;
  685|  2.60k|    __m128i rsd_r0, rsd_r1, rsd_r2, rsd_r3;
  686|  2.60k|    __m128i zero_16x8b;  // all bits reset to zero
  687|  2.60k|    __m128i chroma_mask_even;
  688|  2.60k|    __m128i chroma_mask_odd;
  689|       |
  690|  2.60k|    zero_16x8b = _mm_setzero_si128();
  691|       |
  692|  2.60k|    rsd_r0 = _mm_loadu_si128((__m128i *) (pi2_rsd));
  693|  2.60k|    rsd_r1 = _mm_loadu_si128((__m128i *) (pi2_rsd + (1 * rsd_strd)));
  694|  2.60k|    rsd_r2 = _mm_loadu_si128((__m128i *) (pi2_rsd + (2 * rsd_strd)));
  695|  2.60k|    rsd_r3 = _mm_loadu_si128((__m128i *) (pi2_rsd + (3 * rsd_strd)));
  696|       |
  697|  2.60k|    pred_r0 = _mm_loadu_si128((__m128i *) (pu1_pred));
  698|  2.60k|    pred_r1 = _mm_loadu_si128((__m128i *) (pu1_pred + (1 * pred_strd)));
  699|  2.60k|    pred_r2 = _mm_loadu_si128((__m128i *) (pu1_pred + (2 * pred_strd)));
  700|  2.60k|    pred_r3 = _mm_loadu_si128((__m128i *) (pu1_pred + (3 * pred_strd)));
  701|       |
  702|  2.60k|    src_r0 = _mm_loadu_si128((__m128i *) (pu1_out));
  703|  2.60k|    src_r1 = _mm_loadu_si128((__m128i *) (pu1_out + (1 * out_strd)));
  704|  2.60k|    src_r2 = _mm_loadu_si128((__m128i *) (pu1_out + (2 * out_strd)));
  705|  2.60k|    src_r3 = _mm_loadu_si128((__m128i *) (pu1_out + (3 * out_strd)));
  706|       |
  707|  2.60k|    pred0 = _mm_cvtepu8_epi16(pred_r0);
  708|  2.60k|    pred1 = _mm_cvtepu8_epi16(pred_r1);
  709|  2.60k|    pred2 = _mm_cvtepu8_epi16(pred_r2);
  710|  2.60k|    pred3 = _mm_cvtepu8_epi16(pred_r3);
  711|       |
  712|  2.60k|    pred0 = _mm_add_epi16(pred0, rsd_r0);
  713|  2.60k|    pred1 = _mm_add_epi16(pred1, rsd_r1);
  714|  2.60k|    pred2 = _mm_add_epi16(pred2, rsd_r2);
  715|  2.60k|    pred3 = _mm_add_epi16(pred3, rsd_r3);
  716|       |
  717|  2.60k|    pred0 = _mm_packus_epi16(pred0, zero_16x8b);
  718|  2.60k|    pred1 = _mm_packus_epi16(pred1, zero_16x8b);
  719|  2.60k|    pred2 = _mm_packus_epi16(pred2, zero_16x8b);
  720|  2.60k|    pred3 = _mm_packus_epi16(pred3, zero_16x8b);
  721|       |
  722|  2.60k|    chroma_mask_even = _mm_set_epi8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
  723|  2.60k|                                    0x00, 0xff, 0x00, 0xff, 0x00, 0xff);
  724|  2.60k|    chroma_mask_odd = _mm_set_epi8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff,
  725|  2.60k|                                   0x00, 0xff, 0x00, 0xff, 0x00);
  726|       |
  727|  2.60k|    src_r0 = _mm_and_si128(src_r0, chroma_mask_odd);  // 0 src1 0 src2 0 ...
  728|  2.60k|    src_r1 = _mm_and_si128(src_r1, chroma_mask_odd);
  729|  2.60k|    src_r2 = _mm_and_si128(src_r2, chroma_mask_odd);
  730|  2.60k|    src_r3 = _mm_and_si128(src_r3, chroma_mask_odd);
  731|       |
  732|  2.60k|    pred0 = _mm_and_si128(pred0, chroma_mask_even);  // val 0 val 0 ..
  733|  2.60k|    pred1 = _mm_and_si128(pred1, chroma_mask_even);
  734|  2.60k|    pred2 = _mm_and_si128(pred2, chroma_mask_even);
  735|  2.60k|    pred3 = _mm_and_si128(pred3, chroma_mask_even);
  736|       |
  737|  2.60k|    src_r0 = _mm_add_epi8(src_r0, pred0);  // macro  src1 macro src2 macro ...
  738|  2.60k|    src_r1 = _mm_add_epi8(src_r1, pred1);
  739|  2.60k|    src_r2 = _mm_add_epi8(src_r2, pred2);
  740|  2.60k|    src_r3 = _mm_add_epi8(src_r3, pred3);
  741|       |
  742|  2.60k|    _mm_storel_epi64((__m128i *) (&pu1_out[0]), src_r0);
  743|  2.60k|    _mm_storel_epi64((__m128i *) (&pu1_out[out_strd]), src_r1);
  744|  2.60k|    _mm_storel_epi64((__m128i *) (&pu1_out[2 * out_strd]), src_r2);
  745|  2.60k|    _mm_storel_epi64((__m128i *) (&pu1_out[3 * out_strd]), src_r3);
  746|  2.60k|}
isvcd_pred_residual_recon_chroma_8x8_sse42:
  772|  8.64k|{
  773|  8.64k|    __m128i src_r0, src_r1, src_r2, src_r3, src_r4, src_r5, src_r6, src_r7;
  774|  8.64k|    __m128i pred0, pred1, pred2, pred3, pred4, pred5, pred6, pred7;
  775|  8.64k|    __m128i rsd_r0, rsd_r1, rsd_r2, rsd_r3, rsd_r4, rsd_r5, rsd_r6, rsd_r7;
  776|  8.64k|    __m128i zero_16x8b;  // all bits reset to zero
  777|  8.64k|    __m128i chroma_mask_even;
  778|  8.64k|    __m128i chroma_mask_odd;
  779|       |
  780|  8.64k|    zero_16x8b = _mm_setzero_si128();
  781|       |
  782|  8.64k|    rsd_r0 = _mm_loadu_si128((__m128i *) (pi2_rsd));
  783|  8.64k|    rsd_r1 = _mm_loadu_si128((__m128i *) (pi2_rsd + (1 * rsd_strd)));
  784|  8.64k|    rsd_r2 = _mm_loadu_si128((__m128i *) (pi2_rsd + (2 * rsd_strd)));
  785|  8.64k|    rsd_r3 = _mm_loadu_si128((__m128i *) (pi2_rsd + (3 * rsd_strd)));
  786|  8.64k|    rsd_r4 = _mm_loadu_si128((__m128i *) (pi2_rsd + (4 * rsd_strd)));
  787|  8.64k|    rsd_r5 = _mm_loadu_si128((__m128i *) (pi2_rsd + (5 * rsd_strd)));
  788|  8.64k|    rsd_r6 = _mm_loadu_si128((__m128i *) (pi2_rsd + (6 * rsd_strd)));
  789|  8.64k|    rsd_r7 = _mm_loadu_si128((__m128i *) (pi2_rsd + (7 * rsd_strd)));
  790|       |
  791|  8.64k|    pred0 = _mm_loadu_si128((__m128i *) (pu1_pred));
  792|  8.64k|    pred1 = _mm_loadu_si128((__m128i *) (pu1_pred + (1 * pred_strd)));
  793|  8.64k|    pred2 = _mm_loadu_si128((__m128i *) (pu1_pred + (2 * pred_strd)));
  794|  8.64k|    pred3 = _mm_loadu_si128((__m128i *) (pu1_pred + (3 * pred_strd)));
  795|  8.64k|    pred4 = _mm_loadu_si128((__m128i *) (pu1_pred + (4 * pred_strd)));
  796|  8.64k|    pred5 = _mm_loadu_si128((__m128i *) (pu1_pred + (5 * pred_strd)));
  797|  8.64k|    pred6 = _mm_loadu_si128((__m128i *) (pu1_pred + (6 * pred_strd)));
  798|  8.64k|    pred7 = _mm_loadu_si128((__m128i *) (pu1_pred + (7 * pred_strd)));
  799|       |
  800|  8.64k|    src_r0 = _mm_loadu_si128((__m128i *) (pu1_out));
  801|  8.64k|    src_r1 = _mm_loadu_si128((__m128i *) (pu1_out + (1 * out_strd)));
  802|  8.64k|    src_r2 = _mm_loadu_si128((__m128i *) (pu1_out + (2 * out_strd)));
  803|  8.64k|    src_r3 = _mm_loadu_si128((__m128i *) (pu1_out + (3 * out_strd)));
  804|  8.64k|    src_r4 = _mm_loadu_si128((__m128i *) (pu1_out + (4 * out_strd)));
  805|  8.64k|    src_r5 = _mm_loadu_si128((__m128i *) (pu1_out + (5 * out_strd)));
  806|  8.64k|    src_r6 = _mm_loadu_si128((__m128i *) (pu1_out + (6 * out_strd)));
  807|  8.64k|    src_r7 = _mm_loadu_si128((__m128i *) (pu1_out + (7 * out_strd)));
  808|       |
  809|  8.64k|    pred0 = _mm_cvtepu8_epi16(pred0);
  810|  8.64k|    pred1 = _mm_cvtepu8_epi16(pred1);
  811|  8.64k|    pred2 = _mm_cvtepu8_epi16(pred2);
  812|  8.64k|    pred3 = _mm_cvtepu8_epi16(pred3);
  813|  8.64k|    pred4 = _mm_cvtepu8_epi16(pred4);
  814|  8.64k|    pred5 = _mm_cvtepu8_epi16(pred5);
  815|  8.64k|    pred6 = _mm_cvtepu8_epi16(pred6);
  816|  8.64k|    pred7 = _mm_cvtepu8_epi16(pred7);
  817|       |
  818|  8.64k|    pred0 = _mm_add_epi16(pred0, rsd_r0);
  819|  8.64k|    pred1 = _mm_add_epi16(pred1, rsd_r1);
  820|  8.64k|    pred2 = _mm_add_epi16(pred2, rsd_r2);
  821|  8.64k|    pred3 = _mm_add_epi16(pred3, rsd_r3);
  822|  8.64k|    pred4 = _mm_add_epi16(pred4, rsd_r4);
  823|  8.64k|    pred5 = _mm_add_epi16(pred5, rsd_r5);
  824|  8.64k|    pred6 = _mm_add_epi16(pred6, rsd_r6);
  825|  8.64k|    pred7 = _mm_add_epi16(pred7, rsd_r7);
  826|       |
  827|  8.64k|    pred0 = _mm_packus_epi16(pred0, zero_16x8b);
  828|  8.64k|    pred1 = _mm_packus_epi16(pred1, zero_16x8b);
  829|  8.64k|    pred2 = _mm_packus_epi16(pred2, zero_16x8b);
  830|  8.64k|    pred3 = _mm_packus_epi16(pred3, zero_16x8b);
  831|  8.64k|    pred4 = _mm_packus_epi16(pred4, zero_16x8b);
  832|  8.64k|    pred5 = _mm_packus_epi16(pred5, zero_16x8b);
  833|  8.64k|    pred6 = _mm_packus_epi16(pred6, zero_16x8b);
  834|  8.64k|    pred7 = _mm_packus_epi16(pred7, zero_16x8b);
  835|       |
  836|  8.64k|    chroma_mask_even = _mm_set_epi8(0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff,
  837|  8.64k|                                    0x00, 0xff, 0x00, 0xff, 0x00, 0xff);
  838|  8.64k|    chroma_mask_odd = _mm_set_epi8(0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff,
  839|  8.64k|                                   0x00, 0xff, 0x00, 0xff, 0x00);
  840|       |
  841|  8.64k|    src_r0 = _mm_and_si128(src_r0, chroma_mask_odd);  // 0 src1 0 src2 0 ...
  842|  8.64k|    src_r1 = _mm_and_si128(src_r1, chroma_mask_odd);
  843|  8.64k|    src_r2 = _mm_and_si128(src_r2, chroma_mask_odd);
  844|  8.64k|    src_r3 = _mm_and_si128(src_r3, chroma_mask_odd);
  845|  8.64k|    src_r4 = _mm_and_si128(src_r4, chroma_mask_odd);
  846|  8.64k|    src_r5 = _mm_and_si128(src_r5, chroma_mask_odd);
  847|  8.64k|    src_r6 = _mm_and_si128(src_r6, chroma_mask_odd);
  848|  8.64k|    src_r7 = _mm_and_si128(src_r7, chroma_mask_odd);
  849|       |
  850|  8.64k|    pred0 = _mm_and_si128(pred0, chroma_mask_even);  // val 0 val 0 ..
  851|  8.64k|    pred1 = _mm_and_si128(pred1, chroma_mask_even);
  852|  8.64k|    pred2 = _mm_and_si128(pred2, chroma_mask_even);
  853|  8.64k|    pred3 = _mm_and_si128(pred3, chroma_mask_even);
  854|  8.64k|    pred4 = _mm_and_si128(pred4, chroma_mask_even);
  855|  8.64k|    pred5 = _mm_and_si128(pred5, chroma_mask_even);
  856|  8.64k|    pred6 = _mm_and_si128(pred6, chroma_mask_even);
  857|  8.64k|    pred7 = _mm_and_si128(pred7, chroma_mask_even);
  858|       |
  859|  8.64k|    src_r0 = _mm_add_epi8(src_r0, pred0);  // macro  src1 macro src2 macro ...
  860|  8.64k|    src_r1 = _mm_add_epi8(src_r1, pred1);
  861|  8.64k|    src_r2 = _mm_add_epi8(src_r2, pred2);
  862|  8.64k|    src_r3 = _mm_add_epi8(src_r3, pred3);
  863|  8.64k|    src_r4 = _mm_add_epi8(src_r4, pred4);
  864|  8.64k|    src_r5 = _mm_add_epi8(src_r5, pred5);
  865|  8.64k|    src_r6 = _mm_add_epi8(src_r6, pred6);
  866|  8.64k|    src_r7 = _mm_add_epi8(src_r7, pred7);
  867|       |
  868|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[0]), src_r0);
  869|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[out_strd]), src_r1);
  870|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[2 * out_strd]), src_r2);
  871|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[3 * out_strd]), src_r3);
  872|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[4 * out_strd]), src_r4);
  873|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[5 * out_strd]), src_r5);
  874|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[6 * out_strd]), src_r6);
  875|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[7 * out_strd]), src_r7);
  876|       |
  877|       |    /* load and repeat for the last 4 elements interleaved in the row */
  878|       |
  879|  8.64k|    rsd_r0 = _mm_loadu_si128((__m128i *) (pi2_rsd + 8));
  880|  8.64k|    rsd_r1 = _mm_loadu_si128((__m128i *) (pi2_rsd + (1 * rsd_strd) + 8));
  881|  8.64k|    rsd_r2 = _mm_loadu_si128((__m128i *) (pi2_rsd + (2 * rsd_strd) + 8));
  882|  8.64k|    rsd_r3 = _mm_loadu_si128((__m128i *) (pi2_rsd + (3 * rsd_strd) + 8));
  883|  8.64k|    rsd_r4 = _mm_loadu_si128((__m128i *) (pi2_rsd + (4 * rsd_strd) + 8));
  884|  8.64k|    rsd_r5 = _mm_loadu_si128((__m128i *) (pi2_rsd + (5 * rsd_strd) + 8));
  885|  8.64k|    rsd_r6 = _mm_loadu_si128((__m128i *) (pi2_rsd + (6 * rsd_strd) + 8));
  886|  8.64k|    rsd_r7 = _mm_loadu_si128((__m128i *) (pi2_rsd + (7 * rsd_strd) + 8));
  887|       |
  888|  8.64k|    pred0 = _mm_loadu_si128((__m128i *) (pu1_pred + 8));
  889|  8.64k|    pred1 = _mm_loadu_si128((__m128i *) (pu1_pred + (1 * pred_strd) + 8));
  890|  8.64k|    pred2 = _mm_loadu_si128((__m128i *) (pu1_pred + (2 * pred_strd) + 8));
  891|  8.64k|    pred3 = _mm_loadu_si128((__m128i *) (pu1_pred + (3 * pred_strd) + 8));
  892|  8.64k|    pred4 = _mm_loadu_si128((__m128i *) (pu1_pred + (4 * pred_strd) + 8));
  893|  8.64k|    pred5 = _mm_loadu_si128((__m128i *) (pu1_pred + (5 * pred_strd) + 8));
  894|  8.64k|    pred6 = _mm_loadu_si128((__m128i *) (pu1_pred + (6 * pred_strd) + 8));
  895|  8.64k|    pred7 = _mm_loadu_si128((__m128i *) (pu1_pred + (7 * pred_strd) + 8));
  896|       |
  897|  8.64k|    src_r0 = _mm_loadu_si128((__m128i *) (pu1_out + 8));
  898|  8.64k|    src_r1 = _mm_loadu_si128((__m128i *) (pu1_out + (1 * out_strd) + 8));
  899|  8.64k|    src_r2 = _mm_loadu_si128((__m128i *) (pu1_out + (2 * out_strd) + 8));
  900|  8.64k|    src_r3 = _mm_loadu_si128((__m128i *) (pu1_out + (3 * out_strd) + 8));
  901|  8.64k|    src_r4 = _mm_loadu_si128((__m128i *) (pu1_out + (4 * out_strd) + 8));
  902|  8.64k|    src_r5 = _mm_loadu_si128((__m128i *) (pu1_out + (5 * out_strd) + 8));
  903|  8.64k|    src_r6 = _mm_loadu_si128((__m128i *) (pu1_out + (6 * out_strd) + 8));
  904|  8.64k|    src_r7 = _mm_loadu_si128((__m128i *) (pu1_out + (7 * out_strd) + 8));
  905|       |
  906|  8.64k|    pred0 = _mm_cvtepu8_epi16(pred0);
  907|  8.64k|    pred1 = _mm_cvtepu8_epi16(pred1);
  908|  8.64k|    pred2 = _mm_cvtepu8_epi16(pred2);
  909|  8.64k|    pred3 = _mm_cvtepu8_epi16(pred3);
  910|  8.64k|    pred4 = _mm_cvtepu8_epi16(pred4);
  911|  8.64k|    pred5 = _mm_cvtepu8_epi16(pred5);
  912|  8.64k|    pred6 = _mm_cvtepu8_epi16(pred6);
  913|  8.64k|    pred7 = _mm_cvtepu8_epi16(pred7);
  914|       |
  915|  8.64k|    pred0 = _mm_add_epi16(pred0, rsd_r0);
  916|  8.64k|    pred1 = _mm_add_epi16(pred1, rsd_r1);
  917|  8.64k|    pred2 = _mm_add_epi16(pred2, rsd_r2);
  918|  8.64k|    pred3 = _mm_add_epi16(pred3, rsd_r3);
  919|  8.64k|    pred4 = _mm_add_epi16(pred4, rsd_r4);
  920|  8.64k|    pred5 = _mm_add_epi16(pred5, rsd_r5);
  921|  8.64k|    pred6 = _mm_add_epi16(pred6, rsd_r6);
  922|  8.64k|    pred7 = _mm_add_epi16(pred7, rsd_r7);
  923|       |
  924|  8.64k|    pred0 = _mm_packus_epi16(pred0, zero_16x8b);
  925|  8.64k|    pred1 = _mm_packus_epi16(pred1, zero_16x8b);
  926|  8.64k|    pred2 = _mm_packus_epi16(pred2, zero_16x8b);
  927|  8.64k|    pred3 = _mm_packus_epi16(pred3, zero_16x8b);
  928|  8.64k|    pred4 = _mm_packus_epi16(pred4, zero_16x8b);
  929|  8.64k|    pred5 = _mm_packus_epi16(pred5, zero_16x8b);
  930|  8.64k|    pred6 = _mm_packus_epi16(pred6, zero_16x8b);
  931|  8.64k|    pred7 = _mm_packus_epi16(pred7, zero_16x8b);
  932|       |
  933|  8.64k|    src_r0 = _mm_and_si128(src_r0, chroma_mask_odd);  // 0 src1 0 src2 0 ...
  934|  8.64k|    src_r1 = _mm_and_si128(src_r1, chroma_mask_odd);
  935|  8.64k|    src_r2 = _mm_and_si128(src_r2, chroma_mask_odd);
  936|  8.64k|    src_r3 = _mm_and_si128(src_r3, chroma_mask_odd);
  937|  8.64k|    src_r4 = _mm_and_si128(src_r4, chroma_mask_odd);
  938|  8.64k|    src_r5 = _mm_and_si128(src_r5, chroma_mask_odd);
  939|  8.64k|    src_r6 = _mm_and_si128(src_r6, chroma_mask_odd);
  940|  8.64k|    src_r7 = _mm_and_si128(src_r7, chroma_mask_odd);
  941|       |
  942|  8.64k|    pred0 = _mm_and_si128(pred0, chroma_mask_even);  // val 0 val 0 ..
  943|  8.64k|    pred1 = _mm_and_si128(pred1, chroma_mask_even);
  944|  8.64k|    pred2 = _mm_and_si128(pred2, chroma_mask_even);
  945|  8.64k|    pred3 = _mm_and_si128(pred3, chroma_mask_even);
  946|  8.64k|    pred4 = _mm_and_si128(pred4, chroma_mask_even);
  947|  8.64k|    pred5 = _mm_and_si128(pred5, chroma_mask_even);
  948|  8.64k|    pred6 = _mm_and_si128(pred6, chroma_mask_even);
  949|  8.64k|    pred7 = _mm_and_si128(pred7, chroma_mask_even);
  950|       |
  951|  8.64k|    src_r0 = _mm_add_epi8(src_r0, pred0);  // macro  src1 macro src2 macro ...
  952|  8.64k|    src_r1 = _mm_add_epi8(src_r1, pred1);
  953|  8.64k|    src_r2 = _mm_add_epi8(src_r2, pred2);
  954|  8.64k|    src_r3 = _mm_add_epi8(src_r3, pred3);
  955|  8.64k|    src_r4 = _mm_add_epi8(src_r4, pred4);
  956|  8.64k|    src_r5 = _mm_add_epi8(src_r5, pred5);
  957|  8.64k|    src_r6 = _mm_add_epi8(src_r6, pred6);
  958|  8.64k|    src_r7 = _mm_add_epi8(src_r7, pred7);
  959|       |
  960|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[0] + 8), src_r0);
  961|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[out_strd] + 8), src_r1);
  962|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[(2 * out_strd)] + 8), src_r2);
  963|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[(3 * out_strd)] + 8), src_r3);
  964|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[(4 * out_strd)] + 8), src_r4);
  965|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[(5 * out_strd)] + 8), src_r5);
  966|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[(6 * out_strd)] + 8), src_r6);
  967|  8.64k|    _mm_storel_epi64((__m128i *) (&pu1_out[(7 * out_strd)] + 8), src_r7);
  968|  8.64k|}

isvcd_residual_luma_dyadic_sse42:
   75|  11.8k|{
   76|  11.8k|    WORD16 *pi2_refarray_buffer;
   77|  11.8k|    WORD32 i4_blk_ctr;
   78|  11.8k|    residual_sampling_ctxt_t *ps_ctxt;
   79|       |
   80|  11.8k|    UNUSED(ps_ref_mb_mode);
  ------------------
  |  |   45|  11.8k|#define UNUSED(x) ((void)(x))
  ------------------
   81|  11.8k|    UNUSED(u2_mb_x);
  ------------------
  |  |   45|  11.8k|#define UNUSED(x) ((void)(x))
  ------------------
   82|  11.8k|    UNUSED(u2_mb_y);
  ------------------
  |  |   45|  11.8k|#define UNUSED(x) ((void)(x))
  ------------------
   83|       |
   84|  11.8k|    ps_ctxt = (residual_sampling_ctxt_t *) pv_residual_samp_ctxt;
   85|  11.8k|    pi2_refarray_buffer = ps_ctxt->pi2_refarray_buffer;
   86|       |
   87|       |    /* based on transform size the counter and interpolation width and */
   88|       |    /* height are intialised as follows                                */
   89|       |
   90|  11.8k|    if((i4_ref_tx_size) && (0 != i4_ref_nnz))
  ------------------
  |  Branch (90:8): [True: 0, False: 11.8k]
  |  Branch (90:28): [True: 0, False: 0]
  ------------------
   91|      0|    {
   92|      0|        WORD16 *pi2_ref_data_byte;
   93|      0|        WORD32 i4_i, i4_j;
   94|      0|        WORD16 *pi2_refarray_buffer_tmp = pi2_refarray_buffer;
   95|       |
   96|      0|        __m128i i2_coeff_8x16b_r1_0, i2_coeff_8x16b_r1_1;
   97|      0|        __m128i res_8x16b_r1_0, res_8x16b_r1_1;
   98|      0|        __m128i final_res_8x16b_r1_0, final_res_8x16b_r1_1;
   99|       |
  100|      0|        __m128i coeff_add_8x16b_r1;
  101|       |
  102|      0|        __m128i coeff_add_8x16b_r2;
  103|      0|        __m128i i2_coeff_8x16b_r2_0, i2_coeff_8x16b_r2_1;
  104|      0|        __m128i res_8x16b_r2_0, res_8x16b_r2_1;
  105|      0|        __m128i final_res_8x16b_r2_0, final_res_8x16b_r2_1;
  106|       |
  107|      0|        pi2_ref_data_byte = pi2_inp_data;
  108|       |
  109|       |        /* ----------- Horizontal Interpolation ---------------- */
  110|      0|        for(i4_i = 0; i4_i < BLOCK_HEIGHT; i4_i += 2)
  ------------------
  |  |   65|      0|#define BLOCK_HEIGHT 8
  ------------------
  |  Branch (110:23): [True: 0, False: 0]
  ------------------
  111|      0|        {
  112|      0|            i2_coeff_8x16b_r1_0 =
  113|      0|                _mm_loadu_si128((__m128i *) pi2_ref_data_byte);         // a0 a1 a2 a3 a4 a5 a6 a7
  114|      0|            i2_coeff_8x16b_r2_0 = _mm_loadu_si128(
  115|      0|                (__m128i *) (pi2_ref_data_byte + i4_inp_data_stride));  // b0 b1 b2 b3 b4 b5 b6 b7
  116|       |
  117|      0|            i2_coeff_8x16b_r1_1 = _mm_srli_si128(i2_coeff_8x16b_r1_0, 2);  // a1 a2 a3 a4 a5 a6 a7 0
  118|      0|            i2_coeff_8x16b_r2_1 = _mm_srli_si128(i2_coeff_8x16b_r2_0, 2);  // b1 b2 b3 b4 b5 b6 b7 0
  119|       |
  120|      0|            coeff_add_8x16b_r1 = _mm_add_epi16(i2_coeff_8x16b_r1_0, i2_coeff_8x16b_r1_1);
  121|      0|            coeff_add_8x16b_r2 = _mm_add_epi16(i2_coeff_8x16b_r2_0, i2_coeff_8x16b_r2_1);
  122|       |
  123|      0|            i2_coeff_8x16b_r1_0 = _mm_slli_epi16(i2_coeff_8x16b_r1_0, 1);
  124|      0|            i2_coeff_8x16b_r2_0 = _mm_slli_epi16(i2_coeff_8x16b_r2_0, 1);
  125|       |
  126|      0|            i2_coeff_8x16b_r1_1 = _mm_slli_epi16(i2_coeff_8x16b_r1_1, 1);
  127|      0|            i2_coeff_8x16b_r2_1 = _mm_slli_epi16(i2_coeff_8x16b_r2_1, 1);
  128|       |
  129|      0|            res_8x16b_r1_0 = _mm_add_epi16(i2_coeff_8x16b_r1_0, coeff_add_8x16b_r1);
  130|      0|            res_8x16b_r2_0 = _mm_add_epi16(i2_coeff_8x16b_r2_0, coeff_add_8x16b_r2);
  131|       |
  132|      0|            res_8x16b_r1_1 = _mm_add_epi16(i2_coeff_8x16b_r1_1, coeff_add_8x16b_r1);
  133|      0|            res_8x16b_r2_1 = _mm_add_epi16(i2_coeff_8x16b_r2_1, coeff_add_8x16b_r2);
  134|       |
  135|      0|            final_res_8x16b_r1_0 = _mm_unpacklo_epi16(res_8x16b_r1_0, res_8x16b_r1_1);
  136|      0|            final_res_8x16b_r2_0 = _mm_unpacklo_epi16(res_8x16b_r2_0, res_8x16b_r2_1);
  137|       |
  138|      0|            final_res_8x16b_r1_1 = _mm_unpackhi_epi16(res_8x16b_r1_0, res_8x16b_r1_1);
  139|      0|            final_res_8x16b_r2_1 = _mm_unpackhi_epi16(res_8x16b_r2_0, res_8x16b_r2_1);
  140|       |
  141|      0|            _mm_storeu_si128((__m128i *) (pi2_refarray_buffer + 1), final_res_8x16b_r1_0);
  142|      0|            _mm_storeu_si128((__m128i *) (pi2_refarray_buffer + 9), final_res_8x16b_r1_1);
  143|       |
  144|      0|            _mm_storeu_si128((__m128i *) (pi2_refarray_buffer + 17), final_res_8x16b_r2_0);
  145|      0|            _mm_storeu_si128((__m128i *) (pi2_refarray_buffer + 25), final_res_8x16b_r2_1);
  146|       |
  147|      0|            pi2_refarray_buffer[0] = (pi2_ref_data_byte[0] << 2);
  148|      0|            pi2_refarray_buffer[15] = (pi2_ref_data_byte[7] << 2);
  149|      0|            pi2_ref_data_byte += i4_inp_data_stride;
  150|      0|            pi2_refarray_buffer[16] = (pi2_ref_data_byte[0] << 2);
  151|      0|            pi2_refarray_buffer[31] = (pi2_ref_data_byte[7] << 2);
  152|       |
  153|       |            /* vertical loop uopdates */
  154|      0|            pi2_ref_data_byte = pi2_inp_data + ((i4_i + 2) * i4_inp_data_stride);
  155|      0|            pi2_refarray_buffer += 32;
  156|      0|        }
  157|       |
  158|       |        /* ----------- Vertical Interpolation ---------------- */
  159|      0|        pi2_refarray_buffer = pi2_refarray_buffer_tmp;
  160|       |
  161|      0|        {
  162|      0|            __m128i i4_horz_samp_4x32b_r1_1, i4_horz_samp_4x32b_r1_2, i4_horz_samp_4x32b_r1_3,
  163|      0|                i4_horz_samp_4x32b_r1_4;
  164|      0|            __m128i i4_horz_samp_4x32b_r2_1, i4_horz_samp_4x32b_r2_2, i4_horz_samp_4x32b_r2_3,
  165|      0|                i4_horz_samp_4x32b_r2_4;
  166|      0|            __m128i i4_res_samp_4x32b_r1_1, i4_res_samp_4x32b_r1_2, i4_res_samp_4x32b_r1_3,
  167|      0|                i4_res_samp_4x32b_r1_4;
  168|      0|            __m128i i4_res_samp_4x32b_r2_1, i4_res_samp_4x32b_r2_2, i4_res_samp_4x32b_r2_3,
  169|      0|                i4_res_samp_4x32b_r2_4;
  170|      0|            __m128i horz_add_4x32b_r2_1, horz_add_4x32b_r2_2, horz_add_4x32b_r2_3,
  171|      0|                horz_add_4x32b_r2_4;
  172|       |
  173|      0|            __m128i i4_horz_samp_8x16b_r1_1, i4_horz_samp_8x16b_r2_1;
  174|      0|            __m128i i4_horz_samp_8x16b_r1_2, i4_horz_samp_8x16b_r2_2;
  175|      0|            __m128i i4_horz_samp_8x16b_r1_3, i4_horz_samp_8x16b_r2_3;
  176|      0|            __m128i i4_horz_samp_8x16b_r1_4, i4_horz_samp_8x16b_r2_4;
  177|       |
  178|      0|            __m128i twos = _mm_set1_epi32(2);
  179|      0|            __m128i eights = _mm_set1_epi32(8);
  180|       |
  181|      0|            WORD16 *pi2_out;
  182|       |
  183|      0|            pi2_out = pi2_out_res;
  184|       |
  185|      0|            i4_horz_samp_8x16b_r1_1 = _mm_loadu_si128((__m128i *) (pi2_refarray_buffer));
  186|      0|            i4_horz_samp_8x16b_r1_2 = _mm_loadu_si128((__m128i *) (pi2_refarray_buffer + 4));
  187|      0|            i4_horz_samp_8x16b_r1_3 = _mm_loadu_si128((__m128i *) (pi2_refarray_buffer + 8));
  188|      0|            i4_horz_samp_8x16b_r1_4 = _mm_loadu_si128((__m128i *) (pi2_refarray_buffer + 12));
  189|       |
  190|      0|            i4_horz_samp_4x32b_r1_1 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r1_1);
  191|      0|            i4_horz_samp_4x32b_r1_2 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r1_2);
  192|      0|            i4_horz_samp_4x32b_r1_3 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r1_3);
  193|      0|            i4_horz_samp_4x32b_r1_4 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r1_4);
  194|       |
  195|       |            /* populate the first inter sample */
  196|      0|            i4_res_samp_4x32b_r1_1 =
  197|      0|                _mm_srai_epi32(_mm_add_epi32(i4_horz_samp_4x32b_r1_1, twos), 2);
  198|      0|            i4_res_samp_4x32b_r1_2 =
  199|      0|                _mm_srai_epi32(_mm_add_epi32(i4_horz_samp_4x32b_r1_2, twos), 2);
  200|      0|            i4_res_samp_4x32b_r1_3 =
  201|      0|                _mm_srai_epi32(_mm_add_epi32(i4_horz_samp_4x32b_r1_3, twos), 2);
  202|      0|            i4_res_samp_4x32b_r1_4 =
  203|      0|                _mm_srai_epi32(_mm_add_epi32(i4_horz_samp_4x32b_r1_4, twos), 2);
  204|       |
  205|      0|            _mm_storeu_si128((__m128i *) pi2_out,
  206|      0|                             _mm_packs_epi32(i4_res_samp_4x32b_r1_1, i4_res_samp_4x32b_r1_2));
  207|      0|            _mm_storeu_si128((__m128i *) (pi2_out + 8),
  208|      0|                             _mm_packs_epi32(i4_res_samp_4x32b_r1_3, i4_res_samp_4x32b_r1_4));
  209|      0|            pi2_out += i4_out_res_stride;
  210|       |
  211|      0|            for(i4_j = 0; i4_j < 14; i4_j += 2)
  ------------------
  |  Branch (211:27): [True: 0, False: 0]
  ------------------
  212|      0|            {
  213|      0|                pi2_refarray_buffer += MB_WIDTH;
  ------------------
  |  |   67|      0|#define MB_WIDTH 16
  ------------------
  214|       |
  215|      0|                i4_horz_samp_8x16b_r2_1 = _mm_loadu_si128((__m128i *) (pi2_refarray_buffer));
  216|      0|                i4_horz_samp_8x16b_r2_2 = _mm_loadu_si128((__m128i *) (pi2_refarray_buffer + 4));
  217|      0|                i4_horz_samp_8x16b_r2_3 = _mm_loadu_si128((__m128i *) (pi2_refarray_buffer + 8));
  218|      0|                i4_horz_samp_8x16b_r2_4 = _mm_loadu_si128((__m128i *) (pi2_refarray_buffer + 12));
  219|       |
  220|      0|                i4_horz_samp_4x32b_r2_1 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r2_1);
  221|      0|                i4_horz_samp_4x32b_r2_2 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r2_2);
  222|      0|                i4_horz_samp_4x32b_r2_3 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r2_3);
  223|      0|                i4_horz_samp_4x32b_r2_4 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r2_4);
  224|       |
  225|      0|                horz_add_4x32b_r2_1 =
  226|      0|                    _mm_add_epi32(i4_horz_samp_4x32b_r1_1, i4_horz_samp_4x32b_r2_1);
  227|      0|                horz_add_4x32b_r2_2 =
  228|      0|                    _mm_add_epi32(i4_horz_samp_4x32b_r1_2, i4_horz_samp_4x32b_r2_2);
  229|      0|                horz_add_4x32b_r2_3 =
  230|      0|                    _mm_add_epi32(i4_horz_samp_4x32b_r1_3, i4_horz_samp_4x32b_r2_3);
  231|      0|                horz_add_4x32b_r2_4 =
  232|      0|                    _mm_add_epi32(i4_horz_samp_4x32b_r1_4, i4_horz_samp_4x32b_r2_4);
  233|       |
  234|      0|                i4_res_samp_4x32b_r1_1 =
  235|      0|                    _mm_add_epi32(_mm_slli_epi32(i4_horz_samp_4x32b_r1_1, 1), horz_add_4x32b_r2_1);
  236|      0|                i4_res_samp_4x32b_r1_2 =
  237|      0|                    _mm_add_epi32(_mm_slli_epi32(i4_horz_samp_4x32b_r1_2, 1), horz_add_4x32b_r2_2);
  238|      0|                i4_res_samp_4x32b_r1_3 =
  239|      0|                    _mm_add_epi32(_mm_slli_epi32(i4_horz_samp_4x32b_r1_3, 1), horz_add_4x32b_r2_3);
  240|      0|                i4_res_samp_4x32b_r1_4 =
  241|      0|                    _mm_add_epi32(_mm_slli_epi32(i4_horz_samp_4x32b_r1_4, 1), horz_add_4x32b_r2_4);
  242|       |
  243|      0|                i4_res_samp_4x32b_r2_1 =
  244|      0|                    _mm_add_epi32(_mm_slli_epi32(i4_horz_samp_4x32b_r2_1, 1), horz_add_4x32b_r2_1);
  245|      0|                i4_res_samp_4x32b_r2_2 =
  246|      0|                    _mm_add_epi32(_mm_slli_epi32(i4_horz_samp_4x32b_r2_2, 1), horz_add_4x32b_r2_2);
  247|      0|                i4_res_samp_4x32b_r2_3 =
  248|      0|                    _mm_add_epi32(_mm_slli_epi32(i4_horz_samp_4x32b_r2_3, 1), horz_add_4x32b_r2_3);
  249|      0|                i4_res_samp_4x32b_r2_4 =
  250|      0|                    _mm_add_epi32(_mm_slli_epi32(i4_horz_samp_4x32b_r2_4, 1), horz_add_4x32b_r2_4);
  251|       |
  252|      0|                i4_res_samp_4x32b_r1_1 =
  253|      0|                    _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r1_1, eights), 4);
  254|      0|                i4_res_samp_4x32b_r1_2 =
  255|      0|                    _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r1_2, eights), 4);
  256|      0|                i4_res_samp_4x32b_r1_3 =
  257|      0|                    _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r1_3, eights), 4);
  258|      0|                i4_res_samp_4x32b_r1_4 =
  259|      0|                    _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r1_4, eights), 4);
  260|       |
  261|      0|                i4_res_samp_4x32b_r2_1 =
  262|      0|                    _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r2_1, eights), 4);
  263|      0|                i4_res_samp_4x32b_r2_2 =
  264|      0|                    _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r2_2, eights), 4);
  265|      0|                i4_res_samp_4x32b_r2_3 =
  266|      0|                    _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r2_3, eights), 4);
  267|      0|                i4_res_samp_4x32b_r2_4 =
  268|      0|                    _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r2_4, eights), 4);
  269|       |
  270|       |                /* populate 2 samples based on current coeffs */
  271|      0|                _mm_storeu_si128((__m128i *) pi2_out,
  272|      0|                                 _mm_packs_epi32(i4_res_samp_4x32b_r1_1, i4_res_samp_4x32b_r1_2));
  273|      0|                _mm_storeu_si128((__m128i *) (pi2_out + 8),
  274|      0|                                 _mm_packs_epi32(i4_res_samp_4x32b_r1_3, i4_res_samp_4x32b_r1_4));
  275|      0|                pi2_out += i4_out_res_stride;
  276|       |
  277|      0|                _mm_storeu_si128((__m128i *) pi2_out,
  278|      0|                                 _mm_packs_epi32(i4_res_samp_4x32b_r2_1, i4_res_samp_4x32b_r2_2));
  279|      0|                _mm_storeu_si128((__m128i *) (pi2_out + 8),
  280|      0|                                 _mm_packs_epi32(i4_res_samp_4x32b_r2_3, i4_res_samp_4x32b_r2_4));
  281|      0|                pi2_out += i4_out_res_stride;
  282|       |
  283|       |                /* store the coeff 2 to coeff 1 */
  284|       |                /* (used in next iteration)     */
  285|      0|                i4_horz_samp_4x32b_r1_1 = i4_horz_samp_4x32b_r2_1;
  286|      0|                i4_horz_samp_4x32b_r1_2 = i4_horz_samp_4x32b_r2_2;
  287|      0|                i4_horz_samp_4x32b_r1_3 = i4_horz_samp_4x32b_r2_3;
  288|      0|                i4_horz_samp_4x32b_r1_4 = i4_horz_samp_4x32b_r2_4;
  289|      0|            }
  290|       |
  291|      0|            i4_res_samp_4x32b_r1_1 =
  292|      0|                _mm_srai_epi32(_mm_add_epi32(i4_horz_samp_4x32b_r1_1, twos), 2);
  293|      0|            i4_res_samp_4x32b_r1_2 =
  294|      0|                _mm_srai_epi32(_mm_add_epi32(i4_horz_samp_4x32b_r1_2, twos), 2);
  295|      0|            i4_res_samp_4x32b_r1_3 =
  296|      0|                _mm_srai_epi32(_mm_add_epi32(i4_horz_samp_4x32b_r1_3, twos), 2);
  297|      0|            i4_res_samp_4x32b_r1_4 =
  298|      0|                _mm_srai_epi32(_mm_add_epi32(i4_horz_samp_4x32b_r1_4, twos), 2);
  299|       |
  300|      0|            _mm_storeu_si128((__m128i *) pi2_out,
  301|      0|                             _mm_packs_epi32(i4_res_samp_4x32b_r1_1, i4_res_samp_4x32b_r1_2));
  302|      0|            _mm_storeu_si128((__m128i *) (pi2_out + 8),
  303|      0|                             _mm_packs_epi32(i4_res_samp_4x32b_r1_3, i4_res_samp_4x32b_r1_4));
  304|      0|        }
  305|      0|    }
  306|  11.8k|    else
  307|  11.8k|    {
  308|       |        /* ----------------------------------------------------------------- */
  309|       |        /* LOOP over number of blocks                                        */
  310|       |        /* ----------------------------------------------------------------- */
  311|  59.2k|        for(i4_blk_ctr = 0; i4_blk_ctr < 4; i4_blk_ctr++)
  ------------------
  |  Branch (311:29): [True: 47.3k, False: 11.8k]
  ------------------
  312|  47.3k|        {
  313|       |            /* if reference layer is not coded then no processing */
  314|  47.3k|            if(0 != (i4_ref_nnz & 0x1))
  ------------------
  |  Branch (314:16): [True: 0, False: 47.3k]
  ------------------
  315|      0|            {
  316|      0|                __m128i i2_coeff_8x16b_r1_0, i2_coeff_8x16b_r1_1;
  317|      0|                __m128i i2_coeff_8x16b_r2_0, i2_coeff_8x16b_r2_1;
  318|      0|                __m128i i2_coeff_8x16b_r3_0, i2_coeff_8x16b_r3_1;
  319|      0|                __m128i i2_coeff_8x16b_r4_0, i2_coeff_8x16b_r4_1;
  320|       |
  321|      0|                __m128i res_8x16b_r1_0, res_8x16b_r1_1;
  322|      0|                __m128i res_8x16b_r2_0, res_8x16b_r2_1;
  323|      0|                __m128i res_8x16b_r3_0, res_8x16b_r3_1;
  324|      0|                __m128i res_8x16b_r4_0, res_8x16b_r4_1;
  325|      0|                __m128i final_res_8x16b_r1_0;
  326|      0|                __m128i final_res_8x16b_r2_0;
  327|      0|                __m128i final_res_8x16b_r3_0;
  328|      0|                __m128i final_res_8x16b_r4_0;
  329|       |
  330|      0|                __m128i coeff_add_8x16b_r1;
  331|      0|                __m128i coeff_add_8x16b_r2;
  332|      0|                __m128i coeff_add_8x16b_r3;
  333|      0|                __m128i coeff_add_8x16b_r4;
  334|       |
  335|       |                /* ----------- Horizontal Interpolation ---------------- */
  336|       |
  337|      0|                i2_coeff_8x16b_r1_0 =
  338|      0|                    _mm_loadu_si128((__m128i *) pi2_inp_data);         // a0 a1 a2 a3 a4 a5 a6 a7
  339|      0|                i2_coeff_8x16b_r2_0 = _mm_loadu_si128(
  340|      0|                    (__m128i *) (pi2_inp_data + i4_inp_data_stride));  // b0 b1 b2 b3 b4 b5 b6 b7
  341|      0|                i2_coeff_8x16b_r3_0 =
  342|      0|                    _mm_loadu_si128((__m128i *) (pi2_inp_data + (i4_inp_data_stride << 1)));
  343|      0|                i2_coeff_8x16b_r4_0 =
  344|      0|                    _mm_loadu_si128((__m128i *) (pi2_inp_data + (i4_inp_data_stride * 3)));
  345|       |
  346|      0|                i2_coeff_8x16b_r1_1 = _mm_srli_si128(i2_coeff_8x16b_r1_0,
  347|      0|                                                     2);  // a1 a2 a3 a4 a5 a6 a7 0
  348|      0|                i2_coeff_8x16b_r2_1 = _mm_srli_si128(i2_coeff_8x16b_r2_0,
  349|      0|                                                     2);  // b1 b2 b3 b4 b5 b6 b7 0
  350|      0|                i2_coeff_8x16b_r3_1 = _mm_srli_si128(i2_coeff_8x16b_r3_0, 2);
  351|      0|                i2_coeff_8x16b_r4_1 = _mm_srli_si128(i2_coeff_8x16b_r4_0, 2);
  352|       |
  353|      0|                coeff_add_8x16b_r1 = _mm_add_epi16(i2_coeff_8x16b_r1_0, i2_coeff_8x16b_r1_1);
  354|      0|                coeff_add_8x16b_r2 = _mm_add_epi16(i2_coeff_8x16b_r2_0, i2_coeff_8x16b_r2_1);
  355|      0|                coeff_add_8x16b_r3 = _mm_add_epi16(i2_coeff_8x16b_r3_0, i2_coeff_8x16b_r3_1);
  356|      0|                coeff_add_8x16b_r4 = _mm_add_epi16(i2_coeff_8x16b_r4_0, i2_coeff_8x16b_r4_1);
  357|       |
  358|      0|                i2_coeff_8x16b_r1_0 = _mm_slli_epi16(i2_coeff_8x16b_r1_0, 1);
  359|      0|                i2_coeff_8x16b_r2_0 = _mm_slli_epi16(i2_coeff_8x16b_r2_0, 1);
  360|      0|                i2_coeff_8x16b_r3_0 = _mm_slli_epi16(i2_coeff_8x16b_r3_0, 1);
  361|      0|                i2_coeff_8x16b_r4_0 = _mm_slli_epi16(i2_coeff_8x16b_r4_0, 1);
  362|       |
  363|      0|                i2_coeff_8x16b_r1_1 = _mm_slli_epi16(i2_coeff_8x16b_r1_1, 1);
  364|      0|                i2_coeff_8x16b_r2_1 = _mm_slli_epi16(i2_coeff_8x16b_r2_1, 1);
  365|      0|                i2_coeff_8x16b_r3_1 = _mm_slli_epi16(i2_coeff_8x16b_r3_1, 1);
  366|      0|                i2_coeff_8x16b_r4_1 = _mm_slli_epi16(i2_coeff_8x16b_r4_1, 1);
  367|       |
  368|      0|                res_8x16b_r1_0 = _mm_add_epi16(i2_coeff_8x16b_r1_0, coeff_add_8x16b_r1);
  369|      0|                res_8x16b_r2_0 = _mm_add_epi16(i2_coeff_8x16b_r2_0, coeff_add_8x16b_r2);
  370|      0|                res_8x16b_r3_0 = _mm_add_epi16(i2_coeff_8x16b_r3_0, coeff_add_8x16b_r3);
  371|      0|                res_8x16b_r4_0 = _mm_add_epi16(i2_coeff_8x16b_r4_0, coeff_add_8x16b_r4);
  372|       |
  373|      0|                res_8x16b_r1_1 = _mm_add_epi16(i2_coeff_8x16b_r1_1, coeff_add_8x16b_r1);
  374|      0|                res_8x16b_r2_1 = _mm_add_epi16(i2_coeff_8x16b_r2_1, coeff_add_8x16b_r2);
  375|      0|                res_8x16b_r3_1 = _mm_add_epi16(i2_coeff_8x16b_r3_1, coeff_add_8x16b_r3);
  376|      0|                res_8x16b_r4_1 = _mm_add_epi16(i2_coeff_8x16b_r4_1, coeff_add_8x16b_r4);
  377|       |
  378|      0|                final_res_8x16b_r1_0 = _mm_unpacklo_epi16(res_8x16b_r1_0, res_8x16b_r1_1);
  379|      0|                final_res_8x16b_r2_0 = _mm_unpacklo_epi16(res_8x16b_r2_0, res_8x16b_r2_1);
  380|      0|                final_res_8x16b_r3_0 = _mm_unpacklo_epi16(res_8x16b_r3_0, res_8x16b_r3_1);
  381|      0|                final_res_8x16b_r4_0 = _mm_unpacklo_epi16(res_8x16b_r4_0, res_8x16b_r4_1);
  382|       |
  383|      0|                _mm_storeu_si128((__m128i *) (pi2_refarray_buffer + 1), final_res_8x16b_r1_0);
  384|      0|                _mm_storeu_si128((__m128i *) (pi2_refarray_buffer + 9), final_res_8x16b_r2_0);
  385|      0|                _mm_storeu_si128((__m128i *) (pi2_refarray_buffer + 17), final_res_8x16b_r3_0);
  386|      0|                _mm_storeu_si128((__m128i *) (pi2_refarray_buffer + 25), final_res_8x16b_r4_0);
  387|       |
  388|      0|                pi2_refarray_buffer[0] = (pi2_inp_data[0] << 2);
  389|      0|                pi2_refarray_buffer[7] = (pi2_inp_data[3] << 2);
  390|      0|                pi2_refarray_buffer[8] = (pi2_inp_data[i4_inp_data_stride] << 2);
  391|      0|                pi2_refarray_buffer[15] = (pi2_inp_data[i4_inp_data_stride + 3] << 2);
  392|      0|                pi2_refarray_buffer[16] = (pi2_inp_data[(i4_inp_data_stride << 1)] << 2);
  393|      0|                pi2_refarray_buffer[23] = (pi2_inp_data[(i4_inp_data_stride << 1) + 3] << 2);
  394|      0|                pi2_refarray_buffer[24] = (pi2_inp_data[(i4_inp_data_stride * 3)] << 2);
  395|      0|                pi2_refarray_buffer[31] = (pi2_inp_data[(i4_inp_data_stride * 3) + 3] << 2);
  396|       |
  397|       |                /* ----------- Vertical Interpolation ---------------- */
  398|      0|                {
  399|      0|                    __m128i i4_horz_samp_8x16b_r0_1, i4_horz_samp_8x16b_r0_2;
  400|      0|                    __m128i i4_horz_samp_8x16b_r1_1, i4_horz_samp_8x16b_r1_2;
  401|      0|                    __m128i i4_horz_samp_8x16b_r2_1, i4_horz_samp_8x16b_r2_2;
  402|      0|                    __m128i i4_horz_samp_8x16b_r3_1, i4_horz_samp_8x16b_r3_2;
  403|       |
  404|      0|                    __m128i i4_horz_samp_4x32b_r0_1, i4_horz_samp_4x32b_r0_2;
  405|      0|                    __m128i i4_horz_samp_4x32b_r1_1, i4_horz_samp_4x32b_r1_2;
  406|      0|                    __m128i i4_horz_samp_4x32b_r2_1, i4_horz_samp_4x32b_r2_2;
  407|      0|                    __m128i i4_horz_samp_4x32b_r3_1, i4_horz_samp_4x32b_r3_2;
  408|       |
  409|      0|                    __m128i i4_res_samp_4x32b_r0_1, i4_res_samp_4x32b_r0_2;
  410|      0|                    __m128i i4_res_samp_4x32b_r1_1, i4_res_samp_4x32b_r1_2;
  411|      0|                    __m128i i4_res_samp_4x32b_r2_1, i4_res_samp_4x32b_r2_2;
  412|      0|                    __m128i i4_res_samp_4x32b_r3_1, i4_res_samp_4x32b_r3_2;
  413|      0|                    __m128i i4_res_samp_4x32b_r4_1, i4_res_samp_4x32b_r4_2;
  414|      0|                    __m128i i4_res_samp_4x32b_r5_1, i4_res_samp_4x32b_r5_2;
  415|      0|                    __m128i i4_res_samp_4x32b_r6_1, i4_res_samp_4x32b_r6_2;
  416|      0|                    __m128i i4_res_samp_4x32b_r7_1, i4_res_samp_4x32b_r7_2;
  417|       |
  418|      0|                    __m128i horz_add_4x32b_r1_1, horz_add_4x32b_r1_2;
  419|      0|                    __m128i horz_add_4x32b_r2_1, horz_add_4x32b_r2_2;
  420|      0|                    __m128i horz_add_4x32b_r3_1, horz_add_4x32b_r3_2;
  421|       |
  422|      0|                    __m128i twos = _mm_set1_epi32(2);
  423|      0|                    __m128i eights = _mm_set1_epi32(8);
  424|       |
  425|      0|                    i4_horz_samp_8x16b_r0_1 = _mm_loadu_si128((__m128i *) (pi2_refarray_buffer));
  426|      0|                    i4_horz_samp_8x16b_r0_2 =
  427|      0|                        _mm_loadu_si128((__m128i *) (pi2_refarray_buffer + 4));
  428|      0|                    i4_horz_samp_8x16b_r1_1 =
  429|      0|                        _mm_loadu_si128((__m128i *) (pi2_refarray_buffer + BLOCK_WIDTH));
  ------------------
  |  |   64|      0|#define BLOCK_WIDTH 8
  ------------------
  430|      0|                    i4_horz_samp_8x16b_r1_2 =
  431|      0|                        _mm_loadu_si128((__m128i *) (pi2_refarray_buffer + BLOCK_WIDTH + 4));
  ------------------
  |  |   64|      0|#define BLOCK_WIDTH 8
  ------------------
  432|      0|                    i4_horz_samp_8x16b_r2_1 =
  433|      0|                        _mm_loadu_si128((__m128i *) (pi2_refarray_buffer + (BLOCK_WIDTH << 1)));
  ------------------
  |  |   64|      0|#define BLOCK_WIDTH 8
  ------------------
  434|      0|                    i4_horz_samp_8x16b_r2_2 =
  435|      0|                        _mm_loadu_si128((__m128i *) (pi2_refarray_buffer + (BLOCK_WIDTH << 1) + 4));
  ------------------
  |  |   64|      0|#define BLOCK_WIDTH 8
  ------------------
  436|      0|                    i4_horz_samp_8x16b_r3_1 =
  437|      0|                        _mm_loadu_si128((__m128i *) (pi2_refarray_buffer + (BLOCK_WIDTH * 3)));
  ------------------
  |  |   64|      0|#define BLOCK_WIDTH 8
  ------------------
  438|      0|                    i4_horz_samp_8x16b_r3_2 =
  439|      0|                        _mm_loadu_si128((__m128i *) (pi2_refarray_buffer + (BLOCK_WIDTH * 3) + 4));
  ------------------
  |  |   64|      0|#define BLOCK_WIDTH 8
  ------------------
  440|       |
  441|      0|                    i4_horz_samp_4x32b_r0_1 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r0_1);
  442|      0|                    i4_horz_samp_4x32b_r0_2 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r0_2);
  443|      0|                    i4_horz_samp_4x32b_r1_1 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r1_1);
  444|      0|                    i4_horz_samp_4x32b_r1_2 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r1_2);
  445|      0|                    i4_horz_samp_4x32b_r2_1 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r2_1);
  446|      0|                    i4_horz_samp_4x32b_r2_2 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r2_2);
  447|      0|                    i4_horz_samp_4x32b_r3_1 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r3_1);
  448|      0|                    i4_horz_samp_4x32b_r3_2 = _mm_cvtepi16_epi32(i4_horz_samp_8x16b_r3_2);
  449|       |
  450|      0|                    horz_add_4x32b_r1_1 =
  451|      0|                        _mm_add_epi32(i4_horz_samp_4x32b_r0_1, i4_horz_samp_4x32b_r1_1);
  452|      0|                    horz_add_4x32b_r2_1 =
  453|      0|                        _mm_add_epi32(i4_horz_samp_4x32b_r1_1, i4_horz_samp_4x32b_r2_1);
  454|      0|                    horz_add_4x32b_r3_1 =
  455|      0|                        _mm_add_epi32(i4_horz_samp_4x32b_r2_1, i4_horz_samp_4x32b_r3_1);
  456|       |
  457|      0|                    horz_add_4x32b_r1_2 =
  458|      0|                        _mm_add_epi32(i4_horz_samp_4x32b_r0_2, i4_horz_samp_4x32b_r1_2);
  459|      0|                    horz_add_4x32b_r2_2 =
  460|      0|                        _mm_add_epi32(i4_horz_samp_4x32b_r1_2, i4_horz_samp_4x32b_r2_2);
  461|      0|                    horz_add_4x32b_r3_2 =
  462|      0|                        _mm_add_epi32(i4_horz_samp_4x32b_r2_2, i4_horz_samp_4x32b_r3_2);
  463|       |
  464|      0|                    i4_res_samp_4x32b_r1_1 = _mm_add_epi32(
  465|      0|                        _mm_slli_epi32(i4_horz_samp_4x32b_r0_1, 1), horz_add_4x32b_r1_1);
  466|      0|                    i4_res_samp_4x32b_r2_1 = _mm_add_epi32(
  467|      0|                        _mm_slli_epi32(i4_horz_samp_4x32b_r1_1, 1), horz_add_4x32b_r1_1);
  468|      0|                    i4_res_samp_4x32b_r3_1 = _mm_add_epi32(
  469|      0|                        _mm_slli_epi32(i4_horz_samp_4x32b_r1_1, 1), horz_add_4x32b_r2_1);
  470|      0|                    i4_res_samp_4x32b_r4_1 = _mm_add_epi32(
  471|      0|                        _mm_slli_epi32(i4_horz_samp_4x32b_r2_1, 1), horz_add_4x32b_r2_1);
  472|      0|                    i4_res_samp_4x32b_r5_1 = _mm_add_epi32(
  473|      0|                        _mm_slli_epi32(i4_horz_samp_4x32b_r2_1, 1), horz_add_4x32b_r3_1);
  474|      0|                    i4_res_samp_4x32b_r6_1 = _mm_add_epi32(
  475|      0|                        _mm_slli_epi32(i4_horz_samp_4x32b_r3_1, 1), horz_add_4x32b_r3_1);
  476|       |
  477|      0|                    i4_res_samp_4x32b_r1_2 = _mm_add_epi32(
  478|      0|                        _mm_slli_epi32(i4_horz_samp_4x32b_r0_2, 1), horz_add_4x32b_r1_2);
  479|      0|                    i4_res_samp_4x32b_r2_2 = _mm_add_epi32(
  480|      0|                        _mm_slli_epi32(i4_horz_samp_4x32b_r1_2, 1), horz_add_4x32b_r1_2);
  481|      0|                    i4_res_samp_4x32b_r3_2 = _mm_add_epi32(
  482|      0|                        _mm_slli_epi32(i4_horz_samp_4x32b_r1_2, 1), horz_add_4x32b_r2_2);
  483|      0|                    i4_res_samp_4x32b_r4_2 = _mm_add_epi32(
  484|      0|                        _mm_slli_epi32(i4_horz_samp_4x32b_r2_2, 1), horz_add_4x32b_r2_2);
  485|      0|                    i4_res_samp_4x32b_r5_2 = _mm_add_epi32(
  486|      0|                        _mm_slli_epi32(i4_horz_samp_4x32b_r2_2, 1), horz_add_4x32b_r3_2);
  487|      0|                    i4_res_samp_4x32b_r6_2 = _mm_add_epi32(
  488|      0|                        _mm_slli_epi32(i4_horz_samp_4x32b_r3_2, 1), horz_add_4x32b_r3_2);
  489|       |
  490|      0|                    i4_res_samp_4x32b_r0_1 =
  491|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_horz_samp_4x32b_r0_1, twos), 2);
  492|      0|                    i4_res_samp_4x32b_r1_1 =
  493|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r1_1, eights), 4);
  494|      0|                    i4_res_samp_4x32b_r2_1 =
  495|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r2_1, eights), 4);
  496|      0|                    i4_res_samp_4x32b_r3_1 =
  497|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r3_1, eights), 4);
  498|      0|                    i4_res_samp_4x32b_r4_1 =
  499|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r4_1, eights), 4);
  500|      0|                    i4_res_samp_4x32b_r5_1 =
  501|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r5_1, eights), 4);
  502|      0|                    i4_res_samp_4x32b_r6_1 =
  503|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r6_1, eights), 4);
  504|      0|                    i4_res_samp_4x32b_r7_1 =
  505|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_horz_samp_4x32b_r3_1, twos), 2);
  506|       |
  507|      0|                    i4_res_samp_4x32b_r0_2 =
  508|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_horz_samp_4x32b_r0_2, twos), 2);
  509|      0|                    i4_res_samp_4x32b_r1_2 =
  510|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r1_2, eights), 4);
  511|      0|                    i4_res_samp_4x32b_r2_2 =
  512|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r2_2, eights), 4);
  513|      0|                    i4_res_samp_4x32b_r3_2 =
  514|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r3_2, eights), 4);
  515|      0|                    i4_res_samp_4x32b_r4_2 =
  516|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r4_2, eights), 4);
  517|      0|                    i4_res_samp_4x32b_r5_2 =
  518|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r5_2, eights), 4);
  519|      0|                    i4_res_samp_4x32b_r6_2 =
  520|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_res_samp_4x32b_r6_2, eights), 4);
  521|      0|                    i4_res_samp_4x32b_r7_2 =
  522|      0|                        _mm_srai_epi32(_mm_add_epi32(i4_horz_samp_4x32b_r3_2, twos), 2);
  523|       |
  524|       |                    /* populate 2 samples based on current coeffs */
  525|      0|                    _mm_storeu_si128(
  526|      0|                        (__m128i *) pi2_out_res,
  527|      0|                        _mm_packs_epi32(i4_res_samp_4x32b_r0_1, i4_res_samp_4x32b_r0_2));
  528|      0|                    _mm_storeu_si128(
  529|      0|                        (__m128i *) (pi2_out_res + i4_out_res_stride),
  530|      0|                        _mm_packs_epi32(i4_res_samp_4x32b_r1_1, i4_res_samp_4x32b_r1_2));
  531|      0|                    _mm_storeu_si128(
  532|      0|                        (__m128i *) (pi2_out_res + (i4_out_res_stride << 1)),
  533|      0|                        _mm_packs_epi32(i4_res_samp_4x32b_r2_1, i4_res_samp_4x32b_r2_2));
  534|      0|                    _mm_storeu_si128(
  535|      0|                        (__m128i *) (pi2_out_res + (i4_out_res_stride * 3)),
  536|      0|                        _mm_packs_epi32(i4_res_samp_4x32b_r3_1, i4_res_samp_4x32b_r3_2));
  537|      0|                    _mm_storeu_si128(
  538|      0|                        (__m128i *) (pi2_out_res + (i4_out_res_stride << 2)),
  539|      0|                        _mm_packs_epi32(i4_res_samp_4x32b_r4_1, i4_res_samp_4x32b_r4_2));
  540|      0|                    _mm_storeu_si128(
  541|      0|                        (__m128i *) (pi2_out_res + (i4_out_res_stride * 5)),
  542|      0|                        _mm_packs_epi32(i4_res_samp_4x32b_r5_1, i4_res_samp_4x32b_r5_2));
  543|      0|                    _mm_storeu_si128(
  544|      0|                        (__m128i *) (pi2_out_res + (i4_out_res_stride * 6)),
  545|      0|                        _mm_packs_epi32(i4_res_samp_4x32b_r6_1, i4_res_samp_4x32b_r6_2));
  546|      0|                    _mm_storeu_si128(
  547|      0|                        (__m128i *) (pi2_out_res + (i4_out_res_stride * 7)),
  548|      0|                        _mm_packs_epi32(i4_res_samp_4x32b_r7_1, i4_res_samp_4x32b_r7_2));
  549|       |
  550|      0|                    pi2_out_res += BLOCK_WIDTH;
  ------------------
  |  |   64|      0|#define BLOCK_WIDTH 8
  ------------------
  551|      0|                }
  552|      0|            }
  553|  47.3k|            else
  554|  47.3k|            {
  555|  47.3k|                pi2_out_res += BLOCK_WIDTH;
  ------------------
  |  |   64|  47.3k|#define BLOCK_WIDTH 8
  ------------------
  556|  47.3k|            }
  557|       |
  558|       |            /* Block level loop updates */
  559|  47.3k|            if(1 == i4_blk_ctr)
  ------------------
  |  Branch (559:16): [True: 11.8k, False: 35.5k]
  ------------------
  560|  11.8k|            {
  561|  11.8k|                pi2_inp_data -= SUB_BLOCK_WIDTH;
  ------------------
  |  |   61|  11.8k|#define SUB_BLOCK_WIDTH 4
  ------------------
  562|  11.8k|                pi2_inp_data += (i4_inp_data_stride * SUB_BLOCK_HEIGHT);
  ------------------
  |  |   62|  11.8k|#define SUB_BLOCK_HEIGHT 4
  ------------------
  563|  11.8k|                pi2_out_res -= MB_WIDTH;
  ------------------
  |  |   67|  11.8k|#define MB_WIDTH 16
  ------------------
  564|  11.8k|                pi2_out_res += (i4_out_res_stride * BLOCK_HEIGHT);
  ------------------
  |  |   65|  11.8k|#define BLOCK_HEIGHT 8
  ------------------
  565|  11.8k|                i4_ref_nnz >>= 2;
  566|  11.8k|            }
  567|  35.5k|            else
  568|  35.5k|            {
  569|  35.5k|                pi2_inp_data += SUB_BLOCK_WIDTH;
  ------------------
  |  |   61|  35.5k|#define SUB_BLOCK_WIDTH 4
  ------------------
  570|  35.5k|            }
  571|       |
  572|  47.3k|            i4_ref_nnz >>= 1;
  573|  47.3k|        } /* end of loop over all the blocks */
  574|  11.8k|    }
  575|  11.8k|    return;
  576|  11.8k|}
isvcd_interpolate_residual_sse42:
  603|    300|{
  604|    300|    residual_sampling_ctxt_t *ps_ctxt;
  605|    300|    residual_samp_map_ctxt_t *ps_map_ctxt;
  606|    300|    res_lyr_ctxt *ps_lyr_ctxt;
  607|    300|    ref_pixel_map_t *ps_x_pos_phase;
  608|    300|    ref_pixel_map_t *ps_y_pos_phase;
  609|       |
  610|    300|    WORD32 i4_x, i4_y;
  611|    300|    WORD32 i4_frm_mb_x, i4_frm_mb_y;
  612|    300|    WORD32 i4_temp_array_ht;
  613|    300|    WORD32 i4_mb_wd;
  614|    300|    WORD32 i4_mb_ht;
  615|    300|    WORD16 *pi2_ref_array;
  616|    300|    UWORD8 *pu1_ref_x_ptr_incr, *pu1_ref_y_ptr_incr;
  617|       |
  618|    300|    WORD8 arr_y_ref_pos[16] = {0};
  619|    300|    WORD8 arr_x_ref_pos[16] = {0};
  620|    300|    WORD8 arr_x_phase[32] = {0};
  621|    300|    WORD8 arr_y_phase[32] = {0};
  622|    300|    WORD8 *pi1_y_ref_pos;
  623|    300|    WORD8 *pi1_x_ref_pos;
  624|    300|    WORD8 *pi1_y_phase;
  625|    300|    WORD8 *pi1_x_phase;
  626|       |
  627|    300|    ps_ctxt = (residual_sampling_ctxt_t *) pv_residual_samp_ctxt;
  628|    300|    ps_lyr_ctxt = &ps_ctxt->as_res_lyrs[ps_ctxt->i4_res_lyr_id];
  629|    300|    pi2_ref_array = ps_ctxt->pi2_refarray_buffer;
  630|    300|    pu1_ref_x_ptr_incr = ps_ctxt->pu1_ref_x_ptr_incr;
  631|    300|    pu1_ref_y_ptr_incr = ps_ctxt->pu1_ref_y_ptr_incr;
  632|       |
  633|       |    /* --------------------------------------------------------------------- */
  634|       |    /* Extracting information from the mapping context                       */
  635|       |    /* --------------------------------------------------------------------- */
  636|    300|    if(1 == i4_chroma_flag)
  ------------------
  |  Branch (636:8): [True: 200, False: 100]
  ------------------
  637|    200|        ps_map_ctxt = &ps_lyr_ctxt->s_chroma_map_ctxt;
  638|    100|    else
  639|    100|        ps_map_ctxt = &ps_lyr_ctxt->s_luma_map_ctxt;
  640|       |
  641|    300|    i4_mb_wd = MB_WIDTH >> i4_chroma_flag;
  ------------------
  |  |   67|    300|#define MB_WIDTH 16
  ------------------
  642|    300|    i4_mb_ht = MB_HEIGHT >> i4_chroma_flag;
  ------------------
  |  |   68|    300|#define MB_HEIGHT 16
  ------------------
  643|       |
  644|    300|    ps_x_pos_phase = ps_map_ctxt->ps_x_pos_phase;
  645|    300|    ps_y_pos_phase = ps_map_ctxt->ps_y_pos_phase;
  646|       |
  647|    300|    i4_temp_array_ht = i4_mb_ht;
  648|    300|    i4_frm_mb_y = u2_mb_y * i4_mb_ht;
  649|    300|    i4_frm_mb_x = u2_mb_x * i4_mb_wd;
  650|       |
  651|       |    /* --------------------------------------------------------------------- */
  652|       |    /* Loop for interpolation                                                */
  653|       |    /* --------------------------------------------------------------------- */
  654|       |
  655|    300|    if(i4_chroma_flag == 0)
  ------------------
  |  Branch (655:8): [True: 100, False: 200]
  ------------------
  656|    100|    {
  657|    100|        __m128i const_16_8x16b, const_128, const_ones, const_ones_8x16b, mid_indx_16x8b;
  658|    100|        __m128i ref_arr_8x16b_r0_0;
  659|    100|        __m128i ref_arr_8x16b_r1_0;
  660|    100|        __m128i phs_mask_8x16b_0, phs_mask_16min_8x16b_0, phs_mask_16x8b_0;
  661|    100|        __m128i x_ref_pos_mask_r0, x_ref_rnd_mask_r0_0;
  662|    100|        __m128i x_ref_pos_mask_temp_r0_0;
  663|    100|        __m128i x_ref_pos_mask_temp_r1_0;
  664|    100|        __m128i phs_mask_div8_8x16b_0;
  665|    100|        __m128i u1_incr_8x16b_r0_0, ref_arr_temp0_8x16b_r0_0, res0_8x16b_r0_0,
  666|    100|            u1_incr_not_8x16b_r0_0;
  667|    100|        __m128i u1_incr_8x16b_r1_0, ref_arr_temp1_8x16b_r0_0, res1_8x16b_r0_0;
  668|       |
  669|    100|        __m128i u1_incr_not_8x16b_r0_even, u1_incr_not_8x16b_r1_even, x_ref_pos_mask_temp_r0_even,
  670|    100|            x_ref_pos_mask_temp_r1_even;
  671|    100|        __m128i u1_incr_not_8x16b_r0_odd, u1_incr_not_8x16b_r1_odd, x_ref_pos_mask_temp_r0_odd,
  672|    100|            x_ref_pos_mask_temp_r1_odd;
  673|       |
  674|    100|        __m128i ref_arr_temp0_8x16b_r1_0, res_8x16b_r0_0, res0_8x16b_r1_0, u1_incr_not_8x16b_r1_0;
  675|    100|        __m128i ref_arr_temp1_8x16b_r1_0, res_8x16b_r1_0, res1_8x16b_r1_0;
  676|    100|        __m128i u1_y_incr_8x16b_r0_0, u1_y_incr_8x16b_r0_1, u1_y_incr_8x16b_r0_low,
  677|    100|            u1_y_incr_8x16b_r0_high;
  678|       |
  679|    100|        __m128i prev_res_8x16b_r0_0;
  680|    100|        __m128i prev_res_8x16b_r1_0;
  681|    100|        __m128i prev_res_8x16b_r0_1;
  682|    100|        __m128i prev_res_8x16b_r1_1;
  683|       |
  684|    100|        __m128i u1_prev_y_incr_8x16b_r0_0;
  685|    100|        __m128i u1_prev_y_incr_8x16b_r0_1;
  686|       |
  687|    100|        __m128i ref_arr_8x16b_r0_1;
  688|    100|        __m128i ref_arr_8x16b_r1_1;
  689|    100|        __m128i phs_mask_8x16b_1, phs_mask_div8_8x16b_1, phs_mask_16min_8x16b_1;
  690|    100|        __m128i x_ref_pos_mask_temp_r0_1;
  691|    100|        __m128i x_ref_pos_mask_temp_r1_1;
  692|    100|        __m128i ref_arr_temp0_8x16b_r0_1, res0_8x16b_r0_1, u1_incr_not_8x16b_r0_1;
  693|    100|        __m128i ref_arr_temp1_8x16b_r0_1, res1_8x16b_r0_1;
  694|       |
  695|    100|        __m128i ref_arr_temp0_8x16b_r1_1, res_8x16b_r0_1, res0_8x16b_r1_1, u1_incr_not_8x16b_r1_1;
  696|    100|        __m128i ref_arr_temp1_8x16b_r1_1, res_8x16b_r1_1, res1_8x16b_r1_1;
  697|       |
  698|    100|        __m128i vert_res0_8x16b_r0_0, vert_res0_8x16b_r0_1, res_4x32b_l_0, res_4x32b_h_0;
  699|    100|        __m128i vert_res1_8x16b_r0_0, vert_res1_8x16b_r0_1, res_4x32b_l_1, res_4x32b_h_1;
  700|    100|        __m128i res_8x16b_l, res_8x16b_h;
  701|    100|        __m128i phs_y_mask_16min_8x16b, phs_y_mask_8x16b, phs_y_mask_mix_8x16b;
  702|    100|        __m128i zero_8x16b;
  703|    100|        WORD32 zero_r0_0, zero_r1_0, zero_r0_1, zero_r1_1, zero_r0_r1 = 0;
  704|    100|        WORD32 strt_indx_h;
  705|    100|        WORD16 *pi2_ref_array_temp;
  706|    100|        UWORD8 *pu1_ref_x_ptr_incr_temp, *pu1_ref_y_ptr_incr_temp;
  707|    100|        WORD32 i4_y_phase;
  708|    100|        WORD32 out_stride_temp;
  709|    100|        const_128 = _mm_set1_epi32(128);
  710|    100|        zero_8x16b = _mm_set1_epi16(0);
  711|    100|        const_ones = _mm_set1_epi8(1);
  712|    100|        const_ones_8x16b = _mm_set1_epi16(1);
  713|       |
  714|  1.70k|        for(i4_y = 0; i4_y < (i4_temp_array_ht); i4_y++)
  ------------------
  |  Branch (714:23): [True: 1.60k, False: 100]
  ------------------
  715|  1.60k|        {
  716|  1.60k|            arr_y_phase[i4_y] = (WORD8) ps_y_pos_phase[i4_y + i4_frm_mb_y].i2_phase;
  717|  1.60k|            arr_y_ref_pos[i4_y] = (WORD8) (ps_y_pos_phase[i4_y + i4_frm_mb_y].i2_ref_pos);
  718|  1.60k|        }
  719|    100|        pi1_y_ref_pos = arr_y_ref_pos;
  720|    100|        pi1_y_phase = arr_y_phase;
  721|       |
  722|    100|        strt_indx_h = 0;
  723|    100|        strt_indx_h = (ps_x_pos_phase[8 + i4_frm_mb_x].i2_ref_pos);
  724|  1.70k|        for(i4_x = 0; i4_x < i4_mb_wd; i4_x++)
  ------------------
  |  Branch (724:23): [True: 1.60k, False: 100]
  ------------------
  725|  1.60k|        {
  726|  1.60k|            arr_x_ref_pos[i4_x] = (WORD8) ps_x_pos_phase[i4_x + i4_frm_mb_x].i2_ref_pos;
  727|  1.60k|            arr_x_phase[i4_x] = (WORD8) ps_x_pos_phase[i4_x + i4_frm_mb_x].i2_phase;
  728|  1.60k|        }
  729|       |
  730|    100|        pi1_x_ref_pos = arr_x_ref_pos;
  731|    100|        pi1_x_phase = arr_x_phase;
  732|       |
  733|    100|        x_ref_pos_mask_r0 = _mm_loadu_si128((__m128i *) (pi1_x_ref_pos));
  734|    100|        phs_mask_16x8b_0 = _mm_loadu_si128((__m128i *) (pi1_x_phase));
  735|    100|        phs_mask_8x16b_0 = _mm_cvtepi8_epi16(phs_mask_16x8b_0);
  736|    100|        phs_mask_8x16b_1 = _mm_cvtepi8_epi16(_mm_loadu_si128((__m128i *) (pi1_x_phase + 8)));
  737|       |
  738|    100|        phs_mask_div8_8x16b_0 = _mm_srli_epi16(phs_mask_8x16b_0, 3);
  739|    100|        phs_mask_div8_8x16b_1 = _mm_srli_epi16(phs_mask_8x16b_1, 3);
  740|    100|        phs_mask_div8_8x16b_0 = _mm_packs_epi16(phs_mask_div8_8x16b_0, phs_mask_div8_8x16b_1);
  741|    100|        const_16_8x16b = _mm_set1_epi16(16);
  742|       |
  743|    100|        phs_mask_16min_8x16b_0 = _mm_sub_epi16(const_16_8x16b, phs_mask_8x16b_0);
  744|    100|        phs_mask_16min_8x16b_1 = _mm_sub_epi16(const_16_8x16b, phs_mask_8x16b_1);
  745|       |
  746|    100|        x_ref_rnd_mask_r0_0 = _mm_add_epi8(x_ref_pos_mask_r0, phs_mask_div8_8x16b_0);
  747|    100|        mid_indx_16x8b = _mm_set1_epi8((strt_indx_h << 1));
  748|  1.70k|        for(i4_y = 0; i4_y < (i4_temp_array_ht); i4_y++)
  ------------------
  |  Branch (748:23): [True: 1.60k, False: 100]
  ------------------
  749|  1.60k|        {
  750|  1.60k|            if((i4_y > 0) && (pi1_y_ref_pos[i4_y] == pi1_y_ref_pos[i4_y - 1]))
  ------------------
  |  Branch (750:16): [True: 1.50k, False: 100]
  |  Branch (750:30): [True: 500, False: 1.00k]
  ------------------
  751|    500|            {
  752|    500|                if(zero_r0_r1)
  ------------------
  |  Branch (752:20): [True: 424, False: 76]
  ------------------
  753|    424|                {
  754|    424|                    res_8x16b_l = _mm_set1_epi16(0);
  755|    424|                    res_8x16b_h = _mm_set1_epi16(0);
  756|    424|                    out_stride_temp = (i4_y * i4_out_stride);
  757|    424|                    _mm_storeu_si128((__m128i *) (pi2_out + out_stride_temp), res_8x16b_l);
  758|    424|                    _mm_storeu_si128((__m128i *) (pi2_out + out_stride_temp + 8), res_8x16b_h);
  759|    424|                    continue;
  760|    424|                }
  761|       |
  762|     76|                res_8x16b_r0_0 = prev_res_8x16b_r0_0;
  763|     76|                res_8x16b_r1_0 = prev_res_8x16b_r1_0;
  764|     76|                res_8x16b_r0_1 = prev_res_8x16b_r0_1;
  765|     76|                res_8x16b_r1_1 = prev_res_8x16b_r1_1;
  766|       |
  767|     76|                u1_y_incr_8x16b_r0_0 = u1_prev_y_incr_8x16b_r0_0;
  768|     76|                u1_y_incr_8x16b_r0_1 = u1_prev_y_incr_8x16b_r0_1;
  769|     76|            }
  770|  1.10k|            else
  771|  1.10k|            {
  772|  1.10k|                pi2_ref_array_temp = pi2_ref_array + ((pi1_y_ref_pos[i4_y]) * i4_refarray_wd);
  773|  1.10k|                pu1_ref_x_ptr_incr_temp =
  774|  1.10k|                    pu1_ref_x_ptr_incr + ((pi1_y_ref_pos[i4_y]) * i4_refarray_wd);
  775|  1.10k|                ref_arr_8x16b_r0_0 = _mm_loadu_si128((__m128i *) (pi2_ref_array_temp));
  776|  1.10k|                ref_arr_8x16b_r1_0 =
  777|  1.10k|                    _mm_loadu_si128((__m128i *) (pi2_ref_array_temp + i4_refarray_wd));
  778|  1.10k|                ref_arr_8x16b_r0_1 =
  779|  1.10k|                    _mm_loadu_si128((__m128i *) (pi2_ref_array_temp + strt_indx_h));
  780|  1.10k|                ref_arr_8x16b_r1_1 = _mm_loadu_si128(
  781|  1.10k|                    (__m128i *) (pi2_ref_array_temp + i4_refarray_wd + strt_indx_h));
  782|       |
  783|  1.10k|                zero_r0_0 = _mm_test_all_ones(_mm_cmpeq_epi16(
  784|  1.10k|                    ref_arr_8x16b_r0_0, zero_8x16b));  // return 1 if all zeros, else 0
  785|  1.10k|                zero_r1_0 = _mm_test_all_ones(_mm_cmpeq_epi16(ref_arr_8x16b_r1_0, zero_8x16b));
  786|  1.10k|                zero_r0_1 = _mm_test_all_ones(_mm_cmpeq_epi16(ref_arr_8x16b_r0_1, zero_8x16b));
  787|  1.10k|                zero_r1_1 = _mm_test_all_ones(_mm_cmpeq_epi16(ref_arr_8x16b_r1_1, zero_8x16b));
  788|       |
  789|  1.10k|                zero_r0_r1 = zero_r0_0 && zero_r1_0 && zero_r0_1 && zero_r1_1;
  ------------------
  |  Branch (789:30): [True: 980, False: 120]
  |  Branch (789:43): [True: 964, False: 16]
  |  Branch (789:56): [True: 964, False: 0]
  |  Branch (789:69): [True: 958, False: 6]
  ------------------
  790|       |
  791|  1.10k|                if(!zero_r0_r1)
  ------------------
  |  Branch (791:20): [True: 142, False: 958]
  ------------------
  792|    142|                {
  793|    142|                    u1_incr_8x16b_r0_0 = _mm_loadu_si128((__m128i *) (pu1_ref_x_ptr_incr_temp));
  794|    142|                    u1_incr_8x16b_r1_0 =
  795|    142|                        _mm_loadu_si128((__m128i *) (pu1_ref_x_ptr_incr_temp + i4_refarray_wd));
  796|       |
  797|    142|                    u1_incr_8x16b_r0_0 = _mm_shuffle_epi8(u1_incr_8x16b_r0_0, x_ref_pos_mask_r0);
  798|    142|                    u1_incr_8x16b_r1_0 = _mm_shuffle_epi8(u1_incr_8x16b_r1_0, x_ref_pos_mask_r0);
  799|       |
  800|    142|                    u1_incr_not_8x16b_r0_0 =
  801|    142|                        _mm_andnot_si128(u1_incr_8x16b_r0_0, phs_mask_div8_8x16b_0);
  802|    142|                    u1_incr_not_8x16b_r1_0 =
  803|    142|                        _mm_andnot_si128(u1_incr_8x16b_r1_0, phs_mask_div8_8x16b_0);
  804|       |
  805|    142|                    u1_incr_not_8x16b_r0_0 =
  806|    142|                        _mm_add_epi8(u1_incr_not_8x16b_r0_0, x_ref_pos_mask_r0);
  807|    142|                    u1_incr_not_8x16b_r1_0 =
  808|    142|                        _mm_add_epi8(u1_incr_not_8x16b_r1_0, x_ref_pos_mask_r0);
  809|       |
  810|    142|                    x_ref_pos_mask_temp_r0_0 =
  811|    142|                        _mm_add_epi8(u1_incr_not_8x16b_r0_0, u1_incr_8x16b_r0_0);
  812|    142|                    x_ref_pos_mask_temp_r1_0 =
  813|    142|                        _mm_add_epi8(u1_incr_not_8x16b_r1_0, u1_incr_8x16b_r1_0);
  814|       |
  815|       |                    /* _mm_slli_epi8(u1_incr_not_8x16b_r0_0, 1)*/
  816|    142|                    u1_incr_not_8x16b_r0_even =
  817|    142|                        _mm_add_epi8(u1_incr_not_8x16b_r0_0, u1_incr_not_8x16b_r0_0);
  818|    142|                    u1_incr_not_8x16b_r1_even =
  819|    142|                        _mm_add_epi8(u1_incr_not_8x16b_r1_0, u1_incr_not_8x16b_r1_0);
  820|    142|                    x_ref_pos_mask_temp_r0_even =
  821|    142|                        _mm_add_epi8(x_ref_pos_mask_temp_r0_0, x_ref_pos_mask_temp_r0_0);
  822|    142|                    x_ref_pos_mask_temp_r1_even =
  823|    142|                        _mm_add_epi8(x_ref_pos_mask_temp_r1_0, x_ref_pos_mask_temp_r1_0);
  824|       |
  825|    142|                    u1_incr_not_8x16b_r0_odd = _mm_add_epi8(u1_incr_not_8x16b_r0_even, const_ones);
  826|    142|                    u1_incr_not_8x16b_r1_odd = _mm_add_epi8(u1_incr_not_8x16b_r1_even, const_ones);
  827|    142|                    x_ref_pos_mask_temp_r0_odd =
  828|    142|                        _mm_add_epi8(x_ref_pos_mask_temp_r0_even, const_ones);
  829|    142|                    x_ref_pos_mask_temp_r1_odd =
  830|    142|                        _mm_add_epi8(x_ref_pos_mask_temp_r1_even, const_ones);
  831|       |
  832|    142|                    u1_incr_not_8x16b_r0_0 =
  833|    142|                        _mm_unpacklo_epi8(u1_incr_not_8x16b_r0_even, u1_incr_not_8x16b_r0_odd);
  834|    142|                    u1_incr_not_8x16b_r1_0 =
  835|    142|                        _mm_unpacklo_epi8(u1_incr_not_8x16b_r1_even, u1_incr_not_8x16b_r1_odd);
  836|    142|                    x_ref_pos_mask_temp_r0_0 =
  837|    142|                        _mm_unpacklo_epi8(x_ref_pos_mask_temp_r0_even, x_ref_pos_mask_temp_r0_odd);
  838|    142|                    x_ref_pos_mask_temp_r1_0 =
  839|    142|                        _mm_unpacklo_epi8(x_ref_pos_mask_temp_r1_even, x_ref_pos_mask_temp_r1_odd);
  840|       |
  841|    142|                    u1_incr_not_8x16b_r0_1 =
  842|    142|                        _mm_unpackhi_epi8(u1_incr_not_8x16b_r0_even, u1_incr_not_8x16b_r0_odd);
  843|    142|                    u1_incr_not_8x16b_r1_1 =
  844|    142|                        _mm_unpackhi_epi8(u1_incr_not_8x16b_r1_even, u1_incr_not_8x16b_r1_odd);
  845|    142|                    x_ref_pos_mask_temp_r0_1 =
  846|    142|                        _mm_unpackhi_epi8(x_ref_pos_mask_temp_r0_even, x_ref_pos_mask_temp_r0_odd);
  847|    142|                    x_ref_pos_mask_temp_r1_1 =
  848|    142|                        _mm_unpackhi_epi8(x_ref_pos_mask_temp_r1_even, x_ref_pos_mask_temp_r1_odd);
  849|       |
  850|    142|                    u1_incr_not_8x16b_r0_1 = _mm_sub_epi8(u1_incr_not_8x16b_r0_1, mid_indx_16x8b);
  851|    142|                    u1_incr_not_8x16b_r1_1 = _mm_sub_epi8(u1_incr_not_8x16b_r1_1, mid_indx_16x8b);
  852|    142|                    x_ref_pos_mask_temp_r0_1 =
  853|    142|                        _mm_sub_epi8(x_ref_pos_mask_temp_r0_1, mid_indx_16x8b);
  854|    142|                    x_ref_pos_mask_temp_r1_1 =
  855|    142|                        _mm_sub_epi8(x_ref_pos_mask_temp_r1_1, mid_indx_16x8b);
  856|       |
  857|    142|                    ref_arr_temp0_8x16b_r0_0 =
  858|    142|                        _mm_shuffle_epi8(ref_arr_8x16b_r0_0, u1_incr_not_8x16b_r0_0);
  859|    142|                    ref_arr_temp0_8x16b_r1_0 =
  860|    142|                        _mm_shuffle_epi8(ref_arr_8x16b_r1_0, u1_incr_not_8x16b_r1_0);
  861|    142|                    ref_arr_temp1_8x16b_r0_0 =
  862|    142|                        _mm_shuffle_epi8(ref_arr_8x16b_r0_0, x_ref_pos_mask_temp_r0_0);
  863|    142|                    ref_arr_temp1_8x16b_r1_0 =
  864|    142|                        _mm_shuffle_epi8(ref_arr_8x16b_r1_0, x_ref_pos_mask_temp_r1_0);
  865|    142|                    ref_arr_temp0_8x16b_r0_1 =
  866|    142|                        _mm_shuffle_epi8(ref_arr_8x16b_r0_1, u1_incr_not_8x16b_r0_1);
  867|    142|                    ref_arr_temp0_8x16b_r1_1 =
  868|    142|                        _mm_shuffle_epi8(ref_arr_8x16b_r1_1, u1_incr_not_8x16b_r1_1);
  869|    142|                    ref_arr_temp1_8x16b_r0_1 =
  870|    142|                        _mm_shuffle_epi8(ref_arr_8x16b_r0_1, x_ref_pos_mask_temp_r0_1);
  871|    142|                    ref_arr_temp1_8x16b_r1_1 =
  872|    142|                        _mm_shuffle_epi8(ref_arr_8x16b_r1_1, x_ref_pos_mask_temp_r1_1);
  873|       |
  874|    142|                    res0_8x16b_r0_0 =
  875|    142|                        _mm_mullo_epi16(ref_arr_temp0_8x16b_r0_0, phs_mask_16min_8x16b_0);
  876|    142|                    res0_8x16b_r1_0 =
  877|    142|                        _mm_mullo_epi16(ref_arr_temp0_8x16b_r1_0, phs_mask_16min_8x16b_0);
  878|    142|                    res1_8x16b_r0_0 = _mm_mullo_epi16(ref_arr_temp1_8x16b_r0_0, phs_mask_8x16b_0);
  879|    142|                    res1_8x16b_r1_0 = _mm_mullo_epi16(ref_arr_temp1_8x16b_r1_0, phs_mask_8x16b_0);
  880|    142|                    res0_8x16b_r0_1 =
  881|    142|                        _mm_mullo_epi16(ref_arr_temp0_8x16b_r0_1, phs_mask_16min_8x16b_1);
  882|    142|                    res0_8x16b_r1_1 =
  883|    142|                        _mm_mullo_epi16(ref_arr_temp0_8x16b_r1_1, phs_mask_16min_8x16b_1);
  884|    142|                    res1_8x16b_r0_1 = _mm_mullo_epi16(ref_arr_temp1_8x16b_r0_1, phs_mask_8x16b_1);
  885|    142|                    res1_8x16b_r1_1 = _mm_mullo_epi16(ref_arr_temp1_8x16b_r1_1, phs_mask_8x16b_1);
  886|       |
  887|    142|                    res_8x16b_r0_0 = _mm_add_epi16(res0_8x16b_r0_0, res1_8x16b_r0_0);
  888|    142|                    res_8x16b_r1_0 = _mm_add_epi16(res0_8x16b_r1_0, res1_8x16b_r1_0);
  889|    142|                    res_8x16b_r0_1 = _mm_add_epi16(res0_8x16b_r0_1, res1_8x16b_r0_1);
  890|    142|                    res_8x16b_r1_1 = _mm_add_epi16(res0_8x16b_r1_1, res1_8x16b_r1_1);
  891|       |
  892|    142|                    prev_res_8x16b_r0_0 = res_8x16b_r0_0;
  893|    142|                    prev_res_8x16b_r1_0 = res_8x16b_r1_0;
  894|    142|                    prev_res_8x16b_r0_1 = res_8x16b_r0_1;
  895|    142|                    prev_res_8x16b_r1_1 = res_8x16b_r1_1;
  896|       |
  897|    142|                    pu1_ref_y_ptr_incr_temp =
  898|    142|                        pu1_ref_y_ptr_incr + (pi1_y_ref_pos[i4_y] * i4_refarray_wd);
  899|    142|                    u1_y_incr_8x16b_r0_0 = _mm_loadu_si128((__m128i *) (pu1_ref_y_ptr_incr_temp));
  900|       |
  901|    142|                    u1_y_incr_8x16b_r0_0 =
  902|    142|                        _mm_shuffle_epi8(u1_y_incr_8x16b_r0_0, x_ref_rnd_mask_r0_0);
  903|       |
  904|    142|                    u1_y_incr_8x16b_r0_low = _mm_cvtepi8_epi16(u1_y_incr_8x16b_r0_0);
  905|    142|                    u1_y_incr_8x16b_r0_high =
  906|    142|                        _mm_cvtepi8_epi16(_mm_unpackhi_epi64(u1_y_incr_8x16b_r0_0, const_ones));
  907|       |
  908|    142|                    u1_y_incr_8x16b_r0_0 =
  909|    142|                        _mm_cmpeq_epi16(u1_y_incr_8x16b_r0_low, const_ones_8x16b);
  910|    142|                    u1_y_incr_8x16b_r0_1 =
  911|    142|                        _mm_cmpeq_epi16(u1_y_incr_8x16b_r0_high, const_ones_8x16b);
  912|       |
  913|    142|                    u1_prev_y_incr_8x16b_r0_0 = u1_y_incr_8x16b_r0_0;
  914|    142|                    u1_prev_y_incr_8x16b_r0_1 = u1_y_incr_8x16b_r0_1;
  915|    142|                }
  916|  1.10k|            }
  917|       |
  918|  1.17k|            if(zero_r0_r1)
  ------------------
  |  Branch (918:16): [True: 958, False: 218]
  ------------------
  919|    958|            {
  920|    958|                res_8x16b_l = _mm_set1_epi16(0);
  921|    958|                res_8x16b_h = _mm_set1_epi16(0);
  922|    958|            }
  923|    218|            else
  924|    218|            {
  925|    218|                i4_y_phase = pi1_y_phase[i4_y];
  926|       |
  927|    218|                if((i4_y_phase) >> 3)
  ------------------
  |  Branch (927:20): [True: 142, False: 76]
  ------------------
  928|    142|                {
  929|    142|                    vert_res0_8x16b_r0_0 =
  930|    142|                        _mm_blendv_epi8(res_8x16b_r1_0, res_8x16b_r0_0, u1_y_incr_8x16b_r0_0);
  931|    142|                    vert_res1_8x16b_r0_0 =
  932|    142|                        _mm_blendv_epi8(res_8x16b_r1_0, res_8x16b_r1_0, u1_y_incr_8x16b_r0_0);
  933|    142|                    vert_res0_8x16b_r0_1 =
  934|    142|                        _mm_blendv_epi8(res_8x16b_r1_1, res_8x16b_r0_1, u1_y_incr_8x16b_r0_1);
  935|    142|                    vert_res1_8x16b_r0_1 =
  936|    142|                        _mm_blendv_epi8(res_8x16b_r1_1, res_8x16b_r1_1, u1_y_incr_8x16b_r0_1);
  937|    142|                }
  938|     76|                else
  939|     76|                {
  940|     76|                    vert_res0_8x16b_r0_0 =
  941|     76|                        _mm_blendv_epi8(res_8x16b_r0_0, res_8x16b_r0_0, u1_y_incr_8x16b_r0_0);
  942|     76|                    vert_res1_8x16b_r0_0 =
  943|     76|                        _mm_blendv_epi8(res_8x16b_r0_0, res_8x16b_r1_0, u1_y_incr_8x16b_r0_0);
  944|     76|                    vert_res0_8x16b_r0_1 =
  945|     76|                        _mm_blendv_epi8(res_8x16b_r0_1, res_8x16b_r0_1, u1_y_incr_8x16b_r0_1);
  946|     76|                    vert_res1_8x16b_r0_1 =
  947|     76|                        _mm_blendv_epi8(res_8x16b_r0_1, res_8x16b_r1_1, u1_y_incr_8x16b_r0_1);
  948|     76|                }
  949|    218|                res0_8x16b_r0_0 = _mm_unpacklo_epi16(vert_res0_8x16b_r0_0, vert_res1_8x16b_r0_0);
  950|    218|                res1_8x16b_r0_0 = _mm_unpackhi_epi16(vert_res0_8x16b_r0_0, vert_res1_8x16b_r0_0);
  951|    218|                res0_8x16b_r0_1 = _mm_unpacklo_epi16(vert_res0_8x16b_r0_1, vert_res1_8x16b_r0_1);
  952|    218|                res1_8x16b_r0_1 = _mm_unpackhi_epi16(vert_res0_8x16b_r0_1, vert_res1_8x16b_r0_1);
  953|       |
  954|    218|                phs_y_mask_16min_8x16b = _mm_set1_epi16(16 - i4_y_phase);
  955|    218|                phs_y_mask_8x16b = _mm_set1_epi16(i4_y_phase);
  956|    218|                phs_y_mask_mix_8x16b = _mm_unpacklo_epi16(phs_y_mask_16min_8x16b, phs_y_mask_8x16b);
  957|       |
  958|    218|                res_4x32b_l_0 = _mm_madd_epi16(res0_8x16b_r0_0, phs_y_mask_mix_8x16b);
  959|    218|                res_4x32b_l_1 = _mm_madd_epi16(res1_8x16b_r0_0, phs_y_mask_mix_8x16b);
  960|    218|                res_4x32b_h_0 = _mm_madd_epi16(res0_8x16b_r0_1, phs_y_mask_mix_8x16b);
  961|    218|                res_4x32b_h_1 = _mm_madd_epi16(res1_8x16b_r0_1, phs_y_mask_mix_8x16b);
  962|       |
  963|    218|                res_4x32b_l_0 = _mm_add_epi32(res_4x32b_l_0, const_128);
  964|    218|                res_4x32b_l_1 = _mm_add_epi32(res_4x32b_l_1, const_128);
  965|    218|                res_4x32b_h_0 = _mm_add_epi32(res_4x32b_h_0, const_128);
  966|    218|                res_4x32b_h_1 = _mm_add_epi32(res_4x32b_h_1, const_128);
  967|       |
  968|    218|                res_4x32b_l_0 = _mm_srai_epi32(res_4x32b_l_0, 8);
  969|    218|                res_4x32b_l_1 = _mm_srai_epi32(res_4x32b_l_1, 8);
  970|    218|                res_4x32b_h_0 = _mm_srai_epi32(res_4x32b_h_0, 8);
  971|    218|                res_4x32b_h_1 = _mm_srai_epi32(res_4x32b_h_1, 8);
  972|    218|                res_8x16b_l = _mm_packs_epi32(res_4x32b_l_0, res_4x32b_l_1);
  973|    218|                res_8x16b_h = _mm_packs_epi32(res_4x32b_h_0, res_4x32b_h_1);
  974|    218|            }
  975|       |
  976|  1.17k|            out_stride_temp = (i4_y * i4_out_stride);
  977|  1.17k|            _mm_storeu_si128((__m128i *) (pi2_out + out_stride_temp), res_8x16b_l);
  978|  1.17k|            _mm_storeu_si128((__m128i *) (pi2_out + out_stride_temp + 8), res_8x16b_h);
  979|  1.17k|        }
  980|    100|    }
  981|    200|    else
  982|    200|    {
  983|    200|        __m128i const_16_8x16b, const_128, const_ones, const_ones_8x16b;
  984|    200|        __m128i ref_arr_8x16b_r0_0;
  985|    200|        __m128i ref_arr_8x16b_r1_0;
  986|    200|        __m128i phs_mask_8x16b_0, phs_mask_div8_8x16b_0, phs_mask_16min_8x16b_0;
  987|    200|        __m128i x_ref_pos_mask_r0, x_ref_rnd_mask_r0_0;
  988|    200|        __m128i x_ref_pos_mask_temp_r0_0;
  989|    200|        __m128i x_ref_pos_mask_temp_r1_0;
  990|       |
  991|    200|        __m128i u1_incr_8x16b_r0_0, ref_arr_temp0_8x16b_r0_0, res0_8x16b_r0_0,
  992|    200|            u1_incr_not_8x16b_r0_0;
  993|    200|        __m128i u1_incr_8x16b_r1_0, ref_arr_temp1_8x16b_r0_0, res1_8x16b_r0_0;
  994|    200|        __m128i u1_y_incr_8x16b_r0_0;
  995|       |
  996|    200|        __m128i u1_incr_not_8x16b_r0_odd, u1_incr_not_8x16b_r1_odd, x_ref_pos_mask_temp_r0_odd,
  997|    200|            x_ref_pos_mask_temp_r1_odd;
  998|    200|        __m128i u1_incr_not_8x16b_r0_even, u1_incr_not_8x16b_r1_even, x_ref_pos_mask_temp_r0_even,
  999|    200|            x_ref_pos_mask_temp_r1_even;
 1000|       |
 1001|    200|        __m128i ref_arr_temp0_8x16b_r1_0, res_8x16b_r0_0, res0_8x16b_r1_0, u1_incr_not_8x16b_r1_0;
 1002|    200|        __m128i ref_arr_temp1_8x16b_r1_0, res_8x16b_r1_0, res1_8x16b_r1_0;
 1003|    200|        __m128i u1_prev_y_incr_8x16b_r0_0;
 1004|    200|        __m128i prev_res_8x16b_r0_0;
 1005|    200|        __m128i prev_res_8x16b_r1_0;
 1006|       |
 1007|    200|        __m128i vert_res0_8x16b_r0_0, res_4x32b_l_0, out_4x32b_l;
 1008|    200|        __m128i vert_res1_8x16b_r0_0, res_4x32b_l_1, out_4x32b_h;
 1009|    200|        __m128i phs_y_mask_16min_8x16b, phs_y_mask_8x16b, phs_y_mask_mix_8x16b;
 1010|    200|        __m128i chroma_mask, chroma_mask2;
 1011|    200|        __m128i zero_8x16b = _mm_set1_epi16(0);
 1012|    200|        WORD32 zero_r0_0, zero_r1_0, zero_r0_r1 = 0;
 1013|    200|        WORD16 *pi2_ref_array_temp;
 1014|    200|        UWORD8 *pu1_ref_x_ptr_incr_temp, *pu1_ref_y_ptr_incr_temp;
 1015|    200|        WORD32 i4_y_phase;
 1016|    200|        WORD32 out_stride_temp;
 1017|    200|        const_ones = _mm_set1_epi8(1);
 1018|    200|        const_ones_8x16b = _mm_set1_epi16(1);
 1019|    200|        const_128 = _mm_set1_epi32(128);
 1020|       |
 1021|  1.80k|        for(i4_y = 0; i4_y < (i4_temp_array_ht); i4_y++)
  ------------------
  |  Branch (1021:23): [True: 1.60k, False: 200]
  ------------------
 1022|  1.60k|        {
 1023|  1.60k|            arr_y_phase[i4_y] = (WORD8) ps_y_pos_phase[i4_y + i4_frm_mb_y].i2_phase;
 1024|  1.60k|            arr_y_ref_pos[i4_y] = (WORD8) (ps_y_pos_phase[i4_y + i4_frm_mb_y].i2_ref_pos);
 1025|  1.60k|        }
 1026|    200|        pi1_y_ref_pos = arr_y_ref_pos;
 1027|    200|        pi1_y_phase = arr_y_phase;
 1028|       |
 1029|  1.80k|        for(i4_x = 0; i4_x < i4_mb_wd; i4_x++)
  ------------------
  |  Branch (1029:23): [True: 1.60k, False: 200]
  ------------------
 1030|  1.60k|        {
 1031|  1.60k|            arr_x_ref_pos[i4_x] = (WORD8) ps_x_pos_phase[i4_x + i4_frm_mb_x].i2_ref_pos;
 1032|  1.60k|            arr_x_phase[i4_x] = (WORD8) ps_x_pos_phase[i4_x + i4_frm_mb_x].i2_phase;
 1033|  1.60k|        }
 1034|       |
 1035|    200|        pi1_x_ref_pos = arr_x_ref_pos;
 1036|    200|        pi1_x_phase = arr_x_phase;
 1037|       |
 1038|    200|        phs_mask_8x16b_0 = _mm_cvtepi8_epi16(_mm_loadu_si128((__m128i *) (pi1_x_phase)));
 1039|    200|        x_ref_pos_mask_r0 = _mm_loadu_si128((__m128i *) (pi1_x_ref_pos));
 1040|       |
 1041|    200|        const_16_8x16b = _mm_set1_epi16(16);
 1042|    200|        chroma_mask = _mm_set1_epi32(0xFFFF0000);
 1043|    200|        chroma_mask2 = _mm_set1_epi32(0x0000FFFF);
 1044|    200|        phs_mask_div8_8x16b_0 = _mm_srli_epi16(phs_mask_8x16b_0, 3);
 1045|    200|        phs_mask_div8_8x16b_0 = _mm_packs_epi16(phs_mask_div8_8x16b_0, const_ones);
 1046|       |
 1047|    200|        phs_mask_16min_8x16b_0 = _mm_sub_epi16(const_16_8x16b, phs_mask_8x16b_0);
 1048|    200|        x_ref_rnd_mask_r0_0 = _mm_add_epi8(x_ref_pos_mask_r0, phs_mask_div8_8x16b_0);
 1049|       |
 1050|  1.80k|        for(i4_y = 0; i4_y < (i4_temp_array_ht); i4_y++)
  ------------------
  |  Branch (1050:23): [True: 1.60k, False: 200]
  ------------------
 1051|  1.60k|        {
 1052|  1.60k|            if((i4_y > 0) && (pi1_y_ref_pos[i4_y] == pi1_y_ref_pos[i4_y - 1]))
  ------------------
  |  Branch (1052:16): [True: 1.40k, False: 200]
  |  Branch (1052:30): [True: 468, False: 932]
  ------------------
 1053|    468|            {
 1054|    468|                if(zero_r0_r1)
  ------------------
  |  Branch (1054:20): [True: 418, False: 50]
  ------------------
 1055|    418|                {
 1056|    418|                    res_4x32b_l_0 = _mm_set1_epi32(0);
 1057|    418|                    res_4x32b_l_1 = _mm_set1_epi32(0);
 1058|    418|                    out_stride_temp = (i4_y * i4_out_stride);
 1059|       |
 1060|    418|                    out_4x32b_l = _mm_loadu_si128((__m128i *) (pi2_out + out_stride_temp));
 1061|    418|                    out_4x32b_h = _mm_loadu_si128((__m128i *) (pi2_out + out_stride_temp + 8));
 1062|       |
 1063|    418|                    out_4x32b_l = _mm_and_si128(out_4x32b_l, chroma_mask);
 1064|    418|                    out_4x32b_h = _mm_and_si128(out_4x32b_h, chroma_mask);
 1065|       |
 1066|    418|                    res_4x32b_l_0 = _mm_and_si128(res_4x32b_l_0, chroma_mask2);
 1067|    418|                    res_4x32b_l_1 = _mm_and_si128(res_4x32b_l_1, chroma_mask2);
 1068|       |
 1069|    418|                    out_4x32b_l = _mm_add_epi8(res_4x32b_l_0, out_4x32b_l);
 1070|    418|                    out_4x32b_h = _mm_add_epi8(res_4x32b_l_1, out_4x32b_h);
 1071|       |
 1072|    418|                    _mm_storeu_si128((__m128i *) (pi2_out + out_stride_temp), out_4x32b_l);
 1073|    418|                    _mm_storeu_si128((__m128i *) (pi2_out + out_stride_temp + 8), out_4x32b_h);
 1074|    418|                    continue;
 1075|    418|                }
 1076|       |
 1077|     50|                res_8x16b_r0_0 = prev_res_8x16b_r0_0;
 1078|     50|                res_8x16b_r1_0 = prev_res_8x16b_r1_0;
 1079|       |
 1080|     50|                u1_y_incr_8x16b_r0_0 = u1_prev_y_incr_8x16b_r0_0;
 1081|     50|            }
 1082|  1.13k|            else
 1083|  1.13k|            {
 1084|  1.13k|                pi2_ref_array_temp = pi2_ref_array + ((pi1_y_ref_pos[i4_y]) * i4_refarray_wd);
 1085|  1.13k|                pu1_ref_x_ptr_incr_temp =
 1086|  1.13k|                    pu1_ref_x_ptr_incr + ((pi1_y_ref_pos[i4_y]) * i4_refarray_wd);
 1087|  1.13k|                ref_arr_8x16b_r0_0 = _mm_loadu_si128((__m128i *) (pi2_ref_array_temp));
 1088|  1.13k|                ref_arr_8x16b_r1_0 =
 1089|  1.13k|                    _mm_loadu_si128((__m128i *) (pi2_ref_array_temp + i4_refarray_wd));
 1090|       |
 1091|  1.13k|                zero_r0_0 = _mm_test_all_ones(_mm_cmpeq_epi16(
 1092|  1.13k|                    ref_arr_8x16b_r0_0, zero_8x16b));  // return 1 if all zeros, else 0
 1093|  1.13k|                zero_r1_0 = _mm_test_all_ones(_mm_cmpeq_epi16(ref_arr_8x16b_r1_0, zero_8x16b));
 1094|       |
 1095|  1.13k|                zero_r0_r1 = zero_r0_0 && zero_r1_0;
  ------------------
  |  Branch (1095:30): [True: 1.04k, False: 86]
  |  Branch (1095:43): [True: 1.02k, False: 22]
  ------------------
 1096|       |
 1097|  1.13k|                if(!zero_r0_r1)
  ------------------
  |  Branch (1097:20): [True: 108, False: 1.02k]
  ------------------
 1098|    108|                {
 1099|    108|                    u1_incr_8x16b_r0_0 = _mm_loadu_si128((__m128i *) (pu1_ref_x_ptr_incr_temp));
 1100|    108|                    u1_incr_8x16b_r1_0 =
 1101|    108|                        _mm_loadu_si128((__m128i *) (pu1_ref_x_ptr_incr_temp + i4_refarray_wd));
 1102|       |
 1103|    108|                    u1_incr_8x16b_r0_0 = _mm_shuffle_epi8(u1_incr_8x16b_r0_0, x_ref_pos_mask_r0);
 1104|    108|                    u1_incr_8x16b_r1_0 = _mm_shuffle_epi8(u1_incr_8x16b_r1_0, x_ref_pos_mask_r0);
 1105|       |
 1106|    108|                    u1_incr_not_8x16b_r0_0 =
 1107|    108|                        _mm_andnot_si128(u1_incr_8x16b_r0_0, phs_mask_div8_8x16b_0);
 1108|    108|                    u1_incr_not_8x16b_r1_0 =
 1109|    108|                        _mm_andnot_si128(u1_incr_8x16b_r1_0, phs_mask_div8_8x16b_0);
 1110|       |
 1111|    108|                    u1_incr_not_8x16b_r0_0 =
 1112|    108|                        _mm_add_epi8(u1_incr_not_8x16b_r0_0, x_ref_pos_mask_r0);
 1113|    108|                    u1_incr_not_8x16b_r1_0 =
 1114|    108|                        _mm_add_epi8(u1_incr_not_8x16b_r1_0, x_ref_pos_mask_r0);
 1115|       |
 1116|    108|                    x_ref_pos_mask_temp_r0_0 =
 1117|    108|                        _mm_add_epi8(u1_incr_not_8x16b_r0_0, u1_incr_8x16b_r0_0);
 1118|    108|                    x_ref_pos_mask_temp_r1_0 =
 1119|    108|                        _mm_add_epi8(u1_incr_not_8x16b_r1_0, u1_incr_8x16b_r1_0);
 1120|       |
 1121|    108|                    u1_incr_not_8x16b_r0_even =
 1122|    108|                        _mm_add_epi8(u1_incr_not_8x16b_r0_0, u1_incr_not_8x16b_r0_0);
 1123|    108|                    u1_incr_not_8x16b_r1_even =
 1124|    108|                        _mm_add_epi8(u1_incr_not_8x16b_r1_0, u1_incr_not_8x16b_r1_0);
 1125|    108|                    x_ref_pos_mask_temp_r0_even =
 1126|    108|                        _mm_add_epi8(x_ref_pos_mask_temp_r0_0, x_ref_pos_mask_temp_r0_0);
 1127|    108|                    x_ref_pos_mask_temp_r1_even =
 1128|    108|                        _mm_add_epi8(x_ref_pos_mask_temp_r1_0, x_ref_pos_mask_temp_r1_0);
 1129|       |
 1130|    108|                    u1_incr_not_8x16b_r0_odd = _mm_add_epi8(u1_incr_not_8x16b_r0_even, const_ones);
 1131|    108|                    u1_incr_not_8x16b_r1_odd = _mm_add_epi8(u1_incr_not_8x16b_r1_even, const_ones);
 1132|    108|                    x_ref_pos_mask_temp_r0_odd =
 1133|    108|                        _mm_add_epi8(x_ref_pos_mask_temp_r0_even, const_ones);
 1134|    108|                    x_ref_pos_mask_temp_r1_odd =
 1135|    108|                        _mm_add_epi8(x_ref_pos_mask_temp_r1_even, const_ones);
 1136|       |
 1137|    108|                    u1_incr_not_8x16b_r0_0 =
 1138|    108|                        _mm_unpacklo_epi8(u1_incr_not_8x16b_r0_even, u1_incr_not_8x16b_r0_odd);
 1139|    108|                    u1_incr_not_8x16b_r1_0 =
 1140|    108|                        _mm_unpacklo_epi8(u1_incr_not_8x16b_r1_even, u1_incr_not_8x16b_r1_odd);
 1141|    108|                    x_ref_pos_mask_temp_r0_0 =
 1142|    108|                        _mm_unpacklo_epi8(x_ref_pos_mask_temp_r0_even, x_ref_pos_mask_temp_r0_odd);
 1143|    108|                    x_ref_pos_mask_temp_r1_0 =
 1144|    108|                        _mm_unpacklo_epi8(x_ref_pos_mask_temp_r1_even, x_ref_pos_mask_temp_r1_odd);
 1145|       |
 1146|    108|                    ref_arr_temp0_8x16b_r0_0 =
 1147|    108|                        _mm_shuffle_epi8(ref_arr_8x16b_r0_0, u1_incr_not_8x16b_r0_0);
 1148|    108|                    ref_arr_temp0_8x16b_r1_0 =
 1149|    108|                        _mm_shuffle_epi8(ref_arr_8x16b_r1_0, u1_incr_not_8x16b_r1_0);
 1150|    108|                    ref_arr_temp1_8x16b_r0_0 =
 1151|    108|                        _mm_shuffle_epi8(ref_arr_8x16b_r0_0, x_ref_pos_mask_temp_r0_0);
 1152|    108|                    ref_arr_temp1_8x16b_r1_0 =
 1153|    108|                        _mm_shuffle_epi8(ref_arr_8x16b_r1_0, x_ref_pos_mask_temp_r1_0);
 1154|       |
 1155|    108|                    res0_8x16b_r0_0 =
 1156|    108|                        _mm_mullo_epi16(ref_arr_temp0_8x16b_r0_0, phs_mask_16min_8x16b_0);
 1157|    108|                    res0_8x16b_r1_0 =
 1158|    108|                        _mm_mullo_epi16(ref_arr_temp0_8x16b_r1_0, phs_mask_16min_8x16b_0);
 1159|    108|                    res1_8x16b_r0_0 = _mm_mullo_epi16(ref_arr_temp1_8x16b_r0_0, phs_mask_8x16b_0);
 1160|    108|                    res1_8x16b_r1_0 = _mm_mullo_epi16(ref_arr_temp1_8x16b_r1_0, phs_mask_8x16b_0);
 1161|       |
 1162|    108|                    res_8x16b_r0_0 = _mm_add_epi16(res0_8x16b_r0_0, res1_8x16b_r0_0);
 1163|    108|                    res_8x16b_r1_0 = _mm_add_epi16(res0_8x16b_r1_0, res1_8x16b_r1_0);
 1164|       |
 1165|    108|                    pu1_ref_y_ptr_incr_temp =
 1166|    108|                        pu1_ref_y_ptr_incr + (pi1_y_ref_pos[i4_y] * i4_refarray_wd);
 1167|    108|                    u1_y_incr_8x16b_r0_0 = _mm_loadu_si128((__m128i *) (pu1_ref_y_ptr_incr_temp));
 1168|       |
 1169|    108|                    u1_y_incr_8x16b_r0_0 =
 1170|    108|                        _mm_shuffle_epi8(u1_y_incr_8x16b_r0_0, x_ref_rnd_mask_r0_0);
 1171|       |
 1172|    108|                    u1_y_incr_8x16b_r0_0 = _mm_cvtepi8_epi16(u1_y_incr_8x16b_r0_0);
 1173|    108|                    u1_y_incr_8x16b_r0_0 = _mm_cmpeq_epi16(u1_y_incr_8x16b_r0_0, const_ones_8x16b);
 1174|    108|                    u1_prev_y_incr_8x16b_r0_0 = u1_y_incr_8x16b_r0_0;
 1175|       |
 1176|    108|                    prev_res_8x16b_r0_0 = res_8x16b_r0_0;
 1177|    108|                    prev_res_8x16b_r1_0 = res_8x16b_r1_0;
 1178|    108|                }
 1179|  1.13k|            }
 1180|       |
 1181|  1.18k|            if(zero_r0_r1)
  ------------------
  |  Branch (1181:16): [True: 1.02k, False: 158]
  ------------------
 1182|  1.02k|            {
 1183|  1.02k|                res_4x32b_l_0 = _mm_set1_epi32(0);
 1184|  1.02k|                res_4x32b_l_1 = _mm_set1_epi32(0);
 1185|  1.02k|            }
 1186|    158|            else
 1187|    158|            {
 1188|    158|                i4_y_phase = pi1_y_phase[i4_y];
 1189|       |
 1190|    158|                if((i4_y_phase) >> 3)
  ------------------
  |  Branch (1190:20): [True: 100, False: 58]
  ------------------
 1191|    100|                {
 1192|    100|                    vert_res0_8x16b_r0_0 =
 1193|    100|                        _mm_blendv_epi8(res_8x16b_r1_0, res_8x16b_r0_0, u1_y_incr_8x16b_r0_0);
 1194|    100|                    vert_res1_8x16b_r0_0 =
 1195|    100|                        _mm_blendv_epi8(res_8x16b_r1_0, res_8x16b_r1_0, u1_y_incr_8x16b_r0_0);
 1196|    100|                }
 1197|     58|                else
 1198|     58|                {
 1199|     58|                    vert_res0_8x16b_r0_0 =
 1200|     58|                        _mm_blendv_epi8(res_8x16b_r0_0, res_8x16b_r0_0, u1_y_incr_8x16b_r0_0);
 1201|     58|                    vert_res1_8x16b_r0_0 =
 1202|     58|                        _mm_blendv_epi8(res_8x16b_r0_0, res_8x16b_r1_0, u1_y_incr_8x16b_r0_0);
 1203|     58|                }
 1204|       |
 1205|    158|                res0_8x16b_r0_0 = _mm_unpacklo_epi16(vert_res0_8x16b_r0_0, vert_res1_8x16b_r0_0);
 1206|    158|                res1_8x16b_r0_0 = _mm_unpackhi_epi16(vert_res0_8x16b_r0_0, vert_res1_8x16b_r0_0);
 1207|       |
 1208|    158|                phs_y_mask_16min_8x16b = _mm_set1_epi16(16 - i4_y_phase);
 1209|    158|                phs_y_mask_8x16b = _mm_set1_epi16(i4_y_phase);
 1210|    158|                phs_y_mask_mix_8x16b = _mm_unpacklo_epi16(phs_y_mask_16min_8x16b, phs_y_mask_8x16b);
 1211|       |
 1212|    158|                res_4x32b_l_0 = _mm_madd_epi16(res0_8x16b_r0_0, phs_y_mask_mix_8x16b);
 1213|    158|                res_4x32b_l_1 = _mm_madd_epi16(res1_8x16b_r0_0, phs_y_mask_mix_8x16b);
 1214|    158|                res_4x32b_l_0 = _mm_add_epi32(res_4x32b_l_0, const_128);
 1215|    158|                res_4x32b_l_1 = _mm_add_epi32(res_4x32b_l_1, const_128);
 1216|       |
 1217|    158|                res_4x32b_l_0 = _mm_srai_epi32(res_4x32b_l_0, 8);
 1218|    158|                res_4x32b_l_1 = _mm_srai_epi32(res_4x32b_l_1, 8);
 1219|    158|            }
 1220|  1.18k|            out_stride_temp = (i4_y * i4_out_stride);
 1221|       |
 1222|  1.18k|            out_4x32b_l = _mm_loadu_si128((__m128i *) (pi2_out + out_stride_temp));
 1223|  1.18k|            out_4x32b_h = _mm_loadu_si128((__m128i *) (pi2_out + out_stride_temp + 8));
 1224|       |
 1225|  1.18k|            out_4x32b_l = _mm_and_si128(out_4x32b_l, chroma_mask);
 1226|  1.18k|            out_4x32b_h = _mm_and_si128(out_4x32b_h, chroma_mask);
 1227|       |
 1228|  1.18k|            res_4x32b_l_0 = _mm_and_si128(res_4x32b_l_0, chroma_mask2);
 1229|  1.18k|            res_4x32b_l_1 = _mm_and_si128(res_4x32b_l_1, chroma_mask2);
 1230|       |
 1231|  1.18k|            out_4x32b_l = _mm_add_epi8(res_4x32b_l_0, out_4x32b_l);
 1232|  1.18k|            out_4x32b_h = _mm_add_epi8(res_4x32b_l_1, out_4x32b_h);
 1233|       |
 1234|  1.18k|            _mm_storeu_si128((__m128i *) (pi2_out + out_stride_temp), out_4x32b_l);
 1235|  1.18k|            _mm_storeu_si128((__m128i *) (pi2_out + out_stride_temp + 8), out_4x32b_h);
 1236|  1.18k|        }
 1237|    200|    }
 1238|    300|    return;
 1239|    300|} /* End of Interpolation Function */
isvcd_residual_reflayer_const_non_boundary_mb_sse42:
 1268|    108|{
 1269|    108|    WORD32 i4_y;
 1270|       |
 1271|    108|    WORD16 *pi2_ref_data_byte;
 1272|    108|    WORD16 *pi2_ref_array_temp;
 1273|    108|    if(i4_chroma_flag == 0)
  ------------------
  |  Branch (1273:8): [True: 36, False: 72]
  ------------------
 1274|     36|    {
 1275|     36|        WORD8 index_0[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
 1276|     36|        __m128i ref_mb_type_8x16_q0, ref_mb_type_8x16_q1, ref_mb_type_8x16_q2, ref_mb_type_8x16_q3,
 1277|     36|            mb_quard1_part_x_8x16;
 1278|     36|        __m128i ref_mb_type_8x16_0, ref_mb_type_8x16_1;
 1279|     36|        __m128i ref_mb_type_8x16_low_0, ref_mb_type_8x16_low_1;
 1280|     36|        __m128i mb_type_mask_8x16_0 = _mm_set1_epi8(-1);
 1281|     36|        __m128i mb_type_mask_8x16_1 = _mm_set1_epi8(-1);
 1282|     36|        __m128i mb_type_mask_8x16_low_0, mb_type_mask_8x16_low_1;
 1283|     36|        __m128i mask_8x16_0;
 1284|     36|        __m128i index_arr_0;
 1285|     36|        __m128i inp_data_16x8_0, inp_data_16x8_1;
 1286|     36|        __m128i res_16x8_0, res_16x8_1;
 1287|     36|        __m128i one_8x16 = _mm_set1_epi8(1);
 1288|     36|        __m128i zero_8x16 = _mm_set1_epi8(0);
 1289|       |
 1290|     36|        index_arr_0 = _mm_loadu_si128((__m128i *) index_0);
 1291|     36|        ref_mb_type_8x16_q0 = _mm_set1_epi8(i4_ref_mb_type_q0);
 1292|     36|        ref_mb_type_8x16_q1 = _mm_set1_epi8(i4_ref_mb_type_q1);
 1293|     36|        ref_mb_type_8x16_q2 = _mm_set1_epi8(i4_ref_mb_type_q2);
 1294|     36|        ref_mb_type_8x16_q3 = _mm_set1_epi8(i4_ref_mb_type_q3);
 1295|     36|        if((i4_mb_quard1_part_x >= i4_refarray_wd) && (i4_mb_quard1_part_y >= i4_refarray_ht))
  ------------------
  |  Branch (1295:12): [True: 0, False: 36]
  |  Branch (1295:55): [True: 0, False: 0]
  ------------------
 1296|      0|        {
 1297|       |            // Quard 0
 1298|      0|            ref_mb_type_8x16_0 = ref_mb_type_8x16_q0;
 1299|      0|            ref_mb_type_8x16_1 = ref_mb_type_8x16_q0;
 1300|      0|            mb_type_mask_8x16_0 = _mm_cmpeq_epi8(ref_mb_type_8x16_0, one_8x16);
 1301|      0|            mb_type_mask_8x16_1 = mb_type_mask_8x16_0;
 1302|      0|        }
 1303|     36|        else if((i4_mb_quard1_part_y >= (i4_refarray_ht - 1)) &&
  ------------------
  |  Branch (1303:17): [True: 12, False: 24]
  ------------------
 1304|     12|                (i4_mb_quard1_part_x < i4_refarray_wd))
  ------------------
  |  Branch (1304:17): [True: 12, False: 0]
  ------------------
 1305|     12|        {
 1306|       |            // Quard 0 & 1
 1307|     12|            if(i4_mb_quard1_part_x == 8)
  ------------------
  |  Branch (1307:16): [True: 0, False: 12]
  ------------------
 1308|      0|            {
 1309|      0|                ref_mb_type_8x16_0 = ref_mb_type_8x16_q0;
 1310|      0|                ref_mb_type_8x16_1 = ref_mb_type_8x16_q1;
 1311|      0|            }
 1312|     12|            else if(i4_mb_quard1_part_x < 8)
  ------------------
  |  Branch (1312:21): [True: 12, False: 0]
  ------------------
 1313|     12|            {
 1314|     12|                mb_quard1_part_x_8x16 = _mm_set1_epi8((i4_mb_quard1_part_x << 1));
 1315|     12|                mask_8x16_0 =
 1316|     12|                    _mm_cmplt_epi8(index_arr_0, mb_quard1_part_x_8x16);  // return 1 if a<b, else 0
 1317|       |
 1318|     12|                ref_mb_type_8x16_0 =
 1319|     12|                    _mm_blendv_epi8(ref_mb_type_8x16_q1, ref_mb_type_8x16_q0, mask_8x16_0);
 1320|     12|                ref_mb_type_8x16_1 = ref_mb_type_8x16_q1;
 1321|     12|            }
 1322|      0|            else
 1323|      0|            {
 1324|      0|                mb_quard1_part_x_8x16 = _mm_set1_epi8((i4_mb_quard1_part_x - 8) << 1);
 1325|      0|                mask_8x16_0 =
 1326|      0|                    _mm_cmplt_epi8(index_arr_0, mb_quard1_part_x_8x16);  // return 1 if a<b, else 0
 1327|       |
 1328|      0|                ref_mb_type_8x16_0 = ref_mb_type_8x16_q0;
 1329|      0|                ref_mb_type_8x16_1 =
 1330|      0|                    _mm_blendv_epi8(ref_mb_type_8x16_q1, ref_mb_type_8x16_q0, mask_8x16_0);
 1331|      0|            }
 1332|       |
 1333|     12|            mb_type_mask_8x16_0 = _mm_cmpeq_epi8(ref_mb_type_8x16_0, one_8x16);
 1334|     12|            mb_type_mask_8x16_1 = _mm_cmpeq_epi8(ref_mb_type_8x16_1, one_8x16);
 1335|     12|        }
 1336|     24|        else
 1337|     24|        {
 1338|     24|            if(i4_mb_quard1_part_x >= i4_refarray_wd)
  ------------------
  |  Branch (1338:16): [True: 0, False: 24]
  ------------------
 1339|      0|            {
 1340|      0|                ref_mb_type_8x16_0 = ref_mb_type_8x16_q0;
 1341|      0|                ref_mb_type_8x16_1 = ref_mb_type_8x16_q0;
 1342|       |
 1343|      0|                ref_mb_type_8x16_low_0 = ref_mb_type_8x16_q2;
 1344|      0|                ref_mb_type_8x16_low_1 = ref_mb_type_8x16_q2;
 1345|      0|            }
 1346|     24|            else
 1347|     24|            {
 1348|       |                // Quard 0, 1, 2, 3
 1349|     24|                if(i4_mb_quard1_part_x == 8)
  ------------------
  |  Branch (1349:20): [True: 0, False: 24]
  ------------------
 1350|      0|                {
 1351|      0|                    ref_mb_type_8x16_0 = ref_mb_type_8x16_q0;
 1352|      0|                    ref_mb_type_8x16_1 = ref_mb_type_8x16_q1;
 1353|       |
 1354|      0|                    ref_mb_type_8x16_low_0 = ref_mb_type_8x16_q2;
 1355|      0|                    ref_mb_type_8x16_low_1 = ref_mb_type_8x16_q3;
 1356|      0|                }
 1357|     24|                else if(i4_mb_quard1_part_x < 8)
  ------------------
  |  Branch (1357:25): [True: 24, False: 0]
  ------------------
 1358|     24|                {
 1359|     24|                    mb_quard1_part_x_8x16 = _mm_set1_epi8((i4_mb_quard1_part_x << 1));
 1360|     24|                    mask_8x16_0 = _mm_cmplt_epi8(index_arr_0,
 1361|     24|                                                 mb_quard1_part_x_8x16);  // return 1 if a<b, else 0
 1362|       |
 1363|     24|                    ref_mb_type_8x16_0 =
 1364|     24|                        _mm_blendv_epi8(ref_mb_type_8x16_q1, ref_mb_type_8x16_q0, mask_8x16_0);
 1365|     24|                    ref_mb_type_8x16_1 = ref_mb_type_8x16_q1;
 1366|       |
 1367|     24|                    ref_mb_type_8x16_low_0 =
 1368|     24|                        _mm_blendv_epi8(ref_mb_type_8x16_q3, ref_mb_type_8x16_q2, mask_8x16_0);
 1369|     24|                    ref_mb_type_8x16_low_1 = ref_mb_type_8x16_q3;
 1370|     24|                }
 1371|      0|                else
 1372|      0|                {
 1373|      0|                    mb_quard1_part_x_8x16 = _mm_set1_epi8((i4_mb_quard1_part_x - 8) << 1);
 1374|      0|                    mask_8x16_0 = _mm_cmplt_epi8(index_arr_0,
 1375|      0|                                                 mb_quard1_part_x_8x16);  // return 1 if a<b, else 0
 1376|       |
 1377|      0|                    ref_mb_type_8x16_0 = ref_mb_type_8x16_q0;
 1378|      0|                    ref_mb_type_8x16_1 =
 1379|      0|                        _mm_blendv_epi8(ref_mb_type_8x16_q1, ref_mb_type_8x16_q0, mask_8x16_0);
 1380|       |
 1381|      0|                    ref_mb_type_8x16_low_0 = ref_mb_type_8x16_q2;
 1382|      0|                    ref_mb_type_8x16_low_1 =
 1383|      0|                        _mm_blendv_epi8(ref_mb_type_8x16_q3, ref_mb_type_8x16_q2, mask_8x16_0);
 1384|      0|                }
 1385|     24|                mb_type_mask_8x16_0 = _mm_cmpeq_epi8(ref_mb_type_8x16_0, one_8x16);
 1386|     24|                mb_type_mask_8x16_1 = _mm_cmpeq_epi8(ref_mb_type_8x16_1, one_8x16);
 1387|       |
 1388|     24|                mb_type_mask_8x16_low_0 = _mm_cmpeq_epi8(ref_mb_type_8x16_low_0, one_8x16);
 1389|     24|                mb_type_mask_8x16_low_1 = _mm_cmpeq_epi8(ref_mb_type_8x16_low_1, one_8x16);
 1390|     24|            }
 1391|     24|        }
 1392|       |
 1393|     36|        if(i4_mb_quard1_part_y < i4_refarray_ht - 1)
  ------------------
  |  Branch (1393:12): [True: 24, False: 12]
  ------------------
 1394|     24|        {
 1395|    312|            for(i4_y = 0; i4_y < i4_refarray_ht; i4_y++)
  ------------------
  |  Branch (1395:27): [True: 288, False: 24]
  ------------------
 1396|    288|            {
 1397|    288|                pi2_ref_data_byte = pi2_inp_data + (i4_y * i4_inp_data_stride);
 1398|    288|                inp_data_16x8_0 = _mm_loadu_si128((__m128i *) (pi2_ref_data_byte));
 1399|    288|                inp_data_16x8_1 = _mm_loadu_si128((__m128i *) (pi2_ref_data_byte + 8));
 1400|       |
 1401|    288|                if(i4_y < i4_mb_quard1_part_y)
  ------------------
  |  Branch (1401:20): [True: 94, False: 194]
  ------------------
 1402|     94|                {
 1403|     94|                    res_16x8_0 = _mm_blendv_epi8(zero_8x16, inp_data_16x8_0, mb_type_mask_8x16_0);
 1404|     94|                    res_16x8_1 = _mm_blendv_epi8(zero_8x16, inp_data_16x8_1, mb_type_mask_8x16_1);
 1405|     94|                }
 1406|    194|                else
 1407|    194|                {
 1408|    194|                    res_16x8_0 =
 1409|    194|                        _mm_blendv_epi8(zero_8x16, inp_data_16x8_0, mb_type_mask_8x16_low_0);
 1410|    194|                    res_16x8_1 =
 1411|    194|                        _mm_blendv_epi8(zero_8x16, inp_data_16x8_1, mb_type_mask_8x16_low_1);
 1412|    194|                }
 1413|       |
 1414|    288|                pi2_ref_array_temp = pi2_ref_array + (i4_y * i4_refarray_wd);
 1415|    288|                _mm_storeu_si128((__m128i *) (pi2_ref_array_temp), res_16x8_0);
 1416|    288|                _mm_storeu_si128((__m128i *) (pi2_ref_array_temp + 8), res_16x8_1);
 1417|    288|            }
 1418|     24|        }
 1419|     12|        else
 1420|     12|        {
 1421|    156|            for(i4_y = 0; i4_y < i4_refarray_ht; i4_y++)
  ------------------
  |  Branch (1421:27): [True: 144, False: 12]
  ------------------
 1422|    144|            {
 1423|    144|                pi2_ref_data_byte = pi2_inp_data + (i4_y * i4_inp_data_stride);
 1424|    144|                inp_data_16x8_0 = _mm_loadu_si128((__m128i *) (pi2_ref_data_byte));
 1425|    144|                inp_data_16x8_1 = _mm_loadu_si128((__m128i *) (pi2_ref_data_byte + 8));
 1426|       |
 1427|    144|                res_16x8_0 = _mm_blendv_epi8(zero_8x16, inp_data_16x8_0, mb_type_mask_8x16_0);
 1428|    144|                res_16x8_1 = _mm_blendv_epi8(zero_8x16, inp_data_16x8_1, mb_type_mask_8x16_1);
 1429|       |
 1430|    144|                pi2_ref_array_temp = pi2_ref_array + (i4_y * i4_refarray_wd);
 1431|    144|                _mm_storeu_si128((__m128i *) (pi2_ref_array_temp), res_16x8_0);
 1432|    144|                _mm_storeu_si128((__m128i *) (pi2_ref_array_temp + 8), res_16x8_1);
 1433|    144|            }
 1434|     12|        }
 1435|     36|    }
 1436|     72|    else
 1437|     72|    {
 1438|     72|        WORD8 index_0[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
 1439|     72|        WORD8 even_mask_arr[16] = {0, 1, 4, 5, 8, 9, 12, 13, 2, 3, 6, 7, 10, 11, 14, 15};
 1440|     72|        __m128i ref_mb_type_8x16_q0, ref_mb_type_8x16_q1, ref_mb_type_8x16_q2, ref_mb_type_8x16_q3,
 1441|     72|            mb_quard1_part_x_8x16;
 1442|     72|        __m128i ref_mb_type_8x16_0;
 1443|     72|        __m128i ref_mb_type_8x16_low_0;
 1444|     72|        __m128i mb_type_mask_8x16_0 = _mm_set1_epi8(-1);
 1445|     72|        __m128i mb_type_mask_8x16_low_0;
 1446|     72|        __m128i mask_8x16_0;
 1447|     72|        __m128i index_arr_0, even_mask;
 1448|     72|        __m128i inp_data_16x8_0, inp_data_16x8_1, inp_data_16x8;
 1449|     72|        __m128i res_16x8_0;
 1450|     72|        __m128i one_8x16 = _mm_set1_epi8(1);
 1451|     72|        __m128i zero_8x16 = _mm_set1_epi8(0);
 1452|       |
 1453|     72|        index_arr_0 = _mm_loadu_si128((__m128i *) index_0);
 1454|     72|        even_mask = _mm_loadu_si128((__m128i *) even_mask_arr);
 1455|       |
 1456|     72|        ref_mb_type_8x16_q0 = _mm_set1_epi8(i4_ref_mb_type_q0);
 1457|     72|        ref_mb_type_8x16_q1 = _mm_set1_epi8(i4_ref_mb_type_q1);
 1458|     72|        ref_mb_type_8x16_q2 = _mm_set1_epi8(i4_ref_mb_type_q2);
 1459|     72|        ref_mb_type_8x16_q3 = _mm_set1_epi8(i4_ref_mb_type_q3);
 1460|     72|        if((i4_mb_quard1_part_x >= i4_refarray_wd) && (i4_mb_quard1_part_y >= i4_refarray_ht))
  ------------------
  |  Branch (1460:12): [True: 0, False: 72]
  |  Branch (1460:55): [True: 0, False: 0]
  ------------------
 1461|      0|        {
 1462|       |            // Quard 0
 1463|      0|            ref_mb_type_8x16_0 = ref_mb_type_8x16_q0;
 1464|      0|            mb_type_mask_8x16_0 = _mm_cmpeq_epi8(ref_mb_type_8x16_0, one_8x16);
 1465|      0|        }
 1466|     72|        else if((i4_mb_quard1_part_y >= (i4_refarray_ht - 1)) &&
  ------------------
  |  Branch (1466:17): [True: 24, False: 48]
  ------------------
 1467|     24|                (i4_mb_quard1_part_x < i4_refarray_wd))
  ------------------
  |  Branch (1467:17): [True: 24, False: 0]
  ------------------
 1468|     24|        {
 1469|       |            // Quard 0 & 1
 1470|     24|            mb_quard1_part_x_8x16 = _mm_set1_epi8((i4_mb_quard1_part_x << 1));
 1471|     24|            mask_8x16_0 =
 1472|     24|                _mm_cmplt_epi8(index_arr_0, mb_quard1_part_x_8x16);  // return 1 if a<b, else 0
 1473|       |
 1474|     24|            ref_mb_type_8x16_0 =
 1475|     24|                _mm_blendv_epi8(ref_mb_type_8x16_q1, ref_mb_type_8x16_q0, mask_8x16_0);
 1476|     24|            mb_type_mask_8x16_0 = _mm_cmpeq_epi8(ref_mb_type_8x16_0, one_8x16);
 1477|     24|        }
 1478|     48|        else
 1479|     48|        {
 1480|     48|            if(i4_mb_quard1_part_x >= i4_refarray_wd)
  ------------------
  |  Branch (1480:16): [True: 0, False: 48]
  ------------------
 1481|      0|            {
 1482|       |                // Quard 0 & 2
 1483|      0|                ref_mb_type_8x16_0 = ref_mb_type_8x16_q0;
 1484|      0|                ref_mb_type_8x16_low_0 = ref_mb_type_8x16_q2;
 1485|      0|            }
 1486|     48|            else
 1487|     48|            {
 1488|       |                // Quard 0, 1, 2, 3
 1489|     48|                mb_quard1_part_x_8x16 = _mm_set1_epi8((i4_mb_quard1_part_x << 1));
 1490|     48|                mask_8x16_0 =
 1491|     48|                    _mm_cmplt_epi8(index_arr_0, mb_quard1_part_x_8x16);  // return 1 if a<b, else 0
 1492|       |
 1493|     48|                ref_mb_type_8x16_0 =
 1494|     48|                    _mm_blendv_epi8(ref_mb_type_8x16_q1, ref_mb_type_8x16_q0, mask_8x16_0);
 1495|     48|                ref_mb_type_8x16_low_0 =
 1496|     48|                    _mm_blendv_epi8(ref_mb_type_8x16_q3, ref_mb_type_8x16_q2, mask_8x16_0);
 1497|       |
 1498|     48|                mb_type_mask_8x16_0 = _mm_cmpeq_epi8(ref_mb_type_8x16_0, one_8x16);
 1499|     48|                mb_type_mask_8x16_low_0 = _mm_cmpeq_epi8(ref_mb_type_8x16_low_0, one_8x16);
 1500|     48|            }
 1501|     48|        }
 1502|       |
 1503|     72|        if(i4_mb_quard1_part_y < i4_refarray_ht - 1)
  ------------------
  |  Branch (1503:12): [True: 48, False: 24]
  ------------------
 1504|     48|        {
 1505|    356|            for(i4_y = 0; i4_y < i4_refarray_ht; i4_y++)
  ------------------
  |  Branch (1505:27): [True: 308, False: 48]
  ------------------
 1506|    308|            {
 1507|    308|                pi2_ref_data_byte = pi2_inp_data + (i4_y * i4_inp_data_stride);
 1508|    308|                inp_data_16x8_0 = _mm_loadu_si128((__m128i *) (pi2_ref_data_byte));
 1509|    308|                inp_data_16x8_1 = _mm_loadu_si128((__m128i *) (pi2_ref_data_byte + 8));
 1510|       |
 1511|    308|                inp_data_16x8_0 = _mm_shuffle_epi8(inp_data_16x8_0, even_mask);
 1512|    308|                inp_data_16x8_1 = _mm_shuffle_epi8(inp_data_16x8_1, even_mask);
 1513|       |
 1514|    308|                inp_data_16x8 = _mm_unpacklo_epi64(inp_data_16x8_0, inp_data_16x8_1);
 1515|    308|                if(i4_y < i4_mb_quard1_part_y)
  ------------------
  |  Branch (1515:20): [True: 104, False: 204]
  ------------------
 1516|    104|                {
 1517|    104|                    res_16x8_0 = _mm_blendv_epi8(zero_8x16, inp_data_16x8, mb_type_mask_8x16_0);
 1518|    104|                }
 1519|    204|                else
 1520|    204|                {
 1521|    204|                    res_16x8_0 = _mm_blendv_epi8(zero_8x16, inp_data_16x8, mb_type_mask_8x16_low_0);
 1522|    204|                }
 1523|       |
 1524|    308|                pi2_ref_array_temp = pi2_ref_array + (i4_y * i4_refarray_wd);
 1525|    308|                _mm_storeu_si128((__m128i *) (pi2_ref_array_temp), res_16x8_0);
 1526|    308|            }
 1527|     48|        }
 1528|     24|        else
 1529|     24|        {
 1530|    192|            for(i4_y = 0; i4_y < i4_refarray_ht; i4_y++)
  ------------------
  |  Branch (1530:27): [True: 168, False: 24]
  ------------------
 1531|    168|            {
 1532|    168|                pi2_ref_data_byte = pi2_inp_data + (i4_y * i4_inp_data_stride);
 1533|    168|                inp_data_16x8_0 = _mm_loadu_si128((__m128i *) (pi2_ref_data_byte));
 1534|    168|                inp_data_16x8_1 = _mm_loadu_si128((__m128i *) (pi2_ref_data_byte + 8));
 1535|       |
 1536|    168|                inp_data_16x8_0 = _mm_shuffle_epi8(inp_data_16x8_0, even_mask);
 1537|    168|                inp_data_16x8_1 = _mm_shuffle_epi8(inp_data_16x8_1, even_mask);
 1538|    168|                inp_data_16x8 = _mm_unpacklo_epi64(inp_data_16x8_0, inp_data_16x8_1);
 1539|       |
 1540|    168|                res_16x8_0 = _mm_blendv_epi8(zero_8x16, inp_data_16x8, mb_type_mask_8x16_0);
 1541|    168|                pi2_ref_array_temp = pi2_ref_array + (i4_y * i4_refarray_wd);
 1542|    168|                _mm_storeu_si128((__m128i *) (pi2_ref_array_temp), res_16x8_0);
 1543|    168|            }
 1544|     24|        }
 1545|     72|    }
 1546|    108|}

_Z17iv_aligned_mallocPvii:
   82|  25.8k|{
   83|  25.8k|    void *buf = NULL;
   84|  25.8k|    (void) ctxt;
   85|  25.8k|    if(0 != posix_memalign(&buf, alignment, size))
  ------------------
  |  Branch (85:8): [True: 0, False: 25.8k]
  ------------------
   86|      0|    {
   87|      0|        return NULL;
   88|      0|    }
   89|  25.8k|    return buf;
   90|  25.8k|}
_Z15iv_aligned_freePvS_:
   93|  25.8k|{
   94|  25.8k|    (void) ctxt;
   95|  25.8k|    free(buf);
   96|  25.8k|}
_ZN5CodecC2E17IV_COLOR_FORMAT_Tm:
  126|    155|{
  127|    155|    mColorFormat = colorFormat;
  128|    155|    mNumCores = numCores;
  129|    155|    mCodec = nullptr;
  130|    155|    mWidth = 0;
  131|    155|    mHeight = 0;
  132|       |
  133|    155|    memset(&mOutBufHandle, 0, sizeof(mOutBufHandle));
  134|    155|}
_ZN5CodecD2Ev:
  136|    155|Codec::~Codec() {}
_ZN5Codec11createCodecEv:
  138|    155|{
  139|    155|    IV_API_CALL_STATUS_T ret;
  140|    155|    ih264d_create_ip_t create_ip{};
  141|    155|    ih264d_create_op_t create_op{};
  142|    155|    void *fxns = (void *) &ivd_api_function;
  ------------------
  |  |   55|    155|#define ivd_api_function isvcd_api_function
  ------------------
  143|       |
  144|    155|    create_ip.s_ivd_create_ip_t.e_cmd = IVD_CMD_CREATE;
  145|    155|    create_ip.s_ivd_create_ip_t.u4_share_disp_buf = 0;
  146|    155|    create_ip.s_ivd_create_ip_t.e_output_format = mColorFormat;
  147|    155|    create_ip.s_ivd_create_ip_t.pf_aligned_alloc = iv_aligned_malloc;
  148|    155|    create_ip.s_ivd_create_ip_t.pf_aligned_free = iv_aligned_free;
  149|    155|    create_ip.s_ivd_create_ip_t.pv_mem_ctxt = NULL;
  150|    155|    create_ip.s_ivd_create_ip_t.u4_size = sizeof(ih264d_create_ip_t);
  151|    155|    create_op.s_ivd_create_op_t.u4_size = sizeof(ih264d_create_op_t);
  152|       |
  153|    155|    ret = ivd_api_function(NULL, (void *) &create_ip, (void *) &create_op);
  ------------------
  |  |   55|    155|#define ivd_api_function isvcd_api_function
  ------------------
  154|    155|    if(ret != IV_SUCCESS)
  ------------------
  |  Branch (154:8): [True: 1, False: 154]
  ------------------
  155|      1|    {
  156|      1|        return;
  157|      1|    }
  158|    154|    mCodec = (iv_obj_t *) create_op.s_ivd_create_op_t.pv_handle;
  159|    154|    mCodec->pv_fxns = fxns;
  160|    154|    mCodec->u4_size = sizeof(iv_obj_t);
  161|    154|}
_ZN5Codec11deleteCodecEv:
  164|    155|{
  165|    155|    ivd_delete_ip_t delete_ip{};
  166|    155|    ivd_delete_op_t delete_op{};
  167|       |
  168|    155|    delete_ip.e_cmd = IVD_CMD_DELETE;
  169|    155|    delete_ip.u4_size = sizeof(ivd_delete_ip_t);
  170|    155|    delete_op.u4_size = sizeof(ivd_delete_op_t);
  171|       |
  172|    155|    ivd_api_function(mCodec, (void *) &delete_ip, (void *) &delete_op);
  ------------------
  |  |   55|    155|#define ivd_api_function isvcd_api_function
  ------------------
  173|    155|}
_ZN5Codec10resetCodecEv:
  176|    354|{
  177|    354|    ivd_ctl_reset_ip_t s_ctl_ip{};
  178|    354|    ivd_ctl_reset_op_t s_ctl_op{};
  179|       |
  180|    354|    s_ctl_ip.e_cmd = IVD_CMD_VIDEO_CTL;
  181|    354|    s_ctl_ip.e_sub_cmd = IVD_CMD_CTL_RESET;
  182|    354|    s_ctl_ip.u4_size = sizeof(ivd_ctl_reset_ip_t);
  183|    354|    s_ctl_op.u4_size = sizeof(ivd_ctl_reset_op_t);
  184|       |
  185|    354|    ivd_api_function(mCodec, (void *) &s_ctl_ip, (void *) &s_ctl_op);
  ------------------
  |  |   55|    354|#define ivd_api_function isvcd_api_function
  ------------------
  186|    354|}
_ZN5Codec8setCoresEv:
  189|    155|{
  190|    155|    ih264d_ctl_set_num_cores_ip_t s_ctl_ip{};
  191|    155|    ih264d_ctl_set_num_cores_op_t s_ctl_op{};
  192|       |
  193|    155|    s_ctl_ip.e_cmd = IVD_CMD_VIDEO_CTL;
  194|    155|    s_ctl_ip.e_sub_cmd = (IVD_CONTROL_API_COMMAND_TYPE_T) IH264D_CMD_CTL_SET_NUM_CORES;
  195|    155|    s_ctl_ip.u4_num_cores = mNumCores;
  196|    155|    s_ctl_ip.u4_size = sizeof(ih264d_ctl_set_num_cores_ip_t);
  197|    155|    s_ctl_op.u4_size = sizeof(ih264d_ctl_set_num_cores_op_t);
  198|       |
  199|    155|    ivd_api_function(mCodec, (void *) &s_ctl_ip, (void *) &s_ctl_op);
  ------------------
  |  |   55|    155|#define ivd_api_function isvcd_api_function
  ------------------
  200|    155|}
_ZN5Codec11setTgtLayerEm:
  203|    155|{
  204|    155|    isvcd_set_target_layer_ip_t s_ctl_set_target_layer_ip{};
  205|    155|    isvcd_set_target_layer_op_t s_ctl_set_target_layer_op{};
  206|       |
  207|    155|    s_ctl_set_target_layer_ip.e_cmd = IVD_CMD_VIDEO_CTL;
  208|    155|    s_ctl_set_target_layer_ip.e_sub_cmd =
  209|    155|        (IVD_CONTROL_API_COMMAND_TYPE_T) ISVCD_CMD_CTL_SET_TGT_LAYER;
  210|    155|    s_ctl_set_target_layer_ip.u1_tgt_priority_id = 63;
  211|    155|    s_ctl_set_target_layer_ip.u1_tgt_temp_id = 7;
  212|    155|    s_ctl_set_target_layer_ip.u1_tgt_quality_id = 0;
  213|    155|    s_ctl_set_target_layer_ip.u1_tgt_dep_id = TgtLayer;
  214|    155|    s_ctl_set_target_layer_ip.u4_size = sizeof(isvcd_set_target_layer_ip_t);
  215|    155|    s_ctl_set_target_layer_op.u4_size = sizeof(isvcd_set_target_layer_op_t);
  216|       |
  217|    155|    ivd_api_function(mCodec, (void *) &s_ctl_set_target_layer_ip,
  ------------------
  |  |   55|    155|#define ivd_api_function isvcd_api_function
  ------------------
  218|    155|                     (void *) &s_ctl_set_target_layer_op);
  219|    155|}
_ZN5Codec9setParamsE23IVD_VIDEO_DECODE_MODE_T:
  222|    310|{
  223|    310|    ivd_ctl_set_config_ip_t s_ctl_ip{};
  224|    310|    ivd_ctl_set_config_op_t s_ctl_op{};
  225|       |
  226|    310|    s_ctl_ip.u4_disp_wd = 0;
  227|    310|    s_ctl_ip.e_frm_skip_mode = IVD_SKIP_NONE;
  228|    310|    s_ctl_ip.e_frm_out_mode = IVD_DISPLAY_FRAME_OUT;
  229|    310|    s_ctl_ip.e_vid_dec_mode = mode;
  230|    310|    s_ctl_ip.e_cmd = IVD_CMD_VIDEO_CTL;
  231|    310|    s_ctl_ip.e_sub_cmd = IVD_CMD_CTL_SETPARAMS;
  232|    310|    s_ctl_ip.u4_size = sizeof(ivd_ctl_set_config_ip_t);
  233|    310|    s_ctl_op.u4_size = sizeof(ivd_ctl_set_config_op_t);
  234|       |
  235|    310|    ivd_api_function(mCodec, (void *) &s_ctl_ip, (void *) &s_ctl_op);
  ------------------
  |  |   55|    310|#define ivd_api_function isvcd_api_function
  ------------------
  236|    310|}
_ZN5Codec15setArchitectureE10IVD_ARCH_T:
  239|    155|{
  240|    155|    ih264d_ctl_set_processor_ip_t s_ctl_ip{};
  241|    155|    ih264d_ctl_set_processor_op_t s_ctl_op{};
  242|       |
  243|    155|    s_ctl_ip.e_cmd = IVD_CMD_VIDEO_CTL;
  244|    155|    s_ctl_ip.e_sub_cmd = (IVD_CONTROL_API_COMMAND_TYPE_T) IH264D_CMD_CTL_SET_PROCESSOR;
  245|    155|    s_ctl_ip.u4_arch = arch;
  246|    155|    s_ctl_ip.u4_soc = SOC_GENERIC;
  247|    155|    s_ctl_ip.u4_size = sizeof(ih264d_ctl_set_processor_ip_t);
  248|    155|    s_ctl_op.u4_size = sizeof(ih264d_ctl_set_processor_op_t);
  249|       |
  250|    155|    ivd_api_function(mCodec, (void *) &s_ctl_ip, (void *) &s_ctl_op);
  ------------------
  |  |   55|    155|#define ivd_api_function isvcd_api_function
  ------------------
  251|    155|}
_ZN5Codec9freeFrameEv:
  254|    545|{
  255|  1.52k|    for(unsigned int i = 0; i < mOutBufHandle.u4_num_bufs; i++)
  ------------------
  |  Branch (255:29): [True: 981, False: 545]
  ------------------
  256|    981|    {
  257|    981|        if(mOutBufHandle.pu1_bufs[i])
  ------------------
  |  Branch (257:12): [True: 981, False: 0]
  ------------------
  258|    981|        {
  259|       |            iv_aligned_free(NULL, mOutBufHandle.pu1_bufs[i]);
  260|    981|            mOutBufHandle.pu1_bufs[i] = nullptr;
  261|    981|        }
  262|    981|    }
  263|    545|}
_ZN5Codec10allocFrameEv:
  266|    390|{
  267|    390|    size_t sizes[4] = {0};
  268|    390|    UWORD32 num_bufs = 0;
  269|       |
  270|    390|    freeFrame();
  271|       |
  272|    390|    memset(&mOutBufHandle, 0, sizeof(mOutBufHandle));
  273|       |
  274|    390|    switch(mColorFormat)
  275|    390|    {
  276|     92|        case IV_YUV_420SP_UV:
  ------------------
  |  Branch (276:9): [True: 92, False: 298]
  ------------------
  277|     92|            [[fallthrough]];
  278|    187|        case IV_YUV_420SP_VU:
  ------------------
  |  Branch (278:9): [True: 95, False: 295]
  ------------------
  279|    187|            sizes[0] = mWidth * mHeight;
  280|    187|            sizes[1] = mWidth * mHeight >> 1;
  281|    187|            num_bufs = 2;
  282|    187|            break;
  283|      0|        case IV_YUV_422ILE:
  ------------------
  |  Branch (283:9): [True: 0, False: 390]
  ------------------
  284|      0|            sizes[0] = mWidth * mHeight * 2;
  285|      0|            num_bufs = 1;
  286|      0|            break;
  287|      1|        case IV_RGB_565:
  ------------------
  |  Branch (287:9): [True: 1, False: 389]
  ------------------
  288|      1|            sizes[0] = mWidth * mHeight * 2;
  289|      1|            num_bufs = 1;
  290|      1|            break;
  291|      0|        case IV_RGBA_8888:
  ------------------
  |  Branch (291:9): [True: 0, False: 390]
  ------------------
  292|      0|            sizes[0] = mWidth * mHeight * 4;
  293|      0|            num_bufs = 1;
  294|      0|            break;
  295|    202|        case IV_YUV_420P:
  ------------------
  |  Branch (295:9): [True: 202, False: 188]
  ------------------
  296|    202|            [[fallthrough]];
  297|    202|        default:
  ------------------
  |  Branch (297:9): [True: 0, False: 390]
  ------------------
  298|    202|            sizes[0] = mWidth * mHeight;
  299|    202|            sizes[1] = mWidth * mHeight >> 2;
  300|    202|            sizes[2] = mWidth * mHeight >> 2;
  301|    202|            num_bufs = 3;
  302|    202|            break;
  303|    390|    }
  304|    390|    mOutBufHandle.u4_num_bufs = num_bufs;
  305|  1.37k|    for(UWORD32 i = 0; i < num_bufs; i++)
  ------------------
  |  Branch (305:24): [True: 981, False: 390]
  ------------------
  306|    981|    {
  307|    981|        mOutBufHandle.u4_min_out_buf_size[i] = sizes[i];
  308|       |        mOutBufHandle.pu1_bufs[i] = (UWORD8 *) iv_aligned_malloc(NULL, 16, sizes[i]);
  309|    981|    }
  310|    390|}
_ZN5Codec12decodeHeaderEPKhm:
  313|    155|{
  314|    155|    setParams(IVD_DECODE_HEADER);
  315|    155|    size_t numDecodeCalls = 0;
  316|  11.9k|    while(size > 0 && numDecodeCalls < kMaxNumDecodeCalls)
  ------------------
  |  Branch (316:11): [True: 11.9k, False: 44]
  |  Branch (316:23): [True: 11.8k, False: 111]
  ------------------
  317|  11.8k|    {
  318|  11.8k|        IV_API_CALL_STATUS_T ret;
  319|  11.8k|        isvcd_video_decode_ip_t s_video_decode_ip;
  320|  11.8k|        isvcd_video_decode_op_t s_video_decode_op;
  321|  11.8k|        size_t bytes_consumed;
  322|  11.8k|        memset(&s_video_decode_ip, 0, sizeof(s_video_decode_ip));
  323|  11.8k|        memset(&s_video_decode_op, 0, sizeof(s_video_decode_op));
  324|       |
  325|  11.8k|        s_video_decode_ip.s_ivd_video_decode_ip_t.e_cmd = IVD_CMD_VIDEO_DECODE;
  326|  11.8k|        s_video_decode_ip.s_ivd_video_decode_ip_t.u4_ts = 0;
  327|  11.8k|        s_video_decode_ip.s_ivd_video_decode_ip_t.pv_stream_buffer = (void *) data;
  328|  11.8k|        s_video_decode_ip.s_ivd_video_decode_ip_t.u4_num_Bytes = size;
  329|  11.8k|        s_video_decode_ip.s_ivd_video_decode_ip_t.u4_size = sizeof(s_video_decode_ip);
  330|  11.8k|        s_video_decode_op.s_ivd_video_decode_op_t.u4_size = sizeof(s_video_decode_op);
  331|       |
  332|  11.8k|        ret = ivd_api_function(mCodec, (void *) &s_video_decode_ip, (void *) &s_video_decode_op);
  ------------------
  |  |   55|  11.8k|#define ivd_api_function isvcd_api_function
  ------------------
  333|  11.8k|        (void(ret));
  334|  11.8k|        bytes_consumed = s_video_decode_op.s_ivd_video_decode_op_t.u4_num_bytes_consumed;
  335|       |        /* If no bytes are consumed, then consume 4 bytes to ensure fuzzer proceeds
  336|       |         * to feed next data */
  337|  11.8k|        if(!bytes_consumed) bytes_consumed = 4;
  ------------------
  |  Branch (337:12): [True: 11.2k, False: 599]
  ------------------
  338|       |
  339|  11.8k|        bytes_consumed = std::min(size, bytes_consumed);
  340|       |
  341|  11.8k|        data += bytes_consumed;
  342|  11.8k|        size -= bytes_consumed;
  343|  11.8k|        numDecodeCalls++;
  344|       |
  345|  11.8k|        mWidth = std::min(s_video_decode_op.s_ivd_video_decode_op_t.u4_pic_wd, (UWORD32) 10240);
  346|  11.8k|        mHeight = std::min(s_video_decode_op.s_ivd_video_decode_op_t.u4_pic_ht, (UWORD32) 10240);
  347|       |
  348|       |        /* Break after successful header decode */
  349|  11.8k|        if(mWidth && mHeight)
  ------------------
  |  Branch (349:12): [True: 0, False: 11.8k]
  |  Branch (349:22): [True: 0, False: 0]
  ------------------
  350|      0|        {
  351|      0|            break;
  352|      0|        }
  353|  11.8k|    }
  354|       |    /* if width / height are invalid, set them to defaults */
  355|    155|    if(!mWidth) mWidth = 1920;
  ------------------
  |  Branch (355:8): [True: 155, False: 0]
  ------------------
  356|    155|    if(!mHeight) mHeight = 1088;
  ------------------
  |  Branch (356:8): [True: 155, False: 0]
  ------------------
  357|    155|}
_ZN5Codec11decodeFrameEPKhmPm:
  360|  8.55k|{
  361|  8.55k|    IV_API_CALL_STATUS_T ret;
  362|  8.55k|    isvcd_video_decode_ip_t s_video_decode_ip{};
  363|  8.55k|    isvcd_video_decode_op_t s_video_decode_op{};
  364|       |
  365|  8.55k|    s_video_decode_ip.s_ivd_video_decode_ip_t.e_cmd = IVD_CMD_VIDEO_DECODE;
  366|  8.55k|    s_video_decode_ip.s_ivd_video_decode_ip_t.u4_ts = 0;
  367|  8.55k|    s_video_decode_ip.s_ivd_video_decode_ip_t.pv_stream_buffer = (void *) data;
  368|  8.55k|    s_video_decode_ip.s_ivd_video_decode_ip_t.u4_num_Bytes = size;
  369|  8.55k|    s_video_decode_ip.s_ivd_video_decode_ip_t.u4_size = sizeof(s_video_decode_ip);
  370|  8.55k|    s_video_decode_ip.s_ivd_video_decode_ip_t.s_out_buffer = mOutBufHandle;
  371|       |
  372|  8.55k|    s_video_decode_op.s_ivd_video_decode_op_t.u4_size = sizeof(s_video_decode_op);
  373|  8.55k|    s_video_decode_op.s_ivd_video_decode_op_t.u4_num_bytes_consumed = 0;
  374|  8.55k|    s_video_decode_op.s_ivd_video_decode_op_t.u4_pic_wd = 0;
  375|  8.55k|    s_video_decode_op.s_ivd_video_decode_op_t.u4_pic_ht = 0;
  376|       |
  377|  8.55k|    ret = ivd_api_function(mCodec, (void *) &s_video_decode_ip, (void *) &s_video_decode_op);
  ------------------
  |  |   55|  8.55k|#define ivd_api_function isvcd_api_function
  ------------------
  378|       |
  379|       |    /* In case of change in resolution, reset codec and feed the same data again
  380|       |     */
  381|  8.55k|    if(IVD_RES_CHANGED == (s_video_decode_op.s_ivd_video_decode_op_t.u4_error_code & 0xFF))
  ------------------
  |  Branch (381:8): [True: 354, False: 8.19k]
  ------------------
  382|    354|    {
  383|    354|        resetCodec();
  384|    354|        ret = ivd_api_function(mCodec, (void *) &s_video_decode_ip, (void *) &s_video_decode_op);
  ------------------
  |  |   55|    354|#define ivd_api_function isvcd_api_function
  ------------------
  385|    354|    }
  386|  8.55k|    *bytesConsumed = s_video_decode_op.s_ivd_video_decode_op_t.u4_num_bytes_consumed;
  387|       |
  388|       |    /* If no bytes are consumed, then consume 4 bytes to ensure fuzzer proceeds
  389|       |     * to feed next data */
  390|  8.55k|    if(!*bytesConsumed)
  ------------------
  |  Branch (390:8): [True: 2.62k, False: 5.92k]
  ------------------
  391|  2.62k|    {
  392|  2.62k|        *bytesConsumed = 4;
  393|  2.62k|    }
  394|  8.55k|    if(s_video_decode_op.s_ivd_video_decode_op_t.u4_pic_wd &&
  ------------------
  |  Branch (394:8): [True: 3.89k, False: 4.65k]
  ------------------
  395|  3.89k|       s_video_decode_op.s_ivd_video_decode_op_t.u4_pic_ht &&
  ------------------
  |  Branch (395:8): [True: 3.89k, False: 0]
  ------------------
  396|  3.89k|       (mWidth != s_video_decode_op.s_ivd_video_decode_op_t.u4_pic_wd ||
  ------------------
  |  Branch (396:9): [True: 231, False: 3.66k]
  ------------------
  397|  3.66k|        mHeight != s_video_decode_op.s_ivd_video_decode_op_t.u4_pic_ht))
  ------------------
  |  Branch (397:9): [True: 4, False: 3.65k]
  ------------------
  398|    235|    {
  399|    235|        mWidth = std::min(s_video_decode_op.s_ivd_video_decode_op_t.u4_pic_wd, (UWORD32) 10240);
  400|    235|        mHeight = std::min(s_video_decode_op.s_ivd_video_decode_op_t.u4_pic_ht, (UWORD32) 10240);
  401|    235|        allocFrame();
  402|    235|    }
  403|       |
  404|  8.55k|    return ret;
  405|  8.55k|}
LLVMFuzzerTestOneInput:
  408|    155|{
  409|    155|    if(size < 1)
  ------------------
  |  Branch (409:8): [True: 0, False: 155]
  ------------------
  410|      0|    {
  411|      0|        return 0;
  412|      0|    }
  413|    155|    size_t colorFormatOfst = std::min((size_t) OFFSET_COLOR_FORMAT, size - 1);
  414|    155|    size_t numCoresOfst = std::min((size_t) OFFSET_NUM_CORES, size - 1);
  415|    155|    size_t architectureOfst = std::min((size_t) OFFSET_ARCH, size - 1);
  416|    155|    size_t architectureIdx = data[architectureOfst] % kSupportedArchitectures;
  417|    155|    IVD_ARCH_T arch = (IVD_ARCH_T) supportedArchitectures[architectureIdx];
  418|    155|    size_t colorFormatIdx = data[colorFormatOfst] % kSupportedColorFormats;
  419|    155|    IV_COLOR_FORMAT_T colorFormat = (IV_COLOR_FORMAT_T) (supportedColorFormats[colorFormatIdx]);
  420|    155|    uint32_t numCores = (data[numCoresOfst] % kMaxCores) + 1;
  421|       |
  422|    155|    size_t numTgtLayerOfst = std::min((size_t) OFFSET_TGT_LAYER, size - 1);
  423|    155|    uint32_t tgtLayer = (data[numTgtLayerOfst] % kMaxTgtLayer);
  424|       |
  425|    155|    size_t numDecodeCalls = 0;
  426|    155|    Codec *codec = new Codec(colorFormat, numCores);
  427|    155|    codec->createCodec();
  428|    155|    codec->setArchitecture(arch);
  429|    155|    codec->setCores();
  430|    155|    codec->setTgtLayer(tgtLayer);
  431|    155|    codec->decodeHeader(data, size);
  432|    155|    codec->setParams(IVD_DECODE_FRAME);
  433|    155|    codec->allocFrame();
  434|       |
  435|  8.70k|    while(size > 0 && numDecodeCalls < kMaxNumDecodeCalls)
  ------------------
  |  Branch (435:11): [True: 8.60k, False: 102]
  |  Branch (435:23): [True: 8.55k, False: 53]
  ------------------
  436|  8.55k|    {
  437|  8.55k|        IV_API_CALL_STATUS_T ret;
  438|  8.55k|        size_t bytesConsumed;
  439|  8.55k|        ret = codec->decodeFrame(data, size, &bytesConsumed);
  440|  8.55k|        (void(ret));
  441|  8.55k|        bytesConsumed = std::min(size, bytesConsumed);
  442|  8.55k|        data += bytesConsumed;
  443|  8.55k|        size -= bytesConsumed;
  444|  8.55k|        numDecodeCalls++;
  445|  8.55k|    }
  446|       |
  447|    155|    codec->freeFrame();
  448|    155|    codec->deleteCodec();
  449|    155|    delete codec;
  450|    155|    return 0;
  451|    155|}

